:root {
  color-scheme: dark;
  --bg: #07100d;
  --panel: rgba(13, 25, 22, 0.9);
  --panel-strong: #10251f;
  --line: rgba(178, 218, 197, 0.16);
  --text: #f4fff8;
  --muted: #95a99f;
  --green: #39d98a;
  --gold: #f6c85f;
  --red: #ff6b6b;
  --blue: #5fb8ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --board-panel-height: clamp(700px, calc(100vh - 290px), 860px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(57, 217, 138, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(57, 217, 138, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 78% 8%, rgba(246, 200, 95, 0.13), transparent 28rem),
    var(--bg);
  background-size: 46px 46px, 46px 46px, auto, auto;
  color: var(--text);
}

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

button { cursor: pointer; }

.app-shell {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 26px;
}

.topbar,
.dashboard,
.calendar-strip {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 18px;
}

.dateline,
.section-label {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.segment,
.date-card,
.match-row {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.update-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(57, 217, 138, 0.25);
  border-radius: 8px;
  background: rgba(57, 217, 138, 0.08);
  color: #c9ffe2;
  font-size: 13px;
}

.update-chip span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px var(--green);
}

.dashboard {
  grid-template-columns: minmax(320px, 0.92fr) minmax(380px, 1.18fr) minmax(320px, 0.9fr);
  align-items: stretch;
  grid-auto-rows: minmax(var(--board-panel-height), auto);
}

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

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segment {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
}

.segment.active {
  background: var(--green);
  border-color: var(--green);
  color: #062015;
  font-weight: 800;
}

.match-list,
.center-stack,
.moment-feed {
  display: grid;
  gap: 10px;
}

.match-panel,
.moments-panel {
  display: flex;
  flex-direction: column;
  min-height: var(--board-panel-height);
}

.moments-panel {
  height: var(--board-panel-height);
  max-height: var(--board-panel-height);
  overflow: hidden;
}

.center-stack {
  min-height: var(--board-panel-height);
}

.match-list,
.moment-feed {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.match-row {
  display: grid;
  grid-template-columns: 42px 1fr 74px 1fr 42px;
  align-items: center;
  gap: 8px;
  min-height: 82px;
  padding: 12px;
  border-radius: 8px;
  text-align: left;
}

.match-row:hover {
  border-color: rgba(57, 217, 138, 0.52);
  background: rgba(57, 217, 138, 0.08);
}

.match-row.focus-team-match {
  position: relative;
  border-color: rgba(246, 200, 95, 0.7);
  background:
    linear-gradient(90deg, rgba(246, 200, 95, 0.16), transparent 72%),
    rgba(255, 255, 255, 0.05);
}

.match-row.focus-team-match::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--gold);
}

.team-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 30px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #d8eee4;
  font-size: 12px;
  font-weight: 800;
}

.team-name {
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
}

.team-name.away { text-align: right; }

.match-row strong {
  text-align: center;
  color: var(--gold);
  font-size: 22px;
}

.match-meta {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.match-meta i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.match-meta i.live { background: var(--red); box-shadow: 0 0 14px var(--red); }
.match-meta i.finished { background: var(--green); }
.match-meta i.scheduled { background: var(--blue); }

.feature-panel {
  background:
    linear-gradient(135deg, rgba(57, 217, 138, 0.16), transparent 42%),
    var(--panel-strong);
}

.status-pill,
.moment-count {
  border: 1px solid rgba(246, 200, 95, 0.28);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.feature-score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 18px 0 12px;
}

.feature-team {
  display: grid;
  gap: 8px;
}

.feature-team.right {
  justify-items: end;
  text-align: right;
}

.feature-team span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.feature-team strong {
  font-size: clamp(20px, 2.4vw, 34px);
}

.score-lockup {
  display: grid;
  justify-items: center;
  min-width: 132px;
}

.score-lockup b {
  color: var(--gold);
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1;
}

.score-lockup small,
.feature-note,
.empty-state {
  color: var(--muted);
}

.feature-note {
  line-height: 1.7;
  margin: 8px 0 16px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 22px;
}

.stat-card em {
  color: var(--blue);
  font-style: normal;
}

select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  min-height: 34px;
  padding: 0 10px;
}

.standing-row {
  display: grid;
  grid-template-columns: 1fr 42px 58px 44px;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
  color: #d7e8df;
  font-size: 14px;
}

.standing-row.header {
  min-height: 30px;
  color: var(--muted);
  font-size: 12px;
}

.standing-row.advance span:first-child {
  color: #d9ffe9;
  font-weight: 800;
}

.standing-row strong {
  color: var(--gold);
}

.moment-feed {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.moment {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.moment time {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.moment h3 {
  margin-bottom: 6px;
  font-size: 15px;
}

.moment p {
  color: #c8d8d0;
  font-size: 14px;
  line-height: 1.65;
}

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

.calendar-strip {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 16px;
  max-height: 190px;
  overflow: auto;
}

.date-card {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 12px;
  border-radius: 8px;
  text-align: left;
}

.date-card.active {
  border-color: rgba(57, 217, 138, 0.62);
  background: rgba(57, 217, 138, 0.1);
}

.date-card.focus-team-date {
  border-color: rgba(246, 200, 95, 0.7);
  background:
    linear-gradient(135deg, rgba(246, 200, 95, 0.16), transparent 68%),
    rgba(255, 255, 255, 0.04);
}

.date-card.focus-team-date.active {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(246, 200, 95, 0.28);
}

.date-card.focus-team-date span {
  color: var(--gold);
  font-weight: 800;
}

.date-card span,
.date-card small {
  color: var(--muted);
  font-size: 12px;
}

.date-card strong {
  font-size: 16px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  line-height: 1.7;
}

code {
  color: var(--gold);
}

@media (max-width: 1120px) {
  .dashboard {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: auto;
  }

  .moments-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  :root {
    --board-panel-height: auto;
  }

  .app-shell {
    width: min(100% - 20px, 620px);
    padding-top: 16px;
  }

  .topbar,
  .dashboard,
  .calendar-strip,
  .center-stack {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 14px;
  }

  .panel-heading {
    display: grid;
  }

  .moments-panel {
    height: min(620px, 72vh);
    max-height: min(620px, 72vh);
  }

  .match-row {
    grid-template-columns: 40px 1fr 64px 1fr 40px;
    gap: 6px;
    padding: 10px;
  }

  .team-name {
    font-size: 13px;
  }

  .match-row strong {
    font-size: 17px;
  }

  .feature-score,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .feature-team,
  .feature-team.right {
    justify-items: center;
    text-align: center;
  }
}
