:root {
  /* Surfaces */
  --surface: #ffffff;
  --surface-low: #f4f6f5;
  --surface-high: #e7ece9;
  --surface-lowest: #ffffff;
  --overlay: rgba(12, 15, 14, 0.7);
  --overlay-strong: rgba(12, 15, 14, 0.82);

  /* Colors */
  --primary: #1f5f4a;
  --primary-dim: #174838;
  --primary-underline: #1f6f4a;
  --on-primary: #faf7f6;
  --on-surface: #111111;
  --on-surface-variant: #343a38;
  --chat-assistant: #e8f3ee;
  --chat-assistant-border: #b9d3c7;
  --chat-user: #f7e6a8;
  --chat-user-border: #d1b95f;
  --outline-variant: #6f7773;
  --outline-soft: rgba(173, 179, 176, 0.35);
  --outline-muted: rgba(173, 179, 176, 0.25);
  --outline-grid: rgba(173, 179, 176, 0.2);
  --outline-medium: rgba(173, 179, 176, 0.45);
  --control-fill: rgba(173, 179, 176, 0.5);
  --track: rgba(173, 179, 176, 0.75);
  --error: #9f403d;

  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --font-serif: var(--font-sans);

  /* Layout */
  --gutter: 1.25rem;
  --bottom-bar-space: 7.5rem;

  /* Effects */
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.16);
  --shadow-panel: 0 10px 30px rgba(0, 0, 0, 0.15);
  --shadow-strong: 0 1px 3px rgba(0, 0, 0, 0.615);
}

body[data-mode="regular"] {
  --scale: 1;
}

body[data-mode="larger"] {
  --scale: 1.5;
}

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

/* body modes */
body.surface {
  margin: 0;
  min-height: 100vh;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-sans);
  overflow-x: hidden;
}

body[data-onboarding-open] {
  overflow: hidden;
}

body[data-tutorial-open] {
  overflow: hidden;
}

body[data-settings-open] {
  overflow: hidden;
}

.app-shell {
  min-height: 100dvh;
  font-size: calc(1rem * var(--scale));
}

html[data-uppercase-text],
body[data-uppercase-text],
[data-uppercase-text] {
  text-transform: uppercase !important;
}

html[data-uppercase-text] body *:not(.material-symbols-outlined),
body[data-uppercase-text] *:not(.material-symbols-outlined),
[data-uppercase-text] *:not(.material-symbols-outlined) {
  text-transform: uppercase !important;
}

html[data-uppercase-text] ::placeholder,
body[data-uppercase-text] ::placeholder,
[data-uppercase-text] ::placeholder {
  text-transform: uppercase !important;
}

html[data-uppercase-text] .material-symbols-outlined,
body[data-uppercase-text] .material-symbols-outlined,
[data-uppercase-text] .material-symbols-outlined {
  text-transform: none !important;
}

button,
input,
select {
  font: inherit;
}

/* typography helpers */
.headline {
  font-family: var(--font-serif);
  font-size: calc(2.2rem * var(--scale));
  line-height: 1.1;
  margin: 0 0 0.6rem;
}

.body-lg {
  font-size: calc(1rem * var(--scale));
}

.muted {
  color: var(--on-surface-variant);
}

.eyebrow {
  font-size: calc(0.9rem * var(--scale));
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.eyebrow,
.section-label,
.app-title,
.btn-primary,
.btn-secondary {
  letter-spacing: 0;
  text-transform: none;
}

/* screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Onboarding overlay */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(24px);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  z-index: 2000;
  overflow: hidden;
}

.onboarding-panel {
  background: var(--surface-lowest);
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  padding: 2.5rem clamp(2rem, 6vw, 7rem) 2rem;
  overflow-y: auto;
}

.onboarding-header {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--outline-muted);
  margin-bottom: 1.5rem;
}

.onboarding-body {
  display: flex;
  flex-direction: column;
  gap: 2.1rem;
}

.onb-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.intro-text {
  font-size: calc(1rem * var(--scale));
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0.75rem 0 1rem 0;
  padding: 0.75rem 0;
}

.section-label {
  letter-spacing: 0.18em;
  font-size: calc(1rem * var(--scale));
  font-weight: 600;
  margin: 0;
  color: var(--on-surface-variant);
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--outline-variant);
  background: var(--surface-lowest);
}

.accessibility-category {
  font-size: calc(0.9rem * var(--scale));
  font-weight: 500;
  color: var(--text-secondary, #666);
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}

.onb-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--outline-grid);
}

.age-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  flex-direction: row;
}

.card {
  background: var(--surface-lowest);
  padding: 0.8rem 0.9rem 0.9rem;
  border: none;
  cursor: pointer;
  text-align: left;
}

.card,
.chip,
.toggle-row,
.context-box,
.chat-panel,
.input-shell {
  border: 1.5px solid var(--outline-variant);
}

.card:hover {
  background: var(--surface-low);
}

.card-title {
  font-family: var(--font-serif);
  font-size: calc(1rem * var(--scale));
  margin: 0 0 0.2rem;
}

.card-pictogram,
.option-pictogram {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
  color: var(--primary);
  background: var(--surface-low);
  border: 1px solid var(--outline-soft);
}

.card-pictogram {
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.45rem;
  font-size: calc(1.65rem * var(--scale));
}

.option-pictogram {
  width: 2.6rem;
  height: 2.6rem;
  font-size: calc(1.55rem * var(--scale));
}

.card-subtitle {
  font-size: calc(0.8rem * var(--scale));
  margin: 0;
  color: var(--on-surface-variant);
}

.card-subtitle,
.hint-muted,
.helper-text {
  font-size: calc(1rem * var(--scale));
  line-height: 1.5;
}

/* radio selected state */
.radio-card[aria-checked="true"],
.radio-chip[aria-checked="true"] {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: #e3dfd9;
}


/* chips for age */
.chip {
  display: flex;
  flex-direction: column; 
  align-items: flex-start;
  gap: 8px; 
  background: var(--surface-lowest);
  padding: 0.8rem;
  border: none;
  font-size: calc(1.1rem * var(--scale));
  text-align: left;
  font-weight: 500;
  font-family: var(--font-serif);
  cursor: pointer;
  border: 1.5px solid var(--outline-variant);
}

.chip:hover {
  background: var(--surface-low);
}

/* SVG flag in lang cards */
.flag svg {
  width: 2.2rem;
  height: 1.5rem;
  display: block;
  margin-bottom: 0.35rem;
}

/* SVG icons in persona cards */
.card-icon {
  width: 3.2rem;
  height: 3.2rem;
  color: var(--on-surface-variant);
  margin-bottom: 0.35rem;
  display: block;
}

.radio-card[aria-checked="true"] .card-icon {
  color: var(--primary);
}

/* SVG icons in age chips */
.chip-icon {
  width: 2.2rem;
  height: 2.2rem;
  color: var(--on-surface-variant);
  margin-bottom: 0.2rem;
  display: inline-block;
}

.age-title {
  display: inline-block;
}

.radio-chip[aria-checked="true"] .chip-icon {
  color: var(--primary);
}

.onb-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--outline-muted);
}

.hint-muted {
  font-style: italic;
  font-size: calc(0.85rem * var(--scale));
  color: var(--on-surface-variant);
  margin: 0;
}

.onboarding-step[hidden] {
  display: none;
}

.step-header {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 0.1rem;
}

.step-count {
  font-size: calc(0.85rem * var(--scale));
  color: var(--on-surface-variant);
  margin: 0;
}

.step-bar {
  width: 100%;
  height: 5px;
  background: var(--surface-high);
  border-radius: 999px;
  overflow: hidden;
}

.step-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.step-help {
  margin: 0;
  font-size: 0.95rem;
}

.onb-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.onb-actions > button {
  flex: 1;
}

.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-soft);
  cursor: pointer;
  font-size: calc(1rem * var(--scale));
}

.toggle-row:hover {
  background: var(--surface-low);
}

.toggle-row input {
  margin-top: 0.45rem;
  inline-size: 1.35rem;
  block-size: 1.35rem;
  flex: 0 0 auto;
}

.toggle-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.toggle-content > span {
  font-weight: 700;
  line-height: 1.25;
}

.info-block {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
  background: var(--surface-low);
  border: 1px solid var(--outline-soft);
  font-size: calc(1rem * var(--scale));
}

.info-block p {
  margin: 0;
  line-height: 1.5;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  background: var(--overlay);
}

.settings-overlay[hidden] {
  display: none;
}

.settings-panel {
  width: min(42rem, 100%);
  height: 100dvh;
  background: var(--surface-lowest);
  border-left: 2px solid var(--outline-variant);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--outline-soft);
}

.settings-title {
  margin: 0;
  font-size: calc(1.5rem * var(--scale));
  line-height: 1.2;
}

.settings-help {
  margin: 0.35rem 0 0;
  color: var(--on-surface-variant);
  font-size: calc(1rem * var(--scale));
  line-height: 1.45;
}

.settings-close-btn {
  flex: 0 0 auto;
  border-radius: 0;
  box-shadow: none;
}

.settings-body {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 1rem;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--outline-grid);
}

.settings-grid.age-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.settings-footer {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--outline-soft);
  background: var(--surface-lowest);
}

.settings-footer .btn-primary,
.settings-footer .btn-secondary {
  width: 100%;
  min-height: 3.75rem;
  height: auto;
  padding: 0.75rem 1rem;
  font-size: calc(1rem * var(--scale));
  line-height: 1.2;
  letter-spacing: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.consent-row {
  margin-top: 0.8rem;
}

/* Buttons base */
.btn-primary,
.btn-secondary {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  border: 1px solid var(--outline-soft);
}

.btn-primary {
  background: linear-gradient(120deg, var(--primary), var(--primary-dim));
  color: var(--on-primary);
  height: 2.9rem;
  padding: 0 1.6rem;
  font-weight: 600;
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn-secondary {
  background: var(--surface-low);
  color: var(--on-surface);
  height: 2.9rem;
  padding: 0 1.6rem;
}

.btn-secondary:hover {
  background: var(--surface-high);
}

.wide {
  width: 100%;
}

/* App shell */
.app-shell {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.45rem var(--gutter);
  background: rgba(249, 249, 247, 0.96);
  backdrop-filter: blur(16px);
}

.top-left {
  display: flex;
  margin: 0;
  flex-direction: row;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
  flex: 1 1 auto;
}

.brand-title {
  font-family: var(--font-sans);
  font-size: calc(1.25rem * var(--scale));
  line-height: 1.1;
  max-width: 42vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  order: 2;
  font-weight: 800;
}

.brand-title.eyebrow {
  font-size: calc(1.25rem * var(--scale));
  margin: 0;
}

.app-title {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  min-height: 2.35rem;
  border: 2px solid var(--outline-variant);
  background: var(--surface-lowest);
  padding: 0 0.7rem;
  font-family: var(--font-sans);
  font-size: calc(1.25rem * var(--scale));
  font-weight: 700;
  letter-spacing: 0;
  color: inherit;
  cursor: pointer;
  text-align: left;
  order: 1;
}

.help-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.35rem;
  border: 2px solid var(--outline-variant);
  background: var(--surface-lowest);
  padding: 0 0.7rem;
  color: inherit;
  cursor: pointer;
  font-weight: 700;
}

.help-btn .material-symbols-outlined {
  flex: 0 0 auto;
}

.help-btn:hover {
  background: var(--surface-low);
}

.help-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

.help-btn-text {
  font-size: calc(1rem * var(--scale));
}

.app-title:hover {
  text-decoration: underline;
  text-underline-offset: 0.25rem;
}

.app-title:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

/* language group */
.lang-group {
  display: flex;
  gap: 0.25rem;
}

.lang-btn {
  background: transparent;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}

.lang-btn.active {
  background: var(--surface-low);
  color: var(--on-surface);
}

/* ── AUDIO CONTROLS ───────────────────────────────────────── */
.top-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  min-width: 0;
  flex-wrap: wrap;
}

.audio-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0;
  flex-wrap: wrap;
}

.audio-group > * {
  min-width: 0;
}

.audio-settings-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 3rem;
  padding: 0 0.95rem;
  background: var(--primary);
  color: var(--on-primary);
  border: 1px solid var(--outline-soft);
  border-radius: 0;
  font-weight: 700;
  cursor: pointer;
}

.location-panel-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 3rem;
  padding: 0 0.95rem;
  background: var(--surface-low);
  color: var(--on-surface);
  border: 1px solid var(--outline-soft);
  border-radius: 0;
  font-weight: 700;
  cursor: pointer;
}

.volume-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--surface-low);
  border-radius: 2rem;
  padding: 0.32rem 0.75rem;
  min-height: 2.45rem;
  box-shadow: var(--shadow-xs);
}

.audio-label {
  color: var(--on-surface-variant);
  font-size: calc(0.88rem * var(--scale));
  font-weight: 600;
  white-space: nowrap;
}

.audio-toggle-btn {
  min-height: 2.45rem;
  padding: 0 0.85rem;
  font-size: calc(0.9rem * var(--scale));
  background: var(--surface-low);
  color: var(--on-surface-variant);
  border: 1px solid var(--outline-soft);
  border-radius: 2rem;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.audio-toggle-btn[aria-pressed="true"] {
  background: var(--primary);
  color: var(--on-primary);
}

.audio-toggle-btn:hover {
  background: var(--surface-high);
  color: var(--on-surface);
}

.audio-toggle-btn[aria-pressed="true"]:hover {
  background: var(--primary-dim);
  color: var(--on-primary);
}

.volume-icon {
  font-size: calc(1.05rem * var(--scale));
  color: var(--on-surface-variant);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 150px;
  height: 6px;
  border-radius: 999px;
  background: var(--track);
  outline: none;
  display: block;
}

.volume-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: var(--track);
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-lowest);
  border: 1px solid var(--track);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  margin-top: -6px;
}

.volume-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--track);
}

.volume-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-lowest);
  border: 1px solid var(--track);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.icon-btn {
  width: 2.7rem;
  height: 2.7rem;
  background: var(--surface-low);
  border-radius: 50%;
  color: var(--on-surface-variant);
  box-shadow: var(--shadow-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: calc(1rem * var(--scale));
  transition: background 0.15s;
  border: 1px solid var(--outline-soft);
}

.icon-btn:hover {
  background: var(--surface-high);
}

.icon-btn.is-listening {
  background: var(--error);
  color: var(--on-primary);
}

.icon-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

/* Speed controls */
.speed-wrap {
  display: inline-flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: flex-start;
}

.speed-group {
  display: flex;
  background: var(--control-fill);
  border-radius: 2rem;
  padding: 0.2rem;
  gap: 0.1rem;
}

.speed-btn {
  padding: 0.22rem 0.65rem;
  font-size: calc(0.9rem * var(--scale));
  font-family: var(--font-sans);
  background: none;
  color: var(--on-surface-variant);
  border-radius: 2rem;
  transition: background 0.15s, color 0.15s;
  border: none;
  cursor: pointer;
}

.speed-btn.active,
.speed-btn[aria-checked="true"] {
  background: var(--surface-lowest);
  color: var(--on-surface);
  box-shadow: var(--shadow-strong);
}

.speed-btn:hover {
  background: var(--surface-high);
}

/* Layout main */
.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 0.9fr);
  gap: 1rem;
  padding: 1rem var(--gutter) var(--bottom-bar-space);
  min-height: 0;
}

/* Chat panel */
.chat-panel {
  background: var(--surface-lowest);
  padding: 1rem 1.1rem 0.9rem;
  display: flex;
  flex-direction: column;
  min-height: 300px;
  max-height: calc(100vh - 210px);
  min-width: 0;
}

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 0.15rem 0.4rem 0.15rem 0;
}

.msg-row {
  display: flex;
  margin-bottom: 0.85rem;
}

.msg-row.assistant {
  justify-content: flex-start;
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-bubble {
  max-width: 62ch;
  font-size: calc(1.08rem * var(--scale));
  line-height: 1.65;
  padding: 0.85rem 1rem;
  border: 1px solid transparent;
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
  white-space: pre-wrap;
}

.assistant-bubble {
  background: var(--chat-assistant);
  border-color: var(--chat-assistant-border);
  border-bottom-left-radius: 4px;
  color: var(--on-surface);
}

.user-bubble {
  background: var(--chat-user);
  border-color: var(--chat-user-border);
  border-bottom-right-radius: 4px;
  color: var(--on-surface);
}

/* typing indicator */
#typing-indicator {
  display: none !important;
}

#typing-indicator.is-visible {
  display: inline-flex !important;
  gap: 0.22rem;
  height: 1rem;
  margin: 0.3rem 0;
}

#typing-indicator[hidden] {
  display: none !important;
}

#typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b3aa9b;
  animation: typing 1.2s infinite ease-in-out;
}

#typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}

#typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}

.chat-translation-status {
  align-self: flex-start;
  margin: 0.35rem 0 0.15rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--outline-medium);
  background: var(--surface-low);
  color: var(--on-surface-variant);
  font-size: calc(0.95rem * var(--scale));
  line-height: 1.35;
}

.chat-translation-status[hidden] {
  display: none;
}

@keyframes typing {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* suggestions */
.suggestion-row {
  margin-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.suggestion-btn {
  border: none;
  background: var(--surface-low);
  padding: 0.4rem 0.7rem;
  font-size: calc(0.8rem * var(--scale));
  cursor: pointer;
}

/* Context column */
.context-column {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.context-box {
  background: var(--surface-lowest);
  padding: 0.9rem 0.9rem 0.8rem;
  max-height: calc(100dvh - 8.5rem);
  overflow-y: auto;
}

.context-heading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: calc(0.95rem * var(--scale));
  margin: 0 0 0.7rem;
}

.context-heading-icon {
  flex: 0 0 auto;
  inline-size: 2.4rem;
  block-size: 2.4rem;
  font-size: calc(1.65rem * var(--scale));
  color: var(--on-primary);
  background: var(--primary);
  border: 1px solid var(--outline-medium);
}

.field-label {
  font-size: calc(0.8rem * var(--scale));
  margin: 0.5rem 0 0.1rem;
}

.field-select {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--control-fill);
  padding: 0.4rem 0;
  background: transparent;
  font-size: calc(0.9rem * var(--scale));
}

.field-help {
  font-size: calc(0.75rem * var(--scale));
  margin: 0.1rem 0 0;
}

.field-error {
  font-size: calc(0.8rem * var(--scale));
  color: var(--error);
  margin: 0.3rem 0 0;
}

.field-hint {
  font-size: calc(0.8rem * var(--scale));
  color: var(--on-surface-variant);
  margin: 0.5rem 0;
  font-style: italic;
}

.field-select[aria-invalid="true"] {
  border-bottom-color: var(--error);
}

.context-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.context-actions .btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: calc(0.9rem * var(--scale));
}

.context-actions [hidden] {
  display: none !important;
}

.manual-location-panel {
  margin-top: 0.8rem;
}

.manual-location-panel[hidden],
.qr-scanner[hidden],
.field-error[hidden] {
  display: none !important;
}

.qr-scanner {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.8rem;
  border: 2px solid var(--outline-variant);
  border-radius: 0.25rem;
  padding: 0.5rem;
  background: var(--surface-low);
}

.qr-scanner video {
  width: 100%;
  height: auto;
  border-radius: 0.25rem;
  background: #000;
  max-height: 300px;
  object-fit: contain;
}

.context-suggestion {
  margin-top: 0.5rem;
  font-size: calc(0.8rem * var(--scale));
  color: var(--on-surface-variant);
}

/* Tutorial */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  background: transparent;
  pointer-events: none;
}

.tutorial-overlay[hidden] {
  display: none;
}

.tutorial-panel {
  position: relative;
  z-index: 1100;
  width: min(44rem, 100%);
  max-height: min(28rem, calc(100dvh - 2rem));
  overflow: hidden;
  background: var(--surface-lowest);
  border: 2px solid var(--outline-variant);
  box-shadow: var(--shadow-panel);
  padding: 1.1rem;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
}

.tutorial-overlay[data-waiting-action="true"] .tutorial-panel {
  display: none;
}

.tutorial-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--outline-soft);
}

.tutorial-title {
  margin: 0;
  font-size: calc(1.55rem * var(--scale));
  line-height: 1.2;
}

.tutorial-close-btn {
  flex: 0 0 auto;
  border-radius: 0;
  box-shadow: none;
}

.tutorial-intro {
  flex: 0 0 auto;
  margin: 0.85rem 0;
  font-size: calc(1rem * var(--scale));
  line-height: 1.5;
}

.tutorial-steps {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.tutorial-step {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
  padding: 0.95rem;
  border: 2px solid var(--primary);
  background: var(--surface-lowest);
}

.tutorial-step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 3rem;
  block-size: 3rem;
  color: var(--on-primary);
  background: var(--primary);
  border: 1px solid var(--outline-medium);
}

.tutorial-step-content h3 {
  margin: 0 0 0.35rem;
  font-size: calc(1.25rem * var(--scale));
  line-height: 1.25;
}

.tutorial-step-content p {
  margin: 0;
  color: var(--on-surface);
  font-size: calc(1.05rem * var(--scale));
  line-height: 1.45;
}

.tutorial-step-content .tutorial-progress {
  margin-bottom: 0.35rem;
  color: var(--on-surface-variant);
  font-size: calc(0.95rem * var(--scale));
  font-weight: 700;
}

.tutorial-footer {
  flex: 0 0 auto;
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  background: var(--surface-lowest);
}

.tutorial-footer .btn-primary,
.tutorial-footer .btn-secondary {
  width: 100%;
  min-height: 3.5rem;
  height: auto;
  padding: 0.7rem 1rem;
  font-size: calc(1rem * var(--scale));
  line-height: 1.2;
  letter-spacing: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.tutorial-footer .btn-primary[hidden],
.tutorial-footer .btn-secondary[hidden] {
  display: none;
}

body[data-tutorial-open] .tutorial-target {
  position: relative;
  z-index: 900;
  outline: 4px solid var(--primary);
  outline-offset: 4px;
  box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.95);
}

body[data-tutorial-open] #context-box.tutorial-target,
body[data-tutorial-open] .chat-panel.tutorial-target,
body[data-tutorial-open] .input-shell.tutorial-target {
  outline: none;
  outline-offset: 0;
  box-shadow: inset 0 0 0 4px var(--primary);
}

.tutorial-overlay[data-placement="top"] {
  align-items: flex-start;
  justify-content: center;
  padding: calc(0.75rem + env(safe-area-inset-top)) 1rem 1rem;
}

.tutorial-overlay[data-placement="top"] .tutorial-panel {
  width: min(44rem, 100%);
}

@media (min-width: 881px) {
  .tutorial-overlay[data-placement="left"] {
    align-items: center;
    justify-content: flex-start;
    padding: 1rem 1rem 1rem 2rem;
  }

  .tutorial-overlay[data-placement="left"] .tutorial-panel {
    width: min(44rem, 48vw);
    max-height: calc(100dvh - 2rem);
  }

  .tutorial-overlay[data-placement="right"] {
    align-items: center;
    justify-content: flex-end;
    padding: 1rem 2rem 1rem 1rem;
  }

  .tutorial-overlay[data-placement="right"] .tutorial-panel {
    width: min(34rem, 42vw);
    max-height: calc(100dvh - 2rem);
  }
}

/* bottom bar */
.bottom-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: none;
  padding: 0.4rem var(--gutter) calc(0.6rem + env(safe-area-inset-bottom));
  background: linear-gradient(
    to top,
    rgba(249, 249, 247, 1) 78%,
    rgba(249, 249, 247, 0)
  );
}

.helper-text {
  font-size: calc(0.8rem * var(--scale));
  margin: 0 0 0.35rem;
}

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-lowest);
  padding: 0.4rem 0.5rem 0.4rem 0.8rem;
  min-width: 0;
}

.chat-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: calc(1rem * var(--scale));
}

.input-shell.is-transcribing .chat-input {
  color: transparent;
  caret-color: transparent;
}

.input-shell.is-transcribing .chat-input::placeholder {
  color: transparent;
}

.chat-input:disabled {
  cursor: wait;
}

.voice-input-status {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--on-surface);
  font-size: calc(0.95rem * var(--scale));
  font-weight: 700;
  pointer-events: none;
}

.voice-input-status[hidden] {
  display: none !important;
}

.voice-input-dots {
  height: 0.8rem;
  margin: 0;
}

.voice-input-dots span {
  background: var(--on-surface-variant);
}

.voice-status {
  color: var(--error);
  font-size: calc(0.82rem * var(--scale));
  font-weight: 600;
  min-width: 6rem;
}

.voice-status[hidden] {
  display: none;
}


/* Focus outlines */
button:focus-visible,
[role="radio"]:focus-visible,
.msg-bubble:focus-visible,
.easy-word:focus-visible,
select:focus-visible,
.chat-input:focus-visible {
  outline: 3px solid var(--primary-dim);
  outline-offset: 2px;
}


.easy-word {
  position: relative;
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--primary-underline);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
  cursor: help;
}

.easy-word:focus-visible::after,
.easy-word:hover::after {
  content: attr(aria-label);
  position: absolute;
  left: 0;
  top: calc(100% + 0.25rem);
  z-index: 45;
  width: max-content;
  max-width: min(20rem, 80vw);
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--outline-variant);
  background: var(--surface-lowest);
  color: var(--on-surface);
  box-shadow: var(--shadow-sm);
  font-size: calc(0.9rem * var(--scale));
  line-height: 1.35;
  white-space: normal;
}

/* responsiveness */

@media (min-width: 1301px) {
  body.surface {
    height: 100dvh;
    overflow: hidden;
  }

  .onboarding-panel {
    padding: 1.25rem clamp(1.5rem, 4vw, 4rem) 1rem;
  }

  .onboarding-header {
    padding-bottom: 0.85rem;
    margin-bottom: 1rem;
  }

  .onboarding-header .headline {
    font-size: clamp(2rem, 3vw, 3rem);
    margin-bottom: 0.45rem;
  }

  .onboarding-header .body-lg {
    margin: 0.7rem 0 0;
    font-size: 1rem;
  }

  .onboarding-body {
    gap: 1rem;
  }

  .onb-section {
    gap: 0.55rem;
    margin-bottom: 0;
  }

  .section-label {
    font-size: 1rem;
    margin-top: 1rem;
  }

  .toggle-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .toggle-row {
    min-height: 3.4rem;
    padding: 0.65rem 0.75rem;
    gap: 0.65rem;
    align-items: flex-start;
  }

  .toggle-row input {
    margin-top: 0.3rem;
    inline-size: 1rem;
    block-size: 1rem;
  }

  .toggle-content {
    gap: 0.1rem;
  }

  .card-subtitle,
  .toggle-row .card-subtitle {
    font-size: 0.9rem;
    line-height: 1.25;
  }

  .onb-footer {
    margin-top: auto;
    padding-top: 0.75rem;
  }

  .onb-actions > button {
    min-height: 2.75rem;
  }

  .app-shell {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .top-bar {
    flex: 0 0 auto;
  }

  .main-layout {
    flex: 1 1 auto;
    overflow: hidden;
    padding-bottom: 5.75rem;
  }

  .chat-panel {
    height: 100%;
    max-height: none;
  }

  .context-column {
    min-height: 0;
    overflow: hidden;
  }
}

@media (max-width: 1300px) {
  :root {
    --gutter: 1rem;
    --bottom-bar-space: 0rem;
  }

  body.surface {
    height: 100dvh;
    min-width: 0;
    overflow: hidden;
  }

  .app-shell {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .top-bar {
    position: static;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 2.75rem 2.75rem minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 0.4rem;
    padding: calc(0.75rem + env(safe-area-inset-top)) var(--gutter) 0.55rem;
    border-bottom: 1px solid var(--outline-soft);
    background: var(--surface);
  }

  .top-left {
    display: contents;
    margin: 0;
    min-width: 0;
  }

  .app-title {
    order: initial;
    grid-column: 1;
    justify-self: stretch;
    max-width: none;
    width: 100%;
    min-height: 2.6rem;
    padding: 0;
    font-size: calc(0.9rem * var(--scale));
    line-height: 1;
    letter-spacing: 0;
    justify-content: center;
    overflow-wrap: anywhere;
  }

  .help-btn {
    order: initial;
    justify-self: stretch;
    width: 100%;
    min-width: 0;
    min-height: 2.6rem;
    padding: 0;
    justify-content: center;
  }

  #tutorial-open-btn {
    grid-column: 2;
  }

  .help-btn-text {
    display: none;
  }

  .brand-title {
    display: none;
  }

  .top-right {
    display: contents;
  }

  .audio-settings-btn {
    grid-column: 4;
    justify-self: stretch;
    display: inline-flex;
    width: 100%;
    min-width: 0;
    min-height: 2.6rem;
    padding: 0 0.45rem;
    font-size: calc(0.95rem * var(--scale));
    pointer-events: auto;
    box-shadow: none;
  }

  .tutorial-step {
    grid-template-columns: 2.25rem minmax(0, 1fr);
    padding: 0.7rem;
  }

  .tutorial-step-icon {
    inline-size: 2.25rem;
    block-size: 2.25rem;
  }

  body[data-audio-settings-open] .audio-settings-btn {
    width: 100%;
  }

  .location-panel-btn {
    grid-column: 3;
    justify-self: stretch;
    display: inline-flex;
    width: 100%;
    min-width: 0;
    min-height: 2.6rem;
    padding: 0 0.45rem;
    font-size: calc(0.95rem * var(--scale));
    pointer-events: auto;
    box-shadow: none;
  }

  #location-panel-text,
  #audio-settings-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .audio-group {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
    display: none;
    grid-template-columns: repeat(3, minmax(3.35rem, 1fr));
    gap: 0.45rem;
    align-items: center;
    margin-top: 0.35rem;
    padding: 0.55rem;
    background: var(--surface-low);
    border: 1px solid var(--outline-medium);
    box-shadow: none;
    pointer-events: auto;
  }

  body[data-audio-settings-open] .audio-group {
    display: grid;
  }

  .audio-group .icon-btn,
  .audio-icon-btn {
    width: 100%;
    min-width: 2.75rem;
    height: 2.75rem;
    border-radius: 0;
    box-shadow: none;
  }

  .audio-toggle-btn {
    width: 100%;
    min-width: 0;
    min-height: 3.35rem;
    border-radius: 0;
    padding-inline: 0.55rem;
  }

  .volume-wrap {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
    border-radius: 0;
    min-height: 2.75rem;
    padding: 0.35rem 0.55rem;
  }

  .volume-slider {
    width: 100%;
  }

  .speed-group {
    grid-column: 1 / -1;
    width: 100%;
    border-radius: 0;
  }

  .speed-wrap {
    grid-column: 1 / -1;
    width: 100%;
  }

  .speed-btn {
    flex: 1;
    min-height: 2.65rem;
    padding: 0.45rem 0.35rem;
    font-size: calc(0.95rem * var(--scale));
  }

  @media (max-width: 430px) {
    .top-bar {
      grid-template-columns: 2.5rem 2.5rem minmax(0, 1fr) minmax(0, 1fr);
      gap: 0.3rem;
    }

    .app-title,
    .help-btn,
    .location-panel-btn,
    .audio-settings-btn {
      min-height: 2.5rem;
    }

    .location-panel-btn,
    .audio-settings-btn {
      gap: 0.25rem;
      padding-inline: 0.3rem;
      font-size: calc(0.86rem * var(--scale));
    }
  }

  .main-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    overflow: hidden;
    padding: 0.55rem var(--gutter) 0;
  }

  .context-column,
  .chat-panel,
  .context-box {
    min-width: 0;
  }

  .context-column {
    order: -1;
    flex: 0 0 auto;
    overflow: visible;
    display: none;
  }

  body[data-location-panel-open] .context-column {
    display: flex;
  }

  .context-column .wide {
    min-height: 2.75rem;
    padding: 0.45rem 0.75rem;
    font-size: calc(0.95rem * var(--scale));
  }

  .context-box {
    max-height: calc(100dvh - 8.5rem);
    overflow-y: auto;
  }

  .btn-primary,
  .btn-secondary {
    min-height: 3rem;
    font-size: calc(0.9rem * var(--scale));
  }

  .field-select {
    min-height: 3rem;
    font-size: calc(1rem * var(--scale));
  }

  .tutorial-footer .btn-primary {
    font-size: 1rem;
  }

  .context-heading {
    font-size: calc(1.15rem * var(--scale));
    margin-bottom: 0.7rem;
  }

  .field-label {
    display: block;
    font-size: calc(1rem * var(--scale));
    margin-top: 0.8rem;
  }

  .field-error {
    font-size: calc(0.95rem * var(--scale));
    line-height: 1.35;
  }

  .chat-panel {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
    padding: 0.75rem;
    overflow: hidden;
  }

  .chat-thread {
    overflow-y: auto;
    padding-right: 0;
  }

  .msg-bubble {
    max-width: min(100%, 62ch);
    font-size: calc(1rem * var(--scale));
    line-height: 1.5;
    padding: 0.85rem;
    overflow-wrap: anywhere;
  }

  .bottom-bar {
    position: static;
    flex: 0 0 auto;
    transform: none;
    max-width: none;
    padding: 0.55rem var(--gutter) calc(0.65rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--outline-soft);
    background: var(--surface);
  }

  .helper-text {
    font-size: calc(0.95rem * var(--scale));
    line-height: 1.35;
  }

  .input-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2.85rem 4.75rem;
    gap: 0.45rem;
    align-items: center;
    padding: 0.4rem;
  }

  .chat-input {
    min-height: 2.65rem;
    font-size: calc(0.95rem * var(--scale));
    text-overflow: ellipsis;
  }

  .input-shell .icon-btn {
    width: 2.85rem;
    height: 2.85rem;
    border-radius: 0;
  }

  .input-shell .btn-primary {
    width: 100%;
    min-width: 0;
    padding: 0 0.65rem;
    letter-spacing: 0;
  }

  .voice-status {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    font-size: calc(0.95rem * var(--scale));
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .voice-input-status {
    left: 0.65rem;
    right: 0.65rem;
    font-size: calc(1rem * var(--scale));
  }

  .onboarding-overlay {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: rgba(12, 15, 14, 0.82);
  }

  .onboarding-panel {
    width: 100%;
    max-width: none;
    max-height: none;
    height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
    padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
    overflow-y: auto;
    scrollbar-width: auto;
  }

  .onboarding-panel::-webkit-scrollbar {
    width: 0.65rem;
  }

  .onboarding-panel::-webkit-scrollbar-thumb {
    background: var(--outline-variant);
  }

  .onboarding-header {
    flex: 0 0 auto;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }

  .headline {
    font-size: 1.75rem;
    line-height: 1.2;
  }

  .eyebrow {
    font-size: 0.85rem;
    letter-spacing: 0;
  }

  .onboarding-body {
    flex: 0 0 auto;
    gap: 1rem;
    min-height: 0;
    overflow: visible;
  }

  .onb-grid,
  .onb-grid-lang,
  .age-grid,
  .settings-grid,
  .settings-grid.age-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .settings-panel {
    width: 100%;
    border-left: none;
  }

  .settings-body {
    padding: 0.8rem;
    gap: 1rem;
  }

  .settings-footer {
    grid-template-columns: 1fr;
    gap: 0.7rem;
    padding: 0.8rem 0.8rem calc(0.8rem + env(safe-area-inset-bottom));
  }

  .card,
  .chip,
  .toggle-row,
  .info-block,
  .consent-row {
    padding: 0.9rem;
  }

  .card-title {
    font-size: 1.1rem;
    font-family: var(--font-sans);
  }

  .card-subtitle,
  .hint-muted {
    font-size: 0.95rem;
    line-height: 1.4;
  }
  .toggle-row {
    align-items: flex-start;
    min-height: 4.25rem;
    gap: 0.75rem;
  }

  .toggle-row input {
    inline-size: 1.5rem;
    block-size: 1.5rem;
    flex: 0 0 auto;
  }

  .option-pictogram {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.55rem;
  }

  .settings-section .toggle-row {
    display: grid;
    grid-template-columns: 1.75rem 2.5rem minmax(0, 1fr);
    align-items: start;
    padding: 0.85rem;
  }

  .settings-section .toggle-row input {
    margin-top: 0.55rem;
  }

  .settings-section .toggle-content {
    min-width: 0;
  }

  .settings-section .toggle-content span {
    font-weight: 700;
    line-height: 1.25;
  }

  .settings-section .card-subtitle {
    font-size: 0.95rem;
    line-height: 1.35;
  }

  .info-block {
    max-height: none;
    overflow-y: visible;
    font-size: calc(1rem * var(--scale));
    line-height: 1.5;
  }

  .onb-footer {
    flex: 0 0 auto;
    margin-top: auto;
    padding-top: 0.8rem;
    background: var(--surface-lowest);
  }

  .onb-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .onb-actions > button {
    width: 100%;
    min-height: 3.5rem;
    font-size: 1rem;
    letter-spacing: 0;
  }
}

@media (max-width: 880px) {
  .settings-overlay {
    z-index: 2000;
    align-items: stretch;
    justify-content: stretch;
  }

  .settings-panel {
    width: 100%;
    height: 100dvh;
    border-left: none;
    display: block;
    overflow-y: auto;
  }

  .settings-header {
    padding: calc(0.75rem + env(safe-area-inset-top)) 0.85rem 0.75rem;
    gap: 0.65rem;
  }

  .settings-title {
    font-size: clamp(1.35rem, 6vw, 1.75rem);
    line-height: 1.15;
  }

  .settings-help {
    font-size: calc(0.9rem * var(--scale));
    line-height: 1.3;
  }

  .settings-close-btn {
    width: 2.75rem;
    height: 2.75rem;
    min-width: 2.75rem;
  }

  .settings-body {
    overflow: visible;
    padding: 0.75rem 0.85rem;
    gap: 0.75rem;
  }

  .settings-grid,
  .settings-grid.age-grid {
    grid-template-columns: 1fr;
  }

  .settings-footer {
    position: sticky;
    bottom: 0;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    padding: 0.6rem 0.85rem calc(0.6rem + env(safe-area-inset-bottom));
  }

  .settings-footer .btn-primary,
  .settings-footer .btn-secondary {
    min-height: 2.85rem;
    padding: 0.45rem 0.65rem;
  }

  .tutorial-overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
  }

  .tutorial-panel {
    width: 100%;
    max-height: 36dvh;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 0.5rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom));
  }

  .tutorial-header {
    padding-bottom: 0.35rem;
    gap: 0.5rem;
  }

  .tutorial-header .eyebrow {
    display: none;
  }

  .tutorial-title {
    font-size: clamp(1.25rem, 6vw, 1.5rem);
    line-height: 1.1;
  }

  .tutorial-close-btn {
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
  }

  .tutorial-intro {
    display: none;
  }

  .tutorial-steps {
    min-height: 0;
    overflow-y: auto;
  }

  .tutorial-step {
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .tutorial-step-icon {
    inline-size: 2rem;
    block-size: 2rem;
  }

  .tutorial-step-content .tutorial-progress {
    font-size: 0.8rem;
    margin-bottom: 0.15rem;
  }

  .tutorial-step-content h3 {
    font-size: calc(0.95rem * var(--scale));
    margin-bottom: 0.15rem;
  }

  .tutorial-step-content p {
    font-size: calc(0.85rem * var(--scale));
    line-height: 1.25;
  }

  .tutorial-footer {
    margin-top: 0.5rem;
    gap: 0.5rem;
  }

  .tutorial-footer .btn-primary,
  .tutorial-footer .btn-secondary {
    min-height: 2.65rem;
    padding: 0.45rem 0.65rem;
    font-size: calc(0.9rem * var(--scale));
  }

  .tutorial-target {
    scroll-margin-top: 4.5rem;
    scroll-margin-bottom: 34dvh;
  }

  body[data-tutorial-open] {
    overflow-y: auto;
    overflow-x: hidden;
  }

  body[data-tutorial-open] .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  body[data-tutorial-open] .main-layout {
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
    padding-bottom: calc(37dvh + 1rem + env(safe-area-inset-bottom));
  }

  body[data-tutorial-open][data-tutorial-placement="top"] .main-layout {
    padding-bottom: 1rem;
  }

  body[data-tutorial-open] .context-column {
    overflow: visible;
  }

  body[data-tutorial-open] .context-box {
    max-height: none;
    overflow: visible;
  }

  .tutorial-overlay[data-placement="top"] {
    align-items: flex-start;
    justify-content: center;
    padding: calc(0.5rem + env(safe-area-inset-top)) 0.75rem 0;
  }

  .tutorial-overlay[data-placement="top"] .tutorial-panel {
    width: calc(100% - 1.5rem);
    max-height: 36dvh;
    border: 2px solid var(--outline-variant);
  }
}
