:root{
  --bg: #0b0f14;
  --panel2: rgba(16,24,35,.78);
  --border: rgba(255,255,255,.08);
  --muted: rgba(233,240,246,.68);
  --text: #e9f0f6;
  --purple: #9146FF;
  --teal: #39d0c5;
  --gold: #f6c453;
  --radius: 18px;
}
html,body{height:100%;}
body{
  background:
    radial-gradient(1000px 500px at 18% -10%, rgba(57,208,197,.18), transparent 55%),
    radial-gradient(900px 500px at 80% 0%, rgba(145,70,255,.16), transparent 55%),
    radial-gradient(900px 700px at 50% 120%, rgba(246,196,83,.10), transparent 60%),
    var(--bg);
  color: var(--text);
}
.glass{
  background: var(--panel2);
  border: 1px solid var(--border);
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
}
.btn-twitch{ background: var(--purple); border-color: var(--purple); font-weight: 800; border-radius: 14px; }
.btn-twitch:hover{ filter: brightness(1.05); }
.smallmuted{ color: var(--muted); font-size: 12px; }

.app{ display:grid; grid-template-columns: 270px 1fr; min-height: 100vh; }
.sidebar{ padding: 18px 14px; }
.brand{
  display:flex; align-items:center; gap:12px;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.22);
}
.brand .logo{
  width: 44px; height:44px; border-radius: 14px;
  display:grid; place-items:center;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
}
.brand .logo i{ color: var(--gold); font-size: 18px; }
.brand .title{ font-weight:900; letter-spacing:.2px; line-height:1.1; }
.brand .subtitle{ font-size:12px; color: var(--muted); margin-top:2px; }

.navbox{ margin-top: 14px; padding: 10px; }
.navitem{
  display:flex; align-items:center; gap:10px;
  padding: 10px 12px;
  border-radius: 14px;
  color: rgba(233,240,246,.86);
  text-decoration:none;
  border: 1px solid transparent;
}
.navitem:hover{ background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.06); }
.navitem.active{ background: rgba(145,70,255,.18); border-color: rgba(145,70,255,.30); }
.navitem i{ width: 18px; color: rgba(233,240,246,.70); }
.navitem.active i{ color: var(--purple); }

.content{ padding: 18px 18px 28px; }

/* clean topbar */
.topbar{
  display:flex; align-items:center; justify-content:flex-end; gap:10px;
  padding: 8px 0 16px;
}
.userchip{ display:flex; align-items:center; gap:10px; }
.pill{
  display:flex; align-items:center; gap:8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.18);
  color: rgba(233,240,246,.88);
  font-size: 12px;
  white-space: nowrap;
}
.pill i{ color: var(--teal); }
.pill .coin{ color: var(--gold); }

.avatarwrap{ position: relative; width: 42px; height: 42px; }
.avatar{
  width:42px; height:42px; border-radius: 16px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
}
.avatar img{ width:100%; height:100%; object-fit:cover; display:block; }
.levelbadge{
  position:absolute; top:-7px; left:-7px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px;
  display:flex; align-items:center; justify-content:center;
  font-size: 11px; font-weight: 900;
  color: #0b0f14;
  background: var(--gold);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 8px 18px rgba(0,0,0,.45);
}

.page{ margin-top: 14px; padding: 16px; }
.page h1{ font-size: 22px; margin: 0 0 6px; font-weight: 900; }
.page .lead{ color: var(--muted); margin-bottom: 0; }

/* Leaderboard */
.lb{ margin-top: 12px; }
.lb-row{
  display:grid;
  grid-template-columns: 54px 52px 1fr 140px;
  gap: 12px;
  align-items:center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.14);
}
.lb-row + .lb-row{ margin-top: 10px; }
.lb-pos{ font-weight: 900; display:flex; align-items:center; gap:8px; }
.lb-pos .medal{ width: 18px; display:inline-block; text-align:center; }

.lb-avawrap{ position:relative; width: 46px; height: 46px; }
.lb-ava{
  width:46px; height:46px; border-radius: 16px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
}
.lb-ava img{ width:100%; height:100%; object-fit:cover; display:block; }
.lb-lvl{
  position:absolute; bottom:-6px; right:-6px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px;
  display:flex; align-items:center; justify-content:center;
  font-size: 11px; font-weight: 900;
  color: #0b0f14;
  background: var(--teal);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 8px 18px rgba(0,0,0,.45);
}
.lb-name{ font-weight: 900; line-height: 1.1; }
.lb-sub{ color: var(--muted); font-size: 12px; }
.lb-gold{ justify-self:end; font-weight: 900; display:flex; gap:10px; align-items:center; }
.lb-gold i{ color: var(--gold); }

@media (max-width: 900px){
  .app{ grid-template-columns: 1fr; }
  .lb-row{ grid-template-columns: 40px 46px 1fr 120px; }
}


/* ===== Avatar: rund + Level unten mittig + optional XP-Ring ===== */
.avatarwrap{ position: relative; width: 44px; height: 44px; }
.avatar{
  width:44px; height:44px;
  border-radius:999px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  position:relative;
  z-index: 2;
}
.avatar img{ width:100%; height:100%; object-fit:cover; display:block; border-radius:999px; }

.levelbadge{
  position:absolute;
  left:50%;
  bottom:-8px;
  transform:translateX(-50%);
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 11px;
  font-weight: 900;
  color: #0b0f14;
  background: var(--gold);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 8px 18px rgba(0,0,0,.45);
  z-index: 3;
}

/* XP Ring (nur anzeigen wenn XP vorhanden) */
.xpring{
  --p: 0;
  position:absolute;
  inset:-4px;
  border-radius:999px;
  background: conic-gradient(var(--teal) calc(var(--p)*1%), rgba(255,255,255,.10) 0);
  -webkit-mask: radial-gradient(closest-side, transparent 72%, #000 73%);
          mask: radial-gradient(closest-side, transparent 72%, #000 73%);
  z-index: 1;
}


#syncLine{ opacity:.9; font-size:12px; }


/* ===== Gold-only mode: hide XP/Level UI if any leftovers ===== */
.xpring, #xpRing, .levelbadge, #uLevelBadge, #titlePill, #syncLine { display: none !important; }

/* gold-only */
.lb-lvl{ display:none !important; }


/* ===== Sounds page (no preview) ===== */
.page{ padding: 6px 2px; }
.pagehead{ display:flex; align-items:flex-end; justify-content:space-between; margin-bottom: 14px; }
.cardbox{ padding: 12px; border-radius: 18px; }
.rowhead{
  display:grid;
  grid-template-columns: 140px 1fr 140px;
  gap: 12px;
  padding: 10px 12px;
  color: rgba(255,255,255,.65);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.soundrow{
  display:grid;
  grid-template-columns: 140px 1fr 140px;
  gap: 12px;
  align-items:center;
  padding: 12px 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.soundrow:first-of-type{ border-top: none; }
.pill-cmd{ background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10); }
.pill-gold{ background: rgba(255,193,7,.10); border: 1px solid rgba(255,193,7,.18); }
.empty{ padding: 16px 12px; color: rgba(255,255,255,.75); }
@media (max-width: 900px){
  .rowhead{ display:none; }
  .soundrow{ grid-template-columns: 120px 1fr; }
  .soundrow .cost{ justify-self: end; }
}

/* --- Loader / Spinner --- */
#pageLoader{
  position: fixed;
  inset: 0;
  background: rgba(7,10,16,.35);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: grid;
  place-items: center;
  opacity: 1;
  transition: opacity .25s ease;
}
#pageLoader.hide{ opacity:0; pointer-events:none; }

.spinner{
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 4px solid rgba(255,255,255,.18);
  border-top-color: rgba(255,255,255,.85);
  animation: spin 0.9s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

.lb-loading{
  padding: 26px 0;
  display: grid;
  place-items: center;
}

/* --- Start page blocks --- */
.pagehead{ display:flex; justify-content: space-between; align-items:flex-end; gap:16px; margin-bottom: 14px; }
.grid2{ display:grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 980px){ .grid2{ grid-template-columns: 1fr; } }

.cardbox{ padding: 16px; }
.cardtitle{ font-weight: 700; margin-bottom: 10px; opacity: .95; }

.mini{ display:flex; flex-direction:column; gap:10px; }
.mini-row{ display:flex; gap: 12px; align-items:flex-start; padding: 10px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); }
.mini-ico{ width: 36px; height: 36px; border-radius: 12px; display:grid; place-items:center; background: rgba(145,70,255,.14); border: 1px solid rgba(145,70,255,.22); }
.mini-h{ font-weight: 700; }
.mini-s{ opacity:.85; font-size: .92rem; }

.ranktable{ border-radius: 14px; overflow:hidden; border: 1px solid rgba(255,255,255,.06); }

/* Commands (eingebettet wie Dashboard) */
.cmdtable{ width:100%; border-collapse: collapse; border-radius: 14px; overflow:hidden; border: 1px solid rgba(255,255,255,.06); }
.cmdtable th{ text-align:left; font-size:.82rem; letter-spacing:.02em; color: rgba(255,255,255,.65); padding: 12px 14px; background: rgba(255,255,255,.035); border-bottom: 1px solid rgba(255,255,255,.06); }
.cmdtable td{ padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.cmdtable tr:last-child td{ border-bottom: none; }
.cmdtable tr:hover td{ background: rgba(145,70,255,.06); }
.cmd-cat{ font-weight: 800; letter-spacing:.02em; }
.cmd-badge{ display:inline-flex; align-items:center; gap:8px; padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.18); }
.cmd-badge code{ color: rgba(255,255,255,.92); }
.cmd-cost{ display:inline-flex; align-items:center; gap:8px; justify-content:flex-end; min-width: 72px; }
.rt-head, .rt-row{ display:grid; grid-template-columns: 120px 1fr 1.2fr; gap: 10px; padding: 10px 12px; }
.rt-head{ background: rgba(255,255,255,.05); font-weight: 700; }
.rt-row{ background: rgba(0,0,0,.12); border-top: 1px solid rgba(255,255,255,.06); }
.rt-lvl{ font-variant-numeric: tabular-nums; opacity:.95; }
.rt-title{ font-weight: 700; }
.rt-hint{ opacity:.85; }

/* --- Commands page category header --- */
.rowheadcat{ padding: 10px 0 8px; }
.catname{ font-weight: 800; opacity:.95; }

/* Adjust sound row columns when used on Commands page */
.soundrow .name{ flex: 1.4; }
