:root {
  --bg: #0a0710;
  --bg-2: #120c1c;
  --panel: #17102310;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f2ecff;
  --muted: #a094ba;
  --gold: #ffc857;
  --neon: #ff3d81;
  --neon-2: #7b5cff;
  --win: #43e08a;
  --lose: #ff6b6b;
  --radius: 14px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(123, 92, 255, 0.22), transparent 60%),
    radial-gradient(1000px 500px at 90% 0%, rgba(255, 61, 129, 0.16), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ------------------------------- header ------------------------------- */

header.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(10, 7, 16, 0.72);
  border-bottom: 1px solid var(--line);
}

.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 66px;
}

.brand {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.3px;
  background: linear-gradient(92deg, var(--gold), var(--neon));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

.nav { display: flex; gap: 6px; margin-left: 8px; }

.nav a {
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.nav a:hover, .nav a.active { background: var(--surface-2); color: var(--text); }

.spacer { flex: 1; }

.balance-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 200, 87, 0.16), rgba(255, 200, 87, 0.06));
  border: 1px solid rgba(255, 200, 87, 0.34);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  transition: transform 0.25s;
}

.balance-chip.bump { transform: scale(1.09); }
.balance-chip .amount { color: var(--gold); }

.who { display: flex; align-items: center; gap: 9px; }

.who img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.who .name { font-size: 14px; font-weight: 600; }

/* ------------------------------- buttons ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.discord {
  background: linear-gradient(180deg, #5b6ef5, #4553d8);
  border-color: transparent;
  color: #fff;
}

.btn.primary {
  background: linear-gradient(180deg, var(--neon), #d61f66);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 26px rgba(255, 61, 129, 0.32);
}

.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 13px; }

/* -------------------------------- panels ------------------------------ */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.panel h2 { margin: 0 0 4px; font-size: 16px; letter-spacing: 0.2px; }
.panel .hint { margin: 0 0 16px; color: var(--muted); font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* --------------------------------- hero ------------------------------- */

.hero { padding: 54px 0 30px; text-align: center; }

.hero h1 {
  margin: 0 0 12px;
  font-size: 46px;
  line-height: 1.08;
  letter-spacing: -0.5px;
}

.hero h1 span {
  background: linear-gradient(92deg, var(--gold), var(--neon), var(--neon-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p { margin: 0 auto 24px; max-width: 560px; color: var(--muted); font-size: 16px; line-height: 1.6; }

/* ------------------------------ game cards ---------------------------- */

.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }

.game-card {
  position: relative;
  display: block;
  padding: 22px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.028));
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform 0.18s, border-color 0.18s;
}

.game-card:hover { transform: translateY(-3px); border-color: rgba(255, 61, 129, 0.45); }
.game-card.soon { opacity: 0.5; pointer-events: none; }
.game-card .icon { font-size: 34px; }
.game-card h3 { margin: 12px 0 6px; font-size: 18px; }
.game-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.game-card .rtp {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(67, 224, 138, 0.14);
  border: 1px solid rgba(67, 224, 138, 0.3);
  color: var(--win);
}

.game-card .rtp.soon-tag {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--muted);
}

/* ------------------------------- sections ----------------------------- */

section { margin: 34px 0; }

section > h2 {
  margin: 0 0 14px;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

section > h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* --------------------------------- table ------------------------------ */

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--line);
}

td { padding: 11px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank { width: 34px; color: var(--muted); font-weight: 700; }
.pos { color: var(--win); }
.neg { color: var(--lose); }

.player { display: flex; align-items: center; gap: 9px; }
.player img { width: 26px; height: 26px; border-radius: 50%; }

.avatar-fallback {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
}

/* ------------------------------- notices ------------------------------ */

.notice {
  padding: 13px 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.notice.error { border-color: rgba(255, 107, 107, 0.4); background: rgba(255, 107, 107, 0.09); color: #ffc9c9; }
.notice.good { border-color: rgba(67, 224, 138, 0.35); background: rgba(67, 224, 138, 0.09); color: #b6f3d1; }

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 16px;
  border-radius: 11px;
  background: rgba(23, 16, 35, 0.96);
  border: 1px solid var(--line);
  font-size: 14px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.22s ease;
}

.toast.error { border-color: rgba(255, 107, 107, 0.5); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.muted { color: var(--muted); }
.mono { font-family: 'Cascadia Mono', ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }

footer {
  margin-top: 60px;
  padding: 26px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.7;
}

@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 33px; }
  .nav { display: none; }

  /* The header must fit 375px: drop the name, shrink the chip, keep the
     balance and the sign-out button — those are the two that matter. */
  .topbar .wrap { gap: 10px; padding: 0 12px; }
  .brand { font-size: 16px; }
  .who .name { display: none; }
  .balance-chip { padding: 7px 11px; font-size: 14px; }
  .btn.ghost.small, .who .btn { padding: 6px 10px; font-size: 12px; }
}

/* Narrowest phones: shorten the wordmark rather than dropping it — it is the
   only way back to the lobby once the nav is hidden. (An emoji here would be
   swallowed by the brand's gradient text-clip.) */
@media (max-width: 380px) {
  .brand { font-size: 0; }
  .brand::after { content: 'YOON'; font-size: 16px; }
}

/* Injected sprite sheet — present in the DOM only so <use> can reference it. */
.sprite-host { position: absolute; width: 0; height: 0; overflow: hidden; }

.game-card .icon.sprite { width: 54px; height: 54px; }
.game-card .icon.sprite svg { width: 100%; height: 100%; display: block; }
.game-card:hover { border-color: color-mix(in srgb, var(--card-accent, var(--neon)) 60%, transparent); }

.sound-toggle { font-size: 15px; line-height: 1; padding: 6px 9px; }
.sound-toggle.muted { opacity: 0.5; }
