/* Satz — a warm-white ground with peach and lilac accents,
   Inria Serif headlines, black pill actions, floating tab bar. */

@font-face {
  font-family: "Inria Serif";
  src: url("fonts/inria-serif-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inria Serif";
  src: url("fonts/inria-serif-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #fbf8f4;
  --bg-grad: linear-gradient(165deg, #fffefd 0%, #fbf8f4 52%, #f8f4ef 100%);
  --surface: #ffffff;
  --ink: #17161a;
  --ink-soft: #8a8479;
  --line: #e7e5e0;
  --pill: #1b1a1f;
  --pill-ink: #ffffff;
  --tag-bg: #e9e4f2;
  --tag-ink: #5c5670;
  --peach: #e8b18c;
  --good: #3c7a55;
  --bad: #b0503a;
  --chip-bg: rgba(255, 255, 255, 0.82);
  --card-shadow: 0 10px 30px rgba(63, 56, 72, 0.08);
  --sheet-shadow: 0 -14px 44px rgba(90, 74, 54, 0.22);
  --serif: Georgia, "Times New Roman", serif;
  --heading-serif: "Inria Serif", Georgia, "Times New Roman", serif;
  --punch: #e8b18c;
  --deck1: #f3ddc9;
  --deck2: #e6dff1;
  --blob1: rgba(232, 177, 140, 0.45);
  --blob2: rgba(176, 156, 214, 0.35);
  --lvA1-bg: #d9eede; --lvA1-ink: #2e6b4f;
  --lvA2-bg: #d8e6f3; --lvA2-ink: #33608c;
  --lvB1-bg: #f9e0c7; --lvB1-ink: #8a5220;
  --lvB2-bg: #f5e7bd; --lvB2-ink: #7c5c12;
  --lvC1-bg: #e5dff4; --lvC1-ink: #5a4b8a;
  --lvC2-bg: #f4dae5; --lvC2-ink: #8c3f63;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161419;
    --bg-grad: linear-gradient(165deg, #1a1720 0%, #161419 55%, #131117 100%);
    --surface: #211f28;
    --ink: #f0ebe3;
    --ink-soft: #99929e;
    --line: #322f3a;
    --pill: #f0ebe3;
    --pill-ink: #1b1a1f;
    --tag-bg: #37323f;
    --tag-ink: #c6bfd4;
    --peach: #e0a67f;
    --good: #7cc39a;
    --bad: #e0937c;
    --chip-bg: rgba(33, 31, 40, 0.75);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --sheet-shadow: 0 -14px 44px rgba(0, 0, 0, 0.6);
    --punch: #55415f;
    --deck1: #2e2632;
    --deck2: #292437;
    --blob1: rgba(232, 177, 140, 0.1);
    --blob2: rgba(176, 156, 214, 0.1);
    --lvA1-bg: #24382d; --lvA1-ink: #97cbaa;
    --lvA2-bg: #243343; --lvA2-ink: #9cc0e4;
    --lvB1-bg: #3e2f1f; --lvB1-ink: #e9b980;
    --lvB2-bg: #3b341c; --lvB2-ink: #ddc678;
    --lvC1-bg: #2f2a42; --lvC1-ink: #b7a8e6;
    --lvC2-bg: #3d2733; --lvC2-ink: #e3a2c1;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
button, .chip, .w, .level-choice-button { -webkit-tap-highlight-color: transparent; }

/* Haptics handle the physical acknowledgement on iPhone. These tiny press
   states keep the web surface in sync without adding decorative motion. */
@media (prefers-reduced-motion: no-preference) {
  .tab, .icon-btn, .sheet-say, .why-btn, .voice-input-btn, .w {
    transition: transform 140ms var(--ease-out), opacity 140ms ease;
  }
  .tab:active, .icon-btn:active, .sheet-say:active, .why-btn:active, .voice-input-btn:active, .w:active {
    transform: scale(0.97);
    opacity: 0.78;
  }
}

/* Splash — letters emerge from the field, bounce into place, then the whole sheet lifts. */
#splash {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #ffffff;
  overflow: hidden;
  transition: opacity 0.24s ease-out;
}
#splash.done { pointer-events: none; animation: splash-sheet-out 620ms cubic-bezier(0.7, 0, 0.2, 1) both; }
.splash-field { opacity: 0.98; }
.splash-stage { position: absolute; inset: 0; overflow: hidden; }
.splash-letter {
  position: absolute;
  display: flex;
  width: 34px;
  height: 44px;
  margin-left: -17px;
  margin-top: -22px;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #c9364a;
  border-radius: 999px;
  background: transparent;
  color: #c9364a;
  font: 600 24px ui-monospace, Menlo, monospace;
  opacity: 0;
  transform-origin: center;
  will-change: transform;
}
.splash-o {
  overflow: visible;
  transition: width 420ms cubic-bezier(0.22, 0.8, 0.25, 1), height 420ms cubic-bezier(0.22, 0.8, 0.25, 1), margin 420ms cubic-bezier(0.22, 0.8, 0.25, 1), border-radius 420ms cubic-bezier(0.22, 0.8, 0.25, 1);
}
.splash-o-glyph { position: relative; z-index: 1; }
.splash-o-icon {
  position: absolute;
  top: 50%;
  left: 63%;
  z-index: 2;
  width: 48px;
  height: 48px;
  margin: 0;
  border-radius: 10px;
  object-fit: cover;
  opacity: 0;
  transform: translate(-58%, -50%) scale(0.55);
}
.splash-o::after {
  content: "";
  position: absolute;
  inset: 5px 2px;
  z-index: 3;
  border-radius: 7px;
  pointer-events: none;
  opacity: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 248, 238, 0.95) 0 2px,
    rgba(255, 248, 238, 0) 2px 5px
  );
}
.splash-letter.settled {
  color: #ffffff;
  background: #1b1a1f;
  border-color: #1b1a1f;
  box-shadow: 0 4px 0 #e8b18c;
  transition: background 240ms ease, color 240ms ease, border-color 240ms ease, box-shadow 240ms ease;
}
/* The emoji replaces the O glyph, not the pill: its matching outlined frame
   keeps the mouth character legible against the busy letter field. */
.splash-o.settled {
  background: #ffffff;
  border-color: #5a4b8a;
  box-shadow: 0 3px 0 #e8b18c;
  transition: width 420ms cubic-bezier(0.22, 0.8, 0.25, 1), height 420ms cubic-bezier(0.22, 0.8, 0.25, 1), margin 420ms cubic-bezier(0.22, 0.8, 0.25, 1), border-radius 420ms cubic-bezier(0.22, 0.8, 0.25, 1), background 240ms ease, border-color 240ms ease, box-shadow 240ms ease;
}
.splash-o.swapped {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.splash-o.swapped .splash-o-icon {
  filter: drop-shadow(0 3px 0 #e8b18c);
}
.splash-o.swapped .splash-o-glyph { animation: tongue-glyph-out 420ms cubic-bezier(0.4, 0, 0.2, 1) both; }
.splash-o.swapped .splash-o-icon { animation: tongue-icon-in 900ms cubic-bezier(0.22, 0.8, 0.25, 1) both; }
.splash-o.swapped::after { animation: tongue-scanline-resolve 900ms ease-out both; }
@keyframes tongue-glyph-out {
  0%, 18% { opacity: 1; transform: scale(1); filter: blur(0); }
  100% { opacity: 0; transform: scale(0.72); filter: blur(2px); }
}
@keyframes tongue-icon-in {
  0% { opacity: 0; transform: translate(-58%, -50%) rotate(-120deg) scale(0.28); filter: saturate(1.55) contrast(1.2) blur(1px); }
  24% { opacity: 0.95; transform: translate(-58%, -50%) rotate(-72deg) scale(0.82); }
  58% { opacity: 1; transform: translate(-58%, -50%) rotate(18deg) scale(1.08); filter: saturate(1.18) contrast(1.05) blur(0); }
  78% { transform: translate(-58%, -50%) rotate(-5deg) scale(0.97); }
  100% { opacity: 1; transform: translate(-58%, -50%) scale(1); filter: drop-shadow(0 3px 0 #e8b18c); }
}
@keyframes tongue-scanline-resolve {
  0% { opacity: 0; transform: scale(0.55) rotate(-12deg); }
  20%, 52% { opacity: 0.86; transform: scale(1.08) rotate(3deg); }
  76% { opacity: 0.35; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
/* September splash update: field letters become clean dark 3D pills, then
   the O glitches into the mouth. These later rules intentionally replace the
   former framed-icon treatment without touching the practice screen. */
.splash-o { transition: none; }
.splash-o-icon {
  left: 50%;
  width: 56px;
  height: 56px;
  border-radius: 0;
  transform: translate(-50%, -50%) scale(0.8);
}
.splash-o::after { display: none; }
.splash-letter.settled {
  color: #fff5ef;
  background: #3d1027;
  border-color: #3d1027;
  box-shadow: 0 4px 0 #f4b8ce;
  transition: background 260ms ease, color 260ms ease, border-color 260ms ease, box-shadow 260ms cubic-bezier(0.22, 1, 0.36, 1);
}
.splash-o.settled { background: #3d1027; border-color: #3d1027; box-shadow: 0 4px 0 #f4b8ce; }
.splash-o.glitching .splash-o-glyph { animation: tongue-glyph-glitch 460ms steps(4, end) both; }
.splash-o.swapped {
  width: 56px;
  height: 56px;
  margin-left: -28px;
  margin-top: -30px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.splash-o.swapped .splash-o-glyph { opacity: 0; animation: none; }
.splash-o.swapped .splash-o-icon { filter: none; animation: tongue-icon-glitch-in 340ms steps(4, end) both; }
@keyframes tongue-glyph-glitch {
  0% { opacity: 1; transform: translateX(0); filter: none; clip-path: inset(0); }
  24% { opacity: 0.28; transform: translateX(-3px); filter: hue-rotate(40deg) saturate(2); clip-path: inset(8% 0 57% 0); }
  52% { opacity: 0.72; transform: translateX(3px); filter: hue-rotate(-30deg) saturate(2); clip-path: inset(54% 0 9% 0); }
  76% { opacity: 0.15; transform: translateX(-2px); filter: hue-rotate(60deg) saturate(2); clip-path: inset(26% 0 28% 0); }
  100% { opacity: 0; transform: translateX(0); filter: none; clip-path: inset(0); }
}
@keyframes tongue-icon-glitch-in {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); filter: hue-rotate(60deg) saturate(2); }
  28% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); filter: hue-rotate(38deg) saturate(1.6); }
  52% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.94); filter: hue-rotate(18deg) saturate(1.3); }
  76% { opacity: 1; transform: translate(-50%, -50%) scale(1.02); filter: hue-rotate(5deg) saturate(1.1); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: none; }
}
.splash-static-logo {
  display: none;
  color: #1b1a1f;
  font: 700 clamp(28px, 8vw, 42px) ui-monospace, Menlo, monospace;
  letter-spacing: -0.08em;
  align-items: center;
  gap: 3px;
}
.splash-static-logo img { width: 1.05em; height: 1.05em; border-radius: 0.25em; }
@keyframes splash-sheet-out { to { transform: translateY(-104%); } }

/* Stitched splash: this deliberately overrides the retired coral wordmark.
   The field is a paper-like lilac page; letters become loose paper tiles. */
#splash { background: #fbf8f4; }
#splash.dissolving { pointer-events: none; opacity: 0; transition: opacity 420ms ease; }
.splash-field {
  inset: 0 !important;
  overflow: hidden;
  border-radius: 0;
  opacity: 1;
  background: #fbf8f4;
  box-shadow: 0 14px 38px rgba(75, 57, 99, 0.06);
}
.splash-letter,
.splash-letter.settled {
  width: 40px;
  height: 44px;
  margin-left: -20px;
  margin-top: -22px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #5a4b8a;
  font: 800 27px ui-monospace, Menlo, monospace;
  letter-spacing: -0.02em;
  transition: background 150ms ease-out, color 150ms ease-out, box-shadow 150ms ease-out;
}
.splash-letter.popped,
.splash-letter.popped.settled {
  color: #17161a;
  background: #ffffff;
  box-shadow: 0 1px 0 #e7e5e0, 0 8px 18px rgba(23, 22, 26, 0.16);
}
.splash-o { overflow: visible; }
.splash-o-glyph {
  position: relative;
  z-index: 1;
  display: block;
  transition: opacity 150ms ease-out, transform 150ms ease-out;
}
.splash-o-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 54px;
  height: 54px;
  margin: 0;
  border: 0;
  border-radius: 0;
  object-fit: contain;
  opacity: 0;
  filter: none;
  transform: translate(-50%, -50%) scale(0.92);
  transition: opacity 150ms ease-out, transform 420ms cubic-bezier(0.23, 1, 0.32, 1);
}
.splash-o.glitching .splash-o-glyph { animation: paper-o-glitch 200ms steps(3, end) both; }
.splash-o.swapped,
.splash-o.swapped.settled {
  width: 56px;
  height: 56px;
  margin-left: -28px;
  margin-top: -28px;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.splash-o.swapped .splash-o-glyph { opacity: 0; animation: none; }
.splash-o.swapped .splash-o-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: none;
}
.splash-hero-icon {
  position: absolute;
  z-index: 4;
  width: 250px;
  height: 250px;
  margin-left: -125px;
  margin-top: -125px;
  object-fit: contain;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
  transition: opacity 180ms ease-out, transform 860ms cubic-bezier(0.34, 1.3, 0.5, 1);
}
@keyframes paper-o-glitch {
  0% { opacity: 1; transform: translateX(0); clip-path: inset(0); }
  33% { opacity: 0.35; transform: translateX(-3px); clip-path: inset(12% 0 51% 0); }
  66% { opacity: 0.8; transform: translateX(3px); clip-path: inset(54% 0 8% 0); }
  100% { opacity: 0; transform: translateX(0); clip-path: inset(0); }
}

html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: #fbf8f4;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--ink);
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* Ambient drifting glows behind everything */
body::before, body::after {
  content: "";
  position: fixed;
  z-index: 0;
  width: 64vw;
  height: 64vw;
  max-width: 430px;
  max-height: 430px;
  border-radius: 50%;
  pointer-events: none;
}
body::before {
  top: -12%;
  right: -18%;
  background: radial-gradient(circle, var(--blob1), transparent 65%);
  animation: drift-a 26s ease-in-out infinite alternate;
}
body::after {
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: -20%;
  background: radial-gradient(circle, var(--blob2), transparent 65%);
  animation: drift-b 34s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate(-8%, 7%) scale(1.12); } }
@keyframes drift-b { to { transform: translate(9%, -6%) scale(1.08); } }

.app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: env(safe-area-inset-top) 0 0;
}
.route-to-talk .app { visibility: hidden; }

/* Header */
.top { padding: 14px 22px 4px; }
.practice-header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 8px;
}
.difficulty-picker {
  min-width: 0;
  padding: 0 2px 5px;
}
.difficulty-heading {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
}
.difficulty-heading output {
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.difficulty-picker input[type="range"] {
  --difficulty-progress: 20%;
  width: 100%;
  height: 34px;
  margin: 1px 0 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}
.difficulty-picker input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--pill) 0 var(--difficulty-progress), var(--line) var(--difficulty-progress) 100%);
}
.difficulty-picker input[type="range"]::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  margin-top: -9px;
  appearance: none;
  -webkit-appearance: none;
  border: 5px solid var(--surface);
  border-radius: 50%;
  background: var(--pill);
  box-shadow: 0 2px 0 var(--punch), 0 0 0 1px var(--line);
}
.difficulty-picker input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
}
.difficulty-picker input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--pill);
}
.difficulty-picker input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 5px solid var(--surface);
  border-radius: 50%;
  background: var(--pill);
  box-shadow: 0 2px 0 var(--punch), 0 0 0 1px var(--line);
}
.difficulty-picker input[type="range"]:focus-visible {
  outline: 2px solid var(--tag-ink);
  outline-offset: 3px;
  border-radius: 999px;
}
.talk-usage-chip,
.settings-menu-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .84);
  color: var(--ink);
  box-shadow: 0 3px 0 rgba(232, 177, 140, .36);
  -webkit-tap-highlight-color: transparent;
}
.talk-usage-chip {
  min-width: 58px;
  gap: 5px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.talk-usage-chip svg,
.settings-menu-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.settings-menu-button {
  width: 44px;
  padding: 0;
  border-radius: 50%;
}
.talk-usage-chip:active,
.settings-menu-button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(232, 177, 140, .36); }
.learning-focus {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  width: 100%;
  min-height: 46px;
  margin: 2px 0 7px;
  padding: 9px 42px 9px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(105deg, var(--tag-bg), var(--surface));
  box-shadow: 0 3px 0 var(--deck2);
  color: var(--ink);
  text-align: left;
}
.learning-focus[hidden] { display: none; }
.learning-focus > span:first-child {
  grid-column: 1;
  color: var(--tag-ink);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .1em;
}
.learning-focus strong {
  grid-column: 1;
  margin-top: 2px;
  overflow: hidden;
  font-family: var(--heading-serif);
  font-size: 16px;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.learning-focus-arrow {
  position: absolute;
  top: 50%;
  right: 15px;
  font-size: 18px;
  transform: translateY(-50%);
}
.learning-focus:active { transform: translateY(3px); box-shadow: none; }

/* Main */
main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 22px 20px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
#practice-view { flex: 1; display: flex; flex-direction: column; }
#practice-view[hidden], #vocab-view[hidden], #notes-view[hidden], #you-view[hidden], #practice-header[hidden],
#notes-home[hidden], #coll-view[hidden], #level-view[hidden], #note-editor[hidden],
.vocab-head[hidden], .vocab-list[hidden], .empty[hidden] { display: none; }

/* Deck: the moving letter field sits on the two peeking cards from the splash. */
.card-wrap { position: relative; isolation: isolate; flex: 1; display: flex; }
.card-stack {
  position: absolute;
  inset: 0;
  border-radius: 26px;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.card-stack-one { background: #ffffff; transform: rotate(2.4deg) translateY(7px); }
.card-stack-two { background: #ffffff; transform: rotate(-1.7deg) translateY(4px); }
.card-stack tt-texture { opacity: 1; }

.card {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 26px;
  padding: 26px 24px 28px;
  box-shadow: var(--card-shadow);
  touch-action: pan-y;
  transition: opacity 220ms cubic-bezier(0.22, 1, 0.36, 1), transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
.card.dragging { transition: none; }
@keyframes card-back-in {
  from { opacity: 0; transform: translateX(-52px) rotate(-2deg); }
  to { opacity: 1; transform: none; }
}
.card.back-entering { animation: card-back-in 300ms cubic-bezier(0.22, 1, 0.36, 1); }
.card-top { display: flex; align-items: center; justify-content: flex-end; }
.card-top-actions { display: flex; gap: 8px; }
.audio-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--ink);
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.audio-btn:active { transform: scale(0.9); }
.audio-btn.off { color: var(--ink-soft); }
.audio-btn.on { background: var(--pill); color: var(--pill-ink); }
.audio-btn.playing { background: var(--peach); color: var(--ink); animation: listening-ring 1.1s ease-in-out infinite; }
.audio-btn svg { transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1); }
.audio-btn.flipped svg { transform: scaleX(-1); }
@keyframes listening-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 177, 140, 0.18); }
  50% { box-shadow: 0 0 0 7px rgba(232, 177, 140, 0); }
}
.level-tag {
  display: inline-block;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 5px 11px;
  border-radius: 999px;
}
.lv-A1 { background: var(--lvA1-bg); color: var(--lvA1-ink); }
.lv-A2 { background: var(--lvA2-bg); color: var(--lvA2-ink); }
.lv-B1 { background: var(--lvB1-bg); color: var(--lvB1-ink); }
.lv-B2 { background: var(--lvB2-bg); color: var(--lvB2-ink); }
.lv-C1 { background: var(--lvC1-bg); color: var(--lvC1-ink); }
.lv-C2 { background: var(--lvC2-bg); color: var(--lvC2-ink); }
.card.leaving { opacity: 0; transform: translateY(-10px); }
.card.entering { animation: card-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.sentence-en {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 18px 0;
}
/* The prompt floats between two spacers instead of on auto margins, so the
   float can collapse smoothly (flex-grow animates, margin: auto cannot).
   While typing, the spacers give way and the prompt settles next to the
   input — both stay visible above the phone keyboard. */
/* Apple's sheet curve — brisk start, feather landing — timed to the keyboard */
.card-space { flex: 1 0 0; transition: flex-grow 320ms cubic-bezier(0.32, 0.72, 0, 1); }
.card.typing .card-space { flex-grow: 0; }
.card.is-practice-locked .card-top,
.card.is-practice-locked > .card-space { display: none; }
.card.is-practice-locked .sentence-en { flex: 1; display: grid; place-items: center; padding: 18px 0 0; }
.practice-lock { width: 100%; max-width: 330px; margin: auto; font-family: system-ui, -apple-system, sans-serif; text-align: center; }
.practice-lock-kicker { display: block; margin-bottom: 16px; color: #a45f45; font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.practice-lock-icon { display: grid; width: 62px; height: 62px; margin: 0 auto 22px; place-items: center; border-radius: 50%; background: var(--tag-bg); box-shadow: 0 4px 0 var(--deck2); }
.practice-lock-icon svg { width: 27px; height: 27px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.practice-lock h2 { margin: 0 0 12px; font: 700 clamp(31px, 8vw, 42px)/1.02 var(--heading-serif); letter-spacing: -.025em; }
.practice-lock p { max-width: 29ch; margin: 0 auto 26px; color: var(--ink-soft); font-family: system-ui, -apple-system, sans-serif; font-size: 15px; font-weight: 500; line-height: 1.48; }
.practice-lock .btn { margin-bottom: 10px; }
.practice-lock .btn, .practice-upgrade { font-family: system-ui, -apple-system, sans-serif; }
.practice-upgrade { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 750; }
.practice-lock small { display: block; margin-top: 18px; color: var(--ink-soft); font-size: 11px; line-height: 1.4; }
.listen-play {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--pill);
  color: var(--pill-ink);
  box-shadow: 0 4px 0 var(--punch);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 180ms;
}
.listen-play:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--punch); }
.listen-play.is-playing {
  background: var(--peach);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--punch);
}
.listen-play.is-playing::before,
.listen-play.is-playing::after {
  content: "";
  position: absolute;
  inset: -10px;
  z-index: -1;
  border: 2px solid var(--peach);
  border-radius: 50%;
  pointer-events: none;
  animation: sound-ripple 1.45s ease-out infinite;
}
.listen-play.is-playing::after { animation-delay: 0.72s; }
@keyframes sound-ripple {
  0% { opacity: 0.82; transform: scale(0.82); }
  70% { opacity: 0; transform: scale(1.42); }
  100% { opacity: 0; transform: scale(1.42); }
}
.en-sub {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: 12px;
  opacity: 0;
  animation: word-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.sentence-en.de-q { font-size: 24px; line-height: 1.6; }
.en-reveal {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.55;
  font-weight: 500;
  opacity: 0;
  animation: word-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.divider { height: 1px; background: var(--line); margin: 0 0 22px; }

.sentence-de { font-family: var(--serif); font-size: 23px; line-height: 1.7; font-weight: 500; }
.w {
  display: inline-block;
  padding: 1px 3px;
  margin: 0 -1px;
  border-radius: 8px;
  border-bottom: 1.5px dotted var(--ink-soft);
}
.w:active, .w.saved { background: var(--tag-bg); }
.w.saved { border-bottom-color: var(--tag-ink); }
.w-in {
  opacity: 0;
  animation: word-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes word-in {
  0% { opacity: 0; transform: translateY(18px) scale(0.97); }
  60% { opacity: 1; }
  75% { transform: translateY(-3px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.why-btn {
  align-self: flex-start;
  margin-top: 14px;
  padding: 6px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  border-bottom: 1.5px dotted var(--ink-soft);
  opacity: 0;
  animation: word-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.why-btn.open { color: var(--ink); border-bottom-color: var(--ink); }
.why-box {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.why-box[hidden] { display: none; }
.why-insight { padding: 11px 12px; border-radius: 12px; background: var(--tag-bg); }
.why-insight.secondary { background: color-mix(in srgb, var(--tag-bg) 58%, var(--surface)); }
.why-label {
  color: var(--tag-ink);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.why-note {
  margin-top: 4px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
}

.btn {
  display: block;
  width: 100%;
  padding: 16px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}
.btn-primary {
  background: var(--pill);
  color: var(--pill-ink);
  box-shadow: 0 4px 0 var(--punch);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--punch); }
.next-btn { margin-top: 24px; opacity: 0; animation: word-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
/* Typed-answer mode */
.type-input {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 17px; /* ≥16px so iOS doesn't zoom the page on focus */
  line-height: 1.5;
  padding: 13px 16px;
  margin-bottom: 14px;
  outline: none;
  resize: none;
  overflow-y: hidden;
}
.type-input:focus { border-color: var(--ink-soft); }
.type-input::placeholder { color: var(--ink-soft); opacity: 0.7; }
.answer-input-wrap { position: relative; margin-bottom: 5px; }
.answer-input-wrap .type-input { margin-bottom: 0; padding-right: 58px; }
.voice-input-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--tag-bg);
  color: var(--tag-ink);
  transition: transform 160ms var(--ease-out), background 160ms ease, color 160ms ease;
  isolation: isolate;
}
.voice-input-btn::after {
  content: "";
  position: absolute;
  inset: -5px;
  z-index: -1;
  border: 1.5px solid var(--punch);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.92);
}
.voice-input-btn:active { transform: scale(0.92); }
.voice-input-btn.arming { background: var(--peach); color: var(--ink); animation: mic-arm 160ms var(--ease-out) both; }
.voice-input-btn.recording { background: var(--punch); color: var(--pill-ink); }
.voice-input-btn.recording::after { animation: mic-live 1.1s linear infinite; }
.voice-input-btn.recording svg { animation: mic-breathe 900ms ease-in-out infinite; }
html[dir="rtl"] .answer-input-wrap .type-input { padding-right: 16px; padding-left: 58px; }
html[dir="rtl"] .voice-input-btn { right: auto; left: 8px; }
@keyframes mic-arm {
  from { transform: scale(1); }
  to { transform: scale(0.94); }
}
@keyframes mic-live {
  0% { opacity: 0.62; transform: scale(0.92); }
  72%, 100% { opacity: 0; transform: scale(1.34); }
}
@keyframes mic-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.9); }
}
@media (prefers-reduced-motion: reduce) {
  .voice-input-btn.arming { animation: none; }
  .voice-input-btn.recording::after { animation: none; opacity: 0.55; transform: scale(1.08); }
  .voice-input-btn.recording svg { animation: none; }
}
.typed-attempt {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 80%, var(--tag-bg));
}
.typed-label {
  display: block;
  margin-bottom: 3px;
  color: var(--tag-ink);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.09em;
}
.typed-echo {
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.5;
  font-style: italic;
  margin-bottom: 10px;
}

/* Vocab */
.vocab-head { margin: 6px 2px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vocab-count { font-size: 13.5px; color: var(--ink-soft); }
.vp-btn {
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--pill-ink);
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 3px 0 var(--punch);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 180ms;
}
.vp-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--punch); }
#vp-view { display: flex; flex-direction: column; flex: 1; }
#vp-view[hidden] { display: none; }
#vocab-view { display: flex; flex-direction: column; }
.vocab-title-row { margin: 0 2px 2px; }
.vocab-title-row .collection-kicker { margin-bottom: 5px; }
.vp-counter { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-soft); }
.vp-word { text-align: center; font-size: 30px; }
.vp-word-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0 2px; }
.vp-say { background: var(--tag-bg); color: var(--tag-ink); }
.vp-exit {
  margin: 18px auto 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  border-bottom: 1.5px dotted var(--ink-soft);
  padding: 4px 0;
}
.vp-done { text-align: center; padding: 60px 24px 0; display: flex; flex-direction: column; gap: 20px; align-items: center; }
.vp-done .btn { max-width: 240px; }
.vocab-list { list-style: none; display: flex; flex-direction: column; }
.vocab-item {
  padding: 15px 2px;
  border-bottom: 1px solid var(--line);
  position: relative;
  cursor: pointer;
}
.vocab-item:first-child { border-top: 1px solid var(--line); }
.vocab-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-right: 72px; }
.vocab-word { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.vocab-gloss { font-size: 14px; color: var(--ink-soft); margin-top: 3px; padding-right: 72px; }
.vocab-say {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 34px;
  display: flex;
  color: var(--ink-soft);
  padding: 8px;
  border-radius: 999px;
}
.vocab-say:active { background: var(--tag-bg); }
.vocab-del {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 0;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 999px;
}
.vocab-del:active { background: var(--tag-bg); }
.empty { text-align: center; padding: 72px 24px; }
.empty-pills {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 30px;
}
.pill-f {
  display: inline-block;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(120, 100, 70, 0.12);
  transform: rotate(var(--r));
  animation: floaty 3.4s ease-in-out var(--d) infinite;
}
.pill-f:nth-child(2) { margin-bottom: 14px; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(var(--r)); }
  50% { transform: translateY(-8px) rotate(var(--r)); }
}
.empty-title { font-family: var(--heading-serif); font-size: 22px; font-weight: 400; color: var(--ink); }
.empty-sub { font-size: 13.5px; color: var(--ink-soft); margin-top: 7px; }
/* Notes — the collections stacked full width, then whatever you've written */
.shelf {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0 18px;
}
.shelf-card {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: 16px 15px 14px 27px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 200ms;
}
.shelf-card:active { transform: translateY(2px) scale(0.985); box-shadow: 0 4px 14px rgba(120, 100, 70, 0.1); }
.shelf-texture-edge {
  position: absolute;
  z-index: 0;
  inset: 0 auto 0 0;
  width: 18px;
  overflow: hidden;
  pointer-events: none;
}
.shelf-texture-edge::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 45%, var(--surface) 100%);
}
.shelf-title { position: relative; z-index: 1; font-family: var(--heading-serif); font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.shelf-peek {
  position: relative;
  z-index: 1;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.shelf-peek span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Collection + level pages */
.notes-title { font-family: var(--heading-serif); font-size: 27px; font-weight: 700; letter-spacing: -0.015em; }
.notes-blurb { font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); margin: 7px 0 20px; }
.level-head { display: flex; align-items: center; gap: 11px; }
.level-head .notes-title { font-size: 24px; }
.collection-hero,
.notes-hero,
.level-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 150px;
  margin: 0 0 15px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}
.collection-hero-field,
.notes-hero-field,
.level-hero-field { opacity: 0.72; }
.collection-hero::after,
.notes-hero::after,
.level-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(100deg, rgba(253, 250, 245, 0.96) 0%, rgba(253, 250, 245, 0.88) 57%, rgba(253, 250, 245, 0.54) 100%);
}
.collection-hero-copy,
.notes-hero-copy,
.level-hero-copy { position: relative; z-index: 2; padding: 20px 20px 18px; }
.collection-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--tag-ink);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
}
.collection-hero .notes-title,
.notes-hero .notes-title,
.level-hero .notes-title { max-width: 78%; font-size: 30px; line-height: 1.04; }
.collection-hero .notes-blurb,
.notes-hero .notes-blurb,
.level-hero .notes-blurb { max-width: 76%; margin: 8px 0 0; color: var(--ink-soft); }
.level-picker { list-style: none; display: flex; flex-direction: column; gap: 10px; padding: 0 0 18px; }
.level-choice { min-width: 0; }
.level-choice-button {
  position: relative;
  width: 100%;
  min-height: 104px;
  padding: 15px 48px 15px 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 4px 0 var(--peach), var(--card-shadow);
  text-align: left;
  transition: transform 160ms var(--ease-out), box-shadow 160ms ease;
}
.level-choice-button:active { transform: translateY(4px) scale(0.985); box-shadow: 0 0 0 var(--peach); }
.level-choice-top { display: flex; align-items: center; gap: 9px; }
.level-choice-count { color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.level-choice-note { display: block; margin-top: 9px; color: var(--ink); font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
.level-choice-example { display: block; margin-top: 5px; overflow: hidden; color: var(--ink-soft); font-family: var(--serif); font-size: 13px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.level-choice-chev { position: absolute; top: 50%; right: 19px; color: var(--ink); font-size: 19px; transform: translateY(-50%); }

/* One opener: what to say, what it means, how it sounds in a whole sentence */
.opener-list { list-style: none; display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.opener {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 15px 52px 15px 16px;
  box-shadow: 0 2px 8px rgba(120, 100, 70, 0.05);
}
.opener-de { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
.opener-en { font-size: 13.5px; color: var(--ink-soft); margin-top: 4px; }
.opener-en-below { font-size: 13px; line-height: 1.5; margin-top: 10px; }
.opener-ex {
  margin-top: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--tag-bg);
}
.opener-ex-de { font-family: var(--serif); font-size: 14.5px; line-height: 1.5; }
.opener-ex-en { font-size: 12.5px; line-height: 1.45; color: var(--ink-soft); margin-top: 3px; }
.opener-tip { font-size: 12.5px; line-height: 1.5; color: var(--ink-soft); margin-top: 9px; padding-left: 15px; position: relative; }
.opener-tip::before { content: "↳"; position: absolute; left: 0; top: 0; }
.opener-say {
  position: absolute;
  top: 12px;
  right: 10px;
  display: flex;
  color: var(--ink-soft);
  padding: 9px;
  border-radius: 999px;
}
.opener-say:active { background: var(--tag-bg); }

/* You: coloured folder covers, a paper report, and conversation history. */
body:has(#you-view:not([hidden])):has(#you-notes-panel[hidden])::after { background: radial-gradient(circle, rgba(232, 177, 140, .3), transparent 65%); }
#you-view { padding: 12px 2px 22px; --report-cover: var(--deck1); --report-paper: #fffdf9; --report-muted: #79695d; }
.you-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 2px 30px; }
.you-head h2 { margin: 0; font: 700 48px/.96 var(--heading-serif); letter-spacing: -.035em; }
.you-head p { max-width: 23ch; margin: 10px 0 0; color: var(--report-muted); font-size: 13px; line-height: 1.5; }
.you-head-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.you-switch { display: flex; align-items: end; gap: 8px; margin: 0; padding: 0 8px; }
.you-switch button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 12px 20px 15px; border: 1px solid #dbc6b6; border-bottom: 0; border-radius: 17px 17px 0 0; color: #79695d; background: #f2e9df; font-family: inherit; font-size: 13px; font-weight: 650; line-height: 1.2; }
.you-switch button.active { background: var(--report-cover); color: var(--ink); position: relative; z-index: 1; }
.you-switch button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.you-report-folder { background: var(--report-cover); border: 1px solid #d9bda8; border-radius: 8px 20px 22px 22px; padding: 8px; box-shadow: 0 7px 0 -3px #e8b18c, 0 16px 25px -15px #96705735; }
.you-report-paper { background: var(--report-paper); border: 1px solid #f9f5ef; border-radius: 7px 14px 16px 16px; padding: 24px 20px 0; overflow: hidden; }
.you-report-heading { padding-bottom: 22px; }
.you-eyebrow { display: block; color: #96583e; font-size: 9px; font-weight: 750; letter-spacing: .13em; }
.you-report-heading h3 { margin: 13px 0 12px; font: 400 34px/1.02 var(--heading-serif); letter-spacing: -.035em; }
.you-report-heading > p { max-width: 30ch; margin: 0; color: var(--report-muted); font-size: 13px; line-height: 1.55; }
.you-facts { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 18px; color: var(--report-muted); font-size: 10px; line-height: 1.5; }
.you-facts span + span { padding-left: 14px; border-left: 1px solid #ddcbbd; }
.you-report-switch { display: flex; gap: 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 25px; }
.you-report-switch button { position: relative; min-height: 46px; color: var(--report-muted); font-size: 12px; font-weight: 650; }
.you-report-switch button.active { color: var(--ink); }
.you-report-switch button.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: #bd7955; }
.you-focus-list, .you-log-list { display: flex; flex-direction: column; gap: 25px; }
.you-pattern-group { --pattern-accent: #ae614a; --pattern-tint: #f8e8dd; }
.you-pattern-group.is-check { --pattern-accent: #956f2d; --pattern-tint: #f6efd9; }
.you-pattern-group.is-solid { --pattern-accent: #4b735b; --pattern-tint: #e5eee3; }
.you-group-heading { display: flex; align-items: center; gap: 8px; }
.you-group-heading::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pattern-accent); flex: 0 0 auto; }
.you-group-heading h4 { margin: 0; font: 700 20px/1.2 var(--heading-serif); letter-spacing: -.015em; }
.you-group-count { display: grid; place-items: center; min-width: 22px; height: 22px; margin-left: auto; border-radius: 50%; background: var(--pattern-tint); color: var(--pattern-accent); font-size: 11px; font-weight: 700; }
.you-group-description { margin: 7px 0 13px; color: var(--report-muted); font-size: 11.5px; line-height: 1.55; }
.you-focus-card { display: block; width: 100%; padding: 17px; border: 1px solid #e9e1d8; border-radius: 11px; background: #fffefa; color: inherit; font: inherit; text-align: left; box-shadow: 0 3px 0 -1px var(--pattern-tint); appearance: none; overflow-wrap: anywhere; }
.you-focus-card + .you-focus-card { margin-top: 12px; }
.you-focus-card:active { background: var(--pattern-tint); }
.you-focus-top { display: flex; justify-content: space-between; gap: 12px; }
.you-focus-top h5 { margin: 0; font: 700 18px/1.2 var(--heading-serif); }
.you-focus-top > span { color: var(--pattern-accent); font-size: 17px; }
.you-focus-sentence { margin: 12px 0 0; font: 400 17px/1.4 var(--serif); }
.you-focus-evidence { margin: 12px 0 0; color: var(--report-muted); font-size: 10px; line-height: 1.5; }
.you-focus-open { display: inline-block; margin-top: 9px; color: var(--pattern-accent); font-size: 11px; font-weight: 650; }
.you-section-head { margin-bottom: 17px; }
.you-section-head h3 { margin: 0; font: 700 22px/1.15 var(--heading-serif); letter-spacing: -.02em; }
.you-section-head p { margin: 7px 0 0; color: var(--report-muted); font-size: 12px; line-height: 1.5; }
.you-log-list { gap: 12px; }
.you-history-folder { border: 1px solid #e5d4c5; border-radius: 12px; background: #faf0e4; overflow: hidden; }
.you-history-folder > summary { display: flex; position: relative; flex-direction: column; gap: 6px; padding: 16px 35px 16px 16px; cursor: pointer; list-style: none; }
.you-history-folder > summary::-webkit-details-marker { display: none; }
.you-history-folder > summary::after { content: "+"; position: absolute; right: 16px; top: 34px; color: #96583e; font-size: 20px; }
.you-history-folder[open] > summary::after { content: "−"; }
.you-history-folder > summary strong { font: 700 20px/1.2 var(--heading-serif); overflow-wrap: anywhere; }
.you-history-folder > summary span, .you-history-folder > summary small { color: var(--report-muted); font-size: 10px; line-height: 1.5; }
.you-log-entry { padding: 18px 16px; border-top: 1px solid #e5d4c5; background: var(--report-paper); overflow-wrap: anywhere; }
.you-log-meta { color: #8a604a; font-size: 9px; line-height: 1.5; font-weight: 700; }
.you-log-change { margin-top: 12px; }
.you-log-change p { margin: 0; font: 400 17px/1.42 var(--serif); }
.you-log-quote { color: var(--report-muted); text-decoration: line-through; text-decoration-color: #d47d67; text-decoration-thickness: 1.5px; }
.you-log-quote.is-alternative { text-decoration: none; }
.you-log-change span { display: block; margin: 4px 0; color: #af7756; }
.you-log-suggestion { color: var(--ink); }
.you-log-why { margin: 13px 0 0; color: var(--report-muted); font-size: 12px; line-height: 1.55; }
.you-history-empty { margin: 0; padding: 16px; color: var(--report-muted); font-size: 13px; line-height: 1.55; }
.you-report-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; margin-top: 26px; padding: 12px 0; border-top: 1px dashed #e3cdbb; color: var(--report-muted); }
.you-report-footer > span { font-size: 9px; line-height: 1.5; flex: 1 1 140px; }
.you-report-footer .you-clear { margin: 0; min-height: 44px; font-size: 10px; }
.you-empty { padding: 5px 0 12px; }
.you-empty h3 { margin: 0 0 10px; font: 700 25px/1.15 var(--heading-serif); }
.you-empty p { margin: 0 0 22px; color: var(--report-muted); font-size: 13px; line-height: 1.6; }
.you-empty .btn { max-width: 280px; }
.you-head[hidden], .you-switch[hidden], .you-report-folder[hidden], .you-clear[hidden], .you-empty[hidden], #you-view [role="tabpanel"][hidden] { display: none; }
#you-view button:focus-visible, .you-history-folder > summary:focus-visible { outline: 2px solid #a35b3d; outline-offset: 3px; }
@media (max-width: 360px) {
  .you-report-paper { padding: 21px 15px 0; }
  .you-report-heading h3 { font-size: 30px; }
  .you-switch button { padding-inline: 15px; }
}
@media (prefers-color-scheme: dark) {
  #you-view { --report-cover: #49362c; --report-paper: #29231f; --report-muted: #c5b5a7; }
  .you-report-folder, .you-switch button { border-color: #624b3b; }
  .you-switch button { background: #352d26; color: #c5b5a7; }
  .you-report-paper { border-color: #4c3e33; }
  .you-eyebrow { color: #e8b18c; }
  .you-pattern-group { --pattern-accent: #e9aa91; --pattern-tint: #4c332e; }
  .you-pattern-group.is-check { --pattern-accent: #d4b879; --pattern-tint: #443d2c; }
  .you-pattern-group.is-solid { --pattern-accent: #a2c5ad; --pattern-tint: #2f4237; }
  .you-focus-card { background: #302922; border-color: #544336; }
  .you-history-folder { background: #3a2f26; border-color: #624b3b; }
  .you-log-entry, .you-report-footer { border-color: #624b3b; }
  .you-log-meta { color: #e8b18c; }
  .you-head-actions button { background: #3a2f26; border-color: #624b3b; }
  body:has(#you-view:not([hidden])):has(#you-notes-panel[hidden])::after { background: radial-gradient(circle, rgba(232, 177, 140, .09), transparent 65%); }
}
.you-lesson { padding: 0 2px 30px; }
.you-lesson[hidden] { display: none; }
.you-lesson .note-back { margin-bottom: 30px; }
.you-lesson-status {
  display: inline-block;
  margin-bottom: 9px;
  color: #96583e;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.you-lesson h2 { max-width: 12ch; margin: 0; font: 700 38px/1.02 var(--heading-serif); letter-spacing: -.03em; }
.you-lesson-change { margin: 30px 0 0; padding: 0 0 25px; border-bottom: 1px solid var(--line); }
.you-lesson-change p { margin: 0; font: 600 24px/1.35 var(--serif); }
.you-lesson-change p:first-child { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: #d47d67; text-decoration-thickness: 1.5px; }
.you-lesson-change span { display: block; margin: 7px 0; color: #af7756; }
.you-lesson-why { max-width: 40ch; margin: 25px 0 0; font-size: 15px; line-height: 1.65; }
.you-lesson-steps { margin: 26px 0 0; padding: 0; list-style: none; counter-reset: learning-step; }
.you-lesson-steps li { counter-increment: learning-step; position: relative; padding: 0 0 22px 36px; border-bottom: 1px solid var(--line); }
.you-lesson-steps li + li { padding-top: 22px; }
.you-lesson-steps li::before { content: counter(learning-step, decimal-leading-zero); position: absolute; top: 1px; left: 0; color: #af7756; font: 700 11px/1.4 var(--heading-serif); }
.you-lesson-steps li + li::before { top: 23px; }
.you-lesson-steps strong { display: block; margin-bottom: 5px; font: 700 17px/1.25 var(--heading-serif); }
.you-lesson-steps p { margin: 0; color: var(--ink-soft); font-size: 13.5px; line-height: 1.55; }
.you-lesson-practice { margin-top: 30px; }
.you-lesson-practice > span { color: #96583e; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.you-lesson-practice > p { max-width: 33ch; margin: 8px 0 18px; font: 600 19px/1.42 var(--serif); }
/* Your own notes sit quietly under the collections — a small label and a small
   button, not a section header competing with them. */
#notes-head { margin: 4px 2px 6px; }
#notes-head .vocab-count {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#note-add { padding: 6px 14px; font-size: 12.5px; box-shadow: 0 2px 0 var(--punch); }
#note-add:active { box-shadow: 0 1px 0 var(--punch); }
.note-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Getting back out. Sticks to the top of the scroll area so it is still there
   at the bottom of a long list, and is a real tap target, not a text link. */
.note-back {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  width: fit-content;
  gap: 6px;
  margin: 0 0 18px;
  padding: 9px 16px 9px 12px;
  border-radius: 999px;
  background: var(--chip-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--card-shadow);
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
}
.note-back:active { transform: scale(0.96); }
.note-title {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--heading-serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  outline: none;
}
.note-title::placeholder, .note-body::placeholder { color: var(--ink-soft); opacity: 0.7; }
.note-body {
  display: block;
  width: 100%;
  min-height: 55vh;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 15.5px;
  line-height: 1.7;
  resize: none;
  outline: none;
}

.item-in { opacity: 0; animation: card-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.view-in { animation: card-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* The private speaking pilot is an action, not a fourth destination. Keeping it
   just above the tab bar makes it reachable from every screen without hiding it
   inside Notes or competing with the three primary destinations. */
.talk-launcher {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
}
.talk-launcher[hidden] { display: none; }
.talk-fab {
  position: absolute;
  top: 0;
  left: 0;
  width: 116px;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 7px 8px 7px 18px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--pill-ink);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 0 var(--punch), 0 12px 28px rgba(69, 50, 35, 0.18);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: translate;
}
.talk-fab.is-docked {
  width: 50px;
  padding: 0;
  gap: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.talk-fab.dock-left:not(.is-docked) {
  padding: 7px 18px 7px 8px;
}
.talk-fab.dock-right .talk-fab-mark { order: 2; }
.talk-fab.dock-right .talk-fab-label { order: 1; }
.talk-fab-label {
  max-width: 48px;
  overflow: hidden;
  opacity: 1;
  white-space: nowrap;
}
.talk-fab.is-docked .talk-fab-label { max-width: 0; opacity: 0; }
.talk-fab-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #ffffff;
}
.talk-fab.is-docked .talk-fab-mark {
  width: 50px;
  height: 50px;
  overflow: visible;
  background: transparent;
}
.talk-fab.is-docked.dock-right .talk-fab-mark {
  transform: translateX(10px) rotate(18deg);
  transform-origin: 50% 56%;
}
.talk-fab.is-docked.dock-left .talk-fab-mark {
  transform: translateX(-10px) rotate(-18deg);
  transform-origin: 50% 56%;
}
.talk-fab.is-docked .talk-fab-mark img {
  width: 48px;
  height: 48px;
}
.talk-fab.is-dragging .talk-fab-mark { transform: none; }
.talk-fab-mark img {
  width: 35px;
  height: 35px;
  display: block;
  object-fit: contain;
}
.talk-fab:active {
  transform: translateY(3px) scale(0.97);
  box-shadow: 0 1px 0 var(--punch), 0 5px 13px rgba(69, 50, 35, 0.14);
  opacity: 0.9;
}
.talk-fab.is-docked:active { box-shadow: none; }
.talk-fab:focus-visible { outline: 3px solid var(--tag-ink); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .talk-fab {
    transition: width 260ms cubic-bezier(0.77, 0, 0.175, 1), padding 260ms cubic-bezier(0.77, 0, 0.175, 1), gap 260ms cubic-bezier(0.77, 0, 0.175, 1), background-color 180ms ease, border-color 180ms ease, transform 140ms var(--ease-out), box-shadow 180ms var(--ease-out), opacity 140ms ease;
  }
  .talk-fab-label { transition: max-width 220ms cubic-bezier(0.77, 0, 0.175, 1), opacity 120ms ease; }
  .talk-fab-mark { transition: transform 260ms cubic-bezier(0.77, 0, 0.175, 1); }
  .talk-fab.is-docked:not(.is-dragging) .talk-fab-mark img {
    animation: talk-edge-peek 3600ms var(--ease-in-out) infinite;
    transform-origin: 50% 38%;
  }
}

@keyframes talk-edge-peek {
  0%, 72%, 100% { transform: translateY(0) scaleY(1); }
  82% { transform: translateY(2px) scaleY(1.045); }
  90% { transform: translateY(-1px) scaleY(0.985); }
}

@media (prefers-reduced-motion: reduce) {
  .talk-fab-mark,
  .talk-fab-mark img { animation: none; transition: opacity 160ms ease; }
}

/* Tab bar — sits below the card, never over it */
.tabbar {
  flex: 0 0 auto;
  margin: 0 18px calc(12px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  background: var(--chip-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--card-shadow);
  padding: 6px;
}
.tabbar > .talk-launcher {
  position: relative;
  inset: auto;
  z-index: 1;
  display: grid;
  width: 116px;
  height: 50px;
  place-items: center;
  pointer-events: auto;
  transition: width 260ms cubic-bezier(0.77, 0, 0.175, 1);
}
.tabbar > .talk-launcher[hidden] { display: none; }
.tabbar .talk-fab {
  position: relative;
  inset: auto;
  translate: none !important;
  transform-origin: center;
}
.tabbar .talk-fab.is-docked .talk-fab-mark {
  transform: none;
}
.tabbar .talk-fab.is-docked .talk-fab-mark img {
  width: 50px;
  height: 50px;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
  position: relative;
}
.tab.active { color: var(--ink); background: var(--surface); box-shadow: 0 2px 10px rgba(120, 100, 70, 0.1); }
.tab-icon { font-size: 18px; line-height: 1; }
.tab-icon svg { display: block; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.badge {
  position: absolute;
  top: 5px;
  right: calc(50% - 30px);
  background: var(--pill);
  color: var(--pill-ink);
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 6px;
}
.badge.pop { animation: badge-pop 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes badge-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Bottom sheet */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 19, 14, 0.4);
  z-index: 20;
}
.sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--sheet-shadow);
  padding: 10px 24px calc(26px + env(safe-area-inset-bottom));
  z-index: 21;
  animation: rise 0.22s ease-out;
}
@keyframes rise { from { transform: translate(-50%, 30%); opacity: 0.4; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  #splash { display: flex; align-items: center; justify-content: center; }
  #splash.done { animation: none; opacity: 0; transition: opacity 200ms var(--ease-out); }
  .splash-field, .splash-stage { display: none; }
  .splash-static-logo { display: flex; }
  .sheet, .card.entering, .card.back-entering, .w-in, .next-btn, .item-in, .view-in, .badge.pop, .pill-f, .why-btn, .en-sub, .en-reveal,
  .card, .btn-primary, .chip, .card-space { transition: none; }
  body::before, body::after { animation: none; }
}
.sheet-handle { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 6px auto 18px; }
.sheet-word-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-word { font-family: var(--heading-serif); font-size: 30px; font-weight: 700; letter-spacing: -0.01em; }
.sheet-say { flex: 0 0 auto; background: var(--tag-bg); color: var(--tag-ink); }
/* What kind of word it is, and which form of it you just tapped */
.sheet-kind {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.sheet-kind[hidden] { display: none; }
.sheet-kind .kind-dot { width: 5px; height: 5px; border-radius: 999px; background: var(--ink-soft); opacity: 0.55; }
.sheet-gloss { font-size: 16px; color: var(--ink-soft); margin: 8px 0 16px; line-height: 1.45; }

/* The grammar you cannot guess from the sentence: base form, then the facts */
.sheet-grammar {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 16px 14px;
  margin-bottom: 16px;
}
.sheet-grammar[hidden] { display: none; }
.gram-base { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.gram-rows { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.gram-row { display: flex; gap: 12px; font-size: 13.5px; line-height: 1.45; }
.gram-label {
  flex: 0 0 72px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-top: 2px;
}
.gram-value { flex: 1; }
.gram-value .de { font-family: var(--serif); font-size: 15px; }
.gram-note { color: var(--ink-soft); }
.gram-longnote {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.sheet-grammar > .gram-longnote:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.sheet-example {
  font-size: 14.5px;
  line-height: 1.6;
  padding: 14px 16px;
  background: var(--tag-bg);
  border-radius: 16px;
  margin-bottom: 18px;
}
.sheet-example .ex-en { color: var(--ink-soft); }
.sheet .btn.added { background: var(--good); color: var(--surface); }

/* Structured "Warum so?" (EXPLAIN): built steps, word-order table, swap pattern. */
.why-steps { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.why-step { font-size: 13.5px; line-height: 1.55; color: var(--ink); }
.why-step strong { font-weight: 700; }
.why-table { margin-top: 6px; border-collapse: collapse; width: 100%; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.why-table td { padding: 4px 8px 4px 0; vertical-align: top; border-top: 1px solid color-mix(in srgb, var(--tag-ink) 18%, transparent); }
.why-table tr:first-child td { border-top: 0; }
.why-table td.pos { width: 2.4em; color: var(--tag-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.why-table td.word { font-weight: 600; }
.why-table td.role { color: var(--ink-soft); }

/* "Warum so?" sheet. The explanation lives here rather than inside the card:
   a taller card widened the rotated paper stack behind it, because a rotated
   rectangle spreads sideways in proportion to its height. The German sentence
   stays pinned at the top so it is visible while its explanation is read. */
.why-sheet {
  display: flex;
  flex-direction: column;
  max-height: 78vh;
  padding-bottom: 0;
}
/* display:flex would otherwise beat the browser's own [hidden] rule, leaving the
   sheet permanently on screen and impossible to close. */
.why-sheet[hidden] { display: none; }
.why-sheet-de {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.why-sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-width: none; /* it still scrolls; the bar itself is just noise here */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 0 calc(26px + env(safe-area-inset-bottom));
}

.why-sheet-body::-webkit-scrollbar { width: 0; height: 0; }

.learning-sheet {
  display: flex;
  max-height: 76vh;
  flex-direction: column;
}
.learning-sheet[hidden] { display: none; }
.learning-sheet-kicker {
  color: var(--tag-ink);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .11em;
}
.learning-sheet h2 {
  margin: 7px 0 18px;
  font: 700 30px/1 var(--heading-serif);
  letter-spacing: -.02em;
}
.learning-sheet-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.learning-skill {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
}
.learning-skill-number { color: var(--tag-ink); font: 700 13px/1.3 var(--heading-serif); }
.learning-skill h3 { margin: 0; font: 700 18px/1.12 var(--heading-serif); }
.learning-skill p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.4; }
.learning-clear {
  align-self: center;
  min-height: 44px;
  margin-top: 12px;
  padding: 10px 14px;
  color: var(--ink-soft);
  text-decoration: underline;
}
/* Settings keeps account and billing controls out of the learning profile. */
.settings-screen {
  --settings-accent-bg: #f6ddca;
  --settings-accent-ink: #8f4f37;
  --settings-shadow: #e8b18c;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--ink);
}
.settings-screen[open] { display: block; }
.settings-screen::backdrop { background: transparent; }
.settings-shell {
  display: flex;
  width: 100%;
  max-width: 480px;
  height: 100%;
  margin: 0 auto;
  flex-direction: column;
  padding: max(18px, env(safe-area-inset-top)) 22px 0;
}
.settings-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 54px;
  margin-bottom: 16px;
}
.settings-header button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--settings-shadow);
}
.settings-header button svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.settings-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 0 calc(max(30px, env(safe-area-inset-bottom)) + 18px);
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.settings-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }
.settings-section { padding: 22px 2px 24px; border-bottom: 1px solid var(--line); }
.settings-section:first-child { padding-top: 8px; }
.settings-section:last-child { border-bottom: 0; }
.settings-section h3 { margin: 0 0 14px; color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.settings-profile-row { display: flex; align-items: center; gap: 13px; }
.settings-profile-mark { display: grid; width: 46px; height: 46px; flex: 0 0 46px; place-items: center; border-radius: 50%; background: var(--settings-accent-bg); color: var(--settings-accent-ink); box-shadow: 0 3px 0 var(--settings-shadow); }
.settings-profile-mark svg { display: block; width: 22px; height: 22px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.settings-profile-row div { min-width: 0; }
.settings-profile-row span { display: block; margin-bottom: 4px; color: var(--ink-soft); font-size: 12px; }
.settings-profile-row strong { display: block; overflow-wrap: anywhere; font-size: 16px; }
.settings-plan-card { padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 4px 0 var(--settings-shadow); }
.settings-plan-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.settings-plan-top div > span { display: block; margin-bottom: 4px; color: var(--ink-soft); font-size: 12px; }
.settings-plan-top div > strong { font: 700 26px/1 var(--heading-serif); }
.settings-plan-count { padding: 7px 10px; border-radius: 999px; background: var(--settings-accent-bg); color: var(--settings-accent-ink); font-size: 12px; white-space: nowrap; }
.settings-plan-count b { color: var(--ink); font-variant-numeric: tabular-nums; }
.settings-plan-card progress { display: block; width: 100%; height: 7px; margin: 18px 0 11px; overflow: hidden; border: 0; border-radius: 999px; background: var(--line); appearance: none; -webkit-appearance: none; }
.settings-plan-card progress::-webkit-progress-bar { border-radius: 999px; background: var(--line); }
.settings-plan-card progress::-webkit-progress-value { border-radius: 999px; background: var(--pill); }
.settings-plan-card progress::-moz-progress-bar { border-radius: 999px; background: var(--pill); }
.settings-plan-card > p { margin: 0 0 17px; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.settings-plan-card > .settings-renewal { margin-top: -10px; font-size: 12px; }
.settings-primary-action { width: 100%; min-height: 48px; border-radius: 999px; background: var(--pill); color: var(--pill-ink); font-size: 14px; font-weight: 750; box-shadow: 0 4px 0 var(--punch); }
.settings-link { display: block; min-height: 44px; padding: 16px 0 0; color: var(--ink); font-size: 13px; font-weight: 700; text-align: center; text-underline-offset: 3px; }
.settings-plan-card > .settings-payment-note { margin: 10px 0 0; font-size: 11px; text-align: center; }
.settings-row-button { display: flex; width: 100%; min-height: 52px; align-items: center; justify-content: space-between; gap: 16px; padding: 0; border-bottom: 1px solid rgba(66, 55, 61, .08); background: transparent; color: var(--ink); font-size: 15px; font-weight: 650; text-align: left; text-decoration: none; }
.settings-row-button:last-of-type { border-bottom: 0; }
.settings-row-button b { color: var(--ink-soft); font-size: 20px; font-weight: 400; }
.settings-row-button:disabled { opacity: .48; }
.settings-delete span { color: #9d3d32; }
.settings-inline-status { min-height: 18px; margin: 10px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.4; }
#you-account-status { min-height: 20px; margin: 10px 0 0; color: #9d3d32; font-size: 13px; line-height: 1.4; }
@media (prefers-reduced-motion: no-preference) {
  .settings-screen[open] .settings-shell { animation: settings-in 280ms cubic-bezier(.22, 1, .36, 1) both; }
}
@keyframes settings-in { from { opacity: .78; transform: translate3d(0, 18px, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } }

@media (prefers-color-scheme: dark) {
  .settings-screen {
    --settings-accent-bg: #443027;
    --settings-accent-ink: #f0b18f;
    --settings-shadow: #6a4434;
  }
}

/* Account access is one plain card. It appears only in builds connected to
   the Tongue-tied Supabase project. */
.account-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  background: var(--cream, #fbf8f4);
  opacity: 1;
  transition: opacity 220ms cubic-bezier(.23, 1, .32, 1);
}
.account-gate[hidden] { display: none; }
.account-gate.is-leaving { opacity: 0; pointer-events: none; }
.account-card {
  width: min(100%, 410px);
  padding: 30px 24px 26px;
  border: 1px solid rgba(41, 35, 35, .12);
  border-radius: 30px;
  background: #fffdf9;
  box-shadow: 0 10px 0 #ead8ff;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 200ms cubic-bezier(.23, 1, .32, 1), transform 240ms cubic-bezier(.23, 1, .32, 1);
}
.account-gate.is-checking .account-card { opacity: 0; transform: translateY(10px); pointer-events: none; }
.account-gate.is-leaving .account-card { opacity: 0; transform: translateY(-8px) scale(.985); }
.account-card > img { display: block; width: 108px; height: 108px; margin: 0 auto 12px; }
.account-brand { margin: 0 0 28px; font: 700 clamp(40px, 11.5vw, 54px)/.94 "Inria Serif", Georgia, serif; letter-spacing: -.035em; text-align: center; }
.account-card form { display: grid; gap: 14px; }
.account-card label { display: grid; gap: 7px; color: #514a46; font-size: 13px; font-weight: 700; }
.account-card input { min-height: 52px; padding: 0 15px; border: 1px solid #d9cfc4; border-radius: 14px; background: #fff; color: #19171b; font: inherit; font-size: 17px; }
.account-card input:focus { outline: 3px solid rgba(148, 119, 184, .22); border-color: #9477b8; }
.account-secondary { min-height: 48px; border: 0; background: transparent; color: #40384a; font: 700 16px/1 system-ui; text-decoration: underline; text-underline-offset: 4px; }
.account-forgot { min-height: 34px; margin-top: -8px; color: #817970; font-size: 14px; font-weight: 600; }
.account-status { min-height: 22px; margin: 14px 0 0; color: #9d3d32; font-size: 14px; line-height: 1.4; text-align: center; }
.account-privacy { margin: 10px auto 0; max-width: 34ch; color: #817970; font-size: 12px; line-height: 1.45; text-align: center; }
.subscription-dialog { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: max(28px, env(safe-area-inset-top)) 20px max(26px, env(safe-area-inset-bottom)); border: 0; background: rgba(35, 29, 35, .32); color: var(--ink); }
.subscription-dialog[open] { display: grid; align-items: end; }
.subscription-dialog::backdrop { background: transparent; }
.subscription-card { position: relative; width: 100%; max-width: 480px; margin: 0 auto; padding: 28px 22px 20px; border: 1px solid var(--line); border-radius: 30px; background: var(--surface); box-shadow: 0 7px 0 var(--deck2), 0 28px 60px rgba(45, 36, 46, .22); text-align: center; }
.subscription-card > img { display: block; width: 82px; height: 82px; margin: -64px auto 10px; object-fit: contain; filter: drop-shadow(0 5px 0 rgba(82, 55, 71, .09)); }
.subscription-close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--tag-bg); color: var(--ink); font-size: 17px; }
.subscription-kicker { margin: 0 0 8px; color: #6f578e; font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.subscription-card h2 { margin: 0 0 10px; font: 700 clamp(40px, 11vw, 52px)/.98 "Inria Serif", Georgia, serif; letter-spacing: -.035em; }
.subscription-lead { max-width: 29ch; margin: 0 auto 24px; color: var(--ink-soft); font-size: 16px; line-height: 1.48; }
.subscription-owned-note { max-width: 35ch; margin: -12px auto 22px; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.subscription-buy { margin-bottom: 12px; }
.subscription-restore { min-height: 44px; border: 0; background: transparent; color: var(--ink); font: 700 14px/1 system-ui; text-decoration: underline; text-underline-offset: 4px; }
.subscription-status { min-height: 20px; margin: 4px 0 8px; color: #4f6e53; font-size: 13px; line-height: 1.4; }
.subscription-status.is-error { color: #9d3d32; }
.subscription-terms { max-width: 43ch; margin: 0 auto; color: #817970; font-size: 11px; line-height: 1.45; }
@media (prefers-reduced-motion: no-preference) { .subscription-dialog[open] .subscription-card { animation: subscription-in 380ms cubic-bezier(.22, 1, .36, 1) both; } }
@keyframes subscription-in { from { opacity: .7; transform: translate3d(0, 34px, 0) scale(.98); } to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .account-gate,
  .account-card { transition-duration: 1ms; }
  .account-gate.is-checking .account-card,
  .account-gate.is-leaving .account-card { transform: none; }
}

/* Practice recordings retain the app's existing controls and voice identity. */
.practice-voice-credit { font-size: 11px; color: #776d61; margin-right: auto; align-self: center; }
.practice-speech-notice { position: fixed; z-index: 10000; bottom: calc(96px + env(safe-area-inset-bottom)); left: 24px; right: 24px; max-width: 420px; margin: auto; padding: 14px 18px; border-radius: 16px; background: #24201d; color: #ffffff; font-size: 14px; line-height: 1.4; box-shadow: 0 6px 24px #0002; }
/* First-run language choice and the matching Settings control. */
.language-gate {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  background: #fbf8f4;
}

.language-card {
  width: min(100%, 430px);
  text-align: center;
}

.language-card > img { display: block; margin: 0 auto 18px; }
.language-card h1 { margin: 0; color: #101b3a; font: 700 clamp(30px, 9vw, 44px)/1.02 "Inria Serif", Georgia, serif; }
.language-card > p { max-width: 340px; margin: 12px auto 22px; color: #514b5c; font-size: 15px; line-height: 1.45; }
.language-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 18px; }
.language-option {
  min-height: 48px;
  border: 1px solid #ded6cd;
  border-radius: 14px;
  background: #fffaf4;
  color: #101b3a;
  font: inherit;
  font-weight: 650;
}
.language-option[data-language="ar"],
html[lang="ar"] body { font-family: "Geeza Pro", -apple-system, BlinkMacSystemFont, sans-serif; }
.language-option[data-language="hi"],
html[lang="hi"] body { font-family: "Kohinoor Devanagari", -apple-system, BlinkMacSystemFont, sans-serif; }
.language-option[aria-pressed="true"] { border-color: #101b3a; background: #101b3a; color: #ffffff; }
.language-continue { width: 100%; min-height: 52px; }
.language-status { min-height: 22px; margin: 10px 0 0 !important; font-size: 13px !important; }
.settings-language-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 52px; }
.settings-language-row select {
  max-width: 52%;
  border: 0;
  background: transparent;
  color: #101b3a;
  font: inherit;
  font-weight: 650;
  text-align: end;
}
html[dir="rtl"] .settings-language-row select { text-align: start; }

@media (max-width: 350px) {
  .language-options { grid-template-columns: 1fr; }
}
