/* SpeakingIELTS UI system. Loaded last; builds on the brand tokens in brand-refresh.css.
   Tokens -> base type -> buttons -> surfaces -> content components -> practice tools -> navigation. */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text: #243b53;
  --soft: #f0f7f6;
  --warn-bg: #fffbea;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;
  --radius: 12px; --radius-sm: 8px;
  --tap: 48px;
  --focus: 0 0 0 3px rgba(15, 118, 110, .35);
}

/* Base typography: one readable system font, real heading weights. */
body, button, input, select, textarea, .navbar, .btn { font-family: var(--font); }
body { color: var(--text); font-size: 17px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, .heading h3 { font-family: var(--font); color: var(--ink); font-weight: 700; letter-spacing: -.02em; }
.guide-page h1, .session-state h1 { font-size: clamp(28px, 4.2vw, 42px); line-height: 1.15; margin: var(--space-2) 0 var(--space-4); }
.guide-page h2 { font-size: clamp(22px, 3vw, 28px); line-height: 1.25; margin: var(--space-7) 0 var(--space-3); }
.guide-page h3 { font-size: 19px; line-height: 1.35; margin: var(--space-5) 0 var(--space-2); }
.guide-page .lead, .lead { font-size: clamp(17px, 2vw, 19px); font-weight: 400; color: var(--muted); line-height: 1.6; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.guide-page { background: var(--paper); padding: var(--space-6) 0 var(--space-7); }
.guide-page article { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: clamp(20px, 4vw, 44px); max-width: 880px; color: var(--text); line-height: 1.7; }

/* Buttons: one primary per group, consistent height, predictable stacking on mobile. */
.primary-action, .secondary-action, .secondary-button, .text-button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap); padding: 0 22px; margin: 0; border-radius: 10px; font-weight: 700; font-size: 16px; line-height: 1.2;
  text-decoration: none !important; cursor: pointer; transition: background .15s, border-color .15s, color .15s; width: auto;
}
.primary-action { background: var(--brand); border: 1px solid var(--brand); color: #fff !important; }
.primary-action:hover, .primary-action:focus { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.secondary-action, .secondary-button { background: #fff; border: 1px solid #c3d1dc; color: var(--ink) !important; }
.secondary-action:hover, .secondary-button:hover { border-color: var(--brand); color: var(--brand) !important; }
.text-button, .text-link-button { background: none; border: 0; color: var(--brand); font-weight: 700; padding: 0 var(--space-2); min-height: var(--tap); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.primary-large { min-height: 56px; font-size: 18px; padding: 0 36px; }
.primary-action:disabled, .secondary-button:disabled { opacity: .5; cursor: not-allowed; }
.guide-cta, .hero-actions, .preflight-actions, .writing-bar, .reading-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: var(--space-5) 0; }
.guide-cta > a:not([class]) { font-weight: 700; }
@media (max-width: 600px) {
  .guide-cta, .hero-actions, .preflight-actions { flex-direction: column; align-items: stretch; }
  .guide-cta .primary-action, .guide-cta .secondary-action, .guide-cta .secondary-button, .hero-actions .primary-action, .hero-actions .secondary-action, .preflight-actions .primary-action { width: 100%; }
  .guide-cta .text-button, .guide-cta > a:not([class]) { align-self: center; }
}

/* Surfaces: cards and callouts share one shape. */
.topic-block, .progress-widget, .listening-drill, .resume-panel, .daily-card, .mode-card, .dos-donts > div, .review-row {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4) var(--space-5);
}
.topic-block { margin: var(--space-3) 0; }
.topic-block h3, .topic-block h4 { margin-top: 0; }
.cue-box, .writing-prompt, .sample-answer, .question-of-day {
  border-radius: var(--radius); padding: var(--space-4) var(--space-5); margin: var(--space-4) 0; border: 1px solid;
}
.cue-box, .writing-prompt { background: var(--warn-bg); border-color: #f3dc8f; }
.sample-answer { background: var(--soft); border-color: #b9dcd6; }
.question-of-day { background: var(--soft); border-color: #b9dcd6; font-style: normal; font-weight: 600; }
.cue-box p:last-child, .sample-answer p:last-child { margin-bottom: 0; }
.sample-note { font-size: 14px; color: var(--muted); }
.daily-card { background: var(--soft); border-color: #b9dcd6; }
.mode-card.featured h3, .mode-card.featured strong, .mode-card.featured p, .mode-card.featured span { color: #fff !important; }

/* Content components. */
.breadcrumbs { font-size: 14px; color: var(--muted); margin-bottom: var(--space-3); }
.breadcrumbs a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.guide-toc { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); background: none; padding: 0; margin: var(--space-5) 0; }
.guide-toc strong { font-size: 14px; color: var(--muted); margin-right: var(--space-1); }
.guide-toc a { margin: 0; display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; }
.guide-toc a:hover { border-color: var(--brand); color: var(--brand); }
@media (max-width: 600px) { .guide-toc { flex-wrap: nowrap; overflow-x: auto; padding-bottom: var(--space-2); -webkit-overflow-scrolling: touch; } .guide-toc a { flex: none; } }
.guide-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: var(--space-4) 0; font-size: 15px; }
.guide-table th, .guide-table td { border: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; text-align: left; vertical-align: top; }
.guide-table tr:last-child td { border-bottom: 0; }
.guide-table th { background: var(--paper); color: var(--ink); font-weight: 700; }
@media (max-width: 600px) { .guide-table { display: block; overflow-x: auto; } }
.guide-faq details { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 var(--space-4); margin: var(--space-2) 0; background: var(--card); }
.guide-faq summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 700; cursor: pointer; list-style: none; }
.guide-faq summary::after { content: "+"; margin-left: auto; font-size: 22px; color: var(--brand); }
.guide-faq details[open] summary::after { content: "\2212"; }
.guide-faq summary::-webkit-details-marker { display: none; }
.guide-related { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--line); }
.guide-related ul { columns: 2; padding-left: 20px; }
.phrase-list { columns: 2; }
.cue-pager a { font-weight: 600; }
@media (max-width: 600px) { .guide-related ul, .phrase-list { columns: 1; } }

/* Sticky practise button: mobile only, compact, never covers the footer text. */
@media (max-width: 767px) {
  .sticky-practice { left: 16px; right: 16px; bottom: 16px; border-radius: 999px; padding: 14px 20px; font-size: 16px; background: var(--brand); }
  body:has(.sticky-practice) footer { padding-bottom: 72px; }
}

/* Practice tools: writing, reading, drill. */
.writing-timer { font-size: 26px; font-weight: 800; color: var(--ink); min-width: 84px; font-variant-numeric: tabular-nums; }
.word-count { font-weight: 700; font-size: 15px; }
#writing-text, #drill-answer, .listening-drill select, .test-date-form input, .ready-settings select { border: 1px solid #b8c7d3; border-radius: var(--radius-sm); font-family: var(--font); }
#writing-text { font-family: Georgia, "Times New Roman", serif; font-size: 18px; padding: var(--space-4); }
#writing-text:focus, #drill-answer:focus { border-color: var(--brand); box-shadow: var(--focus); outline: none; }
.reading-bar { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .96); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin: var(--space-4) 0; backdrop-filter: blur(4px); }
.reading-passage { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4) var(--space-5); font-size: 16.5px; }
.reading-question select, .reading-question input { min-height: 44px; }
.model-answer summary { min-height: var(--tap); display: flex; align-items: center; }

/* Speaking session screens. */
.session-state h1 { margin-top: var(--space-2); }
.ready-card { max-width: 640px; margin: 0 auto; text-align: left; }
.ready-steps { counter-reset: step; list-style: none; padding: 0; margin: var(--space-5) 0; }
.ready-steps li { counter-increment: step; position: relative; padding: var(--space-2) 0 var(--space-2) 44px; font-size: 17px; }
.ready-steps li::before { content: counter(step); position: absolute; left: 0; top: 6px; width: 30px; height: 30px; border-radius: 50%; background: var(--soft); color: var(--brand); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.ready-privacy { font-size: 14px; color: var(--muted); margin-top: calc(-1 * var(--space-2)); }
.ready-settings { margin-top: var(--space-5); border-top: 1px solid var(--line); padding-top: var(--space-3); }
.ready-settings summary { cursor: pointer; font-weight: 700; color: var(--muted); min-height: 40px; display: flex; align-items: center; }
.ready-settings select { display: block; margin: var(--space-2) 0 var(--space-3); min-height: 44px; padding: 0 var(--space-3); max-width: 100%; }
.control-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); width: 100%; }
.session-controls .primary-action { width: 100%; min-height: 56px; font-size: 18px; }
.session-controls .text-link-button { align-self: center; font-size: 15px; color: var(--muted); }
.session-notice { background: var(--warn-bg); border: 1px solid #f3dc8f; border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); font-size: 14px; }
.summary-recordings { margin: var(--space-5) 0; }
.summary-recordings h2 { font-size: 22px; margin-bottom: var(--space-3); }
.review-row { margin: var(--space-2) 0; display: grid; gap: var(--space-2); }
.review-question { margin: 0; font-weight: 600; }
.review-row audio { width: 100%; }
.focus-chips { border: 0; padding: 0; margin: var(--space-5) 0; }
.focus-chips legend { font-size: 16px; font-weight: 700; border: 0; margin-bottom: var(--space-2); }
.focus-chips label { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-4); margin: 0 var(--space-2) var(--space-2) 0; border: 1px solid var(--line); border-radius: 999px; font-weight: 600; cursor: pointer; }
.focus-chips input { margin: 0; }
.focus-chips label:has(input:checked) { border-color: var(--brand); background: var(--soft); color: var(--brand); }
.summary-note { color: var(--muted); font-size: 15px; }

/* Navigation: fewer items, one clear call to action. */
.speaking-nav .navbar-nav > li > a { text-transform: none; letter-spacing: 0; font-size: 15px; font-weight: 600; padding-left: 12px; padding-right: 12px; }
.speaking-nav .navbar-nav > li.nav-cta > a { background: var(--brand); color: #fff !important; border-radius: 999px; margin-left: var(--space-2); padding-left: 18px; padding-right: 18px; }
.speaking-nav .navbar-nav > li.nav-cta > a:hover { background: var(--brand-dark); }
@media (min-width: 768px) { .speaking-nav .navbar-nav > li.nav-cta > a { margin-top: 8px; margin-bottom: 8px; padding-top: 10px; padding-bottom: 10px; } }
@media (max-width: 767px) { .speaking-nav .navbar-nav > li.nav-cta > a { margin: var(--space-2) 15px; text-align: center; } }
footer .footer-links a { margin-right: var(--space-3); white-space: nowrap; }

/* Overrides for legacy theme rules (style.css) that forced uppercase nav and thin body text. */
.navbar-custom.speaking-nav ul.nav li a, .speaking-nav .navbar-nav > li > a { text-transform: none !important; letter-spacing: 0 !important; }
@media (min-width: 768px) { .speaking-nav .navbar-nav > li > a { padding-top: 18px; padding-bottom: 18px; line-height: 20px; } .speaking-nav .navbar-nav > li.nav-cta > a { padding-top: 10px; padding-bottom: 10px; margin-top: 8px; } }
body p, body li, body td, body dd, body label, .lead { font-weight: 400; }
.writing-bar { justify-content: space-between; }
.writing-bar .primary-action { margin-left: auto; }
.writing-finish { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-3); }
.writing-finish .sample-note { margin: 0; }
@media (max-width: 600px) { .writing-bar .primary-action, .writing-finish .primary-action { width: 100%; margin-left: 0; } }
@media (max-width: 767px) { .speaking-nav .navbar-nav > li:not(.nav-cta) > a { font-size: 17px; color: var(--ink) !important; padding-top: 14px; padding-bottom: 14px; } }

/* Virtual examiner: still portrait with stacked looping clips that fade in per state. */
.examiner-media { position: relative; overflow: hidden; border-radius: 14px; background: #e7eef3; aspect-ratio: 4 / 5; flex: none; }
.examiner-media img, .examiner-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.examiner-media video { opacity: 0; transition: opacity .25s ease; }
.examiner-media video.is-active { opacity: 1; }
.examiner-media[data-state="speaking"] { box-shadow: 0 0 0 3px var(--brand); }
.active-examiner { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-4); }
.active-examiner .examiner-media { width: 132px; }
.active-examiner span { display: flex; flex-direction: column; }
@media (max-width: 600px) { .active-examiner .examiner-media { width: 104px; } }
.examiner-card .examiner-hero { width: 100%; max-width: 300px; margin: 0 auto var(--space-3); }
.examiner-card { text-align: center; }
@media (prefers-reduced-motion: reduce) { .examiner-media video { display: none; } }

/* Session on phones: examiner and question first; timer and actions pinned to the bottom of the screen. */
@media (max-width: 767px) {
  .session-controls { order: 0 !important; position: sticky; bottom: 0; z-index: 40; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 24px rgba(16, 42, 67, .12); display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; margin: 0 -15px; }
  .session-controls .phase-label { grid-column: 1; font-size: 12px; }
  .session-controls .session-timer { grid-column: 1; font-size: 30px; line-height: 1; }
  .session-controls .timer-progress { grid-column: 1 / -1; }
  .session-controls #timer-guidance, .session-controls .recording-indicator { display: none !important; }
  .session-controls .primary-action { grid-column: 2; grid-row: 1 / span 2; margin: 0; min-height: 52px; font-size: 17px; }
  .session-controls .control-row { grid-column: 1 / -1; }
  .session-controls .control-row button { min-height: 42px; margin: 0; font-size: 14px; }
  .session-controls .text-link-button { grid-column: 1 / -1; min-height: 32px; }
  .question-display { font-size: 21px; line-height: 1.4; }
}
.question-display { font-weight: 500; color: var(--ink); }
