:root {
  --bg: #f4f7f5;
  --panel: #ffffff;
  --ink: #17201c;
  --muted: #6d7a73;
  --line: #cbd8d0;
  --accent: #176b53;
  --accent-2: #2457a6;
  --winner: #d92323;
  --loser-line: #d7dadd;
  --loser-ink: #9aa2a7;
  --slot-h: 76px;
  --gap-y: 18px;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

.admin-entry-link {
  display: none !important;
}

.admin-entry-link.is-visible {
  display: inline-flex !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Malgun Gothic", sans-serif;
}

button, .button, input, select {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

button:hover, .button:hover { filter: brightness(0.95); }

.secondary {
  background: #fff;
  color: var(--ink);
}

input, select {
  min-height: 38px;
  padding: 0 10px;
  background: #fff;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  min-height: 82px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
}

.topbar h1 {
  grid-column: 2;
  margin: 0;
  text-align: center;
  font-size: 26px;
}

.topbar > div:first-child h1 {
  grid-column: auto;
  text-align: left;
}

.corner-title {
  justify-self: start;
  font-weight: 800;
  font-size: 20px;
  color: var(--accent);
}

.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-shell { padding: 18px 24px 28px; }

.public-page {
  background: #fff;
  overflow-x: hidden;
}

.public-page .public-topbar {
  display: block;
  position: relative;
  min-height: 230px;
  align-items: start;
  padding: 20px 26px;
  border-bottom: 2px dashed #666;
  background: #fff;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.public-page .public-topbar.has-background::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(255, 255, 255, 0.48);
}

.public-page .public-topbar > * {
  z-index: 1;
}

.public-page .public-topbar h1 {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 94px;
  transform: translateX(-50%);
  width: max-content;
  padding-top: 0;
  font-size: 36px;
  letter-spacing: 0;
  white-space: nowrap;
}

.public-page .public-topbar .corner-title {
  position: absolute;
  left: 26px;
  top: 58px;
  padding-top: 34px;
  padding-top: 0;
  color: #000;
  font-size: 21px;
}

.public-bracket-tabs {
  position: absolute;
  left: 26px;
  top: 90px;
  display: flex;
  gap: 6px;
}

.public-page .public-topbar .public-bracket-tabs {
  z-index: 3;
}

.bracket-tabs button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #111;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.86);
  color: #111;
  font-size: 13px;
  font-weight: 800;
}

.bracket-tabs button.active {
  background: #111;
  color: #fff;
}

.public-page .public-topbar .top-actions {
  position: absolute;
  z-index: 4;
  right: 26px;
  top: 40px;
  padding-top: 0;
  flex-wrap: nowrap;
}

.public-page .rights-notice {
  position: absolute;
  right: 26px;
  bottom: 22px;
  color: #000;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.public-page .rights-notice:hover {
  text-decoration: underline;
}

.public-page .rights-notice.capturing {
  opacity: 0.65;
  pointer-events: none;
}

.public-page .public-topbar input {
  width: 190px;
  border-radius: 0;
  border-color: #333;
}

.public-page .public-topbar .top-actions button,
.public-page .public-topbar .top-actions .button {
  min-height: 34px;
  border: 0;
  background: #fff;
  color: #000;
  font-weight: 800;
  font-size: 18px;
  padding: 0 12px;
  white-space: nowrap;
}

.public-page .page-shell {
  padding: 0;
}

.public-page .controls-row {
  display: none;
}

.public-page .bracket-scroll {
  height: calc(100vh - 230px);
  border: 0;
  background: #fff;
}

.preliminary-image-view {
  height: calc(100vh - 230px);
  overflow: auto;
  padding: 16px 24px 24px;
  background: #fff;
  text-align: center;
}

.preliminary-image {
  display: block;
  width: auto;
  max-width: 100%;
  min-width: 0;
  height: auto;
  margin: 0 auto;
  border: 0;
  background: #fff;
  object-fit: contain;
}

.preliminary-image-empty {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-weight: 800;
}

.pdf-bracket {
  position: relative;
  min-width: max-content;
  background: #fff;
}

.bracket-svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 1;
}

.bracket-path {
  fill: none;
  stroke: #111;
  stroke-width: 1.3;
  vector-effect: non-scaling-stroke;
}

.bracket-path.red {
  stroke: red;
  stroke-width: 2;
}

.bracket-path.grey {
  stroke: #cfd4da;
}

.pdf-slot {
  position: absolute;
  z-index: 3;
  display: grid;
  grid-template-rows: 20px 1fr;
  width: 28px;
  height: 132px;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent;
}

.match-pair {
  box-sizing: border-box;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

.public-match-pair {
  position: absolute;
  z-index: 2;
  border: none !important;
  background: transparent;
  pointer-events: none;
}

.court-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 700;
  color: #111;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0;
  z-index: 5;
  pointer-events: none;
  white-space: nowrap;
}

.pdf-slot .draw-badge {
  display: grid;
  place-items: center;
  height: 20px;
  border: 1px solid #111 !important;
  font-size: 9px;
  line-height: 1;
  box-sizing: border-box;
}

.pdf-slot .vertical-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 112px;
  padding: 4px 0;
  font-weight: 700;
  line-height: 1.04;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  overflow: hidden;
  border-left: 1px solid #111 !important;
  border-right: 1px solid #111 !important;
  border-bottom: 1px solid #111 !important;
  border-top: 0 !important;
  box-sizing: border-box;
}

.pdf-slot .vertical-name span {
  display: block;
  min-height: 1em;
}

.pdf-slot.highlight {
  outline: 2px solid #ffd84d !important;
  outline-offset: 2px;
}

.pdf-slot.winner,
.pdf-winner.winner {
  border-color: var(--winner);
  color: var(--winner);
}

.pdf-slot.winner .draw-badge {
  border-color: var(--winner) !important;
}

.pdf-slot.winner .vertical-name {
  border-color: var(--winner) !important;
}

.pdf-slot.loser,
.pdf-winner.loser {
  border-color: var(--loser-line);
  color: var(--loser-ink);
  background: #fbfbfb;
}

.pdf-slot.loser .draw-badge {
  border-color: var(--loser-line) !important;
}

.pdf-slot.loser .vertical-name {
  border-color: var(--loser-line) !important;
}

.pdf-slot.bye,
.match-slot-card.bye {
  color: #7b8288;
  background: transparent;
}

.match-slot-card.bye {
  cursor: default;
}
}

.pdf-winner {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  min-width: 78px;
  height: 30px;
  border: 2px solid #111;
  background: #fff;
  font-size: 14px;
  white-space: nowrap;
}

.pdf-court {
  position: absolute;
  z-index: 4;
  transform: translateX(-50%);
  padding: 0 4px;
  background: #fff;
  font-size: 14px;
  white-space: nowrap;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.muted { color: var(--muted); }

.bracket-scroll {
  overflow: auto;
  height: calc(100vh - 150px);
  border: 1px solid var(--line);
  background: #eef3ef;
}

.bracket {
  display: flex;
  align-items: flex-start;
  gap: 42px;
  min-width: max-content;
  padding: 22px;
}

.round {
  display: flex;
  flex-direction: column;
  gap: var(--gap-y);
  min-width: 230px;
}

.round-title {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 0;
  background: #eef3ef;
  font-weight: 800;
  color: var(--accent-2);
}

.match {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: calc(var(--slot-h) * 2 + 8px);
}

.admin-page .match-pair {
  border: none !important;
  padding: 24px 8px 8px;
  margin-bottom: 8px;
  background: transparent;
  cursor: pointer;
}

.admin-page .match-pair:hover {
  background: #f7fbf8;
}

.admin-page .match-pair .court-label {
  left: 50%;
  top: 10px;
}

.match-slot-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #111;
  padding: 7px 8px;
  margin-bottom: 4px;
}

.match-slot-card:last-of-type {
  margin-bottom: 0;
}

.match-slot-card.winner {
  color: #111;
  font-weight: 700;
}

.match-slot-card.loser {
  color: var(--loser-ink);
  opacity: 0.45;
}

.slot {
  position: relative;
  min-height: var(--slot-h);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.slot.clickable { cursor: pointer; }
.slot.clickable:hover { border-color: var(--accent); }
.slot.empty { color: var(--muted); background: #f8faf8; }
.slot.highlight { outline: 3px solid #ffd84d; }
.slot.winner {
  border-color: var(--line);
  color: #111;
  font-weight: 800;
}

.slot.loser {
  border-color: var(--loser-line);
  color: var(--loser-ink);
  background: #fbfbfb;
}

.admin-page .match-pair .match-slot-card {
  min-height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #111;
}

.admin-page .match-pair .match-slot-card.clickable:hover {
  color: var(--accent);
  border: 0;
}

.match-slot-card.pending-winner {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.winner-hint {
  min-height: 16px;
  margin-top: 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.admin-page .match-pair .match-slot-card.winner {
  color: #111;
  font-weight: 800;
}

.admin-page .match-pair .match-slot-card.empty {
  color: #111;
  background: transparent;
}

.admin-page .match-pair.needs-court .match-slot-card:not(.loser),
.admin-page .match-pair.needs-court .match-slot-card:not(.loser) .meta,
.admin-page .match-pair.needs-court .match-slot-card:not(.loser) .team-name,
.admin-page .match-pair.needs-court .match-slot-card:not(.loser) .source {
  color: red;
}

.admin-page .match-pair.needs-court .match-slot-card.loser,
.admin-page .match-pair.needs-court .match-slot-card.loser .meta,
.admin-page .match-pair.needs-court .match-slot-card.loser .team-name,
.admin-page .match-pair.needs-court .match-slot-card.loser .source {
  color: var(--loser-ink);
}

.admin-page .round-title {
  color: #111;
}

.role-staff .court-picker-icon {
  display: none;
}

.role-staff .admin-bracket-scroll {
  height: 72vh;
}

.role-staff .match-slot-card {
  min-height: 58px;
  padding: 10px 8px;
}

.role-staff .match-slot-card.clickable {
  touch-action: manipulation;
}

.court-picker-icon {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.admin-page .match-pair.needs-court .court-picker-icon {
  color: red;
}

.court-picker-icon:hover {
  text-decoration: underline;
  filter: none;
}

.slot .meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--muted);
}

.slot.winner .meta { color: #111; }
.slot.loser .meta,
.slot.loser .players,
.slot.loser .source,
.slot.loser .court {
  color: var(--loser-ink);
}
.team-name { font-weight: 800; }
.players, .source, .court { margin-top: 3px; font-size: 12px; color: var(--muted); }

.admin-page .match-pair .match-slot-card .meta,
.admin-page .match-pair .match-slot-card .team-name,
.admin-page .match-pair .match-slot-card .source {
  color: #111;
}

.admin-page .match-pair .match-slot-card.loser .meta,
.admin-page .match-pair .match-slot-card.loser .team-name,
.admin-page .match-pair .match-slot-card.loser .source {
  color: var(--loser-ink);
}

.pdf-slot.loser,
.match-slot-card.loser,
.slot-card.loser,
.slot.loser {
  color: #b8c0c8 !important;
  opacity: 0.45;
}

.pdf-slot.loser .vertical-name,
.pdf-slot.loser .draw-badge {
  color: #b8c0c8 !important;
  border-color: #d8dee4 !important;
}

.match-slot-card.loser .meta,
.match-slot-card.loser .team-name,
.match-slot-card.loser .source,
.slot.loser .meta,
.slot.loser .team-name,
.slot.loser .source {
  color: #b8c0c8 !important;
}

.pdf-slot.winner,
.match-slot-card.winner,
.slot-card.winner,
.slot.winner {
  color: var(--winner);
  font-weight: 700;
}

.pdf-slot.bye:not(.winner),
.match-slot-card.bye:not(.winner) {
  color: #b8c0c8 !important;
  opacity: 0.45;
}

.pdf-slot.bye:not(.winner) .vertical-name,
.pdf-slot.bye:not(.winner) .draw-badge {
  color: #b8c0c8 !important;
  border-color: #d8dee4 !important;
}

.compact { --slot-h: 58px; gap: 26px; }
.compact .round { min-width: 205px; }
.compact .slot { font-size: 13px; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.login-panel h1 { margin-top: 0; }
.login-panel form, .grid-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.message { min-height: 22px; color: var(--winner); }

.admin-page {
  background: #f6faf7;
}

.admin-topbar {
  grid-template-columns: 1fr auto;
  min-height: 78px;
}

.admin-title-block {
  display: grid;
  gap: 3px;
}

.admin-title-block h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.25;
}

.admin-user {
  color: var(--muted);
  font-size: 13px;
}

.admin-layout {
  display: grid;
  gap: 18px;
  padding: 18px 22px 32px;
}

.admin-config-grid {
  display: grid;
  grid-template-columns: minmax(560px, 1.05fr) minmax(560px, 0.95fr);
  gap: 18px;
}

.role-limited .admin-config-grid,
.role-limited .settings-panel,
.role-limited .media-settings-panel {
  display: none !important;
}

.role-limited .prelim-actions,
.role-limited #resetPrelimBtn,
.role-limited #undoPrelimBtn {
  display: none !important;
}

.admin-config-grid > .panel {
  min-height: 140px;
  border-radius: 18px;
}

.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel h2 { margin: 0 0 14px; font-size: 19px; }
.wide { grid-column: 1 / -1; }

.admin-view-tabs {
  display: inline-flex;
  width: fit-content;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-view-tabs button {
  min-width: 124px;
  background: #fff;
  color: var(--ink);
}

.admin-view-tabs button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.admin-view-tabs .utility-tab {
  min-width: 104px;
  font-weight: 800;
}

.admin-view-tabs .danger {
  border-color: #efc4c4;
  color: var(--winner);
}

.admin-view-tabs .danger:hover {
  background: #fff5f5;
}

.admin-view {
  display: none;
}

.admin-view.active {
  display: block;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.section-title-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.section-title-actions h2 {
  margin: 0;
}

.settings-grid {
  grid-template-columns: minmax(260px, 1fr) 130px 110px auto;
  align-items: end;
}

.court-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.court-status-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.court-status-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
  line-height: 1.5;
}

.court-status-row span {
  color: var(--muted);
}

.media-settings-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 22px;
  row-gap: 10px;
  align-content: start;
}

.media-settings-panel h2,
.media-settings-panel #mediaMessage {
  grid-column: 1 / -1;
}

.media-setting-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 128px;
  gap: 10px;
  align-items: start;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.media-setting-row strong {
  display: block;
  margin-bottom: 4px;
}

.media-setting-row span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.media-setting-row .upload-hint {
  display: block;
  margin-top: 3px;
  color: #47544d;
  font-size: 11px;
}

.media-setting-actions {
  display: grid;
  align-items: stretch;
  justify-content: flex-start;
  gap: 5px;
}

.media-setting-actions input[type="file"] {
  width: 128px;
  max-width: 100%;
  min-height: 28px;
  padding: 3px;
  font-size: 11px;
}

.media-setting-actions button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
  white-space: nowrap;
}

.media-settings-panel .media-setting-row {
  grid-template-columns: minmax(120px, 1fr) 128px;
  align-items: start;
}

.media-settings-panel .media-setting-actions {
  justify-content: flex-start;
}

.media-settings-panel .import-message {
  min-height: 0;
  padding: 0;
  border: 0;
  font-size: 12px;
}

.court-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.22);
}

.court-picker-modal {
  display: grid;
  gap: 12px;
  width: min(360px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(0,0,0,0.16);
}

.court-picker-modal h3,
.court-picker-modal p {
  margin: 0;
}

.prelim-panel {
  padding: 0;
  overflow: hidden;
}

.prelim-panel .section-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.prelim-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.import-message {
  min-height: 34px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.import-message.success {
  color: var(--accent);
  font-weight: 800;
}

.import-message.error {
  color: var(--winner);
  font-weight: 800;
}

.prelim-table-wrap {
  overflow: auto;
  max-height: 64vh;
  background: #fff;
}

.prelim-table {
  width: 100%;
  min-width: 1540px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 14px;
}

.prelim-table .col-group { width: 74px; }
.prelim-table .col-draw { width: 72px; }
.prelim-table .col-winner { width: 220px; }
.prelim-table .col-player { width: 112px; }
.prelim-table .col-court-assignment { width: 210px; }

.prelim-table th,
.prelim-table td {
  border: 1px solid var(--line);
  border-width: 0 1px 1px 0;
  padding: 6px;
  vertical-align: middle;
  background: #fff;
}

.prelim-table th:first-child,
.prelim-table td:first-child {
  border-left-width: 1px;
}

.prelim-table th {
  position: sticky;
  top: 0;
  z-index: 7;
  background: #ecf4ee;
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
  box-shadow: inset 0 1px 0 var(--line);
}

.prelim-table thead tr:first-child th {
  height: 34px;
  padding: 0 6px;
}

.prelim-table thead tr:nth-child(2) th {
  top: 34px;
  z-index: 6;
  height: 34px;
  padding: 0 6px;
  background: #ecf4ee;
}

.prelim-table th[rowspan="2"] {
  z-index: 8;
  vertical-align: middle;
}

.prelim-table input,
.prelim-table select {
  width: 100%;
  min-height: 34px;
  border-radius: 5px;
}

.prelim-table button {
  width: 100%;
  min-height: 34px;
}

.prelim-table tr.saving td {
  background: #fff8e8;
}

.prelim-table tr.saved td {
  background: #edf8ef;
}

.staff-prelim-table {
  min-width: 480px;
  table-layout: fixed;
  font-size: 12px;
}

.staff-prelim-table th:nth-child(1),
.staff-prelim-table td:nth-child(1) {
  width: 44px;
}

.staff-prelim-table th:nth-child(2),
.staff-prelim-table td:nth-child(2),
.staff-prelim-table th:nth-child(3),
.staff-prelim-table td:nth-child(3) {
  width: 138px;
}

.staff-prelim-table th:nth-child(4),
.staff-prelim-table td:nth-child(4) {
  width: 156px;
}

.staff-prelim-table th,
.staff-prelim-table td {
  padding: 4px;
  height: 42px;
  white-space: nowrap;
}

.staff-prelim-table select {
  min-height: 34px;
  padding: 0 6px;
  font-size: 12px;
}

.staff-team-list {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.role-staff .admin-view-tabs button,
.role-staff .section-title-actions button {
  min-height: 38px;
  font-size: 13px;
}

.compact-input {
  font-weight: 800;
}

.number-input {
  text-align: center;
  font-weight: 800;
}

.prelim-table .duplicate-draw-number {
  color: #d60000 !important;
  border-color: #d60000 !important;
  font-weight: 900;
}

.prelim-table input.duplicate-draw-number {
  background: #fff6f6;
}

.prelim-court-name {
  min-width: 190px;
}

.admin-bracket-scroll { height: 68vh; }

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
  .topbar h1 { grid-column: auto; font-size: 21px; }
  .top-actions { justify-self: stretch; flex-wrap: wrap; }
  .top-actions input { flex: 1; min-width: 160px; }
  .admin-layout {
    padding: 12px;
    gap: 12px;
  }
  .admin-topbar {
    position: static;
    padding: 16px;
  }
  .admin-title-block h1 {
    font-size: 21px;
  }
  .admin-topbar .top-actions {
    justify-content: flex-start;
  }
  .admin-config-grid {
    display: block;
  }
  .admin-config-grid > .panel {
    min-height: 0;
    border-radius: 14px;
  }
  .settings-panel {
    padding: 14px;
  }
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .settings-grid button {
    width: 100%;
  }
  .admin-page .media-settings-panel {
    display: none !important;
  }
  .admin-view-tabs {
    width: 100%;
  }
  .admin-view-tabs button {
    flex: 1;
    min-width: 0;
    padding: 0 8px;
  }
  .media-setting-row {
    grid-template-columns: 1fr;
  }
  .media-setting-actions {
    justify-content: flex-start;
  }
  .preliminary-image {
    max-width: 100%;
    min-width: 0;
  }
  .public-page .public-topbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-height: 0;
    padding: 16px;
  }

  .public-page .public-topbar h1,
  .public-page .public-topbar .corner-title,
  .public-page .public-topbar .top-actions,
  .public-page .public-topbar .public-bracket-tabs,
  .public-page .rights-notice {
    position: static;
    transform: none;
    width: auto;
  }

  .public-page .public-topbar h1 {
    order: 1;
    padding: 0;
    font-size: 23px;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
  }

  .public-page .public-topbar .top-actions {
    order: 2;
    justify-content: center;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .public-page .public-topbar input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: 230px;
  }

  .public-page .public-topbar .top-actions button,
  .public-page .public-topbar .top-actions .button {
    min-height: 32px;
    padding: 0 8px;
    font-size: 15px;
  }

  .public-page .public-topbar .corner-title {
    order: 3;
    font-size: 18px;
  }

  .public-page .public-topbar .public-bracket-tabs {
    order: 4;
    align-self: flex-start;
  }

  .public-page .rights-notice {
    order: 5;
    font-size: 11px;
    line-height: 1.35;
    text-align: center;
    white-space: normal;
  }

  .public-page .bracket-scroll,
  .preliminary-image-view {
    height: calc(100vh - 236px);
  }

  .role-staff .admin-layout {
    padding: 8px;
    gap: 10px;
  }

  .role-staff .prelim-panel .section-head {
    padding: 8px;
  }

  .role-staff .import-message {
    min-height: 0;
    padding: 5px 8px;
    font-size: 12px;
  }

  .role-staff .prelim-table-wrap {
    max-height: 72vh;
  }

  .role-staff .staff-prelim-table {
    min-width: 356px;
    font-size: 11px;
  }

  .role-staff .staff-prelim-table th:nth-child(1),
  .role-staff .staff-prelim-table td:nth-child(1) {
    width: 36px;
  }

  .role-staff .staff-prelim-table th:nth-child(2),
  .role-staff .staff-prelim-table td:nth-child(2),
  .role-staff .staff-prelim-table th:nth-child(3),
  .role-staff .staff-prelim-table td:nth-child(3) {
    width: 110px;
  }

  .role-staff .staff-prelim-table th:nth-child(4),
  .role-staff .staff-prelim-table td:nth-child(4) {
    width: 100px;
  }

  .role-staff .staff-prelim-table th,
  .role-staff .staff-prelim-table td {
    height: 36px;
    padding: 3px;
  }

  .role-staff .staff-prelim-table select {
    min-height: 32px;
    font-size: 11px;
  }
}
