/*
 * Shared interface rules. Edit values here, not in individual pages.
 * Typography lives in typography.css; page/game files own their layouts.
 * Game boards, timers, keypads and stage artwork may use dedicated geometry.
 */
:root {
  color-scheme: dark;
  --ink: #0b0d0c;
  --surface: #131614;
  --surface-2: #1a1e1b;
  --line: #303631;
  --control-line: #626a63;
  --paper: #f2f3ed;
  --muted: #9da49d;
  --brand-accent-rgb: 255, 210, 26;
  --brand-accent: rgb(var(--brand-accent-rgb));
  --gold: #ffcf5c;
  --orange: #ff6746;
  --blue: #70a5ff;
  --violet: #c89bff;
  --cyan: #65e6f4;

  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --radius: 4px;
  --control-height: 44px;
  --control-height-large: 52px;
  --control-padding: .65rem .75rem;
  --control-font-size: 1rem;
  --control-font-weight: 400;
  --button-padding: .68rem .95rem;
  --button-padding-small: .45rem .65rem;
  --button-padding-large-inline: 1.3rem;
  --button-font-weight: 750;
  --button-font-size-small: .8rem;
  --disabled-opacity: .45;
  --focus-ring: 3px solid var(--blue);
  --focus-offset: 3px;
  --field-gap: var(--space-2);
  --label-font-size: .8rem;
  --label-font-weight: 750;
  --action-gap: var(--space-3);
  --panel-padding: clamp(1rem, 2.5vw, 1.5rem);
  --page-max: 1180px;
  --page-gutter: 1.2rem;
  --page-start: clamp(2.5rem, 5vw, 4rem);
  --page-end: var(--space-12);
  --heading-gap: var(--space-5);
  --heading-padding: 1.75rem;
  --body-line-height: 1.45;
  --copy-line-height: 1.6;
  --show-ease: cubic-bezier(.2, .8, .2, 1);
  --show-shadow: 0 1.4rem 4rem rgba(0, 0, 0, .38);
  font-family: var(--ui-font);
}

@media (max-width: 620px) {
  :root { --page-gutter: 1rem; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--ink); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--ink); color: var(--paper); font-synthesis: none; line-height: var(--body-line-height); text-rendering: optimizeLegibility; }
h1, h2, h3 { text-wrap: balance; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 1000; top: .5rem; left: var(--page-gutter); transform: translateY(-200%); border: 1px solid var(--brand-accent); border-radius: var(--radius); padding: .75rem 1rem; background: var(--ink); color: var(--paper); }
.skip-link:focus { transform: none; }

/* One focus treatment for links, buttons and fields, including custom toggles. */
:is(a, button, input, select, textarea, summary):focus-visible,
.discipline-picker input:focus-visible + span,
.toggle input:focus-visible + i { outline: var(--focus-ring); outline-offset: var(--focus-offset); }

.button { --button-text: var(--paper); display: inline-flex; min-height: var(--control-height); align-items: center; justify-content: center; border: 1px solid var(--control-line); border-radius: var(--radius); padding: var(--button-padding); background: transparent; color: var(--button-text); font-weight: var(--button-font-weight); text-align: center; text-decoration: none; cursor: pointer; }
.button:hover:not(:disabled) { border-color: var(--paper); }
.button-primary { --button-text: var(--ink); border-color: var(--brand-accent); background: var(--brand-accent); }
.button-secondary { background: var(--surface-2); }
.button-danger { --button-text: var(--orange); border-color: var(--orange); }
.button-quiet { --button-text: var(--muted); }
.button-large { min-height: var(--control-height-large); padding-inline: var(--button-padding-large-inline); }
.button-small { padding: var(--button-padding-small); font-size: var(--button-font-size-small); }
.button:disabled, .text-button:disabled { cursor: default; opacity: var(--disabled-opacity); }
.text-button { min-height: var(--control-height); border: 0; padding: .3rem 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; }

/* Controls do not inherit the tiny, uppercase typography of their labels. */
input, select, textarea { width: 100%; min-height: var(--control-height); border: 1px solid var(--control-line); border-radius: var(--radius); padding: var(--control-padding); background: var(--ink); color: var(--paper); font-size: var(--control-font-size); font-weight: var(--control-font-weight); letter-spacing: normal; text-transform: none; }
summary { min-height: var(--control-height); padding-block: var(--space-2); cursor: pointer; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-accent); }
textarea { resize: vertical; line-height: var(--copy-line-height); }
input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }

:is(.tiebreak-form, .add-participant, .login-card, .stacked-form, .word-config-form, .quote-config-basics, .quote-config-card, .topics-config-form, .auth-card, .create-form, .session-create-form, .session-join-form, .session-inline-form, .session-correction-row) label:where(:not(.toggle)),
.session-recovery-label {
  display: grid;
  gap: var(--field-gap);
  color: var(--muted);
  font-size: var(--label-font-size);
  font-weight: var(--label-font-weight);
  text-transform: uppercase;
}

.check-row { grid-template-columns: auto 1fr !important; align-items: start; border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); cursor: pointer; }
.check-row input, .discipline-picker input { width: 20px; min-height: 20px; margin: 0; accent-color: var(--brand-accent); }
.check-row span b, .check-row span small { display: block; }
.check-row span b { color: var(--paper); }
.check-row span small { margin-top: .3rem; }

/* Shared panel geometry. The page owns placement; variants may own the border. */
:is(.auth-card, .dashboard-tournament, .tournament-card, .dashboard-demo, .create-trial, .account-delete-form, .session-panel, .session-game-choice, .admin-section) {
  min-width: 0;
  border-radius: var(--radius);
  padding: var(--panel-padding);
}
.empty-note, .help-text { overflow-wrap: anywhere; color: var(--muted); line-height: var(--copy-line-height); }

.eyebrow { margin: 0 0 .8rem; color: var(--brand-accent); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.back-link { color: var(--muted); font-size: .88rem; text-decoration: none; }
.flash { position: sticky; z-index: 3; top: .5rem; margin: .5rem auto 1rem; border: 1px solid; padding: .85rem 1rem; overflow-wrap: anywhere; background: var(--ink); font-weight: 700; }
.flash-success { border-color: var(--brand-accent); color: var(--brand-accent); }
.flash-error { border-color: var(--orange); color: var(--orange); }
