/* ============ base.css · 3D 版全局样式（HUD 层） ============ */

:root {
  --pink: #f6a8bc;
  --pink-deep: #e4799a;
  --gold: #d9b380;
  --gold-deep: #b98d55;
  --cream: #fff6ea;
  --ink: #6b4a4f;
  --ink-soft: #a3767e;
  --shadow: 0 10px 30px rgba(180, 110, 120, 0.22);
  --radius: 18px;
  --hud-blur: blur(14px) saturate(1.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: "Ma Shan Zheng", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #ffe9ec;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
}

/* ---------- 3D 世界画布与 CSS3D 层 ---------- */
#world-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 0;
}
#css3d-layer {
  position: fixed; inset: 0;
  z-index: 1;
  pointer-events: none;
}
#css3d-layer > div { pointer-events: none; }

/* ---------- 加载失败 ---------- */
#load-fallback {
  position: fixed; inset: 0; z-index: 99;
  display: flex; align-items: center; justify-content: center;
  background: #fff2ef;
  color: var(--ink);
  font-size: 17px;
  text-align: center;
  padding: 24px;
}

/* ---------- 场景 HUD 层 ---------- */
#app { position: fixed; inset: 0; z-index: 2; pointer-events: none; }

.scene {
  position: absolute; inset: 0;
  display: none;
}
.scene.active { display: block; }
.scene [data-animate] { opacity: 0; }

/* HUD 元素恢复交互 */
.scene button, .scene a, .scene input,
.scene .no-swipe, #focus-hud, #nav-dots, #next-btn { pointer-events: auto; }

/* ---------- 通用按钮 ---------- */
.chip-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border: none; border-radius: 999px;
  font-family: inherit; font-size: 15px; letter-spacing: 1px;
  color: var(--ink);
  background: rgba(255, 252, 247, 0.82);
  backdrop-filter: var(--hud-blur);
  -webkit-backdrop-filter: var(--hud-blur);
  box-shadow: 0 6px 18px rgba(190, 120, 130, 0.18);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.chip-btn:active { transform: scale(0.94); }
.chip-btn svg { width: 17px; height: 17px; }
.chip-btn.accent {
  color: #fff; 
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  box-shadow: 0 8px 22px rgba(228, 121, 154, 0.4);
}
.chip-btn.small { padding: 7px 14px; font-size: 13px; }
.chip-btn.danger {
  color: #fff;
  background: linear-gradient(135deg, #e9899b, #d76a80);
}

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border: none; border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 252, 247, 0.82);
  backdrop-filter: var(--hud-blur);
  -webkit-backdrop-filter: var(--hud-blur);
  box-shadow: 0 6px 18px rgba(190, 120, 130, 0.18);
  cursor: pointer;
  transition: transform 0.25s ease, background 0.25s ease;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.tiny { width: 38px; height: 38px; }
.icon-btn.tiny svg { width: 17px; height: 17px; }
.icon-btn.danger { color: #c2455c; }

/* ---------- 场景标题 ---------- */
.scene-head {
  position: absolute;
  top: clamp(20px, 5.5vh, 54px);
  left: 0; right: 0;
  text-align: center;
  pointer-events: none;
}
.scene-title {
  font-size: clamp(28px, 5.6vw, 44px);
  font-weight: normal;
  letter-spacing: 6px;
  color: var(--ink);
  text-shadow: 0 2px 14px rgba(255, 235, 225, 0.9);
}
.scene-sub {
  margin-top: 8px;
  font-size: clamp(13px, 2.6vw, 16px);
  letter-spacing: 3px;
  color: var(--ink-soft);
}

/* ---------- 底部导航 ---------- */
#nav-dots {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px;
  z-index: 5;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 250, 246, 0.6);
  backdrop-filter: var(--hud-blur);
  -webkit-backdrop-filter: var(--hud-blur);
  box-shadow: 0 6px 20px rgba(190, 120, 130, 0.16);
}
#nav-dots .dot {
  width: 10px; height: 10px;
  border: none; border-radius: 50%;
  background: rgba(163, 118, 126, 0.35);
  cursor: pointer;
  transition: all 0.35s ease;
}
#nav-dots .dot.active {
  width: 26px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--pink), var(--gold));
}

#next-btn {
  position: fixed;
  right: 18px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 5;
  width: 46px; height: 46px;
  border: none; border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  box-shadow: 0 10px 24px rgba(228, 121, 154, 0.45);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.3s ease, opacity 0.3s ease;
  animation: nextFloat 2.4s ease-in-out infinite;
}
#next-btn svg { width: 22px; height: 22px; }
#next-btn.hidden { opacity: 0; pointer-events: none; }
@keyframes nextFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: rgba(90, 55, 65, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.modal.open { opacity: 1; visibility: visible; }
.modal-card {
  width: min(92vw, 460px);
  max-height: 82vh;
  overflow: auto;
  padding: 26px 24px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #fffaf4, #ffeee9);
  box-shadow: var(--shadow);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.22, 0.8, 0.3, 1);
}
.modal.open .modal-card { transform: none; }
.modal-card.small { width: min(88vw, 360px); }
.modal-card h3 {
  font-weight: normal;
  font-size: 21px; letter-spacing: 3px;
  text-align: center; margin-bottom: 16px;
}
.modal-card textarea, .modal-card .text-input {
  width: 100%;
  padding: 13px 15px;
  border: 1.5px solid rgba(217, 179, 128, 0.5);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  font-family: inherit; font-size: 15px; line-height: 1.7;
  color: var(--ink);
  resize: vertical;
  outline: none;
  transition: border-color 0.25s ease;
}
.modal-card textarea { min-height: 128px; }
.modal-card textarea:focus, .modal-card .text-input:focus { border-color: var(--pink-deep); }
.char-count {
  margin-top: 6px; text-align: right;
  font-size: 12px; color: var(--ink-soft);
}
.field-label {
  display: block;
  margin: 14px 0 7px;
  font-size: 14px; letter-spacing: 2px;
  color: var(--ink-soft);
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 18px;
}

/* ---------- 提示气泡 ---------- */
#toast-wrap {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  left: 50%; transform: translateX(-50%);
  z-index: 30;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px; letter-spacing: 1px;
  color: #fff;
  background: rgba(120, 80, 90, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px rgba(120, 70, 80, 0.3);
  animation: toastIn 0.4s cubic-bezier(0.22, 0.9, 0.3, 1.2);
}
.toast.out { opacity: 0; transform: translateY(-10px); transition: all 0.4s ease; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 涟漪 ---------- */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0);
  animation: rippleGo 0.6s ease-out forwards;
  pointer-events: none;
}
@keyframes rippleGo {
  to { transform: scale(2.4); opacity: 0; }
}

/* ---------- 隐藏辅助 ---------- */
[hidden] { display: none !important; }
