/* Grimorio (F18): pergamino, sangre y oro. Colours are tokens, light by default and dark under the system preference or
   the header's toggle (html[data-theme], F7). Cinzel for headings, Alegreya Sans for text, both served from /fonts
   (OFL, font-src 'self'). Every pair of text and background meets WCAG AA in both themes. */

/* ─── Fonts ─────────────────────────────────────────────────────────────────────────────────────────────────────── */

/* Cinzel is variable: one file for every weight */
@font-face { font-family: 'Cinzel'; src: url('/fonts/cinzel.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url('/fonts/alegreya-sans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url('/fonts/alegreya-sans-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url('/fonts/alegreya-sans-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url('/fonts/alegreya-sans-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

/* ─── Tokens ────────────────────────────────────────────────────────────────────────────────────────────────────── */

/* Light: pergamino y tinta */
:root {
  color-scheme: light;
  --bg: #F6F1E7;
  --surface: #FFFDF8;
  --surface-2: #F1EADC;
  --text: #1E1824;
  --muted: #5F566A;
  --line: #DDD3C2;
  --line-strong: #C3B497;
  --accent: #9E1F35;        /* sangre: the main action */
  --accent-hover: #841A2C;
  --accent-text: #FFFFFF;
  --gold: #7A5C14;          /* oro viejo: links, details, the current page */
  --today: #9E1F35;         /* today in the calendar */
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235F566A' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --error: #A8283A;
  --ok: #2E7048;
  --shadow: 0 1px 2px rgb(30 24 36 / 6%), 0 8px 24px rgb(30 24 36 / 6%);

  --font-display: 'Cinzel', 'Times New Roman', serif;
  --font-text: 'Alegreya Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
}

/* Dark: noche, sangre y oro */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #110E16;
    --surface: #1B1722;
    --surface-2: #251F2E;
    --text: #EEE7DA;
    --muted: #A99FB4;
    --line: #3A3245;
    --line-strong: #544865;
    --accent: #C8324A;
    --accent-hover: #A82A3F;
    --accent-text: #FFFFFF;
    --gold: #D4AF5A;
    --today: #E8707E;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23A99FB4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --error: #E8707E;
    --ok: #6FBF8E;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px rgb(0 0 0 / 35%);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #110E16;
  --surface: #1B1722;
  --surface-2: #251F2E;
  --text: #EEE7DA;
  --muted: #A99FB4;
  --line: #3A3245;
  --line-strong: #544865;
  --accent: #C8324A;
  --accent-hover: #A82A3F;
  --accent-text: #FFFFFF;
  --gold: #D4AF5A;
  --today: #E8707E;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23A99FB4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --error: #E8707E;
  --ok: #6FBF8E;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px rgb(0 0 0 / 35%);
}

/* ─── Base ──────────────────────────────────────────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--font-text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--text); }
main { flex: 1; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; letter-spacing: 0.03em; }
h1 { font-size: clamp(30px, 4.4vw, 44px); margin: 28px 0 12px; }
h2 { font-size: 24px; margin: 0 0 12px; }
h3 { font-size: 18px; margin: 16px 0 8px; letter-spacing: 0.04em; }
p { margin: 0 0 12px; }
strong { font-weight: 700; }

/* The space beside the page: half of what a 1040px column would leave (F39), and never under 20px */
.wrap { width: 100%; margin: 0 auto; padding: 0 max(20px, calc((100vw - 1040px) / 4)); }
main.wrap { padding-bottom: 56px; }
.muted { color: var(--muted); }

/* Where the keyboard is, always visible */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

::selection { background: var(--accent); color: var(--accent-text); }

/* ─── Header ────────────────────────────────────────────────────────────────────────────────────────────────────── */

.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-inner { display: flex; align-items: center; gap: 10px 24px; min-height: 68px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }

/* The logo (F20): a card like the games' emblems, blood with the untap U in gold, the same in either theme */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.brand::before {
  content: '';
  width: 35px;
  height: 46px;
  flex: none;
  background: url('/img/logo.svg') center / contain no-repeat;
}
.brand:hover { color: var(--text); }
/* The U of the name in the logo's own gold (img/logo.svg), the same in either theme */
.brand-initial { color: #D4AF5A; }

.nav { display: flex; flex-wrap: wrap; gap: 4px 20px; flex: 1; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--gold); font-weight: 700; border-bottom-color: var(--gold); }
/* ─── The header behind a hamburger (F38): phones, and tablets when logged in (`is-compact`, layout.js) ─── */
/* The logo and the hamburger in the header's row; the rest in the panel under it */
.site-header.is-compact .header-inner { gap: 8px 14px; justify-content: space-between; }
/* The links first in the panel, one under the other with a rule between them, as on Asmodevs' landing */
.site-header.is-compact .nav { flex-direction: column; flex-wrap: nowrap; gap: 0; }
.site-header.is-compact .nav a { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 17px; }
.site-header.is-compact .nav a[aria-current="page"] { border-bottom-color: var(--line); }
/* The panel takes the screen's whole width, right under the header */
.site-header.is-compact { position: relative; }
.site-header.is-compact .header-menu { display: block; }
.site-header.is-compact .header-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
}
.site-header.is-compact .header-menu-button:hover, .site-header.is-compact .header-menu-button[aria-expanded="true"] { color: var(--gold); border-color: var(--gold); }
.site-header.is-compact .header-menu-button .icon { width: 22px; height: 22px; }
.site-header.is-compact .header-menu-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 20px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.site-header.is-compact .header-menu-panel:not(.is-open) { display: none; }
.site-header.is-compact .header-toggles { display: flex; justify-content: space-between; align-items: center; }
.site-header.is-compact .account { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.site-header.is-compact .account:empty { display: none; }
.site-header.is-compact .account-user { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--text); font-weight: 500; border-radius: var(--radius); }
.site-header.is-compact .account-user:hover, .site-header.is-compact .account-user[aria-current="page"] { color: var(--gold); }
.site-header.is-compact .account-user-name { display: inline; }
.site-header.is-compact .account .button { width: 100%; min-height: 44px; }

.account { display: flex; align-items: center; gap: 10px; }
/* The theme, the language and the account: in the header's row, and behind a hamburger on phones (F38) */
.header-menu, .header-menu-panel, .header-toggles { display: contents; }
.header-menu-button { display: none; }
.account-user-name { display: none; }
/* The store's logo opens its account: a small round image, a gold ring on hover or on the account's page */
.account-user { display: inline-flex; border-radius: 50%; text-decoration: none; }
.account-user .store-image { transition: box-shadow 0.15s ease; }
.account-user:hover .store-image, .account-user[aria-current="page"] .store-image { box-shadow: 0 0 0 2px var(--gold); }

/* Toggles in the header (F18): a track with a sliding knob. Theme: sun and moon, the knob on the moon when dark.
   Language: ES | EN, the knob behind the current one. */
.toggle {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.toggle-track {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 68px;
  height: 34px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  transition: border-color 0.15s ease;
}
.toggle:hover .toggle-track { border-color: var(--gold); }
.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 30px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--gold);
  transition: transform 0.2s ease;
}
.toggle-track > :not(.toggle-knob) { position: relative; z-index: 1; justify-self: center; }
.toggle .icon { width: 16px; height: 16px; }
.icon-sun { --icon: url('/img/icons/sun.svg'); }
.icon-info { --icon: url('/img/icons/info.svg'); }
.icon-calendar { --icon: url('/img/icons/calendar.svg'); }
.icon-moon { --icon: url('/img/icons/moon.svg'); }
.theme-toggle[aria-checked="true"] .toggle-knob { transform: translateX(30px); }
.theme-toggle[aria-checked="true"] .icon-moon, .theme-toggle[aria-checked="false"] .icon-sun { color: var(--gold); }
.toggle-option { font: 700 12px/1 var(--font-text); letter-spacing: 0.06em; }
.language-toggle.is-en .toggle-knob { transform: translateX(30px); }
.language-toggle.is-es .toggle-option.is-es, .language-toggle.is-en .toggle-option.is-en { color: var(--gold); }
.site-header .button { min-height: 40px; padding: 0 14px; font-size: 15px; }

/* ─── Footer ────────────────────────────────────────────────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.14em;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.footer-links a { color: inherit; }
.footer-links a:hover { color: var(--gold); }

/* ─── Buttons ───────────────────────────────────────────────────────────────────────────────────────────────────── */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font: 700 16px/1.2 var(--font-text);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.button.is-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); font-weight: 500; }
.button.is-ghost:hover { border-color: var(--gold); color: var(--gold); background: transparent; }
.button.is-danger, .button.is-danger:hover, .button.is-danger:disabled, .button.is-danger:disabled:hover { background: transparent; border-color: var(--error); color: var(--error); }
.button.is-danger:hover:not(:disabled) { background: var(--surface-2); }
.button.is-current, .tabs .is-current { border-color: var(--gold); color: var(--gold); font-weight: 700; background: var(--surface-2); }
.button:disabled, .button:disabled:hover { opacity: 0.5; cursor: default; background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button.is-ghost:disabled, .button.is-ghost:disabled:hover { background: transparent; border-color: var(--line-strong); color: var(--text); }

/* ─── Form controls ─────────────────────────────────────────────────────────────────────────────────────────────── */

input, select, textarea {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 9px 12px;
  min-height: 44px;
}
textarea { min-height: 0; line-height: 1.5; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--gold); outline: 2px solid var(--gold); outline-offset: 0; }
input:disabled, select:disabled, textarea:disabled { opacity: 0.6; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type="file"] { min-height: 0; padding: 8px; }
input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
input[type="checkbox"], input[type="radio"] { min-height: 0; accent-color: var(--accent); }

/* Drop-downs: the native arrow swapped for the same chevron the searchable ones (F14) have */
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 38px;
  background: var(--surface) var(--chevron) no-repeat right 14px center / 12px 8px;
  cursor: pointer;
}
select:disabled { cursor: not-allowed; }
/* Only for screen readers */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The hidden attribute always hides, whatever display a class gives */
[hidden] { display: none !important; }

/* ─── Forms ─────────────────────────────────────────────────────────────────────────────────────────────────────── */

.form { display: flex; flex-direction: column; gap: 16px; max-width: 420px; }
.form.is-wide { max-width: 580px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.actions.is-centered { justify-content: center; margin-top: 24px; }
.page-actions { margin: 0 0 20px; }
/* A store's plan in My tournaments (F45): the tier, and what each month from this one has used, a full one in red */
.plan { margin: 0 0 20px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.plan p { margin: 0; }
/* The tier in gold, as the site's highlights; the (?) on how they count right after the limit */
.plan-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; }
.plan-tier { color: var(--gold); }
.plan-head .info-tip { color: var(--muted); }
.plan-months { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.plan-months li { display: flex; flex-direction: column; min-width: 96px; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); font-variant-numeric: tabular-nums; }
.plan-month { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.plan-months li.is-full { border-color: var(--error); color: var(--error); }
.form-heading { font-size: 20px; margin: 16px 0 0; }
.fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 16px 16px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
}
.fieldset legend { font-size: 14px; font-weight: 700; color: var(--muted); padding: 0 6px; }
input.is-short { max-width: 8em; }
/* A required field left empty, once the form has been tried: its label and its box in red until it is filled */
.field.is-missing label { color: var(--error); }
.field.is-missing input, .field.is-missing select, .field.is-missing textarea, .field.is-missing .date-picker-field {
  border-color: var(--error);
  box-shadow: 0 0 0 1px var(--error);
}
.field.is-missing input:focus-visible, .field.is-missing select:focus-visible, .field.is-missing .date-picker-field:focus-visible { border-color: var(--error); outline-color: var(--error); }
.game-picker.is-missing legend { color: var(--error); }
.game-picker.is-missing .game-choice { border-color: var(--error); }

/* ─── Icon buttons (F18): round, an icon only, their name above them on hover and focus ───────────────────────────── */

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.icon-button .icon { width: 18px; height: 18px; }
.icon-button:hover, .icon-button:focus-visible { border-color: var(--gold); color: var(--gold); background: var(--surface-2); }
/* Saving is the form's main action: blood, like the main buttons */
.icon-button.is-check, .icon-button.is-search, .icon-button.is-flag, .icon-button.is-play, .icon-button.is-plus,
.icon-button.is-user-plus { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.icon-button.is-check:hover, .icon-button.is-check:focus-visible, .icon-button.is-search:hover, .icon-button.is-search:focus-visible,
.icon-button.is-flag:hover, .icon-button.is-flag:focus-visible,
.icon-button.is-play:hover, .icon-button.is-play:focus-visible,
.icon-button.is-plus:hover, .icon-button.is-plus:focus-visible,
.icon-button.is-user-plus:hover, .icon-button.is-user-plus:focus-visible { border-color: var(--accent-hover); background: var(--accent-hover); color: var(--accent-text); }
.icon-button.is-trash:hover, .icon-button.is-trash:focus-visible { border-color: var(--error); color: var(--error); }
.icon-button::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 20;
  padding: 4px 10px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--gold);
  font: 700 12px/1.2 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.icon-button:hover::after, .icon-button:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
/* With tooltips.js (F46) every [data-tip] shows the page's one tooltip instead, placed where it fits in the window:
   the ::after rules stay for a page without it */
.has-tooltips [data-tip]::after { content: none; }
.tooltip {
  position: fixed;
  inset: auto;
  z-index: 1000;
  max-width: calc(100vw - 16px);
  margin: 0;
  padding: 4px 10px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--gold);
  font: 700 12px/1.2 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: visible;
  pointer-events: none;
}
.tooltip[hidden] { display: none; }
/* An info icon's note: a paragraph, as wide as it needs up to 300px */
.tooltip.is-note {
  width: max-content;
  max-width: min(300px, calc(100vw - 16px));
  padding: 8px 12px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  font: 400 14px/1.45 var(--font-text);
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
}
/* A label longer than a phone's width wraps */
@media (max-width: 480px) { .tooltip:not(.is-note) { white-space: normal; text-align: center; } }
.icon-check { --icon: url('/img/icons/check.svg'); }
.icon-close { --icon: url('/img/icons/close.svg'); }
.icon-edit { --icon: url('/img/icons/edit.svg'); }
.icon-trash { --icon: url('/img/icons/trash.svg'); }
.icon-key { --icon: url('/img/icons/key.svg'); }
.icon-menu { --icon: url('/img/icons/menu.svg'); }
.icon-search { --icon: url('/img/icons/search.svg'); }
.icon-filter-off { --icon: url('/img/icons/filter-off.svg'); }
.icon-locate { --icon: url('/img/icons/locate.svg'); }
.icon-eye { --icon: url('/img/icons/eye.svg'); }
.icon-eye-off { --icon: url('/img/icons/eye-off.svg'); }
.icon-external { --icon: url('/img/icons/external.svg'); }
.icon-flag { --icon: url('/img/icons/flag.svg'); }
.icon-play { --icon: url('/img/icons/play.svg'); }
.icon-printer { --icon: url('/img/icons/printer.svg'); }
.icon-score { --icon: url('/img/icons/score.svg'); }
.icon-plus { --icon: url('/img/icons/plus.svg'); }
.icon-download { --icon: url('/img/icons/download.svg'); }
.icon-upload { --icon: url('/img/icons/upload.svg'); }
.icon-user-plus { --icon: url('/img/icons/user-plus.svg'); }

/* ─── Status and notices ────────────────────────────────────────────────────────────────────────────────────────── */

.status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin: 16px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.status.is-error { border-color: var(--error); }
.is-error { color: var(--error); }
.is-ok { color: var(--ok); }

/* ─── Lists and cards ───────────────────────────────────────────────────────────────────────────────────────────── */

.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.item {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
}
.item p { margin: 0; }
/* A card with an image on its left: a tournament's game (F18) */
.item.has-image { flex-direction: row; align-items: center; gap: 14px; }
.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.game-image { flex: none; width: 48px; height: 64px; border-radius: 6px; box-shadow: 0 1px 3px rgb(0 0 0 / 25%); }
.item strong a { color: var(--text); text-decoration: none; font-size: 18px; }
.item strong a:hover { color: var(--gold); text-decoration: underline; }
.item.row { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 16px; }
/* A row's actions (rename, withdraw, enter a result…) to its right */
.item.row > button.button:first-of-type { margin-left: auto; }
.entrant, .team, .inline-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* A player's row: the name takes the free room, so its pencil sits on the right next to the row's bin */
.item.row > .entrant, .item.row > .team { flex: 1; min-width: 0; }
.item.row > .entrant > .icon-button { margin-left: auto; }
.entrant-name { font-weight: 500; }
.team { gap: 8px 16px; }
.add-form { margin: 8px 0 14px; }

.section { margin-top: 40px; }
.section > h2 { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
/* A section's title with its icons right beside it, the rule under both. The icons (36px) overflow the title's line
   (24px × 1.15) instead of making the head taller, so its title and rule line up with a plain section's next to it
   (Players and Rounds) */
.section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; }
.section-head .icon-actions { margin-left: 0; margin-block: -5px; gap: 8px; }
.print-slot { display: contents; }

/* «← My tournaments», «← All stores»…: set apart from the section above them, at the end of the page */
.back-link { margin: 36px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.back-link a { text-decoration: none; font-weight: 500; }
.back-link a:hover { text-decoration: underline; }
.description { white-space: pre-line; }

/* ─── A tournament's page for its organizer (F18) ─────────────────────────────────────────────────────────────────── */

/* What it is, under its name, in a panel of its own: game and format in gold small capitals, when, and its state as tags */
.tournament-facts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.tournament-facts p { margin: 0; }
/* With its game's image on the left (a league's page) */
.tournament-facts.has-image { flex-flow: row wrap; align-items: center; gap: 16px; }
.tournament-facts.has-image > .facts-store { flex-basis: 100%; }
.facts-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.facts-game { font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }
.facts-when { font-weight: 500; }
.facts-state { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px !important; }
.fact-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.fact-tag:not(:has(.info-tip)) { padding-right: 12px; }
.fact-tag.is-started { color: var(--ok); border-color: var(--ok); }
.fact-tag.is-published { color: var(--gold); border-color: var(--gold); }
.fact-tag.is-finished { color: var(--text); }
.fact-tag.is-ended { color: var(--text); border-color: var(--gold); }

/* A public tournament's card: the store under a thin rule, its image next to its name (top-aligned) */
.facts-store { display: flex; align-items: flex-start; gap: 14px; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.facts-store p { margin: 0; }
.facts-store-name { color: var(--text); font-size: 18px; font-weight: 700; text-decoration: none; }
.facts-store-name:hover { color: var(--gold); text-decoration: underline; }
/* Its name with its links beside it, smaller than the store page's */
.facts-store-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
/* No taller than the name: name and address together as tall as the store's image */
.facts-store-head .store-links.is-small { margin: 0; gap: 4px; }
.facts-store-head .store-links.is-small .store-link { width: 20px; height: 20px; border-width: 1px; }
.facts-store-head .store-links.is-small .icon { width: 11px; height: 11px; }
.facts-store-head + p { margin-top: 2px; color: var(--muted); }

/* An info icon whose explanation shows on hover and on keyboard focus */
.info-tip {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  cursor: help;
}
.info-tip .icon { width: 16px; height: 16px; }
.info-tip:hover, .info-tip:focus-visible { color: var(--gold); }
.info-tip::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: max-content;
  max-width: min(300px, 80vw);
  padding: 8px 12px;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow);
  color: var(--text);
  font: 400 14px/1.45 var(--font-text);
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(-8px, 4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.info-tip:hover::after, .info-tip:focus-visible::after { opacity: 1; transform: translate(-8px, 0); }
/* Near the sheet's right edge the explanation opens to the left; on phones the columns stack, so it stays as it is */
@media (min-width: 641px) {
  .info-tip.is-end::after { left: auto; right: 0; transform: translate(8px, 4px); }
  .info-tip.is-end:hover::after, .info-tip.is-end:focus-visible::after { transform: translate(8px, 0); }
}

/* Its buttons, lower than the page's main ones */
.actions.is-compact .button { min-height: 36px; padding: 0 14px; font-size: 15px; }

/* Players and rounds side by side, the rounds wider; the standings across the page above them */
.tournament-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 40px 32px;
  align-items: start;
  margin-top: 40px;
}
.tournament-columns > .section { margin-top: 0; }

/* ─── Leagues (F52) ─────────────────────────────────────────────────────────────────────────────────────────────── */

/* A league tournament before its first round: the league's players, each with its button to add or remove it on the
   right; those not in the tournament, dimmed */
.league-pool .item.is-out { background: transparent; }
.league-pool .item.is-out .entrant-name { color: var(--muted); font-weight: 400; }
.league-points .score-input { width: 6em; }
/* Its save button, apart from the table above it */
.league-points-save { margin-top: 16px; }
/* A store's page: its tournaments or its leagues */
.store-tabs {
  display: flex; flex-wrap: wrap; gap: 8px 28px;
  margin: 40px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
/* Each tab looks like a section's title (h2), not a button: muted, the one shown in gold */
.store-tab {
  padding: 0; border: 0; background: none; cursor: pointer;
  font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1.15; letter-spacing: 0.03em;
  color: var(--muted);
}
.store-tab:hover { color: var(--text); }
.store-tab[aria-selected="true"] { color: var(--gold); }
.store-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 4px; }
.store-tabs ~ .section { margin-top: 0; }

/* ─── Tabs (rounds) and pager ───────────────────────────────────────────────────────────────────────────────────── */

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
/* Under a list that grows as it is scrolled (F28) */
.list-foot { display: flex; justify-content: center; margin-top: 20px; }
.list-foot .status { flex: 1; }

/* ─── Rounds: pairings, pods and scores ─────────────────────────────────────────────────────────────────────────── */

.pairing { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gold); }
/* A score or points box: small, the number centred, no browser arrows (typing or the keyboard's arrows still work) */
.score-input {
  width: 3.2em;
  min-height: 34px;
  height: 34px;
  padding: 2px 6px;
  font-size: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}
.score-input::-webkit-outer-spin-button, .score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* The result form: the draws and the save/cancel icons on one line, the icons to the right */
.result-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; width: 100%; }
.result-row label { display: inline-flex; align-items: center; gap: 8px; }
.icon-actions { display: inline-flex; gap: 6px; margin-left: auto; }
/* A tournament's actions for its organizer, under its card: larger round icons, on the left */
.icon-actions.tournament-actions { display: flex; gap: 10px; margin: 0 0 8px; }
.tournament-actions .icon-button { width: 42px; height: 42px; }
.icon-button:disabled { opacity: 0.5; cursor: default; }
/* A table's result icon, at the end of its row */
.item.row > .icon-button:last-child { margin-left: auto; }
.pods { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.seats { list-style: none; padding: 0; margin: 6px 0 0; }
.seats li, .seat-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); }
.seats li:first-child { border-top: 0; }
/* EDH and cEDH (F54): each player's place in a drop-down, the points it gives before it; under the name when narrow */
.seat-row.has-place { flex-wrap: wrap; }
.pod-scoring-help { margin: 0; font-size: 14px; }
.place-pick { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.place-select { min-height: 38px; padding-block: 6px; font-size: 15px; }
.place-points { min-width: 3.5em; text-align: right; }
.seat-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.seat-no { flex: none; display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--gold); font-size: 0.85em; font-weight: 700; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }

/* ─── Standings ─────────────────────────────────────────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.standings { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.standings th, .standings td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.standings th { font-size: 14px; font-weight: 700; color: var(--muted); background: var(--surface-2); letter-spacing: 0.02em; }
.standings th[title] { text-decoration: underline dotted; text-underline-offset: 0.2em; cursor: help; }
.standings tbody tr:last-child td { border-bottom: 0; }
.standings tbody tr:hover td { background: var(--surface-2); }
.standings .position { font-family: var(--font-display); font-weight: 700; color: var(--muted); }
.standings .is-podium { color: var(--gold); }

/* ─── Landing ───────────────────────────────────────────────────────────────────────────────────────────────────── */

.hero { text-align: center; padding: 48px 0 16px; }
.hero::before {
  content: '';
  display: block;
  width: 72px;
  height: 96px;
  margin: 0 auto 16px;
  background: url('/img/logo.svg') center / contain no-repeat;
  filter: drop-shadow(0 4px 10px rgb(0 0 0 / 30%));
}
.hero h1 { margin: 0 0 10px; font-size: clamp(36px, 6vw, 60px); letter-spacing: 0.06em; }
.hero p { color: var(--muted); font-size: 19px; }
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin-top: 28px; }
.choice {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 260px;
  aspect-ratio: 1;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  text-align: center;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.choice:hover, .choice:focus-visible { border-color: var(--gold); color: inherit; transform: translateY(-3px); }
.choice-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: 0.04em; color: var(--gold); }
.choice-text { font-size: 16px; color: var(--muted); }
.home-organizers { text-align: center; margin-top: 32px; color: var(--muted); }

/* ─── Directories: filters and days ─────────────────────────────────────────────────────────────────────────────── */

/* One row: game, format, province, municipality, from, to. Narrower, three or two a row, so «from» and «to» always
   stay side by side */
.filters {
  display: grid;
  /* The four drop-downs wider than the two dates, which need less room */
  grid-template-columns: repeat(4, minmax(0, 1.3fr)) repeat(2, minmax(0, 1fr));
  gap: 12px 10px;
  align-items: end;
  margin: 20px 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.filters .actions { grid-column: 1 / -1; }
/* Tournaments': two rounded panels side by side, the drop-downs two by two with the buttons under them, and the month
   on the right, as tall */
.filters.has-calendar { grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: stretch; padding: 0; background: none; border: 0; }
.filters-fields, .filters.has-calendar .date-range {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.filters-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; align-content: space-between; }
/* Search and clear, round icons at the end of the panel */
.filters-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; }
.filters-actions .icon-button { width: 42px; height: 42px; }
/* In the free half of the last row, level with its drop-down */
.filters-actions.is-inline { grid-column: auto; align-self: end; min-height: 44px; align-items: center; }
/* Why «Near me» found nothing: under the buttons in Tournaments, under the bar in Stores */
.icon-button.is-locate:disabled { opacity: 0.5; cursor: progress; }
.near-me-status { margin: 0; font-size: 14px; }
.filters-fields > .near-me-status { grid-column: 1 / -1; text-align: right; }
.directory-bar .near-me-status { flex-basis: 100%; text-align: right; }
.place-filter .icon-button { flex: none; width: 26px; height: 26px; margin-right: 5px; }
.place-filter .icon-button .icon { width: 14px; height: 14px; }
/* Its name opens towards the inside: centred, it would widen the page on phones even while invisible */
.place-filter .icon-button::after { left: auto; right: 0; transform: translate(0, 4px); }
.place-filter .icon-button:hover::after, .place-filter .icon-button:focus-visible::after { transform: translate(0, 0); }
/* A little tighter inside the filters, so six fit in a row; what still does not fit ends in «…» */
.filters input, .filters select { font-size: 15px; padding-left: 10px; text-overflow: ellipsis; }
.filters select, .filters .combobox input { padding-right: 30px; }
.filters select { background-position: right 10px center; }
.filters .combobox-toggle { width: 30px; }
/* Open, the list may be wider than its narrow column, so names fit on one line */
.filters .combobox-list { right: auto; min-width: 100%; width: max-content; max-width: min(320px, 90vw); }
.filters .combobox-list [role="option"] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The stores' filters (F18): a slim bar, the count on the left and the place on the right as one field with a pin */
.directory-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin: 18px 0 32px; }
.directory-count { margin: 0; }
.place-filter {
  display: flex;
  align-items: center;
  flex: 0 1 380px;
  min-width: 0;
  padding-left: 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  transition: border-color 0.15s ease;
}
.place-filter:hover { border-color: var(--muted); }
.place-filter:focus-within { border-color: var(--gold); }
.place-filter > .icon { flex: none; width: 15px; height: 15px; color: var(--gold); }
.place-filter .field { flex: 1 1 0; min-width: 0; gap: 0; }
.place-filter .field + .field { border-left: 1px solid var(--line); }
/* The labels for screen readers only: the placeholders say what each is */
.place-filter .field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.place-filter .combobox input { min-height: 34px; padding: 4px 28px 4px 9px; border: 0; background: transparent; font-size: 14px; text-overflow: ellipsis; }
.place-filter .combobox-toggle { width: 26px; }
.place-filter .combobox-toggle::before { width: 10px; height: 7px; }
.place-filter .combobox input:focus-visible { outline: 0; }
.place-filter .combobox-list { right: auto; min-width: 100%; width: max-content; max-width: min(320px, 90vw); }
.place-filter-clear {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 5px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}
.place-filter-clear .icon { width: 12px; height: 12px; }
.place-filter-clear:hover, .place-filter-clear:focus-visible { color: var(--gold); }

/* A day of tournaments: its name, then a thin gold rule to the right */
.day-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15px;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin: 28px 0 10px;
}
.day-heading::first-letter { text-transform: uppercase; }
.day-heading::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ─── Grids: stores four a row, my tournaments two ───────────────────────────────────────────────────────────────── */

.list.is-grid { display: grid; gap: 14px; }
.list.is-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.list.is-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.list.is-grid > .item { transition: border-color 0.15s ease; }
.list.is-grid > .item:hover { border-color: var(--line-strong); }

/* A store as a card: its image across the top, then its name and place */
.is-cols-4 .store-item { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px; }
.is-cols-4 .store-item .store-image { width: 100%; height: 120px; padding: 10px; }
.is-cols-4 .store-item .store-image.is-placeholder { font-size: 30px; }

/* ─── Calendar (F19): a store's week, Monday to Sunday, morning and afternoon; the week's tournaments under it ───── */

.week {
  margin: 8px 0 24px;
  padding: 18px 20px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.week-title { margin: 0; font-size: 22px; }
.week-nav { display: flex; align-items: center; gap: 2px; }
.week-nav a {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  text-decoration: none;
}
.week-nav a:hover { background: var(--surface-2); color: var(--gold); }
.week-today span { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }

/* A column of labels and seven days; each day's head, morning and afternoon line up across the week (subgrid) */
.week-grid {
  display: grid;
  grid-template-columns: 76px repeat(7, minmax(0, 1fr));
  grid-template-rows: auto minmax(92px, auto) minmax(92px, auto);
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.week-labels, .week-day { display: grid; grid-row: 1 / span 3; grid-template-rows: subgrid; min-width: 0; }
.week-day { border-left: 1px solid var(--line); }
.week-corner, .week-day-head { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.week-label {
  display: grid;
  place-items: center;
  padding: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.week-label:nth-child(2), .week-cell.is-morning { border-bottom: 1px solid var(--line); }

.week-day-head { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; }
.week-day-name { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.week-day-number { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.1; }
.week-day.is-today .week-day-head { box-shadow: inset 0 -2px 0 var(--today); }
.week-day.is-today .week-day-name, .week-day.is-today .week-day-number { color: var(--today); }

.week-cell { display: flex; flex-direction: column; gap: 6px; padding: 6px; min-width: 0; }

/* Tournaments starting at the same time: the time once, in gold, then a tile per tournament (name on up to two lines) */
.week-slot { display: flex; flex-direction: column; gap: 4px; }
.week-slot + .week-slot { margin-top: 4px; }
.week-slot-time { font-size: 13px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; padding-left: 2px; }
.week-event {
  display: block;
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.week-event:hover { border-color: var(--gold); }
.week-event-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.week-event.is-in_progress { border-color: var(--ok); }
.week-event.is-finished .week-event-name { color: var(--muted); }

/* The card a tournament in the calendar points to */
.week-list .item { transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.week-list .item.is-highlighted { border-color: var(--gold); background: var(--surface-2); box-shadow: 0 0 0 2px var(--gold), var(--shadow); }
.week-list .day:first-child .day-heading { margin-top: 0; }

/* ─── Drop-down with a search box (F14) ─────────────────────────────────────────────────────────────────────────── */

.combobox { position: relative; display: flex; flex-direction: column; }
.combobox input { padding-right: 38px; }
.combobox-toggle { position: absolute; top: 0; right: 0; bottom: 0; width: 38px; border: 0; background: none;
  font-size: 0; cursor: pointer; border-radius: 0 var(--radius) var(--radius) 0;
  /* Flex, not grid: the hidden ▾ would be a second row and push the chevron up */
  display: flex; align-items: center; justify-content: center; }
/* The same chevron as the native drop-downs, painted with the theme's colour (the ▾ character is hidden) */
.combobox-toggle::before {
  content: '';
  width: 12px;
  height: 8px;
  background: var(--muted);
  -webkit-mask: var(--chevron) center / contain no-repeat;
  mask: var(--chevron) center / contain no-repeat;
}
.combobox-toggle:hover::before { background: var(--gold); }
.combobox-toggle:disabled { cursor: default; opacity: 0.5; }
.combobox-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 10; max-height: 280px; overflow-y: auto;
  margin: 4px 0 0; padding: 6px 0; list-style: none; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); }
.combobox-list [role="option"] { padding: 8px 12px; cursor: pointer; }
.combobox-list [role="option"]:hover, .combobox-list [aria-selected="true"] { background: var(--surface-2); }
.combobox-list .is-chosen { font-weight: 700; color: var(--gold); }
.combobox-empty { padding: 8px 12px; color: var(--muted); }

/* ─── Date picker (F18): the site's own month instead of the browser's calendar ────────────────────────────────── */

.date-picker { position: relative; display: flex; flex-direction: column; }
/* The field, like an input: the date chosen and a calendar icon */
.date-picker-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.date-picker-field:hover { border-color: var(--muted); }
.date-picker-field:focus-visible, .date-picker-field[aria-expanded="true"] { border-color: var(--gold); outline: 2px solid var(--gold); outline-offset: 0; }
.date-picker-field:disabled { opacity: 0.6; cursor: not-allowed; }
.date-picker-field.is-empty .date-picker-text { color: var(--muted); }
.date-picker-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date-picker-field .icon { flex: none; width: 18px; height: 18px; color: var(--muted); }
.date-picker-field:hover .icon, .date-picker-field[aria-expanded="true"] .icon { color: var(--gold); }

/* The panel under it: the month as the store's small month, a gold rule on top */
.date-picker-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 15;
  width: 296px;
  max-width: 90vw;
  padding: 12px 14px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.date-picker-title { margin: 0; font-size: 15px; letter-spacing: 0.03em; }
.date-picker-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; margin-top: 8px; }
.date-picker-day {
  display: grid;
  place-items: center;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.date-picker-day.is-blank { cursor: default; }
/* A day that can't be picked (F45): before today, or beyond the store's plan */
.date-picker-day.is-disabled, button.date-picker-day.is-disabled:hover { background: transparent; color: var(--muted); opacity: 0.4; cursor: not-allowed; }
button.date-picker-day:hover { background: var(--surface-2); color: var(--gold); }
.date-picker-day.is-today { color: var(--today); font-weight: 700; border-color: var(--line-strong); }
.date-picker-day.is-chosen, .date-picker-day.is-chosen:hover { background: var(--gold); border-color: var(--gold); color: var(--bg); font-weight: 700; }
.date-picker-day:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.date-picker-foot { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.date-picker-foot:empty { display: none; }
.date-picker-time { display: flex; align-items: center; gap: 8px; }
.date-picker-time > label { margin-right: auto; font-size: 14px; font-weight: 700; color: var(--muted); }
.date-picker-time .combobox { width: 78px; }
.date-picker-time .combobox input { min-height: 38px; padding: 6px 30px 6px 10px; text-align: center; font-variant-numeric: tabular-nums; }
.date-picker-time .combobox-toggle { width: 28px; }
.date-picker-time .combobox-list { max-height: 200px; }
.date-picker-actions { display: flex; justify-content: flex-end; gap: 8px; }
.date-picker-actions:empty { display: none; }
.date-picker-actions .button { min-height: 34px; padding: 0 12px; font-size: 14px; }
/* From and to in a small month (the tournaments' filters): the ends in gold, the days between shaded */
.date-range { display: flex; flex-direction: column; }
.date-range .mini-nav { width: 28px; height: 28px; font-size: 20px; }
.date-range .date-picker-title { font-size: 14px; }
.date-range .date-picker-grid { gap: 2px 0; margin-top: 4px; }
.date-range .date-picker-day { height: 27px; font-size: 13px; }
.date-picker-day.is-between { border-radius: 0; background: color-mix(in srgb, var(--gold) 16%, transparent); }
.date-picker-day.is-start:not(.is-end) { border-radius: 8px 0 0 8px; }
.date-picker-day.is-end:not(.is-start) { border-radius: 0 8px 8px 0; }
.date-range-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; margin-top: auto; padding-top: 6px; }
.date-range-summary { margin: 0; font-size: 13px; color: var(--muted); }
.date-range-foot .button { min-height: 28px; padding: 0 10px; font-size: 13px; }

/* ─── A Companion code (the API's D28) ──────────────────────────────────────────────────────────────────────────── */

.code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.companion { flex-wrap: wrap; justify-content: space-between; }

/* ─── A store: contact, image and header ────────────────────────────────────────────────────────────────────────── */

/* How to find a store: medallions with a gold icon (public/img/icons) and one ring (F44); on hover and
   focus, one word above them */
.store-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.store-link {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--gold);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
/* Smaller, inside a card */
.store-links.is-small { gap: 8px; margin: 10px 0 4px; }
.store-links.is-small .store-link { width: 34px; height: 34px; }
.store-links.is-small .icon { width: 17px; height: 17px; }
.store-link:hover, .store-link:focus-visible { border-color: var(--gold); background: var(--surface-2); color: var(--gold); }
.store-link::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 5;
  padding: 4px 10px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--gold);
  font: 700 12px/1.2 var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.store-link:hover::after, .store-link:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }

.icon {
  width: 22px;
  height: 22px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.icon-map { --icon: url('/img/icons/map.svg'); }
.icon-web { --icon: url('/img/icons/web.svg'); }
.icon-instagram { --icon: url('/img/icons/instagram.svg'); }
.icon-facebook { --icon: url('/img/icons/facebook.svg'); }
.icon-x { --icon: url('/img/icons/x.svg'); }
.icon-tiktok { --icon: url('/img/icons/tiktok.svg'); }
.icon-youtube { --icon: url('/img/icons/youtube.svg'); }
.icon-twitch { --icon: url('/img/icons/twitch.svg'); }
.icon-discord { --icon: url('/img/icons/discord.svg'); }
.icon-telegram { --icon: url('/img/icons/telegram.svg'); }
.icon-whatsapp { --icon: url('/img/icons/whatsapp.svg'); }
/* TCG markets (F42): after the markets' own icons: MKM two arrows, TCGPlayer three cards, CardHoarder a gem */
.icon-mkm { --icon: url('/img/icons/mkm.svg'); }
.icon-tcgplayer { --icon: url('/img/icons/tcgplayer.svg'); }
.icon-cardhoarder { --icon: url('/img/icons/cardhoarder.svg'); }

/* A small month next to a store's details (F19): days with tournaments link to their week */
.mini-month {
  flex: 0 0 264px;
  margin-left: auto;
  padding: 10px 12px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.mini-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.mini-title { margin: 0; font-size: 14px; letter-spacing: 0.03em; text-align: center; white-space: nowrap; }
.mini-nav {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.mini-nav:hover { background: var(--surface-2); color: var(--gold); }
.mini-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin-top: 6px; }
.mini-weekday { padding: 2px 0; font-size: 11px; font-weight: 700; text-align: center; color: var(--muted); }
.mini-day {
  position: relative;
  display: grid;
  place-items: center;
  height: 30px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.mini-day.is-shown { background: var(--surface-2); }
.mini-day.has-events { color: var(--text); font-weight: 700; }
.mini-day.has-events::after { content: ''; position: absolute; bottom: 3px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--gold); }
a.mini-day:hover { background: var(--surface-2); color: var(--gold); }
.mini-day.is-today { color: var(--today); font-weight: 700; }
.mini-note { margin: 6px 0 0; font-size: 13px; }

/* The whole image shows in its box, and the rest of the box takes the colour of the image's own edge (store-image.js),
   so a wide logo is not cut and there are no white bands. White when that edge is transparent. Without an image, its
   initials on a colour of its own (--store-hue, from its name). */
.store-image {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 56px;
  padding: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  object-fit: contain;
  object-position: center;
}
.store-image.is-large { width: 150px; height: 100px; padding: 8px; border-radius: var(--radius-lg); }
.store-image.is-tiny { width: 40px; height: 40px; padding: 3px; border-radius: 50%; }
.store-image.is-tiny.is-placeholder { font-size: 14px; letter-spacing: 0.02em; }
.store-image.is-placeholder {
  background: hsl(var(--store-hue, 0) 38% 34%);
  border-color: transparent;
  color: #F5EBD8;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.06em;
}
.store-image.is-large.is-placeholder { font-size: 34px; }

.store-item { display: flex; flex-direction: row; align-items: center; gap: 14px; }
.store-item p { margin: 0; }
.store-image-link { display: block; flex: none; border-radius: var(--radius); transition: box-shadow 0.15s ease; }
.store-image-link:hover { box-shadow: 0 0 0 2px var(--gold); }
.store-image-link .store-image { display: flex; }
.store-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px 22px; margin: 28px 0 8px; }
.store-identity { flex: 1 1 492px; display: flex; gap: 14px 22px; min-width: 0; }
/* The image in a box of its own, positioned, so it takes the height of the details beside it and doesn't add to it */
.store-image-box { position: relative; flex: none; width: 150px; min-height: 100px; }
.store-image-box .store-image { position: absolute; inset: 0; width: 100%; height: 100%; }
.store-info { flex: 1 1 320px; min-width: 0; }
.store-info .store-link { width: 38px; height: 38px; }
.store-info .store-link .icon { width: 19px; height: 19px; }
/* The store's tournaments right under its details: the header already sets them apart */
.store-head + .section { margin-top: 12px; }
.store-head h1 { margin: 0 0 6px; }
.store-head p { margin: 0; }
/* Google Maps embedded (F25): under the address when creating the account */
.store-map { display: block; width: 100%; height: 220px; margin-top: 14px; border: 1px solid var(--line-strong); border-radius: 6px; }
.address-map .store-map { margin-top: 0; }
.map-request { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; margin-top: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; }
.map-request p { flex: 1 1 260px; margin: 0; font-size: 15px; }
.address-map .map-request { margin-top: 0; }

/* The legal pages (F26) */
.legal { max-width: 80ch; }
.legal section { margin-top: 28px; }
.legal ul { padding-left: 20px; }
.legal-table { overflow-x: auto; margin: 12px 0; }
.legal-table table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 15px; }
.legal-table th, .legal-table td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.legal-table th { background: var(--surface-2); }

/* ─── Contact form and FAQ (F47) ────────────────────────────────────────────────────────────────────────────────── */

/* What the message is about: three tiles, the chosen one outlined in gold, as the tournament's game (.game-choice) */
/* As many columns as tiles: the issue report's only shows logged in (F47) */
.kind-picker { display: grid; grid-template-columns: repeat(var(--kinds, 3), minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.kind-picker legend { grid-column: 1 / -1; margin-bottom: 8px; padding: 0; font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.kind-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  line-height: 1.3;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
/* The radio stays for the keyboard and screen readers; the tile shows the choice */
.kind-choice input { position: absolute; opacity: 0; pointer-events: none; }
.kind-choice:hover { border-color: var(--line-strong); }
.kind-choice:has(input:checked) { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.kind-choice:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.kind-choice-title { font-weight: 700; }
.kind-choice:has(input:checked) .kind-choice-title { color: var(--gold); }
.kind-choice-text { font-size: 14px; color: var(--muted); }
.contact-fields { display: flex; flex-direction: column; gap: 16px; }
.contact-note { margin: 0; padding: 10px 14px; border-left: 3px solid var(--gold); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.contact-captcha { margin: 0; font-size: 14px; }
.contact-captcha.is-error { color: var(--error); }
/* The field only bots fill in: out of sight, not display:none, which some bots skip */
.contact-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.faq { max-width: 80ch; }
.faq section { margin-top: 28px; scroll-margin-top: 16px; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary { padding: 12px 0; font-weight: 700; cursor: pointer; }
.faq-item summary:hover { color: var(--gold); }
.faq-item[open] summary { color: var(--gold); }
.faq-item p { margin: 0 0 12px; }

@media (max-width: 640px) {
  .kind-picker { grid-template-columns: minmax(0, 1fr); }
}
.image-field { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.image-field > div { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.image-field input[type="file"] { max-width: 100%; }

/* ─── Sheets: My account, a tournament's form (F18) ──────────────────────────────────────────────────────────────────────────────────────────── */

/* A card on the left, kept in sight while the panels on the right scroll: the store, or the tournament's game */
.sheet { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 24px 28px; align-items: start; }
.sheet-card, .sheet-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.sheet-card { position: sticky; top: 20px; border-top: 3px solid var(--gold); }
.sheet-card .image-field { flex-direction: column; align-items: stretch; }
.sheet-card .image-field > div { min-width: 0; }
.sheet-card .image-field > .image-preview { display: block; }
.sheet-card .image-preview .store-image { display: flex; width: 100%; height: 150px; }
/* The colour around the image (F24): circles, the chosen one ringed in gold; the last one, any colour, a colour wheel
   until it holds the one chosen */
.swatch-field { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 18%), 0 0 0 1px var(--line-strong);
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.swatch.is-custom { background: conic-gradient(#E5484D, #F5C83B, #46A758, #3E9BD4, #8E4EC6, #E5484D); }
.swatch.is-custom.is-chosen { background: var(--swatch); }
.swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch:hover { transform: scale(1.1); }
.swatch:has(input:checked), .swatch.is-chosen { box-shadow: inset 0 0 0 1px rgb(0 0 0 / 18%), 0 0 0 2px var(--surface), 0 0 0 4px var(--gold); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 4px; }
/* Initials on a light chosen colour: dark */
.store-image.is-placeholder.is-light { color: #1E1824; border-color: var(--line); }
/* Choose and remove, round icons, the file's name beside them */
.image-field .image-actions { flex-direction: row; align-items: center; gap: 8px; }
.image-file-name { font-size: 13px; overflow-wrap: anywhere; }
.sheet-card .field > .muted { font-size: 13px; margin: 0; }
.me-facts { margin: 0; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.me-fact dt { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.me-fact dd { margin: 2px 0 0; overflow-wrap: anywhere; }
/* A field's label with an info icon beside it */
.label-row { display: flex; align-items: center; gap: 4px; }
.label-row .info-tip { color: var(--muted); }
/* Its note as wide as the field below it, wherever the field is: as wide as its text, it would stick out of a narrow page */
.label-row { position: relative; }
.label-row .info-tip { position: static; }
.label-row .info-tip::after { left: 0; right: 0; width: auto; max-width: none; transform: translate(0, 4px); }
.label-row .info-tip:hover::after, .label-row .info-tip:focus-visible::after { transform: translate(0, 0); }
/* Next to other fields: as tall as a plain label, so the controls under them line up */
.sheet-pair .label-row .info-tip { margin-block: -3px; }
/* My account scrolls as a whole: its card doesn't stay in sight. Both columns end level, the card's date at its foot and
   the last panel taking the rest; saving goes under both */
.sheet.me { align-items: stretch; }
.me .sheet-card { position: static; }
.me .sheet-main > .sheet-panel:last-child { flex: 1; }
.me > .sheet-save { grid-column: 1 / -1; }
.me .me-fixed { margin-top: auto; }
/* Changing the password and deleting the account: round icons before saving, each opening its modal (F37). Their names
   open towards the right, as they are at the left edge on phones */
.me-actions { display: flex; gap: 8px; }
.me-actions .icon-button { width: 42px; height: 42px; }
.me-actions .icon-button::after { left: 0; transform: translate(0, 4px); }
.me-actions .icon-button:hover::after, .me-actions .icon-button:focus-visible::after { transform: translate(0, 0); }
.me-fixed { display: flex; align-items: center; gap: 4px; margin: -6px 0 0 -4px; font-size: 13px; }

.sheet-main { display: flex; flex-direction: column; gap: 20px; }
/* Creating the account: the store's card and the right column as tall as each other, the last panel taking the rest */
.sheet.signup { align-items: stretch; }
.signup .sheet-card { position: static; }
.signup .sheet-main > .sheet-panel:last-child { flex: 1; }
/* Creating it at the last panel's foot, on the right; what went wrong to its left */
.signup .sheet-panel > .sheet-save { justify-content: flex-end; margin-top: auto; padding-top: 4px; }
.signup .sheet-save .icon-button { width: 46px; height: 46px; }
.signup .sheet-save .icon-button .icon { width: 21px; height: 21px; }
/* At the panel's right edge: its name opens towards the inside, not past the screen */
.signup .sheet-save .icon-button::after { left: auto; right: 0; transform: translate(0, 4px); }
.signup .sheet-save .icon-button:hover::after, .signup .sheet-save .icon-button:focus-visible::after { transform: translate(0, 0); }
/* A line under a panel's fields (the password's rules) */
.sheet-note { margin: -6px 0 0; font-size: 14px; }
/* A page's intro under its title, above the sheet */
.page-intro { margin: -4px 0 22px; max-width: 70ch; }
.sheet-panel-title { margin: 0; font-size: 20px; }
.sheet-panel-help { margin: -10px 0 0; font-size: 14px; }
/* Province and municipality, address and postal code: side by side */
.sheet-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sheet-pair.is-address { grid-template-columns: minmax(0, 1fr) 9em; }
/* Social networks and TCG markets (F43): a row of medallions, the chosen one's input under them */
.link-picker { display: flex; flex-direction: column; gap: 14px; background: var(--surface-2); }
.link-tabs { display: flex; flex-wrap: wrap; gap: 10px; }
.link-tab { padding: 0; font: inherit; cursor: pointer; color: var(--muted); }
.link-tab .icon { width: 20px; height: 20px; }
/* With a link: gold, as on the store's page */
.link-tab.is-filled { color: var(--gold); }
/* The chosen one: its ring in gold */
.link-tab[aria-selected="true"] { border-color: var(--gold); background: var(--surface); }
/* Start, rounds and best of in one row, the start wider */
.sheet-pair.is-three { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); }
.sheet-pair > .field { min-width: 0; }

/* A tournament's game, chosen by its emblem: two a row, the chosen one outlined in gold */
.game-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.game-picker legend { grid-column: 1 / -1; margin-bottom: 8px; padding: 0; font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.game-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.game-choice .game-image { width: 30px; height: 40px; }
/* The radio stays for the keyboard and screen readers; the tile shows the choice */
.game-choice input { position: absolute; opacity: 0; pointer-events: none; }
.game-choice:hover { border-color: var(--line-strong); }
.game-choice:has(input:checked) { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold); }
.game-choice:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.game-picker:disabled .game-choice { cursor: default; grid-column: 1 / -1; }
/* Saving, at the end of the panels: the button and what happened */
.sheet-save { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
/* The login's «Forgot your password?» (F48): beside the button, pushed to the right edge */
.login-forgot { margin-left: auto; }
.sheet-message p { margin: 0; }

/* ─── Players or teams from a CSV file (F17) ────────────────────────────────────────────────────────────────────── */

.import { margin: 14px 0; padding: 12px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }
.import summary { cursor: pointer; color: var(--gold); font-weight: 700; }
.import[open] summary { margin-bottom: 12px; }
.import-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.import-file-name { font-size: 14px; overflow-wrap: anywhere; }
.icon-actions.import-actions { margin-left: 0; gap: 8px; }
.import-result { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.import-result p { margin: 0 0 6px; }
.import-result.is-error { border-color: var(--error); }
.import-result ul { margin: 0; padding-left: 20px; }

/* ─── Asking before an action that cannot be undone (F18): instead of the browser's confirm() ───────────────────── */

.confirm-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--surface), 0 0 0 2px var(--gold), var(--shadow);
}
.confirm-dialog::backdrop { background: rgb(8 6 12 / 62%); backdrop-filter: blur(3px); }
.confirm-dialog[open] { animation: confirm-in 0.18s ease-out; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.confirm-box { padding: 26px 26px 22px; text-align: center; }
.confirm-sigil {
  display: block;
  width: 33px;
  height: 44px;
  margin: 0 auto 12px;
  background: url('/img/logo.svg') center / contain no-repeat;
}
.confirm-title { margin: 0 0 10px; font-size: 21px; line-height: 1.25; }
.confirm-detail { margin: 0; color: var(--muted); }
.confirm-actions { justify-content: center; margin-top: 22px; }
/* A form in a modal (F37): left-aligned, × at its corner, the title in red for what can't be undone */
.form-dialog { width: min(460px, calc(100vw - 32px)); }
.form-dialog .confirm-box { position: relative; text-align: left; }
.form-dialog .confirm-title { padding-right: 34px; }
.form-dialog.is-danger .confirm-title { color: var(--error); }
.form-dialog-close { position: absolute; top: 18px; right: 18px; width: 32px; height: 32px; }
.form-dialog-close .icon { width: 15px; height: 15px; }
.form-dialog-close::after { display: none; }
.form-dialog-form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.form-dialog-form .sheet-note { margin: 2px 0 0; }
.form-dialog-form .sheet-message p { margin: 0; }
.form-dialog-form .sheet-message:empty { display: none; }
.form-dialog-form .confirm-actions { justify-content: flex-end; margin-top: 4px; }

/* ─── Small screens ─────────────────────────────────────────────────────────────────────────────────────────────── */

@media (max-width: 960px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .list.is-cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .tournament-columns { grid-template-columns: minmax(0, 1fr); }
  .sheet { grid-template-columns: minmax(0, 1fr); }
  .sheet-card { position: static; }
}

@media (max-width: 760px) {
  .list.is-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* The week as a list of days: the day on the left, its morning and afternoon side by side */
  .week-grid { display: block; border: 0; border-radius: 0; overflow: visible; }
  .week-labels { display: none; }
  .week-day {
    grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto;
    gap: 0 8px;
    padding: 8px 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .week-day-head { background: none; border: 0; justify-content: center; padding: 0; }
  .week-day.is-today .week-day-head { box-shadow: none; }
  .week-cell, .week-cell.is-morning { border: 0; padding: 0; }
  .week-cell::before { content: attr(data-half); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
  .list.is-cols-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* One panel over the other: the month first, so the buttons stay last */
  .filters.has-calendar { grid-template-columns: minmax(0, 1fr); }
  .filters.has-calendar .date-range { order: -1; }
  .place-filter { flex-basis: 100%; }
  .week { padding: 14px 12px; }
  .week-title { font-size: 17px; }
  .mini-month { flex-basis: 100%; margin-left: 0; }
  .store-identity { flex-direction: column; flex-basis: 100%; }
  .store-image-box { height: 100px; }
  .store-info { flex: none; }
  .choice { width: 100%; max-width: 340px; aspect-ratio: auto; min-height: 160px; }
  .standings th, .standings td { padding: 10px; }
  .sheet-pair, .sheet-pair.is-address, .sheet-pair.is-three { grid-template-columns: minmax(0, 1fr); }
  .sheet-card, .sheet-panel { padding: 16px; }
}

@media (max-width: 420px) {
  .list.is-cols-4 { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .toggle-knob { transition: none; }
  .confirm-dialog[open] { animation: none; }
  .icon-button::after { transform: translate(-50%, 0); }
  .store-link::after { transform: translate(-50%, 0); }
  .choice:hover, .choice:focus-visible { transform: none; }
}

/* ─── Print sheets (F15): only the sheet is printed, black on white whatever the theme ──────────────────────────── */

.print-sheet { display: none; }
@media print {
  @page { margin: 15mm; }
  body.is-printing { display: block; min-height: 0; background: #fff; color: #000; }
  body.is-printing > :not(.print-sheet) { display: none !important; }
  body.is-printing .print-sheet { display: block; }
  .print-sheet { --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --muted: #444; --line: #888; --gold: #000; color: #000; font-size: 12pt; }
  .print-head { text-align: center; margin-bottom: 8mm; }
  .print-head h1 { margin: 0; font-size: 22pt; }
  .print-head p { margin: 2mm 0 0; font-size: 14pt; }
  .print-section h2 { font-size: 15pt; margin: 0 0 4mm; border: 0; padding: 0; }
  .print-section + .print-section { break-before: page; }
  .print-table { width: 100%; border-collapse: collapse; font-size: 13pt; }
  .print-table th, .print-table td { border: 1px solid #888; padding: 2mm 3mm; text-align: left; }
  .print-table th { background: #eee; }
  .print-table .is-table { width: 18mm; text-align: center; font-weight: 700; }
  .print-table .is-vs { width: 12mm; text-align: center; color: #444; }
  .print-table tr, .print-pod { break-inside: avoid; }
  .print-pods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .print-pod { border: 1px solid #888; padding: 2mm 3mm; }
  .print-pod h3 { margin: 0 0 2mm; font-size: 13pt; }
  .print-pod ul { margin: 0; padding: 0; list-style: none; font-size: 12pt; }
  .print-pod li + li { margin-top: 1mm; }
  .print-pod .seat-no { border-color: #888; color: #000; }
  .print-sheet .table-wrap { border: 0; background: none; }
  .print-sheet .standings { font-size: 12pt; }
  .print-sheet .standings th, .print-sheet .standings td { border: 1px solid #888; background: none; color: #000; }
  .print-sheet .standings th { background: #eee; text-decoration: none; }
  .print-legend { display: grid; grid-template-columns: max-content 1fr; gap: 1mm 4mm; margin-top: 6mm; font-size: 10pt; }
  .print-legend dt { font-weight: 700; }
  .print-legend dd { margin: 0; }
}
