/* Dartismi — brand: black + flight red, heavy italic display type taken from the wordmark.
   Red is spent on primary actions and the active player; everything else stays neutral. */
:root {
  --bg: #f3f3f4; --bg-grad: #ffffff; --surface: #ffffff; --surface-2: #ececee; --text: #0e0e10; --text-2: #55565c;
  --line: #e1e1e4; --accent: #d90f1c; --accent-2: #a30a14; --accent-text: #ffffff; --danger: #c4121d;
  --win: #1f7a4d; --shadow: 0 1px 2px #0000000d, 0 8px 24px #0000000f;
  --radius: 18px; --tab-h: 64px;
  --display: "Segoe UI Variable Display", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px; color-scheme: light;
}
/* Dark: follows the device unless the user picked a theme in Settings */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0d; --bg-grad: #17090b; --surface: #151518; --surface-2: #222227; --text: #f4f4f6; --text-2: #a3a4ab;
    --line: #2a2a30; --accent: #ff2b37; --accent-2: #d90f1c; --accent-text: #ffffff; --danger: #ff5a63; --win: #4cc38a;
    --shadow: 0 1px 2px #0006, 0 10px 30px #0005; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0d; --bg-grad: #17090b; --surface: #151518; --surface-2: #222227; --text: #f4f4f6; --text-2: #a3a4ab;
  --line: #2a2a30; --accent: #ff2b37; --accent-2: #d90f1c; --accent-text: #ffffff; --danger: #ff5a63; --win: #4cc38a;
  --shadow: 0 1px 2px #0006, 0 10px 30px #0005; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; color: var(--text); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; line-height: 1.45;
  background: radial-gradient(1200px 500px at 85% -10%, var(--bg-grad), transparent 70%), var(--bg); background-attachment: fixed; }
h1, h2, .display { font-family: var(--display); font-style: italic; font-weight: 800; letter-spacing: -0.015em; }
h1 { font-size: 2rem; margin: 0 0 18px; }
h2 { font-size: 1.2rem; margin: 28px 0 12px; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--text-2); }

#app { display: flex; min-height: 100dvh; }
main { flex: 1; padding: 24px 16px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)); max-width: 1000px; margin: 0 auto; width: 100%; outline: none; min-width: 0; }

/* Logo tile: the artwork has a white background, so it always sits on white */
.logo-tile { background: #fff; border-radius: 22%; display: grid; place-items: center; overflow: hidden; box-shadow: var(--shadow); flex: none; }
.logo-tile img { width: 100%; height: 100%; object-fit: contain; padding: 8%; }

/* Tab bar on phones, sidebar from 900px */
#nav { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#nav a { flex: 1; min-height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 0.7rem; font-weight: 600; color: var(--text-2); text-decoration: none; }
#nav a svg { width: 26px; height: 26px; }
#nav a[aria-current="page"] { color: var(--accent); }
#nav .brand { display: none; }
@media (min-width: 900px) {
  #nav { position: sticky; top: 0; height: 100dvh; width: 248px; flex: none; flex-direction: column; justify-content: flex-start;
    border-top: 0; border-right: 1px solid var(--line); padding: 24px 14px; gap: 4px; }
  #nav .brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; }
  #nav .brand .logo-tile { width: 44px; height: 44px; }
  #nav .brand span { font-family: var(--display); font-style: italic; font-weight: 900; font-size: 1.35rem; letter-spacing: 0.02em; text-transform: uppercase; }
  #nav a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 46px; padding: 0 14px;
    border-radius: 12px; font-size: 1rem; position: relative; }
  #nav a svg { width: 22px; height: 22px; }
  #nav a:hover { background: var(--surface-2); color: var(--text); }
  #nav a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 12%, transparent); }
  #nav a[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
  main { padding-bottom: 40px; padding-top: 40px; }
}

/* Controls */
button { font: inherit; font-weight: 600; min-height: 44px; padding: 0 20px; border-radius: 12px; border: 0;
  background: var(--surface-2); color: var(--text); cursor: pointer; touch-action: manipulation; transition: transform .08s, filter .15s; }
button:hover:not(:disabled) { filter: brightness(0.95); }
button:active:not(:disabled) { transform: scale(0.97); }
button.primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: var(--accent-text);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
button.primary:hover:not(:disabled) { filter: brightness(1.07); }
button.danger { color: var(--danger); }
button.small { min-height: 36px; padding: 0 12px; font-size: 0.9rem; }
button:disabled { opacity: 0.45; cursor: default; }
label { display: block; font-weight: 600; margin: 16px 0 6px; font-size: 0.9rem; color: var(--text-2); }
input, select { font: inherit; width: 100%; min-height: 50px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); transition: border-color .15s, background .15s; }
input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.full { width: 100%; }
.mt { margin-top: 16px; }
.auth { max-width: 420px; margin: 4vh auto 0; }
.auth .hero { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 24px; }
.auth .hero .logo-tile { width: 132px; height: 132px; margin-bottom: 14px; }
.error { color: var(--danger); font-weight: 600; min-height: 1.4em; margin: 10px 0 0; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; background: transparent; min-height: 40px; padding: 0 8px; box-shadow: none; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 4px #0000002a; color: var(--accent); }
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list li { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 18px; flex-wrap: wrap; }
.list li + li { border-top: 1px solid var(--line); }
.list li.empty { color: var(--text-2); justify-content: center; }
.list a { font-weight: 600; text-decoration: none; }
.badge { font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.badge.win { background: color-mix(in srgb, var(--win) 16%, transparent); color: var(--win); }
.badge.red { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.soon { border-style: dashed; background: transparent; box-shadow: none; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--display); font-style: italic; font-weight: 800; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.8rem; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat.hl { background: linear-gradient(145deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.stat.hl span { color: #ffffffcc; }
.profile-head { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.profile-head h1 { margin: 0; }
.avatar { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-style: italic; font-size: 1.8rem; font-weight: 900;
  background: linear-gradient(145deg, #222, #000); color: #fff; flex: none; box-shadow: inset 0 0 0 3px var(--accent); }
.avatar.sm { width: 38px; height: 38px; font-size: 1rem; box-shadow: inset 0 0 0 2px var(--accent); }
img.avatar { object-fit: cover; padding: 0; border: 3px solid var(--accent); box-shadow: none; }
img.avatar.sm { border-width: 2px; }
.avatar-edit { border-radius: 50%; display: block; }

/* Nav unread badge */
#nav .ic { position: relative; display: inline-flex; }
.dot { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 800;
  display: inline-grid; place-items: center; line-height: 1; }
#nav .ic .dot { position: absolute; top: -6px; right: -10px; box-shadow: 0 0 0 2px var(--surface); }

/* Messages */
.convo { padding: 0 !important; }
.convo-link { display: flex; gap: 12px; align-items: center; padding: 12px 18px; width: 100%; color: inherit; font-weight: 400 !important; }
.convo-link:hover { background: var(--surface-2); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.strong { color: var(--text); font-weight: 600; }
.center { text-align: center; }
.small-print { font-size: .85rem; margin: 8px 0 0; }
.thread { display: flex; flex-direction: column; height: calc(100dvh - var(--tab-h) - 48px - env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .thread { height: calc(100dvh - 80px); } }
.thread-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.bubbles { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 16px 2px; }
.bubble { max-width: min(78%, 480px); padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: var(--surface-2); align-self: flex-start; word-wrap: break-word; }
.bubble.mine { align-self: flex-end; background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: #fff; border-radius: 18px 18px 6px 18px; }
.bubble time { display: block; font-size: .7rem; opacity: .7; margin-top: 4px; }
.bubble.invite { border: 1px solid var(--accent); background: var(--surface); color: var(--text); }
.bubble.invite.mine { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.composer { padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: nowrap; }
.btn-file span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 12px; background: var(--surface-2);
  color: var(--text); font-weight: 600; cursor: pointer; font-size: 1rem; }
.btn-file:focus-within span { outline: 3px solid var(--accent); outline-offset: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th { color: var(--text-2); font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: .05em; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Game — the remaining score is the signature: huge, italic, tabular */
.game { display: grid; gap: 14px; }
@media (min-width: 900px) { .game { grid-template-columns: 1fr 390px; align-items: start; } }
.players { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.player { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.player.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 10px 30px color-mix(in srgb, var(--accent) 22%, transparent); }
.player.active::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.player .name { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.player .left { font-family: var(--display); font-style: italic; font-size: clamp(2.4rem, 34cqi, 6rem); font-weight: 900; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; margin: 8px 0 4px; }
.player .meta { font-size: 0.85rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.player .checkout { font-weight: 800; color: var(--accent); min-height: 1.4em; font-size: 0.95rem; letter-spacing: .02em; }
.entry { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.entry .display { font-size: 2.8rem; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; min-height: 1.3em; }
.entry .display.bust { color: var(--danger); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { min-height: 62px; font-size: 1.55rem; font-variant-numeric: tabular-nums; }
.keypad button.primary { font-size: 1.1rem; }
.quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 8px; }
.quick button { min-height: 44px; padding: 0; font-size: 1rem; background: transparent; border: 1px solid var(--line); }
.entry-tools { flex-wrap: nowrap; margin-bottom: 8px; }
.entry-tools .seg button { font-size: .9rem; }
.mic { width: 48px; min-width: 48px; padding: 0; display: grid; place-items: center; border-radius: 50%; }
.mic.on { background: var(--accent); color: #fff; animation: mic-pulse 1.6s ease-out infinite; }
@keyframes mic-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
.heard { text-align: center; font-size: .85rem; min-height: 1.3em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slots { display: flex; justify-content: center; gap: 8px; }
.slot { min-width: 64px; padding: 2px 8px; border-radius: 10px; background: var(--surface-2); font-size: 1.5rem; color: var(--text-2); }
.slot.filled { color: var(--text); }
.sum { font-size: 1.4rem; }
.sum small { font-size: .9rem; font-weight: 600; }
.seg.mult { margin-bottom: 8px; }
.seg.mult button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.dartpad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dartpad button { min-height: 50px; padding: 0; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.dartpad.extra { grid-template-columns: 1fr 1fr 1fr 1.4fr; margin-top: 6px; }
.cmd-list { list-style: none; padding: 0; margin: 0; }
.cmd-list li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.cmd-list li span { font-size: .9rem; }
.turns { font-size: 0.9rem; color: var(--text-2); font-variant-numeric: tabular-nums; margin-top: 8px; }
.dialog { position: fixed; inset: 0; background: #000a; backdrop-filter: blur(4px); display: grid; place-items: end center; z-index: 50; padding: 16px; }
.dialog .card { width: 100%; max-width: 420px; margin-bottom: env(safe-area-inset-bottom); }
.dialog h2 { margin-top: 0; }
@media (min-width: 600px) { .dialog { place-items: center; } }

#toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 99px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; box-shadow: var(--shadow); }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } button:active { transform: none !important; } }

/* Spoken score waiting for confirmation */
.pending { text-align: center; padding: 6px 0 2px; }
.pending .pnum { font-family: var(--display); font-style: italic; font-weight: 900; font-size: 3rem; line-height: 1.1; color: var(--accent); }
.pending .bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 10px 0 8px; }
.pending .bar span { display: block; height: 100%; width: 0; background: var(--accent); }
.pending .bar span.run { animation: fill linear forwards; }
@keyframes fill { to { width: 100%; } }

.mic.paused { background: var(--surface-2); color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.diag summary { cursor: pointer; font-size: .85rem; color: var(--text-2); margin: 4px 0; }
.vlog { font-size: .72rem; white-space: pre-wrap; background: var(--surface-2); padding: 8px; border-radius: 8px; max-height: 180px; overflow: auto; margin: 4px 0 8px; }

.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 600; color: var(--text); cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check small { display: block; font-weight: 400; font-size: .85rem; margin-top: 2px; }

/* Roles, tickets, online */
textarea { font: inherit; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); resize: vertical; }
textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.badges { gap: 6px; margin: 4px 0; }
.badges:empty { display: none; }
.badge.pro { background: linear-gradient(135deg, #f5c542, #d9931c); color: #1a1000; }
.badge.role-tester { background: color-mix(in srgb, #3b82f6 18%, transparent); color: #3b82f6; }
.badge.role-moderator { background: color-mix(in srgb, #a855f7 18%, transparent); color: #a855f7; }
.badge.role-admin { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.avatar.support { background: #fff; padding: 3px; box-shadow: none; overflow: hidden; }
.avatar.support img { width: 100%; height: 100%; object-fit: contain; }
.avatar.xs { width: 24px; height: 24px; font-size: .7rem; box-shadow: inset 0 0 0 2px var(--accent); }
img.avatar.xs { border-width: 1px; }
.bubble.support { border: 1px solid var(--line); background: var(--surface); }
.ticket { margin-bottom: 12px; }
.ticket-body { white-space: pre-wrap; margin: 12px 0; }
.reply { border-left: 3px solid var(--accent); padding: 6px 12px; margin: 8px 0; white-space: pre-wrap; background: var(--surface-2); border-radius: 0 10px 10px 0; }
.reply-form { margin-top: 12px; }
.searching, .waiting { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.waiting { flex-direction: column; justify-content: center; text-align: center; min-height: 220px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; border-top-color: var(--accent); } }

.player .name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .name .muted { font-weight: 400; }
.player { container-type: inline-size; }

.fixprev { width: 100%; margin-top: 8px; min-height: 44px; background: transparent; border: 1px dashed var(--line); color: var(--text-2); font-size: .95rem; }
.fixprev:not(:disabled):hover { color: var(--text); border-color: var(--accent); }

.reconnect { display: flex; gap: 12px; align-items: center; padding: 10px 14px; margin-bottom: 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1px solid var(--accent); font-weight: 600; font-size: .95rem; }
.reconnect .spinner { width: 20px; height: 20px; }

/* "Add to home screen" notice */
#install { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom)); z-index: 40; }
@media (min-width: 900px) { #install { left: auto; right: 24px; bottom: 24px; max-width: 460px; } }
.install-card { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--accent); box-shadow: 0 10px 30px #0006; }
.install-card .logo-tile { width: 42px; height: 42px; }
.install-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .85rem; line-height: 1.3; }
.install-text b { font-size: .95rem; }
.install-text span { color: var(--text-2); }
.install-x { min-width: 36px; padding: 0; background: transparent; }
.guide .steps { padding-left: 22px; margin: 8px 0; }
.guide .steps li { margin: 8px 0; line-height: 1.45; }

/* Auto-hiding bottom bar (phones only; the desktop sidebar always stays) */
@media (max-width: 899px) {
  #nav { transition: transform .25s ease; will-change: transform; }
  body.nav-hidden #nav { transform: translateY(calc(100% + 2px)); }
  #install { transition: bottom .25s ease; }
  body.nav-hidden #install { bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { #nav, #install { transition: none !important; } }

/* DartBot */
.avatar.bot { background: linear-gradient(145deg, #2a2a30, #0e0e10); color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.avatar.bot svg { width: 62%; height: 62%; }
.avatar.lg { width: 64px; height: 64px; }
.player .name .avatar.xs.bot svg { width: 70%; height: 70%; }
button.with-icon { display: inline-flex; align-items: center; gap: 8px; }
button.with-icon svg { width: 20px; height: 20px; color: var(--accent); }
.bot-levels { flex-direction: column; align-items: stretch !important; gap: 6px !important; }
.levels { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; width: 100%; }
.levels button { min-height: 40px; padding: 0; font-variant-numeric: tabular-nums; }
.levels button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.bot-turn { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0; text-align: center; }

/* Admin: manage user, login help */
tr.banned td { opacity: .65; }
.manage h3 { font-size: 1rem; margin: 20px 0 8px; }
.manage .actions { display: flex; flex-direction: column; gap: 8px; }
.manage .actions > button { justify-content: flex-start; text-align: left; }
.success { color: var(--win); font-weight: 600; }

/* Tournament */
.tour-card { align-items: center; gap: 14px; }
.trophy { font-size: 2rem; line-height: 1; }
.trophy.big { font-size: 3rem; }
.avatar.guest { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
.tp-row { flex-wrap: nowrap !important; }
.tp-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-match { margin: 12px 0; border-color: var(--accent); }
.vs-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 14px; }
.vs-p { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.vs-p:last-child { justify-content: flex-end; }
.vs { color: var(--text-2); font-style: italic; }
.champion { display: flex; align-items: center; gap: 16px; margin: 12px 0; border-color: #d9a21c;
  background: linear-gradient(135deg, color-mix(in srgb, #f5c542 18%, var(--surface)), var(--surface)); }
.champ-name { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-style: italic; font-weight: 900; font-size: 1.6rem; }
.bracket { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x proximity; }
.b-round { flex: 0 0 200px; display: flex; flex-direction: column; justify-content: space-around; gap: 10px; scroll-snap-align: start; }
.b-round h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin: 0 0 2px; }
.b-match { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.b-match.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.b-match.bye { opacity: .7; }
.b-p { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: .9rem; min-height: 36px; }
.b-p + .b-p { border-top: 1px solid var(--line); }
.b-p.won { font-weight: 800; }
.b-p.won .b-legs { color: var(--accent); }
.b-p.lost { color: var(--text-2); }
.b-p.empty { color: var(--text-2); font-style: italic; }
.b-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-legs { font-variant-numeric: tabular-nums; font-weight: 800; }

/* Leaderboard */
.lb-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.lb-cats button { flex: none; min-height: 38px; padding: 0 14px; border-radius: 99px; font-size: .9rem; }
.lb-cats button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.lb .lb-row { flex-wrap: nowrap; gap: 10px; }
.lb .lb-row.me { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.lb-rank { width: 30px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text-2); flex: none; }
.lb-rank.medal { font-size: 1.35rem; }
.lb-name { font-weight: 700; text-decoration: none; color: var(--text) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lb-value { display: flex; flex-direction: column; align-items: flex-end; font-family: var(--display); font-style: italic; font-weight: 900; font-size: 1.15rem; font-variant-numeric: tabular-nums; flex: none; }
.lb-value small { font-family: inherit; font-style: normal; font-weight: 600; font-size: .7rem; }
.lb-gap { justify-content: center; color: var(--text-2); min-height: 28px !important; }
/* Admin feature switches */
.features .feat { flex-wrap: wrap; gap: 10px; }
.feat-text { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.feat-seg { flex: 0 1 300px; }
.feat-seg button[aria-pressed="true"].st-off { background: var(--danger); color: #fff; }
.feat-seg button[aria-pressed="true"].st-testers { background: #3b82f6; color: #fff; }
.feat-seg button[aria-pressed="true"].st-all { background: var(--win); color: #fff; }
.feat.is-off .feat-text b { color: var(--danger); }
