* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; background: #f5f6f8; color: #222; height: 100vh; display: flex; flex-direction: column; }

header { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid #e3e5e8; flex-wrap: wrap; }
h1 { font-size: 17px; margin-right: 8px; }
.status { font-size: 12px; color: #666; padding: 3px 8px; background: #eef0f2; border-radius: 10px; }
.status.recording { background: #ffe8e8; color: #c00; }
.role-group { display: flex; gap: 4px; margin-left: auto; }
button { cursor: pointer; border: 1px solid #d0d3d8; background: #fff; border-radius: 6px; padding: 6px 12px; font-size: 13px; }
button:hover { background: #f0f2f5; }
button.primary { background: #1677ff; border-color: #1677ff; color: #fff; }
button.primary.recording { background: #d4380d; border-color: #d4380d; }
.role.active { background: #1677ff; color: #fff; border-color: #1677ff; }
button.mini { font-size: 11px; padding: 2px 8px; margin-left: 8px; }

main { flex: 1; display: grid; grid-template-columns: 1.2fr 480px; gap: 12px; padding: 12px 16px; min-height: 0; }
section { background: #fff; border: 1px solid #e3e5e8; border-radius: 8px; padding: 12px; display: flex; flex-direction: column; min-height: 0; }
h2 { font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; }
.right { overflow-y: auto; }
.tag { font-size: 11px; color: #888; font-weight: normal; margin-left: 6px; }

.transcript { flex: 1; overflow-y: auto; padding: 8px; line-height: 1.9; font-size: 15px; background: #fafbfc; border-radius: 6px; }
.transcript .line { margin-bottom: 6px; }
.transcript .role-label { display: inline-block; font-size: 11px; color: #1677ff; background: #e6f0ff; border-radius: 4px; padding: 0 6px; margin-right: 6px; vertical-align: 1px; }
.transcript .partial { color: #999; }   /* partial 灰色 */
.transcript .final { color: #111; }     /* final 黑色 */
.transcript .mine .role-label { color: #389e0d; background: #e8f7e0; }

.manual { display: flex; gap: 6px; margin-top: 8px; }
.manual input { flex: 1; border: 1px solid #d0d3d8; border-radius: 6px; padding: 6px 10px; font-size: 13px; }
.manual select { border: 1px solid #d0d3d8; border-radius: 6px; font-size: 13px; }

.transcript .role-label { cursor: pointer; }
.transcript .role-label.unknown { color: #999; background: #f0f0f0; }
.auto-infer { font-size: 12px; color: #666; font-weight: normal; margin-left: 4px; }
.auto-infer input { vertical-align: -2px; }

.candidates { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.candidate { border: 1px solid #d6e4ff; background: #f7faff; border-radius: 8px; padding: 12px 14px; cursor: pointer; font-size: 15px; line-height: 1.7; }
.candidate:hover { border-color: #1677ff; background: #eaf2ff; }
.candidate .ctype { display: inline-block; font-size: 11px; border-radius: 4px; padding: 0 6px; margin-right: 6px; color: #fff; }
.ctype.t0 { background: #1677ff; } .ctype.t1 { background: #722ed1; } .ctype.t2 { background: #fa8c16; }
.candidate .goto { font-size: 11px; color: #999; margin-left: 6px; }
.placeholder { color: #aaa; font-size: 13px; padding: 12px; text-align: center; }

.risks { margin-bottom: 10px; }
.risk-item { font-size: 12px; color: #d4380d; background: #fff1f0; border: 1px solid #ffccc7; border-radius: 6px; padding: 5px 10px; margin-bottom: 4px; }

.current-node { font-size: 14px; background: #fffbe6; border: 1px solid #ffe58f; border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; line-height: 1.6; }
.tree { font-size: 13px; }
.tree .section-title { font-weight: 600; color: #555; margin: 8px 0 4px; }
.tree .node { display: flex; gap: 6px; padding: 3px 6px; border-radius: 4px; color: #999; line-height: 1.5; }
.tree .node.complete { color: #389e0d; }
.tree .node.partial { color: #d48806; }
.tree .missing { font-size: 11px; color: #d48806; margin: 0 0 4px 40px; line-height: 1.4; }
.tree .node.current { background: #e6f0ff; color: #1677ff; font-weight: 600; }
.tree .node .nid { flex-shrink: 0; width: 34px; }
.progress-summary { font-size: 12px; color: #888; margin-top: 8px; }

/* ===== 手机排布（<900px）：单列、大触控区、转写/候选优先，桌面保持双栏 ===== */
@media (max-width: 899px) {
  body { height: auto; min-height: 100vh; }
  header { gap: 8px; padding: 10px 12px; position: sticky; top: 0; z-index: 10; }
  h1 { font-size: 16px; width: 100%; margin-right: 0; }
  .status { font-size: 11px; }
  .role-group { margin-left: 0; width: 100%; }
  .role-group .role { flex: 1; padding: 10px 4px; font-size: 14px; min-height: 42px; }
  #recordBtn { flex: 1.4; padding: 12px; font-size: 15px; min-height: 46px; }
  #exportBtn, #resetBtn { flex: 1; padding: 10px 6px; font-size: 12px; min-height: 46px; }

  main { display: flex; flex-direction: column; padding: 8px; gap: 10px; overflow: visible; }
  section { min-height: 0; padding: 10px; }
  h2 { font-size: 14px; flex-wrap: wrap; row-gap: 6px; }
  .left .transcript { max-height: 60vh; font-size: 15px; }
  .right { overflow-y: visible; }
  .right .tree { max-height: 45vh; overflow-y: auto; }
  .candidate { font-size: 16px; padding: 14px 12px; }
  .candidate .goto { display: block; margin: 4px 0 0; }
  .risk-item { font-size: 13px; }
  .current-node { font-size: 14px; }

  .manual { flex-wrap: wrap; }
  .manual input { min-width: 0; font-size: 16px; } /* 16px 防 iOS 聚焦自动放大 */
  .manual select, .manual button { font-size: 14px; min-height: 40px; }
  #inferBtn { min-height: 32px; }
}

/* ===== 访谈栏与登录 ===== */
.interview-bar { display: flex; align-items: center; gap: 8px; padding: 6px 16px; background: #fff; border-bottom: 1px solid #e3e5e8; font-size: 13px; }
.interview-bar select { max-width: 320px; border: 1px solid #d0d3d8; border-radius: 6px; padding: 5px 8px; font-size: 13px; }
.interview-bar .spacer { flex: 1; }
.interview-bar #userChip { color: #666; }
.login-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.login-mask[hidden] { display: none; }
.login-card { background: #fff; border-radius: 12px; padding: 28px; width: 320px; display: flex; flex-direction: column; gap: 12px; }
.login-card h2 { font-size: 18px; text-align: center; }
.login-card input { border: 1px solid #d0d3d8; border-radius: 6px; padding: 10px 12px; font-size: 15px; }
.login-card button { padding: 10px; font-size: 15px; }
.login-error { color: #d4380d; font-size: 13px; min-height: 16px; }
@media (max-width: 899px) {
  .interview-bar { flex-wrap: wrap; padding: 6px 12px; }
  .interview-bar select { max-width: 55vw; }
}
