:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede6;
  --text: #1f2328;
  --muted: #5f6670;
  --line: #dcd9d0;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --accent-soft: #dcefe8;
  --me: #1f6f5c;
  --me-ink: #ffffff;
  --warn-bg: #fff4d6;
  --warn-line: #e0b84a;
  --warn-ink: #5b4300;
  --danger-bg: #fde4e1;
  --danger-line: #d9645a;
  --danger-ink: #6b1a14;
  --ok: #1f7a3d;
  --bad: #b3261e;
  --radius: 12px;
  --font: "Noto Sans Bengali", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181b;
    --surface: #1d2125;
    --surface-2: #262b30;
    --text: #e6e8ea;
    --muted: #a0a7af;
    --line: #343a40;
    --accent: #4fb89a;
    --accent-ink: #0d1f1a;
    --accent-soft: #1f3a33;
    --me: #2f7f69;
    --me-ink: #ffffff;
    --warn-bg: #3a3016;
    --warn-line: #b8922f;
    --warn-ink: #f3dc9b;
    --danger-bg: #3d1d1a;
    --danger-line: #c25a50;
    --danger-ink: #f6c4bf;
    --ok: #63c487;
    --bad: #f08a82;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.55; }
.hidden { display: none !important; }
.wrap { max-width: 980px; margin: 0 auto; padding: 20px 16px 48px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
header.top h1 { font-size: 20px; margin: 0; }
header.top .sub { color: var(--muted); font-size: 14px; }
a { color: var(--accent); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 17px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.notice { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; margin-bottom: 16px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.ok .dot { background: var(--ok); }
.pill.bad .dot { background: var(--bad); }
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px;
}
textarea { resize: none; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 9px 16px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--bad); }
button:disabled { opacity: .55; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.choices { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.choices label { border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-size: 14px; background: var(--surface); }
.choices input { margin-right: 6px; }
/* answer key grid */
.keygrid { display: grid; gap: 10px; }
.keyrow { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.keyrow .q { font-size: 14px; }
.keyrow .q code { color: var(--muted); font-size: 12px; margin-right: 6px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.seg label { text-align: center; font-size: 13px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { font-weight: 700; }
.seg label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
/* chat */
.chat-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .chat-layout.with-side { grid-template-columns: minmax(0, 1fr) 300px; } }
.chat { display: flex; flex-direction: column; height: calc(100vh - 140px); min-height: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.msgs { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.interviewer { background: var(--surface-2); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.participant { background: var(--me); color: var(--me-ink); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.system { align-self: stretch; max-width: 100%; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.msg.system.stop { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); font-weight: 600; }
.msg .meta { display: block; font-size: 11px; opacity: .7; margin-top: 3px; }
.typing { align-self: flex-start; color: var(--muted); font-size: 14px; padding: 4px 6px; }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; min-height: 44px; max-height: 140px; }
.error-bar { background: var(--danger-bg); color: var(--danger-ink); border-top: 1px solid var(--danger-line); padding: 8px 14px; font-size: 14px; }
.side .card { position: sticky; top: 12px; }
.side table { width: 100%; font-size: 13px; border-collapse: collapse; }
.side td { padding: 3px 0; border-bottom: 1px solid var(--line); }
.side td:last-child { text-align: right; }
/* result */
.scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.score-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.score-card .label { font-size: 13px; color: var(--muted); }
.score-card .big { font-size: 34px; font-weight: 700; line-height: 1.1; }
.score-card .big small { font-size: 16px; color: var(--muted); font-weight: 400; }
.banner { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; font-size: 15px; }
.banner.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.banner.danger { background: var(--danger-bg); border: 1px solid var(--danger-line); color: var(--danger-ink); }
.table-wrap { overflow-x: auto; }
table.items { width: 100%; border-collapse: collapse; font-size: 14px; }
table.items th, table.items td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.items th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
table.items td.ev { color: var(--muted); font-size: 13px; max-width: 280px; }
td.match-yes { color: var(--ok); font-weight: 700; }
td.match-no { color: var(--bad); font-weight: 700; }
.insuff { color: var(--warn-ink); background: var(--warn-bg); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.stats b { font-size: 18px; display: block; }
details summary { cursor: pointer; font-weight: 600; }
.stars { display: flex; gap: 6px; margin-bottom: 10px; }
.stars label { border: 1px solid var(--line); border-radius: 6px; padding: 4px 12px; cursor: pointer; }
.stars label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.stars input { position: absolute; opacity: 0; pointer-events: none; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
@media (max-width: 600px) {
  .msg { max-width: 92%; }
  .chat { height: calc(100vh - 110px); }
  .score-card .big { font-size: 28px; }
}
