*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--backdrop); color: var(--white);
  font-family: var(--font); font-weight: 400; font-synthesis: none; font-size: 15px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
/* .num: Roboto's digits are already all one width (measured at 400-900), so no 'tnum' feature: asking for it made
   every new font size cost a slow phone ~14 ms more on its first layout, for no visible change */
.num { }
.soft { color: var(--soft); }
.faint { color: var(--faint); }
.black, h1, h2, h3 { font-weight: 900; }
.b7 { font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--me); outline-offset: 3px; }

/* the section label the app already uses: the only caps in the interface */
.label { font-size: 11px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--soft); }

/* ---- panel: shadow, slab, near-black face, hairline, soft top gloss ---- */
.panel {
  position: relative; border-radius: var(--panel-radius);
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  border: 1px solid var(--hairline);
  box-shadow: 0 var(--slab-depth) 0 var(--slab), 0 16px 30px rgba(0, 0, 0, 0.45);
  padding: 24px;
}
.panel::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 38%); }
.panel > * { position: relative; }
.panel.tight { padding: 16px 20px; }
.panel.flat { box-shadow: 0 4px 0 var(--slab); }
.panel.sel { border-color: var(--white); border-width: 1.6px; }
.panel h2 { font-size: 17px; }
.rule { height: 1px; background: var(--hairline); border: 0; margin: 16px 0; }

/* pressable panel (mode cards): sinks into its slab like a thumb press */
.tile { display: block; text-align: start; width: 100%; cursor: pointer; transition: transform 0.26s var(--ease-back), box-shadow 0.26s var(--ease-back), border-color 0.15s; }
.tile:hover { border-color: var(--hairline-selected); }
.tile:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--slab), 0 10px 22px rgba(0, 0, 0, 0.45); transition-duration: 0.09s; }
.tile:disabled, .tile[aria-disabled='true'] { opacity: 0.5; pointer-events: none; }

/* ---- primary: white pill, dark text, bottom lip, top gloss ---- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 26px; border: 0; border-radius: 999px; white-space: nowrap;
  color: #252525; font-weight: 900; font-size: 15px;
  background: linear-gradient(180deg, #fff 0%, var(--pill-face) 100%);
  box-shadow: 0 var(--pill-lip) 0 #858585, 0 10px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.26s var(--ease-back), box-shadow 0.26s var(--ease-back), filter 0.15s;
}
.btn::before { content: ''; position: absolute; left: 6px; right: 6px; top: 3px; height: 38%; border-radius: 999px;
  background: var(--gloss); pointer-events: none; opacity: 0.55; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(var(--pill-lip)); box-shadow: 0 0 0 #858585, 0 4px 10px rgba(0, 0, 0, 0.35); transition-duration: 0.09s; }
.btn:disabled { background: var(--dark-face); color: var(--faint); box-shadow: 0 var(--pill-lip) 0 #121214; pointer-events: none; }
.btn:disabled::before { display: none; }
.btn.small { min-height: 34px; padding: 0 18px; font-size: 13.5px; }
.btn.wide { width: 100%; }

/* ---- secondary: the quiet outlined pill ---- */
.ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px;
  border-radius: 16px; background: var(--ghost-fill); border: 1.2px solid var(--ghost-line);
  font-weight: 900; font-size: 14.5px; color: var(--white); white-space: nowrap;
  transition: background 0.15s, transform 0.2s var(--ease-back), border-color 0.15s;
}
.ghost:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.4); }
.ghost:active { background: var(--ghost-fill-press); transform: translateY(3px); }
.ghost:disabled { color: var(--faint); opacity: 0.6; pointer-events: none; }
.ghost.small { min-height: 34px; padding: 0 16px; font-size: 13px; border-radius: 14px; }
.ghost.wide { width: 100%; }
.ghost.danger:hover { border-color: var(--bad); color: var(--bad); }

/* ---- hero action: black pill, glowing blue to pink edge. One per screen. ---- */
.hero {
  position: relative; display: flex; align-items: center; width: 100%; text-align: start; border: 0; color: var(--white);
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom)); border-radius: var(--panel-radius); padding-block: 0 0; padding-inline: 0 40px; min-height: 96px;
  box-shadow: 0 var(--slab-depth) 0 var(--slab), 0 16px 30px rgba(0, 0, 0, 0.45);
  transition: transform 0.26s var(--ease-back), box-shadow 0.26s var(--ease-back);
}
.hero::before, .hero::after {
  content: ''; position: absolute; inset: 1px; border-radius: calc(var(--panel-radius) - 1px); pointer-events: none;
  background: linear-gradient(135deg, var(--me), var(--op));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); mask-composite: exclude;
}
.hero::before { padding: 2.4px; }
.hero::after { padding: 8px; filter: blur(8px); opacity: 1; transition: filter 0.2s, opacity 0.2s; }
.hero:hover::after { opacity: 1; filter: blur(9px); }
.hero:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--slab), 0 10px 22px rgba(0, 0, 0, 0.45); transition-duration: 0.09s; }
.hero:disabled { pointer-events: none; border: 1px solid var(--hairline); color: var(--faint); }
.hero:disabled::before, .hero:disabled::after { display: none; }
.hero.pill { border-radius: 999px; min-height: 60px; }
.hero.pill::before, .hero.pill::after { border-radius: 999px; }
.hero .mark { position: relative; width: 96px; align-self: stretch; flex: none; }
.hero .title { font-size: 28px; font-weight: 900; line-height: 1.1; }
.hero .sub { font-size: 14px; color: var(--soft); margin-top: 6px; font-weight: 700; }
.hero .chev { margin-inline-start: auto; flex: none; }
.hero.center { justify-content: center; padding: 0 32px; font-weight: 900; font-size: 17px; text-align: center; }

/* the Play Ranked mark: two balls and a white bar */
.mark-bar { position: absolute; left: 28px; top: calc(50% - 3px); width: 40px; height: 6px; border-radius: 3px; background: #fff; box-shadow: 0 2px 0 rgba(176, 180, 190, 0.5); }
.ball { position: absolute; border-radius: 50%; width: 22px; height: 22px; }
.ball.me, .pip-ball.me { background: radial-gradient(circle at 36% 36%, #a5e9ff 0%, var(--me) 55%, #378aa3 100%); }
.ball.op, .pip-ball.op { background: radial-gradient(circle at 36% 36%, #ffb0c6 0%, var(--op) 55%, #cc4a6e 100%); }
.ball.p3, .pip-ball.p3 { background: radial-gradient(circle at 36% 36%, #dcff9d 0%, var(--p3) 55%, #8fcc30 100%); }
.ball.p4, .pip-ball.p4 { background: radial-gradient(circle at 36% 36%, #ffe099 0%, var(--p4) 55%, #cc9b29 100%); }
.ball::after, .pip-ball::after { content: ''; position: absolute; left: 24%; top: 17%; width: 38%; height: 26%; border-radius: 50%; background: rgba(255, 255, 255, 0.75); }
.pip-ball { display: inline-block; position: relative; width: 14px; height: 14px; border-radius: 50%; flex: none; }

/* ---- tags ---- */
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: 11px; background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.19); font-size: 11.5px; font-weight: 700; color: var(--soft); white-space: nowrap; }
.tag.good { color: var(--good); border-color: rgba(70, 220, 130, 0.5); background: rgba(70, 220, 130, 0.1); }
.tag.bad { color: var(--bad); border-color: rgba(255, 84, 84, 0.5); background: rgba(255, 84, 84, 0.1); }
.tag.coin { color: var(--coin); border-color: rgba(255, 194, 51, 0.45); background: rgba(255, 194, 51, 0.08); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--good); flex: none; }
.dot.warn { background: var(--p4); }
.dot.off { background: var(--bad); }

/* ---- inputs ---- */
.field { display: block; width: 100%; height: 48px; padding: 0 18px; border-radius: 16px; border: 1.2px solid var(--field-line);
  background: var(--field); font-weight: 900; font-size: 16px; color: var(--white); transition: border-color 0.15s; }
.field::placeholder { color: var(--faint); font-weight: 700; }
.field:hover { border-color: rgba(255, 255, 255, 0.5); }
.field:focus { border-color: var(--white); border-width: 1.8px; outline: none; padding: 0 17.4px; }
.field.err { border-color: var(--bad); }
.field:disabled { opacity: 0.5; }
.field.code { text-transform: uppercase; letter-spacing: 0.2em; text-align: center; }
.err-text { color: var(--bad); font-size: 13px; font-weight: 700; min-height: 18px; margin-top: 6px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* segmented switch */
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--hairline); }
.seg button { border: 0; background: transparent; color: var(--soft); font-weight: 900; font-size: 13.5px; padding: 0 20px; height: 34px; border-radius: 999px; transition: background 0.15s, color 0.15s; }
.seg button:hover { color: var(--white); }
.seg button[aria-pressed='true'] { background: var(--pill-face); color: #252525; box-shadow: 0 2px 0 #858585; }
.seg button:disabled { opacity: 0.4; pointer-events: none; }

/* option chips (time control, difficulty) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 40px; padding: 0 16px; border-radius: 14px; background: var(--ghost-fill); border: 1.2px solid var(--ghost-line); font-weight: 900; font-size: 14px; color: var(--soft); transition: all 0.15s; }
.chip:hover { color: var(--white); border-color: rgba(255, 255, 255, 0.45); }
.chip:active { transform: translateY(2px); }
.chip[aria-pressed='true'] { color: var(--white); border-color: var(--white); background: rgba(255, 255, 255, 0.14); }
.chip:disabled { opacity: 0.4; pointer-events: none; }

/* ---- table ---- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: start; padding: 0 14px 12px; }
.table td { padding: 13px 14px; border-top: 1px solid rgba(255, 255, 255, 0.1); font-weight: 700; }
.table tr.mine td { background: rgba(70, 214, 255, 0.09); border-top-color: rgba(70, 214, 255, 0.35); }
.table tr.mine td:first-child { border-start-start-radius: 14px; border-start-end-radius: 0; border-end-end-radius: 0; border-end-start-radius: 14px; }
.table tr.mine td:last-child { border-start-start-radius: 0; border-start-end-radius: 14px; border-end-end-radius: 14px; border-end-start-radius: 0; }
.table .r { text-align: end; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.04); }

/* ---- skeleton ---- */
.skel { border-radius: 12px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.05)); background-size: 200% 100%; animation: skel 1.4s linear infinite; }
@keyframes skel { to { background-position: -200% 0; } }
.empty { color: var(--soft); font-weight: 700; padding: 8px 0; }

/* ---- modal & toast ---- */
.modal-back { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(5, 5, 6, 0.72); padding: 16px; animation: fade 0.2s; }
.modal { width: min(440px, 100%); animation: rise 0.4s var(--ease-back); }
.modal h2 { font-size: 22px; margin-bottom: 8px; }
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #101012; border: 1px solid var(--hairline-selected); border-radius: 16px; padding: 12px 20px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); animation: rise 0.4s var(--ease-back); }
.toast.bad { border-color: var(--bad); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }

/* the wordmark: heavy white type with the app's dark outline */
.wordmark { font-weight: 900; letter-spacing: 0.01em; color: #fff; -webkit-text-stroke: 5px #000; paint-order: stroke fill; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.7); text-transform: uppercase; line-height: 1; }
/* the brand wordmark (style 3c, brand/final/svg): the link keeps its text for
   screen readers; the picture is the logo file. Sized from the font size. */
.brand.wordmark { box-sizing: content-box; width: 6em; height: 1em; background: url(../img/wordmark.svg) left center / contain no-repeat; background-origin: content-box; color: transparent; -webkit-text-stroke: 0; text-shadow: none; overflow: hidden; white-space: nowrap; text-indent: 110%; flex: none; }

/* Language picker in the top bar of every website page (added by tools/i18n.mjs): a globe + the two-letter code,
   opening the same list the footer has. No script needed (details/summary). */
.lang-pick { position: relative; flex: none; }
.lang-pick summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 11px; border-radius: 12px; border: 1.2px solid var(--ghost-line); color: var(--soft); font-weight: 900; font-size: 13px; letter-spacing: 0.04em; cursor: pointer; user-select: none; transition: color 0.15s, border-color 0.15s; }
.lang-pick summary::-webkit-details-marker { display: none; }
.lang-pick summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.lang-pick summary:hover, .lang-pick[open] summary { color: #fff; border-color: var(--hairline-selected); }
.lang-list { position: absolute; inset-inline-end: 0; top: calc(100% + 10px); z-index: 60; width: min(340px, calc(100vw - 32px)); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; padding: 8px; border-radius: 16px; border: 1px solid var(--hairline); background: #0c0c0e; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); }
.lang-pick:not([open]) .lang-list { display: none; }   /* closed: no boxes at all (a closed details still lays out a fixed child, in the wrong place) */
.lang-list a { display: flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 10px; color: var(--soft); font-weight: 700; font-size: 14.5px; text-decoration: none; }
.lang-list a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.lang-list a[aria-current] { color: #fff; font-weight: 900; }
.g-top-in .lang-pick { margin-inline-start: auto; }   /* guide and game pages: logo left, language and Play right */
@media (max-width: 420px) { .g-top-in .lang-pick summary { padding: 0 9px; } .g-top-in .lang-pick summary span { display: none; } }   /* narrow phones: the globe alone, so a long Play label (German "Spielen") still fits at 320 */
@media (max-width: 760px) {
  .lang-list { position: fixed; left: 16px; right: 16px; top: 64px; width: auto; }   /* phones: a sheet under the bar, never off the side */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
