:root {
  --ink: #0b3b4a;
  --ink-soft: rgba(11, 59, 74, 0.62);
  --coral: #ef7559;
  --coral-deep: #d9543a;
  --glass: rgba(255, 252, 245, 0.58);
  --glass-strong: rgba(255, 253, 248, 0.82);
  --glass-border: rgba(255, 255, 255, 0.72);
  --shadow: 0 12px 34px rgba(8, 48, 63, 0.18);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  overscroll-behavior: none;
  background: #123a48;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: default;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    120% 92% at 50% 42%,
    rgba(4, 36, 50, 0) 52%,
    rgba(4, 36, 50, 0.2) 100%
  );
}

/* ---------- 标题 ---------- */

.brand {
  position: fixed;
  top: clamp(18px, 3.4vh, 36px);
  left: clamp(18px, 3.4vw, 46px);
  z-index: 5;
  pointer-events: none;
  color: #fffdf7;
  text-shadow: 0 1px 2px rgba(6, 40, 55, 0.24),
    0 2px 26px rgba(6, 40, 55, 0.34);
}

.brand__eyebrow {
  margin: 0 0 8px;
  font-size: calc(14px * var(--fs));
  font-weight: 600;
  letter-spacing: 0.46em;
  opacity: 0.82;
}

.brand__title {
  margin: 0;
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC",
    "Iowan Old Style", Palatino, Georgia, serif;
  font-size: clamp(25px, 3.2vw, 38px);
  font-weight: 600;
  letter-spacing: 0.14em;
}

.brand__hint {
  margin: 10px 0 0;
  font-size: calc(14px * var(--fs));
  font-weight: 500;
  letter-spacing: 0.08em;
  opacity: 0.96;
}

/* ---------- 右上操作 ---------- */

.actions {
  position: fixed;
  top: clamp(18px, 3.4vh, 36px);
  right: clamp(18px, 3.2vw, 40px);
  z-index: 5;
  display: flex;
  gap: 8px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(8, 48, 63, 0.14);
  -webkit-backdrop-filter: blur(12px) saturate(1.25);
  backdrop-filter: blur(12px) saturate(1.25);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.icon-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--glass-strong);
}

.icon-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.96);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ---------- 底部素材栏 ---------- */

.dock {
  position: fixed;
  left: 50%;
  bottom: calc(clamp(16px, 3vh, 30px) + var(--safe-bottom));
  z-index: 5;
  display: flex;
  width: max-content;
  max-width: calc(100vw - 24px);
  gap: 4px;
  padding: 7px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  transform: translateX(-50%);
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  font: inherit;
  font-size: calc(14px * var(--fs));
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.tool:hover {
  background: rgba(255, 255, 255, 0.55);
}

.tool:active {
  transform: scale(0.97);
}

.tool__icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
}

.tool.is-active {
  color: #fff;
  background: linear-gradient(160deg, var(--coral), var(--coral-deep));
  box-shadow: 0 6px 16px rgba(217, 84, 58, 0.35);
}

.tool.is-active:hover {
  background: linear-gradient(160deg, var(--coral), var(--coral-deep));
}

/* ---------- 提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(clamp(16px, 3vh, 30px) + 76px + var(--safe-bottom));
  z-index: 6;
  max-width: min(86vw, 420px);
  padding: 9px 16px;
  font-size: calc(14px * var(--fs));
  letter-spacing: 0.04em;
  color: #fdf8ee;
  background: rgba(10, 52, 66, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  position: fixed;
  inset: 40% 20% auto;
  z-index: 9;
  color: #fff;
  text-align: center;
}

/* ---------- 交互态 ---------- */

#scene.is-grabbing {
  cursor: grabbing !important;
}

button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* ---------- 小屏 ---------- */

@media (max-width: 640px) {
  .brand__hint {
    display: none;
  }

  .tool {
    padding: 9px 11px;
    font-size: calc(14px * var(--fs));
  }

  .dock {
    gap: 2px;
  }

  .actions {
    gap: 6px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 380px) {
  .tool__label {
    display: none;
  }

  .tool {
    padding: 10px 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .icon-btn,
  .tool,
  .toast {
    transition-duration: 0.01ms;
  }
}

/* 字号随屏幕宽度放大：2K/4K 下避免整体偏小；14px 为全站最小字号 */
:root {
  --fs: 1;
}
@media (min-width: 1920px) {
  :root {
    --fs: 1.08;
  }
}
@media (min-width: 2560px) {
  :root {
    --fs: 1.2;
  }
}
@media (min-width: 3200px) {
  :root {
    --fs: 1.32;
  }
}
@media (min-width: 3840px) {
  :root {
    --fs: 1.45;
  }
}

