:root {
  --bg: #0b1020;
  --bg2: #131a33;
  --panel: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.10);
  --text: #e8ecff;
  --muted: #8b95bf;
  --accent: #4fd1ff;
  --green: #3ee08f;
  --gold: #ffd166;
  --red: #ff6b6b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(1200px 800px at 50% -10%, #1a2450 0%, var(--bg) 55%, #070a16 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
               "PingFang SC", "Hiragino Sans GB", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}

.app {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(228px, 280px) 1fr;
  gap: clamp(10px, 1.4vw, 18px);
  padding: clamp(10px, 1.4vw, 18px);
}

/* ---------- 侧栏 ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 2px;
  min-width: 0;
}

.brand { display: flex; align-items: center; gap: 9px; }

.logo {
  font-size: 24px;
  line-height: 1;
  color: var(--green);
  text-shadow: 0 0 18px rgba(62, 224, 143, 0.6);
}

.brand h1 {
  margin: 0;
  font-size: clamp(17px, 1.7vw, 21px);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hud { display: flex; flex-direction: column; gap: 8px; }

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.stat .k { font-size: 11px; color: var(--muted); letter-spacing: 1px; }

.stat .v {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#score { color: var(--green); }

.side-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.ghost {
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
  font-family: inherit;
  transition: background .18s ease, transform .12s ease;
}

.ghost:hover { background: rgba(255, 255, 255, 0.09); }
.ghost:active { transform: scale(.97); }

.ghost.primary-action {
  color: #06101f;
  background: linear-gradient(135deg, var(--green), #8ef0bd);
  border: none;
  font-weight: 700;
}

.ghost[aria-pressed="false"] { color: var(--muted); }

.hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
  opacity: 0.8;
}

/* ---------- 舞台 ---------- */
.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background:
    radial-gradient(600px 400px at 50% 50%, rgba(62, 224, 143, 0.07), transparent 70%),
    var(--bg2);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
  touch-action: none;
}

#game { display: block; width: 100%; height: 100%; }

/* ---------- 遮罩 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 10, 22, 0.72);
  backdrop-filter: blur(6px);
  z-index: 50;
  animation: fade .25s ease;
}

.overlay.hidden, .hidden { display: none !important; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.card {
  text-align: center;
  padding: 26px 36px 30px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(28, 38, 74, 0.96), rgba(16, 22, 44, 0.96));
  border: 1px solid rgba(62, 224, 143, 0.3);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 60px rgba(62, 224, 143, 0.12);
  animation: pop .32s cubic-bezier(.18, 1.2, .4, 1);
}

@keyframes pop {
  from { transform: scale(.86) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.icon {
  font-size: 44px;
  color: var(--green);
  text-shadow: 0 0 26px rgba(62, 224, 143, 0.55);
}

.card h2 { margin: 8px 0 8px; font-size: 24px; letter-spacing: 1px; }
.card .line { margin: 0; color: var(--muted); font-size: 14px; }

.primary {
  margin-top: 18px;
  padding: 12px 34px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  color: #06101f;
  background: linear-gradient(135deg, var(--green), #8ef0bd);
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(62, 224, 143, 0.3);
  font-family: inherit;
}

.primary:hover { box-shadow: 0 12px 34px rgba(62, 224, 143, 0.45); }

/* ---------- 手机 ---------- */
@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    padding: 8px 8px 6px;
  }

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 0;
  }

  .brand h1 { font-size: 16px; }
  .logo { font-size: 18px; }

  .hud { flex-direction: row; flex: 1; gap: 5px; min-width: 0; }

  .stat {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 5px 8px;
    border-radius: 10px;
    flex: 1;
    min-width: 0;
  }

  .stat .k { font-size: 10px; }
  .stat .v { font-size: 15px; }

  .side-actions {
    order: 3;
    width: 100%;
    flex-direction: row;
    gap: 6px;
    margin-top: 0;
  }

  .side-actions .ghost { flex: 1; padding: 8px 4px; font-size: 11px; }

  .hint { display: none; }
  .stage { border-radius: 14px; }
}
