/* Тема: тёмно-синий + золото (в духе баннера abcapital / флага) */
:root {
  --bg: #0a1628;
  --bg-elevated: #0e2040;
  --surface: #132a4a;
  --surface2: #183358;
  --border: #2a5080;
  --border-gold: rgba(232, 197, 71, 0.35);
  --text: #f4f7fb;
  --muted: #9bb4d4;
  --muted2: #7a95b8;
  --gold: #e8c547;
  --gold-dim: #c4a32e;
  --accent: #1e5eb8;
  --accent-bright: #2d6fc9;
  --accent-dim: #184a9e;
  --ok: #2d9f5a;
  --warn: #e8a23a;
  --glow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(30, 94, 184, 0.28), transparent 55%),
    linear-gradient(180deg, #071020 0%, var(--bg) 40%, #060e1c 100%);
  color: var(--text);
  line-height: 1.5;
  padding-left: max(0px, env(safe-area-inset-left, 0px));
  padding-right: max(0px, env(safe-area-inset-right, 0px));
  padding-bottom: max(0px, env(safe-area-inset-bottom, 0px));
}

.header,
.main,
.footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

.header {
  padding-top: max(1rem, env(safe-area-inset-top, 0px));
}

.lang-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

.btn-help {
  margin-inline-start: auto;
  padding: 0.45rem 0.85rem;
  min-height: 40px;
  font-size: 0.85rem;
  background: rgba(19, 42, 74, 0.6);
  border-color: var(--border);
  color: var(--muted);
}

.btn-help:hover {
  color: var(--text);
  border-color: var(--gold);
  background: var(--surface2);
}

.lang-label {
  font-size: 0.85rem;
  color: var(--muted2);
}

.select {
  min-height: 40px;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  max-width: 100%;
}

.lang-select {
  min-width: 12rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.65rem;
}

.brand-logo {
  display: block;
  width: 44px;
  height: 44px;
  max-width: 44px;
  max-height: 44px;
  flex: 0 0 44px;
  object-fit: contain;
}

.brand-text {
  min-width: 0;
}

.brand-name {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: var(--text);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.brand-tagline {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--gold-dim);
}

.lede {
  margin: 0;
  color: var(--muted2);
  font-size: 0.95rem;
}

.card {
  background: linear-gradient(145deg, var(--surface) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-top-color: var(--border-gold);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--glow);
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.subheading {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
}

.hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted2);
}

.hint.hint-warn {
  color: var(--warn);
}

.pixel {
  width: 1px;
  height: 1px;
  position: absolute;
  left: -9999px;
  top: -9999px;
  opacity: 0;
  pointer-events: none;
}

textarea {
  width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  resize: vertical;
  margin-bottom: 1rem;
}

.btn {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

a.btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

.btn.primary {
  background: linear-gradient(180deg, var(--accent-bright) 0%, var(--accent-dim) 100%);
  border-color: var(--gold);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.btn.primary:hover {
  background: linear-gradient(180deg, #3a7fd4 0%, var(--accent) 100%);
  border-color: var(--gold);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.live-share-block {
  margin-top: 0.5rem;
}

.live-link-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
  margin-top: 0.5rem;
}

.live-link-meta {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
  line-height: 1.45;
}

.live-link-meta--expired {
  color: #b91c1c;
  font-weight: 600;
}

.live-link-url {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: 2.5rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
}

.live-link-copy {
  flex: 0 0 auto;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.live-link-copy:active {
  transform: scale(0.97);
}

.live-link-copy.is-copied,
.btn.is-copied {
  background: rgba(22, 163, 74, 0.12);
  border-color: #16a34a;
  color: #15803d;
  font-weight: 600;
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 10050;
  transform: translateX(-50%) translateY(120%);
  max-width: min(90vw, 22rem);
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  background: #0f172a;
  color: #f8fafc;
  font: 600 0.9rem/1.3 system-ui, sans-serif;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.copy-toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.hidden {
  display: none !important;
}

.save-status {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.25em;
}

.matrix-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  margin-left: -0.25rem;
  margin-right: -0.25rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

#standings {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Числовые таблицы оставляем LTR при арабской вёрстке страницы */
[dir="rtl"] .poule-table,
[dir="rtl"] .standings-table,
[dir="rtl"] .bracket-full {
  direction: ltr;
}

.poule-table {
  border-collapse: collapse;
  font-size: 0.8rem;
}

.poule-table th,
.poule-table td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  text-align: center;
  min-width: 3.5rem;
}

.poule-table th.corner {
  background: var(--surface2);
}

.poule-table th.name-head {
  text-align: left;
  min-width: 8rem;
  max-width: 12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poule-table td.dash {
  background: #121820;
  color: var(--muted);
}

.poule-table input.cell {
  width: 3.25rem;
  padding: 0.25rem;
  border: none;
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text);
  text-align: center;
  font: inherit;
}

.poule-table input.cell:invalid {
  outline: 1px solid var(--warn);
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.standings-table th,
.standings-table td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  text-align: left;
}

.standings-table th {
  color: var(--muted);
  font-weight: 600;
}

.standings-table .num {
  text-align: right;
}

.place-badge {
  display: inline-block;
  min-width: 2rem;
  font-weight: 700;
  color: var(--gold);
}

.place-badge--gold {
  color: #0f172a;
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35);
}

.place-badge--silver {
  color: #0f172a;
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.4);
}

.place-badge--bronze {
  color: #0f172a;
  background: linear-gradient(135deg, #fdba74, #c2410c);
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.35);
}

.standings-row--medal td {
  background: rgba(255, 255, 255, 0.04);
}

.standings-row--place-1 td:first-child {
  box-shadow: inset 3px 0 0 #f59e0b;
}

.standings-row--place-2 td:first-child {
  box-shadow: inset 3px 0 0 #94a3b8;
}

.standings-row--place-3 td:first-child {
  box-shadow: inset 3px 0 0 #c2410c;
}

.fencers-dup-hint {
  color: #f87171;
  font-weight: 600;
  margin: 0.35rem 0 0;
}

.fencers-input--locked {
  opacity: 0.85;
  cursor: not-allowed;
  background: rgba(15, 23, 42, 0.35);
}

.final-places-block {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.final-places-table .place-badge {
  font-size: 1.05rem;
}

.diploma-setup {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

.diploma-setup__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.85rem;
  margin: 0.75rem 0 0.85rem;
}

@media (max-width: 640px) {
  .diploma-setup__grid {
    grid-template-columns: 1fr;
  }
}

.diploma-setup__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted2, #64748b);
}

.diploma-setup__input {
  width: 100%;
  font-weight: 500;
}

.diploma-setup__link-row {
  margin-top: 0.65rem;
}

.diploma-setup__link {
  width: 100%;
}

.diploma-setup__qr {
  margin-top: 0.85rem;
  text-align: center;
}

.diploma-setup__qr-host {
  display: inline-block;
  padding: 0.5rem;
  background: #fff;
  border-radius: 0.5rem;
  border: 1px solid var(--border, #e2e8f0);
}

.sp-update-banner {
  position: fixed;
  z-index: 10000;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: calc(100vw - 1.5rem);
  padding: 0.7rem 0.9rem;
  border-radius: 0.75rem;
  background: #0f172a;
  color: #f8fafc;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(56, 189, 248, 0.45);
  font-size: 0.95rem;
}

.sp-update-banner__btn {
  appearance: none;
  border: 0;
  border-radius: 0.5rem;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: #38bdf8;
  color: #0f172a;
  white-space: nowrap;
}

.sp-update-banner__btn:hover {
  background: #7dd3fc;
}

.bracket-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.bracket-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.bracket-list li:last-child {
  border-bottom: none;
}

.bracket-full {
  margin-top: 1rem;
}

/* Горизонтальная сетка: колонки раундов. Без min() в min-width — иначе в части браузеров колонки схлопываются в 0 и всё наезжает. */
.bracket-board {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 0.25rem;
  margin-top: 0.5rem;
  padding: 0.35rem 0 0.5rem;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.bracket-column {
  flex: 0 0 auto;
  width: 16.75rem;
  max-width: 100%;
  min-width: 12rem;
  box-sizing: border-box;
}

.bracket-connector {
  flex: 0 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  position: relative;
  flex-shrink: 0;
  color: var(--gold);
  opacity: 0.9;
}

.bracket-connector::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 12%;
  bottom: 12%;
  width: 0;
  border-left: 1px solid var(--border-gold);
  transform: translateX(-50%);
  pointer-events: none;
}

.bracket-connector__chev {
  position: relative;
  z-index: 1;
  font-size: 0.75rem;
  line-height: 1;
  text-shadow: 0 0 10px rgba(232, 197, 71, 0.45);
}

.bracket-round {
  margin: 0;
  padding: 0.75rem 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(19, 42, 74, 0.65) 0%, rgba(10, 22, 40, 0.9) 100%);
  box-shadow: inset 0 1px 0 rgba(232, 197, 71, 0.12);
  min-height: 4rem;
  position: relative;
  z-index: 0;
  overflow: visible;
}

.bracket-round-title {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  font-weight: 700;
}

.bracket-round .hint {
  margin-bottom: 0.5rem;
}

.bracket-matches {
  margin: 0;
  width: 100%;
  display: block;
}

.match-card {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  background: var(--bg-elevated);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.65rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.match-card:last-child {
  margin-bottom: 0;
}

.match-head {
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.match-body {
  display: block;
}

.match-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: stretch;
}

.match-bout-no {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  padding: 0 0.15rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.match-fencers {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.match-fencers .match-side {
  width: 100%;
}

.match-score-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.match-score-wrap .match-score {
  width: 5.5rem;
}

.match-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.match-side {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  text-align: left;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.match-side:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.match-side.winner {
  border-color: var(--ok);
  background: rgba(45, 159, 90, 0.12);
  outline: 1px solid rgba(45, 159, 90, 0.35);
}

.match-tools {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.match-score {
  flex: 0 0 auto;
  width: 8.5rem;
  max-width: 100%;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.match-score:disabled {
  opacity: 0.6;
}

.bracket-champion {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(90deg, rgba(232, 197, 71, 0.12) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--text);
}

.bye {
  color: var(--ok);
}

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

/* TEMP test helper — set DEV_RANDOM_POULES=false in tournament.js to hide */
.btn--dev-random {
  opacity: 0.4;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--border);
  min-height: 2rem;
  padding: 0.25rem 0.55rem;
}

.btn--dev-random:hover {
  opacity: 0.9;
  color: var(--text);
}

.footer p {
  margin: 0;
}

.footer-madeby {
  margin-top: 0.5rem;
  color: var(--muted2);
}

.footer-madeby a {
  color: var(--muted2);
  text-decoration: underline;
}

.footer-support {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted2);
  line-height: 1.45;
}

.footer-usdt {
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
  word-break: break-all;
  user-select: all;
}

.footer-donate-link {
  color: var(--muted2);
  text-decoration: underline;
}

.footer-donate-link:hover {
  color: var(--text);
}

.footer-donate-net {
  opacity: 0.85;
}

.print-root {
  display: none;
}

.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
}

.help-overlay:not(.hidden) {
  display: flex;
}

.help-dialog {
  width: min(100%, 34rem);
  max-height: min(88vh, 720px);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-top-color: var(--border-gold);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

.help-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.help-title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
}

.help-close {
  flex: 0 0 auto;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.help-body {
  padding: 0.85rem 1rem 1rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.88rem;
  color: var(--text);
}

.help-list {
  margin: 0;
  padding-left: 1.15rem;
}

.help-list li {
  margin-bottom: 0.65rem;
}

.help-list code {
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.help-note {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  color: var(--muted2);
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  @page bracketLandscape {
    size: A4 landscape;
    margin: 10mm;
  }

  /* Hide the whole app to avoid blank pages; show only print-root */
  body.printing > :not(.print-root) {
    display: none !important;
  }

  body.printing .print-root {
    display: block;
    position: static;
    width: auto;
    color: #000;
    background: #fff;
    padding: 0;
  }

  body.printing .print-root .print-doc {
    display: block;
  }

  body.printing .print-root .print-section {
    break-inside: avoid;
  }

  body.printing .print-root .print-section--standings {
    margin-top: 6mm;
  }

  body.printing .print-root .print-head {
    margin: 0 0 2.5mm;
  }

  body.printing .print-root .print-title {
    margin: 0;
    font-size: 11.5pt;
    font-weight: 700;
  }

  body.printing .print-root .print-subtitle {
    margin: 0.8mm 0 0;
    font-size: 9pt;
    color: #333;
  }

  body.printing .print-root table {
    width: 100%;
    border-collapse: collapse;
    font-size: 7pt;
  }

  body.printing .print-root th,
  body.printing .print-root td {
    border: 1px solid #333;
    padding: 1.1mm 1.2mm;
    color: #000;
  }

  body.printing .print-root .poule-table th.name-head {
    max-width: 38mm;
    white-space: normal;
  }

  body.printing .print-root .poule-table th,
  body.printing .print-root .poule-table td {
    min-width: 0;
  }

  body.printing .print-root .poule-table .corner {
    width: 1%;
    white-space: nowrap;
  }

  /* Landscape bracket page */
  body.printing .print-root .print-bracket-page {
    page: bracketLandscape;
    break-before: page;
    margin-top: 0;
  }

  body.printing .print-root .print-bracket-wrap {
    margin-top: 3mm;
  }

  body.printing .print-root .print-bracket {
    display: grid;
    grid-auto-flow: column;
    /* Tuned to fit 6 columns on A4 landscape */
    grid-auto-columns: minmax(38mm, 1fr);
    gap: 4mm;
    align-items: start;
  }

  body.printing .print-root .print-bracket-col {
    display: flex;
    flex-direction: column;
    gap: 2.5mm;
  }

  body.printing .print-root .print-bracket-round {
    font-size: 9pt;
    font-weight: 700;
    margin-bottom: 1mm;
  }

  body.printing .print-root .print-bracket-match {
    border: 1px solid #333;
    border-radius: 2mm;
    padding: 1.4mm 1.6mm;
    break-inside: avoid;
    background: #fff;
  }

  body.printing .print-root .print-bracket-match-main {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.5mm;
    align-items: center;
  }

  body.printing .print-root .print-bracket-bout-no {
    font-size: 7pt;
    color: #666;
    font-weight: 700;
    min-width: 4mm;
    text-align: center;
  }

  body.printing .print-root .print-bracket-fencers {
    min-width: 0;
  }

  body.printing .print-root .print-bracket-score-wrap {
    min-width: 10mm;
    text-align: center;
  }

  body.printing .print-root .print-bracket-score {
    font-size: 8pt;
    font-variant-numeric: tabular-nums;
  }

  body.printing .print-root .print-bracket-match-head {
    font-size: 7pt;
    color: #333;
    margin-bottom: 1.2mm;
  }

  body.printing .print-root .print-bracket-side {
    font-size: 8pt;
    line-height: 1.2;
    padding: 0.6mm 0;
  }

  body.printing .print-root .print-bracket-side.winner {
    font-weight: 700;
    text-decoration: underline;
  }

  body.printing .print-root .print-bracket-champion {
    margin-top: 4mm;
    font-size: 9pt;
    font-weight: 700;
  }
}

/* Узкий экран: сетка «вниз» + стрелка вниз между раундами */
@media (max-width: 900px) {
  .bracket-board {
    flex-direction: column;
    overflow-x: visible;
  }

  .bracket-column {
    min-width: 100%;
    max-width: none;
  }

  .bracket-connector {
    flex: 0 0 auto;
    min-height: 1.5rem;
    width: 100%;
  }

  .bracket-connector::before {
    left: 8%;
    right: 8%;
    top: 50%;
    bottom: auto;
    height: 0;
    width: auto;
    border-left: none;
    border-top: 1px solid var(--border-gold);
    transform: translateY(-50%);
  }

  .bracket-connector__chev {
    transform: rotate(90deg);
  }
}

/* Телефоны: крупнее зоны нажатия, без микроскопического текста в инпутах (iOS не зумит при фокусе) */
@media (max-width: 640px) {
  .header h1 {
    font-size: 1.35rem;
  }

  .btn {
    min-height: 44px;
    padding: 0.65rem 1rem;
  }

  .btn-row .btn {
    flex: 1 1 auto;
    min-width: min(100%, 12rem);
  }

  .poule-table {
    font-size: 0.75rem;
  }

  .poule-table th,
  .poule-table td {
    min-width: 3rem;
    padding: 0.3rem 0.35rem;
  }

  .poule-table th.name-head {
    min-width: 6.5rem;
    max-width: 9rem;
    font-size: 0.7rem;
    white-space: normal;
    word-break: break-word;
    vertical-align: middle;
  }

  .poule-table input.cell {
    width: 2.75rem;
    min-height: 40px;
    font-size: 16px;
    padding: 0.35rem 0.2rem;
  }

  .standings-table {
    font-size: 0.8rem;
  }

  .standings-table th,
  .standings-table td {
    padding: 0.45rem 0.4rem;
  }
}
