:root {
  --purple-950: #21152f;
  --purple-900: #321d48;
  --purple-800: #472861;
  --purple-700: #5b3f8c;
  --purple-600: #6c4da4;
  --purple-100: #eee8f7;
  --purple-50: #f7f3fb;
  --ink: #202027;
  --muted: #6d6b74;
  --line: #dedce3;
  --line-dark: #c9c5d0;
  --paper: #ffffff;
  --canvas: #f4f3f6;
  --green: #25745d;
  --green-soft: #dff4ec;
  --amber: #9a6419;
  --amber-soft: #fff2d8;
  --red: #a63e43;
  --red-soft: #fde9e9;
  --blue: #2f6581;
  --blue-soft: #e5f0f6;
  --shadow: 0 8px 28px rgba(34, 25, 48, 0.08);
  --shadow-strong: 0 16px 60px rgba(34, 25, 48, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --header-height: 132px;
  color-scheme: light;
  font-family:
    "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC",
    system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 95% -10%, rgba(91, 63, 140, 0.13), transparent 28rem),
    var(--canvas);
}

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

button {
  cursor: pointer;
}

a {
  color: var(--purple-700);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(91, 63, 140, 0.28);
  outline-offset: 2px;
}

.boot-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  align-content: center;
  gap: 18px;
  color: var(--muted);
}

.boot-mark,
.brand-mark {
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, var(--purple-700), var(--purple-900));
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: -0.06em;
}

.boot-mark {
  width: 74px;
  height: 74px;
  border-radius: 24px;
  font-size: 25px;
  box-shadow: var(--shadow-strong);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.header-main {
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  font-size: 16px;
  box-shadow: 0 8px 18px rgba(50, 29, 72, 0.2);
}

.brand-title {
  display: block;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-sub {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.header-event {
  margin-left: auto;
  text-align: right;
  border-left: 1px solid var(--line);
  padding-left: 20px;
}

.header-event strong {
  display: block;
  font-size: 15px;
}

.header-event span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.role-chip,
.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.role-chip.admin {
  color: var(--purple-800);
  background: var(--purple-100);
}

.role-chip.viewer {
  color: var(--blue);
  background: var(--blue-soft);
}

.sync-chip {
  color: var(--green);
  background: var(--green-soft);
}

.sync-chip.offline,
.sync-chip.error {
  color: var(--red);
  background: var(--red-soft);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.header-nav {
  border-top: 1px solid var(--line);
}

.nav-inner {
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-inner::-webkit-scrollbar {
  display: none;
}

.nav-button {
  position: relative;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 15px 14px 14px;
  font-size: 13px;
  font-weight: 700;
}

.nav-button:hover {
  color: var(--purple-800);
}

.nav-button.active {
  color: var(--purple-800);
}

.nav-button.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 3px;
  background: var(--purple-700);
  border-radius: 3px 3px 0 0;
}

.page {
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 90px;
  min-width: 0;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  display: block;
  color: var(--purple-700);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.page-title {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.heading-actions,
.button-row,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.08), transparent 48%),
    linear-gradient(125deg, var(--purple-950), var(--purple-700));
  color: white;
  padding: 34px 38px;
  box-shadow: var(--shadow-strong);
}

.hero::after {
  content: "MH";
  position: absolute;
  right: 24px;
  bottom: -64px;
  font: 800 210px/1 Georgia, serif;
  color: rgba(255, 255, 255, 0.045);
  letter-spacing: -0.14em;
  pointer-events: none;
}

.hero-kicker {
  color: #d8c8eb;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.hero h2 {
  max-width: 780px;
  margin: 12px 0;
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: clamp(28px, 4.3vw, 54px);
  line-height: 1.18;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  color: #ece6f5;
  font-size: 13px;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(34, 25, 48, 0.1);
}

.button:disabled {
  cursor: not-allowed;
  transform: none;
  opacity: 0.52;
  box-shadow: none;
}

.button.primary {
  border-color: var(--purple-700);
  background: var(--purple-700);
  color: white;
}

.button.dark {
  border-color: var(--purple-950);
  background: var(--purple-950);
  color: white;
}

.button.light {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.button.ghost {
  border-color: transparent;
  background: transparent;
}

.button.danger {
  border-color: #e4afb2;
  background: var(--red-soft);
  color: var(--red);
}

.button.success {
  border-color: #a9d8c9;
  background: var(--green-soft);
  color: var(--green);
}

.button.small {
  min-height: 31px;
  padding: 6px 10px;
  font-size: 12px;
}

.button.tiny {
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 11px;
}

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

.stat-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat-value {
  display: block;
  margin-top: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.stat-foot {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 9px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.content-stack {
  display: grid;
  gap: 18px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.card-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.card-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.card-body {
  padding: 20px;
}

.card-body.flush {
  padding: 0;
}

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

.group-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 180px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #faf9fc);
}

.group-card:hover {
  border-color: var(--line-dark);
}

.group-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 17px;
  width: 3px;
  height: 35px;
  border-radius: 0 4px 4px 0;
  background: var(--group-color, var(--purple-700));
}

.group-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.group-name {
  margin: 0;
  font-size: 18px;
}

.group-count {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.group-progress {
  margin: 18px 0 14px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 7px;
}

.progress-track {
  height: 5px;
  background: #ebe9ef;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  display: block;
  height: 100%;
  background: var(--group-color, var(--purple-700));
  border-radius: inherit;
}

.group-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.neutral {
  color: var(--muted);
  background: #f0eff3;
}

.badge.purple {
  color: var(--purple-700);
  background: var(--purple-100);
}

.badge.green,
.status-badge.completed {
  color: var(--green);
  background: var(--green-soft);
}

.badge.amber,
.status-badge.scheduled,
.status-badge.ready {
  color: var(--amber);
  background: var(--amber-soft);
}

.badge.red,
.status-badge.conflict {
  color: var(--red);
  background: var(--red-soft);
}

.badge.blue,
.status-badge.live {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-badge.unassigned {
  color: var(--muted);
  background: #f0eff3;
}

.courts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
}

.court-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfafc;
  min-height: 155px;
}

.court-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.court-number strong {
  color: var(--ink);
  font-size: 16px;
}

.court-current {
  margin-top: 18px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.court-next {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.court-empty {
  color: var(--muted);
  font-size: 12px;
  margin-top: 22px;
}

.quick-match-list {
  display: grid;
}

.quick-match {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.quick-match:last-child {
  border-bottom: 0;
}

.quick-match-code {
  color: var(--muted);
  font: 700 11px/1.4 ui-monospace, "Cascadia Code", monospace;
}

.quick-players {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.winner-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 750;
  text-align: left;
}

.winner-button:hover {
  border-color: var(--purple-600);
  color: var(--purple-700);
}

.winner-button.is-winner {
  border-color: #a7d7c8;
  background: var(--green-soft);
  color: var(--green);
}

.winner-button.is-loser {
  color: #b0adb4;
  background: #f6f5f7;
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 15px;
  border-radius: 16px;
  color: var(--purple-700);
  background: var(--purple-100);
  font: 800 15px/1 Georgia, serif;
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 15px;
}

.empty-state p {
  max-width: 520px;
  margin: 0 auto 18px;
  font-size: 13px;
  line-height: 1.75;
}

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

.draw-card .card-body {
  min-height: 260px;
}

.draw-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

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

.mini-group {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfafc;
}

.mini-group-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 900;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin: 0 4px 5px 0;
  padding: 4px 7px;
  border-radius: 6px;
  background: white;
  border: 1px solid #e8e5ec;
  color: #4b4851;
  font-size: 11px;
  line-height: 1.35;
}

.seed-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.seed-list {
  display: grid;
  gap: 7px;
}

.seed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.qualifier-list {
  display: grid;
  gap: 7px;
}

.qualifier-row {
  display: grid;
  grid-template-columns: 36px 1fr auto 1fr;
  align-items: center;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
}

.qualifier-row span:nth-child(3) {
  color: var(--muted);
  font-size: 10px;
}

.warning-box,
.info-box,
.error-box {
  display: flex;
  gap: 10px;
  padding: 13px 15px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.65;
}

.warning-box {
  background: var(--amber-soft);
  border: 1px solid #efd7a8;
  color: #71501d;
}

.info-box {
  background: var(--blue-soft);
  border: 1px solid #c8dde8;
  color: #315669;
}

.error-box {
  background: var(--red-soft);
  border: 1px solid #efc5c7;
  color: #783036;
}

.warning-box strong,
.info-box strong,
.error-box strong {
  display: block;
  margin-bottom: 2px;
}

.group-sections {
  display: grid;
  gap: 20px;
}

.group-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.group-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 18px;
  background: #faf9fc;
  border-bottom: 1px solid var(--line);
}

.group-section-header h3 {
  margin: 0;
  font-size: 16px;
}

.group-section-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

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

.standings-pane {
  border-right: 1px solid var(--line);
  padding: 14px;
}

.matches-pane {
  padding: 14px;
}

.pane-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.standings-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.standings-table th,
.standings-table td,
.data-table th,
.data-table td {
  padding: 9px 8px;
  border-bottom: 1px solid #eceaf0;
  text-align: left;
  vertical-align: middle;
}

.standings-table th,
.data-table th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
  background: #faf9fc;
}

.standings-table tr:last-child td,
.data-table tr:last-child td {
  border-bottom: 0;
}

.standings-table tr.qualify td {
  background: #f5fbf8;
}

.standings-table tr.pending td {
  background: #fffaf0;
}

.rank-cell {
  font: 800 14px/1 Georgia, serif;
}

.match-list {
  display: grid;
  gap: 7px;
}

.match-row {
  display: grid;
  grid-template-columns: 65px minmax(160px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.match-row.mine-live {
  border-color: #a8c9db;
  background: #f6fbfd;
}

.match-code {
  color: var(--muted);
  font: 650 10px/1.45 ui-monospace, "Cascadia Code", monospace;
}

.match-players {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.match-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.group-summary-actions {
  padding: 14px;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  background: #fcfbfd;
}

.bracket-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.segment {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
}

.segment.active {
  background: var(--purple-700);
  color: white;
}

.bracket-shell {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.bracket-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.bracket-header-bar h2 {
  margin: 0;
  font-size: 18px;
}

.bracket-header-bar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.bracket-scroll {
  overflow: auto;
  max-height: calc(100vh - 270px);
  min-height: 450px;
  background:
    linear-gradient(90deg, rgba(91, 63, 140, 0.025) 1px, transparent 1px) 0 0 / 28px 28px,
    #fcfbfd;
}

.bracket-canvas {
  position: relative;
  min-width: 100%;
}

.bracket-phase {
  position: absolute;
  z-index: 3;
  color: var(--purple-800);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.bracket-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.bracket-card {
  position: absolute;
  width: 226px;
  height: 90px;
  z-index: 2;
  border: 1px solid #dcd7e3;
  border-radius: 10px;
  background: white;
  box-shadow: 0 4px 14px rgba(40, 26, 54, 0.06);
  overflow: hidden;
}

.bracket-card.is-live {
  border-color: #6ea8c4;
  box-shadow: 0 0 0 2px rgba(47, 101, 129, 0.12);
}

.bracket-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 26px;
  padding: 0 9px;
  border-bottom: 1px solid #ebe8ef;
  background: #f8f6fa;
  color: var(--muted);
  font: 700 9px/1 ui-monospace, "Cascadia Code", monospace;
}

.bracket-player {
  width: 100%;
  height: 31px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 0;
  background: white;
  color: var(--ink);
  text-align: left;
  font-size: 11px;
}

.bracket-player + .bracket-player {
  border-top: 1px solid #efedf2;
}

.bracket-player:hover {
  background: var(--purple-50);
}

.bracket-player.winner {
  color: var(--green);
  background: #f0faf6;
  font-weight: 850;
}

.bracket-player.loser {
  color: #aaa7ae;
}

.player-seed {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--purple-100);
  color: var(--purple-700);
  font-size: 8px;
  font-weight: 900;
}

.player-main {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-dept {
  margin-left: auto;
  max-width: 78px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.third-place-wrap {
  padding: 22px;
  border-top: 1px solid var(--line);
  background: #faf9fc;
}

.third-place-wrap h3 {
  margin: 0 0 5px;
  font-size: 14px;
}

.third-place-wrap p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
}

.podium-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 20px 20px;
}

.podium-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.podium-place {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.podium-name {
  margin-top: 7px;
  font-size: 15px;
  font-weight: 850;
}

.podium-dept {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

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

.schedule-court {
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.schedule-court-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  color: var(--muted);
  background: var(--purple-950);
  color: white;
  font-size: 12px;
  font-weight: 850;
}

.schedule-court-body {
  padding: 15px;
}

.court-match-label {
  color: var(--muted);
  font: 700 9px/1.4 ui-monospace, "Cascadia Code", monospace;
  letter-spacing: 0.05em;
}

.court-match-title {
  margin: 7px 0;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.45;
}

.court-match-meta {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.court-match-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  min-width: 760px;
}

.data-table.compact {
  min-width: 0;
}

.data-table .name {
  font-weight: 800;
}

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

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table tfoot td {
  font-weight: 900;
  background: #faf9fc;
}

.score-total {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
}

.rank-medal {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  color: var(--muted);
  background: #f0eff3;
  font: 800 12px/1 Georgia, serif;
}

.rank-medal.gold {
  color: #875d12;
  background: #ffefc4;
}

.rank-medal.silver {
  color: #5c6370;
  background: #e7eaf0;
}

.rank-medal.bronze {
  color: #7b4a2f;
  background: #f2dfd1;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 11px 14px;
  border: 1px solid #d9d3e3;
  border-radius: 11px;
  background: var(--purple-50);
}

.bulk-toolbar .check-row {
  min-height: auto;
  font-weight: 800;
}

.bulk-toolbar .inline-actions {
  margin-left: auto;
}

.bulk-count {
  color: var(--purple-800);
  font-size: 12px;
  white-space: nowrap;
}

.select-cell {
  width: 34px;
  text-align: center !important;
}

.select-cell input {
  width: 16px;
  height: 16px;
  accent-color: var(--purple-700);
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  padding: 9px 11px;
  font-size: 13px;
}

.textarea {
  min-height: 88px;
  resize: vertical;
}

.filter-bar .input,
.filter-bar .select {
  width: auto;
  min-width: 150px;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  color: #57545d;
  font-size: 11px;
  font-weight: 800;
}

.field-hint {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  font-size: 12px;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--purple-700);
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.config-field {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfafc;
}

.config-field label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.audit-list {
  display: grid;
}

.audit-row {
  display: grid;
  grid-template-columns: 125px 150px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.audit-row:last-child {
  border-bottom: 0;
}

.audit-time {
  color: var(--muted);
  font-size: 10px;
}

.audit-action {
  font-weight: 850;
}

.audit-detail {
  color: #56535c;
  line-height: 1.55;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 16, 33, 0.55);
  backdrop-filter: blur(6px);
}

.modal {
  width: min(560px, 100%);
  max-height: min(86vh, 820px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: white;
  box-shadow: 0 28px 90px rgba(24, 16, 33, 0.34);
  overflow: hidden;
}

.modal.large {
  width: min(920px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 19px;
}

.modal-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.modal-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--muted);
  font-size: 17px;
}

.modal-body {
  padding: 22px;
  overflow: auto;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 22px;
  border-top: 1px solid var(--line);
  background: #fbfafc;
}

.modal-impact {
  margin: 15px 0 0;
  padding: 12px 14px;
  border-radius: 9px;
  background: var(--red-soft);
  border: 1px solid #edc6c9;
  color: #793338;
  font-size: 12px;
  line-height: 1.7;
}

.winner-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.winner-choice-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  text-align: left;
}

.winner-choice-card:hover {
  border-color: var(--purple-600);
  background: var(--purple-50);
}

.winner-choice-card strong {
  display: block;
  font-size: 15px;
}

.winner-choice-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}

.import-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.import-group {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfafc;
}

.import-group span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.import-group strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.toast {
  position: fixed;
  z-index: 150;
  right: 22px;
  bottom: 22px;
  max-width: min(430px, calc(100vw - 44px));
  padding: 13px 16px;
  border-radius: 11px;
  background: var(--purple-950);
  color: white;
  box-shadow: var(--shadow-strong);
  font-size: 12px;
  line-height: 1.55;
}

.toast.error {
  background: #7b272d;
}

.toast.success {
  background: #1e5f4c;
}

.offline-ribbon {
  padding: 9px 20px;
  color: #793338;
  background: #fde9e9;
  border-bottom: 1px solid #edc6c9;
  text-align: center;
  font-size: 12px;
  font-weight: 750;
}

.saving-bar {
  position: fixed;
  z-index: 160;
  top: 0;
  left: 0;
  height: 3px;
  width: 35%;
  background: var(--purple-600);
  animation: saving 0.8s ease-in-out infinite alternate;
}

@keyframes saving {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(300%);
  }
}

.print-only {
  display: none;
}

body.presentation-mode .app-header,
body.presentation-mode .page-heading,
body.presentation-mode .bracket-toolbar,
body.presentation-mode .header-nav {
  display: none;
}

body.presentation-mode {
  background: #17121c;
}

body.presentation-mode .page {
  width: calc(100% - 30px);
  padding-top: 15px;
}

body.presentation-mode .bracket-shell {
  border-color: #46394f;
}

body.presentation-mode .bracket-scroll {
  max-height: calc(100vh - 40px);
  background: #f7f5f9;
}

@media (max-width: 1100px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .courts-grid,
  .schedule-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-workspace {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .config-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .header-main {
    min-height: 72px;
    width: calc(100% - 24px);
    gap: 12px;
  }

  .header-event {
    display: none;
  }

  .nav-inner {
    width: calc(100% - 24px);
  }

  .page {
    width: calc(100% - 24px);
    padding-top: 20px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-grid,
  .group-grid,
  .draw-grid,
  .courts-grid,
  .schedule-board,
  .podium-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-workspace {
    grid-template-columns: 1fr;
  }

  .standings-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .quick-match {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .quick-match .match-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .audit-row {
    grid-template-columns: 110px minmax(0, 1fr);
  }

  .audit-detail {
    grid-column: 2;
  }
}

@media (max-width: 620px) {
  .hero {
    padding: 26px 22px;
    border-radius: 18px;
  }

  .hero h2 {
    font-size: 32px;
  }

  .brand-sub,
  .sync-chip {
    display: none;
  }

  .stats-grid,
  .group-grid,
  .draw-grid,
  .courts-grid,
  .schedule-board,
  .draw-groups,
  .seed-layout,
  .field-grid,
  .config-grid,
  .podium-grid,
  .winner-choice,
  .import-summary {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-match {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .quick-match .match-actions {
    grid-column: auto;
  }

  .match-row {
    grid-template-columns: 55px minmax(0, 1fr);
  }

  .match-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .bracket-scroll {
    min-height: 520px;
  }

  .modal-backdrop {
    padding: 0;
    align-items: end;
  }

  .modal,
  .modal.large {
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
  }

  .audit-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .audit-detail {
    grid-column: auto;
  }
}

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

  body {
    background: white;
  }

  .app-header,
  .page-heading,
  .bracket-toolbar,
  .bracket-header-bar .button-row,
  #toast-root,
  #modal-root {
    display: none !important;
  }

  .page {
    width: 100%;
    padding: 0;
  }

  .bracket-shell {
    border: 0;
    box-shadow: none;
  }

  .bracket-scroll {
    overflow: visible;
    max-height: none;
    background: white;
  }

  .bracket-canvas {
    zoom: 0.66;
  }

  .print-only {
    display: block;
  }

  .bracket-card {
    break-inside: avoid;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
