
:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: rgba(15, 23, 42, 0.88);
  --panel2: rgba(30, 41, 59, 0.82);
  --text: #eef4ff;
  --muted: #a7b2c5;
  --line: rgba(148, 163, 184, 0.26);
  --accent: #38bdf8;
  --hot: #f97316;
  --ok: #22c55e;
  --danger: #f43f5e;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--accent) 32%, transparent), transparent 28%),
    radial-gradient(circle at 88% 22%, color-mix(in srgb, var(--hot) 22%, transparent), transparent 25%),
    linear-gradient(135deg, #080d19, var(--bg));
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(14px, 4vw, 42px);
  background: rgba(8, 13, 25, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #06101f;
  background: var(--accent);
}
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.top-actions a, .top-actions button, .primary, .ghost {
  min-height: 38px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.primary { color: #06101f; background: var(--accent); border-color: transparent; font-weight: 900; }
.ghost:hover, .top-actions a:hover, .top-actions button:hover { border-color: var(--accent); }
.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  width: min(1180px, calc(100% - 28px));
  margin: 18px auto 32px;
}
.stage-card, .side-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.24);
}
.stage-card { overflow: hidden; }
.game-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.game-head h1 { margin: 0; font-size: clamp(24px, 4vw, 40px); letter-spacing: 0; }
.game-head p { margin: 6px 0 0; color: var(--muted); line-height: 1.6; }
.source-badge {
  align-self: start;
  padding: 8px 10px;
  color: #06101f;
  font-weight: 900;
  background: var(--hot);
  border-radius: 8px;
  white-space: nowrap;
}
.hud {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.hud div { padding: 10px 12px; background: rgba(15, 23, 42, 0.94); }
.hud span { display: block; color: var(--muted); font-size: 12px; }
.hud strong { display: block; margin-top: 2px; font-size: 20px; }
.canvas-wrap { position: relative; background: #070b14; touch-action: none; }
canvas {
  display: block;
  width: 100%;
  height: min(68vh, 620px);
  min-height: 420px;
  touch-action: none;
}
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  text-align: center;
  background: rgba(5, 8, 15, 0.62);
}
.overlay.hidden { display: none; }
.overlay-box {
  max-width: 520px;
  padding: 22px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.overlay-box strong { display: block; margin-bottom: 8px; font-size: 28px; }
.overlay-box p { margin: 0; color: var(--muted); line-height: 1.7; }
.side {
  display: grid;
  gap: 14px;
  align-self: start;
}
.side-card { padding: 16px; }
.side-card h2 { margin: 0 0 10px; font-size: 18px; }
.side-card p, .side-card li { color: var(--muted); line-height: 1.65; }
.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.controls button { min-height: 42px; }
.wide { grid-column: 1 / -1; }
.ad-slot {
  display: grid;
  gap: 6px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(56,189,248,0.18), rgba(249,115,22,0.16));
  border: 1px dashed rgba(255,255,255,0.3);
  border-radius: 8px;
}
.ad-slot span { color: var(--muted); font-size: 12px; }
.rank-list { margin: 0; padding-left: 22px; }
.upgrade-row { display: grid; gap: 8px; }
.upgrade-row button {
  min-height: 40px;
  color: var(--text);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.tip { color: var(--muted); font-size: 13px; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; width: min(100% - 20px, 720px); margin-top: 10px; }
  .topbar { position: static; align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; }
  .top-actions a, .top-actions button { flex: 1; text-align: center; }
  .game-head { display: grid; }
  .source-badge { justify-self: start; }
  .hud { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  canvas { height: 62vh; min-height: 360px; }
}
@media (max-width: 520px) {
  .hud strong { font-size: 17px; }
  .hud div { padding: 8px; }
  .controls { grid-template-columns: 1fr; }
  canvas { min-height: 330px; }
}
