/*
 * MaxDarts Arena – the one stylesheet of the web app (docs/HONNUN-VEFUR.md). Tokens first; every colour, radius
 * and font comes from here, so a change of look is one line. Then the shell (menu, header), then the shared
 * components (cards, buttons, lists, dialogs), then the pages. The game page (/leikur) has its own styles.
 */
@font-face { font-family: "Exo 2"; font-style: italic; font-weight: 800; font-display: swap; src: url(/fonts/exo-2-latin-800-italic.woff2) format("woff2"); }
@font-face { font-family: "Exo 2"; font-style: italic; font-weight: 900; font-display: swap; src: url(/fonts/exo-2-latin-900-italic.woff2) format("woff2"); }
@font-face { font-family: "Exo 2"; font-style: normal; font-weight: 800; font-display: swap; src: url(/fonts/exo-2-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "Exo 2"; font-style: normal; font-weight: 900; font-display: swap; src: url(/fonts/exo-2-latin-900-normal.woff2) format("woff2"); }

:root {
  /* colours: coal, graphite, fire red; gold only for winners; green = connected */
  --bg: #0B0F14;
  --bg-nav: #090C11;
  --card: #171D26;
  --card-hi: #1D242F;
  --raised: #222B36;
  --raised-hi: #2A3542;
  --field: #0F141B;
  --edge: #ffffff14;
  --edge-hi: #ffffff26;
  --text: #E9EDF2;
  --soft: #C9D1DA;
  --muted: #8A96A3;
  --red: #E61928;
  --red-hi: #F22A38;
  --red-lo: #B80B1A;
  --gold: #D4AF37;
  --green: #3BD16F;
  --orange: #F29A2E;
  /* shapes and type */
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px #00000080;
  --display: "Exo 2", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --body: system-ui, "Segoe UI", Roboto, sans-serif;
  --nav-w: 264px;
  --bar-h: 76px;            /* the brand at the top of the menu and the header have the same height and line */
  --frame: #0D1218;         /* the menu and the header: one frame around the page */
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: radial-gradient(1200px 600px at 75% -10%, #E6192812, transparent 60%), var(--bg); color: var(--text); font: 16px/1.45 var(--body); min-height: 100vh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
.display { font-family: var(--display); font-style: italic; font-weight: 900; }

/* ============================================================ the shell: menu on the left, header, page */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.nav { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 0 14px 22px;
  background: var(--frame); border-right: 1px solid var(--edge); }
.brand { display: flex; align-items: center; gap: 12px; height: var(--bar-h); flex: none; margin: 0 -14px 14px; padding: 0 22px; text-decoration: none; color: #fff; border-bottom: 1px solid var(--edge); }
.nav-group { margin: 14px 14px 6px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.brand svg { width: 42px; height: 42px; flex: none; }
.brand span { font-family: var(--display); font-style: italic; font-weight: 900; font-size: 20px; line-height: 1; text-transform: uppercase; display: grid; }
.brand em { font-style: normal; font-size: 12px; letter-spacing: .32em; color: var(--red); font-weight: 800; }
.nav a.item { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-radius: 12px; color: var(--soft); text-decoration: none; font-weight: 700; font-size: 16px; }
.nav a.item:hover { background: #ffffff0a; color: #fff; }
.nav a.item.active { background: linear-gradient(180deg, var(--red), #A80917); color: #fff; box-shadow: 0 6px 18px #E6192840; }
.ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-toggle { display: none; }

.page { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: flex-end; gap: 12px; height: var(--bar-h);
  padding: 0 clamp(16px, 2.4vw, 40px); background: color-mix(in srgb, var(--frame) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--edge); }
.top .crumb { margin-right: auto; color: var(--muted); font-weight: 700; font-size: 15px; }
#view { padding: clamp(18px, 2.2vw, 34px) clamp(16px, 2.4vw, 40px) 48px; width: 100%; display: grid; gap: 24px; align-content: start; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(82vw, 300px); transform: translateX(-102%); transition: transform .2s; box-shadow: 20px 0 60px #000a; }
  .nav-open .nav { transform: none; }
  .nav-open .scrim { position: fixed; inset: 0; z-index: 39; background: #0009; }
  .top { justify-content: space-between; height: 64px; }
  .top .crumb { display: none; }
  .nav-toggle { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--edge); background: var(--card); cursor: pointer; }
  .top-brand { display: flex; align-items: center; gap: 8px; margin-right: auto; font-family: var(--display); font-style: italic; font-weight: 900; text-transform: uppercase; text-decoration: none; }
  .top-brand svg { width: 30px; height: 30px; }
}
@media (min-width: 861px) { .top-brand { display: none; } }

/* status dot (the dart system) and the user button */
.dot-btn { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--edge); background: var(--card); cursor: pointer; font-size: 14px; color: var(--soft); }
.dot-btn i { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot-btn.green i { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot-btn.orange i { background: var(--orange); }
.dot-btn.red i { background: var(--red); }
@media (max-width: 560px) { .dot-btn b { display: none; } }
.user { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--edge); border-radius: 999px; padding: 5px 14px 5px 5px; font-weight: 700; cursor: pointer; }
.user-btn:hover { background: var(--card-hi); }
.user-btn .caret { font-size: 12px; opacity: .7; }
@media (max-width: 560px) { .user-btn .name, .user-btn .caret { display: none; } .user-btn { padding: 4px; } }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 240px; background: #141A21; border: 1px solid var(--edge-hi); border-radius: 12px; padding: 6px; box-shadow: 0 18px 40px #0008; display: grid; }
.menu a, .menu button { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; }
.menu a:hover, .menu button:hover { background: #ffffff0f; }
.menu .who { padding: 10px 12px; color: var(--muted); font-size: 14px; border-bottom: 1px solid var(--edge); margin-bottom: 4px; }
.menu .who b { color: var(--text); }
.menu .out { color: #FF6B6B; border-top: 1px solid var(--edge); border-radius: 0 0 8px 8px; margin-top: 4px; }

/* ============================================================ components */
.card { background: linear-gradient(180deg, var(--card-hi), var(--card)); border: 1px solid var(--edge); border-radius: var(--radius); padding: clamp(14px, 1.6vw, 22px); box-shadow: var(--shadow); min-width: 0; }
.card > h2, .section-title { white-space: nowrap; font-family: var(--display); font-style: italic; font-weight: 900; font-size: clamp(22px, 2vw, 28px); display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.card > h2::after, .section-title::after { content: ""; flex: 0 1 110px; min-width: 0; height: 2px; background: linear-gradient(90deg, var(--red), #E6192800); }
.kicker { margin: 0; color: var(--gold); font-weight: 800; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.note { margin: 0; color: var(--muted); font-size: 14px; }
.soft { color: var(--soft); }
.error { color: #FF6B6B; margin: 0; font-weight: 600; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--display); font-style: italic; font-weight: 900; font-size: clamp(28px, 3vw, 42px); line-height: 1.05; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.page-head .grow { flex: 1; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--edge-hi); border-radius: var(--radius-sm); padding: 10px 16px; background: var(--raised); font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--raised-hi); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: linear-gradient(180deg, var(--red-hi), var(--red-lo)); border-color: #ff4a55; color: #fff; box-shadow: 0 6px 18px #E6192840; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: linear-gradient(180deg, var(--red-hi), var(--red-lo)); }
.btn.big { font-family: var(--display); font-size: 18px; padding: 13px 22px; }
.btn.ghost { background: transparent; }
.btn.ring { background: transparent; border: 2px solid var(--red); border-radius: 999px; }
.btn.ring:hover:not(:disabled) { background: #E6192822; box-shadow: 0 0 18px #E6192855; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn.link { background: none; border: 0; color: #FF4A55; padding: 4px; box-shadow: none; }
.btn.danger { color: #FF6B6B; }
.btn .ico { width: 18px; height: 18px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }

label.field { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
input.input, select.input, .field input, .field select { background: var(--field); border: 1px solid var(--edge-hi); border-radius: var(--radius-sm); padding: 11px 12px; min-width: 0; }
.field input:focus, .field select:focus, .input:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.check { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--soft); font-size: 14px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { display: inline-block; vertical-align: middle; width: 40px; height: 22px; border-radius: 999px; background: #2A333E; position: relative; transition: background .15s; flex: none; }
.switch > span:last-child { display: inline-flex; align-items: center; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + i { background: #2FB463; }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid #fff; outline-offset: 2px; }

.list { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.item-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: #ffffff07; border: 1px solid transparent; flex-wrap: wrap; }
.item-row .grow { flex: 1; min-width: 0; display: grid; }
.item-row .grow b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-row .grow small { color: var(--muted); }
.empty { display: grid; justify-items: center; gap: 6px; padding: 34px 16px; border: 1px dashed var(--edge-hi); border-radius: var(--radius); color: var(--soft); text-align: center; }
.empty p { margin: 0; }

.avatar { --h: 0; position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 900; color: #fff;
  background: linear-gradient(160deg, hsl(var(--h) 60% 45%), hsl(var(--h) 65% 28%)); border: 2px solid #ffffff22; }
.avatar.small { width: 30px; height: 30px; font-size: 13px; }
.avatar.big { width: 64px; height: 64px; font-size: 26px; }
.avatar.empty { background: none; border: 2px dashed #ffffff26; }
.avatar .st { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--card); background: var(--green); }
.avatar .st.playing { background: var(--gold); }
.avatar .st.busy { background: var(--muted); }
.art { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; background: radial-gradient(circle at 50% 40%, #1A212B, #0B0F14); }
.tag { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: #ffffff10; color: var(--soft); }
.tag.red { background: var(--red); color: #fff; }
.tag.gold { background: #D4AF3726; color: var(--gold); }

dialog.dialog { border: 1px solid var(--edge-hi); border-radius: 18px; background: linear-gradient(180deg, var(--card-hi), #141A22); color: var(--text); padding: 24px; width: min(540px, calc(100% - 32px)); box-shadow: 0 30px 80px #000c; }
dialog.dialog::backdrop { background: #04060Bb8; backdrop-filter: blur(3px); }
dialog.dialog h2 { font-family: var(--display); font-style: italic; font-weight: 900; margin: 4px 0 6px; }
dialog.dialog form { display: grid; gap: 12px; margin-top: 14px; }
dialog.dialog.center { text-align: center; }
dialog.dialog.center .row { justify-content: center; margin-top: 14px; }
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: min(520px, calc(100% - 32px)); }
.toast { background: #141A21; border: 1px solid var(--edge-hi); border-left: 4px solid var(--green); border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow); }
.toast.error { border-left-color: var(--red); }

/* The dartboard drawing (core/board.js), the same colours as on the game screen */
svg.board .b-rim { fill: url(#ma-rim); }
svg.board .b-dark { fill: #141719; }
svg.board .b-light { fill: #EADDB6; }
svg.board .b-red { fill: #D0202D; }
svg.board .b-green { fill: #13914A; }
svg.board .b-num { fill: #C9D0D8; font-family: var(--display); font-weight: 800; }

/* ============================================================ pages */
/* Heim */
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; min-height: clamp(140px, 19vh, 220px);
  border-radius: 18px; border: 1px solid var(--edge); background: radial-gradient(60% 120% at 78% 50%, #3b0a1080 0%, transparent 60%), linear-gradient(105deg, #12171F 0%, var(--bg) 52%, #170A0D 100%); box-shadow: var(--shadow); }
.hero-text { position: relative; z-index: 2; padding: clamp(18px, 3vh, 40px) clamp(20px, 3vw, 52px); }
.hero h1 { font-family: var(--display); font-style: italic; font-weight: 900; font-size: clamp(32px, 4.4vw, 70px); line-height: 1; text-shadow: 0 4px 24px #000; }
.hero h1 small { display: block; font-size: .46em; font-weight: 800; color: #DCE1E8; margin-bottom: .14em; }
.hero h1::after { content: ""; display: block; width: 2.6em; height: 6px; margin-top: .3em; background: linear-gradient(90deg, var(--red), #E6192800); transform: skewX(-24deg); transform-origin: left; }
.hero p { margin: 14px 0 0; color: #C4CCD6; font-size: clamp(15px, 1.2vw, 20px); max-width: 38ch; }
.hero-art { align-self: stretch; position: relative; min-height: 150px; }
.hero-art svg { position: absolute; top: 50%; right: -8%; height: 165%; width: auto; aspect-ratio: 1; transform: translateY(-50%) rotate(-14deg); filter: drop-shadow(0 20px 40px #000);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 34%); mask-image: linear-gradient(90deg, transparent 0%, #000 34%); }
@media (max-width: 700px) { .hero { grid-template-columns: minmax(0, 1fr); } .hero-art { position: absolute; inset: 0 0 0 40%; opacity: .35; } }
.home-grid { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(0, 2.7fr); gap: 22px; align-items: start; }
.home-lower { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 1100px) { .home-grid, .home-lower { grid-template-columns: minmax(0, 1fr); } }
.start-list { display: grid; gap: 10px; }
.start-list .btn { justify-content: flex-start; padding: 13px 16px; }
/* At most five tiles a row, the same width in every row (the two practice games line up under the games) */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(165px, calc((100% - 4 * 14px) / 5)), 1fr)); gap: 14px; }
.game-tile { position: relative; display: grid; gap: 8px; align-content: start; padding: 12px; border-radius: 14px; border: 1px solid var(--edge); background: linear-gradient(180deg, #1D242F, #141A22); text-decoration: none; transition: transform .15s, border-color .15s, box-shadow .15s; }
.game-tile:hover { transform: translateY(-2px); border-color: #E6192880; box-shadow: 0 10px 26px #E6192826; }
.game-tile b { font-family: var(--display); font-weight: 800; font-size: 18px; line-height: 1.1; }
.game-tile small { color: var(--muted); }
.game-tile .tag.red { position: absolute; top: 8px; right: 8px; font-size: 11px; }
.practice { display: grid; gap: 10px; }
.practice a { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px; border-radius: 14px; border: 1px solid var(--edge); background: #ffffff05; text-decoration: none; }
.practice a:hover { border-color: #E6192880; }
.practice b { font-family: var(--display); font-weight: 800; font-size: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats div { display: grid; justify-items: center; gap: 4px; padding: 6px; border-left: 1px solid var(--edge); text-align: center; }
.stats div:first-child { border-left: 0; }
.stats b { font-family: var(--display); font-size: clamp(26px, 3vw, 44px); line-height: 1; }
.stats span { color: var(--muted); font-size: 14px; }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; } .stats div:nth-child(3) { border-left: 0; } }

/* Leikir: set up a game at one board */
.setup { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 1000px) { .setup { grid-template-columns: minmax(0, 1fr); } }
.setup-art { max-width: 220px; }
.players-list .item-row { background: #ffffff09; }
.players-list .num { width: 26px; text-align: center; font-weight: 900; color: var(--muted); }
.add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.options { display: grid; gap: 12px; }

/* Netleikur (lobby) */
.stats-chips { display: flex; gap: 10px; }
.chip { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--edge); }
.chip div { display: grid; line-height: 1.1; }
.chip b { font-size: 20px; }
.chip small { color: var(--muted); font-size: 12px; }
.lobby { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .lobby { grid-template-columns: minmax(0, 1fr); } }
.lobby-main { display: grid; gap: 16px; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar .filter { display: flex; align-items: center; gap: 10px; color: var(--muted); margin-left: auto; }
.offer { position: relative; overflow: hidden; display: grid; grid-template-columns: 132px minmax(0, 1fr) auto auto; align-items: center; gap: 18px; padding: 12px 16px 12px 12px;
  border-radius: var(--radius); border: 1px solid var(--edge); background: linear-gradient(100deg, #1D242F 0%, #161C25 55%, #121821 100%); }
.offer::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--red); }
.offer.mine { border-color: #D4AF3766; }
.offer.mine::before { background: var(--gold); }
.offer .art { width: 132px; }
.offer h3 { font-family: var(--display); font-weight: 800; font-size: 22px; }
.offer .info { display: grid; gap: 3px; min-width: 0; }
.offer .settings { margin: 0; color: var(--soft); font-size: 14px; }
.waiting { border-color: #D4AF3780; box-shadow: 0 0 0 1px #D4AF3733, var(--shadow); }
.waiting::before { background: var(--gold); }
.waiting-side { display: grid; gap: 10px; justify-items: end; }
.seats { display: flex; align-items: center; gap: 6px; }
.seats .count { display: flex; align-items: center; gap: 4px; color: var(--soft); font-weight: 700; margin-right: 6px; white-space: nowrap; }
.seats .count .ico { width: 16px; height: 16px; }
@media (max-width: 700px) {
  .offer { grid-template-columns: 96px minmax(0, 1fr); }
  .offer .art { width: 96px; }
  .offer .seats, .offer .act, .waiting-side { grid-column: 1 / -1; justify-items: start; }
}
.side { position: sticky; top: 20px; display: grid; gap: 12px; }
.side h2 { font-size: 18px; display: flex; align-items: center; gap: 10px; }
.live { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.side .switch { padding-bottom: 10px; border-bottom: 1px solid var(--edge); }
.player { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; background: #ffffff06; }
.player.you { background: #E6192812; }
.player .grow { flex: 1; display: grid; min-width: 0; line-height: 1.2; }
.player .grow b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .grow small { color: var(--muted); }
.invite-who { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 14px 0 6px; }
.invite-who .art { width: 140px; }

/* Spjöld, Stillingar, Stjórn */
.board-card { display: grid; gap: 12px; }
.board-card header { display: flex; align-items: center; gap: 12px; }
.board-card h3 { font-family: var(--display); font-weight: 800; font-size: 22px; flex: 1; }
.link-box { display: grid; gap: 8px; background: var(--field); border: 1px solid var(--edge); border-radius: 12px; padding: 14px; }
.link-box .code { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 900; letter-spacing: .08em; color: var(--gold); }
.link-box .url { margin: 0; overflow-wrap: anywhere; font-size: 14px; }

/* Login page */
.auth { width: min(440px, calc(100% - 32px)); margin: 0 auto; padding: 8vh 0 40px; display: grid; gap: 16px; }
.auth .brand { justify-content: center; padding-bottom: 6px; }
.auth .brand svg { width: 56px; height: 56px; }
.auth .brand span { font-size: 26px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; background: var(--card); border: 1px solid var(--edge); border-radius: 14px; }
.tabs button { border: 0; border-radius: 10px; padding: 10px; font-weight: 700; background: none; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--raised); color: #fff; box-shadow: inset 0 -3px 0 var(--red); }
.auth form { display: grid; gap: 14px; }
@media (max-width: 520px) {
  .practice a { grid-template-columns: 84px minmax(0, 1fr) auto; gap: 10px; }
  .practice .note { display: none; }
}

/* A game's settings: the name on the left, the choice on the right (ui.js optionRow) */
.opts { display: grid; }
.opt { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 2fr); align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--edge); }
.opt:first-child { border-top: 0; }
.opt-label { font-weight: 700; color: var(--text); }
.opt.toggle .switch, .opt.number .num { justify-self: end; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); gap: 6px; }
.seg-btn { border: 1px solid var(--edge-hi); background: var(--field); color: var(--soft); border-radius: 12px; padding: 11px 12px; font-weight: 700; cursor: pointer; transition: border-color .12s, box-shadow .12s, background .12s; }
.seg-btn:hover { border-color: #ffffff40; color: #fff; }
.seg-btn.on { border-color: var(--red); background: linear-gradient(180deg, #E6192833, #E6192814); color: #fff; box-shadow: 0 0 0 1px var(--red) inset, 0 0 18px #E6192840; }
.num { display: inline-flex; align-items: center; gap: 4px; background: var(--field); border: 1px solid var(--edge-hi); border-radius: 12px; padding: 4px; }
.num-btn { width: 40px; height: 40px; border: 0; border-radius: 9px; background: var(--raised); font-size: 22px; font-weight: 700; cursor: pointer; }
.num-btn:hover:not(:disabled) { background: var(--raised-hi); }
.num-btn:disabled { opacity: .35; cursor: default; }
.num-val { min-width: 52px; text-align: center; font-family: var(--display); font-size: 22px; }
@media (max-width: 640px) {
  .opt { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .opt.toggle { grid-template-columns: minmax(0, 1fr) auto; }
  .opt.number { grid-template-columns: minmax(0, 1fr) auto; }
}
/* Choosing the game in the lobby's dialog; the small picture in a setup page's head */
.game-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.game-pick-btn { display: grid; gap: 6px; padding: 8px; border-radius: 12px; border: 1px solid var(--edge-hi); background: var(--field); cursor: pointer; text-align: center; }
.game-pick-btn b { font-family: var(--display); font-weight: 800; font-size: 14px; line-height: 1.15; }
.game-pick-btn.on { border-color: var(--red); box-shadow: 0 0 0 1px var(--red) inset, 0 0 18px #E6192840; background: linear-gradient(180deg, #E6192826, #E619280d); }
dialog.dialog { width: min(620px, calc(100% - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; }
.head-art { width: 120px; flex: none; }
@media (max-width: 640px) { .head-art { display: none; } }
@media (max-width: 640px) {
  .seg-btn { padding: 10px 6px; }
  .players-list .item-row { gap: 8px; padding: 8px; }
  .players-list .item-row .btn.small { padding: 6px 7px; }
}

.num-val.wide { min-width: 96px; font-size: 18px; white-space: nowrap; }
img.art.photo { object-fit: cover; object-position: 60% 50%; }

/* A game's cover on its card: the whole card is the picture (2:3), the name is in it */
.game-tile.poster { padding: 0; overflow: hidden; aspect-ratio: 2 / 3; align-content: end; }
.game-tile.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.game-tile.poster .poster-foot { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 26px 12px 10px;
  background: linear-gradient(180deg, transparent, #000c 60%); }
.game-tile.poster .poster-foot small { color: #DCE1E8; }
.game-tile.poster .tag.red { position: static; }
img.art.from-cover { object-position: 50% 30%; } /* the scene of a cover, above its name */

/* A game's setup page: its cover behind the page, blurred, darkened and fading into the background */
#view { position: relative; }
#view > .backdrop { position: absolute; inset: 0 0 auto 0; height: min(85vh, 900px); z-index: 0; pointer-events: none; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 35%, transparent 100%); mask-image: linear-gradient(180deg, #000 0%, #000 35%, transparent 100%); }
#view > .backdrop::before { content: ""; position: absolute; inset: -40px; background: var(--cover) center 25% / cover no-repeat; filter: blur(6px) saturate(1.2); opacity: .55; }
#view > .backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #0B0F14 0%, #0B0F1499 30%, #0B0F1433 70%, #0B0F1466 100%); }
#view.with-backdrop > :not(.backdrop) { position: relative; z-index: 1; }
#view.with-backdrop .card { background: linear-gradient(180deg, #1D242Fd9, #171D26e6); backdrop-filter: blur(6px); }

/* Heim: an unfinished game at the board */
.resume-strip { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: var(--radius); text-decoration: none;
  border: 1px solid #D4AF3766; background: linear-gradient(90deg, #D4AF371f, #171D26 60%); box-shadow: var(--shadow); }
.resume-strip .grow { flex: 1; min-width: 0; }
.resume-strip small { color: var(--muted); }
.resume-strip:hover { border-color: var(--gold); }

/* The welcome with its banner picture: the picture fills the box, darkened on the left behind the text */
.hero.banner { background: linear-gradient(90deg, #0B0F14f2 0%, #0B0F14b3 35%, #0B0F1400 70%), var(--banner) right center / cover no-repeat, var(--bg); }
.hero.banner .hero-art { display: none; }

/* The welcome's right side: today's numbers and the last match */
.hero-side { position: relative; z-index: 2; display: flex; gap: 14px; justify-content: flex-end; align-items: stretch; padding: 18px clamp(18px, 2.4vw, 36px); flex-wrap: wrap; }
.hero-today, .hero-last { display: grid; gap: 8px; align-content: center; padding: 14px 18px; border-radius: 14px; background: #0B0F1499; border: 1px solid var(--edge); backdrop-filter: blur(6px); }
.hero-today > small, .hero-last > small { color: var(--gold); font-weight: 800; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.hero-nums { display: flex; gap: 22px; }
.hero-nums div { display: grid; }
.hero-nums b { font-family: var(--display); font-size: clamp(24px, 2.2vw, 34px); line-height: 1; }
.hero-nums span { color: var(--muted); font-size: 13px; }
.hero-last { min-width: 190px; }
.hero-last b { font-family: var(--display); font-size: 22px; }
.hero-last.won { border-color: #D4AF3766; }
@media (max-width: 700px) { .hero-side { justify-content: flex-start; padding-top: 0; } }
@media (max-width: 560px) {
  .games { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hero-side { gap: 10px; }
  .hero-today, .hero-last { flex: 1 1 100%; }
}
.tag.dev { background: #F29A2E; color: #1a1205; }
.game-tile.poster .tag.dev { position: static; }
.game-tile:not(.poster) .tag.dev { position: absolute; top: 8px; right: 8px; }
.game-pick-btn .tag.dev { justify-self: center; }
