/* app-extra.css — 应用外壳新增组件样式（登录/阶段导航/对话布局/打字指示器）
   沿用 app.css 的设计 token：--navy-* / --gold-* / --bg / --ink，苹果式克制 + 远航深蓝暖金。 */

.hidden { display: none !important; }

/* ============ 全局布局 ============ */
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, "PingFang SC", "Songti SC", sans-serif; }

/* ============ 认证视图 ============ */
.auth-view { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; overflow: auto; }
.auth-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, #10345A 0%, #0A2540 45%, #061527 100%);
}
.auth-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(216,182,86,.5) 1px, transparent 1px);
  background-size: 46px 46px; opacity: .18;
}
.auth-card {
  position: relative; z-index: 1; width: 100%; max-width: 420px;
  background: var(--card); border-radius: 24px; padding: 40px 36px 32px;
  box-shadow: 0 24px 60px rgba(6,21,39,.35);
}
.auth-mark { font-size: 30px; color: var(--gold-500); text-align: center; line-height: 1; }
.auth-brand { text-align: center; font-size: 13px; letter-spacing: 3px; color: var(--gold-700); margin: 8px 0 20px; font-weight: 600; }
.auth-card h1 { font-family: "Songti SC", serif; font-size: 28px; font-weight: 600; text-align: center; margin: 0 0 8px; color: var(--navy-800); }
.auth-sub { text-align: center; font-size: 14px; color: var(--gray); line-height: 1.6; margin: 0 0 26px; }
.auth-label { display: block; font-size: 12.5px; color: var(--gray); margin: 14px 0 6px; letter-spacing: .3px; }
.auth-input {
  width: 100%; box-sizing: border-box; padding: 13px 15px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.auth-input:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px var(--gold-soft); }
.auth-error { color: #C0392B; font-size: 13px; min-height: 18px; margin: 12px 0 0; text-align: center; }
.auth-submit { width: 100%; margin-top: 10px; justify-content: center; }
.auth-switch { text-align: center; font-size: 13.5px; color: var(--gray); margin-top: 18px; }
.auth-switch a { color: var(--gold-700); text-decoration: none; font-weight: 600; }
.auth-privacy { text-align: center; font-size: 11.5px; color: var(--gray-2); line-height: 1.6; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }

/* ============ 应用视图 ============ */
.app-view { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
/* 覆盖原型 app.css 遗留的 .app-head{position:sticky;top:60px}（原型顶部另有品牌条），
   否则 header 被顶下 60px、把阶段导航压在下面看不见。 */
.app-head { position: static; top: auto; display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line-soft); flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-family: "Songti SC", serif; font-size: 18px; font-weight: 600; color: var(--navy-800); }
.brand-mark { color: var(--gold-500); font-size: 20px; }
.head-right { display: flex; align-items: center; gap: 10px; }
.user-chip { font-size: 13px; color: var(--ink-2); background: var(--navy-tint); padding: 6px 14px; border-radius: 999px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 阶段导航 ============ */
.phase-nav { display: flex; gap: 4px; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--line-soft); overflow-x: auto; flex-shrink: 0; }
.ptab { display: flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px; font-size: 13px; color: var(--gray-2); white-space: nowrap; transition: all .25s; }
.ptab .pnum { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--line-soft); font-size: 11px; font-weight: 600; }
.ptab.done { color: var(--gold-700); }
.ptab.done .pnum { background: var(--gold-soft); color: var(--gold-700); }
.ptab.active { background: var(--navy-800); color: #fff; }
.ptab.active .pnum { background: var(--gold-500); color: var(--navy-900); }

/* ============ 对话主体 ============ */
.app-main { flex: 1; overflow-y: auto; padding: 0; }
.chat-col { max-width: 760px; margin: 0 auto; padding: 24px 20px 40px; }
.phase-title { font-family: "Songti SC", serif; font-size: 20px; font-weight: 600; color: var(--navy-800); margin-bottom: 20px; }
.chat-stream { display: flex; flex-direction: column; gap: 18px; }

.msg { display: flex; gap: 12px; animation: msgRise .45s cubic-bezier(.22,1,.36,1) both; }
@keyframes msgRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg.me { justify-content: flex-end; }
.msg .bubble { max-width: 78%; padding: 14px 18px; border-radius: 20px; font-size: 15px; line-height: 1.72; }
.msg.me .bubble { background: var(--navy-800); color: #fff; border-bottom-right-radius: 6px; }
.msg.ai .bubble { background: #fff; color: var(--ink); border: 1px solid var(--line-soft); border-bottom-left-radius: 6px; box-shadow: 0 2px 10px rgba(10,37,64,.04); }
.ai-av { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--gold-400), var(--gold-600)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }

/* 打字指示器 */
.typing { display: inline-flex; gap: 4px; align-items: center; height: 20px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold-400); animation: typingBounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }

/* 阶段分隔 */
.phase-divider { display: flex; align-items: center; gap: 14px; margin: 8px 0; color: var(--gray-2); font-size: 12.5px; letter-spacing: 1px; }
.phase-divider::before, .phase-divider::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }

/* 产物面板 */
.output-panel { margin-top: 28px; }

/* ============ 底部输入 ============ */
.chat-foot { flex-shrink: 0; padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.9); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line-soft); }
.advance-btn { display: block; max-width: 760px; margin: 0 auto 12px; width: 100%; justify-content: center; }
.chat-input { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 6px 6px 20px; transition: border-color .2s, box-shadow .2s; }
.chat-input:focus-within { border-color: var(--gold-500); box-shadow: 0 0 0 3px var(--gold-soft); }
.chat-input input { flex: 1; border: none; outline: none; font-size: 15px; background: transparent; color: var(--ink); padding: 10px 0; }
.send-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--navy-800); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: opacity .2s, transform .15s; }
.send-btn:hover { transform: scale(1.05); }
.send-btn.disabled { opacity: .4; pointer-events: none; }
.attach-btn { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--gray); cursor: pointer; flex-shrink: 0; transition: background .2s, color .2s; }
.attach-btn:hover { background: var(--navy-tint); color: var(--navy-700); }

/* 已上传文件清单 */
.file-list { max-width: 760px; margin: 0 auto 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.file-list.hidden { display: none; }
.fitem { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line-soft); border-radius: 999px; padding: 6px 14px; font-size: 12.5px; color: var(--ink-2); max-width: 320px; }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--line-soft); color: var(--gray); white-space: nowrap; }
.fb.ok { background: #E8F5E9; color: #2E7D32; }
.fb.warn { background: var(--gold-soft); color: var(--gold-700); }
.fb.err { background: #FDECEA; color: #C0392B; }

/* ============ 报告封面（复用原型 rep-cover 视觉，补应用内布局） ============ */
#panel-report .rep-cover { background: radial-gradient(900px 400px at 50% 0%, #10345A, #061527); color: #fff; border-radius: 24px; padding: 56px 32px; text-align: center; margin-bottom: 20px; }
#panel-report .rc-mark { font-size: 44px; color: var(--gold-400); }
#panel-report .rc-eyebrow { font-size: 12px; letter-spacing: 3px; color: var(--gold-300); margin: 14px 0 10px; }
#panel-report .rc-name { font-family: "Songti SC", serif; font-size: 34px; font-weight: 500; }
#panel-report .rc-pos { font-size: 15px; color: rgba(255,255,255,.8); margin-top: 12px; line-height: 1.7; }
#panel-report .rc-date { font-size: 12px; color: rgba(255,255,255,.5); margin-top: 18px; }
#panel-report .rep-sec { background: #fff; border-radius: 20px; padding: 28px; margin-bottom: 16px; border: 1px solid var(--line-soft); }
#panel-report .rep-sec-head { font-family: "Songti SC", serif; font-size: 20px; font-weight: 600; color: var(--navy-800); margin-bottom: 14px; }
#panel-report .akb { font-size: 13px; color: var(--gold-700); background: var(--gold-soft); padding: 10px 14px; border-radius: 10px; margin-top: 12px; }
#panel-report .closing { text-align: center; padding: 32px; font-family: "Songti SC", serif; font-size: 19px; line-height: 1.8; color: var(--navy-700); }

/* 路径卡片网格（复用原型 pcard 视觉） */
#panel-paths .paths-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
#panel-paths .pcard { background: #fff; border-radius: 20px; overflow: hidden; border: 1px solid var(--line-soft); }
#panel-paths .ptop { height: 6px; }
#panel-paths .pbody { padding: 20px; }
#panel-paths .pn { font-size: 12px; letter-spacing: 1px; color: var(--gray-2); }
#panel-paths .pt { font-family: "Songti SC", serif; font-size: 19px; font-weight: 600; color: var(--navy-800); margin: 6px 0 8px; }
#panel-paths .pd { font-size: 13.5px; color: var(--gray); line-height: 1.6; margin-bottom: 14px; }
#panel-paths .radar { display: flex; justify-content: center; }

/* 镜子面板（复用原型 mirror 视觉） */
#panel-mirror .mirror-grid { display: grid; gap: 16px; }
#panel-mirror .portrait, #panel-mirror .pattern, #panel-mirror .tension { background: #fff; border-radius: 20px; padding: 24px; border: 1px solid var(--line-soft); }
#panel-mirror .mlabel { font-size: 12px; letter-spacing: 1px; color: var(--gold-700); margin-bottom: 10px; font-weight: 600; }
#panel-mirror .portrait p, #panel-mirror .pattern p { font-size: 15px; line-height: 1.78; color: var(--ink-2); margin: 0; }
#panel-mirror .mt { font-size: 12.5px; color: var(--gray-2); margin-top: 10px; }
#panel-mirror .pole { font-family: "Songti SC", serif; font-size: 18px; color: var(--navy-800); text-align: center; margin: 0; }
#panel-mirror .arrow { color: var(--gold-500); margin: 0 10px; }
#panel-mirror .assets { display: flex; flex-wrap: wrap; gap: 10px; }
#panel-mirror .atag { background: var(--gold-soft); color: var(--gold-700); padding: 8px 16px; border-radius: 999px; font-size: 13.5px; }

/* 实验卡片 */
#panel-report .ecard { background: var(--navy-tint); border-radius: 14px; padding: 16px 18px; margin-bottom: 10px; }
#panel-report .ek { font-size: 14.5px; color: var(--navy-800); font-weight: 500; }
#panel-report .ev { font-size: 12.5px; color: var(--gray); margin-top: 6px; }

/* 报告操作条 */
.report-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 28px 0 8px; }
.report-actions .btn { min-width: 200px; justify-content: center; }

/* ============ 响应式 ============ */
@media (max-width: 640px) {
  .app-head { padding: 12px 16px; }
  .brand { font-size: 16px; }
  .head-right .btn-sm { padding: 8px 12px; font-size: 12px; }
  .user-chip { display: none; }
  .phase-nav { padding: 8px 16px; }
  .chat-col { padding: 18px 14px 32px; }
  .msg .bubble { max-width: 86%; }
  .auth-card { padding: 32px 24px 26px; }
}
