/* 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; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
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); }

.account { display: flex; align-items: center; gap: 10px; }
/* 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;
}

/* ─── 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-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; }
.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; }

/* ─── 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 { 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 { 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); }
.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-search { --icon: url('/img/icons/search.svg'); }
.icon-filter-off { --icon: url('/img/icons/filter-off.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'); }

/* ─── 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 */
.section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; }
.section-head .icon-actions { margin-left: 0; 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; }
.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); }

/* 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; box-shadow: none; }
.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); }

/* 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; }

/* ─── 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; }

/* ─── 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; }
/* A round's or the standings' own actions (print), under their heading */
.icon-actions.round-actions { display: flex; margin: 0 0 14px; }
.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; }

/* ─── 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; }
/* 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; }
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 an inner ring, like the sigil; 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);
  box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4px var(--line);
  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; box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3px var(--line); }
.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'); }

/* 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-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px 22px; margin: 28px 0 8px; }
.store-head > .store-image { align-self: flex-start; }
.store-info { flex: 1 1 320px; min-width: 0; }
/* 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; }
.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); }
.me .sheet-card .image-field { flex-direction: column; align-items: stretch; }
.me .sheet-card .image-field > div { align-items: stretch; min-width: 0; }
.me .sheet-card .image-field > .image-preview { display: block; }
.me .sheet-card .image-preview .store-image { display: flex; width: 100%; height: 150px; }
.me .sheet-card .image-field input[type="file"] { width: 100%; font-size: 14px; }
.me .sheet-card .image-field .button { align-self: flex-start; min-height: 34px; padding: 0 12px; font-size: 14px; }
.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; }
.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; }
.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; }
.sheet-panel .socials { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; background: var(--surface-2); }
.sheet-panel .socials legend { grid-column: 1 / -1; }
/* 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; }
.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; }

/* ─── 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; }
  .header-inner { gap: 8px 14px; }
  .nav { order: 3; flex-basis: 100%; }
  .account { margin-left: auto; }
  .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, .sheet-panel .socials { 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-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; }
}
