/* SAVANTWARS — electric-renaissance zine. Hard shadows, misprint type, sticker chips, grain.
   Clear first, unmistakable second. */

:root {
  --ink: #0d0c14;
  --panel: #15131f;
  --panel2: #1c1929;
  --line: rgba(244, 242, 255, 0.09);
  --gold: #ffc63f;
  --gold-deep: #b98a12;
  --coral: #ff5c7a;
  --violet: #8c5bff;
  --cyan: #3be8ff;
  --acid: #c8ff2e;
  --paper: #f4f2ff;
  --dim: #918da8;
  --font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(1100px 560px at 82% -8%, rgba(140, 91, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 8% 108%, rgba(255, 198, 63, 0.10), transparent 60%);
}
body::after {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 90; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.9'/%3E%3C/svg%3E");
}

#app { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; }

button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }

.card {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 9px 9px 0 rgba(0, 0, 0, 0.38);
}

/* ---------------- topbar ---------------- */

#topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 12, 20, 0.82);
  backdrop-filter: blur(8px);
}
.logo {
  font-size: 20px; font-weight: 900; font-style: italic; letter-spacing: -0.5px;
  transform: skewX(-6deg); white-space: nowrap; cursor: default;
  text-shadow: 2px 2px 0 rgba(140, 91, 255, 0.5);
}
.logo span { color: var(--gold); text-shadow: 2px 2px 0 rgba(255, 92, 122, 0.4); }
.pills { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; overflow: hidden; }
.pill {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; color: var(--dim);
  background: var(--panel); border: 1px solid var(--line);
  padding: 6px 10px; border-radius: 999px; white-space: nowrap;
}
.pill[hidden] { display: none; }
.pill b { color: var(--paper); font-variant-numeric: tabular-nums; }
.pill u { text-decoration: none; }
.pill.live b { color: var(--gold); }
.pill.flame b { color: var(--gold); }
.dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--gold);
  box-shadow: 0 0 8px var(--gold); animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.72); } }

.tools { display: flex; gap: 8px; align-items: center; }
.iconbtn {
  font-size: 16px; width: 40px; height: 40px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}
.iconbtn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35); }
#youChip {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 4px 10px 4px 4px; max-width: 190px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}
#youChip:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35); }
.avatar {
  width: 28px; height: 28px; border-radius: 9px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 15px; flex: none;
  background: var(--panel2); border: 1px solid var(--line);
}
.avatar.big { width: 52px; height: 52px; font-size: 28px; border-radius: 14px; }
.youmeta { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.youmeta b { font-size: 12px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.youmeta em { font-size: 9px; font-style: italic; color: var(--gold); font-weight: 700; text-transform: uppercase; }

/* badges */
.acct-star { color: var(--gold); font-style: normal; }
.og-tag {
  display: inline-block; margin-left: 5px; padding: 0 4px; border-radius: 4px;
  font-size: 8px; font-weight: 900; letter-spacing: 0.5px; vertical-align: 1px;
  color: var(--ink); background: var(--gold);
}

/* ---------------- tape marquee ---------------- */

.tape {
  display: flex; overflow: hidden; white-space: nowrap;
  background: var(--gold); color: var(--ink);
  font-size: 10.5px; font-weight: 900; font-style: italic; letter-spacing: 1.5px;
  padding: 4px 0; border-radius: 4px;
  transform: rotate(-0.8deg); margin: 0 -4px 2px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}
.tape span { animation: tapescroll 26s linear infinite; }
@keyframes tapescroll { to { transform: translateX(-100%); } }

/* ---------------- stage / views ---------------- */

#stage { flex: 1; min-height: 0; padding: 14px; display: flex; }
.view { display: none; flex: 1; min-height: 0; }
body.phase-lobby #lobbyView { display: flex; flex-direction: column; gap: 12px; }
body.phase-play #playView, body.phase-reveal #playView { display: flex; }

/* ---------------- lobby ---------------- */

.lobby-grid { display: flex; gap: 14px; flex: 1; min-height: 0; }
.next-card {
  flex: 0 0 350px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 20px; gap: 4px;
  position: relative; overflow: hidden;
  transform: rotate(-0.5deg);
  border-color: rgba(255, 198, 63, 0.25);
}
.kicker { font-size: 11px; font-weight: 800; letter-spacing: 3px; color: var(--dim); }
.countdown {
  font-size: 92px; font-weight: 900; font-style: italic; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -3px;
  color: var(--paper);
  text-shadow: 5px 5px 0 rgba(140, 91, 255, 0.55), -4px -4px 0 rgba(255, 198, 63, 0.4);
  animation: wobble 3.5s ease-in-out infinite;
}
@keyframes wobble { 0%, 100% { transform: rotate(-0.6deg); } 50% { transform: rotate(0.6deg); } }
.countdown.hot { color: var(--gold); animation: hotpulse 1s ease-in-out infinite; }
@keyframes hotpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.game-name {
  font-size: 30px; font-weight: 900; font-style: italic; letter-spacing: -1px;
  color: var(--coral); text-transform: uppercase; transform: skewX(-5deg);
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45); margin-top: 4px;
}
.game-how { font-size: 13px; color: var(--dim); max-width: 280px; line-height: 1.45; }
.drop-status {
  margin-top: 10px; font-size: 12px; font-weight: 800; font-style: italic;
  color: var(--gold); text-transform: uppercase; letter-spacing: 1px;
}
.lobby-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; width: 100%; max-width: 270px; }
.join-toggle {
  font-size: 13px; font-weight: 900; font-style: italic; letter-spacing: 0.5px;
  padding: 11px 14px; border-radius: 12px;
  background: rgba(200, 255, 46, 0.14); border: 2px solid var(--acid); color: var(--acid);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.35);
}
.join-toggle small { display: block; font-size: 9px; font-weight: 700; color: var(--dim); letter-spacing: 1px; }
.join-toggle.sitting { background: rgba(255, 92, 122, 0.12); border-color: var(--coral); color: var(--coral); }
.join-toggle:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35); }
.claim-btn {
  font-size: 12px; font-weight: 900; font-style: italic; letter-spacing: 0.5px;
  padding: 10px 14px; border-radius: 12px;
  color: var(--ink); background: var(--gold);
  box-shadow: 0 4px 0 var(--gold-deep), 4px 8px 0 rgba(0, 0, 0, 0.3);
}
.claim-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--gold-deep); }
.claim-btn.pulse { animation: claimpulse 1.2s ease-in-out 4; }
@keyframes claimpulse { 50% { transform: scale(1.06); } }

.results-card { flex: 1; min-width: 0; padding: 16px; overflow: hidden auto; transform: rotate(0.3deg); }
.rc-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; }
.rc-big { font-size: 26px; font-weight: 900; font-style: italic; letter-spacing: -0.5px; }
.rc-sub { font-size: 13px; color: var(--dim); line-height: 1.6; }
.rc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.rc-head > span:first-child { font-size: 12px; font-weight: 800; letter-spacing: 2px; color: var(--dim); }
.rc-btns { display: flex; gap: 6px; }
.minibtn {
  font-size: 11px; font-weight: 900; font-style: italic; letter-spacing: 1px;
  color: var(--ink); background: var(--gold); padding: 6px 12px; border-radius: 8px;
  box-shadow: 0 3px 0 var(--gold-deep);
}
.minibtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-deep); }
.minibtn.ghost {
  color: var(--paper); background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
}
.linkbtn {
  font-size: 11px; font-weight: 800; color: var(--cyan); text-decoration: underline;
  text-underline-offset: 3px; margin-left: 6px;
}

.podium { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.pod {
  flex: 1; max-width: 150px; text-align: center; padding: 10px 6px 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.35);
  animation: popin 0.35s cubic-bezier(0.2, 1.6, 0.4, 1) backwards;
}
.pod:nth-child(1) { animation-delay: 0.12s; border-color: rgba(255, 198, 63, 0.6); transform: rotate(-1.2deg); }
.pod:nth-child(2) { animation-delay: 0.24s; transform: rotate(0.8deg); }
.pod:nth-child(3) { animation-delay: 0.36s; transform: rotate(-0.6deg); }
.pod .medal { font-size: 20px; }
.pod .pname { display: block; font-size: 11px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.pod .pscore { font-size: 15px; font-weight: 900; font-style: italic; color: var(--gold); font-variant-numeric: tabular-nums; }
@keyframes popin { from { opacity: 0; transform: scale(0.6) translateY(14px); } }

.rtable { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.rtable li {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px;
  padding: 5px 10px; border-radius: 8px; background: rgba(244, 242, 255, 0.03);
  animation: rowin 0.3s ease backwards;
}
.rtable li:nth-child(-n+10) { animation-delay: calc(var(--i, 0) * 0.04s); }
@keyframes rowin { from { opacity: 0; transform: translateX(-8px); } }
.rtable .rk { width: 26px; color: var(--dim); font-weight: 800; font-variant-numeric: tabular-nums; }
.rtable .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rtable .sc { font-weight: 900; font-variant-numeric: tabular-nums; }
.rtable li.you {
  background: linear-gradient(90deg, rgba(255, 198, 63, 0.16), rgba(255, 198, 63, 0.04));
  border: 1px solid rgba(255, 198, 63, 0.45);
}
.rtable li.you .nm { color: var(--gold); }
.youline {
  margin-top: 10px; text-align: center; font-size: 13px; font-weight: 800;
  font-style: italic; color: var(--paper);
}
.youline b { color: var(--gold); }
.youline .xp { color: var(--violet); }

.roster-strip { flex: none; }
.roster-label { font-size: 10px; font-weight: 800; letter-spacing: 2px; color: var(--dim); margin: 0 2px 6px; }
#rosterChips { display: flex; gap: 6px; overflow: hidden; height: 36px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 0 10px 0 4px; font-size: 11px; font-weight: 700; color: var(--dim);
  animation: popin 0.3s cubic-bezier(0.2, 1.6, 0.4, 1) backwards; white-space: nowrap;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}
.chip:nth-child(odd) { transform: rotate(-1.1deg); }
.chip:nth-child(even) { transform: rotate(0.9deg); }
.chip .cava {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px;
}
.chip.you { border-color: rgba(255, 198, 63, 0.55); color: var(--paper); }

/* ---------------- play ---------------- */

.play-grid { display: flex; gap: 12px; flex: 1; min-height: 0; }
#gameWrap { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; position: relative; }
#timeBar { height: 5px; background: rgba(244, 242, 255, 0.07); }
#timeFill {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--gold), var(--coral));
  transform-origin: left; transition: transform 0.2s linear;
}
.play-head {
  display: flex; align-items: baseline; gap: 12px; padding: 10px 16px 6px;
}
.ph-game { font-size: 17px; font-weight: 900; font-style: italic; color: var(--coral); text-transform: uppercase; letter-spacing: -0.5px; }
.ph-rank { flex: 1; font-size: 12px; font-weight: 800; color: var(--dim); font-variant-numeric: tabular-nums; }
.ph-rank b { color: var(--gold); }
.ph-score { font-size: 26px; font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; }
.ph-score.bump { animation: bump 0.25s ease; }
@keyframes bump { 40% { transform: scale(1.25); color: var(--gold); } }

#gameRoot { flex: 1; min-height: 0; position: relative; overflow: hidden; }

#spectate {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 20px; text-align: center;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
}
#spectate[hidden] { display: none; }
.sp-kicker { font-size: 11px; font-weight: 800; letter-spacing: 3px; color: var(--dim); }
.sp-game { font-size: 30px; font-weight: 900; font-style: italic; color: var(--coral); transform: skewX(-5deg); }
.sp-list { list-style: none; width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 4px; }
.sp-list li {
  display: flex; gap: 8px; align-items: center; font-size: 12.5px; padding: 5px 10px;
  border-radius: 8px; background: rgba(244, 242, 255, 0.04);
}
.sp-list .rk { color: var(--dim); font-weight: 800; width: 20px; }
.sp-list .nm { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.sp-list .sc { font-weight: 900; color: var(--cyan); font-variant-numeric: tabular-nums; }
.sp-note { font-size: 12px; color: var(--dim); font-weight: 700; }

#liveBoard { flex: 0 0 210px; padding: 12px; overflow: hidden; display: flex; flex-direction: column; }
.lb-head { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 900; letter-spacing: 3px; color: var(--dim); margin-bottom: 8px; }
#liveRows { list-style: none; display: flex; flex-direction: column; gap: 3px; flex: 1; overflow: hidden; }
#liveRows li {
  display: flex; gap: 6px; align-items: center; font-size: 11.5px; padding: 4px 8px;
  border-radius: 7px; background: rgba(244, 242, 255, 0.03);
}
#liveRows .rk { color: var(--dim); font-weight: 800; width: 20px; font-variant-numeric: tabular-nums; }
#liveRows .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#liveRows .sc { font-weight: 900; font-variant-numeric: tabular-nums; color: var(--cyan); }
#liveRows li.you { background: rgba(255, 198, 63, 0.12); border: 1px solid rgba(255, 198, 63, 0.4); }
#liveRows li.you .sc { color: var(--gold); }

/* ---------------- bottom bar ---------------- */

#bottombar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
#feedTicker { flex: 1; min-width: 0; overflow: hidden; font-size: 11.5px; color: var(--dim); height: 32px; display: flex; align-items: center; }
#feedText { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; animation: feedin 0.4s ease; line-height: 1.3; }
@keyframes feedin { from { opacity: 0; transform: translateY(10px); } }
#emoteBar { display: flex; gap: 6px; }
.emote {
  font-size: 17px; width: 40px; height: 40px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
  transition: transform 0.1s;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}
.emote:active { transform: scale(1.25) rotate(-8deg); }

#emoteLayer { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.float-emote {
  position: absolute; bottom: 60px; font-size: 26px;
  animation: floatup 2.6s ease-out forwards;
}
.float-emote small {
  display: block; font-size: 9px; font-weight: 800; color: var(--dim);
  text-align: center; font-family: var(--font);
}
@keyframes floatup {
  0% { opacity: 0; transform: translateY(20px) scale(0.6); }
  12% { opacity: 1; transform: translateY(0) scale(1.15); }
  100% { opacity: 0; transform: translateY(-46vh) scale(0.9) rotate(var(--rot, 8deg)); }
}

/* ---------------- overlays ---------------- */

#revealOverlay {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(13, 12, 20, 0.9); backdrop-filter: blur(6px);
}
#revealOverlay[hidden] { display: none; }
.reveal-inner { text-align: center; animation: popin 0.3s cubic-bezier(0.2, 1.6, 0.4, 1); }
.reveal-big {
  font-size: 68px; font-weight: 900; font-style: italic; letter-spacing: -2px;
  transform: skewX(-6deg);
  text-shadow: 5px 5px 0 rgba(140, 91, 255, 0.55), -4px -4px 0 rgba(255, 198, 63, 0.4);
}
.reveal-sub { font-size: 14px; color: var(--dim); margin-top: 8px; font-weight: 600; }

#recordFlash {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 198, 63, 0.94); color: var(--ink); text-align: center; padding: 20px;
}
#recordFlash[hidden] { display: none; }
.rf-kind { font-size: clamp(40px, 9vw, 76px); font-weight: 900; font-style: italic; letter-spacing: -2px; transform: skewX(-6deg) rotate(-2deg); }
.rf-text { font-size: clamp(15px, 3vw, 22px); font-weight: 800; margin-top: 12px; }

/* ---------------- onboarding ---------------- */

#onboard {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 70% 20%, rgba(140, 91, 255, 0.20), transparent 60%),
    radial-gradient(700px 400px at 20% 90%, rgba(255, 198, 63, 0.14), transparent 60%),
    var(--ink);
  padding: 20px;
}
#onboard.gone { display: none; }
.ob-inner { text-align: center; max-width: 480px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.ob-logo {
  font-size: clamp(46px, 11vw, 76px); font-weight: 900; font-style: italic;
  letter-spacing: -3px; transform: skewX(-7deg); line-height: 0.95;
  text-shadow: 5px 5px 0 rgba(140, 91, 255, 0.5);
}
.ob-logo span { display: block; color: var(--gold); text-shadow: 5px 5px 0 rgba(255, 92, 122, 0.4); }
.ob-pitch { font-size: 16px; color: var(--dim); line-height: 1.6; }
.ob-pitch b { color: var(--paper); }
.ob-motto {
  font-size: 15px; font-weight: 900; font-style: italic; color: var(--gold);
  letter-spacing: 0.5px; transform: rotate(-1deg);
}
.ob-you { font-size: 14px; color: var(--dim); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.ob-name {
  font-size: 15px; font-weight: 900; font-style: italic; color: var(--cyan);
  background: var(--panel); border: 1px dashed rgba(59, 232, 255, 0.5);
  padding: 6px 12px; border-radius: 10px;
}
.ob-edit { font-size: 11px; }
.bigbtn {
  font-size: 22px; font-weight: 900; font-style: italic; letter-spacing: 0.5px;
  color: var(--ink); background: var(--gold);
  padding: 16px 42px; border-radius: 16px; transform: skewX(-4deg);
  box-shadow: 0 6px 0 var(--gold-deep), 8px 12px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.08s, box-shadow 0.08s;
}
.bigbtn:active { transform: skewX(-4deg) translateY(5px); box-shadow: 0 1px 0 var(--gold-deep), 4px 6px 0 rgba(0, 0, 0, 0.35); }
.bigbtn.slim { font-size: 14px; padding: 12px 22px; box-shadow: 0 4px 0 var(--gold-deep), 5px 8px 0 rgba(0, 0, 0, 0.3); }
.ob-small { font-size: 12px; color: var(--dim); }
.ob-small b { color: var(--gold); font-variant-numeric: tabular-nums; }
.ob-pop { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); font-weight: 700; }
.ob-pop b { color: var(--paper); }

/* ---------------- modals shared ---------------- */

#profileModal, #authModal, #recordsModal, #replayOverlay, #studioModal, #storeModal, #ladderModal {
  position: fixed; inset: 0; z-index: 65; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 7, 14, 0.78); backdrop-filter: blur(6px); padding: 16px;
}
#profileModal[hidden], #authModal[hidden], #recordsModal[hidden], #replayOverlay[hidden],
#studioModal[hidden], #storeModal[hidden], #ladderModal[hidden] { display: none; }
.pm-card, .auth-card, .rec-card, .replay-card, .studio-card, .store-card, .ladder-card {
  width: 100%; max-width: 440px; max-height: 92vh; overflow: hidden auto;
  padding: 20px; position: relative; display: flex; flex-direction: column; gap: 14px;
}
.pm-close { position: absolute; top: 8px; right: 8px; font-size: 15px; color: var(--dim); width: 40px; height: 40px; z-index: 3; }

/* profile */
.pm-head { display: flex; gap: 12px; align-items: center; }
.pm-name-row { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 900; }
.pm-title { font-size: 11px; font-weight: 900; font-style: italic; text-transform: uppercase; color: var(--gold); letter-spacing: 1px; }
.pm-xpbar { height: 6px; background: rgba(244, 242, 255, 0.08); border-radius: 4px; margin-top: 6px; width: 220px; overflow: hidden; }
.pm-xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--coral)); border-radius: 4px; }
.pm-xpline { font-size: 10px; color: var(--dim); margin-top: 3px; font-variant-numeric: tabular-nums; }
.pm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pm-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px; text-align: center; }
.pm-stat b { display: block; font-size: 17px; font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; }
.pm-stat span { font-size: 9px; font-weight: 700; letter-spacing: 1px; color: var(--dim); text-transform: uppercase; }
.pm-radar-wrap { display: flex; justify-content: center; }
.pm-radar-wrap canvas { max-width: 100%; height: auto; }
.pm-skills { display: flex; flex-direction: column; gap: 6px; }
.pm-skill { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.pm-skill .sn { width: 88px; font-weight: 800; text-transform: uppercase; font-size: 10px; letter-spacing: 1px; color: var(--dim); }
.pm-skill .sbar { flex: 1; height: 8px; background: rgba(244, 242, 255, 0.07); border-radius: 5px; overflow: hidden; }
.pm-skill .sbar i { display: block; height: 100%; border-radius: 5px; }
.pm-skill .sv { width: 56px; text-align: right; font-weight: 900; font-variant-numeric: tabular-nums; font-size: 11.5px; }
.pm-skill .tr { width: 44px; font-size: 10px; font-weight: 800; text-align: right; }
.tr.up { color: var(--acid); } .tr.dn { color: var(--coral); } .tr.fl { color: var(--dim); }
.pm-claim {
  display: flex; flex-direction: column; gap: 8px; padding: 12px;
  border: 1px dashed rgba(255, 198, 63, 0.5); border-radius: 12px; font-size: 12px;
}
.pm-claim b { color: var(--gold); }
.pm-claim span { color: var(--dim); line-height: 1.5; }
.pm-claim.ok { border-style: solid; }

/* auth */
.auth-title { font-size: 24px; font-weight: 900; font-style: italic; letter-spacing: -0.5px; transform: skewX(-4deg); }
.auth-sub { font-size: 12.5px; color: var(--dim); line-height: 1.5; }
.auth-label { font-size: 10px; font-weight: 800; letter-spacing: 2px; color: var(--dim); text-transform: uppercase; }
.auth-input {
  font-family: inherit; font-size: 18px; font-weight: 800; color: var(--paper);
  background: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; outline: none; width: 100%;
}
.auth-input:focus { border-color: var(--gold); }
.auth-err { min-height: 16px; font-size: 12px; font-weight: 800; color: var(--coral); }
.auth-founder { font-size: 11.5px; font-weight: 800; color: var(--gold); }

/* records */
.rec-title { font-size: 22px; font-weight: 900; font-style: italic; letter-spacing: -0.5px; transform: skewX(-4deg); }
.rec-sub { font-size: 12px; color: var(--dim); }
.rec-intro { font-size: 12px; color: var(--dim); padding: 10px; border: 1px dashed rgba(255, 198, 63, 0.4); border-radius: 10px; }
.rec-intro b { color: var(--gold); }
.rec-row {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 10px;
  border-radius: 10px; background: rgba(244, 242, 255, 0.03); font-size: 12px;
}
.rec-game { font-weight: 900; font-style: italic; color: var(--coral); font-size: 13px; }
.rec-best b { color: var(--gold); font-variant-numeric: tabular-nums; }
.rec-first { color: var(--dim); font-size: 11px; }
.rec-best.open, .rec-first.open { color: var(--dim); }
.rec-best.open b, .rec-first.open b { color: var(--cyan); }
#recBody { display: flex; flex-direction: column; gap: 6px; }

/* replay */
#replayCanvas { width: 100%; border-radius: 10px; background: var(--ink); }

/* ---------------- toasts ---------------- */

#toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 85; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 18px; font-size: 13px; font-weight: 800;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.45);
  animation: toastin 0.35s cubic-bezier(0.2, 1.6, 0.4, 1), toastout 0.4s ease 3.8s forwards;
  max-width: 92vw; text-align: center;
}
.toast.gold { border-color: rgba(255, 198, 63, 0.5); color: var(--gold); }
.toast.pink { border-color: rgba(255, 92, 122, 0.5); color: var(--coral); }
@keyframes toastin { from { opacity: 0; transform: translateY(-14px) scale(0.9); } }
@keyframes toastout { to { opacity: 0; transform: translateY(-10px); } }

/* ---------------- screenshake + confetti ---------------- */

body.shake #stage { animation: shake 0.25s; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-5px, 3px); }
  50% { transform: translate(4px, -4px); }
  75% { transform: translate(-3px, -2px); }
}
.confetti {
  position: fixed; width: 9px; height: 14px; z-index: 82; pointer-events: none; top: -20px;
  animation: confall linear forwards;
}
@keyframes confall {
  to { transform: translateY(110vh) rotate(var(--spin, 720deg)); opacity: 0.7; }
}

/* ---------------- in-game shared ---------------- */

.g-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 18px; text-align: center; }
.g-question { font-size: clamp(26px, 6vw, 44px); font-weight: 900; font-style: italic; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.g-prompt { font-size: 14px; color: var(--dim); font-weight: 700; }
.g-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 420px; }
.g-opt {
  font-size: 19px; font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 10px; transition: transform 0.08s;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}
.g-opt:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3); }
.g-opt.good { background: rgba(200, 255, 46, 0.18); border-color: var(--acid); color: var(--acid); }
.g-opt.bad { background: rgba(255, 92, 122, 0.16); border-color: var(--coral); color: var(--coral); animation: shake 0.25s; }
.g-feedback { min-height: 20px; font-size: 13px; font-weight: 900; font-style: italic; }
.g-feedback.good { color: var(--acid); } .g-feedback.bad { color: var(--coral); }

canvas.gcanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

/* echo / rewind */
.echo-grid { display: grid; grid-template-columns: repeat(3, 84px); gap: 10px; }
.echo-cell {
  width: 84px; height: 84px; border-radius: 16px; background: var(--panel2);
  border: 1px solid var(--line); transition: background 0.12s, transform 0.12s;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}
.echo-cell.lit { background: var(--cyan); box-shadow: 0 0 26px rgba(59, 232, 255, 0.6); transform: scale(1.06); }
.echo-cell.lit.g2 { background: var(--coral); box-shadow: 0 0 26px rgba(255, 92, 122, 0.6); }
.echo-cell.hit { background: rgba(200, 255, 46, 0.35); transform: scale(0.94); }
.echo-cell.err { background: rgba(255, 92, 122, 0.4); animation: shake 0.25s; }
.echo-status { font-size: 13px; font-weight: 900; font-style: italic; color: var(--dim); text-transform: uppercase; letter-spacing: 2px; min-height: 18px; }

/* wordsmash */
.ws-word { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; min-height: 56px; }
.ws-slot {
  width: 46px; height: 54px; border-radius: 12px; background: rgba(244, 242, 255, 0.05);
  border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 900; font-style: italic;
}
.ws-slot.filled { border-style: solid; border-color: var(--cyan); color: var(--cyan); }
.ws-letters { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.ws-letter {
  width: 56px; height: 60px; border-radius: 14px; background: var(--panel2);
  border: 1px solid var(--line); font-size: 28px; font-weight: 900; font-style: italic;
  transition: transform 0.08s, opacity 0.12s;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}
.ws-letter:active { transform: translate(2px, 2px); }
.ws-letter.used { opacity: 0.15; pointer-events: none; }
.ws-ctl { display: flex; gap: 10px; }
.ws-ctlbtn { font-size: 12px; font-weight: 900; color: var(--dim); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 16px; }

/* instinct (hivemind) */
.hm-opt {
  font-size: 15px; font-weight: 800; font-style: normal; text-align: left;
  padding: 13px 14px; position: relative; overflow: hidden;
}
.hm-opt .bar {
  position: absolute; inset: 0; width: 0%; background: linear-gradient(90deg, rgba(140, 91, 255, 0.4), rgba(140, 91, 255, 0.08));
  transition: width 0.7s cubic-bezier(0.2, 0.9, 0.3, 1); z-index: 0;
}
.hm-opt .lbl, .hm-opt .pct { position: relative; z-index: 1; }
.hm-opt .pct { float: right; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--dim); }
.hm-opt.picked { border-color: var(--violet); }
.hm-opt.top .pct { color: var(--gold); }
.hm-count { font-size: 12px; color: var(--dim); font-weight: 700; }

/* oddball */
.odd-grid { display: grid; gap: 8px; width: 100%; max-width: 400px; }
.odd-cell {
  aspect-ratio: 1; border-radius: 12px; background: var(--panel2);
  border: 1px solid var(--line); font-size: clamp(18px, 4.5vw, 30px);
  display: flex; align-items: center; justify-content: center;
}
.odd-cell:active { transform: scale(0.93); }

/* flashback */
.flash-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; max-width: 380px; }
.flash-cell {
  aspect-ratio: 1; border-radius: 12px; background: var(--panel2);
  border: 1px solid var(--line); font-size: 24px; font-weight: 900; font-style: italic;
  color: var(--gold);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}
.flash-cell.num { border-color: rgba(255, 198, 63, 0.4); }
.flash-cell.hit { background: rgba(200, 255, 46, 0.25); border-color: var(--acid); color: var(--acid); }
.flash-cell.err { background: rgba(255, 92, 122, 0.35); animation: shake 0.25s; }

/* clutch */
.clutch-bar {
  position: relative; width: min(90%, 460px); height: 46px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}
.clutch-zone {
  position: absolute; top: 0; bottom: 0; background: rgba(255, 198, 63, 0.35);
  border-left: 2px solid var(--gold); border-right: 2px solid var(--gold);
}
.clutch-marker {
  position: absolute; top: -4px; bottom: -4px; width: 6px; margin-left: -3px;
  background: var(--cyan); border-radius: 3px; box-shadow: 0 0 14px rgba(59, 232, 255, 0.8);
}

/* emojimath */
.em-eqs { display: flex; flex-direction: column; gap: 6px; }
.em-line { font-size: clamp(22px, 5vw, 34px); font-weight: 900; font-variant-numeric: tabular-nums; }
.em-target { color: var(--gold); margin-top: 6px; }

/* versus */
.vs-cards { display: flex; gap: 12px; width: 100%; max-width: 440px; }
.vs-card {
  flex: 1; font-size: clamp(22px, 5vw, 34px); font-weight: 900; font-style: italic;
  font-variant-numeric: tabular-nums; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 16px; padding: 28px 10px;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.35); transition: transform 0.08s;
}
.vs-card:first-child { transform: rotate(-1deg); }
.vs-card:last-child { transform: rotate(1deg); }
.vs-card:active { transform: scale(0.95); }
.vs-card.good { background: rgba(200, 255, 46, 0.18); border-color: var(--acid); color: var(--acid); }
.vs-card.bad { background: rgba(255, 92, 122, 0.16); border-color: var(--coral); color: var(--coral); }

/* shades */
.shade-grid { display: grid; gap: 8px; width: 100%; max-width: 380px; }
.shade-cell { aspect-ratio: 1; border-radius: 12px; border: 1px solid rgba(0, 0, 0, 0.25); }
.shade-cell:active { transform: scale(0.93); }

/* ---------------- responsive ---------------- */

@media (max-width: 860px) {
  #liveBoard { display: none; }
  .lobby-grid { flex-direction: column; }
  .next-card { flex: none; padding: 14px; }
  .countdown { font-size: 60px; }
  .game-name { font-size: 22px; }
  .lobby-actions { flex-direction: row; max-width: none; }
  .join-toggle, .claim-btn { flex: 1; font-size: 11px; padding: 9px 8px; }
  .results-card { flex: 1; }
  .echo-grid { grid-template-columns: repeat(3, 72px); }
  .echo-cell { width: 72px; height: 72px; }
  .ws-letter { width: 48px; height: 54px; font-size: 24px; }
  .pills .pill u { display: none; }
  #stage { padding: 10px; }
  .tape { font-size: 9px; }
}
@media (max-width: 400px) {
  .logo { font-size: 16px; }
  .youmeta em { display: none; }
  .pill#roundPill { display: none; }
}

/* ================= SAVANTWARS: creatures, ranks, studio, emporium ================= */

/* creature svg */
.creature { display: block; overflow: visible; }
.creature.live .av-body { animation: creatureIdle 3.2s ease-in-out infinite; transform-origin: 50px 90px; }
.creature.live .av-face { animation: creatureBlink 5.5s ease-in-out infinite; transform-origin: 50px 46px; }
@keyframes creatureIdle {
  0%, 100% { transform: translateY(0) scaleY(1) scaleX(1); }
  45% { transform: translateY(-3px) scaleY(1.035) scaleX(0.98); }
  70% { transform: translateY(1px) scaleY(0.975) scaleX(1.02); }
}
@keyframes creatureBlink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
.creature .av-spin { animation: avSpin 9s linear infinite; transform-origin: 50px 52px; }
@keyframes avSpin { to { transform: rotate(360deg); } }
.creature .av-flicker { animation: avFlicker 1.4s ease-in-out infinite; }
@keyframes avFlicker { 0%, 100% { opacity: 0.85; } 50% { opacity: 0.45; } }

.avatar { overflow: visible; background: none; border: none; width: 34px; height: 34px; }
.chip .cava { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; }
.podcre { display: flex; justify-content: center; margin: 2px 0; }

/* rank chip in topbar */
.youmeta em { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rankbar { display: block; width: 118px; height: 3px; background: rgba(244,242,255,0.12); border-radius: 2px; margin-top: 3px; overflow: hidden; }
.rankbar i { display: block; height: 100%; background: var(--gold); border-radius: 2px; transition: width 0.6s ease; }

/* rank badge next to names */
.rank-badge {
  display: inline-block; margin-left: 5px; font-size: 9px; font-weight: 900;
  letter-spacing: 0.3px; vertical-align: 1px; font-style: normal;
}

/* name effects */
.fx-goldname, .fx-s_namefx_neon, .fx-gradientname, .fx-glitchname, .fx-starname { font-weight: 900; }
.fx-goldname { color: var(--gold); text-shadow: 0 0 8px rgba(255,198,63,0.5); }
.fx-s_namefx_neon { color: #6bf0ff; text-shadow: 0 0 6px #3be8ff, 0 0 14px #3be8ff; }
.fx-gradientname {
  background: linear-gradient(90deg, var(--gold), var(--coral), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.fx-glitchname { color: var(--cyan); text-shadow: 1.5px 0 var(--coral), -1.5px 0 var(--violet); animation: glitchName 2.6s steps(2) infinite; }
@keyframes glitchName { 0%, 92%, 100% { transform: none; } 94% { transform: translateX(1.5px); } 96% { transform: translateX(-1.5px); } }
.fx-starname { color: #fff; text-shadow: 0 0 6px #fff, 0 0 12px var(--violet); }

/* rank-up takeover */
#rankFlash {
  position: fixed; inset: 0; z-index: 84; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 7, 14, 0.94); backdrop-filter: blur(8px); padding: 20px; text-align: center;
}
#rankFlash[hidden] { display: none; }
.rkf-inner { max-width: 520px; animation: popin 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); }
.rkf-kicker { font-size: 12px; font-weight: 900; letter-spacing: 6px; color: var(--dim); }
.rkf-icon { font-size: 68px; line-height: 1.2; animation: wobble 2s ease-in-out infinite; }
.rkf-name { font-size: clamp(34px, 8vw, 62px); font-weight: 900; font-style: italic; letter-spacing: -2px; transform: skewX(-6deg); }
.rkf-class { font-size: 12px; font-weight: 800; letter-spacing: 2px; color: var(--dim); margin-top: 6px; }
.rkf-credits { font-size: 17px; font-weight: 900; color: var(--gold); margin-top: 10px; }
.rkf-unlocks { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.rkf-unlock {
  font-size: 13px; font-weight: 700; padding: 9px 12px; border-radius: 10px;
  background: rgba(255, 198, 63, 0.12); border: 1px solid rgba(255, 198, 63, 0.4);
}
.rkf-unlock b { color: var(--gold); font-size: 10px; letter-spacing: 1.5px; margin-right: 6px; }
.rkf-unlock span { color: var(--dim); }

.reveal-xp { font-size: 17px; font-weight: 900; font-style: italic; color: var(--gold); margin-top: 10px; }

/* profile additions */
.pm-head { align-items: flex-start; }
.pm-creature { flex: none; width: 96px; }
.pm-headmain { min-width: 0; flex: 1; }
.pm-rankname { font-size: 17px; font-weight: 900; font-style: italic; }
.pm-class { font-size: 10px; font-weight: 800; letter-spacing: 1.5px; color: var(--dim); margin-top: 2px; }
.pm-xpbar { width: 100%; max-width: 240px; }
.pm-nextunlock { font-size: 11px; color: var(--dim); margin-top: 6px; }
.pm-nextunlock b { color: var(--cyan); }
.pm-btns { display: flex; gap: 8px; }
.pm-btns .minibtn { flex: 1; padding: 10px 8px; }
.pm-stats { grid-template-columns: repeat(3, 1fr); }

/* studio */
.studio-card, .store-card, .ladder-card { max-width: 520px; }
.st-top { display: flex; align-items: center; gap: 14px; }
.st-preview {
  flex: none; width: 150px; height: 150px; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 60%, rgba(140,91,255,0.16), transparent 70%);
  border: 1px dashed var(--line); border-radius: 16px;
}
.st-locked { font-size: 12px; font-weight: 800; color: var(--dim); line-height: 1.5; }
.st-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.st-tab {
  font-size: 10.5px; font-weight: 900; letter-spacing: 1px; padding: 8px 11px; border-radius: 9px;
  background: var(--panel); border: 1px solid var(--line); color: var(--dim); min-height: 34px;
}
.st-tab.on { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.st-body { display: flex; flex-wrap: wrap; gap: 8px; max-height: 42vh; overflow-y: auto; padding: 2px; }
.st-sub { width: 100%; font-size: 10px; font-weight: 900; letter-spacing: 2px; color: var(--dim); margin-top: 6px; }
.st-opt {
  display: flex; flex-direction: column; align-items: center; gap: 3px; width: 92px; padding: 8px 6px;
  border-radius: 12px; background: var(--panel); border: 1px solid var(--line);
  font-size: 10px; font-weight: 800; text-align: center; min-height: 44px;
}
.st-opt span { color: var(--paper); line-height: 1.2; }
.st-opt i { font-style: normal; font-size: 8.5px; color: var(--dim); }
.st-opt.on { border-color: var(--gold); background: rgba(255, 198, 63, 0.12); }
.st-opt.locked { opacity: 0.45; }
.st-opt .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin: 0 1px; }
.st-hues { display: flex; flex-wrap: wrap; gap: 6px; }
.st-hue { width: 34px; height: 34px; border-radius: 9px; border: 2px solid transparent; }
.st-hue.on { border-color: var(--paper); transform: scale(1.12); }

/* emporium */
.store-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.store-credits { font-size: 20px; font-weight: 900; font-style: italic; color: var(--gold); }
.store-disc { font-size: 10.5px; font-weight: 800; letter-spacing: 1px; color: var(--cyan); }
.store-body { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; padding: 2px; }
.sh-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
}
.sh-item.owned { opacity: 0.62; border-color: rgba(200, 255, 46, 0.4); }
.sh-item.ranklocked { opacity: 0.72; }
.sh-prev { flex: none; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; }
.sh-credits { font-size: 30px; color: var(--gold); }
.sh-fx { font-size: 20px; font-weight: 900; }
.sh-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sh-mid b { font-size: 13px; }
.sh-mid span { font-size: 11px; color: var(--dim); line-height: 1.35; }
.sh-gate { font-size: 10px; font-style: normal; font-weight: 800; color: var(--coral); }
.sh-buy {
  flex: none; min-width: 78px; min-height: 40px; padding: 10px 12px; border-radius: 10px;
  font-size: 12px; font-weight: 900; font-style: italic;
  background: var(--gold); color: var(--ink); box-shadow: 0 3px 0 var(--gold-deep);
}
.sh-buy:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-deep); }
.sh-buy:disabled { background: var(--panel2); color: var(--dim); box-shadow: none; border: 1px solid var(--line); }
.sh-buy.premium { background: var(--violet); color: #fff; box-shadow: 0 3px 0 #5b32c4; }
.sh-buy.cant { background: var(--panel2); color: var(--dim); box-shadow: none; border: 1px solid var(--line); }
.store-note { font-size: 11px; color: var(--dim); line-height: 1.5; }

/* ladder */
#ladderBody { display: flex; flex-direction: column; gap: 6px; max-height: 66vh; overflow-y: auto; }
.ladder-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 11px;
  background: rgba(244, 242, 255, 0.03); border: 1px solid transparent; opacity: 0.55;
}
.ladder-row.reached { opacity: 1; border-color: var(--line); }
.ladder-row.done { opacity: 0.85; }
.lr-icon { font-size: 20px; flex: none; }
.lr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lr-main b { font-size: 12.5px; letter-spacing: 1px; }
.lr-main span { font-size: 10.5px; color: var(--dim); }
.lr-state { font-size: 10px; font-weight: 900; letter-spacing: 1px; color: var(--gold); }
.ladder-unlocks { margin-top: 12px; display: flex; flex-direction: column; gap: 3px; }
.ul-row {
  display: flex; align-items: center; gap: 10px; font-size: 11.5px;
  padding: 5px 9px; border-radius: 8px; background: rgba(244, 242, 255, 0.025); opacity: 0.5;
}
.ul-row.got { opacity: 1; }
.ul-row b { width: 42px; color: var(--cyan); font-variant-numeric: tabular-nums; }
.ul-row span { flex: 1; }
.ul-row i { font-style: normal; }

/* auth carry-over */
.auth-carry {
  font-size: 12px; color: var(--dim); padding: 9px 11px; border-radius: 10px;
  background: rgba(200, 255, 46, 0.08); border: 1px dashed rgba(200, 255, 46, 0.35);
}
.auth-carry b { color: var(--acid); }
.auth-carry[hidden] { display: none; }

/* emotes: locked state */
.emote.locked { opacity: 0.4; font-size: 13px; }

/* onboarding creature */
.ob-creature { display: flex; justify-content: center; }

/* confetti star variant */
.confetti.star { background: none; width: auto; height: auto; font-size: 16px; font-weight: 900; }

@media (max-width: 860px) {
  .pm-stats { grid-template-columns: repeat(3, 1fr); }
  .st-preview { width: 110px; height: 110px; }
  .st-opt { width: 78px; }
  .pm-creature { width: 72px; }
  .pm-creature .creature { width: 72px; height: 72px; }
}


/* ================= END SCREEN (the dopamine beat) ================= */

#revealOverlay {
  position: fixed; inset: 0; z-index: 62; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(900px 520px at 50% 18%, rgba(140, 91, 255, 0.22), transparent 65%),
    rgba(9, 8, 15, 0.95);
  backdrop-filter: blur(8px); padding: 16px;
}
#revealOverlay[hidden] { display: none; }
.end-card {
  width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 12px;
  animation: popin 0.34s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.end-stage { position: relative; text-align: center; }
.end-podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; min-height: 130px; position: relative; }
.ep-slot {
  display: flex; flex-direction: column; align-items: center; gap: 2px; width: 33%; max-width: 150px;
  animation: podRise 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) backwards;
}
@keyframes podRise { from { opacity: 0; transform: translateY(26px) scale(0.8); } }
.ep-slot.ep-1 { order: 2; }
.ep-slot.ep-2 { order: 1; padding-bottom: 12px; }
.ep-slot.ep-3 { order: 3; padding-bottom: 20px; }
.ep-medal { font-size: 20px; }
.ep-cre { line-height: 0; }
.ep-name { font-size: 11px; font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-score { font-size: 13px; font-weight: 900; font-style: italic; color: var(--gold); font-variant-numeric: tabular-nums; }
.podium-emote {
  position: absolute; bottom: 0; font-size: 26px; pointer-events: none;
  animation: podEmote 2.2s ease-out forwards;
}
@keyframes podEmote {
  0% { opacity: 0; transform: translateY(10px) scale(0.5); }
  15% { opacity: 1; transform: translateY(-6px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-130px) scale(0.9) rotate(12deg); }
}
.end-big {
  font-size: clamp(46px, 12vw, 84px); font-weight: 900; font-style: italic; letter-spacing: -3px;
  transform: skewX(-6deg); line-height: 1; margin-top: 6px;
  text-shadow: 5px 5px 0 rgba(140, 91, 255, 0.5), -4px -4px 0 rgba(255, 198, 63, 0.35);
}
.end-sub { font-size: 14px; font-weight: 700; color: var(--dim); margin-top: 4px; }

.end-spark {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  opacity: 0; transform: translateY(8px); transition: opacity 0.4s ease, transform 0.4s ease;
}
.end-spark.show { opacity: 1; transform: none; }
.es-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.es-gain { font-size: 19px; font-weight: 900; font-style: italic; color: var(--gold); }
.es-rank { font-size: 14px; font-weight: 900; font-style: italic; text-align: right; }
.es-bar { position: relative; height: 14px; background: rgba(244, 242, 255, 0.08); border-radius: 8px; overflow: hidden; }
.es-bar i { position: absolute; inset: 0; width: 0%; border-radius: 8px; background: var(--gold); transition: background 0.4s ease; }
.es-bar i.burst { box-shadow: 0 0 22px 4px var(--gold); }
.es-bar b { display: none; }
.es-next { font-size: 11px; color: var(--dim); margin-top: 6px; font-weight: 700; }

.end-react { display: flex; gap: 8px; justify-content: center; }
.end-emote {
  font-size: 20px; width: 46px; height: 46px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}
.end-emote:active, .end-emote.pop { animation: emotePop 0.35s ease; }
@keyframes emotePop { 40% { transform: scale(1.35) rotate(-10deg); } }
.end-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.end-next-round { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; color: var(--dim); }
.end-next-round b { color: var(--gold); font-variant-numeric: tabular-nums; }
.end-skip {
  font-size: 11px; font-weight: 800; color: var(--dim); padding: 10px 14px; min-height: 40px;
  border-radius: 10px; border: 1px solid var(--line);
}

/* ================= scroll affordance ================= */
.results-card { position: relative; }
.results-card.has-more::after {
  content: ""; position: sticky; bottom: -16px; left: 0; right: 0; display: block; height: 44px;
  margin: -44px -16px -16px; pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--panel) 85%);
}
.scrollhint {
  display: none; text-align: center; font-size: 10.5px; font-weight: 800; letter-spacing: 1.5px;
  color: var(--gold); padding: 5px; cursor: pointer; animation: hintBob 1.8s ease-in-out infinite;
}
.scrollhint.on { display: block; }
@keyframes hintBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

/* ================= sit-out: clear, deliberately quiet ================= */
.join-toggle {
  background: transparent; border: 1px solid var(--line); color: var(--dim);
  font-size: 11.5px; font-weight: 700; font-style: normal; letter-spacing: 0.3px;
  box-shadow: none; padding: 10px 12px; min-height: 40px;
}
.join-toggle.sitting {
  background: rgba(200, 255, 46, 0.14); border: 2px solid var(--acid); color: var(--acid);
  font-weight: 900; font-style: italic; box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.35);
}
.join-toggle small { display: block; font-size: 9px; font-weight: 700; letter-spacing: 1px; opacity: 0.85; }

/* ================= journey ================= */
.jr-now { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: rgba(244,242,255,0.04); }
.jr-icon { font-size: 34px; }
.jr-now b { display: block; font-size: 17px; font-style: italic; }
.jr-now span { font-size: 11.5px; color: var(--dim); }
.jr-hist, .jr-soon { margin-top: 12px; display: flex; flex-direction: column; gap: 3px; }
.jr-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; padding: 6px 9px; border-radius: 8px; background: rgba(244,242,255,0.025); opacity: 0.75; }
.jr-row.now { opacity: 1; border: 1px solid rgba(255,198,63,0.45); background: rgba(255,198,63,0.1); }
.jr-row b { flex: 1; font-weight: 700; }
.jr-row i { font-style: normal; font-size: 10px; color: var(--dim); }
.jr-more { font-size: 11px; color: var(--dim); padding: 6px 9px; }
.jr-next { padding: 11px; border-radius: 11px; border: 1px dashed rgba(59,232,255,0.45); }
.jr-next b { color: var(--cyan); font-size: 13px; }
.jr-next span { display: block; font-size: 12px; color: var(--dim); margin-top: 2px; }
.jr-mystery { font-size: 11.5px; color: var(--dim); font-style: italic; margin-top: 8px; text-align: center; }

.pill.live s { text-decoration: none; font-size: 10px; color: var(--dim); }
@media (max-width: 640px) { .pill.live s { display: none; } .end-big { font-size: 46px; } }

/* ================= MOBILE: the between-games screen must always fit ================= */

.end-card { max-height: calc(100dvh - 24px); overflow-y: auto; overflow-x: hidden; }
.end-podium { max-width: 100%; }
.ep-slot { min-width: 0; }
.ep-cre svg { max-width: 100%; height: auto; }

@media (max-width: 700px) {
  #revealOverlay { padding: 8px; align-items: flex-start; }
  .end-card {
    max-width: 100%; gap: 8px; padding: 6px 2px 10px;
    max-height: calc(100dvh - 16px);
  }
  .end-podium { min-height: 96px; gap: 4px; }
  .ep-slot { width: 33%; max-width: none; gap: 0; }
  .ep-slot.ep-2 { padding-bottom: 8px; }
  .ep-slot.ep-3 { padding-bottom: 14px; }
  .ep-cre svg { width: 54px; height: 54px; }
  .ep-slot.ep-1 .ep-cre svg { width: 68px; height: 68px; }
  .ep-medal { font-size: 16px; }
  .ep-name { font-size: 10px; }
  .ep-score { font-size: 12px; }
  .end-big { font-size: 42px; letter-spacing: -2px; margin-top: 2px; }
  .end-sub { font-size: 12px; }
  .end-spark { padding: 10px 12px; }
  .es-gain { font-size: 16px; }
  .es-rank { font-size: 12.5px; }
  .es-bar { height: 12px; }
  .end-emote { width: 42px; height: 42px; font-size: 18px; }
  .end-react { gap: 6px; flex-wrap: wrap; }
  .end-foot { flex-wrap: wrap; gap: 6px; }
  .end-next-round { font-size: 10.5px; }
  .podium-emote { font-size: 22px; }
}

/* very short screens (landscape phones): keep the essentials, shrink the theatre */
@media (max-height: 560px) {
  .end-podium { min-height: 76px; }
  .ep-cre svg { width: 44px; height: 44px; }
  .ep-slot.ep-1 .ep-cre svg { width: 54px; height: 54px; }
  .end-big { font-size: 34px; }
  .end-react { display: none; }
}

/* ================= MOBILE: lobby readability ================= */

@media (max-width: 700px) {
  .lobby-grid { gap: 10px; }
  .next-card { transform: none; padding: 12px 12px 14px; }
  .results-card { transform: none; padding: 12px; }
  .countdown { font-size: 54px; letter-spacing: -2px; }
  .game-name { font-size: 21px; }
  .game-how { font-size: 12px; max-width: none; }
  .drop-status { margin-top: 6px; font-size: 11px; }
  .lobby-actions { flex-direction: column; max-width: none; margin-top: 10px; }
  .join-toggle, .claim-btn { width: 100%; }
  .podium { gap: 6px; }
  .pod { padding: 8px 4px 6px; transform: none; }
  .pod .podcre svg { width: 34px; height: 34px; }
  .pod .pname { font-size: 10px; }
  .pod .pscore { font-size: 13px; }
  .rtable li { font-size: 12px; padding: 5px 8px; }
  .youline { font-size: 12px; }
  .roster-strip { display: none; }              /* the arena is on the end screen instead */
  .tape { font-size: 8.5px; letter-spacing: 1px; }
}

/* tally + chain */
.tally-field {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  max-width: 420px; max-height: 34vh; overflow: hidden; padding: 8px;
  background: rgba(244,242,255,0.03); border-radius: 14px;
}
.tally-cell { font-size: clamp(17px, 4.5vw, 26px); line-height: 1; }
.chain-track { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; min-height: 30px; }
.chain-chip {
  font-size: 13px; font-weight: 900; padding: 5px 10px; border-radius: 8px;
  background: rgba(244,242,255,0.06); border: 1px solid var(--line);
  animation: popin 0.25s cubic-bezier(0.2,1.6,0.4,1);
}
