@font-face {
  font-family: Baloo;
  src: url("media/font-semibold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Baloo;
  src: url("media/font-bold.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --top: #0e7c77;
  --mid: #5fa8a2;
  --soft: #cfe6e2;
  --base: #faf7f1;
  --on-hero: #fff;
  --translation: #e7f3f1;
  --on-base: #12303b;
  --edge: #12303b40;
  --active: #096560;
  --gold: #f2b84b;
  --on-gold: #12303b;
}
:root[data-theme="night"] {
  color-scheme: dark;
  --top: #0e1a3a;
  --mid: #13224a;
  --soft: #0f2c55;
  --base: #0a3f52;
  --on-hero: #eaf3f2;
  --translation: #5fd3cb;
  --on-base: #eaf3f2;
  --edge: #eaf3f24d;
  --active: #5fd3cb;
}

* { box-sizing: border-box; }
html {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  background-color: var(--top);
  scroll-behavior: smooth;
  scroll-padding-block: var(--safe-top) var(--safe-bottom);
}
body {
  margin: 0;
  padding-top: var(--safe-top);
  /* iOS can use the body's solid background for the browser chrome. */
  background-color: var(--top);
  color: var(--on-base);
  font: 600 1rem/1.5 Baloo, sans-serif;
}
:where(#website, .site-header, .site-footer) :is(h1, h2, p) { margin: 0; }
:where(#website, .site-header, .site-footer) :is(h1, h2, strong) { font-weight: 800; }
:where(#website, .site-header, .site-footer) a, .site-skip { color: inherit; text-decoration: none; }
:where(#website, .site-header, .site-footer) button { font: inherit; color: inherit; cursor: pointer; }
:where(#website, .site-header, .site-footer) img { display: block; max-width: 100%; object-fit: contain; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.site-skip { position: fixed; z-index: 2; top: 0; right: calc(8px + var(--safe-right)); padding: 8px 16px; background: var(--gold); color: var(--on-gold); transform: translateY(-160%); }
.site-skip:focus { top: calc(8px + var(--safe-top)); transform: none; }

/* Safari can extend a solid, viewport-attached surface behind its controls. */
.site-edge { display: none; }
@media (max-width: 560px), (hover: none) and (pointer: coarse) {
  .site-edge {
    display: block;
    position: fixed;
    z-index: 1;
    inset-inline: 0;
    background: var(--top);
    pointer-events: none;
  }
  .site-edge-top { top: 0; height: max(1px, var(--safe-top)); }
  .site-edge-bottom { bottom: 0; height: max(1px, var(--safe-bottom)); background-color: var(--card); }
}

.intro {
  --hold: clamp(400px, 32vw, 476px);
  --fade: clamp(136px, 16vw, 218px);
  background: linear-gradient(
    to bottom, var(--top) var(--hold),
    var(--mid) calc(var(--hold) + var(--fade) * .45),
    var(--soft) calc(var(--hold) + var(--fade) * .78),
    var(--base) calc(var(--hold) + var(--fade))
  );
}
.site-width { width: min(1344px, calc(100% - 96px)); margin-inline: auto; }
.site-header {
  min-height: 112px;
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  align-items: center;
  gap: 24px;
  color: var(--on-hero);
}
.brand { display: inline-flex; align-items: center; gap: 14px; width: max-content; text-shadow: none; }
.brand > img { width: clamp(48px, 4.5vw, 64px); height: auto; border-radius: 50%; }
.brand-text { display: grid; gap: 4px; text-align: right; color: inherit; }
.brand-text strong { font-size: clamp(1.25rem, 2.4vw, 2.15rem); line-height: 1.05; }
.brand-text > span { font-size: clamp(.875rem, 1.4vw, 1.25rem); line-height: 1.15; }
.site-nav, .header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: clamp(12px, 2.1vw, 32px); }
.site-nav :is(a, summary) { display: inline-flex; align-items: center; min-height: 44px; font-weight: 800; font-size: clamp(1rem, 1.55vw, 1.375rem); white-space: nowrap; }
.site-nav :is(a, summary):hover { text-decoration: underline; text-underline-offset: 5px; }
.site-nav > a:focus-visible, .nav-tools > summary:focus-visible {
  outline: 2px solid var(--on-hero);
  outline-offset: 1px;
  border-radius: 4px;
}
.nav-short { display: none; }
.nav-tools { position: relative; }
.nav-tools summary { cursor: pointer; gap: .35em; list-style: none; }
.nav-tools summary::-webkit-details-marker { display: none; }
.nav-tools summary::after {
  content: "";
  width: .4em;
  height: .4em;
  border-right: 2px solid;
  border-bottom: 2px solid;
  transform: rotate(45deg) translateY(-.1em);
}
.nav-tools[open] summary::after { transform: rotate(225deg) translateY(-.1em); }
.nav-tools:not([open]) > ul { display: none; }
.nav-tools:has(a[aria-current]) summary { text-decoration: underline; text-underline-offset: 5px; }
.nav-tools ul {
  position: absolute;
  z-index: 3;
  inset-block-start: 100%;
  inset-inline-start: 0;
  min-width: 12rem;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--card-line);
  border-radius: 16px;
  background: var(--card);
  color: var(--on-base);
  box-shadow: 0 8px 24px #12303b26;
}
.nav-tools ul a { display: flex; padding-inline: 10px; border-radius: 10px; font-size: 1rem; }
.nav-tools ul a:is(:hover, :focus-visible, [aria-current]) { background: var(--wash); }
.nav-tools ul a:focus-visible { outline-color: var(--active); outline-offset: -2px; }
.header-actions { justify-content: end; gap: 16px; }
.try, .theme { min-height: 44px; padding: 4px 16px; border: 1px solid var(--on-hero); border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; background: transparent; white-space: nowrap; font-weight: 800; }
.theme { width: 44px; padding: 4px; }
.try:hover, .theme:hover { background: #ffffff18; }

.learning-hero {
  min-height: clamp(360px, 33vw, 490px);
  display: grid;
  direction: ltr;
  grid-template-columns: minmax(0, 1fr) minmax(0, .4fr);
  align-items: center;
  column-gap: 24px;
  color: var(--on-hero);
}
.words { text-align: left; min-width: 0; }
#prompt { font-size: clamp(1.25rem, 3.35vw, 3rem); line-height: 1.15; margin-block-end: 12px; }
#phrase { font-size: clamp(3.1rem, 10.08vw, 9.75rem); line-height: 1.07; letter-spacing: -.033em; text-wrap: balance; }
.meaning-line { display: flex; align-items: center; flex-wrap: wrap; column-gap: 40px; row-gap: 8px; margin-block-start: 12px; }
#meaning { color: var(--translation); font-size: clamp(1.5rem, 4.3vw, 4.25rem); font-weight: 800; line-height: 1.15; }
.listen { display: inline-flex; flex-direction: row-reverse; align-items: center; gap: 12px; border: 0; padding: 4px 0; min-height: 48px; background: transparent; font-size: clamp(1rem, 2vw, 1.75rem); font-weight: 800; }
.listen img { box-sizing: content-box; padding: 10px; border-radius: 50%; background: var(--gold); }
.voice-status { font-size: .875rem; min-height: 1.35em; margin-block-start: 4px; }
.mascot { width: 100%; max-width: 356px; height: auto; justify-self: end; }
.home-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0 24px;
  flex-wrap: wrap;
  margin-block-start: 12px;
  padding-inline: 12px;
  border: 1px solid var(--card-line);
  border-radius: 16px;
  background: var(--card);
}
.download { min-height: 96px; display: flex; align-items: center; gap: 12px 32px; flex-wrap: wrap; padding-block: 16px; scroll-margin-top: 16px; }
.download h2 { font-size: clamp(1.25rem, 2vw, 1.8rem); }
.badges { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.store-badge { display: inline-flex; align-items: center; min-height: 44px; }
.store-badge img { width: auto; height: 44px; }
.play-text {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: .3em;
  min-height: 44px;
  font-size: .875rem;
  text-decoration: underline;
  text-underline-offset: .2em;
}
.ios-upcoming {
  display: inline-grid;
  align-content: center;
  min-height: 44px;
  line-height: 1.15;
  font-size: .875rem;
  color: var(--muted);
}
.ios-follow { color: var(--active); text-decoration: underline; text-underline-offset: .2em; }
.home-resources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-block-end: 12px; }
.home-resources a {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--card-line); border-radius: 12px; background: var(--card);
  color: var(--on-base); font-weight: 800; font-size: .95rem; text-align: center;
}
.home-resources a:hover { border-color: var(--active); background: var(--wash); }
.home-resources img { flex: none; }
@media (min-width: 1000px) { .home-resources { margin-block: 0; } }
.journey { padding-block: 24px 32px; scroll-margin-top: 16px; }
.journey h2 { font-size: clamp(1.75rem, 3.5vw, 3.125rem); margin-block-end: 12px; }
.map { display: block; border-radius: 24px; overflow: hidden; }
.map img { width: 100%; height: clamp(144px, 18vw, 262px); object-fit: cover; object-position: 50% 42%; }

@media (max-width: 900px) {
  .site-width { width: calc(100% - 48px); }
  .site-header { grid-template-columns: 1fr auto; gap: 0 12px; padding-block: 12px; }
  .site-nav { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .learning-hero { padding-block: 16px; }
}
@media (max-width: 560px) {
  .intro { --hold: 516px; --fade: 144px; }
  .site-width { width: calc(100% - 32px); }
  .site-header { min-height: auto; grid-template-columns: minmax(0, 1fr) auto; }
  .site-nav { column-gap: clamp(8px, 2.5vw, 16px); row-gap: 0; }
  .site-nav > a, .nav-tools summary { font-size: clamp(.875rem, 4vw, 1rem); }
  .brand { gap: 8px; width: auto; }
  .brand > img { width: 40px; flex: none; }
  .brand-text strong { font-size: 1.1rem; white-space: nowrap; }
  .brand-text > span { font-size: .75rem; white-space: nowrap; }
  .try { padding-inline: 10px; font-size: .875rem; }
  .theme { width: 36px; min-height: 36px; }
  .learning-hero { min-height: 418px; grid-template-columns: 1fr; gap: 0; padding: 12px 0 0; }
  .words { grid-row: 2; }
  #phrase { font-size: clamp(2.85rem, 11vw, 4.45rem); }
  #prompt { margin-block-end: 8px; }
  .meaning-line { column-gap: 18px; margin-block-start: 8px; }
  .home-resources { width: 100%; }
  .home-resources a { gap: 6px; padding-inline: 8px; }
  .home-resources img { width: 20px; height: 20px; }
  .listen { gap: 6px; }
  .listen img { padding: 6px; }
  .mascot { width: clamp(122px, 42vw, 164px); grid-row: 1; justify-self: center; }
  .badges { gap: 8px; }
  .store-badge img { height: 40px; max-width: 130px; }
}
@media (max-width: 360px) {
  .site-header { width: calc(100% - 24px); column-gap: 8px; }
  .site-header .brand { gap: 6px; }
  .header-actions { gap: 12px; }
  .try { padding-inline: 6px; }
  .site-nav { position: relative; }
  .site-nav .nav-full { display: none; }
  .site-nav .nav-short { display: inline; }
  .nav-tools { position: static; }
  .nav-tools ul { inset-inline: 0; width: min(100%, 17rem); margin-inline: auto; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Main website screens */
[hidden] { display: none !important; }
:root {
  --card: #fff;
  --muted: #4f5f64;
  --wash: #e7f3f1;
  --card-line: #dadfe0;
  --button: #0a615d;
  --button-text: #fff;
}
:root[data-theme="night"] {
  --card: #15264a;
  --muted: #b7c9cd;
  --wash: #163f4b;
  --card-line: #526786;
  --button: #5fd3cb;
  --button-text: #0e1a3a;
}
.site-nav a:is([aria-current="page"], [aria-current="true"]) { text-decoration: underline; text-underline-offset: 6px; }
.intro:not([data-route="home"]) { --hold: 256px; --fade: 192px; }
.route { padding-block: 20px 56px; max-width: 1100px; margin-inline: auto; }
.route.narrow { max-width: 720px; }
.route.dictionary { max-width: 880px; }
.route-heading { color: var(--on-hero); margin-block-end: 24px; }
.route-heading h1 { font-size: clamp(2.25rem, 5vw, 4.25rem); line-height: 1.1; }
.route-heading p { font-size: clamp(1rem, 1.7vw, 1.25rem); margin-block-start: 8px; }
.route-heading h1:focus { outline: none; }
.level-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; margin-block-end: 16px; border: 1px solid var(--card-line); border-radius: 24px; background: var(--card); }
.level-list a, .suggestions button { border: 1px solid transparent; border-radius: 99px; min-height: 44px; padding: 6px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; }
.level-list a { flex: 1 1 auto; }
.level-list a[aria-current="true"], .level-list a:hover, .suggestions button:hover { background: var(--wash); color: var(--active); border-color: var(--card-line); }
.world-preview, .journey-unit, .learn-panel, .dictionary-entry {
  background: var(--card); border: 1px solid var(--card-line); border-radius: 24px;
}
.world-preview { overflow: hidden; }
.world-art img { width: 100%; height: clamp(180px, 27vw, 320px); object-fit: cover; object-position: center 53%; }
.world-caption { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; }
.world-caption h2, .units-heading h2 { font-size: clamp(1.35rem, 2.6vw, 2rem); line-height: 1.25; }
.world-caption p, .units-heading span { color: var(--muted); }
.learning-tag { background: var(--wash); color: var(--on-base); border-radius: 99px; padding: 4px 12px; font-size: .875rem; white-space: nowrap; }
.units-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-block: 28px 12px; }
.units { display: grid; gap: 8px; }
.journey-unit { overflow: hidden; }
.journey-unit summary { min-height: 72px; display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.journey-unit summary::-webkit-details-marker, .dictionary-entry summary::-webkit-details-marker { display: none; }
.journey-unit summary:focus-visible, .dictionary-entry summary:focus-visible { outline-offset: -4px; }
.journey-unit summary:hover, .dictionary-entry summary:hover { background: var(--wash); }
.journey-unit summary::after { width: 16px; height: 16px; content: ""; background: url("media/icon_chevron_left.webp") center / contain no-repeat; margin-inline-start: auto; flex: none; }
.journey-unit[open] summary::after { transform: rotate(-90deg); }
.unit-name, .result-word { display: grid; min-width: 0; }
.unit-name small { color: var(--muted); }
.unit-content { padding: 14px 16px; border-top: 1px solid var(--card-line); }
.unit-content ol { margin: 0 0 16px; padding: 0; list-style: none; }
.unit-content li { display: grid; grid-template-columns: 1.75em minmax(0, 1fr); align-items: baseline; gap: 8px; }
.unit-lesson-number { text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.unit-content li a { padding-block: 6px; }
@media (max-width: 560px) {
  .unit-content li a { min-height: 44px; padding-block: 10px; }
}
.unit-content li a { text-decoration: underline; text-decoration-color: var(--card-line); text-underline-offset: 4px; }
.unit-content li a:hover { color: var(--active); text-decoration-color: currentColor; }
.inline-link { color: var(--active); text-decoration: underline; text-underline-offset: 4px; font-weight: 800; }
.learn-panel { padding: clamp(16px, 3.3vw, 32px); }
.step-status { display: flex; align-items: center; gap: 16px; color: var(--muted); margin-block-end: 24px; }
.step-status progress { flex: 1; min-width: 0; height: 8px; border: 0; border-radius: 99px; background: var(--wash); accent-color: var(--active); overflow: hidden; }
.step-status progress::-webkit-progress-bar { background: var(--wash); }
.step-status progress::-webkit-progress-value { background: var(--active); border-radius: 99px; }
.step-status progress::-moz-progress-bar { background: var(--active); }
.question-heading { font-size: clamp(1.35rem, 3vw, 2.1rem); line-height: 1.25; margin-block-end: 16px; }
.question-heading:focus { outline: none; }
.example { background: var(--wash); border-radius: 12px; font-size: 1.25rem; padding: 12px 16px; margin-block-end: 12px; }
.options { border: 0; padding: 0; margin: 0; min-inline-size: 0; display: grid; gap: 8px; }
.option {
  display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 56px; border: 1px solid var(--card-line);
  padding: 8px 12px; border-radius: 12px; font-weight: 800; font-size: 1.125rem;
}
.option:has(input:checked), .option.correct { background: var(--wash); border-color: var(--active); }
.option input { accent-color: var(--active); width: 18px; height: 18px; flex: none; }
.option img { margin-inline-start: auto; }
.screen-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-block-start: 16px; }
.action {
  display: inline-flex; min-height: 48px; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 20px; border-radius: 99px; border: 1px solid var(--card-line); background: var(--card); font-weight: 800; cursor: pointer;
}
.action.primary { background: var(--button); border-color: var(--button); color: var(--button-text); }
.action:disabled { background: var(--wash); border-color: var(--card-line); color: var(--muted); cursor: default; }
.answer-note { display: flex; align-items: center; gap: 12px; margin-block-start: 16px; padding: 12px; border-radius: 16px; background: var(--wash); }
.answer-note strong, .result h2 { font-size: 1.5rem; }
.answer-note img { width: 52px; height: 64px; flex: none; }
.result { text-align: center; display: grid; justify-items: center; gap: 8px; }
.result p { color: var(--muted); }
.result .screen-actions { justify-content: center; }
.lesson-result-actions {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-block-start: 8px;
}
.lesson-play { gap: .35em; flex-wrap: wrap; }
.lesson-follow { display: flex; align-items: center; min-height: 44px; font-size: .9375rem; }
@media (max-width: 360px) and (max-height: 700px) {
  .route[data-view="lesson"]:has(.result) .route-heading { margin-block-end: 12px; }
  .route[data-view="lesson"]:has(.result) .route-heading h1 { font-size: 1.5rem; }
  .route[data-view="lesson"]:has(.result) .route-heading p { margin-block-start: 4px; }
  #lesson-screen .result > img { width: 76px; height: 76px; }
}
.placement-intro p { margin-block-end: 16px; color: var(--muted); }
.result-level { font-size: clamp(3rem, 9vw, 6rem); line-height: 1; color: var(--active); font-weight: 800; }
.dictionary-search { display: grid; gap: 8px; }
.dictionary-search label { font-weight: 800; }
.dictionary-browse { display: flex; align-items: center; min-height: 44px; justify-self: start; }
.search-field { display: flex; align-items: center; gap: 8px; background: var(--wash); border: 1px solid var(--card-line); border-radius: 16px; padding: 0 14px; }
.search-field img { flex: none; }
.search-field input { min-height: 52px; width: 100%; min-width: 0; padding: 4px; border: 0; background: transparent; color: var(--on-base); font: inherit; }
.search-field input::placeholder { color: var(--muted); opacity: 1; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestions button { border-color: var(--card-line); background: var(--card); min-height: 40px; }
.dictionary-results { margin-block-start: 20px; }
#dictionary-status { color: var(--muted); margin-block-end: 8px; }
#dictionary-results { display: grid; gap: 8px; }
.dictionary-entry { overflow: hidden; }
.dictionary-entry summary { display: flex; align-items: center; gap: 12px; justify-content: space-between; min-height: 64px; padding: 12px 16px; cursor: pointer; list-style: none; }
.result-word bdi { font-size: 1.125rem; justify-self: start; }
.result-word small { color: var(--muted); }
.definition { border-top: 1px solid var(--card-line); padding: 12px 16px; }
.definition p + p { margin-block-start: 6px; }
.definition .listen-word { margin-block-start: 8px; }
@media (max-width: 560px) {
  .intro:not([data-route="home"]) { --hold: 264px; --fade: 152px; }
  .route { padding-block-start: 12px; }
  .route-heading { margin-block-end: 16px; }
  .world-caption, .units-heading { align-items: flex-start; }
  .units-heading { flex-wrap: wrap; }
  .level-list a { padding-inline: 10px; }
  .world-caption { padding-inline: 12px; }
}
.result-more { justify-self: start; margin-block-start: 4px; }

/* Journey keeps the map and the stops in the same reading area. */
.journey-layout { display: grid; grid-template-columns: minmax(240px, .86fr) minmax(0, 1.34fr); grid-template-areas: "stops map"; gap: 16px; align-items: start; }
.journey-layout .world-preview { grid-area: map; position: sticky; top: 16px; }
.journey-layout .world-art img { height: clamp(248px, 32vw, 416px); }
.journey-stops { grid-area: stops; background: var(--card); border: 1px solid var(--card-line); border-radius: 24px; padding: 16px; min-width: 0; }
.journey-stops .units-heading { margin-block: 0 12px; align-items: center; }
.journey-stops .units-heading h2 { font-size: 1.375rem; }
.journey-stops .units { gap: 0; }
.journey-stops .journey-unit { border: 0; border-radius: 0; background: transparent; }
.journey-stops .journey-unit + .journey-unit { border-top: 1px solid var(--card-line); }
.journey-stops .journey-unit summary { padding: 8px 4px; min-height: 64px; }
.journey-stops .journey-unit summary:hover, .journey-stops .journey-unit[open] summary, .journey-stops .journey-unit.targeted summary { background: var(--wash); }
.journey-stops .journey-unit summary img { width: 32px; }
.journey-stops .unit-content { padding: 12px 12px 14px; border-top: 0; }
.journey-stops .unit-content ol { margin-block: 0 12px; }

/* The example is a reading area inside the word entry, rather than another card. */
.definition { display: grid; grid-template-columns: minmax(150px, .65fr) minmax(0, 1.35fr); align-items: start; gap: 16px; padding: 16px; }
.word-example { border-inline-start: 2px solid var(--active); padding-inline-start: 14px; }
.word-example h3 { margin: 0 0 6px; font-size: .95rem; color: var(--muted); }
.word-example .english-example { font-size: 1.2rem; font-weight: 800; }
.word-example .arabic-example { color: var(--muted); }
.dictionary-entry[open] > summary { background: var(--wash); }
.search-field:focus-within { outline: 2px solid var(--active); outline-offset: 2px; }
.search-field input:focus-visible { outline: none; }

/* Shared footer */
.intro, .inner-frame {
  min-height: calc(100vh - var(--safe-top));
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
@supports (min-height: 100dvh) {
  .intro, .inner-frame { min-height: calc(100dvh - var(--safe-top)); }
}
/* Keep the solid header and footer full width while their links stay clear of side cutouts. */
.header-band, .site-footer {
  margin-left: calc(-1 * var(--safe-left));
  margin-right: calc(-1 * var(--safe-right));
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
.intro { display: flex; flex-direction: column; }
.site-footer { margin-block-start: auto; padding-block-end: var(--safe-bottom); border-top: 1px solid var(--card-line); background: var(--card); color: var(--on-base); }
.footer-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .7fr) minmax(0, .7fr) minmax(0, 1fr); gap: clamp(16px, 3vw, 44px); padding-block: 32px 24px; }
.footer-brand .brand { max-width: 100%; }
.footer-brand .brand-text strong { font-size: 1.4rem; }
.footer-brand .brand-text > span { font-size: .9rem; }
.footer-brand .brand > img { width: 48px; flex: none; }
.site-footer h2 { font-size: 1.2rem; line-height: 1.3; margin-block-end: 6px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.footer-links a, .footer-social a, .footer-bottom a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; color: var(--muted); }
.site-footer a:hover { color: var(--active); text-decoration: underline; text-underline-offset: 4px; }
.footer-social .social-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.footer-social li { min-width: 0; }
.footer-social a { display: flex; width: 100%; min-height: 40px; padding: 6px 8px; border: 1px solid var(--card-line); border-radius: 10px; font-size: .9rem; white-space: nowrap; }
.footer-social svg { flex: none; }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 2px 24px; padding-block: 10px 16px; border-top: 1px solid var(--card-line); }
.footer-bottom nav { display: flex; flex-wrap: wrap; gap: 0 16px; }
.footer-bottom a, .footer-rights { font-size: .875rem; color: var(--muted); }
.footer-rights bdi { white-space: nowrap; }
.listen-word[data-playback="playing"], .say[data-playback="playing"] { outline: 2px solid var(--active); outline-offset: 2px; }
.spoken-status:empty { display: none; }
.spoken-status { margin-block: 4px; color: var(--muted); font-size: .875rem; }
@media (max-width: 960px) {
  .footer-main { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-social { grid-column: 1 / -1; }
  .footer-social .social-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .journey-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "map" "stops"; }
  .journey-layout .world-preview { position: static; }
  .journey-layout .world-art img { height: clamp(160px, 46vw, 280px); }
}
@media (max-width: 560px) {
  .definition { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .footer-main { padding-block: 24px 16px; }
  .footer-brand .brand > img { width: 40px; }
  .footer-bottom nav { gap: 0 12px; }
}
#phrase:focus { outline: none; }

/* A different learning task at each level. */
.intro[data-route="home"] { --hold: clamp(690px, 48vw, 760px); --fade: 152px; }
.example-picker { color: var(--on-hero); margin-block-start: 4px; }
.home-title { font-size: clamp(1.25rem, 2.7vw, 2rem); line-height: 1.25; margin-block-end: 12px; }
.example-picker h2 { font-size: 1.125rem; margin-block-end: 8px; }
.example-skill { display: none; }
.example-levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.example-levels button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid #ffffff6e;
  border-radius: 12px;
  background: #ffffff0c;
  font-weight: 800;
}
.example-levels button bdi {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  min-height: 28px;
  padding-inline: 5px;
  border-radius: 8px;
  background: #ffffff24;
  color: inherit;
  font-weight: 800;
}
.example-levels button:is(:hover, [aria-pressed="true"]) { background: var(--card); color: var(--active); border-color: var(--card-line); }
.example-levels button:is(:hover, [aria-pressed="true"]) bdi { background: var(--wash); }
.example-levels button:focus-visible { outline: 2px solid var(--on-hero); outline-offset: 2px; }
.home-next :is(.download a, .placement-action):focus-visible { outline-color: var(--active); }
.home-next .home-resources a:focus-visible { outline-color: var(--on-base); outline-offset: -3px; }
.learning-hero { min-height: clamp(340px, 31vw, 448px); padding-block: 16px 8px; }
#prompt { font-size: clamp(1.125rem, 2.3vw, 2.125rem); line-height: 1.2; }
#phrase { font-size: clamp(2.75rem, 6.5vw, 6.3rem); letter-spacing: -.02em; text-wrap: wrap; }
#phrase[data-level="A2"], #phrase[data-level="B1"] { font-size: clamp(2.3rem, 5.75vw, 5.5rem); }
#phrase[data-level="B2"] { font-size: clamp(2.125rem, 5.25vw, 5rem); }
#phrase[data-level="C1"] { font-size: clamp(2rem, 4.85vw, 4.7rem); }
#meaning { font-size: clamp(1.35rem, 3vw, 3.15rem); margin-block-start: 8px; }
.meaning-line { min-height: 56px; column-gap: 20px; }
.listen { font-size: clamp(1rem, 1.55vw, 1.375rem); }
.example-lesson {
  display: inline-grid;
  place-content: center;
  min-height: 48px;
  padding: 4px clamp(10px, 1.35vw, 20px);
  border-radius: 14px;
  background: var(--on-hero);
  color: var(--top);
  text-align: center;
  font-size: clamp(1rem, 1.25vw, 1.25rem);
  font-weight: 800;
  line-height: 1.2;
}
.example-lesson span:last-child { font-size: clamp(.8125rem, 1.05vw, .9375rem); font-weight: 600; }
.example-lesson:hover span:first-child { text-decoration: underline; text-underline-offset: .15em; }
.example-lesson:focus-visible { outline-color: var(--on-hero); }
.meaning-line .listen img { width: 22px; height: 22px; padding: 6px; }
.translation { font-size: 1rem; align-self: center; }
.translation summary { display: inline-flex; min-height: 44px; align-items: center; cursor: pointer; text-decoration: underline; text-underline-offset: 5px; }
.translation summary::-webkit-details-marker { display: none; }
.translation p {
  margin-block: 4px 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--top);
  color: var(--on-hero);
}
.placement-callout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 24px;
  padding: 16px 20px;
  margin-block-start: 12px;
}
.placement-callout h2 { font-size: clamp(1.4rem, 2.5vw, 2rem); line-height: 1.2; }
.placement-callout p { color: var(--muted); margin-block-start: 4px; }
.placement-action { min-height: 54px; padding-inline: 24px; font-size: 1.125rem; }
.placement-intro h2 { font-size: clamp(1.5rem, 3.2vw, 2.25rem); }
.placement-icon { display: grid; place-items: center; width: 60px; height: 60px; background: var(--wash); border-radius: 16px; margin-block-end: 12px; }
.example-location { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(230px, .75fr); grid-template-areas: "map copy"; border: 1px solid var(--card-line); border-radius: 24px; overflow: hidden; background: var(--card); }
.example-map { grid-area: map; width: 100%; height: clamp(180px, 22vw, 300px); }
.example-map img { width: 100%; height: 100%; object-fit: cover; object-position: center 55%; }
.example-location-copy { grid-area: copy; align-self: center; padding: clamp(16px, 3vw, 32px); }
.location-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.example-location-copy h3 { margin: 8px 0 0; font-size: clamp(1.65rem, 3.5vw, 2.75rem); line-height: 1.15; }
.example-location-copy p { color: var(--muted); margin-block: 6px 12px; }
.more-social { margin-block-start: 8px; }
.more-social summary { min-height: 42px; display: flex; align-items: center; gap: 8px; list-style: none; color: var(--active); cursor: pointer; font-size: .95rem; }
.more-social summary::-webkit-details-marker { display: none; }
.more-social summary::after { content: ""; width: 14px; height: 14px; background: url("media/icon_chevron_left.webp") center / contain no-repeat; }
.more-social[open] summary::after { transform: rotate(-90deg); }
:root[data-theme="night"] .more-social summary::after {
  width: 18px;
  height: 18px;
  background-color: var(--on-hero);
  background-size: 12px;
  border-radius: 50%;
}
.footer-social a:hover { background: var(--wash); }
.footer-social .social-grid li { min-width: 0; }

:root[data-theme="night"] .intro[data-route="home"] {
  --hold: clamp(290px, 34vw, 420px);
  --fade: 510px;
}

@media (min-width: 901px) {
  .learning-hero { min-height: clamp(320px, 26vw, 390px); padding-block: 12px 8px; }
  .learning-hero .mascot { max-width: clamp(220px, 21vw, 300px); }
  #phrase { font-size: clamp(2.75rem, 6.1vw, 6rem); }
}
@media (min-width: 1000px) and (max-height: 820px) {
  .learning-hero { min-height: 300px; }
  .learning-hero .mascot { max-width: 240px; }
  #prompt { font-size: clamp(1.125rem, 1.9vw, 1.75rem); }
  #phrase { font-size: clamp(2.75rem, 5.5vw, 4.75rem); }
  #phrase:is([data-level="A2"], [data-level="B1"]) { font-size: clamp(2.3rem, 5vw, 4.15rem); }
  #phrase[data-level="B2"] { font-size: clamp(2.125rem, 4.6vw, 3.95rem); }
  #phrase[data-level="C1"] { font-size: clamp(2rem, 4.2vw, 3.7rem); }
  #meaning { font-size: clamp(1.35rem, 2.6vw, 2.375rem); }
}
@media (min-width: 1200px) and (max-height: 820px) {
  .home-next {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 12px;
    margin-block-start: 12px;
  }
  .home-next .placement-callout { margin: 0; padding: 12px 16px; column-gap: 12px; }
  .home-next .placement-callout h2 { font-size: clamp(1.4rem, 2.1vw, 1.75rem); }
  .home-next .placement-callout .placement-action { padding-inline: 18px; }
  .home-next .home-actions { display: contents; }
  .home-next .download {
    display: grid;
    align-content: center;
    gap: 4px;
    min-height: 0;
    padding: 10px 14px;
    border: 1px solid var(--card-line);
    border-radius: 24px;
    background: var(--card);
  }
  .home-next .download h2 { font-size: 1.375rem; line-height: 1.2; }
  .home-next .download > div { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; }
  .home-next .home-resources { grid-column: 1 / -1; justify-self: center; width: min(100%, 30rem); }
}
@media (max-width: 720px) {
  .example-location { grid-template-columns: minmax(0, 1fr); grid-template-areas: "map" "copy"; }
}
@media (max-width: 560px) {
  .intro[data-route="home"] { --hold: 735px; --fade: 128px; }
  :root[data-theme="night"] .intro[data-route="home"] { --hold: 285px; --fade: 595px; }
  .example-picker { margin-block-start: 12px; }
  .home-title-join { display: none; }
  .home-title bdi { display: block; font-size: .9em; text-align: right; }
  .example-levels { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .example-levels button { flex-direction: column; gap: 2px; grid-column: span 2; padding-block: 6px; font-size: .875rem; }
  .example-levels button:nth-child(n+4) { grid-column: span 3; }
  .learning-hero { position: relative; min-height: unset; padding-block: 16px 0; gap: 4px; }
  .words { grid-row: 1; }
  .mascot { position: absolute; right: 0; bottom: 6px; width: 80px; margin: 0; }
  #prompt { margin-block-end: 6px; }
  #phrase { font-size: 2.85rem; }
  #phrase[data-level="A2"], #phrase[data-level="B1"] { font-size: 2.6rem; }
  #phrase[data-level="B2"], #phrase[data-level="C1"] { font-size: 2.25rem; }
  .meaning-line { align-content: flex-start; gap: 8px 12px; min-height: 92px; margin-block-start: 4px; padding-right: 92px; }
  .meaning-line .listen { font-size: .9375rem; }
  .voice-status { padding-right: 92px; }
  .placement-callout { padding: 14px; margin-block-start: 0; }
  .placement-callout .action { width: 100%; }
  .footer-social .social-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) and (max-height: 800px) {
  .example-picker { margin-block-start: 6px; }
  .home-title { margin-block-end: 8px; }
  .example-levels { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .example-levels button { position: relative; grid-column: auto; min-height: 44px; padding: 4px; }
  .example-levels button:nth-child(n+4) { grid-column: auto; }
  .example-levels button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .example-skill { display: block; margin-block-start: 6px; font-size: .9375rem; font-weight: 800; }
  .learning-hero { padding-block-start: 10px; }
  #prompt { margin-block-end: 4px; }
  #phrase[data-level="C1"] { font-size: 2rem; }
  .meaning-line { min-height: 82px; }
}
@media (max-width: 360px) and (max-height: 640px) {
  #phrase[data-level="A2"] { font-size: 2.1875rem; }
  #phrase[data-level="C1"] { font-size: 1.75rem; }
  .meaning-line { row-gap: 4px; }
}
