:root {
  /* the edge of the screen under the phone's status bar / gesture bar: iOS gives env(), Android 15+ (Capacitor 8) gives --safe-area-inset-* */
  --sat: max(env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px));
  --sab: max(env(safe-area-inset-bottom, 0px), var(--safe-area-inset-bottom, 0px));
  --brand-900: #0A1E25;
  --brand-800: #0E2A33;
  --brand-700: #276E83;   /* links on the light page: #2E7C93 was 4.2:1 */
  --brand-600: #3D90A8;
  --brand-100: #DCE9ED;
  --brand-50: #F3F7F8;
  --accent: #FFD21F;
  --accent-dark: #E8BC00;
  --accent-ink: #7A5C00;   /* the accent as text on a light page or card (the yellow itself is 1.5:1 on white) */
  --on-red: #FFFFFF;
  --gold: #E8AB1F;
  --silver: #A9B2BB;
  --bronze: #C3813F;
  --green: #4E7A2B;
  --red: #D1432B;
  --amber: #7A5C00;
  --bg: #EDF1F2;
  --card: #FFFFFF;
  --border: #C9D3D6;
  --text: #0E2A33;
  --muted: #4F6A73;
  --shadow: none;
  --hdr-1: #0E2A33;
  --hdr-2: #0E2A33;
  --on-accent: #0E2A33;
  --input-bg: #FFFFFF;
  --ring: #FFFFFF;
  --flash-bg: #FFF4C2;
  --flash-border: #E8CF63;
  --btn2-hover: #D4E4E9;
  --danger-bg: #FBE3DE;
  --danger-hover: #F6D0C8;
  --ok-bg: #E4EFD9;
  --pending-bg: #E3EAEC;
  --ok-fg: #3F6A1F;
  --bad-fg: #B8341F;
  --warn-fg: #7A5C00;
  --tick: #0E2A33;
  --medal-gold: #FFD21F;
  --medal-silver: #C5CED3;
  --medal-bronze: #D9955A;
  --rail: #0E2A33;
  --rail-ink: #CFE0E4;
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  /* the same colours by their role (so a rule reads as what it means) */
  --background: var(--bg);
  --foreground: var(--text);
  --muted-foreground: var(--muted);
  --destructive: var(--red);
  --focus: var(--brand-700);
  color-scheme: light;
}

/* Dark palette: chosen by the account setting / cookie (data-theme="dark"), or by the device when "auto". Also always used on the TV screen. */
:root[data-theme="dark"] {
  --brand-800: #BFE3EE;
  --brand-700: #4FA3BC;
  --brand-600: #4FA3BC;
  --brand-100: #16323B;
  --brand-50: #0F232A;
  --accent-dark: #FFE066;
  --accent-ink: #FFD21F;
  --on-red: #0A1E25;   /* white on the light coral red is 2.7:1 */
  --green: #8DBE5C;
  --red: #FF7058;
  --amber: #FFD21F;
  --bg: #0C1B21;
  --card: #112830;
  --border: #24424C;
  --text: #E6EEF0;
  --muted: #93AEB6;
  --hdr-1: #081317;
  --hdr-2: #081317;
  --input-bg: #0E2229;
  --ring: #112830;
  --flash-bg: #3A3210;
  --flash-border: #5E5120;
  --btn2-hover: #1D3C47;
  --danger-bg: #4A2822;
  --danger-hover: #5C312A;
  --ok-bg: #22381A;
  --pending-bg: #24424C;
  --ok-fg: #8DBE5C;
  --bad-fg: #FF8F7C;
  --warn-fg: #FFD21F;
  --tick: #E6EEF0;
  --rail: #081317;
  --rail-ink: #93AEB6;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --brand-800: #BFE3EE;
    --brand-700: #4FA3BC;
    --brand-600: #4FA3BC;
    --brand-100: #16323B;
    --brand-50: #0F232A;
    --accent-dark: #FFE066;
    --accent-ink: #FFD21F;
    --on-red: #0A1E25;
    --green: #8DBE5C;
    --red: #FF7058;
    --amber: #FFD21F;
    --bg: #0C1B21;
    --card: #112830;
    --border: #24424C;
    --text: #E6EEF0;
    --muted: #93AEB6;
    --hdr-1: #081317;
    --hdr-2: #081317;
    --input-bg: #0E2229;
    --ring: #112830;
    --flash-bg: #3A3210;
    --flash-border: #5E5120;
    --btn2-hover: #1D3C47;
    --danger-bg: #4A2822;
    --danger-hover: #5C312A;
    --ok-bg: #22381A;
    --pending-bg: #24424C;
    --ok-fg: #8DBE5C;
    --bad-fg: #FF8F7C;
    --warn-fg: #FFD21F;
    --tick: #E6EEF0;
    --rail: #081317;
    --rail-ink: #93AEB6;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.0625rem;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--brand-700); }
a:hover { color: var(--text); }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }
h1, h2 { font-family: var(--font-display); letter-spacing: 0; }
h1 { font-weight: 700; }
h2 { font-size: 1.6rem; line-height: 1.1; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 24px;
  background: var(--hdr-1);
  color: white;
}
.topbar .brand {
  font-family: var(--font-display);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand-mark { display: inline-flex; align-items: center; justify-content: center; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 2px; }
.topbar nav a {
  color: rgba(255, 255, 255, 0.85);
  margin-left: 0;
  padding: 7px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.topbar nav a:hover { background: rgba(255, 255, 255, 0.12); color: white; }
.topbar nav a.active { background: rgba(255, 255, 255, 0.22); color: white; }

.container { max-width: 900px; margin: 0 auto; padding: 24px 20px; }

footer { text-align: center; color: var(--muted); font-size: var(--fs-sm); padding: 24px; }

.flash { background: var(--flash-bg); border: 1px solid var(--flash-border); padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; }

.card-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 4px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.card.card-row {
  flex-direction: row;
  gap: 14px;
  align-items: flex-start;
}
.card h2, .card h3 { margin: 0 0 4px; }
.catch-thumb { width: 90px; height: 90px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }

.actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  text-decoration: none;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: scale(0.98); }
.btn.secondary { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.btn.secondary:hover { background: var(--btn2-hover); }
.btn.danger { background: var(--danger-bg); color: var(--red); }
.btn.danger:hover { background: var(--danger-hover); }

form label { display: block; margin-bottom: 12px; font-size: 0.88rem; color: var(--muted); font-weight: 500; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.launch-marker { font-size: 22px; text-align: center; line-height: 28px; }

form input, form select {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
}
form input:focus, form select:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px var(--brand-100);
}
.rule-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; background: var(--card); padding: 18px; border-radius: 4px; border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 20px; }
.rule-form .btn { grid-column: span 2; }

.rules-box { background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 4px; padding: 14px 18px; margin: 14px 0; }
.rules-box strong { color: var(--brand-800); }
.rules-box ul { margin: 6px 0 0; padding-left: 20px; }

.muted { color: var(--muted); font-size: 0.9rem; }

.data-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 4px; overflow: hidden; box-shadow: var(--shadow); margin-bottom: 24px; }
.data-table th, .data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th { background: var(--brand-50); font-size: 0.8rem;  letter-spacing: 0.04em; color: var(--brand-800); font-weight: 600; }
.data-table tbody tr:last-child td { border-bottom: none; }
.points { font-weight: 700; color: var(--accent-dark); }

.badge { display: inline-block; padding: 4px 12px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em; margin-right: 6px; }
.badge-verified { background: var(--ok-bg); color: var(--ok-fg); }
.badge-rejected { background: var(--danger-bg); color: var(--bad-fg); }
.badge-pending { background: var(--pending-bg); color: var(--muted); }
.badge-mode { background: var(--brand-100); color: var(--brand-800); }

.result-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; margin-top: 14px; }
.catch-photo { width: 100%; border-radius: 4px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.kv { width: 100%; border-collapse: collapse; }
.kv th { text-align: left; color: var(--muted); font-size: 0.85rem; font-weight: 500; padding: 6px 10px 6px 0; vertical-align: top; width: 40%; }
.kv td { padding: 6px 0; }

.inline-form { margin-bottom: 16px; max-width: 280px; }

.review-fields { display: flex; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.review-fields label { flex: 1 1 160px; margin-bottom: 0; }

.rule-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.rule-edit summary { list-style: none; cursor: pointer; }
.rule-edit summary::-webkit-details-marker { display: none; }
.rule-edit[open] summary { margin-bottom: 8px; }
.rule-edit form { min-width: 280px; }

/* Leaderboard */
.leaderboard-list { list-style: none; padding: 0; margin: 0 0 28px; display: flex; flex-direction: column; gap: 10px; }
.lb-row {
  flex-wrap: wrap;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 4px;
  padding: 12px 16px;
}
.lb-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--brand-800);
  background: var(--brand-100);
  flex-shrink: 0;
}
.lb-rank.rank-1 { background: var(--gold); color: #4a3200; }
.lb-rank.rank-2 { background: var(--silver); color: #2e333a; }
.lb-rank.rank-3 { background: var(--bronze); color: #3c2308; }
.lb-name { font-weight: 600; color: inherit; text-decoration: none; }
a.lb-name:hover { text-decoration: underline; }
code { background: var(--brand-50); padding: 2px 7px; border-radius: 6px; font-size: 0.88em; color: var(--brand-800); }
.lb-fish { margin-left: 4px; }
.lb-points { margin-left: auto; font-weight: 700; font-size: 1.05rem; color: var(--accent-dark); white-space: nowrap; }
.lb-points small { font-weight: 500; font-size: 0.72rem; color: var(--muted); margin-left: 2px; }
.lb-empty { padding: 16px; color: var(--muted); }

.angler-card { margin-bottom: 14px; }
.angler-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }

.catch-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.catch-gallery-item { display: block; text-decoration: none; color: inherit; border-radius: 4px; overflow: hidden; border: 1px solid var(--border); background: var(--brand-50); }
.catch-gallery-item img { width: 100%; height: 100px; object-fit: cover; display: block; }
.catch-gallery-caption { display: block; padding: 6px 8px; font-size: 0.76rem; color: var(--brand-800); font-weight: 600; }

.form-field-label { display: block; margin-bottom: 6px; font-size: 0.88rem; color: var(--muted); font-weight: 500; }
.code-boxes { display: flex; gap: 8px; margin: 6px 0 4px; }
.code-box {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--brand-800);
  
}
.code-box:focus { outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 3px var(--brand-100); }

/* Account page - full-bleed hero + flat menu */
.acc-hero {
  background: linear-gradient(160deg, var(--hdr-1), var(--hdr-2));
  color: white;
  padding: 18px 20px 0;
  position: relative;
  margin-bottom: 64px;
}
.acc-hero-bar { display: flex; justify-content: space-between; align-items: center; max-width: 900px; margin: 0 auto; }
.acc-icon-btn { color: white; display: inline-flex; padding: 6px; opacity: 0.95; }
.acc-wordmark { display: inline-flex; align-items: center; gap: 8px; font-size: 1.6rem; font-weight: 300; letter-spacing: 0.02em; }
.acc-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand-700);
  border: 4px solid var(--ring);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 18px auto -60px;
  position: relative;
  box-shadow: 0 4px 14px rgba(10, 31, 61, 0.18);
}
.acc-identity { text-align: center; margin-bottom: 14px; }
.acc-name { font-size: 1.35rem; font-weight: 700; color: var(--muted); }
.acc-level { font-size: 1.15rem; color: var(--muted); }
.acc-star { color: var(--accent-ink); font-size: 1.3rem; }
.acc-team { margin-top: 4px; font-size: 0.85rem; color: var(--brand-700); font-weight: 600; letter-spacing: 0.04em;  }

.acc-menu { list-style: none; padding: 0; margin: 0 0 24px; }
.acc-menu a, .acc-menu button {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 18px 8px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  
  text-align: left;
  color: var(--brand-700);
  text-decoration: none;
  cursor: pointer;
}
.acc-menu a:hover, .acc-menu button:hover { color: var(--brand-800); }
.acc-menu svg { width: 28px; height: 28px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Tablet */
@media (max-width: 860px) {
  .container { padding: 20px 16px; }
  .result-grid { grid-template-columns: 1fr; }
  .rule-form { grid-template-columns: 1fr; }
  .rule-form .btn { grid-column: span 1; }
  .data-table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* Nothing may make the whole page wider than the screen (the page would slide sideways on a phone) */
html, body { max-width: 100%; overflow-x: clip; }
.container, .card, .data-table td { min-width: 0; overflow-wrap: anywhere; }
.data-table td .cell { min-width: 0; }
@media (max-width: 720px) { .data-table.stack td .cell { text-align: right; } }
.data-table td .cell > div + div { margin-top: 4px; }

/* Phone */
@media (max-width: 560px) {
  .topbar { padding: 12px 16px; }
  .topbar .brand { font-size: 1.1rem; }
  .topbar nav a { padding: 6px 10px; font-size: 0.82rem; }
  .container { padding: 16px 14px; }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.15rem; }
  .card.card-row { flex-direction: column; }
  .card.card-row .catch-thumb { width: 100%; height: 160px; }
  .lb-row { padding: 10px 12px; gap: 10px; }
  .lb-rank { width: 28px; height: 28px; font-size: 0.85rem; }
  .lb-fish { display: none; }
  .actions .btn, .actions .btn.secondary { flex: 1 1 auto; text-align: center; }
}

/* Logo, avatar, admin additions */
.fc-logo { display: block; }

.acc-avatar { cursor: pointer; overflow: visible; }
.acc-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.acc-avatar-badge {
  position: absolute;
  right: 2px;
  bottom: 6px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--brand-900);
  border: 3px solid var(--ring);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

form textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
}
.rule-form .span-2 { grid-column: span 2; }
.rule-form + .card-list, .card .rule-form { margin-top: 12px; }

.admin-tournament-picker { max-width: 320px; margin-bottom: 16px; }

.top3 { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 10px; }
.top3 li { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 4px; padding: 10px 14px; }
.top3-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.catch-thumb-sm { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.badge-verified, .badge-pending, .badge-rejected { margin-right: 0; }

@media (max-width: 860px) {
  .rule-form .span-2 { grid-column: span 1; }
}

.editor-map { height: 560px; border-radius: 4px; margin: 10px 0 14px; border: 1px solid var(--border); }
.map-search { display: flex; gap: 8px; margin: 10px 0 0; max-width: 520px; }
.map-search input { margin-top: 0; }
.map-search input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 4px; font-family: inherit; font-size: 1rem; color: var(--text); background: var(--input-bg); }

/* Preferences (account page) */
.pref-form { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; max-width: 520px; margin-bottom: 8px; }
.pref-form label { flex: 1 1 200px; margin-bottom: 0; }

/* Biggest fish per species */
.biggest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 24px; }
.biggest-card { align-items: stretch; gap: 8px; padding: 14px; }
.biggest-species { font-weight: 700; color: var(--brand-800);  letter-spacing: 0.04em; font-size: 0.8rem; }
.biggest-card img { width: 100%; height: 130px; object-fit: cover; border-radius: 4px; display: block; }
.biggest-length { font-size: 1.4rem; font-weight: 700; color: var(--accent-dark); }
.biggest-none { padding: 40px 0; text-align: center; }

/* Admin tournament workspace + app-wide preferences */
.tournament-bar { display: flex; align-items: baseline; gap: 14px; margin: 4px 0 6px; flex-wrap: wrap; }
.tournament-bar a { font-size: 0.88rem; text-decoration: none; color: var(--brand-700); }
.tournament-bar strong { font-size: 1.15rem; }
.plain-link { color: inherit; text-decoration: none; }
.plain-link:hover { text-decoration: underline; }
.rule-form label.check { display: flex; gap: 8px; align-items: flex-start; grid-column: span 2; }
.rule-form label.check input { width: auto; margin-top: 3px; }
.footer-prefs { display: flex; gap: 8px; justify-content: center; margin-bottom: var(--s3); }
.footer-prefs select { display: inline-block; width: auto; margin: 0; padding: 6px 10px; font-size: 0.85rem; border-radius: 4px; }
.map-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin: 10px 0 0; }
.map-tools .map-search { margin: 0; flex: 1 1 320px; }
#wand.on { background: var(--brand-700); color: white; }

/* out-of-scope catches and the fishing / no-fishing toggle in the map editor */
.badge-scope { background: var(--danger-bg); color: var(--bad-fg); border: 1px solid var(--red); }   /* the plain red text is 3.8:1 here */
.scope-bad { color: var(--red); }
.kind-toggle { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0 4px; }
.kind-toggle .kind { background: transparent; color: var(--text); border: 2px solid var(--line, #c9d3dc); display: inline-flex; align-items: center; gap: 8px; }
.kind-toggle .kind.on { border-color: var(--brand-800); background: var(--brand-100); }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; }
.swatch.fish { background: rgba(45, 106, 79, 0.35); border: 2px solid #2d6a4f; }
.swatch.ban { background: rgba(192, 57, 43, 0.35); border: 2px dashed #c0392b; }

/* rounds, likes, best-N */
.lb-rounds { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s1); }
.chip { background: var(--brand-100); color: var(--brand-800); border-radius: 4px; padding: 3px 10px; font-size: 0.78rem; }
.like-form { margin: 0; }
.like { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 4px; padding: 4px 12px; font: inherit; font-size: 0.85rem; cursor: pointer; }
.like:hover { border-color: var(--red); color: var(--red); }
.like.on { background: var(--danger-bg); border-color: var(--red); color: var(--red); font-weight: 700; }
.team-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.team-total { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.team-total .lb-points { margin-left: 0; font-size: 1.4rem; }
.round-banner { padding: 10px 14px; border-radius: 4px; background: var(--brand-100); color: var(--brand-800); font-weight: 600; }
.round-banner.on { background: var(--ok-bg); color: var(--green); }
.round-pick { display: block; margin: 8px 0; }
.formula { font-weight: 500; }

.badge-big { background: #f6c945; color: #4a3200; }
.catch-map { height: 540px; border-radius: 4px; }
.cm-filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 10px 0; }
.fish-pin { width: 22px; height: 22px; border-radius: 50%; background: #2d6a4f; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); color: #fff; font-size: 12px; line-height: 18px; text-align: center; }
.fish-pin.rejected { background: #8a94a3; opacity: .8; }
.fish-pin.big { width: 34px; height: 34px; background: #f6c945; color: #4a3200; border-color: #b8860b; font-size: 20px; line-height: 30px; animation: bigpulse 1.6s ease-out infinite; }
@keyframes bigpulse { 0% { box-shadow: 0 0 0 0 rgba(246,201,69,.8); } 70% { box-shadow: 0 0 0 14px rgba(246,201,69,0); } 100% { box-shadow: 0 0 0 0 rgba(246,201,69,0); } }

/* tables become stacked cards on narrow screens so every button stays reachable */
@media (max-width: 720px) {
  .data-table.stack { display: block; overflow: visible; white-space: normal; background: none; box-shadow: none; border-radius: 0; }
  .data-table.stack thead { display: none; }
  .data-table.stack tbody, .data-table.stack tr { display: block; }
  .data-table.stack tr { background: var(--card); border: 1px solid var(--border); border-radius: 4px; box-shadow: var(--shadow); margin-bottom: 12px; padding: 6px 14px; }
  .data-table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 7px 0; border-bottom: 1px dashed var(--border); text-align: right; }
  .data-table.stack td:last-child { border-bottom: none; }
  .data-table.stack td::before { content: attr(data-label); flex-shrink: 0; font-size: 0.74rem;  letter-spacing: 0.04em; font-weight: 600; color: var(--muted); text-align: left; }
  .data-table.stack td[data-label=""]::before { content: none; }
  .data-table.stack td[colspan] { display: block; text-align: center; }
  .data-table.stack .rule-actions { justify-content: flex-end; flex-wrap: wrap; }
}

.analyzing { text-align: center; }
.analyzing .catch-photo { max-width: 420px; margin: 14px auto 0; opacity: .85; }
.spinner { width: 44px; height: 44px; margin: 6px auto 14px; border: 4px solid var(--brand-100); border-top-color: var(--accent, #f6a623); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.capture-msg { margin: 12px 0; padding: 10px 14px; border-radius: 4px; background: var(--brand-100); color: var(--brand-800); font-weight: 600; }
.capture-msg.bad { background: var(--danger-bg); color: var(--red); }
#fc-queue { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--sab)); z-index: 1200; max-width: 560px; margin: 0 auto;
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 4px; box-shadow: 0 6px 24px rgba(0,0,0,.35);
  padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; font-size: .92rem; }
#fc-queue[hidden] { display: none; }
#fc-queue button { align-self: flex-start; border: 0; border-radius: 4px; padding: 7px 16px; background: #f6a623; color: #241a00; font-weight: 700; cursor: pointer; }
#fc-queue .fc-queue-sent { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#fc-queue .fc-queue-sent a { color: var(--green); font-weight: 600; }
#fc-queue .fc-queue-x { padding: 2px 10px; background: transparent; color: var(--muted); font-size: 1.2rem; }

.footer-links a { color: inherit; opacity: .85; }
.report-box { margin-top: 18px; }
.report-box summary { cursor: pointer; color: var(--muted); }
.report-box form { display: grid; gap: 10px; max-width: 420px; margin-top: 10px; }
.reports-box { margin-bottom: 18px; border-color: var(--red); }
.report-row { display: flex; gap: 14px; align-items: flex-start; padding: 10px 0; border-top: 1px dashed var(--border); }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.legal { max-width: 760px; line-height: 1.6; }
.legal h2 { margin-top: 1.6em; }
.legal-table { width: 100%; border-collapse: collapse; margin: .6em 0 1em; font-size: .95em; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: .45em .6em; border-bottom: 1px solid var(--line, rgba(127,127,127,.25)); }
.legal-table td:last-child, .legal-table th:last-child { white-space: nowrap; }
.rule-form label.pay-consent, form label.pay-consent { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; font-size: .92em; line-height: 1.45; font-weight: 400; margin: .4em 0 .8em; }
label.pay-consent input[type="checkbox"] { flex: none; width: 22px; height: 22px; margin: 1px 0 0; }

.btn.danger { background: var(--red); color: var(--on-red); }
.danger-zone { margin: 36px 0 12px; padding: 14px 16px; border: 1px solid var(--red); border-radius: 4px; }
.danger-zone summary { cursor: pointer; font-weight: 700; color: var(--red); }
.howto { margin: var(--s5) 0; }
.howto-svg { width: 100%; max-width: 420px; display: block; margin: 8px 0 14px; color: var(--text); }
.howto-steps { padding-left: var(--s5); line-height: 1.55; margin: 0; }
.howto-steps li { margin-bottom: var(--s2); }
.rules-text { white-space: pre-wrap; line-height: 1.6; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: .8rem; padding: 4px 0; }
.link-btn:hover { color: var(--red); }
.biggest-report { margin: 2px 0 0; }

.top3-species { margin: 18px 0 6px; color: var(--brand-800); }

.overlay-thumb { display: block; max-width: 100%; width: 320px; border-radius: 4px; margin: 6px 0; border: 1px solid var(--border); }
.overlay-thumb.small { width: 110px; display: inline-block; vertical-align: middle; }
.retake-card { border-color: var(--red); margin-bottom: 18px; }
.accuracy-box { margin: 10px 0 16px; }

#fc-cam { position: fixed; inset: 0; z-index: 3000; background: #000; display: flex; flex-direction: column; }
#fc-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fc-cam-frame { position: absolute; inset: 7% 5% 20% 5%; border: 2px dashed rgba(255,255,255,.85); border-radius: 4px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(0,0,0,.28); }
.fc-cam-tip { position: absolute; left: 12px; right: 12px; top: calc(10px + var(--sat)); padding: 8px 12px; border-radius: 4px; background: rgba(0,0,0,.6); color: #fff; font-weight: 600; text-align: center; font-size: .95rem; }
.fc-cam-level { position: absolute; left: 50%; bottom: calc(118px + var(--sab)); width: 100px; height: 12px; margin-left: -50px; border-radius: 6px; background: rgba(255,255,255,.35); overflow: visible; }
.fc-cam-level span { position: absolute; left: 50%; top: -3px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: #fff; transition: transform .1s linear; }
#fc-cam[data-level="good"] .fc-cam-level span { background: #3ddc84; }
#fc-cam[data-level="warn"] .fc-cam-level span { background: #f6a623; }
#fc-cam[data-level="bad"] .fc-cam-level span { background: #ff5252; }
.fc-cam-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; padding: 14px 28px calc(18px + var(--sab)); background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.fc-cam-shutter { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.25); cursor: pointer; }
.fc-cam-shutter:active { background: #fff; }
.fc-cam-cancel { width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.2); color: #fff; font-size: 1.3rem; cursor: pointer; }
.fc-cam-spacer { width: 46px; }


/* =====================================================================================================
   UI polish layer: one spacing scale, one type scale, real tap targets, phone navigation at the thumb.
   (Overrides the older rules above on purpose; keep this block last.)
   ===================================================================================================== */
:root { --tap: 48px; --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --r-ctl: 4px; --nav-h: 64px;
  /* the type scale: seven sizes (12 14 16 20 26 32 and the display size 32-48); new rules take one of these, not a raw value */
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.25rem; --fs-xl: 1.625rem; --fs-2xl: 2rem; --fs-3xl: clamp(2rem, 1rem + 3.2vw, 3rem); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-size: 16px; line-height: 1.55; -webkit-tap-highlight-color: transparent; }
a, button, select, input, summary, label { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
h1 { font-size: clamp(1.55rem, 1.2rem + 1.6vw, 2.1rem); line-height: 1.2; margin: 4px 0 var(--s3); }
h2 { font-size: 1.25rem; line-height: 1.3; margin: var(--s6) 0 var(--s3); }
h3 { font-size: 1.05rem; line-height: 1.3; }
p { margin: 0 0 var(--s3); }
.muted { font-size: var(--fs-sm); line-height: 1.5; }
.container { max-width: 960px; padding: var(--s5) var(--s4) var(--s6); }
.section-h { margin-top: var(--s5); }

/* header: stays in view, roomy links on a computer */
.topbar { position: sticky; top: 0; z-index: 1100; flex-wrap: nowrap; padding: 10px var(--s5); padding-top: calc(10px + var(--sat)); }
.topbar nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 16px; font-size: 0.95rem; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: var(--s3) var(--s5); font-size: 1rem; line-height: 1.2; text-align: center; }
.btn-xl { display: flex; width: 100%; min-height: 60px; font-size: 1.1rem; margin-bottom: var(--s3); }
.data-table .btn, .rule-actions .btn, .cm-filters .btn { min-height: 40px; padding: 8px 16px; font-size: 0.9rem; }
.actions { gap: var(--s3); margin-top: var(--s3); }

/* forms: 16px text (stops iPhones zooming in), 48px tall controls */
form label { font-size: 0.92rem; margin-bottom: var(--s4); }
form input, form select, form textarea { min-height: var(--tap); padding: 12px 14px; border-radius: var(--r-ctl); font-size: 16px; margin-top: 6px; }
form input[type="checkbox"], form input[type="radio"] { min-height: 0; }
.footer-prefs select { min-height: 44px; padding: var(--s2) var(--s3); }
footer { padding: var(--s5) var(--s4) var(--s6); }
.footer-links a { display: inline-block; padding: 8px 4px; }

/* sign-in / register / reset: one centred card */
.auth-card { max-width: 440px; margin: var(--s5) auto 0; background: var(--card); border: 1px solid var(--border); border-radius: 4px; padding: var(--s5); box-shadow: var(--shadow); }
.auth-card h1 { margin-top: 0; }
.auth-card .btn { width: 100%; }
.auth-card .muted { text-align: left; }
.auth-card > .muted:last-child { text-align: center; margin: var(--s4) 0 0; }
/* "or continue with Google / Apple" under the e-mail form (templates/_social_login.html), in Google's and Apple's button styles */
.social-login { margin-top: var(--s4); display: grid; gap: 10px; }
.social-or { display: flex; align-items: center; gap: 12px; margin: 0 0 4px; color: var(--muted); font-size: .9rem; }
.social-or::before, .social-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.social-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 16px;
  border-radius: 999px; font: 600 1rem/1.2 inherit; font-family: inherit; text-decoration: none; cursor: pointer; }
.social-btn .social-ic { flex: none; }
.social-google { background: #FFFFFF; color: #1F1F1F; border: 1px solid #747775; }
.social-google:hover { background: #F7F8F8; color: #1F1F1F; }
.social-apple { background: #000000; color: #FFFFFF; border: 1px solid #000000; }
.social-apple:hover { background: #1C1C1E; color: #FFFFFF; }
.social-btn:disabled { opacity: .6; cursor: wait; }
.social-login .flash { margin: 0; }
:root[data-theme="dark"] .social-apple { background: #FFFFFF; color: #000000; border-color: #FFFFFF; }   /* Apple: white button on dark */
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .social-apple { background: #FFFFFF; color: #000000; border-color: #FFFFFF; } }

/* cards and lists */
.card { padding: 20px; border-radius: 4px; }
.card-list { gap: var(--s4); }

/* the "submit a catch" page: the camera button comes first and is big */
.round-banner { margin: 0 0 var(--s4); }

/* bottom tab bar (phones only) */
.bottom-nav { display: none; }
@media (max-width: 720px) {
  .has-bottom-nav .topbar { justify-content: center; padding: 8px var(--s4); padding-top: calc(8px + var(--sat)); }
  .has-bottom-nav .topbar nav { display: none; }
  body.has-bottom-nav { padding-bottom: calc(var(--nav-h) + 12px + var(--sab)); }
  .bottom-nav { display: flex; align-items: stretch; justify-content: space-around; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100;
    background: var(--card); border-top: 1px solid var(--border); box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.22);
    padding: 6px 6px calc(6px + var(--sab)); }
  .bottom-nav a { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px;
    color: var(--muted); text-decoration: none; font-size: 0.72rem; font-weight: 600; border-radius: 4px; position: relative; }
  .bottom-nav a .ic { display: flex; width: 28px; height: 28px; align-items: center; justify-content: center; }
  .bottom-nav a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .bottom-nav a.active { color: var(--brand-700); }
  .bottom-nav a.active::after { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 3px; background: var(--brand-700); }
  .bottom-nav a.primary { color: var(--text); }
  .bottom-nav a.primary .ic { width: 56px; height: 56px; margin-top: -24px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
    box-shadow: 0 6px 16px rgba(240, 162, 2, 0.45), 0 0 0 5px var(--card); }
  .bottom-nav a.primary svg { width: 28px; height: 28px; stroke: var(--on-accent); }
  .bottom-nav a.primary.active::after { display: none; }
  #fc-queue { bottom: calc(var(--nav-h) + 12px + var(--sab)); }
  .container { padding: var(--s4) var(--s4) var(--s5); }
  .auth-card { margin-top: var(--s3); padding: 20px; }
  h2 { margin-top: var(--s5); }
}
@media (min-width: 721px) {
  .btn-xl { width: auto; min-width: 340px; }
  .auth-card { margin-top: 48px; padding: 32px; }
}

/* leaderboard rows: the name takes the free space, points and the heart stay on the same line, the heart is easy to tap */
.lb-rounds { flex: 1 0 100%; }
.like { min-height: 40px; padding: 6px 14px; display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 720px) {
  .lb-name { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
  .lb-points { margin-left: 0; }
}

/* super-admin: account search and the delete-account options */
.acc-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 var(--s3); }
.acc-filter input[type="search"] { flex: 1 1 220px; margin-top: 0; }
.acc-filter select { flex: 0 1 180px; margin-top: 0; width: auto; }
fieldset.choice { border: 1px solid var(--border); border-radius: 4px; padding: 12px 16px; margin: 0 0 var(--s4); }
fieldset.choice legend { font-weight: 600; padding: 0 6px; }
fieldset.choice label.check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; color: var(--text); font-size: 0.95rem; }
fieldset.choice input[type="radio"] { width: 22px; height: 22px; margin-top: 2px; flex-shrink: 0; }

/* tournament logo */
.title-row { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s2); }
.title-row h1, .title-row h2 { margin: 0; }
.t-logo { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 4px; padding: 5px; flex-shrink: 0; box-shadow: var(--shadow); }
.t-logo.sm { width: 44px; height: 44px; border-radius: 4px; padding: 3px; }
.t-logo.big { width: 140px; height: 140px; border-radius: 4px; padding: 8px; margin-bottom: var(--s3); }
.tournament-bar .t-logo { align-self: center; }
.logo-card form { margin: 0 0 var(--s3); }

/* ===================================================================================================
   Leaderboard showcase (medal photos + sponsors), live movement, results ceremony, TV mode
   =================================================================================================== */
.lb-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
.lb-aside { order: -1; }
.join-hint { margin: 10px 0 0; }

.showcase { position: relative; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: #0b1530; box-shadow: var(--shadow); cursor: pointer; isolation: isolate; }
.showcase[hidden] { display: none; }
.show-stage { position: absolute; inset: 0; }
.showcase .slide { position: absolute; inset: 0; opacity: 0; transition: opacity 0.9s ease; }
.showcase .slide.in { opacity: 1; }
.showcase .slide.photo img { width: 100%; height: 100%; object-fit: cover; display: block; animation: kenburns 10s ease-out forwards; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.09); } }
.showcase .caption { position: absolute; left: 0; right: 0; bottom: 0; padding: var(--s7) var(--s4) var(--s4); color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.82)); }
.showcase .caption .t { font-weight: 700; font-size: var(--fs-lg); line-height: 1.2; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }
.showcase .caption .s { opacity: 0.9; font-size: var(--fs-md); margin-top: var(--s1); }
.showcase .slide.sponsor { background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 9% 12% 11%; }
.showcase .slide.sponsor img { max-width: 100%; max-height: 72%; object-fit: contain; display: block; flex: 1 1 0; min-height: 0; width: 100%; }
.showcase .slide.sponsor .name { margin-top: 12px; color: #1d3a2c; font-weight: 700; text-align: center; }
.showcase .slide.sponsor .tag { position: absolute; top: 12px; left: 16px; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: #6b7784; font-weight: 600; }
.show-dots { position: absolute; right: 12px; bottom: var(--s3); display: flex; gap: var(--s2); z-index: 3; }
.show-dots .dot { width: 9px; height: 9px; min-height: 0; padding: 0; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.5); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3); cursor: pointer; }
.show-dots .dot.on { background: #fff; }

/* rows that move */
.leaderboard-list > .lb-row { position: relative; transition: box-shadow 0.4s, opacity 0.4s, background-color 0.4s; }
.leaderboard-list > .lb-row.lb-up { z-index: 3; box-shadow: 0 0 0 2px #2fd17a, 0 10px 34px rgba(47, 209, 122, 0.4); }
.leaderboard-list > .lb-row.lb-down { opacity: 0.7; box-shadow: 0 0 0 2px rgba(239, 71, 111, 0.65); }
.v-total.bump { color: var(--green); transition: color 0.3s; }
.lb-points { font-variant-numeric: tabular-nums; }
.leaderboard-list > .lb-row.lb-hidden { opacity: 0; transform: translateX(70px); pointer-events: none; }
.leaderboard-list > .lb-row.lb-reveal { animation: lbreveal 0.9s cubic-bezier(0.2, 0.9, 0.25, 1.1) both; }
.leaderboard-list > .lb-row:first-child.lb-reveal { animation: lbreveal 0.9s cubic-bezier(0.2, 0.9, 0.25, 1.1) both, winnerglow 3s ease-out 0.4s; }
@keyframes lbreveal { from { opacity: 0; transform: translateX(90px) scale(0.96); } 60% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes winnerglow { 0% { box-shadow: 0 0 0 0 rgba(240, 162, 2, 0.9); } 40% { box-shadow: 0 0 0 14px rgba(240, 162, 2, 0.35), 0 0 60px rgba(240, 162, 2, 0.7); } 100% { box-shadow: var(--shadow); } }

.lb-toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px + var(--sab)); transform: translate(-50%, 24px); opacity: 0; max-width: 92vw;
  padding: 12px 22px; border-radius: 999px; background: #0f1b33; color: #fff; font-weight: 700; text-align: center; border: 2px solid #2fd17a; box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  z-index: 2500; transition: opacity 0.35s, transform 0.35s; pointer-events: none; }
.lb-toast.show { opacity: 1; transform: translate(-50%, 0); }
.lb-toast.gold { border-color: var(--accent); }
.lb-drum { position: fixed; inset: 0; z-index: 2400; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; color: #fff;
  font-weight: 800; font-size: clamp(1.8rem, 5vw, 3.6rem); background: rgba(8, 16, 36, 0.86); opacity: 0; pointer-events: none; transition: opacity 0.5s; }
.lb-drum.show { opacity: 1; }
.lb-drum.big { font-size: clamp(3rem, 12vw, 9rem); color: var(--accent); animation: drumpulse 0.9s ease-in-out infinite; }
@keyframes drumpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.confetti-box { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2600; }
.confetti-box i { position: absolute; top: -20px; width: 10px; height: 16px; opacity: 0.95; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { transform: translateY(112vh) rotate(760deg); } }

/* organiser: gallery, sponsors, medal button */
.gallery-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--s3); margin: var(--s3) 0; }
.gallery-item { margin: 0; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.gallery-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; }
.gallery-item figcaption { font-size: 0.85rem; color: var(--muted); min-height: 1.3em; }
.gallery-item form { margin: 0; }
.photo-add { display: block; }
.sponsor-list { list-style: none; padding: 0; margin: var(--s3) 0; display: flex; flex-direction: column; gap: var(--s2); }
.sponsor-row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; }
.sponsor-row img { width: 96px; height: 56px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; }
.sponsor-row .sponsor-name { flex: 1 1 140px; font-weight: 600; }
.sponsor-row form { margin: 0; }
.sponsor-row .btn { min-height: 40px; padding: 6px 14px; }
.medal-form { margin: 8px 0 0; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.medal-btn { cursor: pointer; min-height: 40px; padding: 6px 14px; font-size: 0.9rem; margin: 0; }
.top3 li { flex-wrap: wrap; }

/* ---- TV mode: the ranking fills the screen, the slideshow stands beside it ---- */
.tv-bar { display: none; }
body.tv { padding-bottom: 0; }
body.tv .topbar, body.tv .bottom-nav, body.tv footer, body.tv .player-tabs, body.tv .title-row, body.tv .formula,
body.tv .lb-biggest, body.tv .like-form, body.tv .status-tabs, body.tv .lb-main > p.muted, body.tv .flash { display: none; }
body.tv .container { max-width: none; padding: 20px 36px 40px; }
body.tv .tv-bar { display: flex; align-items: center; gap: 22px; margin-bottom: 20px; }
body.tv .tv-title { flex: 1; font-size: clamp(1.6rem, 3vw, 3rem); font-weight: 800; letter-spacing: -0.01em; }
body.tv .tv-bar .t-logo { width: 84px; height: 84px; }
body.tv .tv-clock { font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
body.tv .tv-fs { min-height: 48px; width: 48px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 1.4rem; cursor: pointer; }
body.tv .lb-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 36px; align-items: start; }
body.tv .lb-aside { order: 0; position: sticky; top: 20px; }
body.tv .leaderboard-list { gap: 14px; }
body.tv .leaderboard-list > .lb-row { padding: 18px 26px; gap: 22px; }
body.tv .lb-rank { width: 56px; height: 56px; font-size: 1.6rem; }
body.tv .lb-name { font-size: clamp(1.3rem, 2.2vw, 2.1rem); }
body.tv .lb-points { font-size: clamp(1.5rem, 2.6vw, 2.5rem); }
body.tv .lb-points small { font-size: 0.9rem; }
body.tv .lb-fish { display: none; }
body.tv .lb-name { flex: 1 1 0; min-width: 0; }
body.tv .lb-points { margin-left: 0; }
body.tv .lb-rounds { display: none; }
body.tv .lb-toast { bottom: 48px; font-size: clamp(1.4rem, 3vw, 2.4rem); padding: 18px 40px; }
@media (max-width: 960px) {
  body.tv .lb-layout { grid-template-columns: minmax(0, 1fr); }
  body.tv .lb-aside { position: static; order: -1; }
}
@media (min-width: 900px) {
  .lb-layout:not(:has(.lb-aside)) { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .showcase .slide.photo img { animation: none; }
  .leaderboard-list > .lb-row.lb-reveal { animation: none; }
}

/* stacked cards on a page keep a gap */
main > .card + .card, .container > .card + .card { margin-top: var(--s4); }

.showcase .slide.sponsor .url { margin-top: 2px; color: #6b7784; font-size: 0.85rem; }
body.tv .showcase .slide.sponsor .name { font-size: 1.6rem; }
body.tv .showcase .slide.sponsor .url { font-size: 1.1rem; }

.show-dots .count { font-size: 0.75rem; font-weight: 700; color: #1d3a2c; background: rgba(255, 255, 255, 0.88); padding: var(--s1) var(--s2); border-radius: 999px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); font-variant-numeric: tabular-nums; }

/* home page groups, empty states */
.group-h { margin: var(--s5) 0 var(--s3); font-size: 1.05rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.title-row .badge { margin-left: auto; align-self: center; }
.empty-card { text-align: center; padding: 32px 16px; background: var(--card); border: 1px dashed var(--border); border-radius: 18px; color: var(--muted); }
.leaderboard-list > .lb-empty { list-style: none; text-align: center; padding: 28px 16px; background: var(--card); border: 1px dashed var(--border); border-radius: 14px; color: var(--muted); }
.lb-empty strong { display: block; color: var(--text); }
.lb-empty span { display: block; margin-top: 6px; font-size: 0.9rem; }
label.check { display: flex; gap: 10px; align-items: flex-start; color: var(--text); margin-bottom: var(--s3); }
label.check input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; margin: 2px 0 0; flex-shrink: 0; }

.demo-state { list-style: none; padding: 0; margin: 0 0 var(--s3); display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; }

.showcase .slide .credit { position: absolute; top: 8px; right: 10px; max-width: 70%; text-align: right; font-size: 0.68rem; color: rgba(255, 255, 255, 0.9); background: rgba(0, 0, 0, 0.45); padding: 2px 8px; border-radius: 999px; }
body.tv .showcase .slide .credit { font-size: 0.9rem; }

/* TV screen: the slideshow takes over the whole screen between ranking views */
body.tv.tv-show .lb-main, body.tv.tv-show .tv-bar { visibility: hidden; }
body.tv.tv-show .lb-aside { position: fixed; inset: 0; z-index: 2000; background: #000; padding: 0; }
body.tv.tv-show .showcase { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
body.tv.tv-show .showcase .caption { padding: 90px 48px 40px; }
body.tv.tv-show .showcase .caption .t { font-size: clamp(2rem, 4.5vw, 4rem); }
body.tv.tv-show .showcase .caption .s { font-size: clamp(1.1rem, 2vw, 1.8rem); }
body.tv.tv-show .showcase .slide.sponsor img { max-height: 60%; }
body.tv.tv-show .showcase .slide.sponsor .name { font-size: clamp(1.6rem, 3vw, 2.6rem); }
body.tv.tv-show .showcase .slide .credit { font-size: 1rem; top: 18px; right: 22px; }

.lb-hint { position: fixed; left: 50%; bottom: 36px; transform: translate(-50%, 20px); z-index: 2450; opacity: 0; transition: opacity 0.4s, transform 0.4s; pointer-events: none;
  background: rgba(15, 27, 51, 0.92); color: #fff; border: 2px solid var(--accent); border-radius: 999px; padding: 12px 28px; font-weight: 700; font-size: clamp(1rem, 2.2vw, 1.8rem); animation: hintpulse 1.6s ease-in-out infinite; }
.lb-hint.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes hintpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(240, 162, 2, 0.5); } 50% { box-shadow: 0 0 0 14px rgba(240, 162, 2, 0); } }

/* ===== TV screen v2: logo up top, ranking in the middle, the sponsors + medal fish strip at the bottom centre ===== */
body.tv .container { padding-bottom: calc(26vh + 24px); }
body.tv .lb-layout { display: flex; flex-direction: column; align-items: center; gap: 20px; }
body.tv .lb-main { width: min(1100px, 100%); }
body.tv .lb-aside { position: fixed; top: auto; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(980px, 78vw); height: 24vh; order: 3; z-index: 40; }
body.tv .lb-aside .showcase { height: 100%; aspect-ratio: auto; }
body.tv .tv-bar { justify-content: center; gap: 28px; }
body.tv .tv-bar .t-logo { width: clamp(110px, 13vh, 170px); height: clamp(110px, 13vh, 170px); border-radius: 22px; padding: 10px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }
body.tv .tv-title { flex: 0 1 auto; text-align: center; font-size: clamp(2rem, 4.2vw, 4.2rem); }
body.tv .tv-clock { position: fixed; top: 16px; right: 80px; }
body.tv .tv-fs { position: fixed; top: 12px; right: 16px; }
body.tv.tv-show .lb-aside { top: 0; left: 0; bottom: 0; transform: none; width: 100%; height: 100%; }
@media (max-width: 960px) { body.tv .lb-aside { position: static; transform: none; width: 100%; height: auto; } body.tv .lb-aside .showcase { aspect-ratio: 16 / 9; } }

/* ===== results ceremony ===== */
body.ceremony .lb-main { display: none; }
.cer { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; min-height: calc(100vh - 52vh); gap: 18px; }
.cer-ladder { width: min(940px, 94vw); display: flex; flex-direction: column; gap: 10px; transition: opacity 0.8s, transform 0.8s; }
.cer-ladder.out { opacity: 0; transform: translateY(-40px) scale(0.97); }
.cer-row { display: flex; align-items: center; gap: 20px; padding: 12px 26px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; opacity: 0; transform: translateX(80px); }
.cer-row.in { opacity: 1; transform: none; transition: opacity 0.6s, transform 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.1); }
.cer-rank { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--brand-100); color: var(--brand-800); font-weight: 800; font-size: 1.6rem; flex-shrink: 0; }
.cer-who { flex: 1; min-width: 0; }
.cer-name { font-weight: 700; font-size: clamp(1.3rem, 2.4vw, 2.2rem); line-height: 1.15; }
.cer-people { color: var(--muted); font-size: clamp(0.95rem, 1.5vw, 1.35rem); margin-top: 2px; }
.cer-pts { font-weight: 800; font-size: clamp(1.5rem, 2.8vw, 2.6rem); color: var(--accent); white-space: nowrap; }
.cer-pts small { font-size: 0.45em; color: var(--muted); font-weight: 600; }
.cer-podium { display: none; align-items: flex-end; justify-content: center; gap: clamp(12px, 2vw, 28px); width: min(1100px, 96vw); }
.cer-podium.show { display: flex; animation: cerin 0.8s ease both; }
@keyframes cerin { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
.pod { flex: 1 1 0; max-width: 340px; display: flex; flex-direction: column; justify-content: flex-end; }
.pod-card { min-height: 120px; padding: 14px 12px; text-align: center; opacity: 0; transform: translateY(30px) scale(0.92); transition: opacity 0.7s, transform 0.7s cubic-bezier(0.2, 0.9, 0.25, 1.2); display: flex; flex-direction: column; justify-content: flex-end; }
.pod.in .pod-card { opacity: 1; transform: none; }
.pod .cer-name { font-size: clamp(1.2rem, 2.2vw, 2rem); }
.pod-block { display: flex; align-items: flex-start; justify-content: center; border-radius: 16px 16px 0 0; color: rgba(0, 0, 0, 0.55); font-weight: 900; font-size: clamp(2.6rem, 6vw, 5.5rem); padding-top: 6px; box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.35); }
.pod.p1 .pod-block { height: clamp(150px, 24vh, 260px); background: linear-gradient(#f6c945, #c9921b); }
.pod.p2 .pod-block { height: clamp(110px, 17vh, 190px); background: linear-gradient(#d3dae2, #8d99a6); }
.pod.p3 .pod-block { height: clamp(85px, 13vh, 150px); background: linear-gradient(#d9a066, #9a6226); }
.pod.p1.in .cer-pts { font-size: clamp(1.8rem, 3.4vw, 3.2rem); }
body.ceremony .showcase { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }

/* closing summary: the biggest fish of every species and the first catches */
.cer-summary { display: none; width: min(1500px, 98vw); }
.cer-view-summary .cer-summary { display: block; animation: cerin 0.7s ease both; }
.cer-view-summary .cer-podium { display: none; }
.cer-summary h2 { text-align: center; margin: 0 0 14px; font-size: clamp(1.4rem, 2.6vw, 2.4rem); }
.sum-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.sum-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 14px 18px; }
.sum-card h3 { margin: 0 0 8px; font-size: clamp(1.1rem, 1.8vw, 1.6rem); color: var(--accent-ink); }
.sum-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px solid var(--border); }
.sum-row:first-of-type { border-top: 0; }
.sum-row img { width: clamp(44px, 5vw, 76px); height: clamp(44px, 5vw, 76px); object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.sum-rank { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-100); color: var(--brand-800); display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.sum-who { min-width: 0; font-size: clamp(0.85rem, 1.3vw, 1.2rem); color: var(--muted); }
.sum-who strong { color: var(--text); font-size: clamp(1rem, 1.7vw, 1.5rem); }

/* extra promoted place on the ladder and the consolation draw */
.cer-row.bonus { border-color: var(--gold, #e0b13a); box-shadow: 0 0 0 2px rgba(224, 177, 58, 0.35) inset; }
.cer-extra { color: var(--gold, #b8860b); font-weight: 700; font-size: 0.8em; letter-spacing: 0.04em; text-transform: uppercase; }
.cer-draw { display: none; width: min(900px, 96vw); text-align: center; }
.cer-view-draw .cer-draw { display: block; animation: cerin 0.7s ease both; }
.cer-view-draw .cer-podium { display: none; }
.cer-draw h2 { margin: 0 0 14px; font-size: clamp(1.4rem, 2.6vw, 2.4rem); }
.draw-slot { font-size: clamp(1.8rem, 5vw, 4.2rem); font-weight: 800; min-height: 1.4em; padding: 14px 20px; border-radius: 20px; background: var(--card); border: 2px solid var(--border); color: var(--text); overflow-wrap: anywhere; }
.draw-slot.won { border-color: var(--gold, #e0b13a); color: var(--accent); animation: cerin 0.5s ease both; }
.draw-winners { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; text-align: left; font-size: clamp(1rem, 1.8vw, 1.5rem); }
.draw-winners li { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 8px 16px; }
.draw-winners small { color: var(--muted); }
.draw-list { padding-left: 20px; }

/* ceremony: the hint sits above the bottom strip; the summary has the whole screen; long draw lists stay inside the page */
body.tv .lb-hint { bottom: calc(24vh + 30px); }
body.cer-summary-on .lb-aside { display: none; }
body.cer-summary-on .lb-hint { bottom: 28px; }
.cer-summary .sum-grid { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.cer-summary .sum-row img { width: clamp(40px, 4.2vw, 62px); height: clamp(40px, 4.2vw, 62px); }
.cer-summary .sum-row { padding: 5px 0; }
.draw-winners { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); max-height: 30vh; overflow: auto; }

/* TV strip: a compact sponsor slide (the logo must stay big), a one-line title, a slim hint above the strip */
body.tv .showcase .slide.sponsor { padding: 3% 6% 3%; }
body.tv .showcase .slide.sponsor .name { margin-top: 6px; font-size: clamp(1rem, 1.5vw, 1.4rem); }
body.tv .showcase .slide.sponsor .url { font-size: clamp(0.8rem, 1vw, 1rem); }
body.tv .tv-title { font-size: clamp(1.6rem, 3.2vw, 3.2rem); }
body.tv.tv-show .showcase .slide.sponsor { padding: 6% 10%; }
body.tv.tv-show .showcase .slide.sponsor .name { font-size: clamp(1.6rem, 3vw, 2.6rem); }
body.tv .lb-hint { font-size: clamp(0.95rem, 1.3vw, 1.25rem); padding: 9px 22px; white-space: nowrap; max-width: 94vw; }
body.tv .cer { padding-bottom: 64px; }
body.cer-summary-on .tv-title { display: none; }
body.cer-summary-on .cer { padding-bottom: 70px; }
.cer-summary .sum-who { font-size: clamp(0.8rem, 1.05vw, 1rem); }
.cer-summary .sum-who strong { font-size: clamp(0.95rem, 1.25vw, 1.2rem); }
.pod.p1 .pod-block { height: clamp(130px, 20vh, 230px); }
.pod.p2 .pod-block { height: clamp(95px, 14vh, 165px); }
.pod.p3 .pod-block { height: clamp(70px, 10.5vh, 125px); }

/* the bottom strip shows a sponsor as: big logo on the left, name and web address on the right */
body.tv:not(.tv-show) .showcase .slide.sponsor { display: grid; grid-template-columns: 56% 1fr; grid-template-rows: 1fr 1fr; column-gap: 20px; align-items: center; padding: 22px 28px 12px; }
body.tv:not(.tv-show) .showcase .slide.sponsor img { grid-row: 1 / 3; grid-column: 1; width: 100%; height: 100%; max-height: none; }
body.tv:not(.tv-show) .showcase .slide.sponsor .name { grid-column: 2; grid-row: 1; align-self: end; margin: 0; text-align: left; font-size: clamp(1.1rem, 1.9vw, 1.9rem); }
body.tv:not(.tv-show) .showcase .slide.sponsor .url { grid-column: 2; grid-row: 2; align-self: start; margin: 4px 0 0; text-align: left; }

/* the ladder rows shrink so that 10..4 (plus extra places) always fit between the logo and the bottom strip */
.cer-ladder { --rh: min(112px, calc((76vh - 250px) / var(--rows, 7) - 10px)); gap: 8px; }
.cer-row { height: var(--rh); min-height: 34px; padding-top: 0; padding-bottom: 0; box-sizing: border-box; }
.cer-row .cer-name { font-size: min(clamp(1.3rem, 2.4vw, 2.2rem), calc(var(--rh) * 0.38)); }
.cer-row .cer-people { font-size: min(clamp(0.95rem, 1.5vw, 1.35rem), calc(var(--rh) * 0.27)); margin-top: 0; }
.cer-row .cer-extra { font-size: min(0.8em, calc(var(--rh) * 0.18)); }
.cer-row .cer-pts { font-size: min(clamp(1.5rem, 2.8vw, 2.6rem), calc(var(--rh) * 0.42)); }
.cer-row .cer-rank { width: max(30px, calc(var(--rh) * 0.5)); height: max(30px, calc(var(--rh) * 0.5)); font-size: max(1rem, calc(var(--rh) * 0.28)); }

/* a visible way out of the full-screen sponsor show */
.tv-close { position: fixed; top: 16px; right: 16px; z-index: 2600; width: 52px; height: 52px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.6); background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.tv-close:hover { background: rgba(0, 0, 0, 0.85); }

/* a drawn person who is not there any more */
.draw-winners li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.draw-winners li.absent { opacity: 0.55; text-decoration: line-through; }
.draw-winners li.absent em { text-decoration: none; font-style: normal; color: var(--muted); }
.draw-absent { margin-left: auto; cursor: pointer; border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 999px; padding: 4px 12px; font-size: 0.8rem; }
.draw-absent:hover { color: var(--text); border-color: var(--accent); }
.draw-list li.absent { opacity: 0.7; }
.draw-list form.inline { display: inline; margin-left: 8px; }
.steps { border: 1px solid var(--border); border-radius: 12px; padding: 8px 14px; margin: 8px 0; }
.steps label { display: block; margin: 6px 0; }

/* only the winner of each top-3 list gets the prize */
.sum-row.prize .sum-rank { background: var(--accent); color: #1a1200; }
.sum-trophy { font-size: 0.9em; }

.sum-row.gone { opacity: 0.55; }
.sum-row.gone .sum-who strong { text-decoration: line-through; }
.sum-row.gone .sum-who em { text-decoration: none; font-style: normal; color: var(--muted); font-weight: 500; font-size: 0.8em; }
.sum-gone { margin-left: auto; flex-shrink: 0; cursor: pointer; border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 999px; padding: 3px 10px; font-size: 0.72rem; }
.sum-gone:hover { color: var(--text); border-color: var(--accent); }

/* buttons to move between the closing views of the ceremony */
.cer-nav { position: fixed; left: 50%; bottom: calc(24vh + 30px); transform: translateX(-50%); z-index: 2460; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: 94vw; }
body.cer-summary-on .cer-nav { bottom: 28px; }
.cer-nav-btn { cursor: pointer; border: 2px solid var(--border); background: rgba(15, 27, 51, 0.92); color: #fff; border-radius: 999px; padding: 9px 22px; font-weight: 700; font-size: clamp(0.9rem, 1.2vw, 1.15rem); font-family: inherit; }
.cer-nav-btn.on { border-color: var(--accent); }
.cer-nav-btn:hover { border-color: var(--accent); }
body.tv .cer-nav-btn { white-space: nowrap; }
body:has(.cer-nav) .lb-hint { bottom: calc(24vh + 84px); }
body.cer-summary-on:has(.cer-nav) .lb-hint { bottom: 84px; }

/* the draw panel never grows past the space between the logo and the hint/buttons: the list of winners scrolls inside it */
.cer-draw { width: min(1300px, 96vw); max-height: calc(100vh - 160px - 24vh - 110px); display: none; flex-direction: column; min-height: 0; }
.cer-view-draw .cer-draw { display: flex; }
.cer-draw h2 { flex: 0 0 auto; margin-bottom: 8px; }
.draw-slot { flex: 0 0 auto; font-size: clamp(1.4rem, min(4.6vw, 7vh), 4rem); padding: clamp(6px, 1.4vh, 14px) 20px; }
.draw-winners { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; margin-top: 12px; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); align-content: start; scrollbar-width: thin; }
.draw-winners li { padding: 6px 14px; }

/* the draw is run by buttons only */
.draw-actions { flex: 0 0 auto; display: flex; justify-content: center; gap: 12px; margin-top: 12px; }
.draw-actions button[hidden] { display: none; }
.draw-go, .draw-next { cursor: pointer; font-family: inherit; font-weight: 800; font-size: clamp(1rem, 1.6vw, 1.5rem); border-radius: 999px; padding: 12px 34px; border: 2px solid var(--accent); background: var(--accent); color: #1a1200; }
.draw-go:disabled { opacity: 0.5; cursor: wait; }
.draw-next { background: transparent; color: var(--text); }

/* ---- phones: the ceremony views fit a narrow screen and stay clear of the bottom navigation bar ---- */
@media (max-width: 760px) {
  .cer-summary { width: 100%; }
  .cer-summary h2 { font-size: 1.3rem; }
  .cer-summary .sum-grid, .sum-grid { grid-template-columns: 1fr; gap: 12px; }
  .sum-row { flex-wrap: wrap; align-items: center; }
  .sum-who { flex: 1 1 140px; min-width: 0; overflow-wrap: break-word; }
  .sum-gone { margin-left: 0; width: 100%; padding: 8px 12px; font-size: 0.8rem; }
  body:not(.tv) .lb-hint, body:not(.tv):has(.cer-nav) .lb-hint { bottom: calc(84px + var(--sab)); font-size: 0.95rem; padding: 8px 18px; max-width: 92vw; white-space: normal; text-align: center; }
  body:not(.tv) .cer-nav { bottom: calc(84px + var(--sab)); }
  body:not(.tv) .cer-nav-btn { padding: 8px 16px; font-size: 0.9rem; }
  .cer { gap: 12px; padding-bottom: 150px; min-height: 0; }
  .cer-ladder { width: 100%; }
  .cer-row { padding: 6px 12px; gap: 10px; }
  .cer-podium { width: 100%; gap: 6px; }
  .pod .cer-name { font-size: 0.95rem; overflow-wrap: break-word; word-break: normal; hyphens: manual; }
  .pod .cer-people { font-size: 0.72rem; overflow-wrap: break-word; }
  .pod .cer-pts, .pod.p1.in .cer-pts { font-size: 1.1rem; }
  .pod-card { padding: 8px 4px; min-height: 100px; }
  .cer-draw { width: 100%; max-height: none; }
  .draw-slot { font-size: 1.6rem; padding: 10px 12px; }
  .draw-winners { grid-template-columns: 1fr; max-height: 38vh; }
  .draw-go, .draw-next { width: 100%; max-width: 360px; padding: 14px 20px; }
  .draw-winners li { padding: 6px 12px; }
}

/* during the closing ceremony the page heading and the Ranking / Rules tabs are out of the way: logo and tournament name stay */
body.ceremony .player-tabs { display: none; }
body.ceremony .title-row h1 { display: none; }
body.ceremony .title-row p.muted { font-size: clamp(1.1rem, 4.2vw, 1.6rem); font-weight: 700; color: var(--text); margin: 0; }

/* phones: ladder rows grow with their text instead of using the fixed TV row height */
@media (max-width: 760px) {
  .cer-ladder { --rh: auto; gap: 8px; }
  .cer-row { height: auto; min-height: 64px; padding: 8px 12px; }
  .cer-row .cer-name { font-size: 1.05rem; line-height: 1.2; }
  .cer-row .cer-people { font-size: 0.78rem; }
  .cer-row .cer-extra { font-size: 0.65rem; }
  .cer-row .cer-pts { font-size: 1.15rem; }
  .cer-row .cer-rank { width: 40px; height: 40px; font-size: 1.05rem; }
}

/* the documents card: report and protocols as sections of one card */
.doc + .doc { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }
.doc h3 { margin: 0 0 6px; }

/* ---- account page on a computer: the menu becomes a centred grid of tiles instead of a left-aligned phone list ---- */
@media (min-width: 900px) {
  .acc-hero { margin-bottom: 70px; }
  .acc-menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 8px 0 32px; }
  .acc-menu li { display: flex; }
  .acc-menu li form { display: flex; width: 100%; margin: 0; }
  .acc-menu a, .acc-menu button {
    flex-direction: column; justify-content: center; align-items: center; gap: 10px; text-align: center;
    min-height: 118px; padding: 20px 12px; font-size: 0.92rem; font-weight: 600;
    background: var(--card); border: 1px solid var(--border); border-radius: 16px;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  }
  .acc-menu a:hover, .acc-menu button:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
  .acc-menu svg { width: 34px; height: 34px; }
  .acc-menu li form button { width: 100%; }
  main.container h2 { margin-top: 36px; }
  .acc-identity { margin-bottom: 18px; }
}
.acc-cols { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 28px; }
.acc-card h2 { margin-top: 0; }
.acc-card .kv { max-width: none !important; }
@media (min-width: 900px) { .acc-cols { grid-template-columns: 1fr 1fr; align-items: start; } }
main.container .acc-card h2 { margin-top: 0; }

/* the draw view: the hint is replaced by the button inside the panel, so the panel can use the room; compact rows keep the newest winners visible */
.cer-draw { max-height: calc(100vh - 160px - 24vh - 40px); }
.cer-draw h2 { font-size: clamp(1.1rem, 2.2vw, 1.8rem); margin-bottom: 6px; }
.draw-slot { font-size: clamp(1.3rem, min(4vw, 6vh), 3.4rem); padding: clamp(4px, 1vh, 10px) 16px; }
.draw-actions { margin-top: 8px; }
.draw-go, .draw-next { padding: 8px 28px; font-size: clamp(0.95rem, 1.3vw, 1.25rem); }
.draw-winners { margin-top: 8px; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.draw-winners li { font-size: clamp(0.85rem, 1.15vw, 1.05rem); padding: 3px 10px; gap: 2px 8px; align-items: center; }
.draw-absent { padding: 2px 9px; font-size: 0.7rem; white-space: nowrap; }
@media (max-width: 760px) { .cer-draw { max-height: none; } .draw-winners li { padding: 6px 10px; } }

/* ---- keyboard focus and the states of a button: the same everywhere */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
:root[data-theme="dark"] { --focus: #8FD0E4; }
.btn:focus-visible, button:focus-visible, a.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn:active { transform: none; filter: brightness(0.94); }
.btn:disabled, .btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; filter: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; } }

/* ---- sponsors: the bigger the sponsor, the stronger the emphasis (slide, partners page, organiser's list) */
.tier-chip { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: 0.8rem; font-weight: 600; line-height: 1.5; border: 1px solid var(--border); color: var(--muted); background: transparent; }
.tier-chip.tier-main { background: var(--accent); border-color: var(--accent); color: #0E2A33; }
.tier-chip.tier-partner { border-color: var(--text); color: var(--text); }
.sponsor-row.tier-main { box-shadow: inset 5px 0 0 var(--accent); }
.sponsor-row.tier-partner { box-shadow: inset 5px 0 0 var(--text); }
.sponsor-row .sponsor-set { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sponsor-row .sponsor-set select { width: auto; margin: 0; padding: 6px 8px; }
.sponsor-row .sponsor-set label { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 0.9rem; }
.sponsor-row .sponsor-set input { width: 64px; margin: 0; padding: 6px 8px; }
.sponsor-round { margin: 8px 0 0; }
.showcase .slide.sponsor .tag { text-transform: none; letter-spacing: 0; font-size: 0.8rem; }
.showcase .slide.sponsor.tier-partner .tag { border: 1px solid #0E2A33; color: #0E2A33; padding: 1px 8px; border-radius: 3px; }
.showcase .slide.sponsor.tier-main { padding: 6% 7% 8%; box-shadow: inset 0 10px 0 #FFD21F; }
.showcase .slide.sponsor.tier-main .tag { background: #FFD21F; color: #0E2A33; padding: 2px 10px; border-radius: 3px; font-size: 0.95rem; top: 20px; }
.showcase .slide.sponsor.tier-main img { max-height: 82%; }
.showcase .slide.sponsor.tier-main .name { font-size: 1.5em; }
body.tv .showcase .slide.sponsor.tier-main { padding: 3% 5% 3%; }
body.tv .showcase .slide.sponsor.tier-main .name { font-size: 2rem; }
.partner-grid .partner.tier-main { grid-column: span 2; border-top: 6px solid var(--accent); padding-top: 18px; }
.partner-grid .partner.tier-main img { max-height: 200px; }
.partner-grid .partner.tier-main strong { font-size: 1.5rem; }
.partner-grid .partner.tier-partner { border-top: 4px solid var(--text); }
.partner-grid .partner.tier-supporter img { max-height: 80px; }
.partner .tier-chip { align-self: flex-start; }

.sponsor-add { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
.sponsor-add .btn { grid-column: 1 / -1; justify-self: start; }
@media (max-width: 760px) { .sponsor-add { grid-template-columns: 1fr; } }

/* ---- Mata, stage 2: the ranking as plain rows (medal tabs for places 1 to 3), numbers in the condensed face, no amber text on light backgrounds */
.points { color: var(--text); font-family: var(--font-display); font-size: 1.25em; }
.biggest-length { font-family: var(--font-display); font-size: 2rem; line-height: 1; color: var(--text); }
.biggest-species { letter-spacing: 0; font-size: var(--fs-md); }
.biggest-card { border-radius: 4px; }
body:not(.tv) .leaderboard-list { gap: 0; border-top: 3px solid var(--text); }
body:not(.tv) .lb-row { background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; padding: 14px 0; gap: 8px 14px; }
body:not(.tv) .lb-rank { width: 40px; height: 40px; border-radius: 4px; background: transparent; color: var(--text); font: 700 1.8rem var(--font-display); }
body:not(.tv) .lb-rank.rank-1 { background: var(--medal-gold); color: #0E2A33; }
body:not(.tv) .lb-rank.rank-2 { background: var(--medal-silver); color: #0E2A33; }
body:not(.tv) .lb-rank.rank-3 { background: var(--medal-bronze); color: #0E2A33; }
body:not(.tv) .lb-name { font-size: 1.3rem; }
body:not(.tv) .lb-points { font: 700 2.1rem/1 var(--font-display); color: var(--text); }
body:not(.tv) .lb-points small { font: 400 0.95rem var(--font-body, inherit); color: var(--muted); }
body:not(.tv) .lb-rounds .chip { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 3px; font-size: 0.92rem; }
body:not(.tv) .leaderboard-list > .lb-empty { background: transparent; border-radius: 4px; }
/* the list of tournaments: plain rows under a heavy rule */
.comp-list { gap: 0; border-top: 3px solid var(--text); }
.comp-card { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }

/* account tiles, slideshow frame, galleries: the same small radius and the ink outline */
.acc-menu a, .acc-menu button { border-radius: 4px; }
@media (min-width: 721px) { .acc-menu a, .acc-menu button { border-radius: 4px; border-color: var(--text); color: var(--text); } .acc-menu a:hover, .acc-menu button:hover { background: var(--brand-100); } }
.showcase { border-radius: 4px; }
.gallery-item { border-radius: 4px; } .gallery-item img { border-radius: 3px; }
.empty-card { border-radius: 4px; }
.sponsor-row { border-radius: 4px; }

/* ---- the account page (Mata): on a computer two columns, identity and menu beside the content; on a phone one column */
.acc-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 48px; align-items: start; padding-top: 8px; }
.acc-side { position: sticky; top: 16px; }
.acc-avatar { width: 120px; height: 120px; border-radius: 4px; border: 0; margin: 0; background: var(--brand-100); box-shadow: none; display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer; overflow: visible; }
.acc-avatar img { border-radius: 4px; }
.acc-identity { text-align: left; margin: 16px 0 0; }
.acc-name { font: 700 2.4rem/1 var(--font-display); color: var(--text); margin: 0 0 8px; }
.acc-score { display: flex; align-items: baseline; gap: 8px; }
.acc-score .num { font-size: 2.2rem; line-height: 1; }
.acc-score small { color: var(--muted); font-size: 1rem; }
.acc-team { margin-top: 6px; font-size: 1.05rem; color: var(--text); font-weight: 600; letter-spacing: 0; }
.acc-side .acc-menu { display: block; list-style: none; padding: 0; margin: 22px 0 0; border-top: 3px solid var(--text); }
.acc-side .acc-menu li { display: block; border-bottom: 1px solid var(--border); }
.acc-side .acc-menu li form { display: block; margin: 0; }
.acc-side .acc-menu a, .acc-side .acc-menu button { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; width: 100%; min-height: 0; padding: 13px 4px;
  background: transparent; border: 0; border-radius: 0; box-shadow: none; transform: none; color: var(--text); font: 600 1.08rem var(--sans, inherit); text-align: left; text-decoration: none; cursor: pointer; }
.acc-side .acc-menu a:hover, .acc-side .acc-menu button:hover { background: var(--brand-100); border-color: transparent; transform: none; box-shadow: none; color: var(--text); }
.acc-side .acc-menu svg { width: 24px; height: 24px; color: var(--brand-700); stroke: currentColor; }
.acc-main h2:first-child, .acc-main > h2 { margin-top: 0; }
.acc-main .acc-cols { grid-template-columns: 1fr; margin-top: 34px; }
.acc-main .acc-card { border: 0; border-top: 3px solid var(--text); border-radius: 0; background: transparent; padding: 14px 0 0; }
.acc-main .catch-gallery { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.acc-main .catch-gallery-item { border-radius: 4px; border: 0; background: transparent; }
.acc-main .catch-gallery-item img { height: 130px; border-radius: 4px; }
.acc-main .catch-gallery-caption { padding: 6px 0 0; font-size: 0.95rem; color: var(--text); }
@media (min-width: 1100px) { .acc-main .acc-cols { grid-template-columns: 1fr 1fr; gap: 40px; } }
/* leaving FishCup: one quiet line under everything, far from the everyday buttons */
.acc-leave { margin: 44px 0 0; padding-top: 14px; border-top: 1px solid var(--border); }
.acc-leave a { display: inline-flex; align-items: center; min-height: 44px; color: var(--bad-fg); font-weight: 600; }
@media (max-width: 899px) {
  .acc-layout { grid-template-columns: 1fr; gap: 22px; }
  .acc-side { position: static; }
  .acc-side .acc-avatar-form { float: left; margin-right: 16px; }
  .acc-avatar { width: 88px; height: 88px; }
  .acc-identity { margin-top: 0; min-height: 88px; }
  .acc-name { font-size: 2rem; }
  .acc-side .acc-menu { clear: both; }
}

/* the tournament's payment card (templates/_pay_card.html) */
.pay-card.pay-due { border-color: var(--accent); }
.pay-price { font-size: 1.1rem; }
.pay-price strong { font-size: 1.35rem; }
.pay-invoice { border: 0; padding: 0; margin: 0 0 var(--s3); min-width: 0; display: grid; gap: 4px; }
.pay-invoice legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.pay-quote { margin-top: var(--s4); }
.pay-quote summary { cursor: pointer; font-weight: 600; }
.rule-form .pay-invoice { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); column-gap: 16px; }
.rule-form .pay-invoice legend, .rule-form .pay-invoice label.check { grid-column: 1 / -1; }

/* fields that belong to one choice only: PZW club (become_organizer.html), company invoice (_invoice_fields.html) */
.org-form:not(:has(input[value="pzw"]:checked)) .pzw-only { display: none; }
.pay-invoice:not(:has(input[value="company"]:checked)) .company-only { display: none; }
.auth-card label.check { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; color: var(--text); font-weight: 600; }
.auth-card label.check input { width: auto; min-height: 0; flex: none; margin: 0; accent-color: var(--accent); }

/* Phones: every form field takes the whole row. A checkbox row asks for two columns on a computer (grid-column: span 2), which on a
   one-column phone grid silently added a narrow second column and squeezed everything else (the vertical "Insert the template",
   the round "Save" button). */
@media (max-width: 860px) {
  .rule-form > *, .rule-form > label.check, .rule-form > .span-2, .form-grid > *, .form-grid > label.check, .form-grid > .span-2 { grid-column: 1 / -1; }
}

/* fields made of several controls (templates/_tournament_fields.html, Details page) */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.field-label { font-size: .9rem; color: var(--muted); font-weight: 500; }
.field textarea { width: 100%; }
.rules-tpl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.rules-tpl .btn { flex: none; }
.rules-tpl small { flex: 1 1 240px; }
.preset-form select { width: 100%; }

/* one calendar for a range, one clock for hours (static/js/pickers.js) */
.date-range.picker-on > input[type=date], .date-range.picker-on > input[type=datetime-local],
.time-range.picker-on > input[type=time] { display: none; }
.date-range { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.date-range .range-field, .date-range .flatpickr-input { flex: 1 1 220px; min-width: 0; cursor: pointer; }
.range-clear { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; padding: 4px; }
.time-range { position: relative; display: flex; gap: 8px; }
.time-range-btn { width: 100%; min-height: 44px; text-align: left; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--input-bg, var(--card)); color: var(--text); font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; }
.time-range-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow); }
.time-range-panel[hidden] { display: none; }
.trp-col { display: flex; flex-direction: column; gap: 6px; }
.trp-label { font-size: .85rem; color: var(--muted); }
.trp-row { display: flex; align-items: center; gap: 4px; }
.trp-row select { width: auto; min-width: 64px; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.trp-done { min-height: 40px; }
.field textarea { margin: 0; }

/* the price lines on the payment card and the judge choice (templates/_pay_card.html, _tournament_fields.html) */
.pay-lines { width: 100%; max-width: 460px; border-collapse: collapse; margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
.pay-lines td { padding: 5px 0; border-bottom: 1px solid var(--border); }
.pay-lines td:last-child { text-align: right; white-space: nowrap; padding-left: 16px; }
.pay-lines .pay-sum td { border-top: 1px solid var(--muted); }
.pay-lines .pay-total td { border-bottom: 0; font-size: 1.15rem; }
.pay-lines .pay-total strong { font-size: 1.35rem; }
.judge-choice { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; display: grid; gap: 10px; }
.judge-choice legend { font-size: .9rem; color: var(--muted); padding: 0; margin-bottom: 6px; }
.judge-choice label.check { align-items: flex-start; margin: 0; }
.judge-choice[disabled] { opacity: .7; }

/* 'confirm your e-mail' bar (base.html): the text, then the button; under each other on a phone */
.verify-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 0 16px;
  padding: 10px 14px; background: var(--flash-bg); border: 1px solid var(--flash-border); border-radius: 4px; }
.verify-bar span { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.verify-bar .btn { padding: 8px 18px; min-height: 40px; }

/* two-step login (account_2fa.html, login_2fa.html) */
.twofa .qr-box { display: inline-block; margin: 10px 0; padding: 0; line-height: 0; border-radius: 4px; overflow: hidden; }
.twofa .qr-box svg { width: 200px; height: 200px; max-width: 100%; }
.twofa .totp-key { overflow-wrap: anywhere; letter-spacing: .04em; }
.twofa-steps { padding-left: 1.2em; display: grid; gap: 14px; }
.twofa-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 8px; }
.twofa-form label { flex: 1 1 200px; }
.code-input { font-size: 1.3rem; letter-spacing: .2em; max-width: 12ch; }
.backup-codes { columns: 2; padding-left: 1.6em; font-size: 1.05rem; line-height: 1.9; }
