:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #dde3ee;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;
  --blue: #2563eb;
  --shadow: 0 10px 30px rgba(23, 32, 51, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 24px;
  background: #111827;
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
}

.brand {
  color: #fff;
  font-weight: 800;
  font-size: 18px;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.topbar nav a {
  color: #d7dee9;
  padding: 7px 9px;
  border-radius: 6px;
}

.topbar nav a:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
  text-decoration: none;
}

.logout-form {
  margin: 0;
}

.logout-form button {
  min-height: auto;
  padding: 7px 9px;
  border: 0;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 14px;
}

.logout-form button:hover {
  background: rgba(255,255,255,.16);
}

.page {
  width: min(1440px, calc(100% - 32px));
  margin: 24px auto 56px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-head.compact-head {
  margin-top: 28px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 30px; line-height: 1.15; }
h2 { margin-bottom: 14px; font-size: 18px; }
h3 { margin-bottom: 10px; font-size: 15px; }

.eyebrow {
  margin-bottom: 5px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

.panel, .stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel { padding: 18px; margin-bottom: 18px; }
.panel.narrow { max-width: 620px; }

.grid {
  display: grid;
  gap: 18px;
}

.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat span { color: var(--muted); font-weight: 700; }
.stat strong { font-size: 30px; color: var(--primary-dark); }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2 { margin: 0; }

.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.button:hover, button:hover { text-decoration: none; border-color: #bcc7d8; }
.button.primary, button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.button.primary:hover, button.primary:hover { background: var(--primary-dark); }
.button.success, button.success { background: var(--success); border-color: var(--success); color: #fff; }
.button.warning, button.warning { background: #fff7ed; border-color: #fed7aa; color: var(--warning); }

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 6px;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.actions, .row-actions, .actions.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.actions.compact .button { min-height: 32px; padding: 6px 9px; font-size: 13px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

input, select, textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #cfd7e6;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.filters input, .filters select { width: 220px; }

.inline-feedback {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-weight: 800;
}

.inline-feedback.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.inline-feedback.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.inline-weigh-form {
  display: grid;
  grid-template-columns: 92px 140px auto;
  gap: 6px;
  align-items: center;
  min-width: 330px;
}

.inline-pay-form {
  grid-template-columns: 92px auto;
  min-width: 200px;
}

.inline-weigh-form input {
  min-height: 32px;
  padding: 6px 8px;
}

.inline-weigh-form button {
  min-height: 32px;
  padding: 6px 10px;
}

.form-grid p { margin: 0 0 12px; }
.form-grid label { display: block; margin-bottom: 5px; font-weight: 700; }
.form-grid .helptext, .form-grid ul { color: var(--muted); font-size: 13px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #f8fafc;
}
tr:last-child td { border-bottom: 0; }

.empty {
  color: var(--muted);
  padding: 12px;
}

.pill, .status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.pill { background: #eef6ff; color: var(--blue); }
.status.pending { background: #eef2ff; color: #3730a3; }
.status.passed, .status.done, .status.moved { background: #dcfce7; color: #166534; }
.status.failed { background: #fee2e2; color: var(--danger); }
.status.paid { background: #fff7ed; color: var(--warning); }
.status.current { background: #fef3c7; color: #92400e; }
.status.absent, .status.disqualified { background: #fee2e2; color: var(--danger); }

.match-stack {
  display: grid;
  gap: 12px;
}

.match-card {
  border: 1px solid var(--line);
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.match-card.live { border-left-color: var(--warning); }
.match-card.side-A { border-left-color: var(--blue); }
.match-card.side-B { border-left-color: var(--primary); }
.match-card.side-F { border-left-color: var(--warning); background: #fffbeb; }

.match-meta {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.fighters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.fighters span, .slot {
  display: grid;
  gap: 2px;
  min-width: 0;
}

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

.slot {
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 7px;
  background: #f8fafc;
}

.slot.winner {
  border-color: #86efac;
  background: #f0fdf4;
  font-weight: 800;
}

.ranking {
  display: grid;
  gap: 8px;
}

.ranking.large { gap: 10px; }

.rank-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.rank {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #111827;
  color: #fff;
  font-weight: 800;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  font-weight: 700;
}

.random-rule {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.random-rule div {
  display: grid;
  gap: 4px;
}

.random-rule span {
  color: var(--muted);
  font-weight: 700;
}

.random-grid {
  display: grid;
  gap: 16px;
}

.random-card .section-title {
  align-items: flex-start;
}

.random-meta {
  margin-bottom: 14px;
}

.random-entry-form {
  display: grid;
  grid-template-columns: 90px minmax(150px, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.random-entry-form input {
  min-height: 32px;
  padding: 6px 8px;
}

.random-entry-form button {
  min-height: 32px;
  padding: 6px 9px;
}

.tournament-preview {
  display: grid;
  gap: 10px;
  align-content: start;
}

.tournament-preview img {
  width: 150px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.tournament-preview strong {
  font-size: 16px;
}

.tournament-preview span {
  color: var(--muted);
  font-weight: 700;
}

.seed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.seed-settings {
  padding: 0;
  overflow: hidden;
}

.seed-settings summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 900;
}

.seed-settings form {
  padding: 0 16px 16px;
  border-top: 1px solid var(--line);
}

.seed-settings:not([open]) {
  margin-bottom: 18px;
}

.seed-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.seed-card span {
  display: grid;
  min-width: 0;
}

.seed-card strong,
.seed-card small,
.seed-card em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seed-card em {
  color: var(--primary-dark);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.seed-card input {
  min-height: 32px;
  padding: 5px 7px;
  text-align: center;
  font-weight: 800;
}

.seed-actions {
  margin-top: 12px;
}

.playable-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.draw-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: 0 0 14px;
}

.draw-filter label {
  display: grid;
  gap: 5px;
  width: min(320px, 100%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.selected-filter {
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 700;
}

.draw-editor {
  display: grid;
  gap: 14px;
}

.draw-editor-actions {
  padding-top: 2px;
}

.playable-column,
.playable-final {
  display: grid;
  align-content: start;
  gap: 10px;
}

.playable-column h3,
.playable-final h3 {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f1f5f9;
  font-size: 13px;
  text-transform: uppercase;
}

.playable-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

.playable-card-head,
.playable-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.playable-card-head strong {
  color: #0f172a;
  font-size: 13px;
}

.playable-card-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.fighters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}

.fighter {
  display: grid;
  align-content: center;
  min-height: 50px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.drop-slot {
  border-style: dashed;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.drop-slot.drag-over {
  border-color: var(--primary);
  background: #ecfdf5;
  box-shadow: inset 0 0 0 1px var(--primary);
}

.drag-player,
.static-player,
.empty-player {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.drag-player {
  cursor: grab;
}

.drag-player:active {
  cursor: grabbing;
}

.fighter strong,
.fighter small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fighter strong {
  font-size: 13px;
}

.player-no {
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.fighter small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.versus {
  display: grid;
  place-items: center;
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
}

.playable-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.empty.compact {
  padding: 14px;
}

.bracket-scroll {
  overflow: auto;
  padding-bottom: 8px;
}

.bracket-paper {
  width: max-content;
  min-width: 0;
  padding: 18px 22px 24px;
  background: #fff;
  border: 1px solid #cfd7e6;
  box-shadow: 0 10px 35px rgba(15, 23, 42, .12);
  color: #111827;
}

.bracket-svg {
  display: block;
  width: auto;
  max-width: none;
  min-width: 0;
  height: auto;
  margin-top: 14px;
  background: #fff;
}

.bracket-lines path {
  fill: none;
  stroke: #65758b;
  stroke-width: 1.4;
  shape-rendering: crispEdges;
}

.round-labels text {
  font-size: 13px;
  font-weight: 900;
  text-anchor: middle;
  fill: #0f172a;
}

.match-box,
.winner-svg rect {
  fill: #fff;
  stroke: #64748b;
  stroke-width: 1.1;
  shape-rendering: crispEdges;
}

.match-head {
  fill: #f1f5f9;
}

.player-line {
  fill: #fff;
}

.winner-fill {
  fill: #e7f8ef;
}

.match-number {
  font-size: 9px;
  font-weight: 900;
  fill: #0f172a;
}

.player-name {
  font-size: 9.4px;
  font-weight: 800;
  fill: #0f172a;
}

.club-name {
  font-size: 8px;
  fill: #475569;
}

.rtl {
  direction: rtl;
  unicode-bidi: plaintext;
  text-anchor: end;
}

.winner-label {
  font-size: 10px;
  font-weight: 900;
  text-anchor: middle;
  fill: #0f172a;
}

.winner-name {
  font-size: 11px;
  font-weight: 900;
  fill: #0f172a;
}

.bracket-header {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #111827;
  font-size: 12px;
}

.bracket-header div {
  display: grid;
  gap: 3px;
}

.bracket-title {
  text-align: center;
}

.bracket-title h2 {
  margin: 0;
  font-size: 18px;
  text-transform: uppercase;
}

.bracket-meta {
  text-align: right;
}

.tournament-tree {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px minmax(0, 1fr);
  gap: 18px;
  min-height: 585px;
  padding-top: 18px;
}

.tree-side {
  display: grid;
  gap: 0;
}

.tree-left {
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
}

.tree-right {
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
}

.tree-round {
  position: relative;
  display: grid;
  grid-template-rows: 28px 1fr;
  min-width: 142px;
}

.tree-round h3 {
  margin: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.tree-matches {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  min-height: 535px;
  padding: 0 18px;
}

.tree-match {
  position: relative;
  min-height: 54px;
  border: 1px solid #8d99aa;
  background: #fff;
  font-size: 10px;
}

.tree-match::before,
.tree-match::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 18px;
  border-top: 1px solid #8d99aa;
}

.tree-match-left::after {
  left: 100%;
}

.tree-match-right::before {
  right: 100%;
}

.tree-match-final::before {
  right: 100%;
}

.tree-match-final::after {
  left: 100%;
}

.tree-match-no {
  padding: 2px 5px;
  border-bottom: 1px solid #d6dde8;
  color: #475467;
  font-size: 9px;
  font-weight: 800;
}

.tree-player {
  display: grid;
  min-height: 20px;
  padding: 2px 5px;
  border-top: 1px solid #e7ebf2;
  line-height: 1.15;
}

.tree-player:first-of-type {
  border-top: 0;
}

.tree-player span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.tree-player small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}

.tree-player.winner {
  background: #ecfdf3;
}

.tree-final {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.tree-final::before,
.tree-final::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 18px;
  border-top: 1px solid #8d99aa;
}

.tree-final::before {
  right: 100%;
}

.tree-final::after {
  left: 100%;
}

.final-label,
.winner-box {
  border: 1px solid #111827;
  background: #f8fafc;
  text-align: center;
}

.final-label {
  padding: 5px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.winner-box {
  display: grid;
  gap: 4px;
  padding: 8px;
}

.winner-box span {
  color: #475467;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.winner-box strong {
  min-height: 20px;
}

.display-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(15, 118, 110, .22), transparent 34%),
    linear-gradient(135deg, #111318 0%, #171b22 52%, #10131a 100%);
  color: #f8fafc;
  overflow-x: hidden;
}

.display-shell {
  width: min(1880px, calc(100% - 44px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 28px;
}

.display-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.18);
}

.display-brand-block {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 16px;
}

.display-brand-block img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 5px;
}

.display-brand-block span,
.display-side-title span {
  color: #9ee8dc;
  font-size: 16px;
  font-weight: 900;
  text-transform: uppercase;
}

.display-brand-block h1 {
  margin: 3px 0 0;
  max-width: 1100px;
  color: #fff;
  font-size: 34px;
  line-height: 1.08;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.display-side-title {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.display-side-title strong {
  color: #fff;
  font-size: 44px;
  line-height: 1;
  text-transform: uppercase;
}

.display-podium {
  display: grid;
  grid-template-columns: 1fr 1.22fr 1fr;
  grid-template-areas: "second first third";
  gap: 18px;
  align-items: end;
  margin-bottom: 22px;
}

.display-podium-card,
.display-ranking-row,
.display-mat-card,
.display-match-card,
.display-empty-match,
.display-empty-wide {
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  box-shadow: 0 24px 70px rgba(0,0,0,.25);
  backdrop-filter: blur(12px);
}

.display-podium-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 172px;
  padding: 22px;
  border-radius: 8px;
}

.display-podium-card.rank-1 {
  grid-area: first;
  min-height: 220px;
  border-color: rgba(250, 204, 21, .55);
  background: linear-gradient(135deg, rgba(250,204,21,.34), rgba(180,83,9,.14));
}

.display-podium-card.rank-2 {
  grid-area: second;
  border-color: rgba(226,232,240,.58);
  background: linear-gradient(135deg, rgba(226,232,240,.26), rgba(100,116,139,.12));
}

.display-podium-card.rank-3 {
  grid-area: third;
  border-color: rgba(217,119,6,.58);
  background: linear-gradient(135deg, rgba(217,119,6,.25), rgba(120,53,15,.14));
}

.display-rank-no {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 8px;
  background: #f8fafc;
  color: #111827;
  font-size: 42px;
  font-weight: 950;
}

.display-podium-card.rank-1 .display-rank-no {
  background: #facc15;
  color: #111827;
}

.display-podium-card.rank-2 .display-rank-no {
  background: #e2e8f0;
  color: #111827;
}

.display-podium-card.rank-3 .display-rank-no {
  background: #d97706;
  color: #fff;
}

.display-podium-card strong {
  display: block;
  color: #fff;
  font-size: 34px;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.display-podium-card.rank-1 strong {
  font-size: 42px;
}

.display-podium-card small {
  display: block;
  margin-top: 8px;
  color: #d1fae5;
  font-size: 30px;
  font-weight: 950;
}

.display-ranking-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.display-ranking-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 13px 16px;
  border-radius: 8px;
}

.display-ranking-row span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 7px;
  background: rgba(255,255,255,.14);
  color: #d1fae5;
  font-size: 23px;
  font-weight: 950;
}

.display-ranking-row strong {
  color: #fff;
  font-size: 26px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.display-ranking-row em {
  color: #9ee8dc;
  font-size: 28px;
  font-style: normal;
  font-weight: 950;
}

.display-empty-wide {
  grid-column: 1 / -1;
  padding: 36px;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 26px;
  font-weight: 900;
  text-align: center;
}

.display-mats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.display-mat-card {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
  min-height: calc(100vh - 150px);
  padding: 18px;
  border-radius: 8px;
}

.display-mat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,.16);
}

.display-mat-head div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.display-mat-head span {
  color: #9ee8dc;
  font-size: 16px;
  font-weight: 950;
  text-transform: uppercase;
}

.display-mat-head strong {
  color: #fff;
  font-size: 58px;
  line-height: .92;
}

.display-mat-head em {
  color: #cbd5e1;
  font-size: 18px;
  font-style: normal;
  font-weight: 900;
}

.display-current-zone h2,
.display-next-zone h3 {
  margin-bottom: 9px;
  color: #fff;
  font-size: 18px;
  text-transform: uppercase;
}

.display-current-zone h2 {
  color: #fde68a;
}

.display-match-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
}

.display-match-card.is-current {
  border-color: rgba(250,204,21,.42);
  background: linear-gradient(135deg, rgba(250,204,21,.12), rgba(255,255,255,.08));
}

.display-match-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 7px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
}

.display-match-meta span:first-child {
  color: #fff;
}

.display-fighters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.display-fighter {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 132px;
  padding: 14px;
  border-radius: 8px;
  color: #fff;
}

.display-match-card.is-next .display-fighter {
  min-height: 92px;
}

.display-fighter.blue {
  background: linear-gradient(135deg, #0b4ec9, #183b8f);
  border: 1px solid rgba(147,197,253,.55);
}

.display-fighter.red {
  background: linear-gradient(135deg, #c1121f, #7f1d1d);
  border: 1px solid rgba(252,165,165,.58);
}

.display-color {
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
  opacity: .92;
}

.display-player-photo,
.display-player-photo img,
.display-avatar {
  width: 78px;
  height: 78px;
  border-radius: 8px;
}

.display-player-photo img {
  display: block;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.72);
  background: #fff;
}

.display-avatar {
  display: grid;
  place-items: center;
  border: 2px solid rgba(255,255,255,.72);
  color: #fff;
  font-size: 34px;
  font-weight: 950;
}

.display-avatar.male {
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
}

.display-avatar.female {
  background: linear-gradient(135deg, #be185d, #7c3aed);
}

.display-fighter-text {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.display-fighter strong {
  font-size: 26px;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.display-match-card.is-next .display-fighter strong {
  font-size: 20px;
}

.display-fighter small {
  color: rgba(255,255,255,.82);
  font-size: 16px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.display-match-card.is-next .display-player-photo,
.display-match-card.is-next .display-player-photo img,
.display-match-card.is-next .display-avatar {
  width: 58px;
  height: 58px;
  font-size: 25px;
}

.display-match-card.is-next .display-fighter {
  grid-template-columns: 58px minmax(0, 1fr);
}

.display-vs {
  display: grid;
  place-items: center;
  color: #f8fafc;
  font-size: 18px;
  font-weight: 950;
}

.display-next-stack {
  display: grid;
  gap: 12px;
}

.display-empty-match {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 138px;
  padding: 20px;
  border-radius: 8px;
  color: #cbd5e1;
  text-align: center;
}

.display-empty-match.compact {
  min-height: 86px;
}

.display-empty-match strong {
  color: #fff;
  font-size: 22px;
}

.display-empty-match span {
  font-weight: 750;
}

.scoring-summary {
  display: grid;
  gap: 14px;
  align-content: start;
}

.mat-console-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.mat-console-link {
  display: grid;
  gap: 8px;
  min-height: 180px;
  color: var(--ink);
  text-decoration: none;
}

.mat-console-link:hover {
  text-decoration: none;
  border-color: var(--primary);
}

.mat-console-link span {
  color: var(--primary-dark);
  font-weight: 900;
  text-transform: uppercase;
}

.mat-console-link strong {
  color: #111827;
  font-size: 70px;
  line-height: .9;
}

.mat-console-link small {
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.mat-console-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.mat-console-main {
  display: grid;
  gap: 14px;
}

.mat-console-main .display-match-card {
  background: #111827;
  border-color: #243145;
  box-shadow: none;
  backdrop-filter: none;
}

.console-result-form {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.console-result-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.console-winner-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.console-winner-actions .button,
.console-start,
.console-launch-actions .button {
  min-height: 54px;
  font-size: 17px;
  font-weight: 900;
}

.button.console-blue {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
}

.button.console-red {
  border-color: #b91c1c;
  background: #b91c1c;
  color: #fff;
}

.console-launch-actions {
  display: flex;
  justify-content: center;
}

.console-launch-actions form {
  width: min(420px, 100%);
}

.console-launch-actions .button {
  width: 100%;
}

.mat-console-side {
  display: grid;
  gap: 12px;
}

.console-last-result {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.console-last-result span,
.console-last-result small {
  color: var(--muted);
  font-weight: 800;
}

.console-last-result strong {
  font-size: 20px;
  color: var(--primary-dark);
}

.console-empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 320px;
  color: var(--muted);
  text-align: center;
}

.console-empty-state strong {
  color: var(--ink);
  font-size: 28px;
}

.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.message {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 700;
}

.message.success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.message.warning { border-color: #fed7aa; background: #fff7ed; color: #9a3412; }
.message.error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }

@media (max-width: 900px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .grid.two, .grid.side, .stats-grid, .playable-grid, .random-rule, .random-entry-form, .mat-console-grid, .mat-console-layout, .console-winner-actions { grid-template-columns: 1fr; }
  .filters input, .filters select { width: 100%; }
  .fighters { grid-template-columns: 1fr; }
  .inline-weigh-form, .inline-pay-form { grid-template-columns: 1fr; min-width: 220px; }
  .display-shell { width: min(100% - 22px, 100%); padding-top: 14px; }
  .display-top { align-items: flex-start; flex-direction: column; }
  .display-side-title { justify-items: start; }
  .display-brand-block h1 { white-space: normal; font-size: 28px; }
  .display-side-title strong { font-size: 34px; }
  .display-podium,
  .display-ranking-list,
  .display-mats-grid,
  .display-fighters { grid-template-columns: 1fr; grid-template-areas: none; }
  .display-podium-card.rank-1,
  .display-podium-card.rank-2,
  .display-podium-card.rank-3 { grid-area: auto; min-height: 150px; }
  .display-mat-card { min-height: 0; }
}

@media print {
  body { background: #fff; }
  .topbar, .page-head, .panel > .section-title, .chips, .messages { display: none; }
  .page { width: 100%; margin: 0; }
  .panel { border: 0; box-shadow: none; padding: 0; margin: 0; }
  .bracket-scroll { overflow: visible; }
  .bracket-paper {
    min-width: 0;
    width: 100%;
    min-height: 0;
    box-shadow: none;
    border: 0;
  }
}
