:root {
  color-scheme: light;
  --ink: #18253a;
  --muted: #718096;
  --line: #e4e9f0;
  --paper: #ffffff;
  --canvas: #f3f6fa;
  --red: #e94b46;
  --red-dark: #ca3838;
  --yellow: #ffc94a;
  --green: #188b69;
  --blue: #4e70c9;
  --shadow: 0 14px 34px rgba(26, 43, 69, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: not-allowed; opacity: .55; }

.topbar {
  height: 68px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #18253a;
  color: #fff;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  font-size: 15px;
  letter-spacing: -.02em;
}

.brand strong { font-weight: 700; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--yellow);
  color: #382c14;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 700;
  transform: rotate(-5deg);
}

.topbar-actions { display: flex; align-items: center; gap: 9px; }
.save-status { color: #bdc8d9; font-size: 12px; margin-right: 8px; }
.file-button { display: inline-flex; align-items: center; }

.page-shell { width: min(1180px, calc(100% - 48px)); margin: 30px auto 0; }
.hero {
  min-height: 254px;
  padding: 35px 42px;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
  border-radius: 24px;
  background: linear-gradient(115deg, #17243a 0%, #233752 62%, #2c4965 100%);
  color: white;
  box-shadow: 0 18px 42px rgba(24, 37, 58, .17);
}
.hero-copy, .hero-summary { position: relative; z-index: 1; }
.eyebrow {
  margin: 0 0 8px;
  color: #f7c654;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0;
  font-family: 'Space Grotesk', 'DM Sans', sans-serif;
  font-size: clamp(31px, 4vw, 47px);
  line-height: 1.04;
  letter-spacing: -.06em;
}
.hero h1 span { color: #ffc94a; }
.hero-description { max-width: 535px; margin: 15px 0 0; color: #c4cfde; font-size: 14px; }
.hero-summary {
  min-width: 245px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 20px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 17px;
  background: rgba(255,255,255,.07);
  backdrop-filter: blur(8px);
}
.summary-item { display: flex; flex-direction: column; gap: 1px; color: #b9c5d4; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.summary-number { color: white; font-family: 'Space Grotesk', sans-serif; font-size: 29px; font-weight: 700; line-height: 1.1; letter-spacing: -.05em; }
.summary-label { font-size: 18px; white-space: nowrap; }
.summary-divider { width: 1px; height: 38px; background: rgba(255,255,255,.18); }
.hero-decoration { position: absolute; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; pointer-events: none; }
.hero-decoration-one { width: 315px; height: 315px; right: 20%; top: -200px; }
.hero-decoration-two { width: 235px; height: 235px; right: 14%; bottom: -185px; }

.main-tabs { display: flex; gap: 7px; margin: 26px 0 19px; border-bottom: 1px solid var(--line); }
.tab-button {
  padding: 0 17px 14px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  position: relative;
  border: 0;
  background: transparent;
  color: #758197;
  font-weight: 600;
}
.tab-button:hover { color: var(--ink); }
.tab-button.is-active { color: var(--ink); }
.tab-button.is-active::after { content: ''; position: absolute; height: 3px; bottom: -1px; left: 16px; right: 16px; border-radius: 4px 4px 0 0; background: var(--red); }
.tab-icon { color: #9ba7b9; font-family: 'Space Grotesk', sans-serif; font-size: 10px; font-weight: 700; }
.tab-button.is-active .tab-icon { color: var(--red); }

.view-section { min-height: 340px; padding-bottom: 35px; }
.is-hidden { display: none !important; }
.section-heading {
  margin: 0 0 4px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  letter-spacing: -.045em;
}
.section-lead { margin: 0; color: var(--muted); font-size: 13px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 0 0 19px; }
.section-head-actions { display: flex; gap: 8px; align-items: center; }

.panel {
  background: var(--paper);
  border: 1px solid #e9edf3;
  border-radius: 17px;
  box-shadow: 0 5px 18px rgba(31, 49, 75, .035);
}
.panel-pad { padding: 21px; }
.panel-title { margin: 0 0 4px; font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.panel-subtitle { margin: 0; color: var(--muted); font-size: 12px; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 17px; }

.button {
  min-height: 39px;
  padding: 9px 15px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--red);
  color: white;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.button:hover:not(:disabled) { background: var(--red-dark); box-shadow: 0 5px 13px rgba(220, 61, 61, .18); transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button-secondary { color: #34435a; background: #f4f6f9; border-color: #e5e9ef; }
.button-secondary:hover:not(:disabled) { background: #e9edf3; box-shadow: none; }
.button-quiet { color: #d5deeb; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); }
.button-quiet:hover:not(:disabled) { color: #fff; background: rgba(255,255,255,.15); box-shadow: none; }
.button-small { min-height: 32px; padding: 6px 10px; border-radius: 8px; font-size: 11px; }
.button-danger { background: #fff1ef; color: #ba4440; border-color: #f6d6d2; }
.button-danger:hover:not(:disabled) { background: #ffe5e1; box-shadow: none; }
.button-success { background: var(--green); }
.button-success:hover:not(:disabled) { background: #117354; box-shadow: 0 5px 13px rgba(24,139,105,.17); }
.button-plain { background: transparent; border-color: var(--line); color: #53627a; }
.button-plain:hover:not(:disabled) { background: #f6f8fb; box-shadow: none; }

.form-row { display: flex; align-items: flex-end; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field-label { color: #5f6e83; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.input, .select {
  min-height: 40px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #dce3ec;
  border-radius: 9px;
  outline: none;
  background: white;
  color: var(--ink);
  font-size: 13px;
}
.input:focus, .select:focus { border-color: #8aa0df; box-shadow: 0 0 0 3px rgba(78,112,201,.11); }
.input::placeholder { color: #a7b1bf; }
.hint { color: var(--muted); font-size: 11px; }

.player-toolbar { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(270px, .8fr); gap: 15px; margin-bottom: 17px; }
.add-player-panel { padding: 17px 19px; }
.add-player-panel .form-row { margin-top: 13px; }
.add-player-panel .field { flex: 1; }
.draft-rules { padding: 17px 19px; display: flex; align-items: flex-start; gap: 12px; background: #fffaf0; border-color: #f3e8c9; }
.rule-icon { width: 31px; height: 31px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: #ffefc8; color: #946c19; font-weight: 800; }
.draft-rules p { margin: 2px 0 0; color: #70644c; font-size: 12px; }
.player-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.player-card { padding: 17px 18px; }
.player-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 13px; }
.player-name { max-width: 100%; overflow-wrap: anywhere; margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.03em; }
.player-number { margin-right: 7px; color: #a0aabc; font-family: 'Space Grotesk', sans-serif; font-size: 10px; }
.draft-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.draft-slot { min-width: 0; padding: 7px; display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 8px; border: 1px solid #edf0f4; border-radius: 11px; background: #fbfcfe; }
.draft-slot-art { width: 48px; height: 52px; overflow: hidden; display: grid; place-items: center; border-radius: 8px; background: #fff; }
.draft-slot-image { width: 100%; height: 100%; object-fit: contain; }
.driver-placeholder { width: 35px; height: 35px; display: grid; place-items: center; border: 1px dashed #cfd7e2; border-radius: 50%; color: #a5afbd; font-family: 'Space Grotesk', sans-serif; font-weight: 700; }
.draft-slot-fields { min-width: 0; }
.draft-slot-fields .draft-label { display: block; margin: 0 0 4px; color: #778398; font-size: 9px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.draft-slots .select { min-height: 37px; padding: 7px 9px; font-size: 12px; }
.draft-label { display: block; margin: 0 0 5px; color: #778398; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.card-foot { margin-top: 11px; display: flex; justify-content: space-between; align-items: center; gap: 9px; }
.draft-state { color: #8591a3; font-size: 11px; }
.draft-state.is-ready { color: var(--green); font-weight: 700; }
.empty-state { padding: 42px 20px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 15px; }
.empty-state .button { margin-top: 14px; }
.warning-box, .info-box, .success-box {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12px;
}
.warning-box { color: #8d5b0f; background: #fff7e5; border: 1px solid #f4dfb3; }
.info-box { color: #53637a; background: #f3f7fc; border: 1px solid #e0e8f2; }
.success-box { color: #17684f; background: #eaf7f1; border: 1px solid #ccebdd; }

.season-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; align-items: start; gap: 16px; }
.season-main { min-width: 0; }
.season-sidebar { display: flex; flex-direction: column; gap: 14px; }
.season-toolbar { display: flex; align-items: center; gap: 9px; }
.season-select { max-width: 190px; min-height: 36px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 15px; }
.stat-card { padding: 14px 16px; }
.stat-card-value { display: block; font-family: 'Space Grotesk', sans-serif; font-size: 23px; font-weight: 700; letter-spacing: -.05em; }
.stat-card-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.standings-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.standings-table th { padding: 10px 8px; color: #8a95a7; font-size: 9px; letter-spacing: .08em; text-align: left; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.standings-table td { padding: 10px 8px; border-bottom: 1px solid #f0f2f6; }
.standings-table tr:last-child td { border-bottom: 0; }
.standings-table .place { width: 32px; color: #9ca8b8; font-family: 'Space Grotesk', sans-serif; font-weight: 700; }
.standings-table .points { font-family: 'Space Grotesk', sans-serif; font-size: 15px; font-weight: 700; }
.standings-table .name-cell { font-weight: 700; }
.champion-badge { display: inline-block; margin-left: 7px; padding: 2px 5px; border-radius: 5px; background: #fff2cc; color: #8c6715; font-size: 8px; font-weight: 800; vertical-align: middle; }
.table-wrap { overflow-x: auto; }
.round-list { display: flex; flex-direction: column; gap: 9px; }
.round-card { padding: 14px 16px; }
.round-heading { display: flex; justify-content: space-between; align-items: center; margin: 0 0 9px; font-size: 12px; font-weight: 700; }
.round-heading span:last-child { color: #8b97a9; font-size: 10px; font-weight: 500; }
.match-row { min-height: 47px; padding: 8px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; border-top: 1px solid #f0f2f6; }
.match-versus { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; font-weight: 600; }
.match-versus .versus-label { color: #a4afbe; font-size: 9px; font-weight: 700; }
.match-player { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-status { color: #8b97a9; font-size: 10px; }
.match-status.is-done { color: var(--green); font-weight: 700; }
.match-row .button { min-height: 30px; padding: 5px 9px; font-size: 10px; }
.sidebar-panel { padding: 17px; }
.sidebar-panel .panel-title { font-size: 13px; }
.sidebar-panel .panel-subtitle { line-height: 1.55; }
.event-chip { display: inline-flex; padding: 4px 8px; margin: 4px 3px 0 0; border-radius: 7px; background: #fff7e5; color: #8d691b; font-size: 10px; font-weight: 700; }

.active-match-panel { margin-bottom: 15px; overflow: hidden; border-color: #f3c8c5; box-shadow: 0 8px 25px rgba(220, 70, 65, .08); }
.active-match-head { padding: 15px 19px; display: flex; justify-content: space-between; align-items: center; gap: 15px; background: #fff5f4; border-bottom: 1px solid #f7dedb; }
.active-match-head .panel-title { margin: 0; }
.active-match-body { padding: 19px; }
.step-label { display: inline-flex; margin-bottom: 9px; padding: 4px 8px; border-radius: 6px; background: #edf1fa; color: #5268aa; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.active-match-body h3 { margin: 0 0 5px; font-size: 17px; letter-spacing: -.035em; }
.active-match-body > p { margin: 0 0 13px; color: var(--muted); font-size: 12px; }
.event-choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.event-option { min-height: 100%; padding: 11px; text-align: left; border: 1px solid #e6eaf0; border-radius: 11px; background: #fff; color: var(--ink); }
.event-option:hover:not(:disabled) { border-color: #e9b75b; background: #fffaf0; }
.event-option strong { display: block; margin-bottom: 4px; font-size: 11px; }
.event-option span { display: block; color: var(--muted); font-size: 10px; line-height: 1.45; }
.event-use-block { padding: 12px 13px; margin-top: 12px; border: 1px solid #f1e4c7; border-radius: 12px; background: #fffcf6; }
.event-use-title { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; font-weight: 700; }
.event-applied { margin: 7px 0 0; padding: 8px 10px; border-radius: 8px; background: #fff3d7; color: #785817; font-size: 11px; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 15px; }
.character-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 11px 0; }
.character-pick-button { min-height: 72px; padding: 8px 10px; display: flex; align-items: center; gap: 10px; border: 1px solid #e2e7ef; border-radius: 10px; background: white; color: var(--ink); text-align: left; font-weight: 700; font-size: 12px; }
.character-pick-image { width: 52px; height: 54px; flex: 0 0 auto; object-fit: contain; border-radius: 7px; background: #fff; }
.character-pick-button:hover:not(:disabled) { border-color: #8da1dc; background: #f7f8fd; }
.character-pick-button.is-selected { border-color: #8b9ee0; background: #f0f3ff; color: #394c9c; }
.character-pick-button:disabled { opacity: .42; }
.pick-turn { margin: 0 0 8px; color: #62718a; font-size: 11px; font-weight: 700; }
.track-choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 12px 0; }
.track-choice {
  min-height: 177px;
  padding: 9px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: stretch;
  gap: 6px;
  border: 1px solid #e5e9f0;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}
.track-choice:hover:not(:disabled) { border-color: #7f96db; background: #f7f8fd; }
.track-choice small { color: #8a96a8; font-size: 9px; }
.track-choice strong { font-size: 12px; line-height: 1.25; }
.track-card-cup { display: flex; align-items: center; gap: 6px; min-height: 17px; }
.track-card-cup img { width: 43px; height: 16px; object-fit: contain; image-rendering: pixelated; }
.track-map-stage { min-height: 84px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: #18253a; }
.track-map-stage img { width: 100%; height: 84px; object-fit: contain; }
.track-choice.is-banned { opacity: .4; text-decoration: line-through; }
.track-reveal { padding: 17px; border: 1px solid #d8eadf; border-radius: 13px; background: #f0faf4; text-align: center; }
.track-reveal-map { width: min(100%, 440px); height: 145px; object-fit: contain; display: block; margin: 0 auto 9px; border-radius: 10px; background: #18253a; }
.track-reveal-cup { display: flex; justify-content: center; align-items: center; gap: 7px; color: #438263; font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.track-reveal-cup img { width: 54px; height: 18px; object-fit: contain; image-rendering: pixelated; }
.track-reveal .track-name { margin: 3px 0 8px; color: #176548; font-family: 'Space Grotesk', sans-serif; font-size: 23px; font-weight: 700; letter-spacing: -.04em; }
.race-event-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0; }
.result-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 13px; }
.result-buttons .button { min-height: 44px; }

.battle-intro { margin: -2px 0 17px; color: var(--muted); font-size: 13px; }
.battle-create-layout { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 15px; }
.battle-create-panel { padding: 19px; }
.battle-course-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: -2px 0 14px; }
.battle-course-gallery figure { min-width: 0; margin: 0; overflow: hidden; border: 1px solid #e4e9f0; border-radius: 8px; background: #18253a; }
.battle-course-gallery img { width: 100%; height: 50px; display: block; object-fit: contain; }
.battle-course-gallery figcaption { padding: 4px 2px; background: white; color: #64738a; font-size: 8px; text-align: center; white-space: nowrap; }
.battle-player-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; max-height: 195px; overflow: auto; margin-top: 9px; }
.battle-player-option { position: relative; }
.battle-player-option input { position: absolute; opacity: 0; }
.battle-player-option span { min-height: 39px; padding: 8px 10px; display: flex; align-items: center; gap: 8px; border: 1px solid #e2e7ef; border-radius: 9px; color: #657289; font-size: 11px; font-weight: 600; cursor: pointer; }
.battle-player-option span::before { content: ''; width: 14px; height: 14px; flex: 0 0 auto; border: 1px solid #c8d0dc; border-radius: 4px; background: white; }
.battle-player-option input:checked + span { border-color: #a6b2e8; background: #f4f5ff; color: #394b91; }
.battle-player-option input:checked + span::before { border-color: #6578c7; background: #6578c7; box-shadow: inset 0 0 0 3px white; }
.battle-player-option input:focus-visible + span { outline: 3px solid rgba(78,112,201,.2); }
.cup-list { display: flex; flex-direction: column; gap: 8px; margin-top: 13px; }
.cup-list-item { width: 100%; padding: 11px 13px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid #e6eaf0; border-radius: 10px; background: white; color: var(--ink); text-align: left; }
.cup-list-item:hover { border-color: #a8b3dd; }
.cup-list-item.is-active { border-color: #8295d8; background: #f6f7ff; }
.cup-list-item strong { display: block; font-size: 12px; }
.cup-list-item small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.cup-status { padding: 4px 7px; border-radius: 6px; background: #eef2f7; color: #62718a; font-size: 9px; font-weight: 700; white-space: nowrap; }
.cup-status.is-complete { background: #eaf7f1; color: #18815e; }
.cup-details { margin-top: 15px; }
.cup-banner { padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; gap: 15px; border-radius: 15px; background: #fff5dd; border: 1px solid #f3e2b8; }
.cup-banner-lead { min-width: 0; display: flex; align-items: center; gap: 13px; }
.cup-battle-map { width: 122px; height: 67px; flex: 0 0 auto; object-fit: contain; border-radius: 9px; background: #18253a; }
.cup-banner h3 { margin: 0 0 2px; font-family: 'Space Grotesk', sans-serif; font-size: 18px; letter-spacing: -.04em; }
.battle-match-map { width: fit-content; margin: 9px 0; display: flex; align-items: center; gap: 10px; color: #566881; font-size: 11px; }
.battle-match-map img { width: 160px; height: 66px; object-fit: contain; border-radius: 8px; background: #18253a; }
.cup-banner p { margin: 0; color: #80704d; font-size: 11px; }
.cup-champion { color: #74570e; text-align: right; font-size: 10px; font-weight: 700; }
.cup-champion strong { display: block; color: #44350f; font-family: 'Space Grotesk', sans-serif; font-size: 15px; }
.cup-rounds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 13px; }
.cup-round-card { padding: 14px; }
.cup-round-card .round-heading { margin-bottom: 6px; }
.playoff-panel { margin-top: 14px; }
.playoff-panel .panel-header { align-items: flex-start; }
.playoff-panel .success-box { margin: 7px 0 0; }
.cup-driver-note { margin: 10px 0 8px; color: #738197; font-size: 11px; }
.cup-entrants { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 7px; margin-bottom: 13px; }
.cup-entrant { min-width: 0; min-height: 55px; padding: 6px 9px; display: flex; align-items: center; gap: 8px; border: 1px solid #e7ebf1; border-radius: 10px; background: white; }
.cup-entrant-portrait { width: 39px; height: 41px; flex: 0 0 auto; overflow: hidden; display: grid; place-items: center; border-radius: 7px; background: #f7f8fa; }
.cup-entrant-portrait > img { max-width: 100%; max-height: 100%; object-fit: contain; }
.entrant-draft-previews { display: flex; align-items: center; justify-content: center; gap: 1px; }
.entrant-draft-previews img { width: 18px; height: 34px; object-fit: contain; }
.cup-entrant-name { min-width: 0; flex: 1; }
.cup-entrant-name strong, .cup-entrant-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cup-entrant-name strong { font-size: 10px; }
.cup-entrant-name small { margin-top: 2px; color: #8793a4; font-size: 8px; }
.bracket-heading { margin: 18px 0 9px; display: flex; justify-content: space-between; align-items: flex-end; gap: 15px; }
.bracket-heading h3 { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 17px; letter-spacing: -.035em; }
.bracket-heading p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.bracket-legend { display: flex; flex-wrap: wrap; gap: 10px; color: #778397; font-size: 9px; }
.bracket-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; }
.legend-upper { background: #3c9c78; }
.legend-lower { background: #d39c3e; }
.cup-bracket-scroll { overflow-x: auto; padding: 1px 1px 10px; scrollbar-color: #c8d0dc transparent; }
.cup-bracket-tree { width: max-content; min-width: 100%; display: flex; align-items: stretch; gap: 10px; }
.cup-bracket-column { width: 282px; flex: 0 0 282px; padding: 11px; border: 1px solid #e6eaf0; border-radius: 13px; background: #f8fafd; }
.cup-bracket-column-head { padding: 1px 2px 9px; display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid #e9edf2; }
.cup-bracket-column-head span { font-family: 'Space Grotesk', sans-serif; font-size: 13px; font-weight: 700; }
.cup-bracket-column-head small { color: #8c98a9; font-size: 9px; }
.bracket-round-flow { align-self: center; color: #adb7c6; font-size: 25px; font-weight: 700; }
.bracket-lane { padding-top: 9px; }
.bracket-lane + .bracket-lane, .bracket-byes { margin-top: 9px; border-top: 1px solid #e9edf2; }
.bracket-lane-heading { margin: 0 0 6px; color: #6d7b90; font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.lane-upper { color: #23815f; }
.lane-lower { color: #9a6b14; }
.lane-final { color: #6557a5; }
.bracket-match-card { padding: 8px; margin-top: 7px; border: 1px solid #e4e9f0; border-radius: 10px; background: white; box-shadow: 0 2px 5px rgba(27, 46, 73, .025); }
.bracket-match-stage { margin: 0 0 5px 2px; color: #8793a4; font-size: 8px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.bracket-player-row { min-height: 47px; padding: 5px 6px; display: flex; align-items: center; gap: 6px; border-radius: 7px; background: #f8f9fb; }
.bracket-player-row.is-bracket-winner { background: #eef8f3; }
.bracket-player-row.is-bracket-loser { background: #fbf5f4; }
.bracket-driver-portrait { width: 36px; height: 36px; flex: 0 0 auto; overflow: hidden; display: flex; justify-content: center; align-items: center; gap: 0; border-radius: 6px; background: white; }
.bracket-driver-portrait img { width: 100%; height: 100%; object-fit: contain; }
.bracket-driver-portrait.is-pending img { width: 50%; height: 90%; }
.bracket-player-name { min-width: 0; flex: 1; }
.bracket-player-name strong, .bracket-player-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bracket-player-name strong { font-size: 9px; }
.bracket-player-name small { margin-top: 2px; color: #8793a4; font-size: 8px; }
.bracket-versus { padding: 1px 0; color: #a0abba; font-size: 8px; font-weight: 800; text-align: center; text-transform: uppercase; }
.bracket-flow-note { padding: 5px 2px 1px; color: #8793a4; font-size: 8px; line-height: 1.35; text-align: center; }
.bracket-match-footer { min-height: 28px; margin-top: 5px; display: flex; justify-content: center; align-items: center; }
.bracket-match-footer .button { min-height: 27px; padding: 4px 9px; font-size: 9px; }
.bracket-result { color: #78869a; font-size: 9px; }
.bracket-result.is-done { color: #23815f; font-weight: 700; }
.bracket-byes { padding-top: 9px; }
.bracket-bye-row { min-height: 43px; margin-top: 5px; padding: 5px 6px; display: flex; align-items: center; gap: 7px; border: 1px dashed #d6dde7; border-radius: 8px; background: #fff; }
.bracket-bye-row .bracket-driver-portrait { width: 32px; height: 32px; }
.bracket-bye-row strong, .bracket-bye-row small { display: block; }
.bracket-bye-row strong { font-size: 9px; }
.bracket-bye-row small { color: #8995a6; font-size: 8px; }
.cup-driver-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.cup-driver-chip { min-height: 38px; padding: 4px 8px 4px 4px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid #e5e9f0; border-radius: 8px; background: white; color: #53627a; font-size: 10px; font-weight: 700; }
.cup-driver-chip img { width: 30px; height: 30px; object-fit: contain; border-radius: 5px; }
.loss-badge { padding: 3px 6px; border-radius: 5px; background: #f0f2f6; color: #657289; font-size: 9px; font-weight: 700; white-space: nowrap; }
.bye-note { margin: 7px 0 0; padding-top: 7px; border-top: 1px solid #f0f2f6; color: #7a8799; font-size: 10px; }
.cup-match-active { margin-top: 13px; }

.page-footer { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 18px 0 28px; display: flex; justify-content: space-between; gap: 15px; color: #99a4b4; font-size: 10px; }
.page-footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.page-footer a:hover { color: #66758b; }
.toast { position: fixed; z-index: 10; right: 22px; bottom: 20px; max-width: min(400px, calc(100vw - 40px)); padding: 12px 16px; border-radius: 10px; background: #18253a; color: white; box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .hero { padding: 31px; }
  .hero-summary { min-width: 205px; }
  .season-layout { grid-template-columns: minmax(0, 1fr) 265px; }
  .player-toolbar { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .topbar { height: auto; min-height: 62px; padding: 11px 18px; }
  .topbar-actions { gap: 6px; }
  .save-status { display: none; }
  .page-shell, .page-footer { width: min(100% - 30px, 560px); }
  .page-shell { margin-top: 17px; }
  .hero { min-height: 0; padding: 27px 23px; align-items: flex-start; flex-direction: column; gap: 20px; border-radius: 18px; }
  .hero-summary { width: 100%; min-width: 0; max-width: 280px; }
  .hero-description { font-size: 12px; }
  .main-tabs { gap: 0; margin-top: 20px; }
  .tab-button { padding: 0 9px 12px; gap: 6px; font-size: 11px; }
  .tab-button.is-active::after { left: 8px; right: 8px; }
  .tab-icon { display: none; }
  .player-toolbar, .season-layout, .battle-create-layout { grid-template-columns: 1fr; }
  .player-grid { grid-template-columns: 1fr; }
  .season-sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .season-toolbar { align-items: stretch; flex-direction: column; }
  .season-select { max-width: none; }
  .cup-rounds { grid-template-columns: 1fr; }
  .bracket-heading { align-items: flex-start; flex-direction: column; }
  .cup-bracket-column { width: 260px; flex-basis: 260px; }
  .event-choice-grid { grid-template-columns: 1fr; }
  .battle-course-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .track-choice-grid { gap: 6px; }
  .track-choice { min-height: 155px; padding: 9px; }
  .track-map-stage, .track-map-stage img { height: 70px; min-height: 70px; }
  .track-choice strong { font-size: 10px; }
  .page-footer { flex-direction: column; gap: 3px; }
}
@media (max-width: 430px) {
  .topbar { align-items: flex-start; }
  .brand { font-size: 12px; }
  .brand-mark { width: 30px; height: 30px; }
  .topbar-actions .button { padding: 5px 7px; font-size: 9px; }
  .hero h1 { font-size: 34px; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .section-head-actions { width: 100%; }
  .section-head-actions .button { flex: 1; }
  .draft-slots { grid-template-columns: 1fr; }
  .season-sidebar { grid-template-columns: 1fr; }
  .stat-grid { gap: 6px; }
  .stat-card { padding: 11px; }
  .stat-card-value { font-size: 19px; }
  .stat-card-label { font-size: 8px; }
  .standings-table { font-size: 10px; }
  .standings-table th { font-size: 8px; }
  .track-choice-grid { grid-template-columns: 1fr; }
  .track-choice { min-height: 150px; }
  .track-map-stage, .track-map-stage img { height: 68px; min-height: 68px; }
  .track-reveal-map { height: 115px; }
  .result-buttons { grid-template-columns: 1fr; }
  .cup-banner { align-items: flex-start; flex-direction: column; }
  .cup-banner-lead { width: 100%; }
  .cup-battle-map { width: 100px; height: 58px; }
  .cup-champion { text-align: left; }
  .cup-bracket-column { width: 250px; flex-basis: 250px; }
  .bracket-legend { gap: 7px; }
  .battle-match-map { align-items: flex-start; flex-direction: column; }
  .battle-match-map img { width: min(100%, 280px); }
}
