:root {
  --bg-top: #8de3ff;
  --bg-mid: #5fc7ff;
  --bg-floor: #3aa8db;
  --hud-bg: rgba(255, 255, 255, 0.2);
  --line: rgba(255, 255, 255, 0.4);
  --panel: rgba(255, 255, 255, 0.82);
  --panel-border: rgba(255, 255, 255, 0.6);
  --accent: #ffcc4a;
  --danger: #ff6b6b;
  --ok: #57db8f;
}

@font-face {
  font-family: "Noto Sans SC";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/NotoSansSC-UI-Subset.woff2") format("woff2");
}

@font-face {
  font-family: "Noto Sans SC";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./assets/fonts/NotoSansSC-UI-Subset.woff2") format("woff2");
}

* {
  box-sizing: border-box;
  touch-action: none;
}

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

body {
  position: relative;
  overflow: hidden;
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Heiti SC",
    "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(circle at 30% 20%, var(--bg-top), var(--bg-mid) 58%, var(--bg-floor) 100%);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  color: #f8fbff;
}

/* Subtle post FX: vignette + grain (under HUD/panels) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background:
    radial-gradient(1200px 800px at 50% 35%, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0) 55%),
    radial-gradient(900px 700px at 12% 14%, rgba(255, 240, 170, 0.12), rgba(0, 0, 0, 0) 52%),
    radial-gradient(1100px 900px at 50% 60%, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.38) 78%, rgba(0, 0, 0, 0.55) 100%);
  mix-blend-mode: multiply;
  opacity: 0.9;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 1px, rgba(0, 0, 0, 0.02) 1px 2px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.015) 0 1px, rgba(0, 0, 0, 0.015) 1px 3px);
  opacity: 0.22;
  mix-blend-mode: overlay;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  overflow: visible;
  touch-action: none;
  background: radial-gradient(circle at 25% 22%, #d0f4ff 0%, var(--bg-top) 30%, var(--bg-mid) 72%, var(--bg-floor) 100%);
  z-index: 1;
}

.panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 460px);
  border: 2px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 245, 208, 0.92));
  color: #2f3e56;
  padding: 16px;
  border-radius: 20px;
  box-shadow: 0 18px 48px rgba(22, 31, 39, 0.25);
  backdrop-filter: blur(4px);
  z-index: 6;
  pointer-events: auto;
  touch-action: auto;
}

.hidden {
  display: none !important;
}

h1,
h2 {
  margin: 0 0 12px;
  text-align: center;
  font-size: clamp(24px, 5vw, 38px);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.85);
}

p {
  margin-top: 0;
}

ul {
  margin: 0 0 12px 18px;
  padding: 0;
  line-height: 1.6;
}

button {
  font-family: inherit;
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  border: 2px solid #fff1a3;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(180deg, #ffe07b, #ffcc44);
  color: #4a2f00;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: transform 0.08s ease, filter 0.12s ease;
  box-shadow: 0 5px 0 #cf9319;
  touch-action: manipulation;
  pointer-events: auto;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

#quitBtn {
  color: #2f3e56;
  background: linear-gradient(180deg, #d0ddea, #a6bfd8);
  border-color: #d1ddf5;
  box-shadow: 0 5px 0 #778eaa;
}

.hud {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, auto));
  grid-gap: 8px;
  width: min(94vw, 470px);
  filter: drop-shadow(0 10px 20px rgba(7, 14, 20, 0.22));
}

.hud-line {
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--hud-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #264157;
}

.label {
  opacity: 0.8;
  font-size: 12px;
}

.value {
  font-weight: 700;
  color: var(--accent);
}

.hud-actions {
  grid-column: 1 / -1;
}

.hud-actions button {
  margin: 0;
  background: linear-gradient(180deg, #ffd96f, #ffb73a);
}

.hint {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  color: #2f3e56;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.58);
}

#scoreBoard {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  padding: 8px 10px;
  color: #2f3e56;
}

#scoreBoard p {
  margin: 6px 0;
}
