/* ============================ Slottle ============================ */

:root {
  --bg: #07040f;
  --bg-2: #120a25;
  --panel: rgba(24, 14, 44, 0.72);
  --panel-line: rgba(160, 120, 255, 0.22);
  --ink: #f3ecff;
  --ink-dim: #a99cc9;
  --hot: #ff2d78;
  --hot-2: #ff8a3d;
  --cool: #38e8ff;
  --gold: #ffd45e;
  --green: #52f5a8;
  --violet: #a06bff;

  --tier-common: #7fd7ff;
  --tier-rare: #6bf0a5;
  --tier-epic: #c07bff;
  --tier-legendary: #ffc247;
  --tier-mythic: #ff5c8a;

  --cell-gap: 4px;
  --radius: 14px;
  --shadow-hard: 0 18px 50px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

/* Class rules that set `display` outrank the UA `[hidden]` rule, and several
   elements below are toggled with the hidden attribute. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body { position: relative; }

.bg-glow {
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(45% 35% at 18% 12%, rgba(255, 45, 120, 0.28), transparent 70%),
    radial-gradient(45% 40% at 84% 20%, rgba(56, 232, 255, 0.22), transparent 70%),
    radial-gradient(60% 50% at 50% 100%, rgba(160, 107, 255, 0.3), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 60%, var(--bg) 100%);
  filter: saturate(1.1);
  animation: bgdrift 24s ease-in-out infinite alternate;
}
@keyframes bgdrift {
  from { transform: translate3d(-1.5%, -1%, 0) scale(1.02); }
  to   { transform: translate3d(1.5%, 1.5%, 0) scale(1.06); }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px clamp(10px, 2.4vw, 26px) 18px;
}

/* ---------------------------- top bar ---------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-size: 30px; filter: drop-shadow(0 0 12px rgba(255, 200, 90, 0.6)); animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-4px) rotate(4deg); } }

.brand-name {
  margin: 0;
  font-size: clamp(26px, 4.6vw, 40px);
  letter-spacing: 0.16em;
  font-weight: 900;
  background: linear-gradient(100deg, var(--gold), var(--hot) 45%, var(--cool) 90%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer { to { background-position: 220% 0; } }

.brand-day {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink-dim);
  font-size: 14px;
  padding: 3px 9px;
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.topstats { display: flex; gap: 8px; margin-left: auto; }
.tstat {
  display: flex; flex-direction: column; align-items: center;
  min-width: 74px; padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  backdrop-filter: blur(8px);
}
.tstat-k { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); }
.tstat-v { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }

.topactions { display: flex; gap: 6px; }
.iconbtn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  font-size: 17px;
  cursor: pointer;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.iconbtn:hover { transform: translateY(-2px); background: rgba(160, 107, 255, 0.24); box-shadow: 0 8px 20px rgba(160, 107, 255, 0.3); }
.iconbtn:active { transform: translateY(0) scale(0.95); }
.iconbtn.muted { opacity: 0.45; }

/* Discord link icon in the top bar */
a.iconbtn.discord { text-decoration: none; color: var(--ink); }
a.iconbtn.discord svg { display: block; }

/* ---------------------------- layout ---------------------------- */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}
@media (max-width: 940px) { .stage { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------- cabinet ---------------------------- */

.cabinet {
  position: relative;
  /* Keep the whole cabinet — board, marquee and controls — on screen without
     scrolling, whatever the window shape. */
  width: 100%;
  /* Upper bound only — the exact fit is measured in render.js `fit()`. */
  max-width: 760px;
  justify-self: center;
  padding: 12px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02)),
    linear-gradient(180deg, #2a1150, #150a2c 60%, #0d0620);
  border: 1px solid rgba(255, 210, 120, 0.28);
  box-shadow: var(--shadow-hard), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.cabinet-top { display: flex; justify-content: center; margin-bottom: 8px; }
.marquee {
  position: relative;
  padding: 7px 22px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #1a0a24;
  background: linear-gradient(95deg, var(--gold), #ffe9a8 40%, var(--hot-2));
  box-shadow: 0 0 26px rgba(255, 200, 90, 0.5);
  text-align: center;
}
.marquee.hot { background: linear-gradient(95deg, var(--hot), var(--violet) 60%, var(--cool)); color: #fff; box-shadow: 0 0 34px rgba(255, 45, 120, 0.6); }

.board-wrap {
  position: relative;
  border-radius: 18px;
  padding: 6px;
  background: radial-gradient(120% 100% at 50% 0%, rgba(90, 50, 160, 0.5), rgba(8, 4, 18, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  gap: var(--cell-gap);
  aspect-ratio: 1;
  min-height: 0;
  z-index: 1;
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025));
  border: 1px solid rgba(255, 255, 255, 0.07);
  /* --face is measured from the real cell size in render.js */
  font-size: var(--face, clamp(12px, 3vw, 26px));
  line-height: 1;
  user-select: none;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.cell .face { display: block; transform: translateZ(0); }

/* spinning reels */
.cell.blur .face { filter: blur(3.5px); animation: reelroll 0.12s linear infinite; }
@keyframes reelroll {
  0% { transform: translateY(-46%) scale(0.94); opacity: 0.55; }
  100% { transform: translateY(46%) scale(0.94); opacity: 0.55; }
}
.cell.landing { animation: land 0.42s cubic-bezier(0.16, 1.4, 0.4, 1) both; }
@keyframes land {
  0% { transform: translateY(-70%) scale(1.18); filter: brightness(1.9); }
  60% { transform: translateY(6%) scale(0.96); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}

/* winning cells */
.cell.win {
  z-index: 3;
  border-color: var(--wc, var(--gold));
  background: linear-gradient(180deg, color-mix(in srgb, var(--wc, var(--gold)) 34%, transparent), rgba(255, 255, 255, 0.05));
  box-shadow: 0 0 0 1px var(--wc, var(--gold)), 0 0 22px color-mix(in srgb, var(--wc, var(--gold)) 60%, transparent);
  animation: winpulse 0.62s cubic-bezier(0.2, 1.5, 0.4, 1);
}
@keyframes winpulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.26) rotate(-3deg); }
  70% { transform: scale(0.97) rotate(2deg); }
  100% { transform: scale(1); }
}
.cell.win .face { animation: facepop 0.62s ease; }
@keyframes facepop { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }

.cell.settled {
  border-color: rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
}
.cell.dim { opacity: 0.34; filter: saturate(0.4); }

/* nudge targeting */
.board.nudging .cell { cursor: crosshair; }
.board.nudging .cell:hover {
  transform: scale(1.12);
  border-color: var(--cool);
  box-shadow: 0 0 0 2px var(--cool), 0 0 26px rgba(56, 232, 255, 0.65);
  z-index: 4;
}
.cell.nudged { animation: nudged 0.6s cubic-bezier(0.16, 1.4, 0.4, 1) both; }
@keyframes nudged {
  0% { transform: scale(0.2) rotate(-180deg); filter: brightness(3); }
  60% { transform: scale(1.2) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}

.cell .chip {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 6px #000, 0 0 12px var(--wc, var(--gold));
  pointer-events: none;
  animation: chipfly 1.05s ease-out forwards;
  z-index: 6;
}
@keyframes chipfly {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.6); }
  25% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(0.95); }
}

/* path overlay */
.paths { position: absolute; inset: 6px; z-index: 2; pointer-events: none; overflow: visible; }
.paths polyline {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px currentColor);
  opacity: 0.95;
}
.paths .halo { stroke-width: 16; opacity: 0.2; }

.board-flash {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.9), transparent 60%);
  opacity: 0;
}
.board-flash.go { animation: flash 0.45s ease-out; }
@keyframes flash { 0% { opacity: 0.75; } 100% { opacity: 0; } }

.banner {
  position: absolute;
  inset-inline: 0;
  top: 42%;
  z-index: 7;
  text-align: center;
  font-weight: 900;
  font-size: clamp(24px, 6vw, 62px);
  letter-spacing: 0.06em;
  pointer-events: none;
  opacity: 0;
  color: #fff;
  text-shadow: 0 0 24px var(--hot), 0 6px 0 rgba(0, 0, 0, 0.35);
}
.banner.show { animation: bannerpop 1.5s cubic-bezier(0.2, 1.3, 0.3, 1) forwards; }
@keyframes bannerpop {
  0% { opacity: 0; transform: scale(0.4) rotate(-8deg); }
  18% { opacity: 1; transform: scale(1.18) rotate(2deg); }
  32% { transform: scale(1) rotate(0); }
  78% { opacity: 1; transform: scale(1.02); }
  100% { opacity: 0; transform: scale(1.5); }
}

.board-wrap.shake { animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-7px, 0, 0); }
  40%, 60% { transform: translate3d(7px, 0, 0); }
}

/* ---------------------------- controls ---------------------------- */

.controls { margin-top: 10px; display: grid; gap: 8px; }
.control-row { display: flex; gap: 12px; justify-content: center; }

.bigbtn {
  position: relative;
  flex: 1 1 auto;
  max-width: 340px;
  padding: 11px 20px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  color: #fff;
  display: grid;
  gap: 2px;
  font-family: inherit;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
  overflow: hidden;
}
.bigbtn-face { font-size: 21px; font-weight: 900; letter-spacing: 0.16em; }
.bigbtn-sub { font-size: 11px; opacity: 0.8; letter-spacing: 0.08em; text-transform: uppercase; }
.bigbtn.spin { background: linear-gradient(180deg, #ff5c8a, var(--hot) 45%, #b4004f); box-shadow: 0 10px 0 #7d0135, 0 20px 40px rgba(255, 45, 120, 0.4); }
.bigbtn.cash { background: linear-gradient(180deg, #7dffc4, var(--green) 45%, #12a869); color: #062418; box-shadow: 0 10px 0 #0a6b43, 0 20px 40px rgba(82, 245, 168, 0.35); }
.bigbtn:hover:not(:disabled) { transform: translateY(-3px); filter: brightness(1.08); }
.bigbtn:active:not(:disabled) { transform: translateY(7px); box-shadow: 0 3px 0 #7d0135, 0 8px 18px rgba(0, 0, 0, 0.5); }
.bigbtn:disabled { filter: grayscale(0.75) brightness(0.6); cursor: not-allowed; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.4); }
.bigbtn.spin::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.55) 48%, transparent 62%);
  transform: translateX(-120%);
  animation: sheen 3.4s ease-in-out infinite;
}
@keyframes sheen { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

.nudge-tray {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 14px;
  background: rgba(56, 232, 255, 0.08);
  border: 1px solid rgba(56, 232, 255, 0.3);
}
.nudge-label { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--cool); font-weight: 800; }
.nudge-pips { display: flex; gap: 5px; }
.pip { font-size: 18px; transition: transform 0.2s ease, filter 0.2s ease; }
.pip.spent { filter: grayscale(1) brightness(0.5); transform: scale(0.8); }
.nudge-hint { font-size: 12px; color: var(--ink-dim); }

.countdown {
  text-align: center;
  font-size: 13px;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
}
.countdown b { color: var(--gold); font-variant-numeric: tabular-nums; font-size: 16px; }

/* ---------------------------- ticker ---------------------------- */

.ticker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-hard);
  min-height: 200px;
}

.scorebox { text-align: center; padding: 8px 0 4px; }
.scorebox-k { font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-dim); }
.scorebox-v {
  font-size: clamp(38px, 7vw, 54px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  background: linear-gradient(180deg, #fff, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 212, 94, 0.4));
}
.scorebox-v.bump { animation: bump 0.28s ease; }
@keyframes bump { 50% { transform: scale(1.14); } }
.scorebox-meta { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 4px; }
.win-count { font-size: 12px; color: var(--ink-dim); }
.fever-tag {
  font-size: 11px; font-weight: 900; letter-spacing: 0.1em;
  padding: 2px 8px; border-radius: 999px;
  background: linear-gradient(95deg, var(--hot), var(--hot-2));
  animation: feverglow 1.1s ease-in-out infinite alternate;
}
@keyframes feverglow { to { box-shadow: 0 0 18px var(--hot); } }

.combo-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-dim);
  border-top: 1px solid var(--panel-line);
  padding-top: 10px;
}
.linkbtn {
  background: none; border: none; cursor: pointer;
  color: var(--cool); font-family: inherit; font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 4px;
}
.linkbtn:hover { color: #fff; text-shadow: 0 0 12px var(--cool); }

/* ------------------------- copy result button ------------------------- */

.ticker-foot { display: grid; }

.sharebtn {
  position: relative;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 13px;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2a1a02;
  background: linear-gradient(100deg, #ffb547, var(--gold) 32%, #fff3c4 50%, var(--gold) 68%, #f59e19);
  background-size: 220% 100%;
  box-shadow: 0 6px 0 #a4720a, 0 12px 26px rgba(255, 190, 60, 0.42);
  animation: sharesheen 3.6s linear infinite, sharebreathe 2.4s ease-in-out infinite;
  transition: transform 0.12s ease, filter 0.2s ease;
}
@keyframes sharesheen { to { background-position: 220% 0; } }
@keyframes sharebreathe {
  0%, 100% { box-shadow: 0 6px 0 #a4720a, 0 12px 26px rgba(255, 190, 60, 0.42); }
  50%      { box-shadow: 0 6px 0 #a4720a, 0 12px 34px rgba(255, 212, 94, 0.8); }
}
.sharebtn:hover { transform: translateY(-2px); filter: brightness(1.07) saturate(1.1); }
.sharebtn:active { transform: translateY(5px); }

.sharebtn-face { position: relative; z-index: 2; }

.sharebtn-sparkles { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.sharebtn-sparkles i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  opacity: 0;
  /* Four-point sparkle: crossed tapers pinched at the centre. */
  background: #fffdf2;
  clip-path: polygon(
    50% 0%, 58% 42%, 100% 50%, 58% 58%,
    50% 100%, 42% 58%, 0% 50%, 42% 42%
  );
  filter: drop-shadow(0 0 4px #fff8d6);
  animation: sparkle 2.1s ease-in-out infinite;
  animation-delay: var(--d);
}
@keyframes sparkle {
  0%, 72%, 100% { opacity: 0; transform: scale(0) rotate(0deg); }
  82%           { opacity: 1; transform: scale(var(--s)) rotate(70deg); }
  92%           { opacity: 0; transform: scale(0) rotate(140deg); }
}

body.calm .sharebtn { animation: none; }
body.calm .sharebtn-sparkles { display: none; }

.combo-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 5px;
  max-height: 46vh;
  overflow-y: auto;
  scrollbar-width: thin;
}
@media (max-width: 940px) { .combo-list { max-height: 260px; } }

.combo-empty { color: var(--ink-dim); font-size: 12.5px; font-style: italic; padding: 8px 2px; }

.combo {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--tc, var(--tier-common));
  animation: slidein 0.34s cubic-bezier(0.2, 1.3, 0.3, 1) both;
}
@keyframes slidein { from { opacity: 0; transform: translateX(26px) scale(0.9); } }
.combo-icon { font-size: 16px; text-align: center; }
.combo-name { font-size: 12.5px; font-weight: 700; }
.combo-detail { font-size: 10.5px; color: var(--ink-dim); }
.combo-score { font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--tc, var(--tier-common)); }
.combo.bonus { border-left-color: var(--gold); background: rgba(255, 212, 94, 0.12); }

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

.toasts {
  position: fixed;
  z-index: 60;
  top: 14px; right: 14px;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  max-width: min(340px, 84vw);
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px;
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(40, 20, 70, 0.96), rgba(20, 10, 40, 0.96));
  border: 1px solid var(--gold);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 26px rgba(255, 212, 94, 0.28);
  animation: toastin 0.42s cubic-bezier(0.2, 1.4, 0.3, 1) both, toastout 0.4s ease 3.1s both;
}
@keyframes toastin { from { opacity: 0; transform: translateX(120%) scale(0.85); } }
@keyframes toastout { to { opacity: 0; transform: translateX(120%) scale(0.9); } }
.toast-icon { font-size: 24px; filter: drop-shadow(0 0 8px var(--gold)); }
.toast-title { font-size: 13px; font-weight: 900; letter-spacing: 0.04em; }
.toast-desc { font-size: 11px; color: var(--ink-dim); }
.toast-bonus { margin-left: auto; font-weight: 900; color: var(--gold); font-size: 14px; }
.toast.repeat { border-color: var(--panel-line); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); }
.toast.repeat .toast-icon { filter: none; opacity: 0.7; }

/* ---------------------------- confetti ---------------------------- */

.confetti { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.spark {
  position: absolute;
  width: 9px; height: 14px;
  border-radius: 2px;
  will-change: transform, opacity;
  animation: fall linear forwards;
}
@keyframes fall {
  0% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate3d(var(--dx), 105vh, 0) rotate(var(--rot)); }
}

/* ---------------------------- sheets ---------------------------- */

.sheet {
  width: min(760px, 94vw);
  max-height: 86vh;
  padding: 0;
  border: 1px solid var(--panel-line);
  border-radius: 20px;
  background: linear-gradient(180deg, #1b0f36, #0d0620);
  color: var(--ink);
  box-shadow: var(--shadow-hard);
  overflow: hidden;
}
.sheet::backdrop { background: rgba(4, 2, 10, 0.72); backdrop-filter: blur(4px); }
.sheet[open] { animation: sheetin 0.28s cubic-bezier(0.2, 1.2, 0.3, 1); }
@keyframes sheetin { from { opacity: 0; transform: translateY(24px) scale(0.96); } }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--panel-line);
  position: sticky; top: 0;
  background: rgba(20, 10, 40, 0.96);
  backdrop-filter: blur(8px);
}
.sheet-head h2 { margin: 0; font-size: 18px; letter-spacing: 0.1em; text-transform: uppercase; }
.sheet-body { padding: 16px 18px 26px; overflow-y: auto; max-height: calc(86vh - 60px); }

.pill {
  font-size: 11px; padding: 2px 9px; border-radius: 999px;
  background: rgba(255, 212, 94, 0.18); color: var(--gold);
  letter-spacing: 0.06em; vertical-align: middle;
}

.pt-section { margin-bottom: 22px; }
.pt-section h3 {
  margin: 0 0 8px; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold);
}
.pt-note { font-size: 12.5px; color: var(--ink-dim); margin: 0 0 10px; line-height: 1.55; }

.symgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 7px; }
.symcard {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--cc);
}
.symcard .s { font-size: 21px; }
.symcard .n { font-size: 11px; color: var(--ink-dim); }
.symcard .v { font-size: 13px; font-weight: 800; margin-left: auto; }

.mechs { display: grid; gap: 8px; }
.mech {
  display: grid; grid-template-columns: 62px 1fr; gap: 12px; align-items: center;
  padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.04);
}
.mech svg { width: 62px; height: 62px; }
.mech h4 { margin: 0 0 2px; font-size: 13px; }
.mech p { margin: 0; font-size: 11.5px; color: var(--ink-dim); line-height: 1.5; }
.mini-cell { fill: rgba(255, 255, 255, 0.08); }
.mini-on { fill: var(--gold); }

.achsummary {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -4px 0 18px;
  padding: 10px 12px 12px;
  border-radius: 12px;
  background: rgba(20, 10, 40, 0.96);
  border: 1px solid var(--panel-line);
  backdrop-filter: blur(8px);
}
.achbar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.achbar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--hot-2));
  box-shadow: 0 0 14px rgba(255, 212, 94, 0.6);
  transition: width 0.4s cubic-bezier(0.2, 1, 0.3, 1);
}
.achsummary-meta {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 7px;
  font-size: 11px;
  color: var(--ink-dim);
}
.achsummary-meta b { color: var(--ink); font-size: 13px; }

.achfilters { display: flex; gap: 6px; margin-top: 9px; }
.achfilter {
  flex: 1;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--panel-line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.achfilter:hover { background: rgba(160, 107, 255, 0.2); color: var(--ink); }
.achfilter.on { background: rgba(255, 212, 94, 0.18); border-color: var(--gold); color: var(--gold); }

.achgroup { margin-bottom: 20px; }
.achgroup h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--cool); }
.achgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.ach {
  display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center;
  padding: 9px 11px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
}
.ach.got { background: rgba(255, 212, 94, 0.12); border-color: rgba(255, 212, 94, 0.4); }
.ach-icon { font-size: 24px; text-align: center; filter: grayscale(1) opacity(0.35); }
.ach.got .ach-icon { filter: none; }
.ach-name { font-size: 12.5px; font-weight: 800; }
.ach-desc { font-size: 10.5px; color: var(--ink-dim); line-height: 1.4; }
.ach-bonus { font-size: 10.5px; color: var(--gold); font-weight: 800; }

.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 9px; margin-bottom: 18px; }
.statcard { padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); text-align: center; }
.statcard .k { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim); }
.statcard .v { font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }

.histtable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.histtable th { text-align: left; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); padding: 6px 8px; }
.histtable td { padding: 7px 8px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.histtable td.num { font-variant-numeric: tabular-nums; font-weight: 800; text-align: right; }

/* ---------------------------- leaderboard ---------------------------- */

.lbtabs {
  display: flex; gap: 6px;
  position: sticky; top: 0; z-index: 2;
  margin: -4px 0 14px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(20, 10, 40, 0.96);
  border: 1px solid var(--panel-line);
  backdrop-filter: blur(8px);
}
.lbtab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.lbtab:hover { background: rgba(160, 107, 255, 0.22); color: var(--ink); }
.lbtab.on {
  background: linear-gradient(180deg, rgba(255, 212, 94, 0.24), rgba(255, 138, 61, 0.14));
  border-color: var(--gold);
  color: var(--gold);
}

.lbtable td:first-child { width: 44px; }
.lbrank { font-weight: 900; font-variant-numeric: tabular-nums; color: var(--ink-dim); }
.lbme {
  background: linear-gradient(90deg, rgba(56, 232, 255, 0.16), transparent);
  outline: 1px solid rgba(56, 232, 255, 0.4);
}
.lbme td { color: var(--ink); }
.lbyou {
  margin-left: 7px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--cool);
  color: #04222a;
}
.lbdetached { margin-top: 10px; border-top: 1px dashed var(--panel-line); padding-top: 6px; }
.lbcta { color: var(--cool); }

/* ------------------------ save-your-results prompt ------------------------ */

.prompt {
  width: min(430px, 92vw);
  padding: 0;
  border: 1px solid rgba(255, 212, 94, 0.5);
  border-radius: 20px;
  background: linear-gradient(180deg, #241245, #100827);
  color: var(--ink);
  box-shadow: var(--shadow-hard), 0 0 60px rgba(255, 190, 60, 0.28);
  overflow: hidden;
}
.prompt::backdrop { background: rgba(4, 2, 10, 0.76); backdrop-filter: blur(5px); }
.prompt[open] { animation: promptin 0.4s cubic-bezier(0.2, 1.3, 0.3, 1); }
@keyframes promptin { from { opacity: 0; transform: translateY(26px) scale(0.94); } }

.prompt-glow {
  position: absolute; inset: -40% -20% auto; height: 220px;
  background: radial-gradient(closest-side, rgba(255, 212, 94, 0.4), transparent 70%);
  pointer-events: none;
}
.prompt-body { position: relative; padding: 22px 22px 18px; text-align: center; }
.prompt-icon { font-size: 42px; filter: drop-shadow(0 0 18px rgba(255, 212, 94, 0.7)); }
.prompt-title { margin: 6px 0 2px; font-size: 22px; letter-spacing: 0.02em; }
.prompt-score {
  margin: 0 0 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}
.prompt-copy { margin: 0 0 14px; font-size: 12.5px; line-height: 1.6; color: var(--ink-dim); }

.prompt-field { display: block; text-align: left; margin-bottom: 14px; }
.prompt-field span {
  display: block; margin-bottom: 5px;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim);
}
.prompt-field em { font-style: normal; opacity: 0.7; text-transform: none; letter-spacing: 0; }
.prompt-field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
}
.prompt-field input:focus { outline: 2px solid var(--cool); outline-offset: 1px; }

.prompt-actions { display: grid; gap: 8px; }
.prompt-go {
  padding: 13px 18px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2a1a02;
  background: linear-gradient(100deg, #ffb547, var(--gold) 40%, #fff3c4 55%, var(--gold) 70%, #f59e19);
  background-size: 200% 100%;
  box-shadow: 0 5px 0 #a4720a, 0 12px 26px rgba(255, 190, 60, 0.4);
  animation: sharesheen 3.6s linear infinite;
  transition: transform 0.12s ease, filter 0.2s ease;
}
.prompt-go:hover { transform: translateY(-2px); filter: brightness(1.06); }
.prompt-go:active { transform: translateY(4px); }
.prompt-skip {
  padding: 9px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.prompt-skip:hover { color: var(--ink); }
.prompt-fine { margin: 12px 0 0; font-size: 10.5px; color: var(--ink-dim); opacity: 0.85; }

/* ---------------------------- footer ---------------------------- */

.footer {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  font-size: 11px;
  color: var(--ink-dim);
}

.footer-meta {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  flex-wrap: wrap;
}

.responsible {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--panel-line);
  background: rgba(10, 6, 22, 0.5);
  /* Kept readable on purpose — this notice should not be the faintest thing
     on the page. */
  color: #b9aede;
  line-height: 1.55;
  max-width: 760px;
}
.responsible p { margin: 0 0 6px; }
.responsible p:last-child { margin-bottom: 0; }
.responsible-head {
  margin: 0 0 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}
.responsible a {
  color: var(--cool);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.responsible a:hover { color: #fff; text-shadow: 0 0 10px var(--cool); }

/* ---------------------------- a11y ---------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
body.calm .bg-glow, body.calm .brand-mark, body.calm .bigbtn.spin::after { animation: none; }
body.calm .cell.blur .face { animation: none; filter: blur(2px); }

:focus-visible { outline: 2px solid var(--cool); outline-offset: 2px; }

/* ------------------------------ auth ------------------------------ */

.auth-hint { color: var(--ink-dim); font-size: 13px; line-height: 1.55; margin: 0 0 16px; }
.auth-ok { color: var(--green); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; font-size: 15px; margin-bottom: 4px; }
.auth-email { color: var(--ink); font-size: 15px; margin-bottom: 12px; word-break: break-all; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--panel-line);
  background: rgba(10, 6, 20, 0.7); color: var(--ink); font-size: 15px; outline: none;
}
.auth-input::placeholder { color: var(--ink-dim); opacity: 0.7; }
.auth-input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(160, 107, 255, 0.25); }
.auth-send, .auth-signout { justify-content: center; }
.auth-status { margin-top: 14px; font-size: 13px; color: var(--gold); line-height: 1.5; }
.auth-status.ok { color: var(--green); }

