:root {
  --paper: #eef4f0;
  --paper-deep: #d7e4dc;
  --ink: #10211c;
  --muted: #5c7068;
  --card: #ffffff;
  --line: #d3e3da;
  --accent: #0e9f6e;
  --gold: #e2b340;
  --side: #0b1c18;
  --side-2: #143028;
  --side-line: #245043;
  --side-text: #e8f4ee;
  --winner: color-mix(in srgb, var(--accent) 16%, white);
  --shadow: 0 14px 34px rgba(16, 33, 28, 0.08);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -10%, rgba(14, 159, 110, 0.16), transparent 34%),
    linear-gradient(180deg, #f7fbf8 0%, var(--paper) 220px);
  font-family: Manrope, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; color: inherit; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, white);
  outline-offset: 2px;
}

.layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 22px 16px 28px;
  background:
    linear-gradient(180deg, rgba(226, 179, 64, 0.14), transparent 120px),
    linear-gradient(180deg, #12352c 0%, var(--side) 240px);
  color: var(--side-text);
  border-right: 1px solid #071410;
}

.side::-webkit-scrollbar { width: 10px; }
.side::-webkit-scrollbar-thumb { background: #245043; border-radius: 999px; }

.brand { padding: 4px 6px 8px; }

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 0.9;
  text-transform: uppercase;
}

.mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background:
    linear-gradient(#e8f4ee, #e8f4ee) 6px 7px / 12px 2px no-repeat,
    linear-gradient(#e8f4ee, #e8f4ee) 16px 7px / 2px 8px no-repeat,
    linear-gradient(#e8f4ee, #e8f4ee) 16px 15px / 8px 2px no-repeat,
    linear-gradient(#e8f4ee, #e8f4ee) 22px 15px / 2px 8px no-repeat,
    var(--accent);
  box-shadow: 0 0 0 4px rgba(14, 159, 110, 0.2);
}

.brand-tag, .save-state { color: #b7d0c4; }

.brand-tag { margin: 10px 6px 16px; line-height: 1.45; }

.panel {
  margin-bottom: 12px;
  padding: 14px 12px 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  background: rgba(8, 22, 18, 0.45);
}

.panel h2, .sheet h2 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.panel h2 { color: var(--gold); }

.side label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
}

.side input, .side select, .side textarea, .row-add input {
  width: 100%;
  border: 1px solid var(--side-line);
  border-radius: 12px;
  background: var(--side-2);
  color: var(--side-text);
  color-scheme: dark;
  padding: 10px 12px;
}

.side textarea { resize: vertical; }

.check {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-weight: 600;
}

.check input { width: auto; accent-color: var(--accent); }

.split, .btn-row, .row-add, .swatches { display: flex; gap: 8px; }

.split > label, .split > * { flex: 1; }

.day-block { margin: 0 0 10px; padding-bottom: 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.day-block .help { margin-bottom: 6px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.help, .hint { margin: 0 0 10px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.side .help, .side .hint { color: #b7d0c4; }

.swatches { margin-bottom: 12px; }

.size-picks { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 10px; }

.size-picks button {
  border: 1px solid var(--side-line);
  background: var(--side-2);
  color: var(--side-text);
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
  font-weight: 700;
}

.size-picks button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.swatches button {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  cursor: pointer;
}

.participants {
  list-style: none;
  margin: 10px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.participant {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  grid-template-areas:
    "num name name"
    "num seed actions";
  gap: 6px;
  align-items: center;
}

.participant span { grid-area: num; }
.participant .name-input { grid-area: name; }
.participant [data-p-field="seed"] { grid-area: seed; width: 64px; }
.participant .mini { grid-area: actions; justify-self: end; }

.participant span {
  color: #b7d0c4;
  font-size: 12px;
  text-align: right;
}

.mini { display: flex; gap: 4px; }

.mini button, .icon-btn {
  border: 1px solid var(--side-line);
  background: transparent;
  color: var(--side-text);
  border-radius: 8px;
  min-width: 28px;
  height: 28px;
  cursor: pointer;
}

.btn {
  border: 1px solid var(--side-line);
  background: transparent;
  color: var(--side-text);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

.btn:hover, .size-picks button:hover, .mini button:hover, .icon-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 70%, white);
}

.btn-row { flex-wrap: wrap; margin-bottom: 8px; }

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-accent:hover { filter: brightness(1.08); }

.btn-block { width: 100%; margin-bottom: 12px; }

.btn-ghost { opacity: 0.8; }

.save-state { font-size: 12px; font-weight: 700; }

.stage { padding: 22px 28px 64px; min-width: 0; }

.hero {
  margin-bottom: 8px;
  padding: 18px 18px 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.live-clock {
  margin: 6px 0 0;
  padding: 0;
  background: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
}

.game-count { display: none; }

.btn-board, .board-exit {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 11px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  box-shadow: none;
}

.btn-board:hover, .board-exit:hover { border-color: var(--accent); color: var(--accent); }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  position: relative;
  z-index: 3;
}

.btn-board { margin-left: 0; text-decoration: none; }

.board-exit {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--accent);
  font-weight: 800;
}

.hero h1, .login-card h1, .brand-mark, .section-title, .tournament-card strong {
  font-family: "Barlow Condensed", Impact, sans-serif;
}

.hero h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 56px);
  letter-spacing: 0.02em;
  line-height: 0.9;
  font-weight: 700;
  text-transform: uppercase;
}

.subtitle, .meta, .progress { color: var(--muted); }

.subtitle { margin: 6px 0 0; font-size: 17px; font-weight: 600; }

.meta, .progress { margin: 8px 0 0; }

.rules {
  max-width: 720px;
  white-space: pre-wrap;
  background: #f6fbf8;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  padding: 12px 14px;
}

.champion {
  display: inline-flex;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--gold);
  font-weight: 800;
}

[hidden] { display: none !important; }

.bracket-logo {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin: 8px 0 2px;
}

.bracket-logo img {
  height: 72px;
  width: auto;
  display: block;
  background: transparent;
}

.bracket-section { margin-top: 22px; }

.section-title {
  width: min(420px, 100%);
  border: none;
  background: transparent;
  font-size: 30px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0 0 4px;
  color: var(--ink);
}

.board-scroll { overflow-x: auto; padding: 8px 0 20px; }

.board-inner {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 76px;
  min-width: max-content;
  padding-right: 12px;
}

.wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.wires path {
  fill: none;
  stroke: #9bb5a8;
  stroke-width: 2;
}

.round {
  width: 340px;
  flex: 0 0 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.round-name {
  width: 100%;
  border: 1px dashed transparent;
  background: transparent;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 4px;
  color: var(--muted);
}

.round-name:focus { border-color: var(--line); background: var(--card); border-radius: 8px; }

.round-matches {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 14px;
}

.match {
  position: relative;
  z-index: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 8px;
  overflow: hidden;
}

.match.is-live::before { background: #e11d48; }

.play-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 2px;
  flex-wrap: wrap;
}

.play-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #d7e4dc;
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.play-chip.is-live { background: #e11d48; color: #fff; }
.play-chip.is-over { background: #e2b340; color: #10211c; }

.limit-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
}

.limit-input { width: 64px; text-align: center; }

.limit-off {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}

body.public-view .limit-field,
body.public-view .limit-off,
.export-board .limit-field,
.export-board .limit-off { display: none !important; }
.play-chip.is-done { background: var(--ink); color: var(--gold); }

.play-clock {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.now-playing {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #10211c;
  color: #f4fff8;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.now-playing::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #e11d48;
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.28);
}

body.public-view .play-btn { display: none !important; }

.match::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.match-top, .match-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}

.time-input, .games-input {
  color: var(--ink);
  color-scheme: light;
  font-weight: 800;
}

.time-input { width: 108px; }

.day-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.games-field {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  color: var(--ink);
}

.games-input { width: 48px; text-align: center; }

.duration {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.venue-field {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.venue-field select {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6fbf8;
  color: var(--ink);
  font-weight: 800;
  padding: 4px 6px;
}

.game-times {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 8px 2px 0;
  padding: 0;
}

.game-times li {
  display: flex;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.game-times time { color: var(--ink); }

.code-input, .seed-input, .score-input, .name-input, .table-scroll input, .table-scroll select {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 6px;
}

.code-input { width: 72px; font-weight: 800; color: var(--accent); }

.team {
  display: grid;
  grid-template-columns: auto 42px minmax(0, 1fr) 52px;
  gap: 4px;
  align-items: center;
  margin-top: 4px;
  border-radius: 10px;
  padding: 2px;
}

.team.is-winner { background: var(--winner); box-shadow: inset 3px 0 0 var(--accent); }

.pick {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.team.is-winner .pick {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.name-input {
  width: 100%;
  min-width: 0;
  font-weight: 700;
  resize: none;
  overflow: hidden;
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  field-sizing: content;
}

.participant .name-input,
.match .name-input,
.table-scroll .name-input {
  padding: 2px 4px;
  min-height: 1.3em;
  resize: none;
}
.seed-input, .score-input { width: 100%; text-align: center; font-weight: 800; }
.score-input { background: #f4faf7; border-radius: 8px; }

.match input:focus, .table-scroll input:focus, .table-scroll select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, white);
  background: white;
  border-color: var(--line);
}

.match-actions { margin-top: 6px; }

.linkish, .text-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-weight: 800;
}

.route-hint { margin: 6px 2px 0; font-size: 11px; color: var(--muted); }

.group-block { margin-top: 22px; min-width: 0; }

.standings-wrap {
  width: 100%;
  max-width: 720px;
  margin: 8px 0 14px;
  overflow-x: auto;
  min-width: 0;
  contain: inline-size;
}

.standings {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.standings .col-rank { width: 42px; }
.standings .col-num { width: 64px; }

.standings th, .standings td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--paper-deep);
}

.standings th {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f3faf6;
}

.standings td:not(:nth-child(2)), .standings th:not(:nth-child(2)) { text-align: center; }

.standings tr:last-child td { border-bottom: none; }

.group-matches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 12px;
}

.sheet { margin-top: 18px; }

.sheet-head p { margin: 4px 0 12px; color: var(--muted); }

.table-scroll {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; min-width: 1100px; }

th, td { padding: 8px; text-align: left; border-bottom: 1px solid var(--paper-deep); vertical-align: middle; }

th {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f3faf6;
}

td input, td select { width: 100%; min-width: 0; }

dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: min(92dvh, 900px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(11, 28, 24, 0.62); }

.dialog-head { display: flex; justify-content: space-between; align-items: center; }

.dialog-head h3 {
  margin: 0;
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: 28px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

dialog label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; font-size: 13px; font-weight: 700; }

dialog input, dialog select, dialog textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
  background: #f6fbf8;
}

dialog .icon-btn { color: var(--ink); border-color: var(--line); }

dialog .btn { color: var(--ink); border-color: var(--line); background: white; }
dialog .btn-accent { color: white; background: var(--accent); border-color: var(--accent); }

body.hide-seeds .seed,
body.hide-seeds .seed-input { display: none; }

body.hide-seeds .team { grid-template-columns: auto minmax(0, 1fr) 52px; }

body.hide-scores .score,
body.hide-scores .score-input { display: none; }

body.hide-scores .team { grid-template-columns: auto 42px minmax(0, 1fr); }

body.hide-seeds.hide-scores .team { grid-template-columns: auto minmax(0, 1fr); }

body.board-only .team { grid-template-columns: 42px minmax(0, 1fr) 52px; }
body.board-only.hide-seeds .team { grid-template-columns: minmax(0, 1fr) 52px; }
body.board-only.hide-scores .team { grid-template-columns: 42px minmax(0, 1fr); }
body.board-only.hide-seeds.hide-scores .team { grid-template-columns: minmax(0, 1fr); }

.empty-note {
  margin: 12px 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: relative; height: auto; }
  .stage { padding: 16px 14px 48px; }
  .hero { padding: 14px; }
  .hero-head { align-items: flex-start; }
  .live-clock { font-size: 15px; }
}

body.board-only .side,
body.board-only .sheet,
body.board-only .rules,
body.board-only .progress,
body.board-only .match-actions,
body.board-only .route-hint,
body.board-only .pick,
body.board-only .hint,
body.board-only .btn-board {
  display: none !important;
}

body.board-only #save-image,
body.board-only #save-pdf { display: inline-flex !important; }

body.board-only .layout { display: block; }
body.board-only .stage { padding: 28px 32px 48px; }
body.board-only .hero { background: transparent; border: none; box-shadow: none; padding: 0; }
body.board-only .board-exit { display: inline-flex; }
body.board-only .live-clock { font-size: 18px; }
body.board-only .match input,
body.board-only .match select,
body.board-only .round-name,
body.board-only .section-title { pointer-events: none; }

body.booting .layout,
body.booting .login-gate { visibility: hidden; }

body.auth-locked .layout { display: none; }

.login-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(226, 179, 64, 0.2), transparent 28%),
    radial-gradient(circle at 80% 90%, rgba(14, 159, 110, 0.28), transparent 32%),
    #0b1c18;
}

.login-gate[hidden] { display: none !important; }

.login-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 24px 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 46px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 0.9;
}

.login-error { color: #e11d48; font-weight: 800; }

.login-card a { color: var(--accent); font-weight: 800; }

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0;
  font-size: 14px;
  font-weight: 700;
}

.login-card input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #f6fbf8;
}

.login-card .linkish { font-size: 14px; }

.login-card .btn-accent { color: white; }

.tournament-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.tournament-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 16px 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}

.tournament-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.tournament-card strong {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 0.95;
}

.tournament-card span { color: var(--accent); font-weight: 800; }

body.public-view #all-tournaments { display: inline-flex; }
body:not(.public-view) #all-tournaments { display: none !important; }

body.public-view .side,
body.public-view .sheet,
body.public-view .rules,
body.public-view .progress,
body.public-view .match-actions,
body.public-view .route-hint,
body.public-view .pick,
body.public-view .hint,
body.public-view #toggle-board,
body.public-view #toggle-side,
body.public-view #go-public,
body.public-view #logout,
body.public-view .board-exit { display: none !important; }

body.public-view .layout { display: block; }
body.public-view .stage { padding: 28px 32px 48px; }
body.public-view .live-clock { font-size: 16px; }
body.public-view .match input,
body.public-view .match select,
body.public-view .match textarea,
body.public-view .round-name,
body.public-view .section-title,
body.public-view .table-scroll input,
body.public-view .table-scroll select,
body.public-view .table-scroll textarea {
  pointer-events: none;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  opacity: 1;
  color: inherit;
  -webkit-text-fill-color: currentColor;
  cursor: default;
}

body.public-view input::-webkit-calendar-picker-indicator,
body.public-view input::-webkit-inner-spin-button,
body.public-view input::-webkit-outer-spin-button {
  display: none;
  -webkit-appearance: none;
}

body.public-view .team { grid-template-columns: 42px minmax(0, 1fr) 52px; }
body.public-view.hide-seeds .team { grid-template-columns: minmax(0, 1fr) 52px; }
body.public-view.hide-scores .team { grid-template-columns: 42px minmax(0, 1fr); }
body.public-view.hide-seeds.hide-scores .team { grid-template-columns: minmax(0, 1fr); }

.export-board {
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
  width: max-content;
  padding: 28px 32px 40px;
  background: #f7fbf8;
  pointer-events: none;
}

.export-heading {
  margin: 0 0 16px;
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: 48px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 0.9;
  text-transform: uppercase;
}

body .export-board .pick,
body .export-board .play-btn,
body .export-board .play-bar.is-idle,
body .export-board .match-actions,
body .export-board .route-hint,
body .export-board .hint { display: none !important; }

.export-board .match-top {
  justify-content: flex-start;
  gap: 8px 14px;
}

.export-board .time-input.export-text { margin-left: auto; }

.export-board .games-field {
  flex: 0 0 auto;
  width: auto;
}

.export-board .games-input.export-text,
.export-board .time-input.export-text,
.export-board .code-input.export-text {
  width: auto;
  display: inline-flex;
}

.export-board .score-input.export-text:empty { display: none !important; }

body .export-board .board-scroll {
  overflow: visible;
  width: max-content;
  max-width: none;
}

body .export-board .team { grid-template-columns: 42px minmax(180px, 1fr) 52px !important; }
body.hide-seeds .export-board .team { grid-template-columns: minmax(180px, 1fr) 52px !important; }
body.hide-scores .export-board .team { grid-template-columns: 42px minmax(180px, 1fr) !important; }
body.hide-seeds.hide-scores .export-board .team { grid-template-columns: minmax(180px, 1fr) !important; }

.export-board .export-text {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.export-board .name-input.export-text,
.export-board .score-input.export-text,
.export-board .seed-input.export-text,
.export-board .section-title.export-text,
.export-board .round-name.export-text,
.export-board .venue-input.export-text {
  display: flex;
  width: 100%;
  height: auto;
  white-space: normal;
  overflow-wrap: anywhere;
}

.export-board .is-placeholder { color: var(--muted); font-weight: 600; }

#toggle-side, .side-close { display: none; }

.side-close {
  width: 100%;
  margin: 0 0 12px;
  border: 1px solid var(--side-line);
  background: transparent;
  color: var(--side-text);
  border-radius: 12px;
  padding: 12px;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 980px) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .stage, .hero, .layout, .board-scroll, .table-scroll, .standings-wrap { max-width: 100%; }

  #toggle-side { display: inline-flex; }

  body:not(.public-view):not(.show-side) .side { display: none; }

  body.show-side .side {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    width: 100%;
    height: 100dvh;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  body.show-side .side-close { display: block; }

  .hero {
    padding: 14px 14px 12px;
    border-radius: 18px;
  }

  .hero h1, .login-card h1 { font-size: clamp(28px, 9vw, 40px); overflow-wrap: anywhere; }

  .subtitle { font-size: 14px; line-height: 1.4; }

  .meta { font-size: 13px; line-height: 1.45; }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .hero-actions .btn-board {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 13px;
    text-align: center;
  }

  .bracket-logo img { height: 48px; }

  .section-title { font-size: 22px; }

  .split { flex-direction: column; }

  .row-add { flex-wrap: wrap; }
  .row-add input { flex: 1 1 140px; min-width: 0; }

  .btn-row .btn { flex: 1 1 calc(50% - 8px); }

  .side input, .side select, .side textarea,
  .login-card input, dialog input, dialog select, dialog textarea {
    font-size: 16px;
  }

  .board-scroll {
    margin-inline: -4px;
    padding-bottom: 16px;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .board-inner { gap: 12px; }

  .round {
    width: calc((100vw - 56px) / 2);
    flex-basis: calc((100vw - 56px) / 2);
    scroll-snap-align: start;
  }

  .round-name { font-size: 12px; padding: 0 0 4px; }

  .round-matches { gap: 8px; }

  .match { padding: 6px; border-radius: 12px; }

  .match-top { gap: 4px; font-size: 11px; }
  .code-input { width: 36px; padding: 2px; font-size: 12px; }
  .time-input, .games-input { width: 68px; font-size: 12px; padding: 2px; }
  .games-input { width: 32px; }
  .games-field { gap: 2px; font-size: 11px; }
  .venue-field { margin-top: 4px; gap: 4px; font-size: 11px; }
  .venue-field select { font-size: 12px; }
  .play-bar { margin: 4px 0 0; gap: 4px; }
  .play-chip { font-size: 9px; padding: 2px 5px; }
  .play-clock { font-size: 11px; }
  .name-input { font-size: 13px; padding: 2px; }
  .seed-input, .score-input { font-size: 12px; padding: 2px; }
  .team { gap: 2px; margin-top: 2px; padding: 0; }
  body.public-view .team { grid-template-columns: 28px minmax(0, 1fr) 36px; }
  body.public-view.hide-seeds .team { grid-template-columns: minmax(0, 1fr) 36px; }
  body.public-view.hide-scores .team { grid-template-columns: 28px minmax(0, 1fr); }

  body.public-view .stage,
  body.board-only .stage {
    padding: 12px 12px calc(28px + env(safe-area-inset-bottom));
  }

  body.public-view .live-clock,
  body.board-only .live-clock { font-size: 15px; }

  .login-gate { padding: 16px; align-items: start; }
  .login-card { padding: 22px 16px 14px; border-radius: 20px; }

  .tournament-list { grid-template-columns: 1fr; }
  .tournament-card strong { font-size: 26px; overflow-wrap: anywhere; }
}

@media print {
  .side, .sheet, .match-actions, .pick, .no-print, .btn-board, .board-exit { display: none !important; }
  .layout { display: block; }
  body, .hero { background: white; }
  .hero { border: none; box-shadow: none; }
  .board-scroll { overflow: visible; }
  .match { break-inside: avoid; box-shadow: none; }
}
