/* ═══════════ 若梦空间站 ═══════════ */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* 小火箭光标（热点在火箭头）；按钮类元素保留 pointer 手型 */
html, body, #scene-container {
  cursor: url('rocket-cursor.png') 1 1, auto;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #05070f;
  color: #e8ecf4;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#scene-container {
  position: fixed;
  inset: 0;
  touch-action: none;          /* 防止页面随滑动滚动，交给自定义手势 */
}

/* ── 标题 ────────────────────────── */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  padding: max(16px, env(safe-area-inset-top)) 20px 0;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 2px 12px rgba(0,0,0,.6);
}
#header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 6px;
  background: linear-gradient(90deg, #ffd98a, #ffb35c, #ffd98a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
#header p {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(232,236,244,.55);
  letter-spacing: 1px;
  white-space: nowrap;   /* 微信等 WebView 字体度量差异易换行 */
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 44px;       /* 给左右留出，避免与音乐按钮/边缘重叠 */
}
#music-btn {
  position: absolute;
  right: 16px; top: max(16px, env(safe-area-inset-top));
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,217,138,.4);
  background: rgba(10,14,26,.55);
  color: #ffd98a;
  font-size: 16px;
  cursor: pointer;
  z-index: 12;
  pointer-events: auto;   /* 父级 #header 是 pointer-events:none，必须恢复可点击 */
}
#music-btn:active { transform: scale(.92); }

/* 首次交互提示 */
#sound-hint {
  position: fixed;
  top: 72px; left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(10,14,26,.8);
  border: 1px solid rgba(255,217,138,.45);
  color: #ffe9b8;
  font-size: 13px;
  white-space: nowrap;      /* 防止微信等 WebView 换行撑高 */
  width: max-content;
  max-width: calc(100vw - 24px);
  animation: ss-hint 1.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ss-hint {
  0%,100% { opacity: 1; }
  50% { opacity: .55; }
}

/* 配乐署名（CC BY 4.0） */
#credit {
  position: fixed;
  right: 12px; bottom: 8px;
  z-index: 5;
  font-size: 10px;
  color: rgba(232,236,244,.4);
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
  pointer-events: none;
}

/* ── 底部导航舰「若梦号」：侧视飞船 + 航行控制台（选择框 + 去探索） ── */
#station-frame {
  position: fixed;
  left: 50%; bottom: 22px;
  transform: translateX(-50%);
  z-index: 10;
  width: 440px; height: 200px;
  /* 固定尺寸：船体恒为 ~345px 宽，窄屏可超出被裁切 */
}
/* 内层包一层：整体缓浮（SVG + 控制台卡片一起动，卡片不脱离船体）；菜单展开时暂停 */
#station-inner {
  position: absolute; inset: 0;
  animation: ss-bob 7s ease-in-out infinite;
}
#station-inner.st-still { animation-play-state: paused; }
@keyframes ss-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
#station-art {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: visible;
}
/* 船体 */
#station-art .ss-hull {
  fill: url(#ss-hullGrad);
  stroke: #ffd98a; stroke-width: 1.4; opacity: .92;
}
#station-art .ss-seam {
  stroke: #ffd98a; stroke-width: .7; opacity: .22;
}
#station-art .ss-window {
  fill: rgba(255,217,138,.16); stroke: rgba(255,217,138,.5); stroke-width: .8;
}
#station-art .ss-cabin {
  fill: url(#ss-glassGrad); fill-opacity: .8;
  stroke: #ffd98a; stroke-width: 1.1; opacity: .95;
}
#station-art .ss-cabin-shine {
  stroke: #fff; stroke-width: 1.4; opacity: .5; stroke-linecap: round;
}
#station-art .ss-fin {
  fill: rgba(255,217,138,.07); stroke: #ffd98a; stroke-width: 1; opacity: .6;
}
#station-art .ss-nozzle {
  fill: rgba(255,217,138,.1); stroke: rgba(255,217,138,.6); stroke-width: .8;
}
/* 发动机尾焰：脉动（根在喷口处，向右生长） */
.ss-plume {
  transform-box: view-box;
  transform-origin: 90px 150px;
  animation: ss-plume 1.4s linear infinite;
}
@keyframes ss-plume {
  0%,100% { transform: scaleX(.94); opacity: .78; }
  30% { transform: scaleX(1.04); opacity: 1; }
  60% { transform: scaleX(.97); opacity: .85; }
  80% { transform: scaleX(1.06); opacity: .97; }
}
/* 航行控制台（金色窗口外框；选择卡由 JS 对齐到其中心） */
#station-art .ss-console {
  fill: rgba(5,9,18,.78);
  stroke: rgba(255,217,138,.55); stroke-width: 1.1;
}
#station-art .ss-name {
  fill: rgba(255,217,138,.62);
  font-size: 13px; letter-spacing: 4px;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
#station-art .st-panel rect {
  fill: rgba(255,217,138,.05);
  stroke: #ffd98a; stroke-width: 1.3; opacity: .5;
}
#station-art .st-panel line,
#station-art .st-mast {
  stroke: #ffd98a; stroke-width: .8; opacity: .32;
}
#station-art .st-bolt {
  fill: #ffd98a; opacity: .5;
}
#station-art .st-beacon {
  fill: #ffd98a;
  animation: ss-blink 2.2s ease-in-out infinite;
}
@keyframes ss-blink { 0%,100% { opacity: 1; } 50% { opacity: .2; } }

/* 空间站细节：电池片高光 / 对接舱 / 航行灯 / 通信碟（缓慢扫动） */
#station-art .st-cell {
  fill: rgba(255,217,138,.14); stroke: none; opacity: .5;
}
#station-art .st-mod {
  fill: rgba(255,217,138,.07); stroke: #ffd98a; stroke-width: 1; opacity: .55;
}
#station-art .st-light {
  fill: #ffd98a; opacity: .9;
  animation: ss-blink 2.2s ease-in-out infinite;
}
#station-art .st-light.l2 { animation-delay: 1.1s; }
#station-art .st-dish { fill: none; stroke: #ffd98a; stroke-width: 1.1; opacity: .6; }
#station-art .st-dish-line { stroke: #ffd98a; stroke-width: .8; opacity: .45; }
#station-art .st-dish-dot { fill: #ffd98a; opacity: .8; }
#station-art .st-dish-anim {
  transform-box: view-box;
  transform-origin: 432px 100px;
  animation: ss-dish 9s ease-in-out infinite;   /* 老浏览器不支持时保持静态，无副作用 */
}
@keyframes ss-dish { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }

/* 金色窗口（选择卡）：一行式控制台布局（选择框 + 去探索），JS 对齐到船体控制台中心 */
#info-card {
  position: absolute;
  left: 50%; top: 124px;   /* 兜底值；实际由 JS 按 SVG 控制台 rect 定位 */
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  box-shadow: none;
  font-size: 14px;
  max-width: calc(100vw - 24px);
  transition: opacity .3s, transform .3s;
}
#info-card.hidden { opacity: 0; transform: translate(-50%, -50%) translateY(12px) scale(.96); pointer-events: none; }

/* 选择框：定宽胶囊，文字居中（行内布局不随星体名长度跳位） */
#selector { position: relative; flex: none; }
#selector-current {
  width: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px;   /* 等边内边距：选项值严格居中 */
  border-radius: 999px;
  background: rgba(10,14,26,.55);
  border: 1px solid rgba(255,217,138,.45);
  color: #ffe9b8;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

/* 下拉菜单：按最长项定宽，文字居中 */
#selector-menu {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: max-content;
  max-height: 42vh;
  overflow-y: auto;
  border-radius: 12px;
  background: rgba(12,17,32,.96);
  border: 1px solid rgba(255,217,138,.35);
  box-shadow: 0 -8px 30px rgba(0,0,0,.5);
  padding: 6px;
  z-index: 15;
}
#selector-menu.hidden { display: none !important; }
.sel-item {
  position: relative;
  padding: 9px 26px;
  border-radius: 8px;
  font-size: 14px;
  color: #dfe6f2;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}
.sel-item:active { background: rgba(255,255,255,.08); }
.sel-item.selected {
  color: #ffd98a;
  background: rgba(255,217,138,.12);
  font-weight: 700;
}
.sel-item.selected::after {
  content: '✓';
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  opacity: .85;
}

/* 动作区：去探索 / 探索中 */
#info-action {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
#info-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #0b0f1a;
  background: linear-gradient(135deg, #ffd98a, #ffb35c);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(255,190,80,.35);
  white-space: nowrap;
}
#info-link:active { transform: scale(.96); }
#info-link.static { pointer-events: none; cursor: default; }   /* 「请选择」全景下的展示型按钮 */
#info-pending { color: rgba(232,236,244,.45); font-size: 13px; }

/* ── Toast ───────────────────────── */
#toast {
  position: fixed;
  top: 22%; left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(10,14,26,.85);
  border: 1px solid rgba(255,255,255,.15);
  font-size: 13px;
  transition: opacity .25s;
  pointer-events: none;
  white-space: nowrap;
}
#toast.hidden { opacity: 0; }

/* ── 哈雷彗星（缓慢划屏 + 拖尾引导文案；CSS 合成器动画，不拦截点击）────── */
#comet {
  position: fixed;
  left: 0; top: 0;
  z-index: 4;   /* 3D 场景之上、标签(5)/控制台(10)之下 */
  pointer-events: none;
  will-change: transform, opacity;
  /* 右上方入、左下方出（对角缓慢划过）；首尾淡入淡出避免循环跳变 */
  animation: comet-cross 55s linear infinite;
}
@keyframes comet-cross {
  0%   { transform: translate(104vw, 16vh) rotate(-14deg); opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { transform: translate(-48vw, 64vh) rotate(-14deg); opacity: 0; }
}
/* 哈雷彗星主体：单一 SVG 流线（亮白圆晕头部 + 细长渐隐尾部）；头部（coma 中心 viewBox 45,70 × 0.25）对齐原点(0,0) */
.comet-body {
  position: absolute;
  left: -11px; top: -18px;
  width: 150px; height: 35px;
  overflow: visible;
  pointer-events: none;
}
.comet-text {
  position: absolute;
  left: 70px; top: -22px;
  white-space: nowrap;
  font-size: 14px;
  letter-spacing: 3px;
  color: rgba(214,238,255,.85);
  text-shadow: 0 0 8px rgba(120,200,255,.45), 0 1px 2px rgba(0,0,0,.8);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
@media (prefers-reduced-motion: reduce) {
  #comet { animation: none; opacity: 0; }
}

/* ── 3D 标签（由 JS 逐帧定位）────── */
/* 原生 DOM 文字标签（2026-10-22：画布位图方案废弃——浏览器文字引擎逐帧在亚像素位置重栅格化 ⇒ 无闪烁/阶梯） */
.ss-label {
  position: absolute;
  left: 0; top: 0;
  z-index: 5;
  pointer-events: none;
}
/* 不加 will-change：避免被栅格化为图层纹理缓存（亚像素移动会重采样缓存 =「沸腾」）；
   text-shadow 保证星空背景可读性（替代原 canvas 阴影） */
.ss-label-text {
  display: inline-block;
  white-space: nowrap;
  font-family: "PingFang SC","Microsoft YaHei",system-ui,sans-serif;
  letter-spacing: .5px;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,.9), 0 0 6px rgba(0,0,0,.5);
}
/* 2026-10-23：太阳标签置于星体正中 ⇒ 「大模型」半落在亮黄日盘上，手机上蓝字低对比度淡出（只剩「AI」可见）
   ⇒ 8 向深色描边（阴影拼边，跨浏览器稳；不用 text-stroke）+ 深蓝，亮盘/暗空都可读 */
.ss-label.sun .ss-label-text {
  text-shadow:
    1px 0 0 #06101f, -1px 0 0 #06101f, 0 1px 0 #06101f, 0 -1px 0 #06101f,
    .7px .7px 0 #06101f, -.7px .7px 0 #06101f, .7px -.7px 0 #06101f, -.7px -.7px 0 #06101f,
    0 0 8px rgba(0,0,0,.8);
}

/* ── 无 WebGL 降级 ───────────────── */
#fallback {
  position: fixed; inset: 0;
  z-index: 30;
  overflow-y: auto;
  background: radial-gradient(1200px 800px at 50% -10%, #101a33 0%, #05070f 60%);
  padding: max(56px, env(safe-area-inset-top)) 24px 40px;
  text-align: center;
}
#fallback h2 {
  font-size: 24px;
  letter-spacing: 6px;
  background: linear-gradient(90deg, #ffd98a, #ffb35c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
#fallback .fb-sub { margin-top: 10px; font-size: 13px; color: rgba(232,236,244,.55); }
#fallback-list {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
  margin-left: auto; margin-right: auto;
}
.fb-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  text-decoration: none;
  color: #e8ecf4;
  font-size: 15px;
  transition: background .2s, border-color .2s;
}
.fb-card:active { background: rgba(255,255,255,.12); }
.fb-card .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 12px;
  flex: none;
}
.fb-card.moon {
  border-color: rgba(255,217,138,.7);
  background: rgba(255,180,60,.10);
  font-weight: 700;
}
.fb-card.moon .dot { background: #ffd98a; box-shadow: 0 0 10px #ffd98a; }
.fb-card.pending { opacity: .55; }
.fb-card .tag { font-size: 12px; color: rgba(232,236,244,.45); }

/* ── 加载动画 ────────────────────── */
#loader {
  position: fixed; inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #05070f;
  transition: opacity .5s;
}
#loader.gone { opacity: 0; pointer-events: none; }
#loader p { font-size: 13px; color: rgba(232,236,244,.6); letter-spacing: 2px; }
.spin {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255,217,138,.15);
  border-top-color: #ffd98a;
  animation: ss-spin 1s linear infinite;
}
@keyframes ss-spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }
