:root {
  --bg: #0b0e2a;
  --bg2: #12163d;
  --panel: #171c4a;
  --panel2: #1e2458;
  --line: #2b3270;
  --text: #eef0ff;
  --muted: #9aa1d6;
  --red: #ff4d6d;
  --red-d: #c9264a;
  --yellow: #ffd23f;
  --yellow-d: #d9a300;
  --board: #2448d8;
  --board-d: #1a35a8;
  --green: #2ee59d;
  --accent: #7c5cff;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #2a1f6b 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #12306e 0%, transparent 55%), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0 0 12px; letter-spacing: -.01em; }
h2 { font-size: 22px; }
h3 { font-size: 16px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ------------------------------------------------ top bar */
#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
  background: rgba(11, 14, 42, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; white-space: nowrap; }
.brand b { color: var(--yellow); }
.brand-discs { display: grid; grid-template-columns: repeat(2, 10px); gap: 3px; padding: 5px; background: var(--board); border-radius: 7px; }
.brand-discs .d { width: 10px; height: 10px; border-radius: 50%; display: block; }
.d.r { background: var(--red); } .d.y { background: var(--yellow); }
#nav { display: flex; gap: 4px; }
#nav a { padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; }
#nav a:hover { color: var(--text); background: var(--panel); }
#nav a.active { color: var(--text); background: var(--panel2); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-weight: 600; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); display: inline-block; }
.me-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; }
.me-chip .av { width: 32px; height: 32px; font-size: 18px; }
.me-chip .r { color: var(--yellow); font-size: 12px; }

/* ------------------------------------------------ layout */
#app { max-width: 1200px; margin: 0 auto; padding: 28px 24px 80px; }
.grid { display: grid; gap: 20px; }
.cols-2 { grid-template-columns: 1.3fr 1fr; }
.panel { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title h1 { font-size: 30px; margin: 0; }

/* ------------------------------------------------ buttons and inputs */
.btn { appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 700; color: #1a1030;
  background: var(--yellow); padding: 11px 18px; border-radius: 12px; transition: transform .08s, filter .15s, background .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.red { background: var(--red); color: #fff; }
.btn.purple { background: var(--accent); color: #fff; }
.btn.green { background: var(--green); color: #062b1c; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--panel2); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.big { padding: 18px 28px; font-size: 20px; border-radius: 16px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=search], input[type=email], input[type=number], input[type=datetime-local], input[type=date], textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, .25); }
.error-text { color: var(--red); font-size: 14px; min-height: 20px; margin-top: 10px; font-weight: 600; }

/* ------------------------------------------------ avatars */
.av { display: inline-grid; place-items: center; width: 40px; height: 40px; font-size: 22px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #3a4290, #222866); border: 2px solid rgba(255, 255, 255, .08); flex: none; line-height: 1; }
.av.lg { width: 96px; height: 96px; font-size: 54px; }
.av.md { width: 56px; height: 56px; font-size: 30px; }
.emoji-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; font-size: 22px; border-radius: 12px; border: 2px solid transparent; background: var(--bg); cursor: pointer; transition: transform .1s, border-color .1s; padding: 0; }
.emoji-grid button:hover { transform: scale(1.12); }
.emoji-grid button.sel { border-color: var(--yellow); background: var(--panel2); transform: scale(1.08); }

/* ------------------------------------------------ auth */
.auth-wrap { min-height: calc(100vh - 60px); display: grid; place-items: center; }
.auth-card { width: min(520px, 100%); }
.auth-hero { text-align: center; margin-bottom: 22px; }
.auth-hero h1 { font-size: 40px; margin: 14px 0 6px; }
.auth-hero h1 b { color: var(--yellow); }
.hero-board { display: inline-grid; grid-template-columns: repeat(7, 22px); gap: 5px; padding: 9px; background: var(--board); border-radius: 12px; box-shadow: var(--shadow); }
.hero-board i { width: 22px; height: 22px; border-radius: 50%; background: var(--bg); display: block; }
.hero-board i.r { background: var(--red); } .hero-board i.y { background: var(--yellow); }
.tabs { display: flex; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 6px; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700; padding: 10px; border-radius: 9px; cursor: pointer; }
.tabs button.on { background: var(--panel2); color: var(--text); }

/* ------------------------------------------------ lobby */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { padding: 16px 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.stat .n { font-size: 32px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat.g .n { color: var(--green); } .stat.y .n { color: var(--yellow); } .stat.r .n { color: var(--red); } .stat.p .n { color: #a995ff; }
.quick { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px;
  background: linear-gradient(120deg, #2a1f78, #1b3aa8); border: 1px solid #3a49b8; }
.quick h2 { font-size: 26px; margin-bottom: 4px; }
.searching { display: inline-flex; align-items: center; gap: 10px; }
.spinner { width: 18px; height: 18px; border: 3px solid rgba(0, 0, 0, .2); border-top-color: #1a1030; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid transparent; }
.row:hover { border-color: var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 12px; color: var(--muted); }
.badge { font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.badge.idle { background: rgba(46, 229, 157, .15); color: var(--green); }
.badge.playing { background: rgba(255, 77, 109, .15); color: var(--red); }
.badge.queue { background: rgba(255, 210, 63, .15); color: var(--yellow); }
.badge.offline { background: rgba(255, 255, 255, .08); color: var(--muted); }
.badge.open { background: rgba(46, 229, 157, .15); color: var(--green); }
.badge.running { background: rgba(255, 210, 63, .15); color: var(--yellow); }
.badge.finished { background: rgba(124, 92, 255, .2); color: #b9a8ff; }
.badge.you { background: rgba(124, 92, 255, .25); color: #cfc3ff; }
.vs { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.vs .side { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.vs .side.right { justify-content: flex-end; text-align: right; }
.vs .mid { font-weight: 800; color: var(--muted); font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.rating { color: var(--yellow); font-weight: 800; }
.plus { color: var(--green); font-weight: 800; } .minus { color: var(--red); font-weight: 800; }

/* ------------------------------------------------ tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
tr.me td { background: rgba(124, 92, 255, .12); }
td.num, th.num { text-align: center; }
.rank { font-weight: 800; width: 50px; }
.medal { font-size: 20px; }
.pcell { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.table-wrap { overflow-x: auto; }

/* ------------------------------------------------ game */
.game { display: grid; grid-template-columns: 240px 1fr 240px; gap: 24px; align-items: start; }
.pcard { padding: 18px; border-radius: var(--radius); background: var(--panel); border: 2px solid var(--line); text-align: center; position: relative; transition: border-color .2s, box-shadow .2s, transform .2s; }
.pcard.active.p1 { border-color: var(--red); box-shadow: 0 0 0 4px rgba(255, 77, 109, .2), var(--shadow); transform: translateY(-3px); }
.pcard.active.p2 { border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(255, 210, 63, .2), var(--shadow); transform: translateY(-3px); }
.pcard .who { font-size: 20px; font-weight: 800; margin-top: 10px; word-break: break-all; }
.pcard .chip { width: 22px; height: 22px; border-radius: 50%; display: inline-block; vertical-align: middle; margin-right: 6px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.pcard.p1 .chip { background: var(--red); } .pcard.p2 .chip { background: var(--yellow); }
.pcard .tag { margin-top: 8px; font-size: 13px; color: var(--muted); }
.timer { margin-top: 14px; height: 10px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.timer > i { display: block; height: 100%; width: 100%; border-radius: 99px; background: var(--green); transform-origin: left; }
.timer.warn > i { background: var(--red); }
.secs { font-size: 34px; font-weight: 900; margin-top: 8px; font-variant-numeric: tabular-nums; }
.secs.warn { color: var(--red); animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }
.away-note { margin-top: 10px; font-size: 13px; color: var(--red); font-weight: 700; }
.float-react { position: absolute; left: 50%; top: 10px; font-size: 46px; pointer-events: none; animation: floatup 1.8s ease-out forwards; z-index: 5; }
.float-react.txt { font-size: 30px; font-weight: 900; color: var(--yellow); }
@keyframes floatup { 0% { transform: translate(-50%, 20px) scale(.4); opacity: 0; } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.15); } 100% { transform: translate(-50%, -130px) scale(1); opacity: 0; } }

.board-area { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.turn-banner { font-size: 22px; font-weight: 800; min-height: 32px; text-align: center; }
.turn-banner.mine { color: var(--green); }
.tourn-tag { font-size: 13px; color: var(--yellow); font-weight: 700; }
.board-wrap { --cell: min(76px, calc((100vw - 48px) / 7.6)); position: relative; }
.ghost-row { display: grid; grid-template-columns: repeat(7, var(--cell)); padding: 0 calc(var(--cell) * .12); height: calc(var(--cell) * .9); }
.ghost-row span { display: grid; place-items: center; }
.ghost-row i { width: calc(var(--cell) * .78); height: calc(var(--cell) * .78); border-radius: 50%; opacity: 0; transition: opacity .1s; }
.ghost-row.p1 i { background: var(--red); } .ghost-row.p2 i { background: var(--yellow); }
.ghost-row span.on i { opacity: .55; }
.board { display: grid; grid-template-columns: repeat(7, var(--cell)); grid-template-rows: repeat(6, var(--cell));
  padding: calc(var(--cell) * .12); background: linear-gradient(180deg, var(--board), var(--board-d)); border-radius: 22px;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .25), 0 20px 50px rgba(0, 0, 0, .5); position: relative; }
.board.myturn .cell { cursor: pointer; }
.cell { display: grid; place-items: center; position: relative; }
.cell::before { content: ""; position: absolute; width: 78%; height: 78%; border-radius: 50%; background: var(--bg); box-shadow: inset 0 4px 8px rgba(0, 0, 0, .55); }
.disc { width: 78%; height: 78%; border-radius: 50%; position: relative; z-index: 1;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .22), inset 0 4px 6px rgba(255, 255, 255, .3); }
.disc.p1 { background: radial-gradient(circle at 35% 30%, #ff8099, var(--red) 55%, var(--red-d)); }
.disc.p2 { background: radial-gradient(circle at 35% 30%, #ffe680, var(--yellow) 55%, var(--yellow-d)); }
.disc.drop { animation: drop .42s cubic-bezier(.45, 0, .7, 1.25); }
@keyframes drop { from { transform: translateY(calc(var(--fall) * -1)); } to { transform: translateY(0); } }
.disc.last::after { content: ""; position: absolute; inset: 34%; border-radius: 50%; background: rgba(255, 255, 255, .45); }
.disc.auto::before { content: "⏱"; position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--cell) * .3); z-index: 2; }
.disc.win { animation: winpulse .7s ease-in-out infinite alternate; box-shadow: 0 0 0 4px #fff, 0 0 24px #fff; }
@keyframes winpulse { to { transform: scale(.86); } }
.react-bar { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.react-bar button { font-size: 22px; background: transparent; border: 0; cursor: pointer; padding: 6px 8px; border-radius: 10px; transition: transform .1s; color: var(--yellow); font-weight: 900; }
.react-bar button:hover { background: var(--panel2); transform: scale(1.2); }

/* ------------------------------------------------ profile */
.profile-head { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.profile-head .who { font-size: 32px; font-weight: 900; }
.kpis { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.kpi { padding: 8px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.kpi b { font-size: 20px; display: block; }
.kpi span { font-size: 12px; color: var(--muted); }
.result-tag { font-weight: 800; font-size: 12px; padding: 3px 8px; border-radius: 6px; }
.result-tag.W { background: rgba(46, 229, 157, .18); color: var(--green); }
.result-tag.L { background: rgba(255, 77, 109, .18); color: var(--red); }
.result-tag.D { background: rgba(255, 255, 255, .1); color: var(--muted); }

/* ------------------------------------------------ tournaments */
.t-card { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 14px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.t-card:hover { border-color: var(--accent); }
.t-card .trophy { font-size: 34px; }
.progress { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--yellow)); }
.round-title { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.match.mine { border-color: rgba(124, 92, 255, .6); background: rgba(124, 92, 255, .08); }
.match .score { font-weight: 800; min-width: 70px; text-align: center; font-size: 13px; }
.winner-banner { text-align: center; padding: 24px; border-radius: var(--radius); background: linear-gradient(120deg, #5a3cff, #c9264a); margin-bottom: 20px; }
.winner-banner .av { margin: 6px auto; }

/* ------------------------------------------------ challenges, toasts, modals */
#challenge-tray { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 40; width: min(360px, calc(100vw - 40px)); }
.ch-card { background: var(--panel2); border: 1px solid var(--accent); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); animation: slidein .25s ease-out; }
.ch-card .top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ch-card .bar { height: 4px; border-radius: 4px; background: var(--accent); margin-top: 10px; transform-origin: left; }
@keyframes slidein { from { transform: translateY(20px); opacity: 0; } }
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--panel2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; animation: slidein .2s ease-out; max-width: 90vw; }
.toast.error { border-color: var(--red); }
.toast a { color: var(--yellow); margin-left: 8px; }
.modal-bg { position: fixed; inset: 0; background: rgba(5, 6, 20, .7); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 26px; box-shadow: var(--shadow); text-align: center; animation: pop .25s cubic-bezier(.2, 1.4, .5, 1); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.modal.left { text-align: left; }
.modal .big-emoji { font-size: 64px; }
.modal h2 { font-size: 30px; margin: 8px 0; }
.modal .btn-row { justify-content: center; margin-top: 20px; }

/* ------------------------------------------------ responsive */
@media (max-width: 1000px) {
  .game { grid-template-columns: 1fr 1fr; }
  .game .board-area { grid-column: 1 / -1; order: 3; }
  .pcard { padding: 12px; }
  .pcard .av.lg { width: 60px; height: 60px; font-size: 34px; }
  .secs { font-size: 24px; }
}
@media (max-width: 860px) {
  .cols-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  #topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  #nav { order: 3; width: 100%; overflow-x: auto; }
  .brand-name { display: none; }
  .me-chip .nm { display: none; }
  #app { padding: 18px 12px 80px; }
  .quick { flex-direction: column; align-items: stretch; text-align: center; }
  .emoji-grid { grid-template-columns: repeat(7, 1fr); }
  .game { gap: 12px; }
  .pcard { padding: 10px; }
  .pcard .av.lg { width: 44px; height: 44px; font-size: 26px; }
  .pcard .who { font-size: 16px; margin-top: 4px; }
  .pcard .tag { margin-top: 2px; font-size: 12px; }
  .secs { font-size: 20px; margin-top: 2px; }
  .timer { margin-top: 6px; height: 8px; }
  .board-area { gap: 8px; }
  .turn-banner { font-size: 18px; min-height: 24px; }
  .ghost-row { height: calc(var(--cell) * .45); }
  .ghost-row i { width: calc(var(--cell) * .4); height: calc(var(--cell) * .4); }
  .react-bar button { font-size: 20px; padding: 4px 6px; }
}

/* ================================================= Face to Face Arena additions */
:root { --c4: #2448d8; --sprint: #ffc61a; --sudoku: #12b5a5; --fuel: #6a3df0; }   /* sprint: racing yellow, so the red car logo stands out */
select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; }
.brand-logo { display: grid; grid-template-columns: repeat(2, 11px); gap: 3px; }
.brand-logo i { width: 11px; height: 11px; border-radius: 3px; display: block; }
.brand-logo .t1 { background: var(--c4); } .brand-logo .t2 { background: var(--sprint); } .brand-logo .t3 { background: var(--sudoku); } .brand-logo .t4 { background: var(--fuel); }
.icon-btn { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 999px; width: 38px; height: 38px; font-size: 17px; cursor: pointer; }
.icon-btn:hover { background: var(--panel2); }
.me-chip .lvl { color: var(--yellow); font-size: 12px; }

/* auth hero */
.hero-tiles { display: inline-grid; grid-template-columns: repeat(4, 54px); gap: 10px; }
.ht { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; font-size: 28px; box-shadow: var(--shadow); }
.ht-connect4 { background: var(--c4); } .ht-sprint { background: var(--sprint); } .ht-sudoku { background: var(--sudoku); } .ht-fuel { background: var(--fuel); }
.hero-games { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.hero-games span { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }

/* home */
.home-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.home-head h1 { font-size: 30px; margin: 0 0 4px; }
.mini-stats { display: flex; gap: 10px; }
.mini-stats div { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px; text-align: center; min-width: 78px; }
.mini-stats b { display: block; font-size: 24px; font-weight: 900; }
.mini-stats span { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.mini-stats .g { color: var(--green); } .mini-stats .r { color: var(--red); } .mini-stats .y { color: var(--yellow); } .mini-stats .p { color: #a995ff; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 20px; }
.tile { cursor: pointer; display: flex; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; min-height: 190px; }
.tile:hover { transform: translateY(-3px); }
.tile-art { width: 42%; flex: none; display: grid; place-items: center; position: relative; overflow: hidden; }
.tile-art canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-body { padding: 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.tile-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tile-title h2 { margin: 0; font-size: 20px; }
.tile-title .rating { font-size: 18px; }
.tile-live { display: flex; gap: 12px; font-size: 12px; color: var(--muted); font-weight: 700; flex-wrap: wrap; }
.tile-live .dot { width: 6px; height: 6px; margin-right: 5px; }
.tile .btn-row { margin-top: auto; }
.tile-connect4 .tile-art { background: radial-gradient(circle at 30% 20%, #3c66ff, #142f9a); }
.tile-sprint .tile-art { background: linear-gradient(180deg, #2f8fe0, #bfe6ff); }
.tile-sudoku .tile-art { background: linear-gradient(160deg, #20d6c2, #0b5c66); }
.tile-fuel .tile-art { background: #05051a; }
.tile-connect4:hover { border-color: var(--c4); } .tile-sprint:hover { border-color: var(--sprint); } .tile-sudoku:hover { border-color: var(--sudoku); } .tile-fuel:hover { border-color: var(--fuel); }
.big-icon { font-size: 64px; }
.c4-art { display: grid; grid-template-columns: repeat(7, 16px); gap: 4px; padding: 8px; background: var(--board); border-radius: 10px; box-shadow: 0 8px 20px rgba(0,0,0,.4); }
.c4-art i { width: 16px; height: 16px; border-radius: 50%; background: #0b0e2a; display: block; }
.c4-art i.r { background: var(--red); } .c4-art i.y { background: var(--yellow); }
.sd-art { display: grid; grid-template-columns: repeat(9, 18px); background: #fff; border: 2px solid #0b3d44; border-radius: 6px; overflow: hidden; box-shadow: 0 8px 20px rgba(0,0,0,.35); }
.sd-art i { width: 18px; height: 22px; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 12px; color: #0b3d44; border-right: 1px solid #cfe7e7; border-bottom: 1px solid #cfe7e7; }
.sd-art i.br { border-right: 2px solid #0b3d44; }
.gtag { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; background: rgba(255,255,255,.06); flex: none; }

/* game page */
.game-hero { display: flex; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); margin-bottom: 20px; box-shadow: var(--shadow); }
.game-hero .tile-art { width: 34%; min-height: 240px; }
.gh-body { padding: 24px; flex: 1; }
.gh-body h1 { font-size: 32px; margin: 6px 0 4px; }
.howto { margin: 0; padding-left: 20px; line-height: 1.6; }
.howto li { margin-bottom: 6px; }
.gtabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.gtab { padding: 9px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; color: var(--muted); }
.gtab.on { color: var(--text); background: var(--panel2); border-color: var(--accent); }
.game-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.gc { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 10px; border-radius: 14px; border: 2px solid transparent; color: #fff; font: inherit; font-weight: 800; cursor: pointer; transition: transform .1s; }
.gc:hover { transform: scale(1.04); border-color: #fff; }
.gc .gi { font-size: 30px; }
.gc-connect4 { background: var(--c4); } .gc-sprint { background: var(--sprint); color: #1b1530; } .gc-sudoku { background: var(--sudoku); } .gc-fuel { background: var(--fuel); }

/* profile */
.level-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; max-width: 460px; }
.level-row .progress { flex: 1; margin: 0; }
.lvl-badge { background: linear-gradient(120deg, var(--accent), #c9264a); padding: 4px 10px; border-radius: 99px; font-weight: 800; font-size: 13px; white-space: nowrap; }
.gcards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.gcard { padding: 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid; }
.gcard.tile-connect4 { border-top-color: var(--c4); } .gcard.tile-sprint { border-top-color: var(--sprint); } .gcard.tile-sudoku { border-top-color: var(--sudoku); } .gcard.tile-fuel { border-top-color: var(--fuel); }
.gc-top { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.gc-top .gi { font-size: 20px; }
.gc-rating { font-size: 30px; margin: 6px 0 2px; }

/* match frame */
.match { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.match-top { display: grid; grid-template-columns: 1fr minmax(200px, 1.2fr) 1fr; gap: 14px; align-items: stretch; }
.pc { padding: 12px 14px; border-radius: 16px; background: var(--panel); border: 2px solid var(--line); position: relative; transition: border-color .2s, box-shadow .2s; }
.pc.active.pc0 { border-color: var(--red); box-shadow: 0 0 0 4px rgba(255, 77, 109, .2); }
.pc.active.pc1 { border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(255, 210, 63, .2); }
.pc-row { display: flex; align-items: center; gap: 10px; }
.pc-info { min-width: 0; }
.pc-name { font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-sub { font-size: 12px; color: var(--muted); }
.pc-extra { margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; min-height: 22px; }
.pc-extra .secs { font-size: 22px; font-weight: 900; margin: 0; }
.pc-extra .timer { flex: 1; margin: 0; min-width: 60px; }
.pc-extra .prog { display: flex; align-items: center; gap: 8px; width: 100%; }
.pc-extra .prog .progress { flex: 1; margin: 0; }
.chip { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
.chip.c1 { background: var(--red); } .chip.c2 { background: var(--yellow); }
.mt-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; }
.mt-title { font-weight: 900; font-size: 18px; }
.banner { font-weight: 800; font-size: 16px; min-height: 22px; }
.banner.mine { color: var(--green); } .banner.warn { color: var(--red); }
.match-bottom { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; }
.stage { display: flex; justify-content: center; }
.solo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.solo-head h2 { margin: 0; }
.over-detail { margin-top: 12px; }
table.mini { width: 100%; font-size: 14px; } table.mini td { padding: 6px 8px; text-align: left; }
.res-line { margin-top: 8px; }
.sg { font-size: 12px; font-weight: 800; padding: 2px 7px; border-radius: 6px; }
.sg-perfect { background: rgba(46,229,157,.2); color: var(--green); } .sg-good { background: rgba(255,210,63,.18); color: var(--yellow); }
.sg-early, .sg-late { background: rgba(255,77,109,.18); color: var(--red); }

/* connect 4 inside the frame */
.c4-wrap { --cell: min(74px, calc((100vw - 40px) / 7.4)); }

/* sudoku */
.sd-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; --sd: min(56px, calc((100vw - 36px) / 9)); }
.sd-top { display: flex; justify-content: space-between; width: calc(var(--sd) * 9); font-weight: 800; }
.sd-time { font-size: 22px; font-variant-numeric: tabular-nums; }
.sd-count { color: var(--muted); align-self: center; }
.sd-grid-wrap { position: relative; }
.sd-grid { display: grid; grid-template-columns: repeat(9, var(--sd)); background: #f4fbfb; border: 3px solid #0b3d44; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); user-select: none; }
.sd-cell { width: var(--sd); height: var(--sd); display: grid; place-items: center; font-size: calc(var(--sd) * .5); font-weight: 700; color: #1f6feb; border-right: 1px solid #c3dede; border-bottom: 1px solid #c3dede; cursor: pointer; background: #f4fbfb; position: relative; }
.sd-cell.given { color: #0b2a30; font-weight: 900; }
.sd-cell.br { border-right: 3px solid #0b3d44; } .sd-cell.bb { border-bottom: 3px solid #0b3d44; }
.sd-cell.peer { background: #e2f2f2; } .sd-cell.same { background: #bfe6ff; } .sd-cell.sel { background: #ffe58a; }
.sd-notes { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; height: 100%; padding: 2px; }
.sd-notes b { font-size: calc(var(--sd) * .2); color: #5b7c80; font-weight: 600; display: grid; place-items: center; }
.sd-cover { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(11, 14, 42, .88); border-radius: 10px; font-size: 64px; font-weight: 900; backdrop-filter: blur(6px); }
.sd-pad { display: grid; grid-template-columns: repeat(9, var(--sd)); gap: 0; width: calc(var(--sd) * 9); gap: 4px; grid-template-columns: repeat(9, 1fr); }
.sd-pad button { height: calc(var(--sd) * 1.05); border: 0; border-radius: 10px; background: var(--panel2); color: var(--text); font: inherit; font-size: calc(var(--sd) * .45); font-weight: 800; cursor: pointer; }
.sd-pad button:hover { background: var(--accent); }
.sd-pad button.done { opacity: .35; }
.sd-pad button.wide { grid-column: span 4; font-size: 15px; } .sd-pad button.wide:last-child { grid-column: span 5; }
.sd-pad button.on { background: var(--yellow); color: #1a1030; }
.sd-hint { text-align: center; max-width: calc(var(--sd) * 9); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* car sprint */
.sp-wrap { width: min(1000px, 100%); display: flex; flex-direction: column; gap: 12px; }
.sp-canvas-wrap { position: relative; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.sp-canvas-wrap canvas { width: 100%; display: block; }
.sp-lights { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; padding: 10px 14px; background: rgba(0,0,0,.75); border-radius: 14px; transition: opacity .5s; }
.sp-lights i { width: 30px; height: 30px; border-radius: 50%; background: #3a2a10; display: block; }
.sp-lights i.on { background: #ffb020; box-shadow: 0 0 20px #ffb020; }
.sp-lights i.g { background: #103a26; } .sp-lights i.g.on { background: var(--green); box-shadow: 0 0 24px var(--green); }
.sp-lights.red i.g { background: var(--red); box-shadow: 0 0 24px var(--red); }
.sp-lights.fade { opacity: 0; }
.sp-pop { position: absolute; top: 110px; left: 50%; transform: translateX(-50%) scale(.8); font-size: 26px; font-weight: 900; opacity: 0; transition: all .2s; text-shadow: 0 3px 10px rgba(0,0,0,.6); white-space: nowrap; }
.sp-pop.show { opacity: 1; transform: translateX(-50%) scale(1); }
.sp-pop.good { color: var(--green); } .sp-pop.meh { color: var(--yellow); } .sp-pop.bad { color: var(--red); }
.sp-hud { display: grid; grid-template-columns: 240px 1fr auto; gap: 16px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 10px 16px; }
.sp-readout { text-align: center; }
.sp-gear { font-size: 56px; font-weight: 900; line-height: 1; color: var(--yellow); }
.sp-speed { font-size: 16px; color: var(--muted); } .sp-speed b { color: var(--text); font-size: 26px; }
.sp-time { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sp-controls { display: flex; gap: 12px; }
.sp-btn { width: 110px; height: 110px; border-radius: 50%; border: 0; font: inherit; font-weight: 900; font-size: 15px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: inset 0 -6px 0 rgba(0,0,0,.25), var(--shadow); }
.sp-btn.rev { background: #2b3270; color: #fff; } .sp-btn.rev.on { background: var(--red); }
.sp-btn.shift { background: var(--green); color: #062b1c; font-size: 18px; }
.sp-btn:active { transform: scale(.96); }
.sp-keys { text-align: center; }
.car-chip { width: 16px; height: 16px; border-radius: 4px; display: inline-block; border: 1px solid rgba(255,255,255,.4); }
.garage canvas { width: 100%; border-radius: 14px; display: block; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.chips button.on { background: var(--accent); border-color: var(--accent); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: 0 0 0 1px rgba(255,255,255,.2); }
.swatches button.on { border-color: #fff; transform: scale(1.1); }
.swatches input[type=color] { width: 40px; height: 34px; border: 0; background: none; cursor: pointer; }
label.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--text); font-size: 14px; }

/* fuel */
.fu-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.fu-canvas-wrap { position: relative; height: min(720px, calc(100vh - 290px)); min-height: 420px; aspect-ratio: 480 / 720; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.fu-canvas-wrap canvas { width: 100%; height: 100%; display: block; }
.fu-hud { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; gap: 10px; background: linear-gradient(rgba(0,0,0,.65), transparent); pointer-events: none; }
.fu-score span { font-size: 10px; color: var(--muted); display: block; font-weight: 800; letter-spacing: .1em; }
.fu-score b { font-size: 22px; font-variant-numeric: tabular-nums; }
.fu-lives i { color: #7cf7ff; font-style: normal; margin: 0 2px; font-size: 16px; } .fu-lives i.lost { color: #333a66; }
.fu-fuel { display: flex; align-items: center; gap: 6px; font-weight: 900; font-size: 12px; }
.fu-gauge { width: 110px; height: 12px; border-radius: 99px; background: rgba(255,255,255,.15); overflow: hidden; }
.fu-gauge i { display: block; height: 100%; background: var(--green); transition: width .1s; }
.fu-gauge i.low { background: var(--red); animation: pulse .4s infinite alternate; }
.fu-center { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; text-align: center; }
.fu-cd { font-size: 96px; font-weight: 900; color: #fff; text-shadow: 0 0 30px var(--fuel); }
.fu-cd.go { color: var(--green); }
.fu-msg { background: rgba(5,5,26,.8); border: 1px solid var(--line); padding: 18px 26px; border-radius: 16px; font-size: 18px; line-height: 1.5; }
.fu-touch { display: none; width: min(480px, 100%); justify-content: space-between; align-items: center; gap: 10px; }
.fu-touch button { width: 68px; height: 68px; border-radius: 18px; border: 0; background: var(--panel2); color: #fff; font-size: 26px; touch-action: none; user-select: none; -webkit-user-select: none; }
.fu-touch button.on { background: var(--accent); }
.fu-pad { display: flex; gap: 8px; } .fu-pad.v { flex-direction: column; } .fu-pad.v button { height: 50px; }
.fu-touch .fu-fire { width: 90px; height: 90px; border-radius: 50%; background: var(--red); font-size: 16px; font-weight: 900; }
.fu-card { width: 100%; } .fu-card .progress.fuelp { margin-top: 4px; } .fu-card .progress.fuelp i { background: var(--green); }
.fu-keys { text-align: center; max-width: 520px; }
@media (hover: none), (pointer: coarse) { .fu-touch { display: flex; } .fu-keys, .sp-keys { display: none; } }

@media (max-width: 1000px) {
  .tiles { grid-template-columns: 1fr; }
  .gcards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .match-top { grid-template-columns: 1fr 1fr; }
  .mt-mid { grid-column: 1 / -1; order: -1; }
  .pc { padding: 8px 10px; } .pc .av.md { width: 40px; height: 40px; font-size: 22px; }
  .pc-name { font-size: 15px; }
  .tile { flex-direction: column; } .tile-art { width: 100%; height: 150px; }
  .game-hero { flex-direction: column; } .game-hero .tile-art { width: 100%; min-height: 170px; height: 170px; }
  .mini-stats { width: 100%; } .mini-stats div { flex: 1; min-width: 0; padding: 6px; }
  .sp-hud { grid-template-columns: 1fr 1fr; } .sp-controls { grid-column: 1 / -1; justify-content: space-between; }
  .sp-btn { width: 46%; height: 84px; border-radius: 20px; }
  #sp-tach { width: 100%; height: auto; }
  .fu-canvas-wrap { height: min(520px, calc(100vh - 440px)); min-height: 300px; }
  .home-head h1 { font-size: 24px; }
}

/* ================================================= dashboard and profile editing */
.flag { margin-right: 5px; font-size: .95em; }
.av.xl { width: 112px; height: 112px; font-size: 62px; }
.modal.wide { width: min(620px, 100%); max-height: 92vh; overflow-y: auto; }
.ep-preview { display: flex; align-items: center; gap: 16px; padding: 12px; border-radius: 14px; background: var(--bg); margin-top: 6px; }
.ep-name { font-size: 22px; font-weight: 900; }
.dash-head { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.dash-name { font-size: 32px; font-weight: 900; }
.sec-title { margin: 6px 0 14px; font-size: 20px; display: flex; align-items: baseline; gap: 10px; }
.dgames { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.dgame { padding: 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--gc); display: flex; flex-direction: column; gap: 10px; transition: transform .15s; }
.dgame:hover { transform: translateY(-2px); }
.dg-rating { display: flex; align-items: baseline; gap: 10px; }
.dg-rating .rating { font-size: 36px; }
.dg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dg-grid div { background: var(--bg); border-radius: 10px; padding: 6px 9px; }
.dg-grid span { display: block; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.dg-grid b { font-size: 15px; }
.dg-best { border-top: 1px solid var(--line); padding-top: 8px; }
.src { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 2px 6px; border-radius: 5px; margin-left: 4px; vertical-align: middle; }
.src-solo { background: rgba(255,255,255,.1); color: var(--muted); }
.src-match { background: rgba(124,92,255,.22); color: #cfc3ff; }
.src-tournament { background: rgba(255,210,63,.18); color: var(--yellow); }
.chart-wrap { position: relative; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 2px; display: inline-block; border-radius: 2px; }
.rchart { width: 100%; height: auto; display: block; }
.rchart .grid-l { stroke: rgba(255,255,255,.07); stroke-width: 1; }
.rchart .base-l { stroke: rgba(255,255,255,.25); stroke-width: 1; }
.rchart .ax { fill: var(--muted); font-size: 12px; }
.rchart .lbl { fill: var(--text); font-size: 13px; font-weight: 700; }
.rchart .xh { stroke: rgba(255,255,255,.4); stroke-width: 1; }
.rchart .xh.hidden { display: none; }
.ctip { position: absolute; background: #0b0e2a; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; pointer-events: none; min-width: 170px; box-shadow: var(--shadow); font-size: 13px; }
.ctip-h { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.ctip-r { display: flex; align-items: center; gap: 8px; }
.ctip-r i { width: 12px; height: 2px; display: inline-block; }
.ctip-r b { font-size: 15px; min-width: 36px; }
.ctip-r span { color: var(--muted); }
.hof { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.hof-col { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--gc); border-radius: 16px; padding: 14px; }
.hof-head { font-weight: 900; font-size: 15px; margin-bottom: 6px; }
.hof-sub { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 6px; }
.hof-row { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 10px; }
.hof-row.me { background: rgba(124,92,255,.15); }
.hof-row .av { width: 30px; height: 30px; font-size: 16px; }
.hof-row .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; font-size: 14px; }
.hof-row .medal { font-size: 16px; }
.hof-val { white-space: nowrap; font-size: 13px; }
.hof-empty { padding: 6px; }
.ach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ach { display: flex; gap: 10px; padding: 10px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); opacity: .65; }
.ach.on { opacity: 1; border-color: rgba(46,229,157,.45); background: rgba(46,229,157,.06); }
.ach-icon { font-size: 28px; filter: grayscale(1); }
.ach.on .ach-icon { filter: none; }
.ach-body { min-width: 0; flex: 1; }
.ach-body .progress { margin-top: 6px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge-pill { padding: 6px 12px; border-radius: 99px; background: rgba(46,229,157,.1); border: 1px solid rgba(46,229,157,.35); font-weight: 700; font-size: 13px; }
.rival { padding: 12px; border-radius: 12px; background: var(--bg); margin-bottom: 10px; }
.rival-title { font-weight: 800; margin-bottom: 8px; }
.rival-body { display: flex; align-items: center; gap: 12px; }
.records div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.records span { color: var(--muted); }
@media (max-width: 1100px) { .dgames, .hof { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .dgames, .hof, .ach-grid { grid-template-columns: 1fr; } .dash-name { font-size: 26px; } .av.xl { width: 84px; height: 84px; font-size: 46px; } }

/* ================================================= tournaments v2 */
.t-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.t-meta span:not(.badge) { font-size: 13px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); padding: 4px 10px; border-radius: 99px; }
.invite-box { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.invite-box > div:first-child { flex: 1; min-width: 240px; }
.invite-box input { margin-top: 6px; font-family: ui-monospace, monospace; font-size: 14px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type=datetime-local] { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; color-scheme: dark; }
.odot { width: 9px; height: 9px; border-radius: 50%; background: #4a5080; display: inline-block; flex: none; }
.odot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.next-match { border-color: var(--accent); background: linear-gradient(135deg, #24206b, #152a6b); }
.nm-vs { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 18px; }
.nm-vs .mid { color: var(--muted); font-weight: 900; font-size: 13px; }
.series { margin-top: 10px; font-weight: 800; color: var(--yellow); }
.nm-state { margin-top: 14px; color: var(--muted); }
.nm-state.live { color: var(--red); font-weight: 800; }
.nm-ready { display: flex; align-items: center; gap: 20px; margin-top: 16px; flex-wrap: wrap; }
.nm-clock { text-align: center; background: rgba(0,0,0,.25); border-radius: 14px; padding: 8px 16px; }
.nm-clock span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 800; letter-spacing: .06em; }
.nm-clock b { font-size: 32px; font-variant-numeric: tabular-nums; }
.nm-flags { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.tm-tag { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,.08); color: var(--muted); text-transform: uppercase; }
.tm-tag.bad { background: rgba(255,77,109,.16); color: var(--red); }
.tm-tag.live { background: rgba(255,77,109,.2); color: #fff; }
.tm-tag.ready { background: rgba(46,229,157,.16); color: var(--green); }
.invite-card { display: flex; max-width: 860px; margin: 30px auto; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.invite-card .tile-art { width: 38%; min-height: 280px; }
.ic-body { padding: 28px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; flex: 1; }
.ic-body h1 { margin: 0; font-size: 34px; }
.ic-players { display: flex; gap: 4px; flex-wrap: wrap; }
.inv-banner { background: linear-gradient(120deg, #5a3cff, #c9264a); padding: 14px 18px; border-radius: 16px; margin-bottom: 14px; text-align: center; line-height: 1.5; }
.series-next { margin-top: 12px; padding: 10px; border-radius: 12px; background: rgba(255,210,63,.12); color: var(--yellow); font-weight: 700; }
#t-alerts { position: fixed; left: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 41; width: min(380px, calc(100vw - 40px)); }
.t-alert { border-color: var(--yellow); }
@media (max-width: 760px) { .invite-card { flex-direction: column; } .invite-card .tile-art { width: 100%; min-height: 160px; height: 160px; } .form-2 { grid-template-columns: 1fr; } #t-alerts { left: 10px; bottom: 10px; } }
#nav a { white-space: nowrap; }
@media (max-width: 760px) { #toasts { bottom: auto; top: 12px; } }

/* ================================================= car sprint circuit */
.sp-canvas-wrap .sp-map { position: absolute; right: 12px; top: 10px; width: 180px; height: 120px; border-radius: 12px; border: 1px solid rgba(255,255,255,.15); }
.sp-btn.down { background: #ffb020; color: #2a1a00; }
.sp-choose { text-align: center; padding: 30px 10px; width: min(720px, 100%); }
.sp-tracks { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sp-track { display: flex; flex-direction: column; gap: 6px; padding: 22px; border-radius: 18px; border: 2px solid var(--line); background: var(--panel); color: var(--text); font: inherit; cursor: pointer; text-align: left; transition: transform .1s, border-color .1s; }
.sp-track:hover { transform: translateY(-2px); border-color: var(--sprint); }
.sp-track b { font-size: 20px; } .sp-track span { color: var(--muted); font-size: 14px; }
@media (max-width: 860px) { .sp-controls .sp-btn { width: 31%; } .sp-tracks { grid-template-columns: 1fr; } .sp-canvas-wrap .sp-map { width: 120px; height: 80px; } }
.badge.live-b { background: rgba(255,77,109,.2); color: #fff; vertical-align: middle; }
.fr-req { border: 1px solid rgba(46,229,157,.35); }

/* ================================================= knockout bracket */
.bracket { display: flex; gap: 18px; overflow-x: auto; padding-bottom: 8px; }
.br-round { min-width: 230px; display: flex; flex-direction: column; }
.br-slots { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 12px; }
.br-match { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; position: relative; }
.br-match.is-live { border-color: var(--red); box-shadow: 0 0 0 2px rgba(255,77,109,.25); }
.br-p { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 14px; font-weight: 700; }
.br-p + .br-p { border-top: 1px solid var(--line); }
.br-p .av { width: 26px; height: 26px; font-size: 14px; }
.br-p .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-p.won { background: rgba(46,229,157,.12); color: var(--green); }
.br-p.lost { opacity: .45; text-decoration: line-through; }
.br-p.me { box-shadow: inset 3px 0 0 var(--accent); }
.br-p.tbd { color: var(--muted); font-weight: 600; font-style: italic; }
.br-s { font-variant-numeric: tabular-nums; }
.br-tag { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.br-champ .br-p { font-size: 16px; }

/* ================================================= admin stats */
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-tiles .stat .n { font-size: 28px; }
.bybar { display: flex; flex-direction: column; gap: 10px; }
.bb-row { display: grid; grid-template-columns: 200px 1fr 60px; gap: 12px; align-items: center; }
.bb-row b { text-align: right; font-variant-numeric: tabular-nums; }
.bb-track { height: 12px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.bb-track i { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.rchart .hit { cursor: crosshair; }
@media (max-width: 760px) { .stat-tiles { grid-template-columns: repeat(2, 1fr); } .bb-row { grid-template-columns: 1fr 1fr 40px; } }

#conn-banner { position: fixed; top: 0; left: 50%; transform: translate(-50%, -110%); background: var(--red); color: #fff; font-weight: 800; padding: 8px 18px; border-radius: 0 0 12px 12px; z-index: 100; transition: transform .25s; }
#conn-banner.show { transform: translate(-50%, 0); }

/* ================================================= Face to Face Arena: brand and avatars */
.bn-short { display: none; }
@media (max-width: 1360px) { .bn-long { display: none; } .bn-short { display: inline; } }
.av svg { width: 86%; height: 86%; display: block; }
.av.xs { width: 22px; height: 22px; font-size: 13px; vertical-align: middle; border-width: 1px; }
.av-picker { display: flex; flex-direction: column; gap: 10px; }
.av-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.av-tabs button { display: flex; align-items: center; gap: 6px; flex: none; padding: 6px 10px 6px 6px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .1);
  background: var(--bg); color: inherit; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; line-height: 1; }
.av-tabs .tab-ic { display: grid; place-items: center; width: 22px; height: 22px; font-size: 18px; font-style: normal; }
.av-tabs .tab-ic svg { width: 100%; height: 100%; }
.av-tabs button.on { background: var(--panel2); border-color: var(--yellow); }
.av-picker .emoji-grid { max-height: 268px; overflow-y: auto; padding: 4px; }
.emoji-grid button { display: grid; place-items: center; }
.emoji-grid button > svg { width: 82%; height: 82%; }
@media (max-width: 640px) { .emoji-grid { grid-template-columns: repeat(7, 1fr); } .av-tabs button span { display: none; } .av-tabs button { padding: 6px; } }
/* live availability line under nickname and email fields */
.fstat { min-height: 18px; margin-top: 4px; font-size: 13px; color: var(--muted, #9aa3c7); }
.fstat.good { color: #34d399; }
.fstat.bad { color: #fb7185; }
.fstat.wait { color: #9aa3c7; }
/* Continue with Google (Google's sign in button style: white, the G logo, dark text) */
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: #fff; color: #1f1f1f;
  border: 1px solid #dadce0; font-weight: 600; text-decoration: none; margin-bottom: 14px; }
.google-btn:hover { background: #f8f9fb; color: #1f1f1f; }
.google-btn.sm { width: auto; margin: 0; }
.g-logo { width: 20px; height: 20px; flex: none; }
.or-line { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px; color: var(--muted, #9aa3c7); font-size: 13px; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: rgba(255, 255, 255, .12); }
.g-conn { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.g-conn .g-logo { width: 18px; height: 18px; }

/* ================================================= F2F Arena text logo
   Two Fs face each other (the second F is the same letter, mirrored), with a "2" badge between them,
   an arena curve underneath, then ARENA. Pure text, no image. */
.f2f-logo { display: inline-flex; align-items: center; font-weight: 900; line-height: 1; white-space: nowrap; color: #fff; }
.f2f-mark { position: relative; display: inline-flex; align-items: center; padding-bottom: .16em; }
.f2f-mark .lf { font-size: 1em; letter-spacing: 0; }
.f2f-mark .lf.m { display: inline-block; transform: scaleX(-1); }
.f2f-mark .l2 { display: inline-grid; place-items: center; width: 1.3em; height: 1.3em; margin: 0 .12em; border-radius: 50%;
  font-size: .62em; background: var(--yellow); color: #1b1530; box-shadow: 0 0 0 .14em rgba(255, 216, 77, .22); margin: 0 .2em; }
.f2f-mark::after { content: ''; position: absolute; left: -.06em; right: -.06em; bottom: -.04em; height: .3em;
  border: .07em solid var(--yellow); border-top: 0; border-radius: 0 0 50% 50% / 0 0 100% 100%; opacity: .85; }
.f2f-logo .la { margin-left: .4em; font-size: .56em; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; color: var(--yellow); }
.brand .f2f-logo { font-size: 26px; }
.brand:hover .f2f-mark .l2 { transform: scale(1.08); }
.auth-logo { font-size: 64px; margin: 6px 0 4px; }
.auth-sub { font-size: 15px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted, #9aa3c7); font-weight: 700; margin-top: 10px; }
@media (max-width: 640px) { .auth-logo { font-size: 48px; } }

/* ================================================= Landing page: the 4 games + log in / sign up */
.landing { padding: 8px 0 20px; }
.land-hero { text-align: center; margin: 6px 0 26px; }
.land-tag { margin: 10px 0 0; font-size: 18px; color: var(--text); opacity: .9; }
.land-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 24px; align-items: start; }
.land-games { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lg-card { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.lg-card .tile-art { width: 100%; height: 132px; }
.lg-card .tile-art canvas { width: 100%; height: 100%; }
.lg-body { padding: 12px 14px 14px; }
.lg-name { font-weight: 800; font-size: 16px; }
.lg-tag { color: var(--muted, #9aa3c7); font-size: 13px; line-height: 1.45; margin-top: 4px; }
.land-auth .panel { margin: 0; }
.auth-foot { margin-top: 14px; text-align: center; line-height: 1.7; }
.welcome-h { font-size: 30px; margin: 14px 0 6px; }
@media (max-width: 900px) {
  .land-grid { grid-template-columns: 1fr; }
  .land-hero { margin-bottom: 18px; }
}
@media (max-width: 640px) {
  .land-games { gap: 10px; }
  .lg-card .tile-art { height: 86px; }
  .lg-body { padding: 8px 10px 10px; }
  .lg-name { font-size: 14px; }
  .lg-tag { display: none; }
  .land-tag { font-size: 16px; }
}

/* ================================================= Sponsor ads: visible, quiet, never in the way */
.ad-top { max-width: 1200px; margin: 14px auto 0; padding: 0 24px; display: flex; flex-direction: column; align-items: center; }
.ad-top a, .ad-side a { display: block; line-height: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); opacity: .94; transition: opacity .15s; }
.ad-top a:hover, .ad-side a:hover { opacity: 1; }
.ad-top img { display: block; width: 728px; max-width: 100%; height: auto; aspect-ratio: 728 / 90; }
.ad-label { margin-top: 3px; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted, #9aa3c7); opacity: .65; line-height: 1.2; }
.ad-side { position: fixed; right: 16px; top: 88px; z-index: 5; display: flex; flex-direction: column; align-items: center; width: 160px; }
.ad-side img { display: block; width: 160px; height: auto; aspect-ratio: 160 / 600; max-height: calc(100vh - 120px); object-fit: contain; }
/* Make room for the side banner when the page margin is too narrow for it. */
@media (min-width: 1100px) and (max-width: 1599px) {
  body.has-ad-side #app, body.has-ad-side .ad-top { max-width: min(1200px, calc(100vw - 210px)); margin-left: auto; margin-right: 196px; }
}
/* Narrow screens: the side banner sits at the bottom of the page instead of floating. */
@media (max-width: 1099px) {
  .ad-side { position: static; width: auto; margin: 0 auto 90px; }
  .ad-side img { max-height: 300px; width: auto; }
}
@media (max-width: 760px) {
  .ad-top { padding: 0 12px; margin-top: 10px; }
  body.in-match .ad-top, body.in-match .ad-side { display: none; }   /* games get the whole phone screen */
}
.sp-admin { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.sp-prev { margin: 10px 0 4px; border-radius: 10px; border: 1px dashed var(--line); background: var(--bg); display: grid; place-items: center; overflow: hidden; color: var(--muted, #9aa3c7); font-weight: 700; }
.sp-prev img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sp-prev-side { max-width: 160px; margin-left: auto; margin-right: auto; }
.sp-slot input[type=file] { width: 100%; font: inherit; color: var(--muted, #9aa3c7); }
@media (max-width: 860px) { .sp-admin { grid-template-columns: 1fr; } }
@media (max-width: 640px) { #topbar .f2f-logo .la { display: none; } .brand .f2f-logo { font-size: 24px; } }
.sp-slot input[type=file]::file-selector-button { margin-right: 10px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2, #23286a); color: var(--text, #fff); font: inherit; font-weight: 700; cursor: pointer; }
