/* TallonGames */
:root {
  --bg: #0d0e22;
  --bg2: #15173a;
  --card: #1b1d40;
  --card2: #23265a;
  --line: #2f3270;
  --text: #eef0ff;
  --muted: #9aa0d0;
  --hot: #ff4d6d;
  --hot2: #ff8a5c;
  --gold: #ffd166;
  --ok: #3ddc97;
  --warn: #ffb547;
  --blue: #4ea8ff;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #2a1d5c 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #3a1240 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.5;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: .875rem; }
.inline { display: inline; margin: 0; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 10px max(16px, env(safe-area-inset-left));
  background: rgba(13, 14, 34, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 1.25rem; letter-spacing: .3px; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--hot); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: conic-gradient(from 200deg, var(--hot), var(--gold), var(--ok), var(--blue), var(--hot));
  box-shadow: 0 0 16px rgba(255, 77, 109, .5);
}
.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav a, .nav .linklike { color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 600; }
.nav a:hover, .nav .linklike:hover { color: var(--text); background: var(--card); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--card2); }
.nav .btn { color: #fff; }
.nav-spacer { flex: 1; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 10px; font-size: 1.2rem; padding: 4px 12px; cursor: pointer; }
.linklike { background: none; border: none; color: var(--gold); font: inherit; cursor: pointer; padding: 0; }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; padding: 8px 16px 16px; background: var(--bg2); border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; }
  .nav-spacer { display: none; }
  .nav a, .nav .linklike, .nav form { text-align: left; }
  .nav .btn { text-align: center; margin-top: 6px; }
}

.banner { background: #3b2a0a; color: #ffe2a8; padding: 10px 16px; text-align: center; font-size: .925rem; border-bottom: 1px solid #5a4210; }

main.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; flex: 1; }
main.wide { width: 100%; max-width: 1280px; margin: 0 auto; padding: 16px 16px 48px; flex: 1; }

.footer { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; padding: 22px 16px 30px; color: var(--muted); border-top: 1px solid var(--line); font-size: .9rem; }
.footer a { color: var(--muted); }

/* ---- Buttons / forms ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card2); color: var(--text); font: inherit; font-weight: 700;
  cursor: pointer; transition: transform .08s, filter .15s, background .15s;
  text-decoration: none; touch-action: manipulation;
}
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-hot { background: linear-gradient(135deg, var(--hot), var(--hot2)); border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(255, 77, 109, .3); }
.btn-gold { background: var(--gold); border-color: transparent; color: #2b1d00; }
.btn-ghost { background: transparent; }
.btn-small { padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn-big { padding: 15px 28px; font-size: 1.1rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; }
input, select {
  font: inherit; color: var(--text); background: var(--bg2);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.check { flex-direction: row !important; align-items: center; gap: 10px !important; font-weight: 500 !important; }
.check input { width: auto; }

.auth-card { max-width: 420px; margin: 24px auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.narrow { max-width: 640px; margin: 0 auto; }

.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; border: 1px solid; }
.flash-success { background: #0f3326; border-color: #1f6b4e; color: #b6f5d8; }
.flash-error { background: #3a1220; border-color: #7a2440; color: #ffc2d0; }
.flash-info { background: #12264a; border-color: #23498a; color: #c4dcff; }

.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; margin-left: 6px; vertical-align: middle; }
.pill-ok { background: #0f3326; color: var(--ok); }
.pill-warn { background: #3b2a0a; color: var(--warn); }
.pill-hot { background: #3a1220; color: var(--hot); }
.pill-blue { background: #12264a; color: var(--blue); }

/* ---- Tabs / tables ---- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.tab { padding: 8px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-weight: 700; font-size: .95rem; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { background: var(--hot); border-color: transparent; color: #fff; }
.subtabs .tab.active { background: var(--card2); border-color: var(--gold); color: var(--gold); }

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table.board { width: 100%; border-collapse: collapse; background: var(--card); font-size: .95rem; }
table.board th, table.board td { padding: 10px 14px; text-align: left; white-space: nowrap; }
table.board th { background: var(--bg2); color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
table.board tr + tr td { border-top: 1px solid var(--line); }
table.board td.num, table.board th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.board tr.me td { background: rgba(255, 209, 102, .08); }
.rank { font-weight: 800; color: var(--muted); width: 1%; }
.rank-1 { color: var(--gold); }
.rank-2 { color: #d6dbff; }
.rank-3 { color: #ff9f6b; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* ---- Home ---- */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 32px; align-items: center; padding: 24px 0 36px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
.hero h1 span { background: linear-gradient(90deg, var(--hot), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 1.1rem; color: var(--muted); }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } }
.mode-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--text); transition: transform .12s, border-color .12s; }
.mode-card:hover { transform: translateY(-2px); border-color: var(--hot); text-decoration: none; }
.mode-card h3 { margin-bottom: 6px; color: var(--gold); }
.mode-card p { color: var(--muted); margin: 0; font-size: .95rem; }
.mode-card .best { margin-top: 10px; font-size: .85rem; color: var(--text); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 14px; flex-wrap: wrap; }

/* ---- Play layout ---- */
.play-layout { display: grid; grid-template-columns: minmax(0, 560px) minmax(260px, 1fr); gap: 24px; align-items: start; justify-content: center; }
@media (max-width: 900px) { .play-layout { grid-template-columns: 1fr; } }
.side { display: flex; flex-direction: column; gap: 16px; }
.side .card h2 { font-size: 1.05rem; }
.mini-board { list-style: none; margin: 0; padding: 0; }
.mini-board li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: .95rem; }
.mini-board li:first-child { border-top: none; }
.mini-board li span:last-child { font-variant-numeric: tabular-nums; font-weight: 700; }
.keys { display: grid; grid-template-columns: repeat(4, 28px); gap: 4px; margin-top: 8px; }
.keys kbd { display: grid; place-items: center; height: 26px; border-radius: 6px; background: var(--bg2); border: 1px solid var(--line); font-size: .8rem; font-family: inherit; }
.result-box { text-align: center; }
.result-box .big { font-size: 2.4rem; font-weight: 900; color: var(--gold); line-height: 1.1; }

/* =================== The Dabpad device =================== */
.dabpad {
  --pad-gap: clamp(8px, 2.4vw, 14px);
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(14px, 3.5vw, 26px);
  border-radius: 26px;
  background: linear-gradient(160deg, #fbfaf6 0%, #ece9e0 100%);
  box-shadow: 0 2px 0 #fff inset, 0 -3px 0 #d3cfc2 inset, 0 30px 60px rgba(0, 0, 0, .45);
  color: #1b1b22;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.dabpad.shake { animation: dp-shake .35s; }
@keyframes dp-shake {
  20% { transform: translateX(-6px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(3px); }
}
.dp-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dp-logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: clamp(1.1rem, 3.5vw, 1.45rem); color: #3a3a46; letter-spacing: .2px; }
.dp-logo sup { font-size: .55em; color: var(--hot); margin-left: 2px; }
.dp-dots { display: inline-flex; gap: 2px; }
.dp-dots i { width: 13px; height: 13px; border-radius: 50%; display: block; }
.dp-dots i:nth-child(1) { background: #e23d4f; }
.dp-dots i:nth-child(2) { background: #f39a2b; transform: translateY(-5px); }
.dp-dots i:nth-child(3) { background: #49b84b; }
.dp-sound { border: none; background: #fff; border-radius: 10px; width: 40px; height: 34px; font-size: 1.1rem; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.dp-sound.off { opacity: .6; }

.dp-hud { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.dp-stat { background: #1d1f33; color: #fff; border-radius: 10px; padding: 6px 10px; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.dp-stat span { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #a8acd6; }
.dp-stat b { font-size: clamp(1.05rem, 3.6vw, 1.35rem); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-lives i { font-style: normal; color: #4a4d6a; margin-right: 2px; }
.dp-lives i.on { color: var(--hot); }

.dp-timer { height: 6px; background: #d6d2c6; border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.dp-timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #49b84b, #a6d94a); }
.dp-timer.low i { background: linear-gradient(90deg, #e23d4f, #f39a2b); }

.dp-screen { position: relative; background: #c9c7c0; border-radius: 16px; padding: var(--pad-gap); box-shadow: 0 2px 6px rgba(0,0,0,.18) inset; }
.dp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--pad-gap); touch-action: none; }

.pad {
  position: relative;
  aspect-ratio: 1 / 1;
  border: none;
  padding: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #eeeeea 55%, #d8d7d0 100%);
  box-shadow: 0 3px 0 #b3b1a8, 0 5px 10px rgba(0,0,0,.18);
  cursor: pointer;
  color: #17171c;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .06s;
  overflow: hidden;
}
.pad svg { position: absolute; inset: 20%; width: 60%; height: 60%; fill: none; stroke: currentColor; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; z-index: 2; pointer-events: none; }
.pad .pad-light { position: absolute; inset: 0; border-radius: 50%; opacity: 0; transition: opacity .08s; z-index: 1; pointer-events: none; }
.pad .pad-fill { position: absolute; inset: 0; border-radius: 50%; z-index: 1; pointer-events: none;
  background: conic-gradient(rgba(73, 184, 75, .95) calc(var(--fill, 0) * 360deg), transparent 0); }
.pad.held { transform: translateY(2px) scale(.97); box-shadow: 0 1px 0 #b3b1a8, 0 2px 4px rgba(0,0,0,.2); }
.pad:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.pad[data-light] { color: #fff; }
.pad[data-light] .pad-light { opacity: 1; }
.pad[data-light="red"] .pad-light { background: radial-gradient(circle at 35% 30%, #ff8a8a, #e3213a 60%, #9d0f22); box-shadow: 0 0 22px 4px rgba(255, 40, 70, .6) inset; }
.pad[data-light="green"] .pad-light { background: radial-gradient(circle at 35% 30%, #b2ff9e, #31c24a 60%, #137a26); }
.pad[data-light="yellow"] .pad-light { background: radial-gradient(circle at 35% 30%, #fff6b0, #ffcd1f 60%, #c18c00); }
.pad[data-light="yellow"] { color: #3a2a00; }
.pad[data-light="blue"] .pad-light { background: radial-gradient(circle at 35% 30%, #a8d8ff, #2f8cff 60%, #134fa6); }
.pad[data-light="done"] .pad-light { background: radial-gradient(circle at 35% 30%, #ffffff, #c7f1ff 70%, #8fd3ea); }
.pad[data-light="done"] { color: #1d5f78; }
.pad[data-light="show"] .pad-light { background: transparent; box-shadow: 0 0 0 5px #2f8cff inset; animation: dp-blink .4s 3; }
.pad[data-light="show"] { color: #134fa6; }
.pad[data-light="bomb"] .pad-light { background: radial-gradient(circle, #fff1a8 0%, #ff7b00 40%, #b00000 75%, #2a0000 100%); animation: dp-boom .6s; }
.pad[data-light="bomb"] svg, .pad[data-light="bomb-safe"] svg { opacity: 0; }
.pad[data-light="bomb"]::after, .pad[data-light="bomb-safe"]::after { content: "💣"; position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(1.4rem, 6vw, 2.4rem); z-index: 3; }
.pad[data-light="bomb-safe"] .pad-light { background: radial-gradient(circle, #555 0%, #222 100%); }

/* Catch Me: a shrinking ring shows how long a red pad stays lit. */
.dabpad[data-mode="catch"] .pad[data-light="red"]::before {
  content: ""; position: absolute; inset: 4px; border-radius: 50%; z-index: 3; pointer-events: none;
  border: 4px solid rgba(255, 255, 255, .9);
  animation: dp-life var(--life, 1500ms) linear forwards;
}
@keyframes dp-life { from { transform: scale(1); opacity: 1; } to { transform: scale(.25); opacity: .2; } }
@keyframes dp-blink { 50% { opacity: .2; } }
@keyframes dp-boom { 0% { transform: scale(.3); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

.pad.flash-hit { animation: dp-hit .3s; }
.pad.flash-bad { animation: dp-bad .5s; }
@keyframes dp-hit { 50% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(73,184,75,.6), 0 5px 10px rgba(0,0,0,.18); } }
@keyframes dp-bad { 0%, 100% { box-shadow: 0 3px 0 #b3b1a8; } 30%, 70% { box-shadow: 0 0 0 6px rgba(226, 33, 58, .8); } }

.dp-overlay { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 16px; background: rgba(20, 21, 40, .78); z-index: 10; text-align: center; padding: 16px; color: #fff; }
.dp-overlay[hidden] { display: none; }
.dp-overlay.toast { background: transparent; pointer-events: none; }
.dp-overlay.toast .dp-msg { background: rgba(20, 21, 40, .85); padding: 10px 20px; border-radius: 14px; }
.dp-msg b { display: block; font-size: clamp(1.5rem, 6vw, 2.3rem); font-weight: 900; }
.dp-msg span { display: block; color: #d6d9ff; margin-top: 6px; }
.dp-msg .btn { margin-top: 14px; }
.dp-overlay.countdown .dp-msg b { font-size: clamp(3rem, 14vw, 5.5rem); color: var(--gold); }

.dp-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.dp-actions[hidden] { display: none; }
.dp-pot { font-weight: 700; font-size: 1.1rem; }
.dp-pot b { color: var(--hot); font-size: 1.4rem; }

.dp-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; }
.dp-mode { border: none; background: transparent; color: #4a4a58; font: inherit; font-weight: 700; font-size: clamp(.7rem, 2.6vw, .92rem); padding: 8px 2px; border-radius: 10px; cursor: pointer; }
.dp-mode:hover:not(:disabled) { background: rgba(0,0,0,.06); }
.dp-mode.active { background: #1d1f33; color: #fff; }
.dp-mode:disabled { cursor: default; }

/* ---- Versus ---- */
.vs-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-bottom: 16px; }
.vs-player { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.vs-player.right { text-align: right; }
.vs-player .name { font-weight: 800; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-player .score { font-size: clamp(1.4rem, 5vw, 2rem); font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.vs-player .meta { color: var(--muted); font-size: .85rem; min-height: 1.3em; }
.vs-player.leading { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.vs-mid { font-weight: 900; color: var(--hot); font-size: 1.4rem; }
.queue-box { text-align: center; padding: 28px 20px; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--hot); animation: spin 1s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.invite-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.invite-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; background: var(--bg2); border-radius: 12px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 800; letter-spacing: .15em; color: var(--gold); }
.win { color: var(--ok); font-weight: 800; }
.loss { color: var(--hot); font-weight: 800; }
.draw { color: var(--muted); font-weight: 800; }

.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-bottom: 18px; }
.avatar { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-weight: 900; font-size: 1.8rem; color: #fff; background: linear-gradient(135deg, var(--hot), #7b4dff); }

.howto h2 { color: var(--gold); margin-top: 28px; }
.howto ul { padding-left: 20px; }
.howto li { margin-bottom: 6px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; margin-right: 4px; }
.result-box .big.win { color: var(--ok); }
.result-box .big.loss { color: var(--hot); }
.result-box .big.draw { color: var(--muted); }
