:root {
  --fg: #f4f2ee;
  --muted: rgba(244, 242, 238, 0.62);
  --glass: rgba(20, 20, 24, 0.42);
  --line: rgba(255, 255, 255, 0.16);
  --accent: #cfe8ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0d0d10;
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

.panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  padding: 28px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  text-align: center;
}

.panel h1 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.panel p { margin: 0 0 18px; line-height: 1.6; color: var(--muted); }
.panel .fine { font-size: 12px; margin: 14px 0 0; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

button {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
button:hover { background: rgba(255, 255, 255, 0.14); }
button:active { transform: scale(0.97); }
button.primary { background: var(--fg); color: #111; border-color: transparent; }
button.primary:hover { background: #fff; }
button.on { background: #ff4d5e; border-color: transparent; color: #fff; }

#hud {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
#hud > * { pointer-events: auto; }

#hint {
  font-size: 13px;
  color: var(--muted);
  background: var(--glass);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.4s ease;
}
#hint:empty { opacity: 0; }

.tools {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#debug {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 240px;
  border-radius: 10px;
  border: 1px solid var(--line);
  pointer-events: none;
}

#toast {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%) translateY(-8px);
  background: var(--glass);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.lil-gui.root { position: fixed; top: 12px; right: 12px; }

@media (max-width: 600px) {
  #hud { flex-direction: column; align-items: stretch; }
  .tools { justify-content: center; }
}

/* —— 起始引导 —— */
#guide {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 32px));
  text-align: center;
  pointer-events: none;
  transition: opacity 0.6s ease, top 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#guide.up { top: 20%; }          /* 手进画面后让开中间，不挡手 */
#guide.gone { opacity: 0; }
#guide .steps {
  list-style: none;
  margin: 0;
  padding: 10px;
  display: flex;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
#guide li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  font-size: 15px;
  color: var(--muted);
  opacity: 0.55;
  transition: opacity 0.3s ease, background 0.3s ease, color 0.3s ease;
}
#guide li .n {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
}
#guide li.done { opacity: 0.4; }
#guide li.done .n { background: rgba(255, 255, 255, 0.14); border-color: transparent; }
#guide li.active { opacity: 1; color: var(--fg); background: rgba(255, 255, 255, 0.1); }
#guide li.active .n { background: var(--fg); color: #111; border-color: transparent; animation: guide-pulse 1.6s ease-in-out infinite; }
@keyframes guide-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.35); } 50% { box-shadow: 0 0 0 6px rgba(255,255,255,0); } }
#guide .sub { margin: 12px 0 0; font-size: 13px; color: var(--muted); text-shadow: 0 1px 8px rgba(0,0,0,0.5); }
@media (max-width: 480px) {
  #guide .steps { flex-direction: column; border-radius: 18px; align-items: stretch; }
  #guide li { font-size: 14px; }
}
