:root {
  --bg0: #07090c;
  --bg1: #0e1318;
  --bg2: #151c24;
  --line: rgba(180, 210, 200, 0.12);
  --text: #e7efe9;
  --muted: #8a9a92;
  --accent: #7dffb3;
  --accent-dim: rgba(125, 255, 179, 0.14);
  --warn: #ffc857;
  --danger: #ff6b6b;
  --ice: #9fd4ff;
  --font: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg0);
  color: var(--text);
  font-family: var(--font);
}

body {
  position: relative;
  isolation: isolate;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(125, 255, 179, 0.12), transparent 55%),
    radial-gradient(800px 420px at 90% 0%, rgba(120, 190, 255, 0.14), transparent 50%),
    linear-gradient(180deg, #0a0e12 0%, #07090c 45%, #050607 100%);
}

.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(7, 9, 12, 0.72);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 7rem;
}

.brand-mark {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.15rem;
  color: var(--accent);
}

.brand-sub {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-left: 0.5rem;
}

.tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 0.4rem;
  cursor: pointer;
}

.tab.active {
  color: var(--text);
  background: var(--accent-dim);
  border-color: rgba(125, 255, 179, 0.28);
}

.tab-badge {
  display: inline-block;
  min-width: 1.15rem;
  margin-left: 0.3rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.65rem;
  line-height: 1.15rem;
  text-align: center;
  vertical-align: middle;
  animation: pulse 1.6s ease-in-out infinite;
}

.tab-badge[hidden] {
  display: none;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.panel-head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 0 1.25rem;
  color: var(--muted);
  max-width: 40rem;
  line-height: 1.45;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
}

.live-toolbar {
  justify-content: space-between;
}

.day-nav,
.chip-group,
.live-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.day-label {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
  min-width: 8.5rem;
  text-align: center;
}

.chip,
.refresh,
.mini {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.chip:hover,
.refresh:hover,
.mini:hover {
  color: var(--text);
  border-color: rgba(125, 255, 179, 0.3);
}

.chip.active {
  color: var(--text);
  background: var(--accent-dim);
  border-color: rgba(125, 255, 179, 0.32);
}

.refresh:disabled {
  opacity: 0.5;
  cursor: progress;
}

.live-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.live-meta.stale {
  color: var(--warn);
}

.chiclet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.85rem;
  align-items: start;
}

.chiclet {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.8rem 0.85rem 0.7rem;
  border-radius: 0.8rem;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(21, 28, 36, 0.92), rgba(14, 19, 24, 0.96));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.chiclet.state-in {
  border-color: rgba(125, 255, 179, 0.28);
}

.chiclet.state-in.power-play {
  border-color: rgba(255, 200, 87, 0.5);
  box-shadow: 0 10px 30px rgba(255, 200, 87, 0.1);
}

.chiclet.state-pre {
  opacity: 0.92;
}

.chiclet-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.4rem;
}

.status {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.status.live {
  color: var(--accent);
  border-color: rgba(125, 255, 179, 0.4);
  background: var(--accent-dim);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.status.live .dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.6);
  animation: ping 1.4s ease-out infinite;
}

.status.final {
  color: var(--text);
}

.chiclet-head .net {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: right;
}

.team-rows {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.team-row {
  display: grid;
  grid-template-columns: 1.7rem minmax(0, 1fr) auto 2.4rem;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.45rem 0.3rem 0.55rem;
  border-radius: 0.5rem;
  border-left: 3px solid var(--team);
  background: rgba(255, 255, 255, 0.025);
}

.team-row.on-pp {
  background: rgba(255, 200, 87, 0.08);
}

.team-row.loser {
  opacity: 0.62;
}

.team-row .logo {
  width: 1.7rem;
  height: 1.7rem;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.logo-fallback {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--team);
  color: #07110c;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
}

.team-row .tname {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.team-row .tname b {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.team-row .tname .full {
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-row .rec {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
}

.pp-pill {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #1a1406;
  background: var(--warn);
  border-radius: 999px;
  padding: 0.08rem 0.38rem;
}

.team-row .tscore {
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.team-row.winner .tscore {
  color: var(--accent);
}

.rink-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.rink {
  width: 100%;
  height: 4.4rem;
  display: block;
  border-radius: 0.45rem;
  border: 1px solid rgba(159, 212, 255, 0.2);
  background: #0c1c28;
}

.rink .ice {
  fill: #163246;
}

.rink .blue-line {
  stroke: #3d7ec9;
  stroke-width: 1.4;
}

.rink .red-line {
  stroke: #d64545;
  stroke-width: 1.1;
}

.rink .goal-line {
  stroke: rgba(232, 244, 255, 0.7);
  stroke-width: 0.7;
}

.rink .center-circle {
  fill: none;
  stroke: rgba(214, 69, 69, 0.85);
  stroke-width: 0.6;
}

.rink .center-dot,
.rink .faceoff {
  fill: rgba(214, 69, 69, 0.9);
}

.rink .crease {
  fill: rgba(159, 212, 255, 0.18);
  stroke: rgba(232, 244, 255, 0.55);
  stroke-width: 0.4;
}

.rink .puck {
  fill: #111;
  stroke: #fff;
  stroke-width: 0.45;
}

.down-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.down-line .end {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.down-line .dd {
  color: var(--muted);
  font-weight: 600;
}

.down-line .dd.hot {
  color: var(--warn);
  letter-spacing: 0.08em;
}

.last-play {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.28);
  border-left: 2px solid var(--ice);
}

.last-play.scoring {
  border-left-color: var(--accent);
}

.lp-tag {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ice);
}

.last-play.scoring .lp-tag {
  color: var(--accent);
}

.lp-text {
  font-size: 0.82rem;
  line-height: 1.35;
}

.stat-compare {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.stat-row {
  display: grid;
  grid-template-columns: 4.4rem 1fr 4.4rem;
  grid-template-areas:
    "a bar h"
    "a label h";
  align-items: center;
  column-gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.stat-row .sv {
  font-variant-numeric: tabular-nums;
}

.stat-row .sv.away {
  grid-area: a;
  text-align: left;
}

.stat-row .sv.home {
  grid-area: h;
  text-align: right;
}

.stat-row .sbar {
  grid-area: bar;
  display: flex;
  height: 0.85rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  gap: 1px;
}

.stat-row .sbar .seg {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}

.stat-row .sl {
  grid-area: label;
  text-align: center;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.goals {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.goal {
  display: grid;
  grid-template-columns: 4.8rem minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: baseline;
  font-size: 0.78rem;
  padding-left: 0.35rem;
  border-left: 2px solid var(--team, var(--line));
}

.goal .when {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--muted);
}

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

.goal .who b {
  font-weight: 600;
}

.goal .who small {
  color: var(--muted);
  margin-left: 0.3rem;
}

.goal .tag {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--warn);
}

.goalies,
.stars {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--line);
}

.goalie-row,
.star-row,
.leader-row {
  display: grid;
  grid-template-columns: 1fr 3.2rem 1fr;
  gap: 0.4rem;
  font-size: 0.74rem;
  align-items: start;
}

.goalie-row .side,
.star-row .side,
.leader-row .lv {
  min-width: 0;
}

.goalie-row .side.home,
.star-row .side.home,
.leader-row .lv.home {
  text-align: right;
}

.goalie-row .tender {
  display: block;
  margin-bottom: 0.15rem;
}

.goalie-row b,
.star-row b,
.leader-row b {
  font-weight: 600;
}

.goalie-row small,
.star-row small,
.leader-row small {
  display: block;
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--muted);
}

.mid-label {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding-top: 0.15rem;
}

.linescore {
  display: grid;
  gap: 0.1rem 0.25rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-align: center;
  padding-top: 0.35rem;
  border-top: 1px solid var(--line);
}

.linescore .lsn {
  text-align: left;
  font-weight: 600;
}

.linescore .lsh {
  color: var(--muted);
  font-size: 0.6rem;
}

.linescore .lst {
  font-weight: 700;
  color: var(--accent);
}

.pre-note {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.4;
}

.chiclet-foot {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.15rem;
}

@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.6);
  }
  100% {
    box-shadow: 0 0 0 6px rgba(255, 107, 107, 0);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

@media (max-width: 720px) {
  .live-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .chiclet-grid {
    grid-template-columns: 1fr;
  }
  .day-label {
    min-width: 0;
  }
}
