:root {
  --bg: #f4f4f6;
  --panel: #ffffff;
  --line: #e6e6eb;
  --line-strong: #d3d3db;
  --text: #1c1c1e;
  --muted: #86868b;
  --accent: #0a6cff;
  --accent-weak: #eef4ff;
  --hover: #f7f7f9;
  --warn-bg: #fdf0e8;
  --warn-fg: #b7440a;
  --ok: #0f8a5f;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f11;
    --panel: #17171a;
    --line: #2a2a2e;
    --line-strong: #3a3a40;
    --text: #f2f2f4;
    --muted: #8e8e93;
    --accent: #5b9dff;
    --accent-weak: #14243a;
    --hover: #1d1d21;
    --warn-bg: #2a1a12;
    --warn-fg: #ffab7b;
    --ok: #3ecf8e;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }



.bar {
  flex: 0 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.bar-left { display: flex; align-items: center; gap: 8px; }

.logo {
  width: 22px; height: 22px;
  flex: 0 0 auto;
  border-radius: 6px;
  user-select: none;
  -webkit-user-drag: none;
}
.bar-mid { display: flex; align-items: center; gap: 8px; margin-left: 12px; }
.bar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line-strong);
  transition: background 0.2s;
}
.dot.on { background: #34c759; box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.16); }
.dot.err { background: #ff3b30; box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.16); }

.brand { font-size: 14px; font-weight: 600; letter-spacing: 0.2px; }
.status { font-size: 12.5px; color: var(--muted); }
.timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-left: 2px;
}

.field {
  width: 190px; height: 30px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}
.field:focus { border-color: var(--accent); background: var(--panel); }

.btn {
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: 0.15s;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary.on { background: #ff3b30; }
.btn.ghost {
  background: var(--panel);
  color: var(--text);
  border-color: var(--line);
}
.btn.ghost:hover:not(:disabled) { border-color: var(--line-strong); background: var(--hover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.small { height: 28px; padding: 0 12px; font-size: 12.5px; }
.btn:active:not(:disabled) { transform: translateY(0.5px); }

.chip-btn {
  height: 30px; padding: 0 11px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.chip-btn:hover { color: var(--text); border-color: var(--line-strong); }
.chip-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-weak); }



.jd-panel {
  flex: 0 0 auto;
  padding: 12px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.jd-panel textarea {
  width: 100%;
  resize: vertical;
  min-height: 64px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.jd-panel textarea:focus { border-color: var(--accent); }
.jd-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.jd-foot .hint { font-size: 12px; color: var(--muted); }


.profile-out {
  margin: 10px 0 0;
  padding: 10px 12px;
  max-height: 180px;
  overflow-y: auto;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.banner {
  flex: 0 0 auto;
  padding: 9px 16px;
  font-size: 12.5px;
  color: var(--warn-fg);
  background: var(--warn-bg);
  border-bottom: 1px solid var(--line);
  line-height: 1.7;
}


.banner code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.16);
  word-break: break-all;
  user-select: all;
}


.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(92vw, 560px);
  padding: 9px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #fff;
  background: rgba(28, 28, 30, 0.92);
  border-radius: 10px;
  word-break: break-word;
  pointer-events: none;
}
@media (prefers-color-scheme: dark) {
  .toast { color: #1c1c1e; background: rgba(240, 240, 245, 0.94); }
}


.panes {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 12px;
  padding: 12px;
}

.pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.pane-head {
  flex: 0 0 auto;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}
.pane-head h2 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.count {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
  border-radius: 20px;
  padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}
.hint { margin-left: auto; font-size: 12px; color: var(--muted); }

.link {
  margin-left: auto;
  padding: 0;
  font-size: 12.5px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
}
.link:disabled { color: var(--muted); opacity: 0.5; cursor: not-allowed; }


.seg {
  display: flex;
  flex: 0 0 auto;      
  margin-left: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.seg button {
  height: 24px;
  padding: 0 9px;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--panel);
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--text); }
.seg button.active {
  color: #fff;                  
  background: var(--accent);
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  
  .seg button.active {
    color: var(--accent);
    background: var(--accent-weak);
    box-shadow: inset 0 0 0 1px var(--accent);
  }
}


.q-add {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.q-add input {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}
.q-add input:focus { border-color: var(--accent); background: var(--panel); }
.q-add input:disabled { opacity: 0.45; cursor: not-allowed; }
.q-add .btn { flex: 0 0 auto; }

.scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 14px 24px;
}

.scroll::-webkit-scrollbar { width: 10px; }
.scroll::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 10px;
  border: 3px solid var(--panel);
}
.scroll::-webkit-scrollbar-track { background: transparent; }

.empty {
  padding: 56px 12px;
  text-align: center;
  color: var(--muted);
}
.empty p { margin: 0 0 6px; font-size: 13.5px; }
.empty .sub { font-size: 12.5px; opacity: 0.75; }



#lines { display: block; }

.line {
  display: grid;
  grid-template-columns: 46px 1fr 20px;
  gap: 8px;
  align-items: start;
  padding: 5px 6px;
  border-radius: 8px;
  cursor: pointer;
}
.line:hover { background: var(--hover); }
.line .t {
  padding-top: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.line .txt {
  font-size: 14.5px;
  line-height: 1.72;
  word-break: break-word;
}
.line .mark {
  margin-top: 4px;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: 0.15s;
}

.line.q-hint { background: var(--accent-weak); box-shadow: inset 3px 0 0 var(--accent); }
.line.q-hint .mark { opacity: 1; color: var(--accent); border-color: var(--accent); }
.line:hover .mark { opacity: 1; }
.line .mark:hover { color: var(--accent); border-color: var(--accent); }
.line .mark.done { opacity: 1; color: var(--ok); border-color: var(--ok); cursor: default; }

.live {
  padding: 6px 6px 6px 60px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--muted);
}



.q {
  margin-bottom: 10px;
  padding: 11px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.q:hover { border-color: var(--line-strong); }
.q.open { border-color: var(--accent); background: var(--panel); }
.q.from-candidate { opacity: 0.72; }

.q-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
}
.q-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}
.tag {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.tag.diff-mid { color: var(--accent); background: var(--accent-weak); }
.tag.diff-senior { color: #8a4bff; background: rgba(138, 75, 255, 0.1); }
.tag.diff-junior { color: var(--muted); }
.tag.ask { color: var(--warn-fg); background: var(--warn-bg); }

.q-tools { margin-left: auto; display: flex; gap: 4px; }
.q-tools button {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  opacity: 0;
}
.q:hover .q-tools button { opacity: 1; }
.q-tools button:hover { color: var(--text); background: var(--bg); }

#questions.locked .q-tools [data-act="edit"],
#questions.locked [data-act="regen"],
#questions.locked .gen-now { display: none; }

.q-text {
  margin: 6px 0 0;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.55;
  cursor: pointer;
  word-break: break-word;
}


.q-edit { margin-top: 8px; cursor: default; }
.q-edit textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 16px;         
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  resize: vertical;
}
.q-edit textarea:focus { outline: none; border-color: var(--accent); }
.q-edit-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.q-edit-foot .hint { margin-right: auto; font-size: 12px; color: var(--muted); }
.q-edit-cancel {
  padding: 0 2px;
  font-size: 12.5px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
}
.q-edit-cancel:hover { color: var(--text); }

.q-body {
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
  cursor: default;
}

.answer {
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.82;
  word-break: break-word;
}
.answer .sec {
  color: var(--accent);
  font-weight: 600;
}
.answer .err { color: var(--warn-fg); }
.answer .caret {
  display: inline-block;
  width: 6px; height: 13px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

.answer .answer-blank {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}
.answer .answer-blank button {
  margin-left: 8px;
  padding: 0;
  font-size: 12.5px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
}
.answer .answer-blank button:hover { text-decoration: underline; }

.q-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.q-foot button {
  padding: 0;
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
}
.q-foot button:hover { text-decoration: underline; }
.q-mode { color: var(--muted); opacity: 0.8; }
.q-state { margin-left: auto; font-variant-numeric: tabular-nums; }
.q.busy .q-state { color: var(--accent); }



.site-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 7px 14px calc(7px + env(safe-area-inset-bottom, 0px));
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  background: var(--panel);
  border-top: 1px solid var(--line);
}



@media (max-width: 900px) {
  body { height: auto; min-height: 100dvh; }
  .bar { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 8px; }
  .bar-mid { margin-left: 0; }
  .field { width: 150px; }
  .panes { grid-template-columns: 1fr; padding: 10px; }
  .pane { max-height: 62vh; }
  .scroll { padding-bottom: 40px; }

  
  .pane-head {
    height: auto;
    flex-wrap: wrap;
    padding: 9px 12px;
    row-gap: 9px;
  }
  .seg {
    order: 3;
    flex: 1 1 100%;
    margin-left: 0;
  }
  .seg button {
    flex: 1 1 0;
    height: 32px;
    font-size: 12.5px;
  }
}


@media (hover: none) {
  .line .mark, .q-tools button { opacity: 1; }
}
