/* English Journey · "a journey to America": airmail, boarding pass, stamps, passport, luggage tags */
:root {
  --navy: #1B2A6B;
  --navy-dark: #121D4D;
  --red: #C8352E;
  --red-text: #A82A24;
  --red-soft: #EBC4BF;
  --paper: #F3EEE2;
  --card: #FFFDF8;
  --green: #2F6B4F;
  --green-soft: #E3F0E7;
  --mustard: #E3A72F;
  --mustard-soft: #FBEBD0;
  --ink: #1E2230;
  --muted: #5A5F6E;
  --line: #DCD2BC;
  --dash: #B9AE96;
  --orange: #B4581B;
  --orange-soft: #FBE7D6;
  --font-display: 'Karantina', 'Rubik', sans-serif;
  --font-ui: 'Rubik', 'Segoe UI', Arial, sans-serif;
  --font-en: 'Atkinson Hyperlegible', 'Segoe UI', Arial, sans-serif;
  --font-code: 'Courier Prime', 'Courier New', monospace;
  --scale: 1;
  --airmail: repeating-linear-gradient(-45deg, var(--red) 0 12px, var(--paper) 12px 20px, var(--navy) 20px 32px, var(--paper) 32px 40px);
  --airmail-card: repeating-linear-gradient(-45deg, var(--red) 0 12px, var(--card) 12px 20px, var(--navy) 20px 32px, var(--card) 32px 40px);
}
:root[data-text="large"] { --scale: 1.15; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #E9E2D2;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: calc(17px * var(--scale));
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.app {
  max-width: 520px;
  min-height: 100%;
  margin: 0 auto;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 0 1px rgba(27, 42, 107, 0.06);
}
.airmail { height: 10px; flex-shrink: 0; background: var(--airmail); }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pad { padding: 0 20px; }
.scroll { flex: 1; overflow-y: auto; padding-bottom: 24px; }
.en { font-family: var(--font-en); direction: ltr; unicode-bidi: isolate; }
.code { font-family: var(--font-code); direction: ltr; unicode-bidi: isolate; letter-spacing: 0.5px; }
.muted { color: var(--muted); }
.display { font-family: var(--font-display); font-weight: 700; color: var(--navy); line-height: 0.95; margin: 0; }
.h-xl { font-size: calc(58px * var(--scale)); }
.h-l { font-size: calc(46px * var(--scale)); }
.h-m { font-size: calc(34px * var(--scale)); }
.small { font-size: calc(14px * var(--scale)); }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* Buttons */
.btn {
  min-height: 56px; border-radius: 14px; border: 0; padding: 0 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-size: calc(19px * var(--scale)); font-weight: 700; text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; box-shadow: 0 3px 0 var(--navy-dark); }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 3px 0 #8E2420; }
.btn-ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); min-height: 48px; }
.btn-dashed { background: transparent; color: var(--red-text); border: 1.5px dashed var(--red); min-height: 44px; border-radius: 6px; font-size: calc(16px * var(--scale)); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: default; box-shadow: none; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 24px; border: 1.5px solid var(--navy);
  background: transparent; color: var(--navy); display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0;
}
.pill { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1.5px solid var(--navy); background: transparent; color: var(--navy); font-weight: 700; font-size: calc(15px * var(--scale)); }
.pill.on { background: var(--navy); color: #fff; }
.tag-label { display: inline-block; padding: 3px 10px; border: 1.5px solid var(--red); border-radius: 4px; color: var(--red-text); font-size: calc(13px * var(--scale)); font-weight: 700; }
.kbd { font-family: var(--font-code); font-size: 12px; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; color: var(--muted); }

/* Home header */
.home-head { padding: 18px 20px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

/* Boarding pass */
.pass { margin: 16px 16px 0; background: var(--card); border-radius: 18px; overflow: hidden; box-shadow: 0 2px 0 var(--line), 0 10px 24px rgba(27, 42, 107, 0.10); }
.pass-band { height: 36px; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; font-size: calc(14px * var(--scale)); font-weight: 500; }
.pass-route { padding: 14px 18px 4px; display: flex; align-items: center; justify-content: space-between; }
.pass-city { font-size: calc(13px * var(--scale)); color: var(--muted); }
.pass-code { font-family: var(--font-code); font-size: calc(36px * var(--scale)); font-weight: 700; color: var(--navy); line-height: 1; direction: ltr; }
.pass-line { flex: 1; margin: 0 14px; position: relative; height: 24px; display: flex; align-items: center; }
.pass-line::before { content: ""; width: 100%; border-top: 2px dashed var(--dash); }
.pass-line .plane { position: absolute; left: 50%; top: 0; transform: translateX(-50%); width: 30px; height: 24px; background: var(--card); color: var(--red); display: flex; align-items: center; justify-content: center; }
.pass-fields { padding: 10px 18px 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pass-fields .k { font-size: calc(12px * var(--scale)); color: var(--muted); }
.pass-fields .v { font-size: calc(16px * var(--scale)); font-weight: 700; }
.tear { position: relative; height: 22px; }
.tear::before, .tear::after { content: ""; position: absolute; top: 0; width: 22px; height: 22px; border-radius: 11px; background: var(--paper); }
.tear::before { right: -11px; } .tear::after { left: -11px; }
.tear span { position: absolute; top: 10px; right: 18px; left: 18px; border-top: 2px dashed #D6CCB5; }
.pass-stub { padding: 6px 18px 18px; display: flex; align-items: center; gap: 14px; }
.barcode { width: 84px; height: 46px; flex-shrink: 0; background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 7px, transparent 7px 8px, var(--ink) 8px 9px, transparent 9px 12px, var(--ink) 12px 15px, transparent 15px 17px); }

/* Stamps (perforated) */
.stamp { position: relative; padding: 5px; background-image: radial-gradient(circle at center, transparent 2.6px, var(--card) 3.1px); background-size: 8px 8px; background-position: -4px -4px; filter: drop-shadow(0 1px 1px rgba(30, 34, 48, 0.2)); }
.stamp-in { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.stamp.big { padding: 6px; background-size: 10px 10px; background-position: -5px -5px; background-image: radial-gradient(circle at center, transparent 3px, var(--card) 3.6px); }
.postmark { position: absolute; border-radius: 50%; border: 2.5px solid currentColor; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; pointer-events: none; background: rgba(243, 238, 226, 0.55); }
.stamp-slot { border-radius: 4px; border: 1.5px dashed var(--dash); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #8A8472; }
.stamp-slot.here { border: 2px dashed var(--red); color: var(--red-text); background: rgba(200, 53, 46, 0.05); }

.passport-row { margin: 12px 20px 0; display: flex; justify-content: flex-start; gap: 8px; }
.passport-row > * { width: 62px; height: 76px; }
.stamp-name { font-size: 11px; font-weight: 700; text-align: center; line-height: 1.1; padding: 0 2px; }

/* Luggage tags */
.tags { margin: 20px 20px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.luggage { position: relative; min-height: 72px; border-radius: 10px 10px 10px 26px; padding: 10px 14px 10px 38px; }
.luggage::after { content: ""; position: absolute; left: 12px; top: 50%; margin-top: -8px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 2px solid rgba(0, 0, 0, 0.25); }
.luggage .n { font-family: var(--font-display); font-size: calc(34px * var(--scale)); font-weight: 700; line-height: 1; }
.luggage.mustard { background: var(--mustard); color: var(--ink); }
.luggage.navy { background: var(--navy); color: #fff; }

/* Bottom nav */
.nav { height: 76px; background: var(--card); border-top: 1.5px solid var(--navy); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); flex-shrink: 0; position: sticky; bottom: 0; }
.nav button { border: 0; background: transparent; color: #4A4F5E; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: calc(13px * var(--scale)); font-weight: 500; }
.nav button[aria-current="page"] { color: var(--red); font-weight: 700; }

/* Lesson */
.lesson-top { padding: 14px 18px 0; display: flex; align-items: center; gap: 12px; }
.flightbar { flex: 1; position: relative; height: 26px; display: flex; align-items: center; }
.flightbar::before { content: ""; position: absolute; right: 0; left: 0; border-top: 2px dashed var(--dash); }
.flightbar .done { position: absolute; right: 0; border-top: 3px solid var(--navy); transition: width 0.3s ease; }
.flightbar .jet { position: absolute; width: 26px; height: 26px; border-radius: 13px; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; transition: right 0.3s ease; }
.ex { padding: 16px 20px 0; display: flex; flex-direction: column; gap: 14px; }
.ex-title { font-family: var(--font-display); font-size: calc(42px * var(--scale)); font-weight: 700; color: var(--navy); line-height: 0.95; margin: 6px 0 0; }
.play-big { width: 80px; height: 80px; border-radius: 40px; border: 5px solid var(--red-soft); background: var(--red); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0; }
.play-big.playing { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.stamps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 4px 2px; }
.stamp-choice { position: relative; border: 0; background: transparent; padding: 0; }
.stamp-choice .stamp { height: calc(128px * var(--scale)); }
.stamp-choice .stamp-in { background: var(--bg, #E6ECF5); border: 2px solid transparent; }
.stamp-choice .emoji { font-size: calc(64px * var(--scale)); line-height: 1; }
.stamp-choice .emoji-img { width: calc(72px * var(--scale)); height: auto; display: block; }
.stamp-choice .denom { position: absolute; bottom: 10px; left: 12px; font-family: var(--font-code); font-size: 11px; font-weight: 700; color: var(--navy); direction: ltr; }
.stamp-choice:nth-child(1) { transform: rotate(-2deg); --bg: #E6ECF5; }
.stamp-choice:nth-child(2) { transform: rotate(1.5deg); --bg: #FBEBD0; }
.stamp-choice:nth-child(3) { transform: rotate(1deg); --bg: #F5E4E2; }
.stamp-choice:nth-child(4) { transform: rotate(-1.5deg); --bg: #E3F0E7; }
.stamp-choice.right .stamp-in { border-color: var(--green); background: var(--green-soft); }
.stamp-choice.wrong .stamp-in { border-color: var(--orange); background: var(--orange-soft); }
.stamp-choice.gone { opacity: 0.25; pointer-events: none; }
.stamp-choice .num { position: absolute; top: 10px; right: 12px; }
.stamp-choice .postmark { top: -10px; left: -10px; width: 64px; height: 64px; font-size: 26px; transform: rotate(-18deg); }

.choices { display: flex; flex-direction: column; gap: 10px; }
.choice { min-height: 58px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); padding: 10px 16px; text-align: start; font-size: calc(19px * var(--scale)); font-weight: 500; display: flex; align-items: center; gap: 12px; }
.choice .kbd { margin-inline-start: auto; }
.choice.right { border: 2px solid var(--green); background: var(--green-soft); }
.choice.wrong { border: 2px solid var(--orange); background: var(--orange-soft); }
.choice.gone { opacity: 0.3; pointer-events: none; }
.word-card { background: var(--card); border-radius: 16px; padding: 18px; text-align: center; box-shadow: 0 2px 0 var(--line); }
.word-big { font-family: var(--font-en); font-size: calc(40px * var(--scale)); font-weight: 700; color: var(--navy); direction: ltr; }

.build-he { font-size: calc(22px * var(--scale)); font-weight: 700; }
.build-line { min-height: 64px; border-bottom: 2px dashed var(--dash); display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; direction: ltr; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; direction: ltr; justify-content: center; }
.tile { min-height: 48px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); font-family: var(--font-en); font-size: calc(20px * var(--scale)); box-shadow: 0 2px 0 var(--line); }
.tile.used { visibility: hidden; }

.say-card { background: var(--card); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 2px 0 var(--line); }
.say-en { font-family: var(--font-en); font-size: calc(26px * var(--scale)); font-weight: 700; color: var(--navy); direction: ltr; text-align: left; }
.mic { width: 88px; height: 88px; border-radius: 44px; border: 0; background: radial-gradient(circle, var(--red) 0 34px, #D9574F 34px 38px, var(--red) 38px 44px); color: #fff; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 3px 0 #8E2420; }
.mic.on { animation: pulse 0.9s ease-in-out infinite; }

/* Feedback postcard */
.sheet-wrap { margin-top: auto; padding: 12px 12px 14px; position: sticky; bottom: 0; }
.postcard { padding: 6px; border-radius: 16px; background: var(--airmail-card); animation: rise 0.22s ease-out; }
.postcard-in { background: var(--card); border-radius: 11px; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.postcard.bad { background: repeating-linear-gradient(-45deg, var(--orange) 0 12px, var(--card) 12px 20px, var(--navy) 20px 32px, var(--card) 32px 40px); }
.verdict { font-family: var(--font-display); font-size: calc(36px * var(--scale)); font-weight: 700; line-height: 1; }
.verdict.good { color: var(--green); } .verdict.bad { color: var(--orange); }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.aux { display: flex; justify-content: center; gap: 8px; padding: 10px 16px 16px; flex-wrap: wrap; margin-top: auto; }

/* Chat */
.chat-head { padding: 14px 16px 12px; display: flex; align-items: center; gap: 12px; border-bottom: 1.5px solid var(--navy); }
.avatar { width: 60px; height: 70px; flex-shrink: 0; transform: rotate(-4deg); }
.avatar .stamp-in { background: var(--mustard-soft); }
.task { margin: 12px 16px 0; display: flex; align-items: stretch; background: var(--card); border: 1.5px solid var(--navy); border-radius: 10px; overflow: hidden; }
.task b { background: var(--navy); color: #fff; padding: 0 10px; display: flex; align-items: center; font-family: var(--font-display); font-size: 24px; }
.task span { flex: 1; padding: 8px 12px; font-size: calc(15px * var(--scale)); }
.chat { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 86%; display: flex; flex-direction: column; gap: 6px; }
.msg.them { align-self: flex-start; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.note { background: var(--card); border-radius: 4px 4px 18px 18px; overflow: hidden; box-shadow: 0 1px 0 var(--line); }
.note::before { content: ""; display: block; height: 5px; background: repeating-linear-gradient(-45deg, var(--red) 0 8px, var(--card) 8px 12px, var(--navy) 12px 20px, var(--card) 20px 24px); }
.note .en { padding: 10px 16px 10px; font-size: calc(19px * var(--scale)); line-height: 1.4; text-align: left; display: block; }
.note .he { padding: 8px 16px 12px; font-size: calc(15px * var(--scale)); color: var(--muted); border-top: 1px dashed #E2D8C2; }
.bubble-me { background: var(--navy); color: #fff; border-radius: 18px 18px 18px 4px; padding: 12px 16px; font-size: calc(19px * var(--scale)); }
.typing { color: var(--muted); font-size: 14px; }

/* Lists and cards */
.card { background: var(--card); border-radius: 14px; border: 1px solid #EDE5D3; padding: 14px 16px; }
.chapter-row { min-height: 64px; border-radius: 14px; background: var(--card); border: 1px solid #EDE5D3; display: flex; align-items: center; gap: 12px; padding: 8px 14px; width: 100%; text-align: start; }
.chapter-row.current { background: #FFF8EA; border: 2px solid var(--mustard); }
.chapter-row.locked { background: transparent; border: 1px dashed #D8CDB6; color: var(--muted); }
.badge { width: 34px; height: 34px; border-radius: 17px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font-ui); font-weight: 700; }
.lesson-dot { width: 40px; height: 40px; border-radius: 20px; border: 1.5px solid var(--navy); background: transparent; color: var(--navy); font-weight: 700; }
.lesson-dot.done { background: var(--green); border-color: var(--green); color: #fff; }
.lesson-dot.next { background: var(--red); border-color: var(--red); color: #fff; }
.word-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #E2D8C2; }
.meter { height: 8px; border-radius: 4px; background: #EFE6D4; overflow: hidden; width: 60px; }
.meter i { display: block; height: 100%; background: var(--green); }
.progress { height: 12px; border-radius: 6px; background: #EFE6D4; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--mustard); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; }
.input { min-height: 52px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); padding: 0 14px; font-size: calc(18px * var(--scale)); }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.opt { border-radius: 14px; border: 2px solid var(--line); background: var(--card); padding: 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.opt[aria-pressed="true"] { border-color: var(--navy); background: #EAF0F7; box-shadow: inset 0 0 0 1px var(--navy); }
.avatars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.avatars button { border: 2px solid transparent; background: transparent; border-radius: 10px; padding: 4px; }
.avatars button[aria-pressed="true"] { border-color: var(--navy); }

/* First-time tip */
.tip { margin: 12px 16px 0; padding: 10px 12px; border-radius: 12px; background: #FFF8EA; border: 1.5px dashed var(--mustard); display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; animation: rise 0.25s ease-out; }
.tip b { display: flex; align-items: center; gap: 6px; color: var(--navy); font-size: calc(15px * var(--scale)); }
.tip span { grid-column: 1; font-size: calc(15px * var(--scale)); }
.tip-x { grid-row: 1 / span 2; grid-column: 2; align-self: start; width: 36px; height: 36px; border: 0; background: transparent; color: var(--muted); border-radius: 18px; }

.toast { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 15px; z-index: 10; max-width: 90vw; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.spin { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--navy); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
