:root {
  --bg: #060a10;
  --panel: rgba(12, 20, 31, 0.92);
  --text: #e9f0fa;
  --muted: #8b9cb3;
  --line: rgba(255, 255, 255, 0.09);
  --home: #5b93ff;
  --home-soft: rgba(91, 147, 255, 0.18);
  --away: #ef5560;
  --away-soft: rgba(239, 85, 96, 0.16);
  --gold: #ffd166;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

canvas#pitch {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 46%, transparent 52%, rgba(0, 0, 0, 0.52) 100%),
    linear-gradient(180deg, rgba(4, 8, 13, 0.35), transparent 18%, transparent 82%, rgba(4, 8, 13, 0.45));
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.scoreboard {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 20px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(14, 23, 36, 0.9), rgba(7, 12, 19, 0.82));
  border: 1px solid var(--line);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.side {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 78px;
}

.side.away { justify-content: flex-end; }

.badge {
  width: 27px;
  height: 27px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #07101c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 3px 10px rgba(0, 0, 0, 0.35);
}

.home-badge { background: linear-gradient(160deg, #a4c9ff, #3f7bff); }
.away-badge { background: linear-gradient(160deg, #ffa6aa, #e23c49); }

.team-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--muted);
  white-space: nowrap;
}

.side.home .team-name { color: #a9c7ff; }
.side.away .team-name { color: #ffb3b7; }

.score-wrap { text-align: center; min-width: 84px; }

.score-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
  font-variant-numeric: tabular-nums;
}

.score {
  display: inline-block;
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
}

.score.bump { animation: bump 0.55s cubic-bezier(0.2, 0.9, 0.25, 1.3); }

.dash {
  font-size: 17px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.28);
}

.clock {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.clock.urgent { color: #ff9a9a; }

.golden-tag {
  position: absolute;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 209, 102, 0.45);
  background: rgba(255, 190, 60, 0.12);
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.24em;
  box-shadow: 0 0 24px rgba(255, 190, 60, 0.22);
  animation: goldPulse 1.8s ease-in-out infinite;
}

.corner-actions {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(10, 17, 27, 0.75);
  color: var(--muted);
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.icon-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(22, 34, 50, 0.85);
  transform: translateY(-1px);
}

.hintbar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 9px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(7, 12, 19, 0.6);
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hintbar span { display: flex; align-items: center; gap: 6px; }

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-bottom-color: rgba(0, 0, 0, 0.5);
  background: rgba(255, 255, 255, 0.07);
  color: #dbe7f7;
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

/* ---------- 进球横幅 ---------- */
.banner {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  opacity: 0;
  text-align: center;
}

.banner.show { animation: bannerIn 2.6s cubic-bezier(0.2, 0.8, 0.25, 1) both; }

/* 比赛仍在进行时的短提示（金球制胜）：缩小并避开球场中央 */
.banner.compact {
  justify-content: flex-start;
  padding-top: clamp(120px, 15vh, 160px);
}

.banner.compact.show {
  animation: bannerInCompact 2s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.banner.compact .banner-main {
  font-size: clamp(30px, 4.6vw, 52px);
  letter-spacing: 0.08em;
  transform: skewX(-4deg);
  filter: drop-shadow(0 10px 26px rgba(255, 175, 40, 0.32));
}

.banner.compact .banner-sub {
  font-size: clamp(11px, 1.4vw, 15px);
  letter-spacing: 0.24em;
}

.banner-main {
  font-size: clamp(64px, 13vw, 148px);
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: 0.03em;
  transform: skewX(-6deg);
  background: linear-gradient(180deg, #ffffff 8%, #ffe7a6 46%, #ffb830 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 12px 34px rgba(255, 175, 40, 0.38)) drop-shadow(0 2px 0 rgba(80, 40, 0, 0.25));
}

.banner-sub {
  font-size: clamp(13px, 1.8vw, 19px);
  font-weight: 700;
  letter-spacing: 0.3em;
  color: rgba(235, 243, 255, 0.82);
  text-transform: uppercase;
}

/* ---------- 慢放选人 HUD ---------- */
.switch-hud {
  position: absolute;
  left: 50%;
  bottom: 64px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 360px;
  padding: 10px 18px 9px;
  border-radius: 16px;
  border: 1px solid rgba(255, 214, 102, 0.3);
  background:
    radial-gradient(120% 160% at 50% 0%, rgba(255, 200, 80, 0.13), transparent 62%),
    rgba(7, 14, 23, 0.88);
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
  transform: translateX(-50%);
  animation: switchHudIn 0.18s ease both;
}

.switch-head { display: flex; align-items: center; gap: 8px; }

.switch-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--gold);
}

.slow-tag {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(125, 230, 255, 0.4);
  background: rgba(80, 200, 255, 0.1);
  color: #9ee7ff;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.switch-chips { display: flex; gap: 7px; }

.switch-chip {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #93a7bf;
  transition:
    transform 0.16s, border-color 0.16s, background 0.16s,
    color 0.16s, box-shadow 0.16s;
}

.switch-chip b { font-size: 15px; font-weight: 800; color: #dbe9fb; }
.switch-chip i { font-style: normal; font-size: 10px; letter-spacing: 0.06em; }

.switch-chip.active {
  border-color: rgba(255, 214, 102, 0.82);
  background: linear-gradient(180deg, rgba(255, 210, 90, 0.22), rgba(255, 180, 40, 0.08));
  color: #ffe3a1;
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(255, 190, 60, 0.28);
}

.switch-chip.active b { color: #fff4d2; }

.switch-help {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #7f93ab;
  white-space: nowrap;
}

.switch-help span { display: flex; align-items: center; gap: 4px; }

@keyframes switchHudIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- 浮层 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(10, 18, 29, 0.52), rgba(3, 6, 10, 0.88) 78%);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease both;
}

.panel {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 34px 36px 30px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(70, 120, 210, 0.16), transparent 55%),
    linear-gradient(165deg, rgba(19, 30, 46, 0.95), rgba(7, 12, 20, 0.96));
  box-shadow:
    0 50px 110px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: panelIn 0.4s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.panel::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 8px; }

.small-panel {
  width: min(400px, 100%);
  text-align: center;
}

.eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.34em;
  color: #7b91ad;
  text-transform: uppercase;
}

h1 {
  margin: 12px 0 10px;
  padding-top: 4px;
  font-size: clamp(38px, 5.6vw, 54px);
  font-weight: 900;
  line-height: 1.16;
  letter-spacing: 0.015em;
  background: linear-gradient(120deg, #ffffff 10%, #cfe2ff 45%, #7db0ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 10px 30px rgba(70, 130, 255, 0.2));
}

h2 {
  margin: 12px 0 18px;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 900;
  letter-spacing: 0.02em;
}

.lead {
  margin: 0 0 24px;
  font-size: 13.5px;
  line-height: 1.8;
  color: #9bacc3;
}

.lead b { color: var(--gold); font-weight: 700; }

.section-label {
  margin-bottom: 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #7386a0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  margin-bottom: 22px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.segmented button {
  padding: 10px 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.18s, background 0.18s, box-shadow 0.18s;
}

.segmented button:hover { color: #dce8f8; }

.segmented button.active {
  color: #fff;
  background: linear-gradient(180deg, rgba(91, 147, 255, 0.34), rgba(91, 147, 255, 0.15));
  box-shadow: inset 0 0 0 1px rgba(130, 175, 255, 0.38), 0 6px 16px rgba(40, 90, 200, 0.2);
}

.controls-card {
  display: grid;
  gap: 9px;
  margin-bottom: 26px;
  padding: 15px 17px;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
}

.ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 12px;
  color: #8fa2ba;
}

.ctrl-row .keys {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.ctrl-row .slash { margin: 0 2px; color: rgba(255, 255, 255, 0.24); font-size: 10px; }

.primary {
  width: 100%;
  padding: 15px 22px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #6ba1ff, #3a72f0);
  color: #06101e;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  cursor: pointer;
  box-shadow:
    0 14px 30px rgba(45, 100, 230, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 20px 38px rgba(45, 100, 230, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.primary:active { transform: translateY(0) scale(0.995); }

.footnote {
  margin: 16px 0 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.7;
  color: #61748e;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn-row .primary { flex: 1.2; }
.btn-row .ghost { flex: 1; }

.ghost {
  padding: 15px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #dfe9f8;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.16s;
}

.ghost:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
}

.link {
  display: inline-block;
  margin-top: 18px;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: #7387a0;
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.18s;
}

.link:hover { color: #cdddf0; }

/* ---------- 终场 ---------- */
.end-panel { text-align: center; width: min(500px, 100%); }

#endTitle { margin-bottom: 6px; }
#endTitle.win {
  color: var(--gold);
  text-shadow: 0 0 40px rgba(255, 200, 80, 0.35);
  background: none;
  -webkit-text-fill-color: var(--gold);
}
#endTitle.lose { color: #9fb0c6; background: none; -webkit-text-fill-color: #9fb0c6; }
#endTitle.draw { color: #d8e3f2; background: none; -webkit-text-fill-color: #d8e3f2; }

.final-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 14px;
  margin: 22px 0 26px;
  font-variant-numeric: tabular-nums;
}

.fs-team { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; }
.home-text { color: #8fb8ff; }
.away-text { color: #ff9ca1; }

.fs-num {
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
}

.fs-sep { font-size: 28px; color: rgba(255, 255, 255, 0.22); }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.stat {
  padding: 13px 12px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #6e8199;
}

.stat-value {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

/* ---------- 动画 ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bannerIn {
  0% { opacity: 0; transform: scale(0.7) rotate(-2deg); }
  12% { opacity: 1; transform: scale(1.06) rotate(0.5deg); }
  22% { transform: scale(1); }
  78% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.03); }
}

@keyframes bannerInCompact {
  0% { opacity: 0; transform: translateY(-14px); }
  12% { opacity: 1; transform: translateY(0); }
  76% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); }
}

@keyframes bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.5); color: var(--gold); }
  100% { transform: scale(1); }
}

@keyframes goldPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 190, 60, 0.16); opacity: 0.86; }
  50% { box-shadow: 0 0 34px rgba(255, 190, 60, 0.34); opacity: 1; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .scoreboard { gap: 12px; padding: 8px 14px; top: 12px; }
  .side { min-width: 58px; }
  .team-name { font-size: 10px; letter-spacing: 0.1em; }
  .badge { width: 23px; height: 23px; font-size: 11px; }
  .score { font-size: 23px; }
  .hintbar { gap: 12px; font-size: 10px; padding: 7px 12px; bottom: 10px; }
  .hintbar span:nth-child(n + 4) { display: none; }
  .corner-actions { top: 12px; right: 12px; }
  .icon-btn { width: 34px; height: 34px; }
  .panel { padding: 26px 22px 22px; border-radius: 20px; }
  .ctrl-row { font-size: 11px; }
  .golden-tag { top: 76px; }
  .banner-sub { letter-spacing: 0.16em; }
  .switch-hud { bottom: 52px; min-width: 0; width: calc(100% - 32px); padding: 9px 12px; }
  .switch-chip { padding: 4px 9px; }
  .switch-chip i { display: none; }
  .switch-help { gap: 9px; font-size: 9px; }
}

@media (max-height: 620px) {
  .panel { padding: 22px 24px; }
  h1 { font-size: 36px; margin-top: 8px; }
  .lead { margin-bottom: 16px; line-height: 1.6; }
  .controls-card { margin-bottom: 16px; padding: 11px 14px; gap: 6px; }
  .segmented { margin-bottom: 14px; }
  .footnote { margin-top: 10px; }
  .hintbar { display: none; }
  .switch-hud { bottom: 14px; }
}
