/* 思念对话 —— 最小可用样式（Task 16 骨架；Task 17~19 在此基础上迭代） */

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0f1115;
  color: #e8eaf0;
}

/* 两屏切换/向导收起：显式压过下面的 display:grid/flex，保证 hidden 属性生效 */
[hidden] { display: none !important; }

/* —— 第一屏：烛光深色 · 聚焦单人（2026-10-13 重设计 spec） —— */
:root {
  --bg-deep: #0f0d13;                 /* 输入/落点底 */
  --bg-card: #151318;                 /* 首屏底 */
  --bg-panel: #1c1922;                /* 浮层/菜单底 */
  --line: #2a2630;
  --line-soft: #35303e;
  --gold: #c9a876;                    /* 烛金 */
  --gold-dim: rgba(201,168,118,.5);
  --gold-glow: rgba(216,180,140,.10);
  --ink: #e6dfd6;                     /* 主文字 */
  --ink-dim: #9a9188;
  --ink-faint: #5b5462;
  --danger: #ff9c8a;
}
#screen-home {
  max-width: 480px; min-height: 100dvh;
  margin: 0 auto; padding: 28px 16px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: var(--bg-card);
}
#brand { font-size: 11px; letter-spacing: .35em; color: #8d8398; font-weight: 500; }

#home-main { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#hero { position: relative; width: 66%; max-width: 300px; aspect-ratio: 3/4; margin: 12px 0 0; }
#hero-photo {
  width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer;
  border-radius: 16px; background: var(--bg-deep);
  border: 1px solid rgba(216,180,140,.35);
  box-shadow: 0 0 46px var(--gold-glow), 0 16px 34px rgba(0,0,0,.5);
}
#hero-meta { font-size: 16px; color: var(--ink); }
#hero-meta b { font-weight: 600; }
#hero-meta span { font-weight: 400; color: var(--ink-dim); }
#hero-hint { margin: 0; font-size: 11px; color: var(--ink-faint); }

#thumb-row {
  margin-top: auto; width: 100%; display: flex; gap: 10px; align-items: center;
  justify-content: safe center;   /* 溢出可滚动时避免居中截断首项（Chrome 115+） */
  overflow-x: auto;
  padding: 10px 4px 4px; border-top: 1px solid rgba(255,255,255,.05);
}
.thumb {
  flex: none; width: 38px; height: 38px; padding: 0; border: none; border-radius: 50%;
  overflow: hidden; cursor: pointer; background: var(--bg-deep); opacity: .55;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.on { opacity: 1; box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 3.5px var(--gold); }
#btn-add {
  flex: none; width: 38px; height: 38px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1.5px dashed #6a6274; background: transparent; color: #8d8398; font-size: 16px;
}

/* 空状态：空相框 */
#home-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
#empty-frame {
  width: 62%; max-width: 260px; aspect-ratio: 3/4; cursor: pointer;
  border: 1.5px dashed var(--gold-dim); border-radius: 16px; background: transparent;
  box-shadow: 0 0 46px rgba(216,180,140,.06);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
#empty-frame .plus { font-size: 30px; font-weight: 300; color: var(--gold); }
#empty-frame .ph-tip { font-size: 11px; color: #8d8398; }
.empty-title { margin: 6px 0 0; font-size: 15px; color: var(--ink); }
.empty-sub { margin: 0; font-size: 11px; color: var(--ink-faint); line-height: 1.9; text-align: center; }

/* 三步向导覆盖层 */
#wizard-overlay {
  position: fixed; inset: 0; z-index: 20; padding: 16px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8,7,10,.72); backdrop-filter: blur(2px);
}
#wizard {
  width: min(420px, 100%); padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--bg-panel); border: 1px solid var(--line-soft); border-radius: 16px;
  box-shadow: 0 18px 44px rgba(0,0,0,.55);
}
.wiz-head { display: flex; align-items: center; gap: 10px; }
#wiz-close { padding: 2px 4px; border: none; background: none; color: var(--ink-faint); font-size: 13px; cursor: pointer; }
.wiz-progress { flex: 1; display: flex; gap: 5px; }
.wiz-progress i { flex: 1; height: 3px; border-radius: 2px; background: #2e2a36; }
.wiz-progress i.on { background: var(--gold); }
#wiz-step-no { font-size: 11px; color: var(--ink-faint); }
.wiz-step { display: flex; flex-direction: column; gap: 10px; }
.wiz-step h2 { margin: 0; font-size: 16px; color: var(--ink); }
.wiz-sub { margin: -6px 0 0; font-size: 11px; color: var(--ink-faint); }
.drop {
  min-height: 88px; padding: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; text-align: center;
  word-break: break-all; font-size: 13px; color: var(--gold);
  border: 1.5px dashed var(--gold-dim); border-radius: 12px; background: var(--bg-deep);
}
.wiz-step label:not(.drop) { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-dim); }
.wiz-step input, .wiz-step textarea {
  padding: 9px 10px; font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg-deep);
}
.wiz-step textarea { min-height: 88px; resize: vertical; }
.step-msg { margin: 0; font-size: 12px; color: var(--danger); line-height: 1.5; }
.wiz-foot { display: flex; gap: 10px; }
#wiz-prev {
  flex: 0 0 auto; padding: 10px 16px; font: inherit; cursor: pointer;
  background: none; border: 1px solid var(--line-soft); border-radius: 9px; color: var(--ink-dim);
}
#wiz-next {
  flex: 1; padding: 10px 16px; font: inherit; cursor: pointer;
  background: rgba(201,168,118,.14); border: 1px solid rgba(201,168,118,.4);
  border-radius: 9px; color: var(--gold);
}
#wiz-next:disabled { opacity: .45; cursor: not-allowed; }

/* ⋯ 菜单（2026-10-13 spec：删除入口，二次确认兜底） */
#btn-hero-menu {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; padding: 0;
  border: none; border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 1;
  background: rgba(15,13,19,.55); color: var(--gold);
}
#hero-menu {
  position: absolute; top: 42px; right: 8px; z-index: 5; overflow: hidden;
  background: var(--bg-panel); border: 1px solid var(--line-soft); border-radius: 10px;
  box-shadow: 0 10px 26px rgba(0,0,0,.5);
}
#hero-menu button {
  display: block; width: 100%; padding: 9px 14px; white-space: nowrap;
  border: none; background: none; color: var(--danger); font-size: 13px; cursor: pointer;
}

/* —— 第二屏：对话 —— */
#screen-chat {
  max-width: 512px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 8px;
}
/* 两路视频叠放进同一格子：视频区 512x512 黑底（字幕层已下线，用户裁定 2026-10-12） */
#v-idle, #v-live { grid-area: 1 / 1; }
#v-idle, #v-live {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  object-fit: contain;
  justify-self: center;
}
/* Bug 1（2026-10-11）：首帧视频前 #v-idle 挂照片 poster——cover 填满 512 视频区 */
#v-idle { object-fit: cover; }
#log {
  max-height: 120px;
  overflow-y: auto;
  font-size: 13px;
  color: #9aa3b2;
}
/* Task 19：对话日志按角色着色（error = 服务端 error 信封，需醒目） */
#log .user { color: #8ab4f8; }
#log .assistant { color: #c8d1dd; }
#log .error { color: #ff9c8a; }
/* 底部输入条 */
#input-wrap { position: relative; }
#in-text {
  width: 100%;
  min-height: 3em;
  padding: 8px 44px 8px 8px;   /* 右侧让位给角标麦克风钮，文字不压按钮 */
  font: inherit;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  background: #171a21;
  color: inherit;
  resize: none;
}
/* 语音听写小按钮（2026-10-12 点击切换）：输入框右下角小圆钮，三态——
   idle 灰 / .rec 红色呼吸脉冲（录音中）/ .busy 禁用旋转（转写中） */
#btn-mic {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #3a4150;
  background: #171a21;
  color: #9aa3b2;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#btn-mic svg { width: 16px; height: 16px; fill: currentColor; }
#btn-mic.rec {
  color: #ff6b5e;
  border-color: #ff6b5e;
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 94, .45); }
  50%      { box-shadow: 0 0 0 7px rgba(255, 107, 94, 0); }
}
#btn-mic.busy {
  color: #5b6472;
  cursor: wait;
  animation: mic-spin 1s linear infinite;
}
@keyframes mic-spin { to { transform: rotate(360deg); } }
#btn-mic:disabled { opacity: .6; }
#btn-send { padding: 10px 16px; font-size: 15px; }
#btn-send:disabled { opacity: .6; cursor: wait; }
#btn-back { color: #9aa3b2; font-size: 14px; text-decoration: none; }
