/* 优面Offer 网页版样式 —— 青绿主题 · 苹果风 · 浅色/深色两套 */

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ============ 设计令牌 ============ */
:root {
  --bg: #F6F9F8;
  --surface: #FFFFFF;
  --surface-2: #EEF4F1;
  --surface-3: #E7F8F6;
  --border: #DCE5E1;
  --text: #1B2522;
  --text-2: #5F6E68;
  --text-3: #93A39B;
  --primary: #16A99D;
  --primary-hover: #118F85;
  --primary-strong: #0E736C;
  --primary-soft: #CCF0EB;
  --primary-softer: #98E2DB;
  --role-int: #0E7A4A;
  --role-cand: #1F6FB2;
  --role-ai: #C05621;
  --role-ai-bg: #EEF4F1;
  --danger: #D0483C;
  --warn: #D99A2B;
  --scrollbar: #B9CCC5;
  --hint-bg: #FBF5E9;
  --hint-text: #8A6D3B;
  --hint-strong: #7A5C22;
  --shadow: 0 2px 8px rgba(0,0,0,.06), 0 12px 32px rgba(0,0,0,.08);
}

[data-theme="dark"] {
  --bg: #0F1514;
  --surface: #171F1D;
  --surface-2: #1E2825;
  --surface-3: #16221F;
  --border: #2A3632;
  --text: #E6EDEA;
  --text-2: #A3B1AA;
  --text-3: #6B7A73;
  --primary: #16A99D;
  --primary-hover: #118F85;
  --primary-strong: #5ED2C7;
  --primary-soft: #1E2825;
  --primary-softer: #2A3632;
  --role-int: #4CC99A;
  --role-cand: #6CB2E8;
  --role-ai: #E8925A;
  --role-ai-bg: #1E2825;
  --danger: #EF6B5E;
  --warn: #E0A93A;
  --scrollbar: #2A3632;
  --hint-bg: #2A241A;
  --hint-text: #D6B76A;
  --hint-strong: #E8CD8A;
  --shadow: 0 2px 8px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.5);
}

html, body {
  height: 100%;
  font-family: -apple-system, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background-color .2s ease, color .2s ease;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1120px;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: var(--shadow);
}

/* 标题栏 */
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-3);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.brand .logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--primary); color: #fff; font-size: 14px;
}
.conn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-left: auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.dot.on { background: var(--primary); box-shadow: 0 0 4px var(--primary); }
.dot.off { background: var(--danger); }
.header-actions { display: flex; gap: 6px; }
.icon-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: 13px; height: 30px; min-width: 30px; padding: 0 8px; border-radius: 8px;
  color: var(--text-2); text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--text); }

/* 电平指示 */
.levels { padding: 8px 14px 4px; display: flex; flex-direction: column; gap: 4px; }
.level-row { display: flex; align-items: center; gap: 10px; }
.level-row .lbl { width: 72px; font-size: 11px; color: var(--text-2); flex-shrink: 0; }
.level-row progress {
  flex: 1; height: 8px; border: none; border-radius: 4px;
  background: var(--surface); appearance: none; -webkit-appearance: none;
}
.level-row progress::-webkit-progress-bar { background: var(--surface); border-radius: 4px; }
.level-row progress::-webkit-progress-value { background: var(--role-int); border-radius: 4px; }
.level-row progress::-moz-progress-bar { background: var(--role-int); border-radius: 4px; }
#level-interviewer::-webkit-progress-value { background: var(--role-int); }
#level-candidate::-webkit-progress-value { background: var(--role-cand); }

/* 双栏：左=实时对话，右=AI 回答（对齐桌面端悬浮窗） */
.columns {
  flex: 1; display: flex; gap: 8px; padding: 8px 12px;
  min-height: 0;   /* 允许子栏在 flex 内独立滚动 */
}
.col {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden;
}
.col-chat { flex: 2; }
.col-answer { flex: 3; }
.col-head {
  display: flex; align-items: center; justify-content: space-between; flex: none;
  padding: 7px 10px; font-size: 12px; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.col-scroll { flex: 1; overflow-y: auto; padding: 10px 12px; }
.col-scroll .empty { color: var(--text-3); font-size: 13px; text-align: center; padding: 40px 0; }

/* 左栏气泡 */
.msg { margin: 8px 0; }
.msg-head { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.msg-body {
  font-size: 14px; line-height: 1.6; white-space: pre-wrap;
  word-break: break-word; color: var(--text);
  background: var(--surface-2); border-radius: 8px; padding: 7px 10px;
}
.msg-interviewer .msg-head { color: var(--role-int); }
.msg-candidate .msg-head { color: var(--role-cand); }

/* 右栏 AI 回答（大字流式 + 复制） */
.answer-copy {
  font-size: 11px; color: var(--role-ai); background: transparent; border: none;
  cursor: pointer; padding: 2px 8px; border-radius: 6px; font-weight: 500;
}
.answer-copy:hover:not(:disabled) { background: var(--primary-soft); }
.answer-copy:disabled { color: var(--text-3); cursor: default; }
.answer-text {
  color: var(--text); font-size: 16px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word;
}
.ans-cursor { color: var(--role-ai); animation: ans-blink 1s steps(2) infinite; }
@keyframes ans-blink { 50% { opacity: 0; } }

/* 手动输入 */
.input-row { display: flex; gap: 8px; padding: 6px 14px; }
.input-row input {
  flex: 1; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; color: var(--text); background: var(--surface);
}
.input-row input:focus { outline: none; border-color: var(--primary); }
button {
  border: none; border-radius: 8px; cursor: pointer;
  background: var(--primary-soft); color: var(--primary-strong); padding: 8px 14px;
  font-size: 13px; font-weight: 500;
}
button:hover { background: var(--primary-softer); }
button.primary { background: var(--primary); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--primary-hover); }

/* 状态栏 */
.status-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 14px; font-size: 11px; color: var(--text-2);
  background: var(--surface-3);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-3); flex: none;
}
.status-dot.ok { background: var(--primary); }
.status-dot.err { background: var(--danger); }
.status-dot.warn { background: var(--warn); }
.status-dot.info { background: var(--role-cand); }
.status-dot.busy { background: var(--text-3); }
.status-dot.done { background: var(--primary); }
.toast {
  position: fixed; left: 50%; bottom: 92px;
  transform: translateX(-50%) translateY(12px);
  background: var(--text); color: var(--surface);
  padding: 10px 18px; border-radius: 999px; font-size: 13px;
  opacity: 0; pointer-events: none; z-index: 200;
  box-shadow: var(--shadow);
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: var(--primary); color: #fff; }
.toast.err { background: var(--danger); color: #fff; }

/* 操作栏 */
.action-bar { display: flex; gap: 8px; padding: 8px 14px 12px; background: var(--surface-3); }
.action-bar button { flex: 1; }

/* 设置面板 */
.settings {
  display: none; padding: 12px 14px 16px; background: var(--surface-2);
  border-top: 1px solid var(--border); overflow-y: auto; max-height: 70vh;
}
.settings.open { display: block; }
.settings h3 {
  font-size: 13px; color: var(--primary-strong); margin: 12px 0 8px;
}
.settings h3:first-child { margin-top: 0; }
.settings label { display: block; font-size: 12px; color: var(--text-2); margin: 8px 0 4px; }
.settings input, .settings textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; color: var(--text); background: var(--surface);
  font-family: inherit;
}
.settings input:focus, .settings textarea:focus { outline: none; border-color: var(--primary); }
.settings .field-row { display: flex; gap: 10px; align-items: flex-end; }
.settings .field-row > * { flex: 1; }
.settings .field-row input.port { flex: 0 0 90px; }
.settings .field-row label { margin-top: 8px; }
.settings button { margin-top: 10px; width: 100%; }
.settings .hint {
  margin-top: 14px; font-size: 12px; color: var(--hint-text); line-height: 1.6;
  background: var(--hint-bg); border-radius: 8px; padding: 10px 12px;
}
.settings .hint strong { color: var(--hint-strong); }

/* 简历文件上传 */
.upload-zone {
  border: 1.5px dashed var(--border); border-radius: 10px; padding: 10px 12px;
  background: var(--surface); margin-bottom: 6px;
  transition: border-color .15s ease, background-color .15s ease;
}
.upload-zone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.upload-inner { display: flex; align-items: center; gap: 10px; }
.upload-inner svg { flex: none; color: var(--primary); }
.upload-text { flex: 1; min-width: 0; }
.upload-text b { display: block; font-size: 13px; color: var(--text); }
.upload-text span { display: block; font-size: 11px; color: var(--text-3); margin-top: 2px; }
.upload-btn {
  flex: none; border: none; border-radius: 8px; cursor: pointer;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 600; padding: 7px 12px;
}
.upload-btn:hover { background: var(--primary-hover); }
.upload-status { font-size: 12px; margin-top: 8px; color: var(--text-2); }
.upload-status.busy { color: var(--role-cand); }
.upload-status.ok { color: var(--role-int); }
.upload-status.err { color: var(--danger); }

@media (max-width: 640px) {
  .columns { flex-direction: column; }
  .col-chat, .col-answer { flex: 1; }
}

@media (max-width: 520px) {
  .level-row .lbl { width: 60px; }
  .settings .field-row { flex-direction: column; }
  .settings .field-row input.port { flex: 1; width: 100%; }
}

/* 激活码门禁覆盖层 */
.activation { position: fixed; inset: 0; background: rgba(12, 22, 16, 0.92); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.activation.open { display: flex; }
.activation-box { background: var(--surface); color: var(--text); border-radius: 14px; padding: 30px 28px; width: min(420px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); }
.activation-box h2 { margin: 0 0 8px; font-size: 20px; }
.activation-box .act-sub { color: var(--text-2); font-size: 13px; margin: 0 0 18px; }
.activation-box input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 11px 12px; font-size: 15px; color: var(--text); background: var(--surface); box-sizing: border-box; margin-bottom: 12px; }
.activation-box input:focus { outline: none; border-color: var(--primary); }
.activation-box .primary { width: 100%; }
.act-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 10px 0 0; }
