/* LetOut —— 夜色街头（与 SoloSpeak 的京都白日形成反差）
   SoloSpeak: 浅暖灰 / 明朝衬线 / 圆角卡片 / 安静
   LetOut  : 暖黑夜色 / 无衬线重字 / 锐角直边 / 热烈 */

:root {
  --bg: #17120f;          /* 暖黑 */
  --bg-2: #201814;        /* 抬起层 */
  --text: #f6ece4;
  --muted: #9b8375;
  --line: #33251e;
  --accent: #e07850;      /* 活力橙 */
  --accent-hot: #ff8b5e;
  --accent-deep: #c45c3e;
  --rest: #3a2b23;
  --r: 4px;               /* 锐角：与 SoloSpeak 的 14px 圆角拉开 */

  /* 情绪主色（由 JS 按当前情绪写入 html，全站继承） */
  --mode-live: #e07850;
  --mode-from: #ffa06b;
  --mode-to: #df3f22;
  /* 实时音量 0..1，录音时由波形模块每帧回传 */
  --live-level: 0;
  /* 弹性回弹缓动：点下去有肉感，不是生硬切换 */
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
  /* 玻璃质感（参考 Xinqing-Station / Daily-Mood-Tracker 的 glassmorphism 写法，适配暗色锐角） */
  --glass-blur: 16px;
  --glass-bg: color-mix(in srgb, var(--bg-2) 56%, transparent);
  --glass-brd: color-mix(in srgb, #ffffff 16%, transparent);
  --glass-shadow: 0 6px 22px color-mix(in srgb, #000 42%, transparent),
                  inset 0 1px 0 color-mix(in srgb, #ffffff 10%, transparent);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: "Helvetica Neue", -apple-system, BlinkMacSystemFont,
               "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* 颗粒噪点叠层：一张内联 SVG 噪声铺满，让纯色块有胶片质感（夜色街头调性）
   纯装饰、不吃事件、不参与布局；静态图层，零 JS、零重绘成本 */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 40;
  pointer-events: none;
  opacity: .055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}

#app {
  position: relative; z-index: 1; /* 抬到粒子背景之上，玻璃卡片才能透出底层粒子 */
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

/* 全屏粒子背景：情绪色氛围（tsParticles 自托管，录音时暂停省电） */
#bg-particles {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
}

/* 系列切换条：回转 Hub + 兄弟站 */
.series-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 11px; letter-spacing: .1em;
}
.series-bar a { color: var(--muted); text-decoration: none; }
.series-bar a:hover { color: var(--accent-hot); }
.series-bar .series-name { color: #6b574c; }

/* 顶栏：左对齐、无 sticky（SoloSpeak 是 sticky 居中气质） */
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 800; font-size: 19px; letter-spacing: -.02em;
  color: var(--text); text-transform: uppercase;
}
.brand-sub {
  display: block; font-weight: 400; font-size: 11px;
  color: var(--accent); letter-spacing: .3em; text-transform: none;
}
.nav { display: flex; gap: 2px; }
.nav-btn {
  border: none; background: transparent; color: var(--muted);
  font-size: 13px; padding: 5px 9px; cursor: pointer;
  border-bottom: 2px solid transparent; transition: .15s;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.active { color: var(--accent-hot); border-bottom-color: var(--accent); }

.view { flex: 1; padding: 22px 18px 28px; }

/* ===== 首页：模式网格即主角（无标题块，打开即选） ===== */

/* 情绪类型：4 格大色块，开场即选（LetOut 视觉核心，热烈释放） */
.emotion-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; margin-bottom: 14px;
}
.emotion-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  padding: 22px 6px 18px;
  border: 1px solid var(--glass-brd); background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--r); cursor: pointer; position: relative; overflow: hidden;
  color: var(--muted);
  box-shadow: var(--glass-shadow);
  transition: transform .32s var(--ease-back), border-color .25s, box-shadow .3s, background .25s;
  animation: tile-in .42s var(--ease-back) both;
}
.emotion-tile:active { transform: scale(.965); }
.emotion-tile:nth-child(2) { animation-delay: .04s; }
.emotion-tile:nth-child(3) { animation-delay: .08s; }
.emotion-tile:nth-child(4) { animation-delay: .12s; }
.emotion-tile::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, var(--mode-live, #e07850) 0%, transparent 60%);
  opacity: 0; transition: opacity .25s;
}
.emotion-tile:hover { transform: translateY(-2px); border-color: #5a3d2e; color: var(--text); }
.et-emoji { font-size: 32px; line-height: 1; filter: grayscale(.45); transition: filter .2s, transform .2s; }
.et-label { font-size: 14px; font-weight: 700; letter-spacing: .06em; }
.emotion-tile.active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--mode-live, #e07850) 65%, transparent);
  box-shadow: 0 10px 32px color-mix(in srgb, var(--mode-live, #e07850) 24%, transparent),
              inset 0 1px 0 color-mix(in srgb, #ffffff 12%, transparent);
}
.emotion-tile.active::after { opacity: .2; }
.emotion-tile.active .et-emoji {
  filter: none;
  transform: scale(1.12);
  transition: transform .4s var(--ease-back), filter .2s;
}

/* 声纹：情绪下的细分变体，轻量胶囊 */
.voice-block { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.voice-label { font-size: 12px; color: var(--muted); }
.voice-row { display: flex; flex-wrap: wrap; gap: 7px; }
.voice-chip {
  padding: 6px 13px; border: 1px solid var(--glass-brd); background: var(--glass-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 999px; cursor: pointer; color: var(--muted);
  box-shadow: var(--glass-shadow);
  transition: transform .3s var(--ease-back), border-color .2s, background .25s, color .2s;
  font-size: 12.5px;
}
.voice-chip:active { transform: scale(.93); }
.voice-chip:hover { border-color: #5a3d2e; color: var(--text); }
.voice-chip.active {
  border-color: var(--mode-live, #e07850); color: var(--text);
  background: color-mix(in srgb, var(--mode-live, #e07850) 16%, var(--bg-2));
}

@keyframes tile-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 释放区：全幅、无卡片包裹，背景随情绪染色 */
.release-zone {
  text-align: center; padding: 14px 0 6px; position: relative;
  border-radius: var(--r); transition: background .45s ease;
  background: radial-gradient(140% 80% at 50% 0%,
    color-mix(in srgb, var(--mode-live, #e07850) 10%, transparent) 0%, transparent 55%);
}
/* 音量驱动的环境光：说得越响，整片释放区越亮越烫（录音时才起作用） */
.release-zone::before {
  content: ''; position: absolute; inset: -24px -14px 0;
  pointer-events: none; z-index: 0; border-radius: 50% 50% 30% 30%;
  background: radial-gradient(115% 76% at 50% 8%,
    var(--mode-live, #e07850) 0%, transparent 64%);
  opacity: calc(.04 + var(--live-level, 0) * .34);
  filter: blur(6px);
  transition: opacity .14s linear, background .45s ease;
}
.release-zone > * { position: relative; z-index: 1; }
.wave-canvas { width: 100%; height: 84px; display: block; margin-bottom: 10px; }
/* 情绪影子的声波播放器：紧凑模式，辅条级 */
.shadow-card .wave-canvas { height: 56px; border-radius: 6px; }
.rec-timer {
  font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums;
  letter-spacing: .04em; color: var(--text);
  transition: color .3s, text-shadow .14s linear;
}
/* 录音中：秒数染上情绪色，并随音量微微发光 */
html[data-rec="1"] .rec-timer {
  color: var(--mode-live, #e07850);
  text-shadow: 0 0 calc(var(--live-level, 0) * 26px)
    color-mix(in srgb, var(--mode-live, #e07850) 70%, transparent);
}
.rec-btn {
  width: 84px; height: 84px; border-radius: 50%;
  border: 2px solid var(--mode-live, #e07850); cursor: pointer; margin: 16px auto 14px;
  background: var(--mode-live, #e07850); color: #17120f; font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--mode-live, #e07850) 10%, transparent);
  transition: transform .3s var(--ease-back), box-shadow .2s, background .2s, border-color .2s;
}
.rec-btn:hover { transform: scale(1.04); }
.rec-btn:active { transform: scale(.94); }
/* 录音中：不再用固定节奏的脉冲，改成「声音越大越烫」——辉光与微缩放都由实时音量驱动 */
.rec-btn.recording {
  background: transparent; color: var(--mode-live, #e07850);
  box-shadow:
    0 0 0 calc(3px + var(--live-level, 0) * 9px) color-mix(in srgb, var(--mode-live, #e07850) 18%, transparent),
    0 0 calc(14px + var(--live-level, 0) * 46px) calc(2px + var(--live-level, 0) * 9px) var(--mode-live, #e07850);
  transform: scale(calc(1 + var(--live-level, 0) * .07));
  transition: box-shadow .13s linear, transform .13s ease-out, color .2s;
}
.rec-hint {
  color: var(--muted); font-size: 13px; line-height: 1.75;
  max-width: 300px; margin: 0 auto;
}

/* 轮换引导语：计时器上方，极轻、半透明、每 3 秒换一句 */
.ghost-guide {
  min-height: 18px; margin: 6px auto 2px; max-width: 320px;
  font-size: 13px; color: var(--accent-hot); opacity: .82;
  letter-spacing: .02em; font-style: italic; transition: opacity .3s;
}

/* 情绪影子：影视台词卡（文本 + webm 音频）—— 辅助层级，不抢录音区焦点 */
.shadow-zone { margin-top: 14px; }
.shadow-card {
  border: 1px solid color-mix(in srgb, var(--glass-brd) 50%, transparent);
  border-radius: calc(var(--r) - 2px);
  background: color-mix(in srgb, var(--glass-bg) 60%, transparent);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.6));
  backdrop-filter: blur(calc(var(--glass-blur) * 0.6));
  box-shadow: none;
  padding: 10px 12px;
  opacity: .82;
}
.shadow-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 6px;
}
.shadow-label {
  font-size: 10px; font-weight: 700; letter-spacing: .24em;
  text-transform: uppercase; color: color-mix(in srgb, var(--accent) 65%, var(--muted));
}
.shadow-batch { font-size: 9px; color: #5a4a42; letter-spacing: .03em; }
.shadow-item { padding: 6px 0; border-top: 1px dashed color-mix(in srgb, var(--line) 50%, transparent); }
.shadow-item:first-of-type { border-top: none; padding-top: 0; }
.shadow-title { font-size: 11px; color: var(--accent); letter-spacing: .06em; margin-bottom: 5px; }
.shadow-text { font-size: 14px; line-height: 1.8; color: var(--text); }
.shadow-audio { width: 100%; margin-top: 10px; height: 34px; }
.shadow-loading { font-size: 12px; color: var(--muted); padding: 8px 0; }

.keep-toggle {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  font-size: 12px; color: var(--muted);
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--line); cursor: pointer;
}
.keep-toggle input { width: 15px; height: 15px; accent-color: var(--accent); }

/* 库房 */
.section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .28em;
  text-transform: uppercase; color: var(--accent);
  margin: 2px 0 16px;
}
.empty {
  text-align: center; color: var(--muted); padding: 64px 20px;
  font-size: 14px; line-height: 1.9;
}
.log-item {
  background: var(--glass-bg); border: 1px solid var(--glass-brd);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-left: 2px solid var(--accent-deep);
  border-radius: var(--r); padding: 13px 14px; margin-bottom: 10px;
  box-shadow: var(--glass-shadow);
}
.log-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.log-mode {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  padding: 3px 8px; border-radius: 2px;
  background: var(--rest); color: var(--accent-hot);
}
.log-meta { font-size: 11px; color: var(--muted); }
.player { margin: 2px 0 8px; }
/* P0-1 擦除定位：录完的声波可拖拽定位（Tide/Audiom 灵魂交互） */
.player .wave-canvas { cursor: pointer; touch-action: none; }
.player-note { font-size: 11px; color: var(--muted); padding: 5px 0; }
.player-bar { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.play-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent); color: #17120f; font-size: 13px; flex-shrink: 0;
  transition: transform .2s var(--ease-back), box-shadow .2s;
}
.play-btn:hover { transform: scale(1.08); }
.play-btn:active { transform: scale(.92); }
/* 播放中：播放键发光呼吸 */
.shadow-card .play-btn[data-playing="1"] {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent),
              0 0 14px 2px color-mix(in srgb, var(--accent) 25%, transparent);
}
.player-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 资源音频：紧凑音符 + 声波条（辅件级，不抢焦点） */
.shadow-player--audio {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 2px 0 0;
}
.shadow-note {
  width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--accent) 60%, transparent);
  background: radial-gradient(circle at 50% 36%,
    color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%);
  color: color-mix(in srgb, var(--accent) 70%, var(--muted));
  font-size: 20px; line-height: 1; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: none;
  transition: transform .2s var(--ease-back), box-shadow .2s, background .2s;
}
.shadow-note:hover { transform: scale(1.1); }
.shadow-note:active { transform: scale(.93); }
.shadow-note[data-playing="1"] {
  background: radial-gradient(circle at 50% 50%,
    color-mix(in srgb, var(--accent) 36%, transparent), transparent 72%);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent),
              0 0 10px 1px color-mix(in srgb, var(--accent) 20%, transparent);
  animation: notePulse 1.5s ease-in-out infinite;
}
@keyframes notePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.shadow-player--audio .wave-canvas { width: 100%; }
.shadow-player--audio .player-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.log-controls { display: flex; gap: 8px; }
.mini-btn {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 11px; padding: 5px 10px; border-radius: 2px; cursor: pointer;
  letter-spacing: .04em;
}
.mini-btn:hover { border-color: var(--accent-deep); color: var(--accent-hot); }

/* P1-4 情绪声波卡模态：移动端长按 <img> 存相册，桌面端「保存图片」下载 */
.share-modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 8, 7, .82);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 22px;
}
.share-card-wrap {
  max-height: 70vh; overflow: hidden; border-radius: var(--r);
  box-shadow: 0 18px 60px color-mix(in srgb, #000 60%, transparent);
}
.share-img { display: block; max-height: 70vh; max-width: 92vw; height: auto; border-radius: var(--r); }
.share-actions { display: flex; gap: 10px; }
.share-actions .mini-btn { font-size: 13px; padding: 9px 18px; }
.share-save { border-color: var(--accent); color: var(--accent-hot); }
.share-tip { color: var(--muted); font-size: 11px; margin: 0; text-align: center; }

/* 关于 */
.about-hero { padding: 6px 0 4px; }
.about-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.about-sub { color: var(--muted); font-size: 12px; margin-top: 4px; letter-spacing: .05em; }
.promise { margin: 26px 0; padding-left: 14px; border-left: 2px solid var(--accent); }
.promise-line { font-size: 19px; font-weight: 700; margin: 4px 0; letter-spacing: -.01em; }
.promise-leave { font-size: 13px; color: var(--muted); margin-top: 12px; }
.story { color: #cdbcb0; font-size: 14px; line-height: 1.95; }
.story p { margin-bottom: 12px; }
.about-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.about-foot-note { color: var(--muted); font-size: 11px; letter-spacing: .04em; }

/* 页脚：最多 2 个出站链接 */
.site-footer {
  padding: 16px 18px 26px; border-top: 1px solid var(--line); margin-top: auto;
}
.foot-links { display: flex; gap: 18px; margin-bottom: 6px; }
.foot-links a {
  color: var(--muted); text-decoration: none; font-size: 12px; letter-spacing: .04em;
}
.foot-links a:hover { color: var(--accent-hot); }
.foot-copy { color: #6b574c; font-size: 10px; letter-spacing: .06em; }

/* 母 slogan（Speak Series 统一骨架） */
.mother-slogan {
  text-align: center; font-size: 13px; color: var(--muted);
  letter-spacing: .06em; margin: 0 0 10px;
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(10px);
  background: var(--accent); color: #17120f; padding: 9px 18px; border-radius: 2px;
  font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 480px) {
  .emotion-tile { padding: 18px 6px 15px; }
  .et-emoji { font-size: 28px; }
  .voice-chip { padding: 6px 11px; font-size: 12px; }
}

/* 尊重系统「减少动态效果」：保留信息（颜色/亮度），去掉缩放与抖动 */
@media (prefers-reduced-motion: reduce) {
  .emotion-tile, .voice-chip, .rec-btn { animation: none !important; }
  .emotion-tile:active, .voice-chip:active,
  .rec-btn:hover, .rec-btn:active, .rec-btn.recording { transform: none !important; }
  .release-zone::before { transition: opacity .4s ease; }
}

/* 不支持 backdrop-filter 的浏览器（部分老旧内核）回退实色，避免看穿底层 */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .emotion-tile, .voice-chip, .shadow-card, .log-item {
    background: var(--bg-2) !important;
    box-shadow: none !important;
  }
}

/* 桌面端适配：不再是一条手机窄条，核心区两栏（左：情绪/声纹，右：释放台） */
@media (min-width: 820px) {
  #app { max-width: 920px; }
  .view { display: grid; grid-template-columns: 1fr 1.12fr; gap: 24px; align-items: start; }
  .emotion-grid { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); }
  .voice-block, .keep-toggle { grid-column: 1; }
  .release-zone {
    grid-column: 2; grid-row: 2 / span 4;
    position: sticky; top: 96px; margin: 0; padding: 26px 18px;
  }
  .shadow-zone { grid-column: 1 / -1; }
}


/* ===== 语言切换（2026-09-01） ===== */
.lang-select {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  padding: 3px 6px;
  cursor: pointer;
  font-family: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
  min-width: 42px;
}
.lang-select:hover {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.06);
}
.lang-select:focus {
  border-color: rgba(255,255,255,0.5);
}
@media (max-width: 480px) {
  .lang-select { font-size: 12px; padding: 2px 4px; min-width: 36px; }
}
