/* SOSpeak - picture-board design system
 *
 * One stylesheet for every screen. It replaces the navy-and-red paper theme
 * and the picture-tile layer that had been appended on top of it.
 *
 * Colour has one job per family, same rule as before, new values:
 *
 *   red     emergency and only emergency. The Call 000 tile.
 *   peach   danger phrases - the urgent symptoms.
 *   mint    every other phrase about the body.
 *   white   everything neutral: rights phrases, places, settings, buttons.
 *   lime    the one action that moves things on: Play, Continue, Next.
 *   forest  "this one is chosen". Selected language, current section.
 *
 * No web fonts. The app is offline-first and read in five scripts, so the
 * system stack is the right one: SF / Helvetica for Latin and Vietnamese,
 * PingFang / Noto for Chinese. Weight does the work instead of a typeface.
 */

:root {
  /* change 5 - six text steps (18 is the floor) and an 8px spacing rhythm.
     Every size is multiplied by --scale, so the phone's text size still wins. */
  --text-1: 1.125rem; /* 18 notes, English lines, hints, chips */
  --text-2: 1.25rem;  /* 20 labels, card English, tile words */
  --text-3: 1.5rem;   /* 24 card text, section headings */
  --text-4: 1.75rem;  /* 28 big card titles, the phrase on its own */
  --text-5: 2.125rem; /* 34 page titles */
  --text-6: 2.5rem;   /* 40 Call 000, the language screen */
}

:root {
  color-scheme: light;

  --bg: #e9eae5;
  --surface: #ffffff;
  --surface-2: #f4f5f1;
  --ink: #111311;
  --ink-2: #3f433d;
  --ink-3: #5a5f57;
  --line: #d6d8d1;

  --red: #c9403e;
  --red-press: #b53634;
  --icon-red: #b3261e;
  --peach: #f7c29a;
  --mint: #e2f4da;
  --lime: #a8e26b;
  --lime-press: #96d457;
  --forest: #1f3a15;
  --on-forest: #a8e26b;
  --tile-ink: #111311;
  --tile-ink-2: #3a2c22;
  --dot-peach: #f2a36b;
  --dot-green: #8ed86a;

  /* aliases the body chart and older markup still read */
  --brand-red: var(--red);
  --crimson: var(--red);
  --indigo: var(--forest);

  --radius-pill: 999px;
  --radius-sm: 16px;
  --radius-button: 22px;
  --radius-tile: 24px;
  --radius-hero: 28px;
  --shadow-float: 0 12px 32px -14px rgba(17, 19, 17, 0.35);

  --tap-size: 68px;
  --scale: 1;
  --board-measure: 36rem;
  --page-measure: 44rem;
  --cards-measure: 72rem;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial,
    "PingFang SC", "PingFang HK", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans TC",
    "Microsoft YaHei", sans-serif;
}

/* Dark: the page and neutral surfaces go dark; peach and lime stay bright with
 * dark ink on them, because they are the colours that carry meaning and they
 * read even better against a dark ground. Mint deepens so light text works. */
@media (prefers-color-scheme: dark) {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #121411;
    --surface: #1e211c;
    --surface-2: #262a24;
    --ink: #f1f2ee;
    --ink-2: #c9ccc4;
    --ink-3: #9a9e96;
    --line: #33372f;
    --mint: #28381f;
    --forest: #a8e26b;
    --on-forest: #142a0c;
    --shadow-float: 0 12px 32px -12px rgba(0, 0, 0, 0.7);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121411;
  --surface: #1e211c;
  --surface-2: #262a24;
  --ink: #f1f2ee;
  --ink-2: #c9ccc4;
  --ink-3: #9a9e96;
  --line: #33372f;
  --mint: #28381f;
  --forest: #a8e26b;
  --on-forest: #142a0c;
  --shadow-float: 0 12px 32px -12px rgba(0, 0, 0, 0.7);
}

/* High contrast (Settings): white on black, every surface outlined, the
 * coloured tiles kept but given black ink and a hard white edge. */
body.high-contrast {
  --bg: #000000;
  --surface: #000000;
  --surface-2: #000000;
  --ink: #ffffff;
  --ink-2: #ffffff;
  --ink-3: #e6e6e6;
  --line: #ffffff;
  --mint: #d8f5c8;
  --forest: #ffffff;
  --on-forest: #000000;
  --shadow-float: none;
}

/* ------------------------------------------------------------------------ */
/* base                                                                      */
/* ------------------------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: calc(var(--text-1) * var(--scale));
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.has-section-bar {
  padding-bottom: calc(108px + env(safe-area-inset-bottom));
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.icon {
  flex-shrink: 0;
  display: block;
}

:focus-visible {
  outline: 3px solid var(--forest);
  outline-offset: 3px;
}

body.high-contrast :focus-visible {
  outline-color: #ffff00;
}

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

.skip-link {
  position: absolute;
  top: -80px;
  left: 16px;
  z-index: 50;
  padding: 12px 16px;
  border-radius: var(--radius-pill);
  background: var(--forest);
  color: var(--on-forest);
  font-weight: 800;
}

.skip-link:focus {
  top: 12px;
}

/* ------------------------------------------------------------------------ */
/* header                                                                    */
/* ------------------------------------------------------------------------ */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
}

.header-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--cards-measure);
  min-height: 56px;
  margin: 0 auto;
}

.brand {
  font-size: calc(var(--text-4) * var(--scale));
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* on the smallest phones the wordmark, the language chip and settings do not
   fit on one line; the wordmark is the one that can go */
@media (max-width: 359px) {
  .brand { display: none; }
}

.back-button,
.settings-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.language-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 700;
}

body.high-contrast .back-button,
body.high-contrast .settings-link,
body.high-contrast .language-chip {
  border: 2px solid var(--line);
}

body.language-screen .brand,
body.show-screen .app-header {
  display: none;
}

/* ------------------------------------------------------------------------ */
/* page frame                                                                */
/* ------------------------------------------------------------------------ */

.page-wrap {
  max-width: var(--page-measure);
  margin: 0 auto;
  padding: 8px 16px 32px;
}

.page-wrap.board {
  max-width: var(--board-measure);
}

.page-wrap.wide {
  max-width: var(--page-measure);
}

.page-wrap.extra-wide {
  max-width: var(--cards-measure);
}

.page-wrap > * + * {
  margin-top: 16px;
}

.page-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-wrap h1,
.home-heading h1 {
  font-size: calc(var(--text-5) * var(--scale));
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.english-subtitle {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 700;
}

.english-interface .english-subtitle {
  display: none;
}

.page-hint,
.body-chart-hint {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 600;
}

.body-chart-hint-small {
  color: var(--ink-3);
  font-size: calc(1rem * var(--scale));
}

.section-title {
  margin: 24px 0 12px;
  font-size: calc(var(--text-2) * var(--scale));
  font-weight: 800;
}

.note {
  color: var(--ink-2);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 600;
}

/* voice search / concern-review, ported from the voice-review feature. The
   search field and its icon, the primary button and .back-link already exist
   above with the picture-board treatment, so only the pieces unique to this
   flow are added here. */
.search-tools {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 0;
  flex-wrap: wrap;
  max-width: 100%;
}

.concern-review {
  display: grid;
  gap: 12px;
  width: 320px;
  max-width: 100%;
}

.concern-review label {
  font-weight: 700;
}

.concern-review input {
  width: 100%;
  min-height: var(--tap-size);
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 600;
}

.concern-review input:focus {
  border-color: var(--forest);
  outline: none;
}

.concern-review-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.concern-review-actions .primary-button {
  width: auto;
}

.search-entry {
  display: flex;
  flex: 1 1 220px;
  min-width: 0;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* the field takes the room that is left, and review drops under it on a
   narrow phone instead of running off the side of the screen */
.search-entry .search-field {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 420px;
}

.search-entry .secondary-button { border: 2px solid var(--line); }

.voice-search {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.voice-search-button {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--lime);
  color: var(--tile-ink);
  box-shadow: 0 0 0 10px var(--surface-2);
  transition: transform 0.13s, background 0.13s;
}

.voice-search-button:hover {
  transform: scale(1.04);
}

.voice-search.listening .voice-search-button {
  background: var(--forest);
  color: var(--on-forest);
  box-shadow: 0 0 0 12px var(--mint);
}

.voice-search-button svg {
  width: 28px;
  height: 28px;
}

.voice-search-label {
  color: var(--ink-3);
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
}

.two-column-layout,
.single-column-layout {
  display: grid;
  gap: 8px 32px;
}

@media (min-width: 1000px) {
  .two-column-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.suggestion-action {
  margin-top: 16px;
  display: inline-block;
  color: var(--forest);
  font-weight: 700;
}

.two-column-layout > .full-width {
  grid-column: 1 / -1;
}

.flex-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

#pageFooter {
  max-width: var(--page-measure);
  margin: 0 auto;
  padding: 8px 24px 24px;
  color: var(--ink-3);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}

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

.lime-button,
.primary-button,
.white-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: var(--tap-size);
  padding: 0 24px;
  border: 0;
  border-radius: var(--radius-button);
  font-size: calc(var(--text-2) * var(--scale));
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  transition: transform 120ms ease, background-color 120ms ease;
}

.lime-button,
.primary-button {
  background: var(--lime);
  color: var(--tile-ink);
}

.lime-button:active,
.primary-button:active {
  background: var(--lime-press);
  transform: scale(0.985);
}

.white-button,
.secondary-button {
  background: var(--surface);
  color: var(--ink);
}

.white-button:active,
.secondary-button:active {
  background: var(--surface-2);
  transform: scale(0.985);
}

.secondary-button {
  min-height: 56px;
  font-size: calc(var(--text-1) * var(--scale));
}

body.high-contrast .lime-button,
body.high-contrast .primary-button {
  border: 3px solid #ffffff;
  background: #ffffff;
  color: #000000;
}

body.high-contrast .white-button,
body.high-contrast .secondary-button {
  border: 2px solid var(--line);
}

.lime-button:disabled,
.primary-button.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.action-row {
  justify-content: flex-start;
  width: 100%;
  padding: 0 24px;
}

.action-row .speaker-icon svg,
.action-row .icon {
  width: 30px;
  height: 30px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  color: var(--ink-2);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 700;
}

.back-link,
.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 700;
}

/* ------------------------------------------------------------------------ */
/* the red Call 000 tile                                                     */
/* ------------------------------------------------------------------------ */

.call-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 104px;
  padding: 16px 24px 16px 16px;
  border-radius: var(--radius-tile);
  background: var(--red);
  color: #ffffff;
}

.call-tile:active {
  background: var(--red-press);
}

.call-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--red);
  flex-shrink: 0;
}

.call-tile-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.call-tile-title {
  font-size: calc(var(--text-5) * var(--scale));
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.call-tile-note {
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 700;
  opacity: 0.95;
}

body.high-contrast .call-tile {
  border: 3px solid #ffffff;
  background: #c00000;
}

/* ------------------------------------------------------------------------ */
/* picture tiles                                                             */
/* ------------------------------------------------------------------------ */

.tile-grid,
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.page-wrap.extra-wide .card-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr));
}

@media (min-width: 700px) {
  .page-wrap.extra-wide .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

.phrase-tile,
.communication-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 176px;
  padding: 16px 16px 16px;
  border: 0;
  border-radius: var(--radius-tile);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: transform 120ms ease;
}

.phrase-tile:active,
.communication-card:active {
  transform: scale(0.98);
}

.tone-peach {
  background: var(--peach);
  color: var(--tile-ink);
}

/* fixed light mint with dark ink, like peach: it no longer turns dark green
   in dark mode, so body tiles stay as bright as the urgent ones */
.tone-mint {
  background: #e2f4da;
  color: var(--tile-ink);
}

.tone-white {
  background: var(--surface);
  color: var(--ink);
}

body.high-contrast .phrase-tile,
body.high-contrast .communication-card {
  border: 3px solid #ffffff;
}

body.high-contrast .tone-peach,
body.high-contrast .tone-mint {
  color: #000000;
}

.tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--icon-red);
}


/* phrase cards on white (the Phrases page) use the same peach disc and red
   icon as the home buttons, fixed so they match in light and dark */
.tone-white .tile-icon {
  background: var(--peach);
  color: var(--icon-red);
}

.tile-native {
  font-size: calc(var(--text-4) * var(--scale));
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.tile-english {
  color: inherit;
  opacity: 0.78;
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
  line-height: 1.25;
}

.english-interface .tile-english,
.english-interface .card-english-text[lang="en"] {
  display: none;
}

/* playing and chosen, on the symptom cards that speak in place */
.tile-speaker {
  position: absolute;
  top: 14px;
  right: 14px;
  color: inherit;
  opacity: 0.7;
}

.speaker-icon {
  display: inline-flex;
}

.speaker-icon svg {
  width: 26px;
  height: 26px;
}

.playing .sound-wave-one,
.playing .sound-wave-two {
  animation: sound-wave 0.9s ease-in-out infinite;
}

.playing .sound-wave-two {
  animation-delay: 0.2s;
}

@keyframes sound-wave {
  50% {
    opacity: 0.2;
  }
}

.phrase-tile.playing,
.lime-button.playing,
.white-button.playing {
  box-shadow: inset 0 0 0 3px var(--forest);
}

.tile-chosen-mark {
  display: none;
}

.communication-card.is-chosen {
  box-shadow: inset 0 0 0 4px var(--forest);
}

.communication-card.is-chosen .tile-speaker {
  display: none;
}

.communication-card.is-chosen .tile-chosen-mark {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--on-forest);
}

/* what appears under a card that has just been played */
.repeat-button,
.show-from-card {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap-size);
  padding: 0 24px;
  border: 0;
  border-radius: var(--radius-button);
  background: var(--surface);
  color: var(--ink);
  font-size: calc(var(--text-2) * var(--scale));
  font-weight: 800;
}

.repeat-button {
  background: var(--lime);
  color: var(--tile-ink);
}

/* hospital and aged-care cards reuse the card shell */
.card-top,
.card-kicker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.card-kicker {
  color: var(--ink-3);
  font-size: calc(1rem * var(--scale));
  font-weight: 800;
  letter-spacing: 0.02em;
}

.card-distance {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--mint);
  color: var(--ink);
  font-size: calc(1rem * var(--scale));
  font-weight: 800;
  white-space: nowrap;
}

.card-native-text {
  font-size: calc(var(--text-2) * var(--scale));
  font-weight: 800;
  line-height: 1.2;
}

.card-english-text {
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.page-wrap.extra-wide .communication-card:not(.phrase-tile) {
  min-height: 132px;
  justify-content: space-between;
}

.wait-line {
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
}

.wait-line-measured {
  color: var(--ink);
}

.wait-line-estimate,
.wait-line-none {
  color: var(--ink-3);
}

.language-need-badge {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--mint);
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
}

/* ------------------------------------------------------------------------ */
/* home board                                                                */
/* ------------------------------------------------------------------------ */

.page-wrap h1.home-question {
  margin-top: 24px;
  font-size: calc(var(--text-4) * var(--scale));
}

.home-actions {
  display: grid;
  gap: 12px;
}

.home-action {
  min-height: 88px;
  padding: 16px 16px;
  gap: 16px;
  text-align: start;
}

.home-action-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  /* all three doors share the peach disc and red icon; fixed colours so they
     stay the same in light and dark */
  background: var(--peach);
  color: var(--icon-red);
}

.home-action-icon.home-action-icon-peach {
  background: var(--peach);
  color: var(--icon-red);
}

.home-action-icon svg {
  width: 28px;
  height: 28px;
}

.home-action-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.home-action-title {
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 800;
}

.home-action-note {
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 800;
}

body.high-contrast .filter-chip {
  border: 2px solid var(--line);
}

.chip-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.chip-dot-peach {
  background: var(--dot-peach);
}

.chip-dot-green {
  background: var(--dot-green);
}

.chip-dot-hollow {
  border: 2px solid var(--ink-3);
}

/* ------------------------------------------------------------------------ */
/* phrase screen                                                             */
/* ------------------------------------------------------------------------ */

.phrase-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 16px 16px;
  border-radius: var(--radius-hero);
  text-align: center;
}

.phrase-hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--icon-red);
}

.phrase-hero.tone-white .phrase-hero-icon {
  background: var(--peach);
}

.phrase-hero-native {
  font-size: calc(var(--text-6) * var(--scale));
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.page-wrap h1.phrase-hero-native {
  font-size: calc(var(--text-6) * var(--scale));
}

.phrase-hero-english {
  width: 100%;
  padding: 16px 16px 16px;
  border-radius: 20px;
  background: #ffffff;
  color: #111311;
}

.phrase-hero.tone-white .phrase-hero-english {
  background: var(--surface-2);
  color: var(--ink);
}

.phrase-hero-english-label {
  display: block;
  color: #555a52;
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
}

.phrase-hero.tone-white .phrase-hero-english-label {
  color: var(--ink-3);
}

.phrase-hero-english-text {
  margin-top: 2px;
  font-size: calc(var(--text-3) * var(--scale));
  font-weight: 700;
  line-height: 1.25;
}

body.high-contrast .phrase-hero {
  border: 3px solid #ffffff;
  color: #000000;
}

.phrase-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ------------------------------------------------------------------------ */
/* show mode                                                                 */
/* ------------------------------------------------------------------------ */

body.show-screen {
  background: #ffffff;
  color: #111311;
}

.show-screen-body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  background: #ffffff;
  color: #111311;
}

.show-half {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: calc(24px + env(safe-area-inset-top)) 24px 24px;
  border-bottom: 4px solid #111311;
  text-align: center;
}

.show-half-english {
  padding-top: 24px;
}

.show-label {
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 700;
}

.show-icon {
  color: #111311;
}

.show-native,
.show-english {
  font-size: clamp(2.6rem, 13vw, 5rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.show-english-only .show-english {
  font-size: clamp(3rem, 15vw, 6rem);
}

.show-close {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 96px;
  padding-bottom: env(safe-area-inset-bottom);
  font-size: calc(var(--text-4) * var(--scale));
  font-weight: 800;
}

/* ------------------------------------------------------------------------ */
/* language screen                                                           */
/* ------------------------------------------------------------------------ */

.language-screen-body {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 76px);
  max-width: var(--board-measure);
  margin: 0 auto;
  padding: 16px 16px 0;
}

body.language-screen .app-header:has(.back-button[hidden]) {
  display: none;
}

body.language-screen .app-header:has(.back-button[hidden]) + main .language-screen-body {
  min-height: 100dvh;
  padding-top: calc(40px + env(safe-area-inset-top));
}

.language-heading {
  font-size: calc(var(--text-6) * var(--scale));
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.025em;
}

.language-subheading {
  margin-top: 12px;
  color: var(--ink-2);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 700;
  line-height: 1.45;
}

.language-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.language-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-height: 136px;
  padding: 16px 16px 16px;
  border: 0;
  border-radius: var(--radius-tile);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: transform 120ms ease, background-color 150ms ease;
}

.language-tile:active {
  transform: scale(0.98);
}

.language-tile-wide {
  grid-column: 1 / -1;
  min-height: 96px;
}

.language-tile-native {
  font-size: calc(var(--text-5) * var(--scale));
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.language-tile-english {
  color: var(--ink-2);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 700;
}

.language-tile.is-picked {
  background: var(--forest);
  color: var(--on-forest);
}

.language-tile.is-picked .language-tile-english {
  color: var(--on-forest);
  opacity: 0.85;
}

body.high-contrast .language-tile {
  border: 3px solid #ffffff;
}

.language-continue-bar {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 24px 0 calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 30%);
}

.language-continue-bar .lime-button {
  width: 100%;
  font-size: calc(var(--text-3) * var(--scale));
}

/* ------------------------------------------------------------------------ */
/* bottom section bar                                                        */
/* ------------------------------------------------------------------------ */

.section-nav {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  gap: 4px;
  width: min(calc(100% - 24px), 520px);
  padding: 8px;
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  transform: translateX(-50%);
}

body.high-contrast .section-nav {
  border: 2px solid var(--line);
}

.section-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  padding: 8px 4px;
  border-radius: 24px;
  color: var(--ink-2);
  text-align: center;
}

.section-nav-label {
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
  line-height: 1.1;
}

.section-nav-item-active {
  background: var(--forest);
  color: var(--on-forest);
}

.section-nav-item-active .section-nav-label {
  font-weight: 800;
}

/* ------------------------------------------------------------------------ */
/* scroll hint                                                               */
/* ------------------------------------------------------------------------ */

/* right-aligned and small, so it points at more without sitting on a tile */
.scroll-hint {
  position: fixed;
  right: 16px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--forest);
  color: var(--on-forest);
  font-size: 1rem;
  font-weight: 800;
  box-shadow: var(--shadow-float);
}

body:not(.has-section-bar) .scroll-hint {
  bottom: calc(18px + env(safe-area-inset-bottom));
}

/* ------------------------------------------------------------------------ */
/* symptoms, rights, next step                                               */
/* ------------------------------------------------------------------------ */

.next-step-bar {
  position: sticky;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 15;
  padding-top: 8px;
}

.next-step-bar .primary-button {
  width: 100%;
  box-shadow: var(--shadow-float);
}

.interpreter-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  max-width: 26rem;
  padding: 16px 24px;
  border-radius: var(--radius-tile);
  background: var(--forest);
  color: var(--on-forest);
}

.interpreter-card-label,
.interpreter-card-note {
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
}

.interpreter-number {
  font-size: calc(var(--text-6) * var(--scale));
  font-weight: 900;
  letter-spacing: 0.01em;
}

.free-translation {
  margin-top: 32px;
  padding: 16px;
  border-radius: var(--radius-tile);
  background: var(--surface);
}

.free-translation-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.free-translation-row .search-field {
  flex: 1 1 260px;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  color: var(--ink-3);
}

.search-field input {
  width: 100%;
  min-height: 60px;
  padding: 0 16px 0 44px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 600;
}

.search-field input:focus {
  border-color: var(--forest);
  outline: none;
}

.translation-result {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.translation-source {
  font-size: calc(var(--text-2) * var(--scale));
  font-weight: 800;
}

.translation-divider {
  height: 1px;
  margin: 12px 0;
  background: var(--line);
}

.translation-output {
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 600;
}

.translation-warning {
  margin-top: 12px;
  color: var(--ink-3);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.hospitals-location-prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 16px 16px;
  border-radius: var(--radius-tile);
  background: var(--surface);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 700;
}

.hospitals-location-prompt .secondary-button {
  background: var(--lime);
  color: var(--tile-ink);
}

/* ------------------------------------------------------------------------ */
/* settings                                                                  */
/* ------------------------------------------------------------------------ */

.settings-row {
  display: block;
  padding: 16px;
  border-radius: var(--radius-tile);
  background: var(--surface);
}

body.high-contrast .settings-row {
  border: 2px solid var(--line);
}

.settings-label {
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 800;
}

.settings-hint {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.settings-row input[type="range"] {
  flex: 1;
  accent-color: var(--forest);
  min-height: 44px;
}

.size-preview {
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--mint);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 700;
}

.toggle {
  position: relative;
  flex-shrink: 0;
  width: 76px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--line);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 150ms ease;
}

.toggle[aria-pressed="true"] {
  background: var(--forest);
}

.toggle[aria-pressed="true"]::after {
  transform: translateX(32px);
  background: var(--on-forest);
}

.rate-options,
.detail-option-row,
.body-chart-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(96px, 100%), 1fr));
  gap: 12px;
  margin-top: 12px;
}

.rate-option,
.detail-option,
.body-chart-figure-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tap-size);
  padding: 12px 12px;
  border: 0;
  border-radius: var(--radius-button);
  background: var(--surface-2);
  color: var(--ink);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 800;
  text-align: center;
}

.detail-option,
.body-chart-figure-option {
  background: var(--surface);
}

body.high-contrast .rate-option,
body.high-contrast .detail-option,
body.high-contrast .body-chart-figure-option {
  border: 2px solid var(--line);
}

.rate-option[aria-pressed="true"],
.detail-option.is-chosen,
.body-chart-figure-option.is-chosen {
  background: var(--forest);
  color: var(--on-forest);
}

.detail-option-english {
  opacity: 0.75;
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
}

.detail-section {
  margin-top: 24px;
}

/* ------------------------------------------------------------------------ */
/* body chart (US 6.1)                                                       */
/*                                                                           */
/* The drawing is public-domain artwork (frontend/assets/body/PROVENANCE.md);  */
/* the sizing rules below decide how big a tappable area ends up, and        */
/* project-tests/body-chart-tests.js measures them. Change with care.        */
/* ------------------------------------------------------------------------ */

.body-chart-figures {
  max-width: 22rem;
  margin: 16px 0 16px;
}

.body-chart-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.body-chart-figure {
  flex: 1 1 300px;
  min-width: 260px;
  max-width: 400px;
  padding: 16px 8px;
  border-radius: var(--radius-hero);
  background: #ffffff;
}

.body-chart-side {
  flex: 1 1 300px;
  min-width: 260px;
}

.body-chart {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  max-height: 70vh;
  min-height: 320px;
}

/* multiply keeps the line work visible through the colour, and the blend sits
   on the group so two chosen areas that meet do not compound */
.body-chart-tints {
  mix-blend-mode: multiply;
  opacity: 0.9;
}

.body-chart-tint {
  fill: var(--lime);
  opacity: 0;
}

.body-chart-tint.is-chosen {
  opacity: 1;
}

.body-chart-target {
  fill: transparent;
  cursor: pointer;
}

/* in screen pixels, not viewBox units */
.body-chart-target:focus-visible {
  outline: none;
  fill: rgba(31, 58, 21, 0.16);
  stroke: #1f3a15;
  stroke-width: 3;
  stroke-dasharray: 8 6;
  vector-effect: non-scaling-stroke;
}

.body-chart-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.body-chart-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 92px;
  padding: 16px 16px;
  border: 0;
  border-radius: var(--radius-tile);
  background: var(--mint);
  color: var(--ink);
  text-align: left;
}

.body-chart-tile.is-chosen {
  background: var(--forest);
  color: var(--on-forest);
}

body.high-contrast .body-chart-tile {
  border: 3px solid #ffffff;
  color: #000000;
}

.body-chart-tile-native {
  font-size: calc(var(--text-2) * var(--scale));
  font-weight: 800;
  line-height: 1.2;
}

.body-chart-tile-english {
  opacity: 0.78;
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
}

.english-interface .body-chart-tile-english,
.english-interface .body-chart-choice-english {
  display: none;
}

.body-chart-choices {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.body-chart-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tap-size);
  padding: 8px 8px 8px 16px;
  border-radius: var(--radius-button);
  background: var(--surface);
}

.body-chart-choice-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.body-chart-choice-native {
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 800;
}

.body-chart-choice-english {
  color: var(--ink-3);
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
}

/* AC 6.1.2 - a full-size target for taking one area off */
.body-chart-remove {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
  font-size: calc(var(--text-2) * var(--scale));
  font-weight: 800;
  line-height: 1;
}

.body-chart-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.body-chart-actions .primary-button {
  flex: 1 1 240px;
}

@media (max-width: 640px) {
  .body-chart-layout {
    gap: 16px;
  }

  .body-chart-figure,
  .body-chart-side {
    flex-basis: 100%;
    max-width: none;
  }
}

/* ------------------------------------------------------------------------ */
/* summary (AC 6.3.1 / 6.3.2)                                                */
/* ------------------------------------------------------------------------ */

.summary-card {
  margin-top: 16px;
  padding: 8px 16px;
  border-radius: var(--radius-hero);
  background: var(--surface);
}

body.high-contrast .summary-card {
  border: 2px solid var(--line);
}

.summary-line {
  padding: 16px 0;
}

.summary-line + .summary-line {
  border-top: 1px solid var(--line);
}

.summary-label {
  color: var(--ink-3);
  font-size: calc(1rem * var(--scale));
  font-weight: 800;
}

.summary-line-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.summary-line-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-line .card-native-text {
  font-size: calc(var(--text-3) * var(--scale));
}

.summary-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--tap-size);
  height: var(--tap-size);
  border: 0;
  border-radius: 50%;
  background: var(--lime);
  color: var(--tile-ink);
}

.summary-play.is-unavailable {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ------------------------------------------------------------------------ */
/* welcome                                                                   */
/* ------------------------------------------------------------------------ */

.landing {
  min-height: 100dvh;
}

.landing-hero {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: var(--board-measure);
  margin: 0 auto;
  padding: calc(32px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
}

.landing-wordmark {
  font-size: var(--text-4);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.landing-hero h1 {
  margin-top: 8px;
  font-size: clamp(2.6rem, 11vw, 3.6rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.landing-lede {
  max-width: 30rem;
  color: var(--ink-2);
  font-size: var(--text-1);
  font-weight: 600;
}

.landing-preview .phrase-hero {
  padding: 24px 16px 16px;
}

.landing-preview .phrase-hero-icon {
  width: 84px;
  height: 84px;
}

.landing-preview .phrase-hero-native {
  font-size: var(--text-5);
}

.landing-preview .phrase-hero-english-text {
  font-size: var(--text-2);
}

.landing-cta {
  width: 100%;
  font-size: var(--text-3);
}

.landing-footer {
  color: var(--ink-3);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ------------------------------------------------------------------------ */
/* body-first flow: tell us what's wrong, and did you mean                   */
/* ------------------------------------------------------------------------ */

.tell-card {
  padding: 24px 16px;
  border-radius: var(--radius-hero);
  background: var(--surface);
}

body.high-contrast .tell-card,
body.high-contrast .match-said {
  border: 2px solid var(--line);
}

.page-wrap .tell-heading {
  font-size: calc(var(--text-3) * var(--scale));
  font-weight: 800;
  line-height: 1.15;
}

.tell-card .note {
  margin-top: 4px;
}

.tell-card .search-tools {
  margin-top: 16px;
  justify-content: flex-start;
}

.tell-card .search-entry,
.tell-card .concern-review {
  flex: 1 1 260px;
  width: auto;
}

.tell-card .search-entry .search-field {
  flex: 1 1 220px;
  width: auto;
}

.tell-card .concern-review {
  margin-top: 16px;
}

.tell-card .body-chart-figures {
  margin-top: 16px;
}

.tell-card .body-chart-figure {
  background: var(--surface-2);
}

.tell-or {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--ink-3);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tell-or::before,
.tell-or::after {
  content: "";
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: var(--line);
}

.match-said {
  padding: 16px 16px 8px;
  border-radius: var(--radius-tile);
  background: var(--surface);
}

.match-said-label {
  color: var(--ink-3);
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
}

.match-said-text {
  margin-top: 2px;
  font-size: calc(var(--text-2) * var(--scale));
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.match-said .text-button {
  justify-content: flex-start;
  padding: 0;
  border: 0;
  background: transparent;
}

.match-label {
  margin-bottom: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.75);
  color: var(--tile-ink);
  font-size: calc(1rem * var(--scale));
  font-weight: 800;
}

.match-label.is-best {
  background: var(--forest);
  color: var(--on-forest);
}

.match-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.summary-play-all {
  margin-top: 16px;
}

.summary-edit .section-title:first-child {
  margin-top: 8px;
}

/* saved details under the English in show mode: the screen stays white in
   every theme, so the panel carries its own colours */

/* a phrase Gemini wrote: dashed edge and its own label, never mistaken for a
   checked card */
.written-tile {
  border: 3px dashed var(--line);
}

.match-label.is-written {
  background: var(--surface-2);
  color: var(--ink);
}

.written-section .note {
  margin-top: 8px;
}

.written-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
}

.voice-search-message {
  max-width: 14rem;
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
  text-align: center;
}

.voice-search-message:empty {
  display: none;
}

.voice-search.busy .voice-search-button {
  background: var(--surface-2);
  color: var(--ink);
}

/* one written phrase at a time, so it takes the full width, and the label
   keeps clear of the speaker in the corner */
.written-section .card-grid,
.page-wrap.extra-wide .written-section .card-grid {
  grid-template-columns: 1fr;
}

.match-tile .match-label {
  max-width: calc(100% - 44px);
}

/* ------------------------------------------------------------------------ */
/* ac 7.1.5 - typical time in ed                                             */
/* ------------------------------------------------------------------------ */
.hospital-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 8px;
}

.hospital-card-actions .lime-button,
.ed-time-panel .lime-button {
  width: 100%;
  padding: 0 16px;
  font-size: calc(var(--text-1) * var(--scale));
}

.staff-phrase-card {
  width: 100%;
  min-height: var(--tap-size);
  cursor: pointer;
}

.ed-time-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}

.ed-time-panel p {
  margin: 0;
}

.ed-time-hospital {
  color: var(--ink-2);
  font-weight: 700;
}

/* the person's language first and biggest; english under it for staff */
.ed-time-native {
  font-size: calc(var(--text-3) * var(--scale));
  font-weight: 800;
}

.ed-time-english {
  padding-top: 8px;
  border-top: 2px solid var(--ink-3);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 700;
}

body.high-contrast .ed-time-panel {
  border: 3px solid #ffffff;
}

/* ac 7.2.1 - what staff may say ------------------------------------------- */

.staff-phrases-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--tap-size);
  margin: 20px 0 8px;
  padding: 16px 20px;
  border-radius: var(--radius-tile);
  background: var(--lime);
  color: var(--tile-ink);
  text-decoration: none;
}

.staff-phrases-link:hover { background: var(--lime-press); }

.staff-phrases-link-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.staff-phrases-link-text strong { font-size: calc(1.3rem * var(--scale)); font-weight: 900; }
.staff-phrases-link-text span { font-size: calc(1rem * var(--scale)); font-weight: 700; }

.staff-group-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0 16px;
}

.staff-group-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  border: 2px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 800;
  text-decoration: none;
}

.staff-group-tab.is-selected {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--on-forest);
}

.staff-phrase-list {
  display: grid;
  gap: 12px;
}

.staff-phrase {
  border-radius: var(--radius-tile);
  background: var(--surface);
  overflow: hidden;
}

.staff-phrase-play {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-height: var(--tap-size);
  padding: 16px 64px 12px 24px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.staff-phrase-play.playing { box-shadow: inset 0 0 0 3px var(--forest); border-radius: var(--radius-tile); }

.staff-phrase-native {
  font-size: calc(var(--text-3) * var(--scale));
  font-weight: 800;
  line-height: 1.3;
}

.staff-phrase-english {
  color: var(--ink-2);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 600;
}

.staff-phrase-source {
  margin: 0;
  padding: 0 24px 12px;
  color: var(--ink-3);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.staff-phrase-source summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-2);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.staff-phrase-source a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
}

.staff-phrase-credit {
  margin-top: 24px;
  color: var(--ink-3);
  font-size: calc(1rem * var(--scale));
}

.staff-phrase-credit a { color: inherit; display: inline-flex; align-items: center; min-height: 44px; }

/* epic 9 - health warnings (flu, heat, thunderstorm asthma) ---------------- */

/* the banner uses the peach "danger" family the urgent tiles use, with the
   warning triangle and the words, so it is never colour alone */
.warning-banners {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.warning-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--tap-size);
  padding: 16px 16px;
  border-radius: var(--radius-tile);
  background: var(--peach);
  color: var(--tile-ink);
  text-decoration: none;
}

.warning-banner > svg { flex-shrink: 0; }

.warning-banner-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: var(--icon-red);
}

.warning-banner-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.warning-banner-text strong { font-size: calc(var(--text-1) * var(--scale)); font-weight: 900; }

.warning-banner-body {
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 700;
  line-height: 1.35;
}

.warning-banner-english,
.warning-banner-updated {
  color: var(--tile-ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.warnings-link {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--tap-size);
  margin-top: 12px;
  padding: 16px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius-tile);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
}

.warnings-link-title { font-size: calc(var(--text-1) * var(--scale)); font-weight: 800; }

.warning-status {
  margin: 12px 0 4px;
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 800;
  line-height: 1.4;
}

.warning-status-english {
  margin: 0 0 4px;
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.warning-status-link { margin: 4px 0 8px; font-weight: 700; }

.warning-pollen {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--mint);
  font-weight: 700;
}

.warning-why {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.warning-why summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 800;
  cursor: pointer;
}

.warning-why p {
  margin: 8px 0;
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  line-height: 1.5;
}

.warning-group { margin-top: 24px; }
.warning-group h2 { margin: 0 0 2px; font-size: calc(var(--text-2) * var(--scale)); }

.warning-card {
  border-radius: var(--radius-tile);
  background: var(--surface);
  overflow: hidden;
}

.warning-card-urgent { border: 3px solid var(--icon-red); }

.warning-card-play {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-height: var(--tap-size);
  padding: 16px 64px 12px 24px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.warning-card-play[disabled] { cursor: default; }
.warning-card-play[disabled] .tile-speaker { opacity: 0.5; }
.warning-card-play.playing { box-shadow: inset 0 0 0 3px var(--forest); border-radius: var(--radius-tile); }

.warning-card-native { font-size: calc(var(--text-3) * var(--scale)); font-weight: 800; line-height: 1.3; }
.warning-card-english { color: var(--ink-2); font-size: calc(var(--text-1) * var(--scale)); font-weight: 600; }

.warning-days {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 8px;
}

.warning-days-label { width: 100%; margin: 0; font-weight: 700; }

.warning-day {
  min-width: 48px;
  min-height: 48px;
  border: 2px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 800;
  cursor: pointer;
}

.warning-day.is-selected {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--on-forest);
}

.warning-card-note,
.warning-card-draft {
  margin: 0;
  padding: 0 24px 12px;
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.warning-card-draft { font-style: italic; }

.warning-call {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin: 0 24px 12px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  background: var(--icon-red);
  color: #ffffff;
  font-weight: 900;
  text-decoration: none;
}

body.high-contrast .warning-banner,
body.high-contrast .warning-card {
  border: 3px solid #ffffff;
}

/* ac 7.1.2 - staff speak english ----------------------------------------- */

.staff-speak {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-tile);
  background: var(--surface);
}

.staff-speak-hint {
  margin: 0 0 12px;
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.staff-speak-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.staff-speak-button {
  flex: none;
  border: 0;
  cursor: pointer;
}

.staff-speak.listening .staff-speak-button {
  background: var(--forest);
  color: var(--on-forest);
  box-shadow: 0 0 0 12px var(--mint);
}

.staff-speak.busy .staff-speak-button { opacity: 0.75; }

.staff-speak-label {
  font-size: calc(1.1rem * var(--scale));
  font-weight: 800;
}

.staff-speak-message:empty { display: none; }

.staff-speak-message {
  margin: 10px 0 0;
  color: var(--ink-2);
  font-weight: 700;
}

.staff-speech-review-label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 800;
}

.staff-speech-text {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border: 2px solid var(--forest);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: calc(1.2rem * var(--scale));
  font-weight: 700;
  resize: vertical;
}

.staff-speech-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.staff-speech-actions .secondary-button {
  border: 2px solid var(--line);
}

.staff-speech-confirmed {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.staff-speech-confirmed-label {
  margin: 0;
  color: var(--ink-3);
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
}

.staff-speech-confirmed-text {
  margin: 4px 0 10px;
  font-size: calc(1.5rem * var(--scale));
  font-weight: 900;
  line-height: 1.25;
}

.staff-speech-note {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-weight: 600;
}

.staff-speech-confirmed .interpreter-call-button {
  display: inline-flex;
  text-decoration: none;
}

body.high-contrast .staff-speak,
body.high-contrast .staff-speech-text {
  border: 3px solid #ffffff;
}

/* ac 7.2.2 - staff type english, checked wording first -------------------- */

.staff-type {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-tile);
  background: var(--surface);
}

.staff-type-hint {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.staff-type-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 800;
}

.staff-type-text {
  width: 100%;
  min-height: 72px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: calc(1.15rem * var(--scale));
  font-weight: 700;
  resize: vertical;
}

.staff-type-text:focus {
  border-color: var(--forest);
  outline: none;
}

.staff-type-translate {
  margin-top: 10px;
  border: 2px solid var(--line);
}

.staff-type-result:empty { display: none; }

.staff-type-result {
  margin-top: 14px;
}

.staff-type-checked-title {
  margin: 0 0 10px;
  font-weight: 800;
}

.staff-phrase.is-checked-match {
  border: 2px solid var(--forest);
}

.checked-badge {
  display: inline-block;
  margin: 12px 0 0 20px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--forest);
  color: var(--on-forest);
  font-size: calc(1rem * var(--scale));
  font-weight: 800;
}

.staff-own-words {
  margin-top: 12px;
  border: 2px solid var(--line);
}

.staff-type-note,
.staff-type-message {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.staff-type-unavailable {
  padding: 14px 16px;
  border: 2px solid var(--peach);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.staff-type-unavailable p { margin: 0 0 8px; }

.staff-type-unavailable .interpreter-call-button {
  display: inline-flex;
  text-decoration: none;
}

body.high-contrast .staff-type,
body.high-contrast .staff-phrase.is-checked-match {
  border: 3px solid #ffffff;
}

/* ac 7.1.1 - typed staff text, two labelled lines ------------------------- */

.staff-translation {
  display: grid;
  gap: 10px;
}

.staff-translation-line {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.staff-translation-line.is-native {
  border: 2px dashed var(--ink-3);
}

.staff-translation-label {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  margin: 0 0 6px;
  color: var(--ink-3);
  font-size: calc(1rem * var(--scale));
  font-weight: 800;
}

.not-checked-label {
  padding: 1px 10px;
  border-radius: var(--radius-pill);
  background: var(--peach);
  color: var(--tile-ink);
}

.staff-translation-native {
  margin: 0 0 10px;
  font-size: calc(1.5rem * var(--scale));
  font-weight: 900;
  line-height: 1.3;
}

.staff-translation-english {
  margin: 0;
  font-size: calc(1.1rem * var(--scale));
  font-weight: 700;
}

.staff-translation-play {
  border: 2px solid var(--line);
}

.staff-translation-play svg {
  width: 22px;
  height: 22px;
}

/* ac 7.2.3 - languages people nearby need --------------------------------- */

.area-languages {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--mint);
  color: var(--ink);
}

.area-languages-label {
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
}

.area-languages-names {
  font-size: calc(1.05rem * var(--scale));
  font-weight: 800;
}

.area-languages-source {
  color: var(--ink-3);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

body.high-contrast .area-languages {
  border: 2px solid #ffffff;
  color: #ffffff;
}
/* epic 8 - practise phrases ----------------------------------------------- */

.practise-link { margin-top: 10px; }

.practise-round {
  display: grid;
  gap: 14px;
}

.practise-progress {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0;
  font-weight: 800;
}

.practise-count {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.practise-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 18px;
  border-radius: var(--radius-hero);
  background: var(--mint);
  text-align: center;
}

.practise-picture {
  display: grid;
  place-items: center;
  width: 144px;
  height: 144px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--forest);
}

.practise-native {
  margin: 6px 0 0;
  font-size: calc(2rem * var(--scale));
  font-weight: 900;
  line-height: 1.2;
}

.practise-english {
  margin: 0 0 6px;
  color: var(--ink-2);
  font-size: calc(1.15rem * var(--scale));
  font-weight: 700;
}

.practise-play .speaker-icon svg {
  width: 24px;
  height: 24px;
}

.practise-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.practise-controls .secondary-button {
  border: 2px solid var(--line);
  text-decoration: none;
}

.practise-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 18px;
  border-radius: var(--radius-hero);
  background: var(--mint);
  text-align: center;
}

.practise-done-mark {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--on-forest);
}

.practise-done-title {
  margin: 0;
  font-size: calc(1.6rem * var(--scale));
  font-weight: 900;
}

.practise-done-note { margin: 0; font-weight: 700; color: var(--ink-2); }

body.high-contrast .practise-card,
body.high-contrast .practise-done {
  border: 3px solid #ffffff;
}

/* in english the phrase and its english are the same words */
body.english-interface .practise-english { display: none; }

/* ac 8.2.1 - listen and choose -------------------------------------------- */

.practise-choose {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: var(--radius-hero);
  background: var(--surface);
}

.practise-question {
  margin: 0;
  font-size: calc(1.2rem * var(--scale));
  font-weight: 800;
}

.practise-play { border: 2px solid var(--line); }

.practise-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.practise-choice {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 3px solid var(--line);
  border-radius: var(--radius-tile);
  background: var(--mint);
  color: var(--forest);
  cursor: pointer;
}

.practise-choice:disabled { cursor: default; }
.practise-choice.is-right { border-color: var(--forest); box-shadow: 0 0 0 3px var(--lime); }
.practise-choice.is-wrong { border-color: var(--red); opacity: 0.75; }
.practise-choice.is-out { opacity: 0.45; }

.practise-tick {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--on-forest);
}

.practise-result { margin: 0; font-weight: 800; }
.practise-result.is-right { font-size: calc(1.3rem * var(--scale)); color: var(--forest); }
.practise-result.is-wrong p { margin: 0 0 8px; }

.practise-answer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--forest);
  border-radius: var(--radius-sm);
  background: var(--mint);
  color: var(--ink);
}

.practise-answer > span:last-child { display: flex; flex-direction: column; }
.practise-answer-native { font-size: calc(1.3rem * var(--scale)); font-weight: 900; }
.practise-answer-english { color: var(--ink-2); font-weight: 700; }
body.english-interface .practise-answer-english { display: none; }

body.high-contrast .practise-choice { border-color: #ffffff; }

/* ac 8.2.2 - say it and get feedback -------------------------------------- */

.practise-say {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: var(--radius-hero);
  background: var(--surface);
}


.practise-mic-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 6px 0;
}

.practise-mic { flex: none; border: 0; cursor: pointer; }

.practise-say.listening .practise-mic {
  background: var(--forest);
  color: var(--on-forest);
  box-shadow: 0 0 0 12px var(--mint);
}

.practise-mic-label {
  font-size: calc(1.1rem * var(--scale));
  font-weight: 800;
}

.practise-said {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  font-weight: 700;
}

.practise-said.is-good { border-color: var(--forest); background: var(--mint); }
.practise-said.is-try-again { border-color: var(--peach); }
.practise-said p { margin: 0; }

.practise-said-label { color: var(--ink-3); font-size: calc(1rem * var(--scale)); }
.practise-said-words { font-size: calc(1.2rem * var(--scale)); font-weight: 800; }

.practise-said-verdict {
  margin-top: 6px !important;
  font-size: calc(1.4rem * var(--scale));
  font-weight: 900;
}

/* ac 2.2.1 - the phone has no voice for the person's language */
.no-voice-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 6px;
  padding: 12px 14px;
  border: 2px solid var(--peach);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
  line-height: 1.4;
}

.no-voice-notice > svg {
  flex: none;
  margin-top: 2px;
  color: var(--icon-red);
}

.no-voice-notice p {
  margin: 0;
}

.no-voice-notice .no-voice-english {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.no-voice-call {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 8px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--red);
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
}

/* ac 1.4.2 - shown recently, on home */
.recently-shown {
  margin-top: 18px;
}

.recently-shown .section-title {
  margin: 0 0 4px;
}

.recently-shown .note {
  margin: 0 0 12px;
}

.recent-list {
  display: grid;
  gap: 8px;
}

.recent-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap-size);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: transform 120ms ease;
}

.recent-tile:active {
  transform: scale(0.98);
}

.recent-tile-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--icon-red);
}

.tone-white .recent-tile-icon {
  background: var(--peach);
}

.recent-tile-text {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.recent-tile .tile-native {
  font-size: calc(1.15rem * var(--scale));
}

.recent-tile .tile-english {
  font-size: calc(1rem * var(--scale));
}

.recent-tile-show {
  flex: none;
  opacity: 0.7;
}

/* ac 7.1.4 - one-tap replies --------------------------------------------- */

.quick-replies {
  padding: 16px;
  border: 2px solid var(--forest);
  border-radius: var(--radius-tile);
  background: var(--surface-2);
}

.quick-replies .section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 0;
}

.quick-replies-english {
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.quick-replies .page-hint {
  margin: 4px 0 12px;
}

.quick-reply-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-reply-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: var(--tap-size);
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius-button);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.quick-reply-button.is-interpreter {
  grid-column: 1 / -1;
  background: var(--peach);
  border-color: var(--peach);
  color: var(--tile-ink);
}

.quick-reply-button.is-selected {
  border-color: var(--forest);
  box-shadow: inset 0 0 0 2px var(--forest);
}

.quick-reply-native {
  font-size: calc(1.2rem * var(--scale));
  font-weight: 800;
}

.quick-reply-english {
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
}

.quick-reply-result:empty { display: none; }

.quick-reply-result {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.quick-reply-shown {
  margin: 0;
  font-size: calc(2rem * var(--scale));
  font-weight: 900;
  line-height: 1.2;
}

.quick-reply-shown-native {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: calc(1.1rem * var(--scale));
  font-weight: 700;
}

.quick-reply-result .interpreter-call-button {
  display: inline-flex;
  margin-top: 12px;
  text-decoration: none;
}

body.high-contrast .quick-replies,
body.high-contrast .quick-reply-button {
  border: 3px solid #ffffff;
}

/* ac 2.3.1 - all phrases, by group */
.phrasebook-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--tap-size);
  margin: 20px 0 8px;
  padding: 16px 20px;
  border: 2px solid var(--line);
  border-radius: var(--radius-tile);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.phrasebook-link + .staff-phrases-link {
  margin-top: 0;
}

/* nine groups: two short columns, so the phrases start on the first screen */
.phrasebook-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 6px;
}

.phrasebook-tab {
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 6px 10px 6px 16px;
  font-size: calc(1rem * var(--scale));
  line-height: 1.2;
  text-align: start;
}

.page-wrap.extra-wide .phrasebook-tabs {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
}

.phrasebook-count {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 800;
}

.staff-group-tab.is-selected .phrasebook-count {
  background: var(--on-forest);
  color: var(--forest);
}

/* ac 2.1.1 - key words checked against a trusted reference */
.phrase-checked {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 4px 0;
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 700;
  line-height: 1.35;
}

.phrase-checked > svg {
  flex: none;
  margin-top: 1px;
  color: var(--ink);
}

.phrase-checked a {
  color: inherit;
}

/* ac 8.1.1 / 8.1.3 - rank, reason and why this order */
.practise-rank {
  flex: 0 0 auto;
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 800;
  font-size: calc(1.05rem * var(--scale));
}

.practise-reason {
  display: block;
  margin-top: 4px;
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  font-weight: 500;
  line-height: 1.4;
}

.practise-why ul {
  margin: 4px 0 8px;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: calc(1rem * var(--scale));
  line-height: 1.5;
}

.practise-set .home-action-text { text-align: left; }
.practise-set { gap: 10px; }

/* ac 3.2.1 - pictures on the tabs, body tiles, figure choice and settings */
.staff-group-tab { max-width: 100%; }
/* a long group name (italian, vietnamese) breaks inside the tab, never out of it */
.phrasebook-tab-label { flex: 1; min-width: 0; overflow-wrap: break-word; hyphens: auto; }
.staff-group-tab .icon { flex: 0 0 auto; }
.body-chart-tile-icon { display: inline-flex; margin-bottom: 4px; }
.settings-row-icon { display: inline-flex; flex: 0 0 auto; color: var(--ink-2); }
.settings-row .flex-row > div { flex: 1; }
/* ui 4 - a 320px phone or the phone's biggest text must never push the page
   sideways. Long words break, and flex children may shrink below their text. */
body {
  overflow-wrap: break-word;
}

/* zero specificity, so any rule that sets its own min-width still wins */
:where(body *) {
  min-width: 0;
  max-width: 100%;
}

.search-tools,
.search-entry,
.header-bar > *,
.section-nav-item {
  max-width: 100%;
}

.search-tools {
  flex-shrink: 1;
}

.section-nav {
  gap: 2px;
}

.section-nav-item {
  padding: 8px 2px;
}

/* ui 4 - the switch was invisible when off (It1 Test 10 02:09): outline it,
   darken the knob, and say On or Off in words beside it */
.toggle {
  border: 3px solid var(--ink-2);
  background: var(--surface);
}

.toggle::after {
  top: 2px;
  left: 2px;
  background: var(--ink-2);
}

.toggle[aria-pressed="true"] {
  border-color: var(--forest);
}

.toggle-state {
  flex-shrink: 0;
  margin-left: auto;
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 800;
}

/* ui 4 - iPhones only pass their text size setting (Dynamic Type) to pages
   that ask for the system body font; every rem then follows it */
@supports (font: -apple-system-body) {
  html {
    font: -apple-system-body;
  }
}

/* ui 10 - room for the bottom tabs and the Next bar, so anything scrolled
   into view lands above them rather than under them */
html {
  scroll-padding-bottom: calc(190px + env(safe-area-inset-bottom));
}

/* ui 6 - four square tiles, one per way to show the problem. aspect-ratio
   keeps them square; they still grow when the text is big. */
.show-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.show-tile-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.show-tile {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  aspect-ratio: 1;
  min-height: var(--tap-size);
  padding: 16px;
  border: 0;
  border-radius: var(--radius-hero);
  background: var(--show-tile-bg, #e2f4da);
  color: var(--tile-ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(17, 19, 17, 0.06), 0 10px 24px -18px rgba(17, 19, 17, 0.55);
  transition: transform 0.13s, box-shadow 0.13s;
}

.show-tile:active { transform: scale(0.97); box-shadow: none; }

/* fixed light colours with dark ink, like .tone-mint, so all four read the
   same in light and dark mode */
.show-tile-speak { --show-tile-bg: #f7c29a; }
.show-tile-type { --show-tile-bg: #d6e6fa; }
.show-tile-point { --show-tile-bg: #e2f4da; }
.show-tile-pick { --show-tile-bg: #ebe3fa; }


.show-tile-label {
  font-size: calc(var(--text-2) * var(--scale));
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.show-tile:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.voice-search.listening .show-tile {
  outline: 4px solid var(--icon-red);
  outline-offset: 3px;
  animation: show-tile-listen 1.2s ease-in-out infinite;
}

@keyframes show-tile-listen {
  50% { outline-offset: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .show-tile { transition: none; }
  .voice-search.listening .show-tile { animation: none; }
}

.show-tiles + .tell-card { margin-top: 16px; }

body.high-contrast .show-tile { border: 3px solid #ffffff; box-shadow: none; }

.show-tile .voice-search-label { color: var(--art-deep); }

/* ======================================================================== */
/* phrasebook - the app as a bilingual pocket phrasebook                    */
/*                                                                          */
/* Each section has its own cover cloth colour. The header sits on the      */
/* cover; the page is a sheet laid on it. The bottom bar is the book's      */
/* thumb index: every tab wears its section colour, the open one is raised. */
/* Red stays for Call 000 only, so no cover is red.                         */
/* ======================================================================== */

:root {
  --cover-problem: #141513;
  --cover-phrases: #157a75;
  --cover-nearby: #2e4fb8;
  --cover-warnings: #e8b21e;
  --cover-none: #4c5563;
  --cover-ink-dark: #24140d;
  --cover: #141513;
  --cover-ink: #ffffff;
}

/* The default stays light even when the phone uses dark mode. Older and
   low-tech users get the same calm, familiar canvas on every device. The
   Settings high-contrast option remains the deliberate dark experience. */
:root:root {
  --cover: #f4f2ec;
  --cover-ink: #18211b;
  --sheet: #fbfaf6;
  color-scheme: light;
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #e8ebe5;
  --ink: #18211b;
  --ink-2: #3f4b43;
  --ink-3: #59645c;
  --line: #cbd1ca;
  --mint: #e2f4da;
  --forest: #387a45;
  --on-forest: #ffffff;
  --shadow-float: 0 14px 32px -18px rgba(34, 48, 39, 0.34);
}

html:has(body[data-section]),
body[data-section],
body[data-section] .app-header {
  background: var(--cover);
}

body[data-section] .brand {
  color: var(--cover-ink);
  font-weight: 900;
}

/* the header buttons are white stickers on the cover */
body[data-section] .back-button,
body[data-section] .settings-link,
body[data-section] .language-chip {
  background: #ffffff;
  color: var(--tile-ink);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}

/* the sheet: the page laid on the cover, with the thumb-index notches
   peeking over its top edge */
body[data-section] .page-wrap {
  position: relative;
  min-height: calc(100dvh - 76px - env(safe-area-inset-top));
  margin-top: 12px;
  padding-top: 24px;
  border-radius: 30px 30px 0 0;
  background: var(--sheet);
  box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.06), 0 -14px 30px -24px rgba(0, 0, 0, 0.5);
}

body[data-section] .page-wrap::before {
  content: "";
  position: absolute;
  top: -9px;
  right: 26px;
  width: 132px;
  height: 12px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(90deg,
    var(--cover-problem) 0 25%, var(--cover-phrases) 25% 50%,
    var(--cover-nearby) 50% 75%, var(--cover-warnings) 75% 100%);
  pointer-events: none;
}

/* the phrasebook entry: the person's words big, a fine rule, the English */
.english-subtitle {
  display: inline-block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  letter-spacing: 0.01em;
}

/* Call 000 gets a white sticker edge so it stands off any page or cover */
.call-tile {
  box-shadow: 0 0 0 4px #ffffff, 0 10px 22px -12px rgba(120, 20, 18, 0.7);
}

/* stamped pictograms: a dashed ring inside each icon disc, like an ink stamp */
.call-tile-icon,
.home-action-icon,
.warning-banner-icon {
  outline: 2px dashed color-mix(in srgb, currentColor 40%, transparent);
  outline-offset: -7px;
}

/* the four tiles: a tab notch on top, as if each could be torn out */
.show-tile-speak { --show-tile-bg: #ffd9c7; --art-spot: #ffbfa3; --art-accent: #ef7a3b; --art-deep: #9a3d10; }
.show-tile-type { --show-tile-bg: #dceafd; --art-spot: #bcd6fb; --art-accent: #3d74d6; --art-deep: #1d3f86; }
.show-tile-point { --show-tile-bg: #def3d4; --art-spot: #bfe6ae; --art-accent: #3f9a52; --art-deep: #1e5a2b; }
.show-tile-pick { --show-tile-bg: #ebe3fb; --art-spot: #d5c6f6; --art-accent: #7d5bd0; --art-deep: #45297f; }

/* the drawing fills most of the tile; the words sit under it */
.show-tile {
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px 16px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.7), transparent 60%),
    var(--show-tile-bg);
  box-shadow:
    inset 0 0 0 1.5px color-mix(in srgb, var(--art-deep) 18%, transparent),
    0 2px 0 color-mix(in srgb, var(--art-deep) 22%, transparent),
    0 14px 26px -18px color-mix(in srgb, var(--art-deep) 80%, transparent);
}

.show-tile-art {
  display: block;
  flex: 1;
  min-height: 0;
  color: #1b1d1a;
}

.show-tile-art svg {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 150px;
  margin: 0 auto;
}

.show-tile-label {
  color: var(--art-deep);
  font-size: calc(var(--text-2) * var(--scale));
}

@media (prefers-reduced-motion: no-preference) {
  .show-tile-art svg { transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .show-tile:hover .show-tile-art svg { transform: translateY(-3px) rotate(-2deg); }
}

body.high-contrast .show-tile {
  background: #000000;
  box-shadow: none;
}

body.high-contrast .show-tile-art { color: #ffffff; }
body.high-contrast .show-tile-label { color: #ffffff; }
body.high-contrast .show-tile { --art-spot: #000000; --art-accent: #ffff00; --art-deep: #ffffff; }

.show-tile::after {
  content: "";
  position: absolute;
  top: 0;
  right: 22px;
  width: 36px;
  height: 12px;
  border-radius: 0 0 8px 8px;
  background: color-mix(in srgb, var(--show-tile-bg) 70%, #24140d);
  opacity: 0.55;
}

/* thumb index: every tab carries its section colour on top; the open tab is
   filled with it */
body[data-section] .section-nav {
  background: #ffffff;
  color: var(--tile-ink);
}

.section-nav-item[data-section="home"],
.section-nav-item[data-section="symptoms"] { --tab: var(--cover-problem); --tab-ink: #ffffff; }
.section-nav-item[data-section="phrases"] { --tab: var(--cover-phrases); --tab-ink: #ffffff; }
.section-nav-item[data-section="nearby"] { --tab: var(--cover-nearby); --tab-ink: #ffffff; }

body[data-section] .section-nav-item {
  color: var(--tile-ink);
  box-shadow: inset 0 5px 0 var(--tab, var(--line));
}

body[data-section] .section-nav-item-active {
  background: var(--tab, var(--forest));
  color: var(--tab-ink, var(--on-forest));
  box-shadow: none;
  transform: translateY(-4px);
}

@media (prefers-reduced-motion: no-preference) {
  body[data-section] .section-nav-item { transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1); }
}

/* high contrast: the book goes black and white; colour never carries meaning
   on its own here */
body.high-contrast[data-section],
html:has(body.high-contrast[data-section]),
body.high-contrast[data-section] .app-header,
body.high-contrast[data-section] .page-wrap,
body.high-contrast[data-section] .section-nav {
  background: #000000;
  box-shadow: none;
}

body.high-contrast[data-section] .brand,
body.high-contrast[data-section] .section-nav-item { color: #ffffff; box-shadow: none; }
body.high-contrast[data-section] .page-wrap::before,
body.high-contrast .show-tile::after { display: none; }
body.high-contrast[data-section] .section-nav-item-active { background: #ffffff; color: #000000; }

/* the SOSpeak logo: S, a red heart with a cross for the O, S, peak. Red
   through "SOS", the cover's ink through "peak" */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-size: calc(var(--brand-size) * 1.05);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
}

.brand-heart {
  height: calc(var(--brand-size) * 0.92);
  width: auto;
  margin: 0 1px;
}

.brand-word-sos { color: var(--brand-red); }
.brand-word-peak { color: var(--cover-ink, var(--ink)); }

/* The brand red stays deep enough to read on the light cover. */
body[data-section] .brand-word-sos,
body[data-section] .brand-heart { --brand-red: #c9403e; color: #c9403e; }

body.high-contrast .brand-word-sos,
body.high-contrast .brand-heart { --brand-red: #ffff00; color: #ffff00; }

/* ------------------------------------------------------------------------ */
/* change 2 - one pastel family for every card. Each pastel has one job and */
/* its own deep text colour (all pass 4.5:1 on their pastel).               */
/*   peach  urgent phrases, the Speak tile, heat                            */
/*   mint   body symptoms and regions, the Point tile                       */
/*   sky    rights and staff phrases, the Type tile, flu                    */
/*   lilac  written and suggested phrases, the Pick tile, storm asthma      */
/*   lime   the one "do this next" action (Play, Next, Continue)            */
/* ------------------------------------------------------------------------ */

:root:root {
  --pastel-peach: #ffd3bf;
  --pastel-mint: #d4efc7;
  --pastel-sky: #d6e6fb;
  --pastel-lilac: #e6dcfa;
  --ink-peach: #7a2e0c;
  --ink-mint: #1e5a2b;
  --ink-sky: #1d3f86;
  --ink-lilac: #45297f;
  --peach: var(--pastel-peach);
  --lime: #bfe98f;
  --lime-press: #ade07a;
}

.tone-peach { background: var(--pastel-peach); color: var(--ink-peach); }
.tone-mint { background: var(--pastel-mint); color: var(--ink-mint); }
.tone-white { background: var(--pastel-sky); color: var(--ink-sky); }
.written-tile.tone-white { background: var(--pastel-lilac); color: var(--ink-lilac); }

.show-tile-speak { --show-tile-bg: var(--pastel-peach); --art-deep: var(--ink-peach); }
.show-tile-type { --show-tile-bg: var(--pastel-sky); --art-deep: var(--ink-sky); }
.show-tile-point { --show-tile-bg: var(--pastel-mint); --art-deep: var(--ink-mint); }
.show-tile-pick { --show-tile-bg: var(--pastel-lilac); --art-deep: var(--ink-lilac); }

/* staff phrases are sky, like the rights phrases they sit beside */
.staff-phrase { background: var(--pastel-sky); }
.staff-phrase-play,
.staff-phrase-english,
.staff-phrase-source { color: var(--ink-sky); }
.staff-phrase-english { opacity: 0.85; }

/* health warnings: each warning has its own pastel and picture */
[data-warning="flu"] {
  --w-bg: var(--pastel-sky); --w-ink: var(--ink-sky);
  --art-spot: #bcd6fb; --art-accent: #3d74d6; --art-deep: #1d3f86;
}
[data-warning="heat"] {
  --w-bg: var(--pastel-peach); --w-ink: var(--ink-peach);
  --art-spot: #ffbfa3; --art-accent: #ef7a3b; --art-deep: #9a3d10;
}
[data-warning="asthma"] {
  --w-bg: var(--pastel-lilac); --w-ink: var(--ink-lilac);
  --art-spot: #d5c6f6; --art-accent: #7d5bd0; --art-deep: #45297f;
}

.warning-card[data-warning],
.warning-banner[data-warning],
.warning-row[data-warning] {
  background: var(--w-bg);
  color: var(--w-ink);
}

.warning-card[data-warning] .warning-card-play,
.warning-card[data-warning] .warning-card-english,
.warning-card[data-warning] .warning-card-note,
.warning-card[data-warning] .warning-card-draft,
.warning-banner[data-warning] .warning-banner-english,
.warning-banner[data-warning] .warning-banner-updated,
.warning-row .home-action-note {
  color: inherit;
}

.warning-card[data-warning] .warning-card-english,
.warning-row .home-action-note { opacity: 0.85; }

.warning-art { display: block; flex-shrink: 0; color: #1b1d1a; }
.warning-art svg { display: block; width: 100%; height: 100%; }

.warning-banner-icon.warning-art {
  width: 60px;
  height: 60px;
  background: transparent;
  outline: none;
}

.warning-row .warning-art { width: 60px; height: 60px; }

/* the Home link: a quiet card that carries the three pictures */
.warnings-link {
  border: 1px solid var(--line);
  background: var(--surface);
}

.warnings-link-art { display: flex; flex-shrink: 0; }

.warnings-link-art .warning-art {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--surface);
}

.warnings-link-art .warning-art + .warning-art { margin-left: -12px; }

body.high-contrast [data-warning] { --w-bg: #000000; --w-ink: #ffffff; --art-spot: #000000; --art-accent: #ffff00; --art-deep: #ffffff; }
body.high-contrast .warning-art { color: #ffffff; }
body.high-contrast .staff-phrase { background: #000000; border: 3px solid #ffffff; }
body.high-contrast .staff-phrase-play,
body.high-contrast .staff-phrase-english,
body.high-contrast .staff-phrase-source { color: #ffffff; }

/* at 78% the English line fell under 4.5:1 on peach and mint; 88% clears it */
.tile-english { opacity: 0.88; }

/* change 3 - a card's icon takes the card's own deep colour on a white
   stamped disc, so red is left for Call 000 and urgent warnings */
.tile-icon {
  background: #ffffff;
  outline: 2px dashed color-mix(in srgb, currentColor 40%, transparent);
  outline-offset: -7px;
}
.tone-peach .tile-icon { color: var(--ink-peach); }
.tone-mint .tile-icon { color: var(--ink-mint); }
.tone-white .tile-icon { background: #ffffff; color: var(--ink-sky); }
.written-tile .tile-icon { color: var(--ink-lilac); }

body.high-contrast .tile-icon { background: #000000; color: #ffffff; outline-color: #ffffff; }

/* the speak buttons say what to do next under their label: "Tap, then
   speak", then "Tap here when you finish" while listening */
.show-tile-words {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.voice-search-hint {
  color: var(--ink-2);
  font-size: calc(var(--text-1) * var(--scale));
  font-weight: 700;
  line-height: 1.2;
}

.show-tile .voice-search-hint {
  color: var(--art-deep);
  opacity: 0.88;
}

.voice-search.listening .voice-search-hint,
.voice-search.busy .voice-search-hint {
  opacity: 1;
  font-weight: 900;
}

body.high-contrast .voice-search-hint { color: #ffffff; opacity: 1; }

/* ------------------------------------------------------------------------ */
/* change 4 - two shadow levels and one hairline edge                       */
/*   rest   every card and tile sitting on the page                         */
/*   float  only what hovers over the page (bottom bar, scroll hint)        */
/*   edge   a faint 1px line so dark cards keep their shape on the dark page */
/* Focus rings, the "now playing" highlight and high contrast are untouched. */
/* ------------------------------------------------------------------------ */

:root:root {
  --edge: 1px solid rgba(24, 33, 27, 0.12);
  --edge-strong: 1px solid rgba(24, 33, 27, 0.24);
  --shadow-rest: 0 1px 2px rgba(34, 48, 39, 0.08), 0 10px 24px -18px rgba(34, 48, 39, 0.3);
  --shadow-float: 0 16px 38px -20px rgba(34, 48, 39, 0.4);
}

/* cards and tiles rest on the page */
.communication-card,
.phrase-tile,
.staff-phrase,
.warning-card,
.summary-card,
.match-said,
.tell-card,
.white-button,
.secondary-button,
.detail-option,
.warning-banner,
.warnings-link {
  box-shadow: var(--shadow-rest);
}

.show-tile { box-shadow: var(--shadow-rest); }
.show-tile:active { box-shadow: none; }

/* dark cards also get the hairline, so their edge shows on the dark sheet */
.white-button,
.secondary-button,
.tell-card,
.match-said,
.summary-card,
.warnings-link,
.detail-option:not(.is-chosen) {
  border: var(--edge);
}

/* the header buttons were white stickers from the light theme */
body[data-section] .back-button,
body[data-section] .settings-link,
body[data-section] .language-chip {
  border: var(--edge-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

/* the bottom bar floats: dark, with the hairline and the float shadow; the
   coloured tab caps and the filled open tab stay */
body[data-section] .section-nav {
  border: var(--edge);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-float);
}

body[data-section] .section-nav-item { color: var(--ink-2); }

/* Call 000: no white sticker ring; its own deeper red edge and the rest shadow */
.call-tile {
  border: 1px solid #8f2a28;
  box-shadow: var(--shadow-rest);
}

/* controls keep a boundary people can see (3:1): inputs on a clear 2px line,
   tabs and day buttons on the stronger hairline */
.concern-review input,
.search-field input {
  border: 2px solid var(--ink-3);
}

.staff-group-tab,
.warning-day {
  border: var(--edge-strong);
}

body.high-contrast .communication-card,
body.high-contrast .phrase-tile,
body.high-contrast .staff-phrase,
body.high-contrast .warning-card,
body.high-contrast .show-tile,
body.high-contrast .call-tile,
body.high-contrast[data-section] .section-nav { box-shadow: none; }
body.high-contrast .call-tile { border: 3px solid #ffffff; }
body.high-contrast[data-section] .back-button,
body.high-contrast[data-section] .settings-link,
body.high-contrast[data-section] .language-chip { background: #000000; color: #ffffff; border: 2px solid #ffffff; }

/* 11 Oct 2026 redesign. One frame, one measure, and an 18px text floor. */
:root:root {
  --text-1: 1rem;
  --text-2: 1.111rem;
  --text-3: 1.333rem;
  --text-4: 1.556rem;
  --text-5: 1.889rem;
  --text-6: 2.222rem;
  --page-measure: 44rem;
  --board-measure: 44rem;
  --cards-measure: 44rem;
  --sky: #dceeff;
  --lilac: #eee4ff;
  --orange: #ffd7a8;
}

html { font-size: 18px; }

.page-wrap,
.page-wrap.board,
.page-wrap.wide,
.page-wrap.extra-wide {
  width: min(100%, var(--page-measure));
  max-width: var(--page-measure);
  padding: 16px 20px 40px;
}

body[data-section] .page-wrap {
  min-height: 0;
  margin-top: 0;
  padding-top: 16px;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
}

body[data-section] .page-wrap::before { display: none; }
body.home-screen.has-section-bar { padding-bottom: 0; }
body.home-screen.has-section-bar:has(.recently-shown) {
  padding-bottom: calc(108px + env(safe-area-inset-bottom));
}

.app-header {
  border-top: 10px solid var(--surface-2);
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
}

body[data-section="symptoms"] .app-header { border-top-color: var(--peach); }
body[data-section="phrases"] .app-header { border-top-color: var(--sky); }
body[data-section="nearby"] .app-header { border-top-color: var(--mint); }
body[data-section="practise"] .app-header { border-top-color: var(--lilac); }
body[data-section="warnings"] .app-header { border-top-color: var(--orange); }

.header-bar {
  max-width: var(--page-measure);
  min-height: 68px;
}

.header-page-title {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: var(--text-2);
  font-weight: 900;
  line-height: 1.12;
}

.header-actions { gap: 8px; }

.header-read-button,
.header-call-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  border: 2px solid var(--line);
  border-radius: var(--radius-button);
  background: var(--surface);
  padding: 0 14px;
  font-size: 1rem;
  font-weight: 900;
}

.header-call-button {
  border-color: var(--red);
  background: var(--red);
  color: #ffffff;
}

.home-screen .page-wrap { padding-top: 4px; }

.home-screen .call-tile {
  min-height: 60px;
  padding: 8px 16px;
}

.home-screen .call-tile-text {
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}

.home-screen .call-tile-title { font-size: var(--text-2); }
.home-screen .call-tile-note { font-size: 1rem; }

.page-wrap h1.home-question {
  margin-top: 16px;
  font-size: var(--text-3);
}

.home-screen .home-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-door {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  border: 2px solid var(--line);
  border-radius: var(--radius-tile);
  padding: 12px 14px;
  background: var(--surface);
  box-shadow: none;
}

.home-door:hover,
.home-door:focus-visible { border-color: var(--forest); }
.home-door:active { transform: translateY(1px); }
.home-door-symptoms { border-left: 8px solid var(--forest); }
.home-door-symptoms { grid-column: 1 / -1; }

.home-door .home-action-icon {
  width: 48px;
  height: 48px;
  background: var(--forest);
  color: var(--on-forest);
}

.home-door > .icon { position: static; color: var(--ink-2); }

.home-door .home-action-title { color: var(--ink); font-size: var(--text-1); line-height: 1.2; }
.home-door .home-action-note { color: var(--ink-2); line-height: 1.3; opacity: 1; }

.journey-choice-card {
  border: 2px solid var(--line);
  border-radius: var(--radius-tile);
  background: var(--surface);
  padding: 18px;
}

.journey-choice-title { margin: 0; font-size: var(--text-2); }
.journey-choice-note { margin: 4px 0 16px; color: var(--ink-2); }

.home-screen .recently-shown { margin-top: 16px; }

.visit-summary {
  border: 2px solid var(--line);
  border-radius: var(--radius-button);
  background: var(--surface);
  overflow: hidden;
}

.visit-summary-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 8px 14px;
  cursor: pointer;
  list-style: none;
}

.visit-summary-row::-webkit-details-marker { display: none; }
.visit-summary-icon { display: inline-flex; align-items: center; justify-content: center; }
.visit-summary-text { display: grid; min-width: 0; line-height: 1.2; }
.visit-summary-text span { color: var(--ink-2); }
.visit-summary[open] .visit-summary-row > .icon { transform: rotate(90deg); }
.visit-summary-detail { display: grid; gap: 12px; border-top: 1px solid var(--line); padding: 14px; }
.visit-summary-detail .section-title { margin: 0; }

.section-nav { max-width: 28rem; }

@media (max-width: 700px) {
  .header-bar { gap: 8px; }
  .header-page-title {
    display: block;
    flex: 1 1 0;
    font-size: 1rem;
    line-height: 1.08;
  }
  .header-actions { flex: 0 0 auto; }
  .header-read-button span { display: none; }
  .header-read-button,
  .header-call-button { min-width: 56px; padding: 0 10px; }

  .home-screen .home-actions { gap: 8px; }
  .home-door {
    grid-template-columns: 40px minmax(0, 1fr);
    align-content: center;
    min-height: 86px;
    gap: 8px;
    padding: 8px 10px;
  }
  .home-door-symptoms { grid-template-columns: 44px minmax(0, 1fr) 22px; }
  .home-door:not(.home-door-symptoms) > .icon { display: none; }
  .home-door:not(.home-door-symptoms) .home-action-note { display: none; }
  .home-door .home-action-icon { width: 40px; height: 40px; }
  .home-door .home-action-title { font-size: 1rem; }
  /* the four smaller doors put the icon above the title, so a long word like
     "understand" or "esercitati" gets the whole tile width instead of
     breaking in the middle */
  .home-door:not(.home-door-symptoms) {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    justify-items: start;
    gap: 6px;
  }
  .home-door:not(.home-door-symptoms) .home-action-icon { width: 36px; height: 36px; }

  .practise-set .home-action-icon { display: none; }
}

@media (max-width: 360px) {
  .page-wrap,
  .page-wrap.board,
  .page-wrap.wide,
  .page-wrap.extra-wide { padding-inline: 12px; }
  .home-door { min-height: 88px; padding-inline: 8px; }
  /* on the narrowest phones the call label sits above its note, so
     "chiama il 000" is not cut in the middle of a word */
  .home-screen .call-tile-text { flex-direction: column; align-items: flex-start; gap: 2px; }

  body:not(.home-screen):not(.language-screen) .header-bar {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 8px;
  }

  body:not(.home-screen):not(.language-screen) .back-button { grid-column: 1; grid-row: 1; }
  body:not(.home-screen):not(.language-screen) .header-actions { grid-column: 3; grid-row: 1; }
  body:not(.home-screen):not(.language-screen) .header-page-title {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    padding: 4px 0 6px;
  }
}

/* the Home tab's cap and fill were black (the old Home cover); on the dark
   bar it needs to be light to show */
.section-nav-item[data-section="home"],
.section-nav-item[data-section="symptoms"] { --tab: #f1f2ee; --tab-ink: #141513; }

body[data-section] .section-nav-item-active {
  background: #f1f2ee;
  color: #141513;
}

body[data-section] .section-nav-item-active .section-nav-label {
  color: #141513;
}

/* "impostazioni" is wider than a third of the bar on a phone, so the italian
   labels shrink with the screen (still growing with the text size setting)
   instead of splitting the word */
html[lang="it"] .section-nav-label {
  font-size: min(calc(1rem * var(--scale)), calc(4.1vw * var(--scale)));
  hyphens: auto;
}

/* ui 7 - Show to staff at the top of the summary, and the summary shown full
   screen: each line in English for the staff member, the person's words under */
.summary-show {
  width: 100%;
  min-height: var(--tap-size);
  font-size: calc(var(--text-3) * var(--scale));
}

.show-summary {
  gap: 0;
  padding: 24px 24px 32px;
}

.show-summary-row {
  padding: 16px 0;
  border-bottom: 1px solid #d6d8d1;
}

.show-summary .show-label { color: #3f433d; }

.show-summary .show-english {
  font-size: calc(var(--text-5) * var(--scale));
}

.show-summary-native {
  margin-top: 4px;
  color: #3f433d;
  font-size: calc(var(--text-2) * var(--scale));
  font-weight: 700;
}

.show-summary .show-close { margin-top: 24px; }

/* the symptom cards that now sit under the body chart */
.body-chart-symptoms { margin-top: 24px; }
.body-chart-symptoms .section-title { margin-bottom: 12px; }

.symptom-entry {
  padding: 16px;
  border-radius: var(--radius-hero);
  background: var(--peach);
}

.symptom-primary-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.symptom-primary-choices > * { min-width: 0; }
.symptom-primary-choices .symptom-entry { display: grid; align-content: center; }
.symptom-primary-choices .inline-body-chart[open] { grid-column: 1 / -1; }
.symptom-primary-choices .inline-body-chart:not([open]) > summary { min-height: 100%; }

.symptom-entry .search-tools { margin: 0; }
.symptom-entry .voice-search-button { width: 88px; height: 88px; }

.symptom-voice-entry { display: grid; justify-items: center; gap: 12px; }
.symptom-voice-entry .voice-search { display: grid; justify-items: center; gap: 6px; width: 100%; }
.symptom-mic-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 104px;
  height: 104px;
  border: 4px solid #8f3f22;
  border-radius: 50%;
  background: #fff7f1;
  color: #6c2b16;
}
.symptom-mic-button .icon { width: 44px; height: 44px; }
.symptom-voice-entry .voice-search-label {
  color: #351800;
  font-size: var(--text-2);
  font-weight: 900;
}
.symptom-voice-entry .voice-search-hint { color: #351800; }
.symptom-type-link {
  min-height: 56px;
  padding-inline: 18px;
  background: #f1f2ee;
  color: #141513;
}
.symptom-type-entry { width: 100%; }

.symptom-match {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  border: 2px solid #c97843;
  border-radius: var(--radius-hero);
  background: #fff7f1;
  padding: 18px;
  color: #2a160f;
}
.symptom-match .match-said-text { margin: 0; }
.symptom-match-question { margin: 4px 0 0; font-size: var(--text-2); font-weight: 900; }
.symptom-match-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  border-radius: var(--radius-button);
  background: #ffffff;
  padding: 12px;
}
.symptom-match-card .tile-english { grid-column: 2; }
.symptom-match-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.symptom-match-actions > * { min-width: 0; }

.symptom-common-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
}

.symptom-common-grid .phrase-tile { min-height: 128px; }

.inline-body-chart {
  border: 2px solid #c97843;
  border-radius: var(--radius-tile);
  background: var(--surface);
  overflow: hidden;
}

.inline-body-chart > summary {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  list-style: none;
  cursor: pointer;
}

.inline-body-chart > summary::-webkit-details-marker { display: none; }
.inline-body-chart[open] > summary { border-bottom: 2px solid var(--line); }
.inline-body-chart .body-figure-switch { margin: 16px; }
.inline-body-chart .body-chart-layout { padding: 0 16px 16px; }

.interpreter-hero {
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 2px solid #71a8d4;
  border-radius: var(--radius-hero);
  background: var(--sky);
}

.interpreter-card-note { color: #2a160f; }
.staff-tell-section > .section-title { color: #2a160f; }

.interpreter-play,
.interpreter-number {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: var(--tap-size);
  border: 2px solid var(--ink);
  border-radius: var(--radius-button);
  background: var(--surface);
  font-size: var(--text-2);
  font-weight: 900;
  text-align: center;
}

.interpreter-number { background: var(--ink); color: var(--surface); }
.staff-tell-section { padding: 16px; border-radius: var(--radius-hero); background: var(--sky); }

/* The title lives in the shared header. Keep the route h1 in the document for
   older tests and assistive tools, but do not print the same title twice. */
.frame-heading {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.page-frame-helper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 16px;
  color: var(--ink-2);
  font-weight: 700;
}

.page-info-button {
  display: inline-flex;
  flex: 0 0 56px;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
}

.offline-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  border: 2px solid #a64b00;
  border-radius: var(--radius-button);
  background: var(--orange);
  padding: 12px 16px;
  color: #351800;
  font-weight: 800;
}

.how-sheet {
  width: min(calc(100% - 24px), 38rem);
  max-height: calc(100dvh - 24px);
  margin: auto auto 0;
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
  color: var(--ink);
  box-shadow: var(--shadow-float);
}

.how-sheet::backdrop { background: rgba(10, 14, 12, 0.72); }
.how-sheet-handle { width: 64px; height: 6px; margin: 0 auto 18px; border-radius: 99px; background: var(--ink-3); }
.how-sheet h2 { margin: 0 0 20px; font-size: var(--text-4); }
.how-sheet-points { display: grid; gap: 12px; }
.how-sheet-point {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  border-radius: var(--radius-button);
  background: var(--surface-2);
  padding: 8px 14px;
  font-weight: 800;
}
.how-sheet-picture { display: inline-flex; align-items: center; justify-content: center; }
.how-sheet-privacy { margin: 20px 0; font-weight: 800; }
.how-sheet .primary-button { width: 100%; }

.practise-missed-list {
  display: grid;
  gap: 8px;
  width: 100%;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.practise-missed-list li {
  border-radius: var(--radius-button);
  background: var(--surface-2);
  padding: 12px 16px;
  font-weight: 800;
}

@media (max-width: 420px) {
  .symptom-common-grid { grid-template-columns: 1fr 1fr; }
  .symptom-common-grid .phrase-tile { min-height: 112px; padding: 12px; }
}
