/* global constants (no :root) */
html{
  --radius:14px;
  --pad:18px;
  --gap:12px;

--verified:#b9a7ff; /* rich purple default */

  /* defaults so clicks always work */
  --click-bg:var(--bg);
  --click-bg-hover:var(--panel);
}


svg{
  fill:currentColor;
  width:1em;
  height:1em;
  vertical-align:-0.125em;
}

html,
body{
  background: var(--bg);
  overscroll-behavior: none;
}

/* kill browser autofill yellow */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus{
  -webkit-text-fill-color: var(--fg);
  -webkit-box-shadow: 0 0 0px 1000px var(--bg) inset;
  transition: background-color 9999s ease-in-out 0s;
}

[hidden]{
  display:none !important;
}

/* =========================
   Base
   ========================= */
*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:radial-gradient(ellipse at top,var(--panel) 0%,var(--bg) 60%);
  color:var(--muted);
}

a{color:inherit;text-decoration:none}

hr{
  border:0;
  border-top:1px solid var(--line);
  margin:16px 0;
}

h1,h2,h3{
  margin:0;
  line-height:1.15;
  color:var(--fg);
}

p{line-height:1.4}
ul{padding-left:18px}

/* =========================
   @handles / mentions
   ========================= */
/* generic class */
.handle,
.mention{
  color:var(--handle);
  font-weight:700;
}

a[href^="mailto:"]{
  color: var(--fg);
  font-weight: 650;
}

a[href^="mailto:"]:hover{
  text-decoration: underline;
  filter: brightness(1.05);
}

/* prevent underline noise on hover */
.handle:hover,
.mention:hover,
a[href^="/@"]:hover{
  text-decoration:none;
  filter:brightness(1.05);
}

/* =========================
   Layout
   ========================= */
.wrap{max-width:980px;margin:18px auto;padding:0 14px}
.stack{display:flex;flex-direction:column;gap:var(--gap)}
.row{display:flex;gap:var(--gap);align-items:center;flex-wrap:wrap}
.actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}

.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:var(--gap)}
@media (max-width:720px){.grid-2{grid-template-columns:1fr}}

/* =========================
   Cards
   ========================= */
.card{
  border:1px solid var(--line);
  background:var(--panel);
  padding:var(--pad);
  border-radius:var(--radius);
  margin:0 0 16px;
}
.card:last-child{margin-bottom:0}

/* =========================
   Notices
   ========================= */
.notice,
.error{
  padding:10px 12px;
  margin:10px 0;
  border-radius:12px;
  border:1px solid var(--line);
}

.notice{
  color:var(--muted);
  border-style:dashed;
}

.error{
  color:var(--danger);
  border-color:var(--danger);
}

/* =========================
   Forms
   ========================= */
label{
  display:block;
  margin:0 0 6px;
  color:var(--muted);
  font-weight:650;
  font-size:.95rem;
}

.field{display:flex;flex-direction:column}

input,
textarea,
select{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:var(--bg);
  color:var(--fg);
  outline:none;
}

textarea{
  min-height:140px;
  resize:vertical;
  line-height:1.35;
}

input:focus,
textarea:focus,
select:focus{
  border-color:var(--muted);
}

input::placeholder,
textarea::placeholder{color:var(--line)}

.help{
  margin-top:6px;
  color:var(--muted);
  font-size:.92rem;
}

input:disabled,
textarea:disabled,
input[readonly],
textarea[readonly]{
  background:var(--panel);
  color:var(--muted);
}

/* =========================
   CLICK SYSTEM (ONLY)
   ========================= */
.click{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:6px 10px;
  border-radius:12px;
  border:1px solid var(--line);
  background:var(--click-bg);
  color:var(--muted);
  font-size:12px;
  font-weight:750;
  line-height:1;
  cursor:pointer;
  user-select:none;
  text-decoration:none;
}

.click,
.click:link,
.click:visited,
.click:hover,
.click:active,
.click:focus,
.click:focus-visible{
  text-decoration:none;
}

.click:hover{
  background:var(--click-bg-hover);
  color:var(--fg);

}

.click:active{transform:translateY(1px)}

.click svg{
  width:16px;
  height:16px;
  fill:currentColor;
}

.click-sm{padding:6px 10px;font-size:12px}
.click-lg{padding:10px 14px;font-size:14px}

.is-active{
  color:var(--fg);
  border-color:var(--muted);
}

.click-danger{
  color:var(--danger);
  border-color:var(--danger);
}

.click-gold{
  color:var(--gold);
  border-color:var(--gold);
}

.click-handle{
  color:var(--handle);
  border-color:var(--handle);
}

.click-verified{
  color:var(--verified);
  border-color:var(--verified);
}


button{font:inherit}

/* =========================
   Topbar
   ========================= */
.topbar{
  position:sticky;
  top:0;
  z-index:10;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 16px;
  border-bottom:1px solid var(--line);
  background:var(--panel);
}

.topbar nav{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.brand{display:flex;align-items:center;gap:6px}

.brand-logo{
  height:54px;
  aspect-ratio:1259 / 359;
  background:var(--fg);
  -webkit-mask:url('/assets/logo.png') no-repeat left center / contain;
  mask:url('/assets/logo.png') no-repeat left center / contain;
}

/* new standalone big logo */
.logo-xl{
  width: min(360px, 80%);
  aspect-ratio: 1259 / 359;
  margin: 0 auto;
  display: block;

  background: var(--fg);
  -webkit-mask: url('/assets/logo.png') no-repeat center / contain;
  mask: url('/assets/logo.png') no-repeat center / contain;
}

@media (max-width: 720px){
  /* square logo on mobile */
  .brand-logo{
    height:36px;
    aspect-ratio:1 / 1;
    -webkit-mask:url('/assets/logo-square.png') no-repeat center / contain;
    mask:url('/assets/logo-square.png') no-repeat center / contain;
  }

  /* icon-only ONLY for buttons that actually have an svg (keeps Sign Up/Login text) */
  .topbar .click-lg:not(.click-handle):has(svg){
    padding:6px;
    font-size:0;
  }

  .topbar .click-lg:not(.click-handle):has(svg) span{
    display:none;
  }

  .topbar .click svg{
    width:18px;
    height:18px;
  }

  /* hide logout on mobile */
  .topbar nav a[href$="logout.php"]{
    display:none;
  }
}

/* =========================
   Profile
   ========================= */
.profile-card{position:relative}

.profile-name{
  color:var(--fg);
}

.profile-header{
  display:flex;
  gap:14px;
  align-items:flex-start;
}

.profile-avatar{
  width:160px;
  height:160px;
  border-radius:12px;
  border:1px solid var(--line);
  background:var(--bg);
  object-fit:cover;
}

.profile-socials{
  position:absolute;
  top:12px;
  right:12px;
  display:flex;
  gap:8px;
}

@media (max-width:720px){
  .profile-card{display:grid}
  .profile-header{grid-row:1}
  .profile-socials{
    position:static;
    grid-row:2;
    margin-top:10px;
    justify-content:flex-start;
    flex-wrap:wrap;
  }
}

.profile-stats div{color:var(--fg)}
.profile-stats b{
  color:var(--muted);
  font-weight:650;
}

/* =========================
   Lists
   ========================= */
.list{display:flex;flex-direction:column;gap:10px}

.list-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:var(--bg);
}

.list-left{display:flex;gap:10px;align-items:center;min-width:0}
.list-main{display:flex;flex-direction:column;gap:2px;min-width:0}

.list-title{
  color:var(--fg);
  font-weight:800;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.list-sub{
  color:var(--muted);
  font-size:12px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.list-actions{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}

/* friends page: push tab buttons to the right */
.friends-tabs{
  margin-left:auto;
}

/* reduce avatar size in lists without touching profile avatar */
.list-left img{
  width:36px;
  height:36px;
}

@media (max-width:520px){
  .list-row{flex-direction:column;align-items:stretch}
  .list-actions{justify-content:flex-end}
}

/* =========================
   Top 8
   ========================= */
.top8-grid{
  display:grid;
  grid-template-columns:repeat(8,1fr);
  gap:8px;
}

/* step down when it genuinely won’t fit */
@media (max-width:980px){
  .top8-grid{grid-template-columns:repeat(4,1fr)}
}

@media (max-width:720px){
  .top8-grid{grid-template-columns:repeat(2,1fr)}
}

.top8-item{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
  padding:6px;
  border-radius:12px;
  color:var(--fg);
}

.top8-item:hover{
  background:var(--panel);
  text-decoration:none;
}

.top8-avatar{
  width:56px;
  height:56px;
  border-radius:10px;
  border:1px solid var(--line);
  background:var(--bg);
  object-fit:cover;
}

.top8-name{
  font-size:11px;
  font-weight:650;
  text-align:center;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* =========================
   Footer
   ========================= */
.footer{
  border-top:1px solid var(--line);
  padding:18px;
  text-align:center;
  color:var(--muted);
}

.footer small{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  line-height:1.2;
}

.footer a{color:var(--muted)}
.footer a:hover{text-decoration:underline}

/* =========================
   Tables
   ========================= */
.table-wrap{
  overflow:auto;
}

table{
  width:100%;
  min-width:900px;
  border-collapse:collapse;
  background:var(--bg);
}

th,
td{
  padding:8px 10px;
  text-align:left;
  vertical-align:top;
}

th{
  color:var(--fg);
  font-weight:700;
  border-bottom:1px solid var(--line);
  white-space:nowrap;
}

td{
  border-bottom:1px solid rgba(31,77,31,.4);
  color:var(--muted);
}

tbody tr:hover{
  background:var(--panel);
}

td .help{
  margin:2px 0 0;
}

/* admin/search input flex inside row forms */
.card form.row input[name="q"]{flex:1;min-width:280px}

/* delete confirm input size inside tables */
.table-wrap input[name="confirm"]{width:140px}

/* keep avatar tidy inside tables */
.table-wrap td img{
  width:36px;
  height:36px;
  border-radius:10px;
  border:1px solid var(--line);
  background:var(--bg);
  object-fit:cover;
}

/* push the flush button to the right without new classes */
.card .row > form{margin-left:auto}


/* =========================
   Wall posts
   ========================= */
.wall-post{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:var(--bg);
}

.wall-post:hover{
  background:var(--panel);
}

.wall-post-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}

.wall-post-left{
  display:flex;
  gap:10px;
  align-items:center;
  min-width:0;
}

.wall-post-meta{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}

.wall-post-author{
  color:var(--fg);
  font-weight:800;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.wall-post-time{
  color:var(--muted);
  font-size:12px;
}

.wall-post-body{
  color:var(--fg);
  line-height:1.4;
  white-space:pre-wrap; /* preserves newlines */
  word-wrap:break-word;
}

/* wall composer toggle */
.wall-compose summary{list-style:none}
.wall-compose summary::-webkit-details-marker{display:none}

.wall-compose-open{display:none}
.wall-compose[open] .wall-compose-open{display:inline}
.wall-compose[open] .wall-compose-closed{display:none}

.about-text{
  margin-top: 14px;
}
.about-embed{
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  margin: 10px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg);
}
.about-yt{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.about-img{
  display:block;
  max-width:100%;
  height:auto;
  margin:10px 0;
  border-radius:12px;
  border:0px solid var(--line);
}

h2{
  margin-bottom: 12px;
}

/* =========================================
   Waterfall YarrCode (NO ACCESSIBILITY BLOCK)
   Requires:
   <span class="yc-waterfall" data-yc="waterfall">...</span>
   JS hydrates to per-character spans: .yc-wf-ch
   ========================================= */

.yc-waterfall{
  display:inline-block;
  position:relative;
  white-space:pre-wrap;
  font-weight:800;
  letter-spacing:.01em;
}

/* Each character */
.yc-waterfall .yc-wf-ch{
  display:inline-block;
  position:relative;
  will-change:transform, filter, opacity;

  /* vertical waterfall bob */
  transform: translateY(var(--wf-drop, 0px));

  /* rainbow text (per-character base hue + animated shift) */
  color: hsl(calc(var(--wf-hue0, 0) + var(--wf-hueShift, 0)), 95%, 72%);
  text-shadow: 0 0 10px hsla(calc(var(--wf-hue0, 0) + var(--wf-hueShift, 0)), 95%, 75%, .32);

  animation:
    yc-wf-fall 1.15s ease-in-out infinite,
    yc-wf-glint 1.8s linear infinite,
    yc-wf-rainbow 2.8s linear infinite;

  animation-delay: var(--wf-delay, 0ms);
}

/* Waterfall motion (up/down cascade) */
@keyframes yc-wf-fall{
  0%   { transform: translateY(calc(var(--wf-drop, 10px) * -1)); opacity:.95; }
  50%  { transform: translateY(var(--wf-drop, 10px)); opacity:1; }
  100% { transform: translateY(calc(var(--wf-drop, 10px) * -1)); opacity:.95; }
}

/* Glitter brightness sweep */
@keyframes yc-wf-glint{
  0%   { filter: saturate(1.1) brightness(1.0); }
  35%  { filter: saturate(1.7) brightness(1.35); }
  70%  { filter: saturate(1.25) brightness(1.08); }
  100% { filter: saturate(1.1) brightness(1.0); }
}

/* Hue continuously cycles through the whole rainbow */
@keyframes yc-wf-rainbow{
  0%   { --wf-hueShift: 0; }
  100% { --wf-hueShift: 360; }
}

/* Tiny per-character star flare */
.yc-waterfall .yc-wf-ch::after{
  content:"";
  position:absolute;
  left:50%;
  top:10%;
  width:10px;
  height:10px;
  transform:translate(-50%,-50%) rotate(45deg) scale(0);
  opacity:0;

  /* rainbow-aware flare */
  background:
    radial-gradient(circle at 50% 50%,
      hsla(calc(var(--wf-hue0, 0) + var(--wf-hueShift, 0)), 95%, 82%, .95) 0%,
      hsla(calc(var(--wf-hue0, 0) + var(--wf-hueShift, 0)), 95%, 72%, .55) 35%,
      transparent 70%);
  filter: blur(.2px);

  animation: yc-wf-star 1.6s ease-in-out infinite;
  animation-delay: calc(var(--wf-delay, 0ms) + 120ms);
}

@keyframes yc-wf-star{
  0%, 82% { opacity:0; transform:translate(-50%,-50%) rotate(45deg) scale(0); }
  88%     { opacity:.95; transform:translate(-50%,-50%) rotate(45deg) scale(1); }
  100%    { opacity:0; transform:translate(-50%,-50%) rotate(45deg) scale(0.2); }
}

