:root {
  --ink: #10181a;
  --cream: #f6efe2;
  --sun: #ffb454;
  --sea: #35d0ba;
  --panel-bg: rgba(14, 22, 24, 0.66);
  --panel-line: rgba(255, 255, 255, 0.09);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  font-family: 'Space Grotesk', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--cream);
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

/* ---------- 加载层 ---------- */
#loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #f2e4c4 0%, #cfe4e2 55%, #9ecfd8 100%);
  transition: opacity 0.9s ease, visibility 0.9s;
}
#loading.done { opacity: 0; visibility: hidden; }

.load-inner { text-align: center; color: var(--ink); }
.load-wave { width: 140px; height: auto; }
.load-wave .w1 { stroke-dasharray: 4 200; animation: dash 2.2s linear infinite; }
.load-wave .w2 { stroke-dasharray: 4 240; animation: dash 2.2s linear infinite reverse; }
@keyframes dash { to { stroke-dashoffset: -204; } }

.load-inner p {
  margin-top: 18px;
  font-size: 13px;
  letter-spacing: 0.35em;
  font-weight: 600;
}
.load-inner p span {
  display: block;
  margin-top: 6px;
  font-size: 9px;
  letter-spacing: 0.5em;
  opacity: 0.55;
}

/* ---------- 品牌 ---------- */
#brand {
  position: fixed;
  top: 28px;
  left: 32px;
  z-index: 10;
  pointer-events: none;
  text-shadow: 0 1px 12px rgba(10, 20, 25, 0.35);
}
#brand h1 {
  font-family: 'Fraunces', 'Songti SC', serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
  letter-spacing: 0.02em;
}
#brand p {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: 0.32em;
  opacity: 0.75;
  font-weight: 500;
}

/* ---------- 控制台 ---------- */
#panel {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 10;
  width: 264px;
  padding: 16px 18px 14px;
  border-radius: 16px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-line);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 18px 48px rgba(5, 12, 14, 0.35);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.panel-head h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
}
.panel-sub {
  font-size: 8px;
  letter-spacing: 0.28em;
  opacity: 0.45;
  margin-left: auto;
}
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sea);
  box-shadow: 0 0 0 0 rgba(53, 208, 186, 0.6);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(53, 208, 186, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(53, 208, 186, 0); }
  100% { box-shadow: 0 0 0 0 rgba(53, 208, 186, 0); }
}

.ctl { margin-bottom: 12px; }
.ctl-top {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 7px;
}
.ctl-top label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
}
.ctl-top .en {
  font-size: 8px;
  letter-spacing: 0.24em;
  opacity: 0.4;
}
.ctl-top output {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--sun);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(90deg, var(--sea) var(--fill, 50%), rgba(255, 255, 255, 0.14) var(--fill, 50%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--cream);
  border: 2px solid var(--sun);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--cream);
  border: 2px solid var(--sun);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 12px;
}
.toggle {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: transparent;
  color: rgba(246, 239, 226, 0.62);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.18s ease;
}
.toggle:hover { border-color: rgba(255, 255, 255, 0.35); color: var(--cream); }
.toggle.wide { padding: 6px 12px; }
.toggle[aria-pressed="true"] {
  background: rgba(53, 208, 186, 0.15);
  border-color: rgba(53, 208, 186, 0.55);
  color: #8ae9da;
}

.stats {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: rgba(246, 239, 226, 0.5);
}
.stats b {
  color: var(--cream);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- 提示 ---------- */
#hint {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 10;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(246, 239, 226, 0.55);
  text-shadow: 0 1px 8px rgba(10, 20, 25, 0.4);
  pointer-events: none;
}

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  #brand { top: 18px; left: 20px; }
  #panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }
  #hint { display: none; }
}
