/* IELTS CBT Test Player — layout & branding (uses tokens from styles.css) */
body.cbt { margin: 0; background: var(--canvas); font-family: var(--font-sans); color: var(--ink-900); overflow: hidden; }
.cbt-app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* top bar */
.cbt-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); background: var(--navy-900); color: #fff; padding: var(--sp-2) var(--sp-4); }
.cbt-bar__title { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cbt-bar__candidate { font-weight: 400; opacity: 0.8; }
.cbt-bar__right { display: flex; align-items: center; gap: var(--sp-3); }
.cbt-bar__clock { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700; background: var(--navy-800); padding: 2px 12px; border-radius: var(--radius-sm); letter-spacing: 1px; }
.cbt-bar__clock.is-warning { background: var(--accent-amber); color: var(--navy-900); }
.cbt-alert { background: var(--accent-amber-soft); color: var(--navy-900); border-bottom: 2px solid var(--accent-amber); text-align: center; font-weight: 700; padding: var(--sp-2); }

/* buttons */
.cbt-btn { border: 0; border-radius: var(--radius-sm); padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.cbt-btn--primary { background: var(--blue-600); color: #fff; }
.cbt-btn--primary:hover { background: var(--blue-500); }
.cbt-btn--green { background: var(--accent-green); color: #fff; }
.cbt-btn--ghost { background: transparent; color: inherit; border: 1px solid currentColor; opacity: 0.85; }
.cbt-btn--big { padding: 10px 28px; font-size: 1.05rem; }
.cbt-btn:disabled { opacity: 0.55; cursor: default; }

/* split panes */
.cbt-main { flex: 1; display: flex; min-height: 0; font-size: 1rem; }
.cbt-pane { flex: 1 1 50%; overflow-y: auto; padding: var(--sp-5); min-width: 0; }
.cbt-pane--passage { border-right: 3px solid var(--ink-300); background: var(--paper); }
.cbt-pane--questions { background: var(--blue-50); }
.cbt-passage-head { color: var(--ink-500); font-size: 0.85rem; margin-bottom: var(--sp-3); }
.cbt-passage { line-height: 1.75; max-width: 70ch; }
.cbt-passage h4 { font-size: 1.2rem; margin: 0 0 var(--sp-3); color: var(--navy-800); }
.cbt-passage .para-label { font-weight: 700; color: var(--blue-700, var(--blue-600)); margin-right: 6px; }
.cbt-hl { background: #fff3a3; cursor: pointer; }
.cbt-scan img { width: 100%; display: block; margin-bottom: var(--sp-3); border: 1px solid var(--ink-200); }
.cbt-scan__pdf { width: 100%; height: 80vh; border: 1px solid var(--ink-200); }

/* questions */
.cbt-group { background: var(--paper); border: 1px solid var(--ink-200); border-radius: var(--radius); padding: var(--sp-4); margin-bottom: var(--sp-5); box-shadow: var(--shadow-sm); }
.cbt-group__title { margin: 0 0 var(--sp-2); font-size: 1rem; color: var(--navy-800); }
.cbt-group__intro { margin: 0 0 var(--sp-3); color: var(--ink-700); font-size: 0.92rem; }
.cbt-q { padding: var(--sp-3); border-radius: var(--radius-sm); margin-bottom: var(--sp-2); }
.cbt-q.is-jump { background: var(--accent-amber-soft); transition: background 0.4s; }
.cbt-q__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.cbt-q__num { font-weight: 800; color: var(--blue-600); }
.cbt-flag { font-size: 0.8rem; color: var(--ink-500); user-select: none; cursor: pointer; }
.cbt-choice { display: block; margin: 4px 0; cursor: pointer; }
.cbt-input { font: inherit; padding: 4px 8px; border: 1px solid var(--ink-300); border-radius: var(--radius-sm); }
.cbt-input:focus { outline: 2px solid var(--blue-500); }
.cbt-input.is-missing { outline: 2px solid var(--accent-red); }
.cbt-gapbox { background: var(--paper); border: 1px solid var(--ink-300); border-radius: var(--radius-sm); padding: var(--sp-4); line-height: 2.1; }
.cbt-gap { white-space: nowrap; }
.cbt-listbox { margin-top: var(--sp-3); padding: var(--sp-3); background: var(--ink-100); border-radius: var(--radius-sm); columns: 2; column-gap: var(--sp-5); font-size: 0.95rem; }

/* palette */
.cbt-palette { display: flex; gap: var(--sp-4); align-items: center; overflow-x: auto; background: var(--navy-900); padding: var(--sp-2) var(--sp-3); }
.cbt-palette__seg { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: var(--radius-sm); }
.cbt-palette__seg.is-current { background: var(--navy-800); }
.cbt-palette__label { color: rgba(255,255,255,.6); font-size: 0.72rem; font-weight: 700; margin-right: 4px; white-space: nowrap; }
.cbt-num { width: 30px; height: 30px; border-radius: 4px; border: 1px solid rgba(255,255,255,.25); background: transparent; color: rgba(255,255,255,.85); font-weight: 700; cursor: pointer; flex: 0 0 auto; }
.cbt-num.is-answered { background: var(--blue-500); border-color: var(--blue-500); color: #fff; }
.cbt-num.is-flagged { box-shadow: 0 0 0 2px var(--accent-amber); }
.cbt-num:hover { border-color: #fff; }

/* overlay (start / review) */
.cbt-overlay { position: fixed; inset: 0; background: rgba(42, 14, 69, 0.72); display: none; align-items: center; justify-content: center; z-index: 50; padding: var(--sp-4); }
.cbt-card { background: var(--paper); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: var(--sp-6); max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; }
.cbt-card--wide { max-width: 820px; }
.cbt-card h2 { margin-top: 0; color: var(--navy-900); }
.cbt-card__rules { padding-left: 1.2em; line-height: 1.7; }
.cbt-card__btns { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-4); }
.cbt-warn { color: var(--accent-amber); font-weight: 700; }
.cbt-score { font-size: 1.2rem; background: var(--blue-50); padding: var(--sp-3); border-radius: var(--radius-sm); }

/* review grid */
.cbt-review { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin: var(--sp-3) 0; }
.cbt-review__cell { border: 1px solid var(--ink-200); border-radius: 4px; padding: 4px 6px; font-size: 0.85rem; background: var(--ink-100); word-break: break-word; }
.cbt-review__cell span { font-weight: 800; color: var(--blue-600); margin-right: 6px; }
.cbt-review__cell.is-blank { background: var(--accent-amber-soft); }
.cbt-review__cell.is-right { background: var(--accent-green-soft); border-color: var(--accent-green); }
.cbt-review__cell.is-wrong { background: var(--accent-red-soft); border-color: var(--accent-red); }
.cbt-review__key { display: block; color: var(--accent-green); font-style: normal; font-weight: 700; font-size: 0.78rem; }

/* stacked panes on small screens */
@media (max-width: 820px) {
  .cbt-main { flex-direction: column; }
  .cbt-pane--passage { border-right: 0; border-bottom: 3px solid var(--ink-300); max-height: 45vh; }
}

/* ===== Listening player additions ===== */
.cbt-pane--audio { background: var(--navy-900); color: rgba(255,255,255,.9); }
.cbt-pane--audio .cbt-passage-head { color: rgba(255,255,255,.6); }
.cbt-audio-panel { background: var(--navy-800); color: rgba(255,255,255,.92); border: 1px solid rgba(255,255,255,.16); border-radius: var(--radius); padding: var(--sp-5); margin-top: var(--sp-4); }
.cbt-audio-status { font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 10px; margin-bottom: var(--sp-3); }
.cbt-audio-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ink-500); display: inline-block; }
.cbt-audio-dot.is-live { background: var(--accent-red); animation: cbt-pulse 1.2s infinite; }
.cbt-audio-dot.is-done { background: var(--accent-green); }
@keyframes cbt-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.cbt-audio-note { color: rgba(255,255,255,.78); line-height: 1.6; font-size: 0.95rem; }
.cbt-audio-context { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid rgba(255,255,255,.16); color: rgba(255,255,255,.85); line-height: 1.6; }
.cbt-bar__clock.is-audio { background: var(--accent-red); color: #fff; }
.cbt-bar__clock.is-check { background: var(--blue-600); color: #fff; }

/* Practice-estimate disclaimer under the Reading score (v9.13) */
.cbt-score__note {
  margin-top: .35rem;
  font-size: .8rem;
  line-height: 1.4;
  color: #5b6472;
  font-style: italic;
  max-width: 60ch;
}
