/* ========== 砖屋顶平台 · 暖色夕阳屋顶美学 ========== */
:root {
  --cream: #f6ead8;
  --cream-dim: rgba(246, 234, 216, 0.62);
  --brick: #b4502e;
  --brick-dark: #7e3319;
  --amber: #f2a65a;
  --gold: #ffc94d;
  --panel: rgba(28, 17, 11, 0.72);
  --font-display: "ZCOOL KuaiLe", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-num: "Space Grotesk", "ZCOOL KuaiLe", "PingFang SC", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }

body {
  background: #160f0a;
  font-family: var(--font-display);
  color: var(--cream);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#game { position: fixed; inset: 0; display: block; }

#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background:
    linear-gradient(180deg, rgba(22, 12, 6, 0.38), transparent 18%),
    radial-gradient(ellipse at 50% 42%, transparent 52%, rgba(20, 9, 4, 0.5) 100%);
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 22px; pointer-events: none;
}
.hud-group { display: flex; gap: 18px; align-items: center; }
.stat { display: flex; align-items: baseline; gap: 8px; }
.stat-label { font-size: 11px; letter-spacing: 3px; color: var(--cream-dim); }
.stat-val {
  font-family: var(--font-num); font-size: 24px; font-weight: 700;
  color: var(--cream); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); min-width: 2ch;
  font-feature-settings: "tnum";
}
.coin-dot {
  width: 13px; height: 13px; border-radius: 50%; align-self: center;
  background: radial-gradient(circle at 35% 30%, #ffe89a, #ffc93c 55%, #c98a00);
  box-shadow: 0 0 8px rgba(255, 201, 60, 0.55);
}
.hud-btn {
  pointer-events: auto; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid rgba(246, 234, 216, 0.35);
  background: rgba(24, 14, 9, 0.45); color: var(--cream);
  font-size: 15px; cursor: pointer; backdrop-filter: blur(4px);
  transition: background 0.15s, transform 0.1s; line-height: 1;
}
.hud-btn:hover { background: rgba(246, 234, 216, 0.16); }
.hud-btn:active { transform: scale(0.92); }
.hud-btn.muted { color: var(--cream-dim); text-decoration: line-through; }

/* ---------- 覆盖层 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(22, 12, 7, 0.5);
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  cursor: pointer;
}
.panel {
  text-align: center; padding: 40px 48px;
  background: var(--panel);
  border: 1px solid rgba(246, 234, 216, 0.14);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
  max-width: min(92vw, 560px);
}
@keyframes pop { from { transform: scale(0.9) translateY(14px); opacity: 0; } }

.kicker { font-size: 11px; letter-spacing: 5px; color: var(--amber); margin-bottom: 14px; }
.title {
  font-size: clamp(52px, 9vw, 96px); line-height: 1.05; color: var(--cream);
  text-shadow: 0 4px 0 rgba(126, 51, 25, 0.6), 0 14px 44px rgba(0, 0, 0, 0.45);
}
.title.small { font-size: clamp(34px, 5vw, 52px); }
.subtitle { margin-top: 10px; font-size: 14px; letter-spacing: 4px; color: var(--cream-dim); }
.best-line { margin-top: 18px; font-size: 14px; color: var(--cream-dim); }
.best-line b { font-family: var(--font-num); color: var(--gold); font-size: 18px; }

.big-btn {
  margin-top: 24px; font-family: var(--font-display); font-size: 21px; letter-spacing: 2px;
  padding: 14px 46px; border: none; border-radius: 999px; color: #fff3e2;
  background: linear-gradient(180deg, #e0703c, #b4502e);
  box-shadow: 0 6px 0 var(--brick-dark), 0 16px 34px rgba(0, 0, 0, 0.4);
  cursor: pointer; transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
.big-btn:hover { filter: brightness(1.07); }
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--brick-dark), 0 8px 18px rgba(0, 0, 0, 0.4); }

.controls { margin-top: 28px; display: flex; flex-direction: column; gap: 9px; font-size: 13px; color: var(--cream-dim); }
kbd {
  font-family: var(--font-num); font-size: 11px; padding: 2px 8px;
  border: 1px solid rgba(246, 234, 216, 0.4); border-bottom-width: 2px;
  border-radius: 6px; background: rgba(246, 234, 216, 0.08); color: var(--cream);
}

.score-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 44px; margin: 24px 0 4px; }
.score-grid span { display: block; font-size: 11px; letter-spacing: 3px; color: var(--cream-dim); }
.score-grid b { font-family: var(--font-num); font-size: 30px; color: var(--cream); font-feature-settings: "tnum"; }
.cause { margin-top: 8px; font-size: 15px; color: var(--cream-dim); letter-spacing: 2px; }

.badge {
  display: inline-block; margin-top: 16px; padding: 5px 18px; border-radius: 999px;
  background: linear-gradient(180deg, #ffd968, #f0a51f); color: #4a2c00;
  font-size: 14px; letter-spacing: 2px;
  animation: pulse 1s ease-in-out infinite;
  box-shadow: 0 0 24px rgba(255, 201, 60, 0.45);
}
@keyframes pulse { 50% { transform: scale(1.07); } }

#toast {
  position: fixed; top: 86px; left: 50%; transform: translateX(-50%); z-index: 20;
  padding: 8px 22px; border-radius: 999px;
  background: linear-gradient(180deg, #ffd968, #f0a51f); color: #4a2c00;
  font-size: 15px; letter-spacing: 3px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); pointer-events: none;
}
#toast.anim { animation: toastIn 1.8s ease forwards; }
@keyframes toastIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

.footer-note { margin-top: 22px; font-size: 11px; color: rgba(246, 234, 216, 0.35); letter-spacing: 2px; }

@media (max-width: 640px) {
  #hud { padding: 12px 14px; }
  .stat-val { font-size: 19px; }
  .panel { padding: 28px 22px; }
  .controls { font-size: 12px; }
  .score-grid { gap: 10px 28px; }
  .big-btn { font-size: 18px; padding: 12px 36px; }
}
