/* Say It In Burmese — phone-first, dark, big touch targets. */

/* Burmese script ships with the app rather than being left to the device.
   Windows has no Myanmar font at all, older Androids draw Burmese as boxes,
   and a good number of phones in Myanmar still carry a Zawgyi font, which maps
   the same bytes to different letters — so the system font is a coin toss on
   whether the one line the other person has to read is even legible. */
@font-face {
  font-family: 'Noto Sans Myanmar';
  src: url('fonts/NotoSansMyanmar-subset.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+1000-109F, U+200C-200D, U+25CC, U+A92E, U+A9E0-A9FE, U+AA60-AA7F;
}

:root {
  color-scheme: dark;
  --bg:        #0e1116;
  --bg-raised: #171b22;
  --bg-hover:  #1e242d;
  --line:      #262d38;
  --text:      #e8ecf2;
  --text-dim:  #9aa4b2;
  --text-faint:#6b7482;
  --accent:    #e8a33d;
  --accent-dim:#3a2a14;

  /* Tone colours. Mandarin learners have Pleco's mapping as a de-facto
     standard to line up with; Burmese has nothing of the kind, so these are
     chosen for separation rather than convention: four hues that stay
     distinguishable to the commonest colour-vision deficiencies, and none of
     them the app's amber accent.

     Colour is deliberately the secondary channel. The one controlled study of
     tone colour-coding found it performed worse than plain tone marks, so the
     contour glyph under each syllable is the primary signal and colour only
     reinforces it. */
  --t1: #5aa9ff;   /* level   */
  --t2: #ff6b6b;   /* falling */
  --t3: #3ecf7d;   /* sharp   */
  --t4: #c08cff;   /* stopped */

  /* For elements that are purely Burmese. The shipped font comes first, with
     the platform Myanmar fonts behind it in case the download fails. */
  --my-font: 'Noto Sans Myanmar', "Myanmar Sangam MN", "Myanmar Text", "Padauk", sans-serif;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* The UA's [hidden] rule is HTML-namespaced, so it silently does nothing to
   <svg>. Restate it namespace-agnostically. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* 'Noto Sans Myanmar' leads the stack but is declared with a unicode-range
     covering only Burmese, so the browser reaches for it for Burmese letters
     and nothing else — which is what makes Burmese inside an English sentence
     (the notes, the hints) render from the shipped font without pulling Latin
     text into it too. */
  font: 16px/1.5 'Noto Sans Myanmar', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overscroll-behavior-y: none;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
/* Keyboard focus only; a tap on a phone shows nothing. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Top bar ─────────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-t) + 14px) 16px 10px;
  background: rgba(14, 17, 22, .86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

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

.topbar h1 {
  margin: 0;
  font-size: 19px; font-weight: 700; letter-spacing: -.02em;
}

.ghost-btn {
  flex: none;
  padding: 9px 14px;
  font-size: 14px; font-weight: 600; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 999px;
}
.ghost-btn:active { background: var(--bg-hover); }

.primary-btn {
  flex: none;
  padding: 9px 18px;
  font-size: 14px; font-weight: 700; color: #1a1205;
  background: var(--accent); border-radius: 999px;
}
.primary-btn:active { filter: brightness(.92); }

.menu-btn { margin: 0 -8px 0 0; }

.search-wrap { position: relative; margin-top: 12px; }
.search-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-faint); pointer-events: none;
}
#search {
  width: 100%; height: 42px;
  padding: 0 14px 0 40px;
  font-size: 16px; color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: 12px;
  -webkit-appearance: none;
}
#search::placeholder { color: var(--text-faint); }
/* iOS only draws its own clear button while the field has focus, and it is
   tiny; ours is always there once something's typed, and thumb-sized. */
#search::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
#search { padding-right: 44px; }
.search-clear {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; padding: 0; border: 0; background: none;
  color: var(--text-faint); display: grid; place-items: center;
}
.search-clear svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
#search:focus { outline: none; border-color: var(--accent); }

.chips {
  display: flex; gap: 8px;
  margin: 12px -16px -2px; padding: 0 16px 4px;
  overflow-x: auto; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.drill-from { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; }

.chip {
  flex: none;
  padding: 8px 14px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: 999px;
}
.chip[aria-pressed="true"] {
  color: #1a1205;
  background: var(--accent);
  border-color: var(--accent);
}
/* A search spans everything, so the selected chip isn't in force meanwhile. */
.chips.searching .chip[aria-pressed="true"] { opacity: .45; }

/* ── Phrase list ─────────────────────────────────────────── */

.list {
  padding: 12px 16px calc(var(--safe-b) + 32px);
  display: flex; flex-direction: column; gap: 8px;
}

.cat-head {
  margin: 14px 2px 2px;
  font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint);
}
.cat-head:first-child { margin-top: 2px; }

.list-intro {
  margin: 2px 2px 6px;
  font-size: 13px; line-height: 1.5; color: var(--text-dim);
}

.card {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 13px 14px;
  text-align: left;
  background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: 14px;
}
.card:active { background: var(--bg-hover); }
.card { position: relative; }
.card-open { position: absolute; inset: 0; border-radius: inherit; }
.card-open:focus-visible { outline-offset: -2px; }
.card .copy-mini, .card-play { position: relative; z-index: 1; }

.card-text { flex: 1; min-width: 0; }
.card-en {
  font-size: 16px; font-weight: 600; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-my { margin-top: 3px; font-size: 15px; }
.card-say { font-weight: 600; }
.card-say .t1 { color: var(--t1); } .card-say .t2 { color: var(--t2); }
.card-say .t3 { color: var(--t3); } .card-say .t4 { color: var(--t4); }
.card-burmese {
  display: flex; align-items: center; gap: 6px;
  margin-top: 3px; font-size: 15px;
  color: var(--text-dim);
  font-family: var(--my-font);
}
.card-burmese [lang] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-mini {
  flex: none;
  display: grid; place-items: center;
  width: 30px; height: 30px; margin: -6px 0;
  color: var(--text-faint);
  border-radius: 8px;
}
.copy-mini svg, .copy-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.copy-mini:active { color: var(--accent); background: var(--bg-hover); }
.card-fav { flex: none; width: 15px; height: 15px; color: var(--accent); fill: var(--accent); }

.card-play {
  flex: none;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  color: var(--text-dim);
  background: var(--bg-hover);
  border-radius: 50%;
}
.card-play svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.card-play:active, .card-play.playing { color: #1a1205; background: var(--accent); }

.empty { padding: 40px 16px; text-align: center; color: var(--text-faint); }

/* ── Detail sheet ────────────────────────────────────────── */

.sheet {
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: rise .22s cubic-bezier(.22,.75,.3,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.sheet-inner {
  max-width: 620px; margin: 0 auto;
  padding: calc(var(--safe-t) + 10px) 20px calc(var(--safe-b) + 40px);
}

.sheet-head { display: flex; align-items: center; justify-content: space-between; }

.icon-btn {
  display: grid; place-items: center;
  width: 42px; height: 42px; margin-left: -10px;
  color: var(--text-dim);
  border-radius: 50%;
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn.star { margin: 0 -8px 0 0; }
.icon-btn.star[aria-pressed="true"] { color: var(--accent); }
.icon-btn.star[aria-pressed="true"] svg { fill: var(--accent); }

.d-en {
  margin: 14px 0 0;
  font-size: 27px; font-weight: 700; line-height: 1.24; letter-spacing: -.025em;
}

.d-copy {
  display: flex; align-items: center; gap: 12px;
  margin: 10px 0 0;
}
.d-my {
  flex: 1; min-width: 0; margin: 0;
  font-family: var(--my-font); font-size: 22px; line-height: 1.6;
  color: var(--text-dim);
  -webkit-user-select: text; user-select: text;
}
.copy-btn { flex: none; }

.d-note {
  margin: 12px 0 0; padding: 11px 13px;
  font-size: 14px; line-height: 1.45; color: var(--text-dim);
  background: var(--bg-raised);
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
}

/* Script + transcription stack, one column per syllable */

.script-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 26px 0 0;
}

.syl {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 46px; padding: 8px 6px 7px;
  border-radius: 11px;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s, transform .12s;
}
.syl.word-end { margin-right: 10px; }
.syl.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* The respelling is the headline — it's what actually gets read aloud. */
.syl-say {
  font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -.015em;
}
.syl-my {
  font-family: var(--my-font);
  /* Burmese stacks marks above and below the consonant, so it needs a taller
     line box than Latin at the same nominal size or the tops get clipped. */
  font-size: 20px; line-height: 1.65; font-weight: 500; opacity: .85;
}
.syl-rom { font-size: 13px; font-weight: 600; letter-spacing: .01em; opacity: .85; }
.syl-tone { width: 15px; height: 9px; opacity: .85; }
.syl-tone path { stroke-width: 2.4; }

.t1 .syl-say, .t1 .syl-my, .t1 .syl-rom, .t1 .syl-tone { color: var(--t1); }
.t2 .syl-say, .t2 .syl-my, .t2 .syl-rom, .t2 .syl-tone { color: var(--t2); }
.t3 .syl-say, .t3 .syl-my, .t3 .syl-rom, .t3 .syl-tone { color: var(--t3); }
.t4 .syl-say, .t4 .syl-my, .t4 .syl-rom, .t4 .syl-tone { color: var(--t4); }

.d-phon {
  margin: 18px 0 0;
  font-size: 15px; color: var(--text-dim);
}
.d-phon b { color: var(--text); font-weight: 600; }

.d-voicing {
  margin: 10px 0 0; padding: 11px 13px;
  font-size: 13px; line-height: 1.6; color: var(--text-dim);
  background: var(--bg-raised); border-radius: 10px;
}
.d-voicing b { color: var(--text); font-weight: 600; }

/* Marks a syllable whose opening consonant softens because of the one before. */
.syl.voiced .syl-say {
  text-decoration: underline dotted currentColor 2px;
  text-underline-offset: 4px;
}

/* ── Player ──────────────────────────────────────────────── */

.player {
  display: flex; align-items: center; gap: 18px;
  margin: 28px 0 0; padding: 18px;
  background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: 18px;
}

.play-btn {
  flex: none;
  display: grid; place-items: center;
  width: 68px; height: 68px;
  color: #1a1205;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 6px 20px -6px var(--accent);
  transition: transform .12s;
}
.play-btn:active { transform: scale(.94); }
.play-btn svg { grid-area: 1 / 1; width: 30px; height: 30px; fill: currentColor; stroke: none; }
.play-btn .i-play { margin-left: 2px; }
.play-btn:not(.playing) .i-stop { display: none; }
.play-btn.playing .i-play { display: none; }

.speed { flex: 1; min-width: 0; }
.speed-head { display: flex; align-items: baseline; justify-content: space-between; }
.speed-head label { font-size: 13px; font-weight: 600; color: var(--text-dim); }
#speed-val {
  font-size: 15px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#speed {
  width: 100%; height: 34px; margin: 2px 0 0;
  background: none; -webkit-appearance: none; appearance: none;
}
#speed::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(var(--accent), var(--accent)) 0/var(--fill,50%) 100% no-repeat, var(--bg-hover);
}
#speed::-moz-range-track { height: 6px; border-radius: 3px; background: var(--bg-hover); }
#speed::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
#speed::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px; height: 26px; margin-top: -10px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
#speed::-moz-range-thumb {
  width: 26px; height: 26px; border: none;
  background: #fff; border-radius: 50%;
}

.speed-ticks {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-faint);
}

/* ── Mode buttons ────────────────────────────────────────── */

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }

.mode-btn {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 8px;
  background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: 14px;
}
.mode-title { font-size: 14px; font-weight: 600; }
.mode-sub   { font-size: 11px; color: var(--text-faint); }
.mode-btn[aria-pressed="true"] {
  color: #1a1205;
  background: var(--accent);
  border-color: var(--accent);
}
.mode-btn[aria-pressed="true"] .mode-sub { color: rgba(26,18,5,.72); }

.hint {
  margin: 12px 0 0; padding: 11px 13px;
  font-size: 13px; line-height: 1.45; color: var(--text-dim);
  background: var(--bg-raised); border-radius: 12px;
}

/* ── Record & compare ────────────────────────────────────── */

.compare { margin-top: 12px; }

.rec-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px;
  font-size: 15px; font-weight: 600;
  background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: 14px;
}
.rec-btn:active { background: var(--bg-hover); }

.rec-dot {
  width: 12px; height: 12px;
  background: var(--accent); border-radius: 50%;
}
.rec-btn.recording { border-color: var(--accent); color: var(--accent); }
.rec-btn.recording .rec-dot { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }

.cmp-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }

.cmp-btn {
  padding: 12px 8px;
  font-size: 14px; font-weight: 600;
  background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: 14px;
}
.cmp-btn:active { background: var(--bg-hover); }
.cmp-btn.accent { color: #1a1205; background: var(--accent); border-color: var(--accent); }

/* ── Tone legend ─────────────────────────────────────────── */

.tone-key {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  margin-top: 26px; padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--text-faint);
}
.tone-key-label { font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.tk { display: inline-flex; align-items: center; gap: 5px; }
.tk i { width: 10px; height: 10px; border-radius: 3px; }
.tk.t1 i { background: var(--t1); } .tk.t2 i { background: var(--t2); }
.tk.t3 i { background: var(--t3); } .tk.t4 i { background: var(--t4); }

/* ── Settings ────────────────────────────────────────────── */

.sheet-title {
  margin: 10px 0 4px;
  font-size: 28px; font-weight: 700; letter-spacing: -.025em;
}

.group { margin-top: 26px; }

.group-head {
  margin: 0 2px 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint);
}

.group-body {
  background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden;
}

.row {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 14px;
  text-align: left;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: none; }
.row.action:active { background: var(--bg-hover); }

.row-text { flex: 1; min-width: 0; }
.row-title { display: block; font-size: 15px; font-weight: 600; }
.row-sub {
  display: block; margin-top: 3px;
  font-size: 13px; line-height: 1.45; color: var(--text-dim);
}
.row-sub a { color: var(--accent); }
.row.block { display: block; }
.row.block .row-title { margin-bottom: 4px; }
.row-sub b { color: var(--text); font-weight: 600; }

.inline-ico {
  width: 15px; height: 15px; vertical-align: -3px;
  color: var(--accent);
}

.pill {
  flex: none;
  padding: 7px 14px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
  color: #1a1205; background: var(--accent);
  border-radius: 999px;
}
.pill.danger { color: var(--text-dim); background: var(--bg-hover); }
.pill[data-state="busy"] { color: var(--text-dim); background: var(--bg-hover); }
.pill[data-state="done"] { color: #06121f; background: var(--t1); }

/* Toggle switch */
.row.toggle { cursor: pointer; }
.row.toggle input { position: absolute; opacity: 0; pointer-events: none; }

.switch {
  flex: none; position: relative;
  width: 50px; height: 30px;
  background: var(--bg-hover);
  border: 1px solid var(--line); border-radius: 999px;
  transition: background .16s, border-color .16s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px;
  background: var(--text-dim); border-radius: 50%;
  transition: transform .16s, background .16s;
}
.row.toggle input:checked ~ .switch { background: var(--accent); border-color: var(--accent); }
.row.toggle input:checked ~ .switch::after { transform: translateX(20px); background: #fff; }
.row.toggle input:focus-visible ~ .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Update prompt ───────────────────────────────────────── */

.update-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-b) + 12px); z-index: 70;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  max-width: 560px; margin: 0 auto; padding: 14px 16px;
  background: var(--bg-hover);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 12px 36px rgba(0,0,0,.55);
  animation: rise .24s cubic-bezier(.22,.75,.3,1);
}
.update-text { flex: 1; min-width: 150px; }
.update-text strong { display: block; font-size: 15px; }
.update-text span { font-size: 13px; color: var(--text-dim); }
.update-actions { display: flex; gap: 8px; }

/* ── Display preferences ─────────────────────────────────── */

/* Tone colouring off: fall back to plain text, but keep the contour marks,
   which still carry the tone without relying on colour. */
html.no-tone-colour .syl-say,
html.no-tone-colour .syl-my,
html.no-tone-colour .syl-rom,
html.no-tone-colour .card-say .t1,
html.no-tone-colour .card-say .t2,
html.no-tone-colour .card-say .t3,
html.no-tone-colour .card-say .t4 { color: var(--text); }

html.hide-rom .syl-rom { display: none; }

html.hide-script .syl-my { display: none; }

/* ── Ear training ────────────────────────────────────────── */

.ear-btn { margin-left: auto; margin-right: 4px; color: var(--text-dim); }

.drill-score { font-size: 14px; font-weight: 700; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.drill-lead { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--text-dim); }

.drill-card {
  margin-top: 20px; padding: 22px 18px;
  text-align: center;
  background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: 16px;
}
.drill-meaning { margin: 0; font-size: 14px; color: var(--text-dim); }
.drill-syl { margin: 8px 0 2px; font-size: 40px; font-weight: 700; letter-spacing: -.02em; }
.drill-where { margin: 0 0 16px; font-size: 13px; color: var(--text-faint); }

.drill-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }

.drill-choice {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: 14px;
  font-size: 15px; font-weight: 600;
}
.drill-choice svg { width: 26px; height: 15px; }
.drill-choice svg path { stroke-width: 2.4; }
.drill-choice:active { background: var(--bg-hover); }
.drill-choice[disabled] { opacity: .45; }
.drill-choice.correct { border-color: var(--t3); background: color-mix(in srgb, var(--t3) 18%, transparent); opacity: 1; }
.drill-choice.wrong   { border-color: var(--t2); background: color-mix(in srgb, var(--t2) 18%, transparent); opacity: 1; }

.drill-feedback { margin: 16px 0 0; font-size: 15px; line-height: 1.5; }
.drill-feedback b { font-weight: 700; }
.drill-next { width: 100%; margin-top: 12px; padding: 15px; }

/* ── Present mode ────────────────────────────────────────── */

.sheet-head-right { display: flex; align-items: center; gap: 6px; }

.pill-btn {
  padding: 8px 14px;
  font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 999px;
}
.pill-btn:active { background: var(--bg-hover); }

.present {
  position: fixed; inset: 0; z-index: 80;
  display: flex; flex-direction: column;
  /* Near-black behind near-white: maximum legibility across a dim table. */
  background: #000; color: #fff;
  padding: calc(var(--safe-t) + 16px) 16px calc(var(--safe-b) + 16px);
}

.present-body {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4vh; text-align: center;
  transition: transform .2s;
}
.present.flipped .present-body { transform: rotate(180deg); }

.present-en { margin: 0; font-size: 20px; font-weight: 600; color: #9aa4b2; }
.present-my {
  margin: 0;
  font-family: var(--my-font);
  /* Scales with the viewport so it stays readable across a table. Burmese sets
     wider than Chinese at the same point size — round glyphs, no stacking of
     whole words — so this caps lower than the Mandarin app's equivalent. */
  font-size: min(13vw, 10vh); line-height: 1.6; font-weight: 500;
  letter-spacing: .01em;
}
.present-rom { margin: 0; font-size: 22px; color: #c3cad4; }

.present-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.present .cmp-btn { background: #14181e; border-color: #2a313c; color: #fff; }

/* ── Quick strip ─────────────────────────────────────────── */

.quickbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 8px 12px calc(var(--safe-b) + 8px);
  background: rgba(14, 17, 22, .93);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}

.quick-tiles {
  display: flex; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
}
.quick-tiles::-webkit-scrollbar { display: none; }

.quick-tile {
  flex: none;
  display: flex; flex-direction: column; gap: 2px;
  /* Comfortably past the 44pt minimum — this gets tapped one-handed, walking. */
  min-width: 116px; min-height: 56px;
  padding: 9px 12px;
  text-align: left;
  background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: 12px;
}
.quick-tile:active { background: var(--bg-hover); border-color: var(--accent); }
.quick-tile.playing { border-color: var(--accent); }
.quick-tile-en {
  font-size: 13px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 150px;
}
.quick-tile-say {
  font-size: 12px; color: var(--text-dim); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 150px;
}

/* Keep the last cards clear of the fixed strip. */
body.has-quickbar .list { padding-bottom: calc(var(--safe-b) + 104px); }

/* ── Toast ───────────────────────────────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 24px); z-index: 90;
  transform: translateX(-50%);
  padding: 11px 18px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  background: var(--bg-hover);
  border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
  animation: rise .2s;
}

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

/* ── Live mode ───────────────────────────────────────────
   Built for one-handed use in front of another person: everything is either
   the full width of the screen or in the bottom third where a thumb already
   is, and the line you read is the largest thing on the display by a long way.
   Black rather than the app background, so a face-up phone looks switched off
   in a dim room. */

.live-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px 8px 11px;
  color: #1a1205; font-weight: 700;
  background: var(--accent); border-color: var(--accent);
}
.live-btn svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.live-btn:active { filter: brightness(.92); background: var(--accent); }

.ear-btn { margin: 0; color: var(--text-dim); }

.live {
  position: fixed; inset: 0; z-index: 85;
  display: flex; flex-direction: column;
  background: #000; color: #fff;
  padding: calc(var(--safe-t) + 10px) 16px calc(var(--safe-b) + 12px);
  animation: rise .2s cubic-bezier(.22,.75,.3,1);
}

/* Dimmed: the phone is on the table and should read as asleep. Kept just above
   invisible rather than at zero so you can still find the card to tap. */
.live.dimmed > * { opacity: .06; transition: opacity .35s; }
.live.dimmed .live-card { opacity: .1; }

.live-top {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-dim);
}
.live-top .close-btn { margin-left: -10px; color: var(--text-dim); }
.live-deck-name { flex: 1; font-size: 14px; font-weight: 600; }
.live-count { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

.live-card {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  min-height: 0; padding: 8px 4px;
  text-align: center;
  border: none; background: none; color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.live-card.saying .live-say { color: var(--accent); }

.live-en { margin: 0; font-size: 19px; font-weight: 600; color: #9aa4b2; }

/* The line you actually read out loud. Sized off the viewport so it stays
   legible at arm's length, and capped so a long phrase still fits. */
.live-say {
  margin: 0;
  font-size: clamp(30px, 9vw, 52px); line-height: 1.16;
  font-weight: 800; letter-spacing: -.02em;
  transition: color .15s;
}
.live-my {
  margin: 0;
  font-family: var(--my-font);
  font-size: clamp(17px, 5vw, 26px); line-height: 1.7;
  color: #c3cad4; opacity: .9;
}
.live-note {
  margin: 0; max-width: 34ch;
  font-size: 13px; line-height: 1.45; color: #6b7482;
}
.live-note:empty { display: none; }

.live-dots { display: flex; justify-content: center; gap: 6px; height: 7px; margin-bottom: 14px; }
.live-dots i { width: 6px; height: 6px; border-radius: 50%; background: #2a313c; }
.live-dots i.on { background: var(--accent); }

.live-controls { display: flex; align-items: stretch; gap: 10px; }

.live-step {
  flex: none;
  display: grid; place-items: center;
  width: 62px;
  background: #14181e;
  border: 1px solid #2a313c; border-radius: 18px;
  color: #fff;
}
.live-step svg { width: 26px; height: 26px; }
.live-step:active { background: #1e242d; }

/* The one control that gets hit without looking. */
.live-say-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 78px;
  font-size: 19px; font-weight: 800; letter-spacing: -.01em;
  color: #1a1205;
  background: var(--accent);
  border-radius: 18px;
  box-shadow: 0 8px 26px -10px var(--accent);
}
.live-say-btn svg { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.live-say-btn:active { transform: scale(.985); }
.live-say-btn:not(.playing) .i-stop { display: none; }
.live-say-btn.playing .i-play { display: none; }

/* Four to a row: seven chips in one line overflow a 375px phone, and the
   last ones end up off the screen. */
.live-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }

.live-chip {
  flex: 1;
  padding: 11px 6px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  color: var(--text-dim);
  background: #14181e;
  border: 1px solid #2a313c; border-radius: 12px;
}
.live-chip[aria-pressed="true"] { color: #1a1205; background: var(--accent); border-color: var(--accent); }
.live-chip:active { background: #1e242d; }

.live-decks {
  display: flex; gap: 8px;
  margin: 10px -16px 0; padding: 0 16px 2px;
  overflow-x: auto; scrollbar-width: none;
}
.live-decks::-webkit-scrollbar { display: none; }

.live-deck {
  flex: none;
  padding: 8px 13px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  color: var(--text-dim);
  background: #14181e;
  border: 1px solid #2a313c; border-radius: 999px;
}
.live-deck[aria-pressed="true"] { color: #fff; background: #2a313c; border-color: #3a4351; }

.live-hint {
  margin: 10px 0 0;
  font-size: 11.5px; line-height: 1.45; text-align: center; color: #4a525e;
}
.live-hint b { color: #6b7482; font-weight: 700; }

/* A short phone has no room for the deck strip and the footnote on top of a
   usable card, and the card is what matters. */
@media (max-height: 700px) {
  .live-hint { display: none; }
  .live-decks { margin-top: 8px; }
}
@media (max-height: 600px) {
  .live-note, .live-decks { display: none; }
}

/* Shown in place of the list if the phrase data fails to load. */
.load-failed { padding: 40px 8px; text-align: center; color: var(--text-dim); line-height: 1.5; }
.load-failed b { color: var(--text); }
.load-failed .primary-btn { margin-top: 12px; }
