/* 云水禅寺 · 3D 大殿 — styles, v1.0.0.
   Palette matches the 2D temple: deep indigo night + warm lantern gold. */
:root {
  --ink: #141a29;
  --ink-2: #1d2436;
  --gold: #e8c07a;
  --gold-dim: #c9a35c;
  --paper: #f5eeda;
  --paper-dim: #cfc6ae;
  --line: rgba(232, 192, 122, 0.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  -webkit-tap-highlight-color: transparent;
}
#scene-container, #scene-container canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none;
}

/* ---------- loading ---------- */
.loading {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #232b44 0%, #141a29 70%);
  transition: opacity 0.8s ease;
}
.loading.done { opacity: 0; pointer-events: none; }
.loading-mark {
  width: 84px; height: 84px; border-radius: 22px;
  background: linear-gradient(145deg, #e8c07a, #c9a35c);
  color: #1d2436; font-size: 48px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 60px rgba(232, 192, 122, 0.35);
  animation: breathe 3s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.loading-text { margin: 22px 0 4px; font-size: 18px; letter-spacing: 0.2em; }
.loading-sub { margin: 0; font-size: 11px; letter-spacing: 0.35em; color: var(--paper-dim); }

/* ---------- top HUD ---------- */
.hud-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(180deg, rgba(20, 26, 41, 0.85), rgba(20, 26, 41, 0));
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.back-link {
  color: var(--paper); text-decoration: none; font-size: 14px;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(20, 26, 41, 0.6); white-space: nowrap;
}
.brand-mini { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(145deg, #e8c07a, #c9a35c);
  color: #1d2436; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.brand-mini strong { font-size: 17px; letter-spacing: 0.12em; white-space: nowrap; }
.sound-control { display: flex; gap: 8px; margin-left: auto; }
.sound-btn {
  font-family: inherit; font-size: 14px; color: var(--gold);
  background: rgba(20, 26, 41, 0.65); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; cursor: pointer; white-space: nowrap;
}
.sound-btn[aria-pressed="true"] { background: var(--gold); color: #1d2436; border-color: var(--gold); }
.sound-btn-sm { padding: 8px 10px; }

/* ---------- mixer panel ---------- */
.sound-panel {
  position: fixed; z-index: 30; right: 14px; top: 64px;
  width: min(300px, calc(100vw - 28px));
  max-height: calc(100dvh - 90px); overflow-y: auto;
  background: rgba(29, 36, 54, 0.97); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 16px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.sound-panel-head { display: flex; align-items: center; justify-content: space-between; }
.sound-panel-head strong { font-size: 16px; letter-spacing: 0.1em; }
.panel-close {
  background: none; border: none; color: var(--paper-dim);
  font-size: 16px; cursor: pointer; padding: 4px 8px;
}
.sound-panel-note { margin: 6px 0 12px; font-size: 12px; line-height: 1.6; color: var(--paper-dim); }
.mixer-rows { display: flex; flex-direction: column; gap: 12px; }
.mixer-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.mixer-row label { font-size: 14px; }
.mixer-row input[type="range"] { width: 100%; accent-color: var(--gold); }
.mixer-toggle {
  width: 40px; height: 22px; border-radius: 999px; border: 1px solid var(--line);
  background: #2a3247; cursor: pointer; position: relative; padding: 0;
}
.mixer-toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--paper-dim); transition: all 0.2s ease;
}
.mixer-toggle[aria-pressed="true"] { background: var(--gold-dim); }
.mixer-toggle[aria-pressed="true"]::after { left: 20px; background: #fff8e6; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%);
  z-index: 25; max-width: calc(100vw - 40px);
  background: rgba(29, 36, 54, 0.95); border: 1px solid var(--line);
  color: var(--paper); font-size: 14px; padding: 10px 18px; border-radius: 999px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

/* ---------- bottom HUD ---------- */
.hud-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(20, 26, 41, 0.88), rgba(20, 26, 41, 0));
  pointer-events: none;
}
.hud-bottom > * { pointer-events: auto; }
.hint { margin: 0; font-size: 14px; color: var(--paper); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); text-align: center; }
.sit-timer { margin: 0; font-size: 13px; letter-spacing: 0.15em; color: var(--gold); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); }
.actions { display: flex; gap: 12px; }
.btn {
  font-family: inherit; font-size: 16px; letter-spacing: 0.08em;
  border-radius: 999px; padding: 12px 26px; cursor: pointer;
}
.btn-gold { background: linear-gradient(145deg, #e8c07a, #c9a35c); color: #1d2436; border: none; font-weight: 700; }
.btn-ghost { background: rgba(20, 26, 41, 0.6); color: var(--paper); border: 1px solid var(--line); }
.hall-note { margin: 0; font-size: 11px; letter-spacing: 0.08em; color: var(--paper-dim); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); }

@media (max-width: 640px) {
  .brand-mini strong { display: none; }
  .back-link { font-size: 13px; padding: 7px 9px; }
  .sound-btn { padding: 8px 11px; font-size: 13px; }
  /* 调音面板：手机底部抽屉 */
  .sound-panel {
    left: 0; right: 0; top: auto; bottom: 0; width: 100%;
    max-height: 78dvh; border-radius: 18px 18px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
  .toast { bottom: 170px; }
}
