/* ==========================================================================
   Real-Life English Coach — Highlands Forward

   Design notes
   ------------
   The logo sets the palette: Highlands Blue, Forward Gold, Highlands Navy over
   white. The one structural device used throughout is a SPEAKER EDGE — a thick
   rule on the leading edge of every utterance, echoing the rule between
   HIGHLANDS and FORWARD in the mark. The edge carries information rather than
   decoration: navy means the other person is speaking, gold means you are.

   Surfaces are a cool blue-grey mixed from Highlands Blue, not a neutral grey,
   so white cards read as lit rather than merely lighter.

   Conversation text is set larger than UI text throughout, because students read
   it aloud.
   ========================================================================== */

:root {
  /* Brand */
  --blue: #007DCE;
  --gold: #F4B517;
  --navy: #163F6D;

  --blue-deep: #0064a8;
  --blue-wash: #E3F0FA;
  --gold-wash: #FDF3DA;
  --navy-soft: #2C5686;

  /* Surfaces */
  --bg: #EDF3F8;
  --surface: #FFFFFF;
  --surface-2: #F6FAFD;
  --line: #D3E0EC;
  --line-strong: #B4C8DA;

  /* Text */
  --text: #16293D;
  --text-muted: #4E6579;
  --text-faint: #6F8497;
  --on-dark: #FFFFFF;

  /* Status */
  --ok: #1C7A4D;
  --ok-wash: #E3F4EB;
  --warn: #8A5A00;
  --warn-wash: #FDF3DA;
  --danger: #A32626;
  --danger-wash: #FBE9E9;

  /* Type */
  --font-head: 'Montserrat', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.5rem;
  --step-3: 2rem;
  --step-4: clamp(2.1rem, 5.5vw, 3.05rem);

  /* Space */
  --s1: 0.375rem;
  --s2: 0.75rem;
  --s3: 1.125rem;
  --s4: 1.75rem;
  --s5: 2.75rem;
  --s6: 4rem;

  --radius: 10px;
  --radius-lg: 16px;
  --edge: 5px;

  --shadow-card: 0 1px 2px rgba(22, 63, 109, 0.06), 0 6px 20px rgba(22, 63, 109, 0.07);
  --shadow-lift: 0 2px 6px rgba(22, 63, 109, 0.10), 0 14px 34px rgba(22, 63, 109, 0.12);

  --measure: 68ch;
  --wrap: 46rem;
}

[data-theme='dark'] {
  --bg: #0B1E33;
  --surface: #12314F;
  --surface-2: #16395B;
  --line: #245179;
  --line-strong: #34689A;

  --text: #EAF2F9;
  --text-muted: #B0C7DA;
  --text-faint: #8FAAC2;

  --blue: #4BA9E8;
  --blue-deep: #6FBDF0;
  --blue-wash: #16395B;
  --gold: #F7C441;
  --gold-wash: #3A2F12;
  --navy: #CFE1F1;
  --navy-soft: #A9C6E0;

  --ok: #6FD3A2;
  --ok-wash: #123A2A;
  --warn: #F2C463;
  --warn-wash: #3A2F12;
  --danger: #F09292;
  --danger-wash: #3E1B1B;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.32);
  --shadow-lift: 0 2px 8px rgba(0, 0, 0, 0.36), 0 16px 38px rgba(0, 0, 0, 0.42);
}

/* ---------------------------------------------------------------- reset */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: var(--font-head);
  color: var(--navy);
  line-height: 1.18;
  letter-spacing: -0.012em;
  margin: 0 0 var(--s2);
  text-wrap: balance;
}

h1 { font-size: var(--step-3); font-weight: 700; }
h2 { font-size: var(--step-2); font-weight: 700; }
h3 { font-size: var(--step-1); font-weight: 600; }

p { margin: 0 0 var(--s3); max-width: var(--measure); }

a { color: var(--blue-deep); }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--s3); top: -100px;
  background: var(--navy); color: #fff; padding: var(--s2) var(--s3);
  border-radius: var(--radius); z-index: 100; font-weight: 600;
}
.skip-link:focus { top: var(--s3); }

/* ------------------------------------------------------------- structure */

.shell { flex: 1; display: flex; flex-direction: column; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--s3);
}
.wrap--wide { max-width: 64rem; }

.masthead {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.masthead__inner {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 68px; padding-block: var(--s2);
}
.masthead__logo { display: flex; align-items: center; gap: var(--s2); text-decoration: none; margin-inline-end: auto; }
.masthead__logo img { height: 38px; width: auto; display: block; }
.masthead__product {
  font-family: var(--font-head); font-weight: 600; font-size: var(--step--1);
  color: var(--text-muted); border-inline-start: 2px solid var(--line-strong);
  padding-inline-start: var(--s2); line-height: 1.25; max-width: 11rem;
}
@media (max-width: 30rem) { .masthead__product { display: none; } }

.page { padding-block: var(--s4) var(--s5); flex: 1; }

.sitefoot {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-block: var(--s3);
  font-size: var(--step--1);
  color: var(--text-faint);
}
.sitefoot p { margin: 0; max-width: none; }
.sitefoot__brand { font-family: var(--font-head); font-weight: 600; color: var(--navy-soft); }

/* --------------------------------------------------------------- buttons */

.btn {
  font: inherit; font-family: var(--font-head); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s2); min-height: 50px; padding: var(--s2) var(--s4);
  border-radius: var(--radius); border: 2px solid transparent;
  background: var(--blue); color: #fff; cursor: pointer;
  text-decoration: none; text-align: center;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--blue-deep); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--quiet {
  background: var(--surface); color: var(--navy); border-color: var(--line-strong);
}
.btn--quiet:hover { background: var(--surface-2); border-color: var(--blue); }

.btn--plain {
  background: transparent; color: var(--blue-deep); border-color: transparent;
  min-height: 40px; padding-inline: var(--s2);
}
.btn--plain:hover { background: var(--blue-wash); }

.btn--gold { background: var(--gold); color: #3A2A00; }
.btn--gold:hover { background: #E0A50F; }

.btn--wide { width: 100%; }
.btn--small { min-height: 40px; font-size: var(--step--1); padding-inline: var(--s3); }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s3);
  box-shadow: var(--shadow-card);
}

/* The speaker/category edge. One device, used consistently. */
.edged { border-inline-start: var(--edge) solid var(--line-strong); }
.edged--blue { border-inline-start-color: var(--blue); }
.edged--gold { border-inline-start-color: var(--gold); }
.edged--navy { border-inline-start-color: var(--navy-soft); }

.stack > * + * { margin-top: var(--s3); }
.stack--tight > * + * { margin-top: var(--s2); }

.grid { display: grid; gap: var(--s3); }
@media (min-width: 44rem) { .grid--2 { grid-template-columns: 1fr 1fr; } }

/* ----------------------------------------------------------- landing page */

.hero { padding-block: var(--s5) var(--s4); }
.hero h1 {
  font-size: var(--step-4); font-weight: 700; letter-spacing: -0.022em;
  margin-bottom: var(--s3);
}
.hero__lede { font-size: var(--step-1); color: var(--text-muted); max-width: 34rem; }

/* The hero is a real opening line — the most characteristic thing in this
   product's world — not a statistic. */
.opener {
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: var(--edge) solid var(--navy-soft);
  border-radius: var(--radius-lg);
  padding: var(--s4) var(--s3) var(--s3);
  box-shadow: var(--shadow-lift);
  margin-top: var(--s4);
}
.opener__who {
  font-size: var(--step--1); color: var(--text-faint); font-weight: 600;
  margin-bottom: var(--s2);
}
.opener__line {
  font-family: var(--font-head); font-weight: 500;
  font-size: clamp(1.3rem, 3.4vw, 1.75rem); line-height: 1.4;
  color: var(--navy); margin: 0 0 var(--s3); max-width: 30ch;
}
.opener__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  padding-top: var(--s3); border-top: 1px solid var(--line);
}
.opener__title { font-weight: 600; color: var(--text); margin-inline-end: auto; }
.opener__nav { display: flex; gap: var(--s1); }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li {
  counter-increment: step; position: relative;
  padding-inline-start: 2.6rem; margin-bottom: var(--s3);
  max-width: var(--measure);
}
.steps li::before {
  content: counter(step);
  position: absolute; inset-inline-start: 0; top: 0.05em;
  width: 1.85rem; height: 1.85rem; border-radius: 50%;
  background: var(--blue-wash); color: var(--blue-deep);
  font-family: var(--font-head); font-weight: 700; font-size: var(--step--1);
  display: grid; place-items: center;
}

.notice {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s3);
  font-size: var(--step--1); color: var(--text-muted);
}
.notice p:last-child { margin-bottom: 0; }
.notice--warn { background: var(--warn-wash); border-color: var(--gold); color: var(--warn); }
.notice--error { background: var(--danger-wash); border-color: var(--danger); color: var(--danger); }
.notice--ok { background: var(--ok-wash); border-color: var(--ok); color: var(--ok); }

/* ------------------------------------------------------------ menu / home */

.menu { display: grid; gap: var(--s2); }
.menu__item {
  display: flex; align-items: center; gap: var(--s3);
  background: var(--surface); border: 1px solid var(--line);
  border-inline-start: var(--edge) solid var(--blue);
  border-radius: var(--radius); padding: var(--s3);
  font: inherit; color: var(--text); text-align: start;
  cursor: pointer; width: 100%;
  transition: border-color .15s ease, background-color .15s ease;
}
.menu__item:hover { background: var(--surface-2); border-inline-start-color: var(--gold); }
.menu__item strong { font-family: var(--font-head); font-size: var(--step-1); display: block; }
.menu__item span { color: var(--text-muted); font-size: var(--step--1); }
.menu__item--primary { border-inline-start-color: var(--gold); background: var(--surface); }

/* ---------------------------------------------------------- scenario list */

.filters { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.filters fieldset { border: 0; padding: 0; margin: 0; }
.filters legend {
  font-size: var(--step--1); color: var(--text-faint);
  font-weight: 600; margin-bottom: var(--s1); padding: 0;
}

.chips { display: flex; flex-wrap: wrap; gap: var(--s1); }
.chip {
  font: inherit; font-size: var(--step--1); font-weight: 500;
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 0.4rem var(--s3); cursor: pointer; min-height: 38px;
}
.chip:hover { border-color: var(--blue); color: var(--blue-deep); }
.chip[aria-pressed='true'] {
  background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600;
}

.scenario {
  background: var(--surface); border: 1px solid var(--line);
  border-inline-start: var(--edge) solid var(--blue);
  border-radius: var(--radius); padding: var(--s3);
  display: flex; flex-direction: column; gap: var(--s2);
}
.scenario h3 { margin: 0; }
.scenario__desc { color: var(--text-muted); font-size: var(--step--1); margin: 0; }
.scenario__goal {
  margin: 0; font-size: var(--step--1);
  padding-inline-start: var(--s2); border-inline-start: 2px solid var(--gold);
}
.scenario__goal b { font-weight: 600; color: var(--navy); }
.scenario__foot {
  display: flex; align-items: center; gap: var(--s3);
  margin-top: auto; padding-top: var(--s2);
}
.scenario__time { font-size: var(--step--1); color: var(--text-faint); margin-inline-end: auto; }

/* ---------------------------------------------------------- conversation */

.convo { display: flex; flex-direction: column; min-height: calc(100dvh - 68px); }

.convo__goalbar {
  position: sticky; top: 68px; z-index: 10;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: var(--s2) 0;
}
.convo__goalbar .wrap { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }
.convo__scenario { font-family: var(--font-head); font-weight: 600; color: var(--navy); }
.convo__goal { font-size: var(--step--1); color: var(--text-muted); margin-inline-end: auto; }
.convo__turns { font-size: var(--step--1); color: var(--text-faint); white-space: nowrap; }

.transcript {
  flex: 1; padding-block: var(--s4);
  display: flex; flex-direction: column; gap: var(--s3);
}

.utterance {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s3);
  max-width: 38rem;
}
.utterance--coach { border-inline-start: var(--edge) solid var(--navy-soft); }
.utterance--student {
  border-inline-start: var(--edge) solid var(--gold);
  background: var(--surface-2); margin-inline-start: auto;
}
.utterance__who {
  font-size: var(--step--1); font-weight: 600; color: var(--text-faint);
  margin-bottom: var(--s1);
}
/* Practice text is English even inside a right-to-left interface. */
.utterance__text {
  font-size: var(--step-1); line-height: 1.7; margin: 0;
  direction: ltr; text-align: start;
}
[dir='rtl'] .utterance__text { text-align: left; }

.utterance__tools { display: flex; gap: var(--s1); margin-top: var(--s2); flex-wrap: wrap; }

.coachnote {
  margin-top: var(--s2); padding: var(--s2) var(--s3);
  background: var(--gold-wash); border-radius: var(--radius);
  border-inline-start: 3px solid var(--gold);
  font-size: var(--step--1); color: var(--text);
}
.coachnote__label { font-weight: 700; color: var(--warn); display: block; font-size: var(--step--1); }
.coachnote p { margin: 0; }

.explainbox {
  margin-top: var(--s2); padding: var(--s2) var(--s3);
  background: var(--blue-wash); border-radius: var(--radius);
  border-inline-start: 3px solid var(--blue);
  font-size: var(--step-0);
}

.thinking { display: flex; align-items: center; gap: var(--s2); color: var(--text-faint); font-size: var(--step--1); }
.thinking__dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--blue);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* The dock is the one place boldness is spent. It must survive the mobile
   keyboard, so the shell tracks visualViewport and sets --kb. */
.dock {
  position: sticky; bottom: 0; z-index: 15;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-block: var(--s2);
  padding-bottom: calc(var(--s2) + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 24px rgba(22, 63, 109, 0.08);
}

.dock__row { display: flex; align-items: flex-end; gap: var(--s2); }

.dock__input {
  flex: 1; font: inherit; font-size: var(--step-0);
  min-height: 50px; max-height: 8rem; resize: none;
  padding: var(--s2) var(--s3); border-radius: var(--radius);
  border: 2px solid var(--line-strong); background: var(--surface);
  color: var(--text); direction: ltr; text-align: start;
}
.dock__input:focus { border-color: var(--blue); }
.dock__input::placeholder { color: var(--text-faint); }

.mic {
  flex: none; width: 58px; height: 58px; border-radius: 50%;
  border: 3px solid var(--gold); background: var(--surface);
  display: grid; place-items: center; cursor: pointer;
  position: relative; overflow: hidden;
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.mic svg { width: 26px; height: 26px; fill: var(--navy); position: relative; z-index: 1; }
.mic::after {
  content: ''; position: absolute; inset: 0; background: var(--gold);
  transform: translateY(100%); transition: transform .18s ease;
}
.mic[data-listening='true']::after { transform: translateY(0); }
.mic[data-listening='true'] svg { fill: #3A2A00; }
.mic:disabled { opacity: .4; cursor: not-allowed; border-color: var(--line-strong); }

.dock__helpers { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s2); }
.dock__status { font-size: var(--step--1); color: var(--text-muted); margin-top: var(--s1); min-height: 1.4em; }

/* ---------------------------------------------------------------- summary */

.stat-row { display: flex; flex-wrap: wrap; gap: var(--s3); }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-inline-start: var(--edge) solid var(--blue);
  border-radius: var(--radius); padding: var(--s2) var(--s3); flex: 1 1 9rem;
}
.stat b { font-family: var(--font-head); font-size: var(--step-2); display: block; color: var(--navy); line-height: 1.2; }
.stat span { font-size: var(--step--1); color: var(--text-muted); }

.goalflag {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-family: var(--font-head); font-weight: 600;
  padding: var(--s1) var(--s3); border-radius: 999px; font-size: var(--step--1);
}
.goalflag--done { background: var(--ok-wash); color: var(--ok); }
.goalflag--progress { background: var(--blue-wash); color: var(--blue-deep); }
.goalflag--none { background: var(--surface-2); color: var(--text-muted); }

.bullets { margin: 0; padding-inline-start: var(--s3); }
.bullets li { margin-bottom: var(--s2); max-width: var(--measure); }

.phraselist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.phraselist li {
  background: var(--surface); border: 1px solid var(--line);
  border-inline-start: var(--edge) solid var(--gold);
  border-radius: var(--radius); padding: var(--s2) var(--s3);
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
}
.phraselist p { margin: 0; flex: 1; direction: ltr; text-align: start; font-size: var(--step-1); }

/* ---------------------------------------------------------------- forms */

.field { display: block; margin-bottom: var(--s3); }
.field > span { display: block; font-weight: 600; margin-bottom: var(--s1); font-size: var(--step--1); }
.field select, .field input[type='range'] { width: 100%; font: inherit; }
.field select {
  min-height: 50px; padding: var(--s2) var(--s3); border-radius: var(--radius);
  border: 2px solid var(--line-strong); background: var(--surface); color: var(--text);
}

/* --------------------------------------------------------------- overlay */

.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(11, 30, 51, .55);
  display: grid; place-items: center; padding: var(--s3);
}
.overlay__panel {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: var(--s4); max-width: 26rem; width: 100%;
  box-shadow: var(--shadow-lift);
}

.loading { display: grid; place-items: center; padding: var(--s6) 0; color: var(--text-faint); }

/* --------------------------------------------------------- rtl + motion */

[dir='rtl'] .steps li { padding-inline-start: 2.6rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media (prefers-contrast: more) {
  :root { --line: #7C96AC; --line-strong: #52708A; }
}

/* Masthead language picker — visible before sign-in so a student who cannot
   read English can change the interface before doing anything else. */
.masthead__actions { display: flex; align-items: center; gap: var(--s2); }
.lang-select {
  font: inherit; font-size: var(--step--1); min-height: 42px;
  padding: 0 var(--s3); border-radius: var(--radius);
  border: 2px solid var(--line-strong); background: var(--surface); color: var(--text);
}
.lang-select:hover { border-color: var(--blue); }

/* Shell height accounts for the on-screen keyboard (--kb set by app.js). */
.convo { min-height: calc(100dvh - 68px - var(--kb, 0px)); }

/* Practice tally — a count of situations tried, never a score or a ranking. */
.tally { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tally li {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s4); background: var(--surface);
  border-inline-start: 4px solid var(--blue); border-radius: var(--radius-sm);
}
.tally__name { font-weight: 500; }
.tally__count { font-family: var(--font-head); font-size: var(--step-1); color: var(--navy); }
:root[data-theme="dark"] .tally__count { color: var(--gold); }

/* Where a saved phrase came from. */
.phraselist__from {
  font-size: var(--step--1); color: var(--muted); margin: 2px 0 0;
}

/* The listen control while it is the one speaking. */
.btn.is-speaking { background: var(--gold-soft); border-color: var(--gold); }

/* Pronunciation and speaking: listen, record locally, compare. */
.speaking-page { --wrap: 72rem; }
.speaking-hero {
  background: linear-gradient(115deg, #163F6D, #225d96);
  color: #fff; border-radius: var(--radius-lg); padding: clamp(1.5rem, 4vw, 2.75rem);
  border-inline-start: 6px solid var(--gold);
}
.speaking-hero h1 { color: #fff; font-size: clamp(1.8rem, 4vw, 2.55rem); margin-block: .5rem .75rem; }
.speaking-hero p { max-width: 62ch; color: #fff; }
.speaking-hero .speaking-eyebrow { color: #ffe4a0; font-size: .8rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.speaking-layout { display: grid; grid-template-columns: minmax(15rem, .75fr) minmax(0, 1.4fr); gap: 1.5rem; align-items: start; }
.speaking-library { min-width: 0; }
.speaking-library h2 { font-size: 1.15rem; }
.speaking-choices { display: grid; gap: .65rem; }
.speaking-choice { text-align: left; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: .85rem 1rem; font: inherit; line-height: 1.5; cursor: pointer; overflow-wrap: anywhere; }
.speaking-choice:hover, .speaking-choice[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-wash); }
.speaking-choice[aria-pressed="true"] { box-shadow: inset 4px 0 var(--blue); }
.speaking-panel { min-width: 0; }
.speaking-panel label { font-weight: 600; }
.speaking-input { width: 100%; min-height: 5.5rem; resize: vertical; padding: .85rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text); font: inherit; font-size: 1.1rem; line-height: 1.5; }
.speaking-step { border-top: 1px solid var(--line); padding-top: 1.15rem; }
.speaking-step h2 { display: flex; align-items: center; gap: .6rem; font-size: 1.1rem; }
.speaking-step__number { display: inline-grid; place-items: center; flex: 0 0 1.8rem; height: 1.8rem; border-radius: 50%; background: #163F6D; color: #fff; font-size: .85rem; }
.speaking-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.speaking-words { display: flex; gap: .35rem; flex-wrap: wrap; }
.speaking-word { padding: .45rem .6rem; min-height: 44px; font: inherit; font-size: 1.05rem; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; max-width: 100%; overflow-wrap: anywhere; }
.speaking-word:hover, .speaking-word[aria-pressed="true"] { background: var(--gold-wash); border-color: var(--gold); }
.speaking-word:disabled { cursor: default; opacity: .6; }
.speaking-tip { background: var(--blue-wash); border-radius: 8px; padding: .8rem 1rem; font-size: .9rem; }
.speaking-tip p + p { margin-top: .35rem; }
.speaking-tip .speaking-syllables { font-weight: 700; font-size: 1.25rem; letter-spacing: .025em; }
.speaking-status { font-size: .9rem; min-height: 1.4em; color: var(--text-muted); }
.speaking-panel[data-recording="true"] .speaking-status { color: var(--danger); font-weight: 600; }
.speaking-timer { font-variant-numeric: tabular-nums; font-weight: 600; }
.speaking-clip { padding: .9rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.speaking-clip p { font-weight: 600; margin-bottom: .6rem; }
.speaking-clip audio { display: block; width: 100%; min-width: 0; margin-bottom: .5rem; }
.speaking-privacy { font-size: .85rem; border-inline-start: 3px solid var(--gold); padding-inline-start: .8rem; color: var(--text-muted); }
.speaking-next { display: flex; gap: 1.5rem; justify-content: space-between; align-items: center; }
.speaking-next h2 { font-size: 1.15rem; }
.speaking-next p { margin-top: .4rem; color: var(--text-muted); }
.speaking-next .btn { flex-shrink: 0; }
.practice-dialog { width: min(42rem, calc(100% - 1.5rem)); max-height: calc(100dvh - 2rem); padding: 1.25rem; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--text); margin: auto; overflow: auto; overscroll-behavior: contain; box-shadow: 0 20px 70px #0005; }
.practice-dialog::backdrop { background: #0b223bb3; }
.practice-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.practice-dialog__head h2 { font-size: 1.15rem; }
.practice-dialog__head .btn { flex-shrink: 0; }
.practice-open { overflow: hidden; }
.speaking-page [hidden], .practice-dialog [hidden] { display: none !important; }
.speaking-panel .notice:empty { display: none; }
@media (max-width: 760px) {
  .speaking-layout { grid-template-columns: 1fr; }
  .speaking-library { padding: 1.1rem; }
  .speaking-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .speaking-choice { font-size: .9rem; padding: .65rem .8rem; }
  .speaking-next { flex-direction: column; align-items: start; }
  .speaking-panel { padding: 1.1rem; }
  .practice-dialog { padding: .8rem; }
}
@media (max-width: 380px) { .speaking-choices { grid-template-columns: 1fr; } }

/* Keep guidance quiet and playback controls compact. */
.btn svg { width: 1.2rem; height: 1.2rem; flex: 0 0 1.2rem; fill: currentColor; }
.speaking-panel .notice:not(.notice--warn) { padding: 0; border: 0; background: transparent; }

.speaking-page .chip[aria-pressed="true"] { background: #163F6D; border-color: #163F6D; color: #fff; }
:where(.speaking-page, .practice-dialog) .btn:not(.btn--quiet):not(.btn--plain) { background: #0064A8; color: #fff; }
:where(.speaking-page, .practice-dialog) .btn:not(.btn--quiet):not(.btn--plain):hover { background: #00548E; }
.speaking-panel { scroll-margin-block-start: 1rem; }

/* Highlands Forward: preserve the original mark; crop its white canvas in CSS. */
.brand-logo { position: relative; display: inline-block; flex: none; width: 220px; aspect-ratio: 1240 / 390; overflow: hidden; background: white; border-radius: 5px; direction: ltr; }
.masthead__logo .brand-logo img, .brand-logo img { position: absolute; display: block; width: 134.8387%; max-width: none; height: auto; left: -14.5161%; top: -70.5128%; }
.masthead { border-top: 5px solid var(--gold); }
.masthead__inner { min-height: 94px; gap: 1.25rem; }
.masthead__product { font-size: .95rem; max-width: 13rem; }
.sitefoot { border-top: 3px solid var(--gold); }
.landing { max-width: 68rem; }
.landing .hero { position: relative; overflow: hidden; padding: clamp(1.5rem, 5vw, 3.5rem); margin-block: 1rem 2rem; border-radius: 24px; background: linear-gradient(115deg, #163F6D, #0064a8); color: white; border-bottom: 6px solid var(--gold); }
.landing .hero h1 { max-width: 16ch; color: white; font-size: clamp(2rem, 4.8vw, 3.6rem); line-height: 1.12; margin-block: 1rem; }
.landing .hero__lede { color: #e1effb; max-width: 42rem; font-size: clamp(1rem, 2vw, 1.2rem); }
.hero__eyebrow { color: #ffce4a; font-weight: 700; letter-spacing: .12em; font-size: .78rem; text-transform: uppercase; }
.hero__topics { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.hero__topics span { border: 1px solid #83add0; border-radius: 999px; padding: .35rem .8rem; font-size: .85rem; }
.landing > .opener { margin: 0 0 1.5rem; padding: clamp(1.2rem, 3vw, 2rem); border-inline-start: 6px solid var(--gold); }
.landing .opener__line { font-size: clamp(1.3rem, 2.6vw, 1.9rem); }
.landing__signin { padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.landing__signin .notice { max-width: none; margin: 0; }
.landing .steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.landing .steps li { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem; align-items: flex-start; }
.landing .scenario { border-top: 3px solid var(--blue); }
select { max-width: 100%; min-width: 0; }
.notice { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .masthead__inner { flex-wrap: wrap; gap: .65rem; padding-block: .65rem; }
  .brand-logo { width: 160px; }
  .masthead__product { font-size: .8rem; max-width: 7rem; padding-inline-start: .6rem; }
  .masthead__actions { width: 100%; justify-content: flex-end; }
  .lang-select { width: 100%; }
  .landing .hero { margin-top: 0; border-radius: 16px; }
  .landing .steps { grid-template-columns: 1fr; }
  .landing__signin { padding: 1rem; }
  .landing .opener__meta { flex-wrap: wrap; }
}

.landing .steps li { padding-inline-start: 3.7rem; }
.landing .steps li::before { inset-inline-start: 1rem; top: 1.1rem; }

/* Public policy pages remain readable without sign-in or JavaScript. */
.legal-links { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; align-items: center; font-size: .875rem; }
.legal-links a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-underline-offset: .2em; }
.legal-page { max-width: 58rem; }
.legal-hero { padding: clamp(1.3rem, 4vw, 2.5rem); border-radius: 18px; background: var(--navy); color: white; border-bottom: 5px solid var(--gold); margin-block-end: 1.5rem; }
.legal-hero h1 { color: white; margin-block: .65rem 1rem; font-size: clamp(2rem, 5vw, 2.8rem); }
.legal-hero p { max-width: 65ch; }
.legal-content { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: clamp(1.2rem, 4vw, 2.5rem); overflow-wrap: anywhere; }
.legal-content section + section { border-top: 1px solid var(--line); padding-top: 1.5rem; margin-top: 1.5rem; }
.legal-content h2 { font-size: 1.25rem; margin-block: 0 .75rem; }
.legal-content p, .legal-content li { max-width: 72ch; }
.legal-content p + p, .legal-content li + li { margin-top: .75rem; }
.legal-content ul { padding-inline-start: 1.4rem; }
.legal-page .legal-links { margin-block: 1rem; }
@media print { .legal-hero { background: white; color: black; border: 0; padding: 0; } .legal-hero h1 { color: #163F6D; } .legal-content { border: 0; padding: 0; } .legal-content h2 { break-after: avoid; } }

/* v1.3.3: clearer hierarchy, readable controls and resilient narrow layouts. */
:root { --radius-sm: 7px; --muted: var(--text-muted); --gold-soft: var(--gold-wash); }
body { background: radial-gradient(ellipse at 5% 0%, #007dce0d, transparent 65%), var(--bg); }
.btn:not(.btn--quiet):not(.btn--plain) { background: #0064a8; color: #fff; }
.btn:not(.btn--quiet):not(.btn--plain):hover { background: #00548e; }
.btn--small, .btn--plain { min-height: 44px; }
.btn.is-speaking { background: var(--gold-wash); color: var(--text); border-color: var(--gold); }
.chip[aria-pressed='true'] { background: #163f6d; color: #fff; border-color: #163f6d; }
.sitefoot { padding-block: 1.5rem; color: var(--text-muted); }
.sitefoot__brand { margin-bottom: .35rem !important; font-size: 1rem; }
.sitefoot .legal-links { margin-top: .5rem; }
.landing { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
.landing > * { min-width: 0; margin-block: 0 !important; }
.landing .hero { margin: 0; box-shadow: 0 12px 34px #163f6d15; }
.landing .hero::after { content: ''; position: absolute; width: 17rem; height: 17rem; border: 1px solid #ffffff18; border-radius: 50%; bottom: -12rem; right: -3rem; pointer-events: none; }
.landing__signin { align-self: stretch; justify-content: center; border-top: 4px solid var(--gold); box-shadow: var(--shadow-card); }
.privacy-reminder { font-size: .875rem; color: var(--text-muted); padding-inline-start: .9rem; border-inline-start: 3px solid var(--gold); }
.landing > .opener { box-shadow: var(--shadow-card); border-radius: var(--radius-lg); }
.practice-home { --wrap: 58rem; }
.practice-home > h1 { padding-block: .75rem; }
.practice-home .menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.practice-home .menu__item { min-width: 0; min-height: 105px; border-radius: 16px; box-shadow: var(--shadow-card); }
.practice-home .menu__item--primary { grid-column: 1 / -1; background: linear-gradient(110deg, #163f6d, #0064a8); color: #fff; border-color: #163f6d; border-inline-start: 5px solid var(--gold); }
.practice-home .menu__item--primary strong, .practice-home .menu__item--primary span { color: #fff; }
.practice-home .menu__item--primary::after { color: var(--gold); }
.safety-note { padding: .85rem 1rem; border: 1px solid var(--line); border-inline-start: 4px solid var(--gold); border-radius: 12px; background: var(--surface); color: var(--text-muted); font-size: .875rem; }
.safety-note summary { cursor: pointer; font-weight: 600; color: var(--navy); min-height: 28px; }
.safety-note p { margin-block: .65rem 0; }
.safety-note a { display: inline-flex; align-items: center; min-height: 44px; margin-top: .4rem; }
.convo .safety-note { margin-block: 1rem; }
.dock__input { min-width: 0; }
.dock__row { min-width: 0; }
.utterance__text, .phraselist p, .menu__item, .scenario h3, .opener__line { overflow-wrap: anywhere; }
@media (min-width: 900px) {
  .landing { grid-template-columns: minmax(0, 1.4fr) minmax(20rem, 1fr); }
  .landing > * { grid-column: 1 / -1; }
  .landing > .hero { grid-column: 1; padding: 2.5rem; }
  .landing > .landing__signin { grid-column: 2; }
  .landing .hero h1 { font-size: clamp(2.4rem, 4vw, 3.2rem); }
  .landing .hero__topics { gap: .45rem; }
}
@media (max-width: 600px) {
  .masthead__inner { min-height: 76px; }
  .masthead__actions { width: auto; margin-inline-start: auto; flex: 1 1 120px; justify-content: flex-end; flex-wrap: wrap; gap: .25rem; }
  .masthead__actions .btn { font-size: .75rem; padding-inline: .5rem; }
  .lang-select { padding-inline: .5rem; font-size: .85rem; }
  .landing { gap: 1.25rem; }
  .landing .hero { padding: 1.4rem; }
  .landing .hero h1 { margin-block: .7rem; }
  .landing .hero__topics { margin-top: 1rem; }
  .practice-home .menu { grid-template-columns: 1fr; }
  .practice-home .menu__item { min-height: 86px; }
  .dock__row { gap: .5rem; }
  .dock__row .btn { padding-inline: .75rem; }
  .dock__row .mic { width: 46px; height: 50px; }
  .dock__input { padding-inline: .65rem; }
  .legal-links { column-gap: 1rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print { .safety-note { display: none; } }
/* Keep the goal and newest reply clear of changing header/dock heights. */
.convo__goalbar { top: var(--masthead-height, 99px); }
.convo { min-height: calc(100dvh - var(--masthead-height, 99px) - var(--kb, 0px)); }
.utterance, .thinking { scroll-margin-block-end: calc(var(--dock-height, 15rem) + 1rem); }
.dock__status:empty { display: none; }
@media (max-width: 600px) {
  .dock__helpers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
  .dock__helpers .btn { padding: .5rem; font-size: .8rem; line-height: 1.4; }
}

/* Page language stays visible before and after sign-in on every device. */
.page-language { display: grid; gap: .2rem; min-width: 0; max-width: 14rem; }
.page-language__label { font-size: .72rem; font-weight: 600; color: var(--text-muted, var(--text)); }
.page-language .lang-select { width: 100%; max-width: 100%; min-height: 44px; }
.masthead__actions { flex-wrap: wrap; }
@media (max-width: 47.5rem) {
  .masthead__actions { flex: 1 1 100%; width: 100%; gap: .5rem; }
  .page-language { flex: 1 1 8rem; max-width: none; }
  .masthead__actions .btn { min-height: 44px; }
}

.leadership-heading h1 { margin-block: .4rem; }
.leadership-filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; }
.leadership-filters .field { flex: 1 1 10rem; margin: 0; min-width: 0; }
.leadership-filters input { min-width: 0; width: 100%; }
.leadership-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1rem; }
.leadership-metrics .card { padding: 1rem; min-width: 0; }
.leadership-metrics p { font-size: .875rem; margin-bottom: .5rem; }
.leadership-metrics strong { font-size: 2rem; font-weight: 700; color: var(--blue); }
.leadership-table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: .5rem; }
.leadership-table { width: 100%; border-collapse: collapse; text-align: start; }
.leadership-table th, .leadership-table td { padding: .7rem; border-bottom: 1px solid var(--line); text-align: start; }
.leadership-table th { font-size: .85rem; background: var(--surface); }
.leadership-table td:first-child { min-width: 9rem; }
@media (max-width: 47.5rem) { .leadership-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 24rem) { .leadership-filters .btn { width: 100%; } }
@media print {
 .leadership { max-width: none; font-size: 10pt; }
 .leadership-metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
 .leadership-table-wrap { overflow: visible; }
 .leadership-table thead { display: table-header-group; }
 .leadership-table tr, .leadership-metrics .card { break-inside: avoid; }
 .leadership h2 { break-after: avoid; }
}

.legal-page, .leadership-heading { overflow-wrap: anywhere; }
.masthead__actions .btn { overflow-wrap: anywhere; }
