:root {
  color-scheme: dark;
  --background: #061422;
  --panel: #0c2034;
  --surface: #172435;
  --line: #253448;
  --text: #eef4f9;
  --muted: #a9b7ca;
  --gold: #ffc15d;
  --gold-hover: #ffd28a;
  --radius: 16px;
  --body-font: "Inter", "Segoe UI", sans-serif;
  --display-font: "Barlow Condensed", "Bahnschrift", "Arial Narrow", "Roboto Condensed", "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 1rem/1.55 var(--body-font);
  -webkit-font-smoothing: antialiased;
}

button { color: inherit; font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--gold-hover);
  outline-offset: 4px;
}

h1, h2, h3, p { margin: 0; }

.container {
  width: min(100% - 3.5rem, 74rem);
  margin-inline: auto;
}

.site-header {
  position: relative;
  z-index: 2;
  border-bottom: 1px solid #223046;
  background: #03182d;
}

.header-inner, .header-actions {
  display: flex;
  align-items: center;
}

.header-inner {
  min-height: 4.25rem;
  justify-content: space-between;
  gap: 1rem;
}

.header-actions { gap: 1.25rem; }

.brand {
  display: flex;
  align-items: center;
  color: var(--text);
  font: 850 1.63rem/1 var(--display-font);
  letter-spacing: -.025em;
  text-decoration: none;
  white-space: nowrap;
}

.brand span { color: var(--gold); }
.brand img { display: block; width: auto; max-width: 145px; height: 36px; object-fit: contain; }

.text-button {
  padding: .65rem .05rem;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
  cursor: pointer;
}

.text-button:hover { color: var(--text); }

.hero {
  --hero-image: url('./assets/arena.webp');
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-bottom: 1px solid #223045;
  background: #091d33;
}

.hero::before, .hero::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
}

.hero::before {
  background-image: var(--hero-image, none);
  background-position: center 53%;
  background-size: cover;
}

.hero::after {
  background:
    linear-gradient(90deg, #061422fc 1%, #061422e1 32%, #0614225c 60%, #06142214 100%),
    linear-gradient(0deg, #061422a1, transparent 58%);
}

.hero-inner {
  min-height: 20rem;
  padding-block: 2.1rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--gold);
  font-size: .813rem;
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1.3;
  text-transform: uppercase;
}

.hero .eyebrow::before {
  width: 1.25rem;
  height: 2px;
  background: var(--gold);
  content: "";
}

.hero h1 {
  margin: 1.05rem 0 .68rem;
  font: 900 clamp(4.65rem, 8vw, 7.95rem)/.9 var(--display-font);
  letter-spacing: -.045em;
  text-transform: uppercase;
}

.hero h1 em {
  color: var(--gold);
  font-style: normal;
}

.hero-copy {
  max-width: 35rem;
  color: #dae5f3;
  font-size: clamp(1rem, 1.5vw, 1.17rem);
  line-height: 1.5;
  text-wrap: pretty;
}

.era-strip {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: 1.37rem;
}

.era-chip {
  display: inline-flex;
  align-items: baseline;
  gap: .45rem;
  padding: .36rem .69rem;
  border: 1px solid #43556b;
  border-radius: 5px;
  background: rgba(10, 19, 33, .72);
  font-size: .813rem;
  line-height: 1.3;
  white-space: nowrap;
}

.era-chip strong { color: var(--text); font-weight: 700; }
.era-chip span { color: #b7c9dd; }

.mode-switch {
  display: flex;
  gap: .35rem;
  margin-block: 1.6rem 0;
}

.mode-switch button {
  padding: .64rem .95rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
}

.mode-switch button:hover { color: var(--text); }

.mode-switch button[aria-pressed="true"] {
  border-color: #4c5766;
  background: var(--panel);
  color: var(--gold);
}

.mode-switch:not([hidden]) ~ .game-layout { padding-top: 1rem; }

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr);
  align-items: start;
  gap: 1.25rem;
  padding-block: 1.85rem 2.9rem;
}

.panel {
  min-width: 0;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, #122740, var(--panel) 70%);
  box-shadow: 0 14px 30px #060a122e;
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: .6rem;
}

.panel-head > .muted {
  flex-shrink: 0;
  padding-bottom: .18rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.panel-head h2 {
  margin-block: .23rem .21rem;
  font: 800 clamp(1.95rem, 3.2vw, 2.45rem)/1.06 var(--display-font);
  letter-spacing: -.025em;
}

.muted { color: var(--muted); }
.panel-head .muted { font-size: .94rem; }

.progress-track {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .4rem;
  margin-block: 1.22rem 1.18rem;
}

.progress-step {
  min-width: 0;
  min-height: .375rem;
  border-radius: 3px;
  background: #263447;
  color: #dee8f4;
  font-size: .875rem;
  font-weight: 750;
  text-align: center;
}

.progress-step.filled { background: var(--gold); color: #201608; }
.progress-step.current { background: #796342; color: #fff4df; }

.draw-box {
  display: grid;
  min-height: 17.7rem;
  justify-items: center;
  align-content: center;
  gap: .68rem;
  padding: 1.65rem 1rem;
  border: 1px dashed #4b5f78;
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 50% 32%, #1c2c40 0%, transparent 61%),
    #0e1826;
  text-align: center;
}

.draw-box h3, .club-name h3, .result-summary h3 {
  font: 800 clamp(1.53rem, 3vw, 2rem)/1.08 var(--display-font);
  letter-spacing: -.02em;
}

.draw-box .muted { max-width: 24rem; font-size: .94rem; }
.draw-box .button { margin-top: .35rem; }

.draw-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: .2rem;
  border: 1px solid #735631;
  border-radius: 50%;
  background: #352c27;
  color: var(--gold);
}

.draw-mark:empty::before {
  width: 1.55rem;
  height: .87rem;
  transform: rotate(-15deg);
  border: 1.5px solid var(--gold);
  border-radius: 50% / 45%;
  background: #654c29;
  box-shadow: 0 .22rem 0 #372626, 0 .25rem 0 var(--gold);
  content: "";
}

.draw-mark svg { width: 1.54rem; height: 1.54rem; }

.button {
  display: inline-flex;
  min-height: 2.88rem;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .59rem 1.08rem;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: .94rem;
  font-weight: 800;
  line-height: 1.26;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .18s, border-color .18s, color .18s;
}

.button svg { flex: none; width: 1.1em; height: 1.1em; }

.button.primary {
  border-color: var(--gold);
  background: var(--gold);
  color: #1d170e;
}

.button.primary:not(:disabled):hover {
  border-color: var(--gold-hover);
  background: var(--gold-hover);
}

.button.secondary {
  border-color: #47617a;
  background: #1a293a;
  color: #dce7f3;
}

.button.secondary:not(:disabled):hover {
  border-color: #7189a2;
  background: #25384d;
}

.button:disabled {
  border-color: #3a495b;
  background: #243142;
  color: #a2b2c6;
  cursor: default;
}

.club-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .8rem;
  padding: .9rem 1rem;
  border: 1px solid #344962;
  border-radius: 9px;
  background: linear-gradient(115deg, #23364d, #192739);
}

.club-name { min-width: 0; }
.club-name h3 { margin-block: .15rem; }
.club-name .muted { font-size: .875rem; }
.club-banner .button { flex: none; }

.player-list { display: grid; gap: .48rem; }

.player-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  width: 100%;
  min-height: 3.9rem;
  align-items: center;
  gap: .7rem;
  padding: .62rem .71rem;
  border: 1px solid #324458;
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: background-color .18s, border-color .18s;
}

.player-card:not(:disabled):hover {
  border-color: var(--gold);
  background: #203146;
}

.player-card:disabled { cursor: default; opacity: .62; }

.position-tag {
  display: grid;
  min-width: 2.35rem;
  min-height: 2rem;
  place-items: center;
  padding: .2rem .32rem;
  border: 1px solid #435f7a;
  border-radius: 5px;
  background: #243a50;
  color: #e0eaf5;
  font-size: .813rem;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
}

.player-details, .player-stat { display: grid; gap: .13rem; }
.player-details { min-width: 0; }
.player-details strong { font-size: .98rem; line-height: 1.2; }
.player-details .muted { font-size: .813rem; line-height: 1.22; }

.player-stat {
  justify-items: end;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.player-stat strong { color: #ffe0ad; font-size: 1.05rem; line-height: 1; }
.player-stat span { color: var(--muted); font-size: .813rem; line-height: 1.15; }

.rink {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 15.65rem;
  align-content: space-between;
  gap: .55rem;
  overflow: hidden;
  margin-top: 1rem;
  padding: .9rem .65rem;
  border: 1px solid #567089;
  border-radius: 35px;
  background:
    linear-gradient(180deg, transparent 26%, #506d8c75 26% 26.6%, transparent 26.6% 49.6%, #9c515a88 49.6% 50.4%, transparent 50.4% 73.4%, #506d8c75 73.4% 74%, transparent 74%),
    radial-gradient(ellipse at center, #21374c, #152838 75%);
}

.rink::before, .rink::after {
  position: absolute;
  z-index: -1;
  border: 1px solid #8b56638c;
  content: "";
  pointer-events: none;
}

.rink::before {
  top: 50%;
  left: 50%;
  width: 6.15rem;
  height: 6.15rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.rink::after {
  bottom: -.7rem;
  left: 50%;
  width: 4.5rem;
  height: 2.35rem;
  transform: translateX(-50%);
  border-radius: 50% 50% 0 0;
  background: #496d8f3b;
}

.rink-row {
  display: flex;
  min-width: 0;
  justify-content: center;
  gap: clamp(.28rem, 1vw, .55rem);
}

.slot {
  display: flex;
  flex: 1 1 0;
  max-width: 8.65rem;
  min-width: 0;
  min-height: 3.85rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .11rem;
  padding: .35rem .18rem;
  border: 1px dashed #7990a7;
  border-radius: 7px;
  background: #142637da;
  text-align: center;
}

.slot.filled {
  border-style: solid;
  border-color: #6c625e;
  background: #233143;
}

.slot-role {
  color: #c4d5e6;
  font-size: .813rem;
  font-weight: 800;
  line-height: 1.12;
  text-transform: uppercase;
}

.slot.filled .slot-role { color: #ffd28a; }

.slot-name, .slot-club {
  max-width: 100%;
  line-height: 1.14;
  overflow-wrap: anywhere;
}

.slot-name { color: #e5edf7; font-size: .875rem; font-weight: 750; }
.slot-club { color: #aebfd1; font-size: .813rem; }

.lineup-footer {
  display: grid;
  gap: .65rem;
  margin-top: .95rem;
}

.lineup-footer .button { width: 100%; }
.lineup-footer p { font-size: .875rem; }
.lineup-footer:has(> .button[hidden]) { display: none; }

.result-summary {
  display: grid;
  gap: .48rem;
  padding: 1.1rem;
  border: 1px solid #75554b;
  border-radius: 10px;
  background: linear-gradient(115deg, #302825, #1b293b);
}

.result-summary p:not(.eyebrow) { color: #d7e0ed; font-size: .94rem; }

.series-list {
  display: grid;
  gap: .42rem;
  margin-block: .8rem;
}

.series-detail {
  border: 1px solid #304357;
  border-radius: 7px;
  background: #182638;
}

.series-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 1.1rem;
  align-items: center;
  gap: .6rem;
  padding: .63rem .75rem;
  border-radius: inherit;
  font-size: .9rem;
  list-style: none;
  cursor: pointer;
}

.series-row::-webkit-details-marker { display: none; }
.series-row:hover { background: #25384d; }
.series-row::after {
  color: var(--gold);
  font-size: 1.15rem;
  line-height: 1;
  text-align: right;
  content: "+";
}

.series-detail[open] .series-row::after { content: "−"; }
.series-row span { color: #d4dfec; }
.series-row strong { color: #ffe0ad; font-variant-numeric: tabular-nums; text-align: right; }

.series-detail ol {
  margin: 0;
  padding: .45rem 1.05rem .65rem 2.2rem;
  border-top: 1px solid #304357;
  color: #d4dfec;
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
}

.button-row { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .85rem; }
#share-status:not(:empty) { margin-top: .55rem; font-size: .875rem; }

.game-footer {
  padding-block: 1.05rem 1.4rem;
  border-top: 1px solid #223045;
  color: var(--muted);
  font-size: .875rem;
}

.game-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .4rem 1.3rem;
}

.game-footer a { color: #d4e3f3; text-underline-offset: .18em; }

.info-dialog {
  width: min(35rem, 100% - 2rem);
  max-height: min(45rem, 100% - 2rem);
  padding: 0;
  border: 1px solid #536984;
  border-radius: var(--radius);
  background: #142134;
  color: var(--text);
  box-shadow: 0 1rem 4rem #000a;
}

.info-dialog::backdrop { background: #050a13c7; }

.dialog-content {
  position: relative;
  display: grid;
  gap: .72rem;
  padding: 1.5rem;
}

.dialog-content h2 {
  padding-right: 2.3rem;
  font: 800 2.25rem/1 var(--display-font);
}

.dialog-content p, .dialog-content li { color: #c2d2e4; }
.dialog-content a { color: #ffe0ad; }
.dialog-content form { margin: 0; }
.dialog-content form:first-child { display: contents; }
#dialog-body { display: grid; gap: .72rem; }
.dialog-content ol, .dialog-content ul { margin: 0; padding-left: 1.35rem; }
.dialog-content li + li { margin-top: .3rem; }
.rules-list li + li { margin-top: .7rem; }

#result-text {
  width: 100%;
  min-height: 8.5rem;
  padding: .75rem;
  border: 1px solid #536984;
  border-radius: 7px;
  background: #0b192a;
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.close-button {
  position: absolute;
  top: .8rem;
  right: .8rem;
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  padding: 0;
  border: 1px solid #405773;
  border-radius: 6px;
  background: #1e3046;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.close-button:hover { background: #2a405a; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 54rem) {
  .game-layout { gap: .85rem; }
  .panel { padding: 1.15rem; }
  .hero::before { background-position: 65% center; }
}

@media (max-width: 43rem) {
  .container { width: calc(100% - 2rem); }
  .header-inner { min-height: 3.75rem; }
  .header-actions { gap: .75rem; }
  .hero-inner { min-height: 18rem; padding-block: 1.75rem; }
  .hero h1 { font-size: clamp(4.05rem, 13vw, 5.5rem); }
  .hero-copy { max-width: 30rem; }
  .hero::after {
    background: linear-gradient(90deg, #061422eb, #0614228c), linear-gradient(0deg, #06142277, transparent 65%);
  }
  .game-layout { grid-template-columns: minmax(0, 1fr); padding-block: 1.08rem 1.7rem; }
  .draw-box { min-height: 15.8rem; }
  .rink { min-height: 15rem; }
}

@media (max-width: 24rem) {
  .container { width: calc(100% - 1.5rem); }
  .brand { font-size: 1.43rem; }
  .brand img { max-width: 119px; height: 30px; }
  .hero h1 { font-size: clamp(3.3rem, 13.3vw, 4.4rem); }
  .era-strip { gap: .35rem; }
  .era-chip { gap: .3rem; padding-inline: .5rem; }
  .panel { padding: .9rem; }
  .club-banner { padding-inline: .7rem; }
  .club-banner .button { padding-inline: .65rem; }
}

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