:root {
  --bg: #15151e;
  --card: #1d1d29;
  --high: #252534;
  --line: #2e2e42;
  --text: #f8fafc;
  --muted: #aab4c8;
  --green: #34d399;
  --amber: #fbbf24;
  --sky: #38bdf8;
  --purple: #c084fc;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    15px/1.55 "Plus Jakarta Sans",
    Inter,
    system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #15151ef2;
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.wrap {
  max-width: 1250px;
  margin: auto;
  padding: 0 24px;
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 13px;
  padding-bottom: 13px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mark {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  border: 2px solid #6475da;
  background: linear-gradient(145deg, #123c38, #25214e);
  font-size: 25px;
}
.brand strong {
  font-size: 20px;
  letter-spacing: -0.04em;
}
.brand strong span {
  color: var(--purple);
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--muted);
}
nav {
  display: flex;
  gap: 4px;
  background: #101019;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: auto;
  max-width: 100%;
}
nav button {
  border: 0;
  background: none;
  color: var(--muted);
  border-radius: 11px;
  padding: 9px 12px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}
nav button.active {
  background: linear-gradient(110deg, #4f46e5, #9333ea);
  color: white;
  box-shadow: 0 5px 16px #4f46e533;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.small {
  font-size: 12px;
}
.pill,
.btn,
.iconbtn,
select,
input {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--high);
  color: var(--text);
}
.btn {
  padding: 10px 15px;
  font-weight: 750;
}
.btn:hover,
.iconbtn:hover {
  border-color: #818cf8;
  background: #323249;
}
.btn.primary {
  background: linear-gradient(110deg, #6366f1, #9333ea);
  border-color: transparent;
}
.btn.amber {
  background: linear-gradient(110deg, #fbbf24, #f97316);
  border: 0;
  color: #211606;
}
.btn.green {
  background: #059669;
  border-color: #10b981;
}
.btn.active {
  border-color: var(--amber);
  color: var(--amber);
}
.iconbtn {
  padding: 9px 12px;
}
.pill {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 5px 10px;
  color: var(--purple);
  background: #a855f71d;
  border-color: #a855f744;
  font-size: 11px;
  font-weight: 800;
}
.memory {
  border-top: 1px solid var(--line);
  padding: 6px 0;
  color: var(--muted);
  font-size: 11px;
}
.memory .wrap {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.memory b {
  font-weight: 700;
}
.green {
  color: var(--green);
}
.amber-t {
  color: var(--amber);
}
.sky {
  color: var(--sky);
}
.purple {
  color: var(--purple);
}
main {
  padding-top: 29px !important;
  padding-bottom: 90px !important;
}
.hero {
  border: 1px solid #3e3d63;
  border-radius: 26px;
  padding: 30px;
  background:
    radial-gradient(circle at 86% 0%, #343063 0, transparent 35%),
    linear-gradient(115deg, #182a2b, #17182b 52%, #241932);
  margin-bottom: 23px;
  box-shadow: 0 20px 60px #07070f55;
}
.hero h1 {
  margin: 12px 0 8px;
  font-size: clamp(26px, 3.2vw, 42px);
  line-height: 1.14;
  letter-spacing: -0.045em;
}
.hero p {
  color: #c8d1e2;
  max-width: 850px;
  margin: 0;
}
.section {
  display: none;
}
.section.active {
  display: block;
}
.section-title {
  font-size: 25px;
  letter-spacing: -0.035em;
  margin: 0 0 6px;
}
.subtitle {
  color: var(--muted);
  margin: 0 0 20px;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 23px;
  padding: 22px;
  margin-bottom: 19px;
}
.panel h3 {
  margin: 0 0 10px;
}
.toolbar {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  margin: 14px 0 20px;
}
.toolbar input,
.toolbar select {
  padding: 10px 12px;
  min-height: 42px;
  outline: none;
}
.toolbar input {
  flex: 1;
  min-width: 190px;
}
.toolbar select {
  max-width: 100%;
}
.muted {
  color: var(--muted);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 13px;
}
.tile {
  border: 1px solid var(--line);
  background: var(--card);
  padding: 17px;
  border-radius: 18px;
  min-width: 0;
}
.tile:hover {
  border-color: #595783;
}
.tile h3 {
  margin: 4px 0;
  font-size: 19px;
  line-height: 1.25;
}
.tile p {
  margin: 6px 0;
  color: #cbd5e1;
  font-size: 13px;
}
.tile .example {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-style: italic;
}
.tile-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}
.emoji {
  font-size: 30px;
}
.kicker {
  font:
    700 11px ui-monospace,
    SFMono-Regular,
    monospace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--purple);
}
.tile .es {
  font-size: 20px;
  color: var(--amber);
  font-weight: 850;
  overflow-wrap: anywhere;
}
.tile .en {
  color: #d0d6e2;
  font-size: 13px;
}
.listen {
  border: 1px solid #38bdf855;
  background: #38bdf816;
  color: var(--sky);
  border-radius: 10px;
  padding: 6px 9px;
  font-size: 15px;
  flex-shrink: 0;
}
.listen:hover {
  background: #38bdf833;
}
.segmented {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.segmented .btn {
  font-size: 12px;
}
.highlight {
  padding: 15px 18px;
  background: #0d29301c;
  border: 1px solid #34d3993a;
  border-radius: 15px;
  color: #d0eee4;
  font-size: 13px;
}
.columns {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.85fr);
  gap: 18px;
}
.field {
  background: #15151e;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px;
}
.field label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 7px;
}
.field input,
.field select {
  width: 100%;
  background: var(--high);
  padding: 11px;
}
.conj {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.conj button,
.conj .verb-static-form,
.conj .verb-past-form,
.conj .verb-k2-form {
  text-align: left;
  background: #15151e;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 14px;
  border-radius: 14px;
}
.conj button:hover {
  border-color: var(--sky);
}
.conj button small,
.conj .verb-static-form small,
.conj .verb-past-form small,
.conj .verb-k2-form small {
  display: block;
  color: var(--muted);
}
.conj button strong,
.conj .verb-static-form strong,
.conj .verb-past-form strong,
.conj .verb-k2-form strong {
  font:
    800 18px ui-monospace,
    monospace;
  color: var(--green);
}
.conj.past button strong,
.conj.past .verb-static-form strong {
  color: var(--amber);
}
.conj.future button strong {
  color: var(--sky);
}
.conj.conditional button strong {
  color: var(--purple);
}
.quiz {
  max-width: 680px;
  margin: 0 auto;
}
.quiz .prompt {
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 850;
  line-height: 1.2;
  margin: 15px 0;
  color: white;
}
.quiz input {
  width: 100%;
  padding: 14px;
  background: var(--bg);
  margin: 12px 0;
}
.feedback {
  padding: 18px;
  background: #121d26;
  border: 1px solid #406478;
  border-radius: 15px;
  margin: 14px 0;
}
.feedback strong {
  color: var(--green);
}
.dialogues {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
}
.scene-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 700px;
  overflow-y: auto;
}
.scene-list button {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
}
.scene-list button:hover {
  background: var(--high);
}
.scene-list button.active {
  background: #4f46e533;
  border-color: #818cf877;
  color: white;
}
.turn {
  display: flex;
  gap: 12px;
  margin: 15px 0;
  align-items: start;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: #2b3762;
  color: #b5c6ff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 850;
  flex-shrink: 0;
}
.turn:nth-child(even) .avatar {
  background: #3d3157;
  color: #e6bcff;
}
.bubble {
  background: #15151e;
  border: 1px solid var(--line);
  border-radius: 5px 17px 17px 17px;
  padding: 12px 15px;
  flex: 1;
}
.bubble .es {
  font-size: 16px;
  font-weight: 700;
}
.bubble .en {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.bubble .speaker {
  color: var(--sky);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.scene-note {
  color: #d8cafd;
  background: #c084fc18;
  border: 1px solid #c084fc44;
  border-radius: 14px;
  padding: 12px 15px;
  font-size: 13px;
  margin-top: 20px;
}
.scene-navigator {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}
.audio-status {
  color: #b9c4d7;
  font-size: 12px;
}
.status {
  min-height: 18px;
  margin-top: 7px;
  color: var(--sky);
  font-size: 12px;
}
.empty {
  padding: 36px;
  text-align: center;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
}
.foot {
  color: #8993a8;
  font-size: 12px;
  border-top: 1px solid var(--line);
  padding: 20px 0;
}
.counter {
  color: var(--amber);
  font:
    800 12px ui-monospace,
    monospace;
}
audio {
  max-width: 100%;
}
@media (max-width: 850px) {
  .columns,
  .dialogues {
    grid-template-columns: 1fr;
  }
  .scene-list {
    max-height: none;
    flex-direction: row;
    overflow: auto;
    white-space: nowrap;
  }
  .scene-list button {
    flex-shrink: 0;
  }
  .header-top {
    align-items: start;
  }
  nav {
    order: 3;
    width: 100%;
  }
}
@media (max-width: 570px) {
  .wrap {
    padding-left: 15px;
    padding-right: 15px;
  }
  .hero {
    padding: 22px;
  }
  .panel {
    padding: 17px;
  }
  .conj {
    grid-template-columns: repeat(2, 1fr);
  }
  .turn {
    gap: 7px;
  }
  .bubble {
    padding: 10px;
  }
  .header-actions .eyebrow {
    display: none;
  }
}
.story-visuals {
  display: block;
}
.story-frame {
  margin: 19px 0;
  background: #15151e;
  border: 1px solid #3d3d58;
  border-radius: 17px;
  overflow: hidden;
  min-width: 0;
}
.story-frame.ending-frame {
  border-color: #34d39966;
}
.story-image {
  aspect-ratio: 16/9;
  max-height: 385px;
  background: linear-gradient(130deg, #3b3660, #212d40);
  overflow: hidden;
}
.story-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.story-frame figcaption {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  min-height: 87px;
}
.story-frame figcaption strong {
  font-size: 13px;
  line-height: 1.35;
  color: white;
}
.story-frame figcaption span:last-child {
  font-size: 11px;
  line-height: 1.3;
  color: #aab4c8;
}
.frame-tag {
  font:
    800 10px ui-monospace,
    monospace;
  letter-spacing: 0.07em;
  color: #c9a7f7;
}
.frame-tag.resolved {
  color: #6ee7b7;
}
@media (max-width: 620px) {
  .story-image {
    max-height: 290px;
  }
  .story-frame figcaption {
    min-height: 0;
  }
}
.lesson-stages {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}
.stage-btn {
  min-height: 130px;
  text-align: left;
  border: 2px solid var(--line);
  border-radius: 19px;
  padding: 17px;
  background: var(--card);
  color: var(--text);
}
.stage-btn.active {
  border-color: var(--stage);
  background: color-mix(in srgb, var(--stage) 15%, var(--card));
  box-shadow: 0 12px 29px #0004;
}
.stage-btn:hover {
  border-color: var(--stage);
}
.stage-btn .stage-number {
  font:
    850 11px ui-monospace,
    monospace;
  color: var(--stage);
}
.stage-btn strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
  margin: 12px 0 3px;
}
.stage-btn small {
  display: block;
  color: #b5bfd1;
}
.chunk-stem {
  color: #9caac0;
}
.chunk-ending {
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 5px;
  color: var(--stage);
}
.chunk-word {
  font:
    850 22px ui-monospace,
    monospace;
}
.lesson-rules {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.lesson-rules div {
  padding: 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.lesson-rules b {
  color: var(--stage);
}
.lesson-conj-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.lesson-conj-grid button {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 14px;
  padding: 14px;
  color: var(--text);
}
.lesson-conj-grid button:hover {
  border-color: var(--stage);
}
.lesson-conj-grid small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.matrix-verb {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.matrix-cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.matrix-cell {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}
.matrix-cell button {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 3px;
  font:
    12px ui-monospace,
    monospace;
}
.matrix-cell button:hover {
  color: var(--sky);
}
.flip-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(230px, 0.7fr);
  gap: 17px;
}
.flip-space {
  perspective: 1300px;
  height: 460px;
}
.flip-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}
.flip-inner.turned {
  transform: rotateY(180deg);
}
.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--card);
  border: 2px solid #7770bd;
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 22px 50px #05050a66;
}
.flip-back {
  transform: rotateY(180deg);
  border-color: var(--green);
}
.flip-inner:not(.turned) .flip-back,
.flip-inner.turned .flip-front {
  pointer-events: none;
  visibility: hidden;
}
.flip-center {
  text-align: center;
  padding: 15px 0;
}
.flip-prompt {
  font-size: clamp(25px, 3.7vw, 40px);
  font-weight: 850;
  line-height: 1.2;
  margin: 13px 0;
  overflow-wrap: anywhere;
}
.flip-input {
  padding: 11px 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: white;
  max-width: 70%;
  font-size: 16px;
}
.flip-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px auto;
  max-width: 460px;
}
.flip-choices button {
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: white;
}
.flip-choices button:hover {
  border-color: var(--sky);
}
.flip-grades {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}
.flip-grades button {
  padding: 10px 5px;
  font-size: 12px;
}
.flip-sidebar {
  align-self: start;
}
@media (max-width: 900px) {
  .lesson-stages,
  .matrix-cols {
    grid-template-columns: repeat(2, 1fr);
  }
  .flip-layout {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 540px) {
  .lesson-rules,
  .lesson-conj-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .flip-space {
    height: 510px;
  }
  .flip-face {
    padding: 16px;
  }
  .flip-choices {
    grid-template-columns: 1fr;
  }
}
.scene-group {
  font:
    900 11px ui-monospace,
    monospace;
  letter-spacing: 0.08em;
  color: #c4a3eb;
  padding: 17px 11px 4px;
  border-top: 1px solid var(--line);
  margin-top: 6px;
}
.scene-group:first-child {
  border-top: 0;
  padding-top: 0;
}
.level-mini {
  display: block;
  color: #8c9bb2;
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
}
.story-level {
  color: #d5b5ff;
  background: #c084fc22;
  border: 1px solid #c084fc55;
  border-radius: 7px;
  padding: 2px 7px;
}
.scene-list button.active .level-mini {
  color: #d5b5ff;
}
@media (max-width: 850px) {
  .scene-group {
    display: none;
  }
}
.image-credit {
  font-size: 10px !important;
  color: #93a0b4 !important;
  line-height: 1.4;
}
.image-credit a {
  color: #7dd3fc;
}
.image-credit a:hover {
  text-decoration: underline;
}
.stage-travel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.stage-travel strong {
  color: var(--muted);
  text-align: center;
}
.lesson-stages {
  display: flex !important;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-color: var(--sky) var(--card);
  padding: 3px 3px 12px;
  gap: 12px;
}
.lesson-stages .stage-btn {
  flex: 0 0 clamp(190px, 25vw, 260px);
  scroll-snap-align: start;
}
.lesson-rules {
  margin: 16px 0;
  gap: 10px;
}
.regular-rows {
  display: grid;
  gap: 13px;
}
.regular-row {
  border: 1px solid var(--stage);
  border-radius: 16px;
  padding: 13px;
  background: color-mix(in srgb, var(--stage) 7%, var(--bg));
}
.row-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 9px;
}
.row-title strong {
  color: var(--stage);
  font-size: 17px;
}
.row-title small {
  color: var(--muted);
}
.row-forms {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}
.row-forms button {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  padding: 8px 5px;
  overflow-wrap: anywhere;
}
.row-forms button:hover,
.side-chunk:hover {
  border-color: var(--stage);
}
.row-forms button small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.row-forms button span {
  font:
    700 13px ui-monospace,
    monospace;
}
.lesson-voice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #38bdf866;
  border-radius: 15px;
  padding: 14px;
  margin: 18px 0;
}
.lesson-voice p {
  margin: 2px 0;
}
.lesson-voice audio {
  width: min(100%, 430px);
}
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.pattern-tile {
  border-left: 3px solid var(--stage);
  border-radius: 10px;
  background: var(--bg);
  padding: 12px 15px;
}
.pattern-tile b {
  color: var(--stage);
}
.pattern-tile p {
  margin: 5px 0;
  color: var(--muted);
}
.irregular-focus {
  background: color-mix(in srgb, var(--stage) 8%, var(--card));
  border: 1px solid var(--stage);
  border-radius: 16px;
  padding: 16px;
  margin-top: 19px;
}
.irregular-focus h3 {
  margin: 0;
}
.irregular-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}
.irregular-grid > div {
  background: var(--bg);
  border-radius: 10px;
  padding: 11px;
}
.irregular-grid > div > b {
  color: var(--stage);
}
.irregular-grid > div > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 5px;
}
.irregular-grid button {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 5px;
  text-align: left;
  overflow-wrap: anywhere;
  font:
    12px ui-monospace,
    monospace;
}
.irregular-grid button small {
  display: block;
  color: var(--muted);
}
.conj-example {
  display: block;
  color: #b8c4d7;
  font-size: 12px;
  margin: 10px 0 5px;
  min-height: 2.5em;
}
.matrix-verb summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 18px;
}
.matrix-verb .matrix-cols {
  margin-top: 13px;
}
.matrix-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.flip-filter-panel {
  margin-bottom: 16px;
}
.filter-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 13px;
}
.filter-row > b {
  padding-top: 7px;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.filter-chip {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 25px;
  color: var(--text);
  padding: 8px 13px;
  font-weight: 700;
}
.filter-chip.selected {
  background: #38bdf81c;
  border-color: var(--sky);
  color: #a5e6ff;
}
.flip-layout {
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.82fr);
}
.flip-inner {
  cursor: pointer;
}
.flip-space {
  height: 360px;
}
.flip-prompt {
  font-size: clamp(22px, 3vw, 36px);
}
.writing-panel {
  margin-top: 15px;
}
.writing-row {
  display: flex;
  gap: 9px;
  margin: 10px 0;
}
.writing-row input {
  min-width: 0;
  flex: 1;
  padding: 12px 13px;
  color: white;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.special-chars {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.special-chars button {
  min-width: 38px;
  padding: 5px 9px;
}
.flip-feedback {
  margin-top: 12px;
  line-height: 1.5;
  border-radius: 10px;
  padding: 10px 12px;
}
.yellow-note {
  background: #fbbf241d;
  border: 1px solid #fbbf2477;
  color: #ffdf8b;
}
.flip-sidebar .tile-head {
  align-items: start;
}
.flip-sidebar h3 {
  margin: 2px 0 0;
}
.flip-sidebar .tile-head button {
  font-size: 11px;
  white-space: nowrap;
}
.side-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0;
}
.side-meta strong {
  font-size: 17px;
}
.side-meta span {
  font-size: 12px;
}
.side-chunk {
  display: grid;
  grid-template-columns: 75px minmax(0, 1fr);
  gap: 0 8px;
  width: 100%;
  margin: 4px 0;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 8px;
  text-align: left;
}
.side-chunk small {
  color: var(--muted);
}
.side-chunk strong {
  color: var(--stage);
  font:
    700 15px ui-monospace,
    monospace;
}
.side-chunk > span {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}
.side-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  margin: 9px 0;
}
.side-pager button {
  font-size: 11px;
  padding: 7px;
}
.side-pager span {
  font-size: 11px;
  color: var(--muted);
}
.flip-sidebar.collapsed {
  align-self: start;
}
.flip-sidebar.collapsed .side-meta {
  margin-bottom: 6px;
}
@media (max-width: 900px) {
  .flip-layout {
    grid-template-columns: 1fr;
  }
  .row-forms {
    grid-template-columns: repeat(3, 1fr);
  }
  .matrix-cols {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .stage-travel {
    flex-wrap: wrap;
  }
  .stage-travel strong {
    order: -1;
    width: 100%;
  }
  .stage-travel button {
    flex: 1;
  }
  .lesson-stages .stage-btn {
    flex-basis: 80vw;
  }
  .row-forms {
    grid-template-columns: repeat(2, 1fr);
  }
  .pattern-grid,
  .irregular-grid {
    grid-template-columns: 1fr;
  }
  .irregular-grid > div > div {
    grid-template-columns: repeat(2, 1fr);
  }
  .filter-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .flip-space {
    height: 410px;
  }
  .writing-row {
    flex-wrap: wrap;
  }
  .writing-row button {
    width: 100%;
  }
  .matrix-cols {
    grid-template-columns: 1fr;
  }
}

.mark {
  padding: 0;
  overflow: hidden;
  background: #421c74;
  border: 1px solid #7850b8;
  border-radius: 13px;
}
.mark svg {
  display: block;
  width: 100%;
  height: 100%;
}
.brand .brand-express {
  color: #e8b8ff;
  letter-spacing: 0.16em;
  font-size: 11px;
  margin-top: -1px;
}
#flipExample {
  font-size: 18px;
  line-height: 1.48;
  font-weight: 600;
  color: #dce6f4;
  margin-top: 10px;
  overflow-wrap: anywhere;
}
.flip-back .flip-center {
  max-height: 245px;
  overflow: auto;
}
.verb-icon {
  display: inline-block;
  vertical-align: -0.22em;
  flex: none;
  width: 21px;
  height: 21px;
  color: var(--stage, var(--purple));
  margin-right: 5px;
}
.verb-icon-gallery {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 13px;
}
.verb-icon-gallery button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 7px 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.verb-icon-gallery button:hover,
.verb-icon-gallery button[aria-pressed="true"] {
  border-color: var(--purple);
  background: #c084fc1b;
}
.verb-quick-gallery {
  border: 1px solid var(--line);
  padding: 12px 15px;
  border-radius: 13px;
  margin: 8px 0 18px;
}
.verb-quick-gallery summary {
  cursor: pointer;
  font-weight: 800;
  color: #dcb9ff;
}
.verb-icon-gallery .verb-icon {
  margin: 0;
}
.regular-row .row-title strong {
  display: inline-flex;
  align-items: center;
}
.irregular-grid > div > b {
  display: inline-flex;
  align-items: center;
}
.flip-badge-area {
  display: flex;
  gap: 6px;
  align-items: center;
}
.flip-badge-area .verb-icon {
  margin: 0;
  width: 25px;
  height: 25px;
}
@media (max-width: 600px) {
  #flipExample {
    font-size: 17px;
    line-height: 1.42;
  }
  .flip-back .flip-center {
    max-height: 250px;
  }
}

/* Narrow-screen grid tracks may shrink; the scene carousel remains independently scrollable. */
.dialogues > * {
  min-width: 0;
}
.scene-list {
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 850px) {
  .dialogues {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 600px) {
  header {
    position: relative;
  }
  .memory .wrap {
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow-x: auto;
    gap: 13px;
    scrollbar-width: thin;
    scrollbar-color: #555274 transparent;
  }
}
.flash-vocab-icon {
  display: inline-block;
  font-size: 24px;
  line-height: 1.2;
  vertical-align: middle;
  max-width: 100%;
}

/* Gato-Sensei: five original transparent raster poses, with a reduced-motion-safe crossfade. */
.hero .sensei-bubble,
.sensei-coach .sensei-bubble {
  color: #311849;
}
.sensei-chat .sensei-bubble {
  position: relative;
}
.sensei-chat .sensei-bubble::after {
  right: 22px;
  bottom: -7px;
  transform: rotate(45deg);
}
.hero.sensei-mode {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(285px, 340px);
  align-items: center;
  gap: 12px;
  min-height: 360px;
  overflow: hidden;
  padding-bottom: 0;
}
.hero-copy {
  min-width: 0;
  align-self: center;
  padding-bottom: 28px;
}
.hero-sensei {
  display: none;
  min-width: 0;
  align-items: center;
  justify-content: end;
  flex-direction: column;
  align-self: end;
}
.hero.sensei-mode .hero-sensei {
  display: flex;
}
.sensei-name {
  display: block;
  color: #eac6ff;
  font:
    850 11px/1.4 ui-monospace,
    SFMono-Regular,
    monospace;
  letter-spacing: 0.12em;
}
.sensei-chat {
  position: relative;
  z-index: 2;
  align-self: flex-end;
  max-width: 280px;
  margin-right: 6px;
}
.sensei-bubble {
  margin: 6px 0 0;
  padding: 12px 17px;
  border: 1px solid #caa1ff88;
  border-radius: 19px 19px 5px 19px;
  background: linear-gradient(135deg, #f9f4ff, #e8dcff);
  color: #311849;
  box-shadow: 0 12px 28px #120c254d;
  font-weight: 850;
  font-size: 16px;
  line-height: 1.3;
  min-width: 155px;
}
.sensei-chat .sensei-bubble::after {
  content: "";
  position: absolute;
  right: 23px;
  bottom: 17px;
  width: 12px;
  height: 12px;
  transform: translateY(16px) rotate(45deg);
  background: #e8dcff;
  border-right: 1px solid #caa1ff88;
  border-bottom: 1px solid #caa1ff88;
}
.sensei-bubble.bubble-pop {
  animation: senseiPop 0.4s ease-out;
}
@keyframes senseiPop {
  from {
    opacity: 0.45;
    transform: translateY(6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.sensei-demo {
  white-space: nowrap;
  display: block;
  margin: 9px 0 0 auto;
  border: 0;
  background: transparent;
  color: #dbc1fc;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 11px;
  font-weight: 750;
  padding: 4px;
}
.sensei-demo:focus-visible {
  outline: 2px solid var(--sky);
}
.sensei-art {
  position: relative;
  width: min(100%, 265px);
  aspect-ratio: 680/820;
  flex-shrink: 0;
  isolation: isolate;
  filter: drop-shadow(0 12px 17px #0b062a88);
}
.hero-sensei > .sensei-art {
  margin-bottom: -19px;
  margin-top: -9px;
  animation: senseiBreathe 4s ease-in-out infinite;
}
.sensei-pose {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: translateY(12px) rotate(-2deg) scale(0.96);
  transition:
    opacity 0.4s ease,
    transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}
.sensei-pose.is-visible {
  opacity: 1;
  transform: translateY(0) rotate(0) scale(1);
}
@keyframes senseiBreathe {
  50% {
    transform: translateY(-4px);
  }
}
.sensei-coach {
  display: flex;
  align-items: center;
  gap: 17px;
  padding: 13px 18px 0;
  margin: 0 0 20px;
  min-height: 130px;
  overflow: hidden;
  background: linear-gradient(110deg, #292144, #241e35 60%, #1c2836);
  border: 1px solid #8358ae8a;
  border-radius: 22px;
  box-shadow: 0 13px 33px #05051033;
}
.sensei-coach-art {
  width: 104px;
  height: 115px;
  flex: none;
  align-self: end;
  position: relative;
}
.sensei-coach .sensei-art {
  width: 104px;
  height: 125px;
  position: absolute;
  left: 0;
  bottom: -12px;
}
.sensei-coach-copy {
  min-width: 0;
  align-self: center;
  padding-bottom: 13px;
}
.sensei-coach .sensei-bubble {
  max-width: 560px;
  min-width: 0;
  margin-top: 7px;
  padding: 10px 15px;
  font-size: 14px;
}
@media (max-width: 900px) {
  .hero.sensei-mode {
    grid-template-columns: minmax(0, 1fr) 225px;
    min-height: 310px;
  }
  .hero-sensei > .sensei-art {
    width: 205px;
  }
  .sensei-chat {
    max-width: 210px;
  }
}
@media (max-width: 600px) {
  .hero.sensei-mode {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding-bottom: 0;
  }
  .hero.sensei-mode .hero-copy {
    padding-bottom: 5px;
  }
  .hero-sensei {
    width: 100%;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    gap: 2px;
  }
  .sensei-chat {
    align-self: center;
    flex: 1;
    min-width: 0;
    margin: 0 0 16px;
  }
  .sensei-chat .sensei-bubble {
    min-width: 0;
    padding: 9px 11px;
    font-size: 14px;
  }
  .sensei-demo {
    font-size: 10px;
  }
  .sensei-chat .sensei-bubble::after {
    display: none;
  }
  .hero-sensei > .sensei-art {
    width: clamp(105px, 35vw, 170px);
    margin-bottom: -8px;
    margin-top: 0;
  }
  .sensei-coach {
    gap: 8px;
    padding: 9px 10px 0;
    min-height: 110px;
  }
  .sensei-coach-art {
    width: 76px;
    height: 100px;
  }
  .sensei-coach .sensei-art {
    width: 80px;
    height: 100px;
    bottom: -7px;
  }
  .sensei-coach .sensei-bubble {
    font-size: 13px;
    padding: 9px 10px;
  }
  .sensei-name {
    font-size: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sensei-pose {
    transition: none !important;
  }
  .hero-sensei > .sensei-art,
  .sensei-bubble.bubble-pop {
    animation: none !important;
  }
}

/* Sensei's collectible expressions: five public previews, the rest earned. */
.master-cat {
  position: relative;
  display: inline-block;
}
.master-ears {
  position: absolute;
  width: 52px;
  height: 16px;
  left: 6px;
  top: -10px;
  pointer-events: none;
  overflow: visible;
  filter: drop-shadow(0 1px 2px #100817);
}
.sensei-journal {
  border-color: #6f568e;
  margin-top: -6px;
}
.sensei-journal summary {
  cursor: pointer;
  color: #f0d7ff;
  font-weight: 850;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.sensei-journal summary small {
  width: 100%;
  font-weight: 500;
  color: var(--muted);
}
.sensei-journal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
  margin-top: 17px;
}
.sensei-collectible {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 165px;
  gap: 5px;
  padding: 9px;
  background: #171520;
  border: 1px solid #54436c;
  border-radius: 14px;
  color: white;
  text-align: center;
  overflow: hidden;
}
.sensei-collectible:not(:disabled):hover {
  border-color: #c9a2ff;
  background: #312043;
}
.sensei-collectible:disabled {
  opacity: 0.68;
  cursor: not-allowed;
}
.sensei-collectible img {
  width: 80px;
  height: 95px;
  object-fit: contain;
}
.sensei-collectible strong {
  font-size: 12px;
  line-height: 1.25;
}
.sensei-collectible small {
  color: #baa6ce;
  font-size: 10px;
  line-height: 1.3;
}
.sensei-exercise {
  border-color: #644c80;
}
.sensei-exercise-form {
  display: flex;
  gap: 9px;
  margin: 12px 0;
}
.sensei-exercise-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
}
.sensei-exercise #senseiChallengeFeedback {
  min-height: 22px;
}
.sensei-exercise #senseiChallengeNext {
  margin: 5px 0 8px;
}
.sensei-art.effect-star::after,
.sensei-art.effect-fire::after,
.sensei-art.effect-super::after {
  position: absolute;
  pointer-events: none;
  z-index: 3;
  text-shadow: 0 0 13px currentColor;
}
.sensei-art.effect-star::after {
  content: "✦  ✦";
  top: 23%;
  left: 36%;
  color: #ffd84f;
  font-size: clamp(12px, 1.8vw, 23px);
  letter-spacing: 0.12em;
  animation: senseiSpark 0.9s ease-in-out infinite alternate;
}
.sensei-art.effect-fire::after {
  content: "🔥  🔥";
  top: 20%;
  left: 31%;
  font-size: clamp(15px, 2.3vw, 28px);
  animation: senseiSpark 0.4s ease-in-out infinite alternate;
}
.sensei-art.effect-fire .sensei-pose.is-visible {
  filter: drop-shadow(0 0 18px #f97316);
}
.sensei-art.effect-super {
  filter: drop-shadow(0 0 22px #ffe356);
}
.sensei-art.effect-super::before {
  content: "";
  position: absolute;
  inset: 2% 0 1%;
  z-index: -1;
  background: radial-gradient(
    ellipse,
    #ffe458aa 8%,
    #fbbf2433 48%,
    transparent 72%
  );
  animation: senseiSpark 0.55s ease-in-out infinite alternate;
}
.sensei-art.effect-super::after {
  content: "⚡  ⚡";
  top: 17%;
  left: 7%;
  width: 86%;
  display: flex;
  justify-content: space-between;
  font-size: clamp(22px, 3vw, 38px);
  color: #ffe14e;
  animation: senseiSpark 0.28s ease-in-out infinite alternate;
}
.sensei-art.effect-super .sensei-pose.is-visible {
  filter: sepia(0.75) saturate(2.8) hue-rotate(-16deg)
    drop-shadow(0 0 12px #ffd500);
}
@keyframes senseiSpark {
  from {
    opacity: 0.66;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1.05);
  }
}
@media (max-width: 600px) {
  .master-ears {
    transform: scale(0.9);
    transform-origin: left bottom;
  }
  .sensei-exercise-form {
    flex-wrap: wrap;
  }
  .sensei-exercise-form button {
    width: 100%;
  }
  .sensei-journal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sensei-art.effect-star::after {
    font-size: 14px;
  }
  .sensei-art.effect-fire::after {
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sensei-art.effect-star::after,
  .sensei-art.effect-fire::after,
  .sensei-art.effect-super::before,
  .sensei-art.effect-super::after {
    animation: none !important;
  }
}

/* Position the provisional star/flame overlays over both pupils at every size. */
.sensei-art.effect-star::before,
.sensei-art.effect-star::after,
.sensei-art.effect-fire::before,
.sensei-art.effect-fire::after {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  animation: senseiSpark 0.65s ease-in-out infinite alternate;
  line-height: 1;
}
.sensei-art.effect-star::before,
.sensei-art.effect-star::after {
  content: "★";
  top: 35.3%;
  font-size: clamp(9px, 1.35vw, 16px);
  color: #ffe361;
  text-shadow: 0 0 8px #ffe442;
}
.sensei-art.effect-star::before {
  left: 34.5%;
}
.sensei-art.effect-star::after {
  left: 55.5%;
  letter-spacing: 0;
}
.sensei-art.effect-fire::before,
.sensei-art.effect-fire::after {
  content: "🔥";
  top: 41.5%;
  font-size: clamp(10px, 1.5vw, 18px);
  text-shadow: 0 0 8px #fb923c;
}
.sensei-art.effect-fire::before {
  left: 37%;
}
.sensei-art.effect-fire::after {
  left: 61%;
}
@media (prefers-reduced-motion: reduce) {
  .sensei-art.effect-star::before,
  .sensei-art.effect-fire::before {
    animation: none !important;
  }
}
.vocab-group {
  grid-column: 1/-1;
  margin: 14px 0 1px;
  padding: 11px 15px;
  border-left: 3px solid #a78bfa;
  border-radius: 8px;
  background: #a78bfa14;
  color: #e9d5ff;
  font-size: 15px;
  letter-spacing: 0.02em;
}
#vocabIntroCount {
  color: #e9d5ff;
}
.adjective-card .adj-fem {
  color: #b9a7ff;
}
.adjective-card .adj-note {
  border-top: 1px solid var(--line);
  padding-top: 9px;
  line-height: 1.5;
}
.adjective-card .kicker {
  letter-spacing: 0.05em;
}
.adjective-card .adj-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 3px 10px;
}
.adjective-card .adj-opposite {
  border: 1px solid #765caa66;
  border-radius: 8px;
  background: #5b32842d;
  color: #d6c3ff;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.adjective-card .adj-opposite:hover,
.adjective-card .adj-opposite:focus-visible {
  background: #7c3aed55;
  border-color: #ad85eb;
  color: #fff;
}
.adjective-card .adj-no-opposite {
  color: #7d8396;
  font-size: 10px;
  font-weight: 600;
}
.adjective-card.adj-highlight {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

/* Offline progress transfer, appended without changing the established visual language. */
.progress-transfer {
  max-width: 720px;
  margin: 12px auto 0;
  color: #c7c6db;
  font-size: 13px;
}
.progress-transfer summary {
  cursor: pointer;
  color: #c7a7ff;
  font-weight: 700;
}
.progress-transfer p {
  line-height: 1.5;
}
.progress-transfer .btn {
  display: inline-flex;
  align-items: center;
  margin: 6px 8px 6px 0;
  cursor: pointer;
}
.progress-transfer [role="status"] {
  display: block;
  min-height: 1.3em;
  color: #ffda93;
}
/* WCAG AA contrast on the two very dark advanced-stage labels. */
button[data-stage="14"] .stage-number {
  color: #f472b6 !important;
}
button[data-stage="15"] .stage-number {
  color: #cbd5e1 !important;
}

.adjective-card .adj-no-opposite {
  color: #b9c2d2;
}
/* Deutsch edition additions */
.brand-express {
  font-size: 10px;
  color: #dfc5ff;
}
.scene-visual {
  margin: 18px 0;
  background: #141420;
  border: 1px solid var(--line);
  border-radius: 17px;
  overflow: hidden;
}
.scene-visual img {
  display: block;
  width: 100%;
  max-height: 300px;
  object-fit: cover;
}
.scene-visual figcaption {
  padding: 9px 13px;
  font-size: 12px;
  color: #c9d2e4;
}
.draft-tag {
  display: inline-block;
  margin: 5px 0;
  padding: 2px 7px;
  border: 1px solid #eab30877;
  border-radius: 6px;
  color: #fcd34d;
  font-size: 10px;
}
.tile .note {
  border-top: 1px solid var(--line);
  padding-top: 9px;
  color: #d2dcf1;
  line-height: 1.55;
}
.case-table {
  overflow-x: auto;
}
.case-table table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  min-width: 540px;
}
.case-table th,
.case-table td {
  border: 1px solid #48485c;
  padding: 10px;
  text-align: left;
}
.case-table th {
  background: #292637;
}
.case-0 td {
  color: #8ee4b8;
}
.case-1 td {
  color: #ffda8a;
}
.case-2 td {
  color: #90d6fb;
}
.case-3 td {
  color: #dbb6fd;
}
.cat-tile {
  text-align: center;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  color: white;
}
.cat-tile img {
  width: 110px;
  height: 125px;
  object-fit: contain;
}
.cat-tile:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}
.cat-tile small {
  color: #bdafcf;
}
.flip-viewport {
  perspective: 1000px;
  max-width: 720px;
  margin: 15px auto;
}
.flip-card {
  background: none;
  border: 0;
  width: 100%;
  height: 295px;
  display: block;
  text-align: center;
  color: #fff;
  cursor: pointer;
}
.flip-inner {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.62s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.flip-card.is-flipped .flip-inner {
  transform: rotateY(180deg);
}
.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid #9872da;
  border-radius: 24px;
  box-shadow: 0 20px 48px #0707148a;
  padding: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-direction: column;
  background: radial-gradient(circle at 80% 15%, #4c377e, #24203d 62%, #1e1b32);
}
.flip-face strong {
  font-size: clamp(27px, 5vw, 43px);
  line-height: 1.14;
}
.flip-face small {
  color: #c7c9e4;
}
.flip-back {
  transform: rotateY(180deg);
  background: radial-gradient(circle at 30% 10%, #215346, #1e2c34 65%, #181e2d);
}
.flip-back strong {
  color: #f8c67e;
}
.flip-back > span:not(.kicker) {
  font-size: 19px;
  line-height: 1.35;
  max-height: 135px;
  overflow: auto;
}
.stage-travel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 15px 0;
}
.stage-travel strong {
  color: #d1b5fd;
}
.segmented button[aria-pressed="true"] {
  background: #5b3e89;
  border-color: #b797f4;
  color: white;
}
.segmented button[aria-pressed="false"] {
  opacity: 0.72;
}
.tile button[data-opposite] {
  margin-top: 7px;
}
.scene-list small {
  margin-left: auto;
  font-size: 10px;
  color: #a8aed1;
}
#vocabGrid .tile .example,
#adverbGrid .tile .example {
  font-size: 14px;
}
.tile h3.es {
  font-size: 20px;
}
.section .panel details summary {
  cursor: pointer;
}
.hero .sensei-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.hero .sensei-art {
  width: 245px;
  height: 260px;
}
.hero.sensei-mode {
  min-height: 315px;
}
.memory b {
  white-space: nowrap;
}
nav button {
  font-size: 11px;
}
#flashFeedback {
  min-height: 25px;
}
#vocabGrid .tile {
  content-visibility: auto;
  contain-intrinsic-size: 210px;
}
#sceneList {
  max-height: 720px;
}
input[type="checkbox"] {
  width: auto;
  min-width: 15px;
  accent-color: #a78bfa;
}
@media (max-width: 600px) {
  .stage-travel {
    flex-wrap: wrap;
  }
  .hero .sensei-art {
    width: 120px;
    height: 145px;
  }
  .flip-card {
    height: 315px;
  }
  .flip-back > span:not(.kicker) {
    font-size: 17px;
  }
}
/* Deutsch curriculum expansion: clearly separated micro-chunks and case cues. */
.lesson-chunks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.chunk-item {
  position: relative;
  padding: 17px 16px 13px;
  border: 1px solid #7561a05c;
  border-radius: 15px;
  background: linear-gradient(160deg, #27213b, #191f2e);
  min-height: 116px;
}
.chunk-item strong {
  display: block;
  color: #f4d5a5;
  font-size: 17px;
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}
.chunk-item small {
  display: block;
  color: #b9dcf6;
  font-size: 12px;
}
.chunk-item p {
  font-size: 12px;
  line-height: 1.45;
  color: #d2d4e6;
  margin: 8px 0 0;
}
.chunk-no {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  background: #a78bfa30;
  color: #dbc9ff;
  font: 800 11px monospace;
  margin-bottom: 8px;
}
.memory-tip {
  padding: 11px 14px;
  border: 1px solid #facc1560;
  border-radius: 12px;
  background: #facc1512;
  color: #fbe6a6;
  font-size: 13px;
  line-height: 1.55;
  margin: 14px 0;
}
.chunk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 14px;
  margin-top: 15px;
}
.chunk-panel {
  background: #1b1b2b;
  border: 1px solid #665a866e;
  border-radius: 18px;
  padding: 16px;
  min-width: 0;
  box-shadow: 0 12px 24px #06061130;
}
.chunk-panel h3 {
  font-size: 17px;
  margin: 6px 0;
}
.chunk-panel .kicker {
  margin: 9px 0 12px;
  line-height: 1.5;
}
.chunk-pieces {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 7px;
}
.chunk-piece {
  display: flex;
  flex-direction: column;
  flex: 1 1 120px;
  gap: 3px;
  padding: 10px 11px;
  border: 1px solid #6d5ca67a;
  border-radius: 12px;
  background: #46326340;
  min-width: 120px;
}
.chunk-piece:nth-child(3n + 2) {
  border-color: #4f8d9c8a;
  background: #25596a30;
}
.chunk-piece:nth-child(3n) {
  border-color: #93824e80;
  background: #5449212b;
}
.chunk-piece b {
  font-size: 15px;
  color: #fff1cb;
  overflow-wrap: anywhere;
}
.chunk-piece small {
  font-size: 12px;
  color: #bbd7f0;
}
.chunk-piece em {
  font-size: 10px;
  color: #b9adc9;
  font-style: normal;
  margin-top: auto;
  line-height: 1.35;
}
.verb-sentence-grid button {
  min-height: 112px;
  display: flex;
  align-items: start;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  text-align: left;
}
.verb-sentence-grid .verb-example {
  font-size: 12px;
  color: #c9d9e8;
  line-height: 1.4;
  font-weight: 500;
}
.verb-sentence-grid button:hover .verb-example {
  color: #fff;
}
.verb-perfect {
  border: 1px solid #74664670;
  border-radius: 13px;
  padding: 13px;
  background: #3a30202d;
}
.verb-perfect summary {
  color: #ffdd99;
  font-weight: 750;
}
.phrase-section > summary {
  font-size: 16px;
  font-weight: 800;
  color: #e3c9ff;
  cursor: pointer;
  list-style: revert;
}
@media (max-width: 700px) {
  .chunk-grid {
    grid-template-columns: 1fr;
  }
  .chunk-panel {
    padding: 13px;
  }
  .lesson-chunks {
    grid-template-columns: 1fr 1fr;
  }
  .verb-sentence-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 420px) {
  .lesson-chunks {
    grid-template-columns: 1fr;
  }
  .chunk-piece {
    min-width: 95px;
  }
  .chunk-grid {
    grid-template-columns: 1fr;
  }
}

/* Shared keyboard and touch affordances across all nine pages. */
summary:focus-visible,
a:focus-visible,
.case-table:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 3px;
}
nav button,
.scene-list button,
.listen {
  min-height: 44px;
}
.listen {
  min-width: 44px;
}
.image-credit {
  font-size: 12px !important;
}
@media (max-width: 600px) {
  input,
  select {
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 200% zoom on a narrow handset leaves ~195 CSS px of layout space. */
@media (max-width: 320px) {
  .wrap {
    padding-left: 10px;
    padding-right: 10px;
  }
  .grid,
  .columns,
  .dialogues,
  .conj,
  .lesson-stages,
  .lesson-chunks,
  .verb-sentence-grid,
  .chunk-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .toolbar input,
  .toolbar select {
    min-width: 0;
    width: 100%;
  }
  .panel,
  .tile,
  .hero,
  .bubble,
  .chunk-panel {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .scene-navigator,
  .stage-travel {
    flex-wrap: wrap;
  }
}
#lessonAnswer {
  width: 100%;
  min-width: 0;
}
@media (max-width: 320px) {
  /* Fractional scrollbars at high zoom must not widen the document. */
  #adjectives,
  #stories {
    overflow-x: clip;
  }
}
@media (max-width: 320px) {
  .toolbar input[type="checkbox"] {
    width: auto;
    min-width: 16px;
    flex: none;
  }
  .section-title,
  .flip-face strong,
  .flip-face small {
    overflow-wrap: anywhere;
  }
}
.adjective-card .adj-opposite,
summary {
  min-height: 44px;
}
.adjective-card .adj-opposite {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Guided 7-Phase Course & SM-2 Flashcard Controls */
.guided-course-controls {
  justify-content: space-between;
  margin-top: 8px;
}
.guided-phase-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}
.guided-phase-tab {
  min-height: 44px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.guided-phase-tab:hover {
  border-color: #818cf8;
  color: var(--text);
}
.guided-phase-tab[aria-selected="true"] {
  background: linear-gradient(110deg, #4f46e5, #7e22ce);
  border-color: #a78bfa;
  color: #fff;
  box-shadow: 0 6px 18px #4f46e533;
}
.guided-unit-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.guided-unit-head h3 {
  margin: 6px 0 2px;
  font-size: clamp(20px, 2.8vw, 26px);
}
.guided-title-de {
  color: var(--amber);
  font-weight: 750;
  margin: 0;
}
.guided-contrast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
  margin: 14px 0;
}
.guided-contrast-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  min-width: 0;
}
.guided-contrast-card strong {
  display: block;
  color: var(--sky);
  font-size: 12px;
  margin-bottom: 4px;
}
.guided-contrast-card span {
  display: block;
  color: var(--text);
  overflow-wrap: anywhere;
}
.guided-model-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}
.guided-model-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #15151e;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 15px;
  min-width: 0;
}
.guided-model-copy {
  min-width: 0;
}
.guided-model-copy strong {
  display: block;
  color: #fde68a;
  font-size: 16px;
  overflow-wrap: anywhere;
}
.guided-model-copy small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}
.guided-words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 12px;
  margin: 14px 0;
}
.guided-word-card {
  background: #15151e;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px;
  min-width: 0;
}
.article-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: lowercase;
}
.article-der {
  background: #0284c733;
  border: 1px solid #38bdf877;
  color: #7dd3fc;
}
.article-die {
  background: #a21caf33;
  border: 1px solid #e879f977;
  color: #f5d0fe;
}
.article-das {
  background: #05966933;
  border: 1px solid #34d39977;
  color: #6ee7b7;
}
.article-neutral {
  background: #47556933;
  border: 1px solid #64748b66;
  color: #cbd5e1;
}
.guided-question-card {
  background: #15151e;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  min-width: 0;
}
.guided-question-prompt {
  font-weight: 700;
  font-size: 15px;
  margin: 6px 0 12px;
  overflow-wrap: anywhere;
}
.guided-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.guided-option {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  text-align: left;
  background: var(--high);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  white-space: normal;
  overflow-wrap: anywhere;
}
.guided-option:hover:not(:disabled) {
  border-color: #818cf8;
  background: #303048;
}
.guided-option.is-correct {
  border-color: var(--green);
  background: #064e3b88;
  color: #d1fae5;
}
.guided-option.is-wrong {
  border-color: #f87171;
  background: #7f1d1d66;
  color: #fee2e2;
}
.guided-typed-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}
.guided-typed-row input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 10px 12px;
  min-height: 44px;
  background: var(--bg);
}
.guided-umlauts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.guided-umlauts .btn {
  min-width: 40px;
  min-height: 40px;
  padding: 6px 10px;
}
.guided-feedback {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.guided-feedback.is-ok {
  color: var(--green);
  font-weight: 700;
}
.guided-feedback.is-err {
  color: #fca5a5;
}
.guided-story-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: #15151e;
  border: 1px solid var(--line);
  border-radius: 13px;
  margin-bottom: 9px;
}
.guided-story-line > div {
  min-width: 0;
  flex: 1;
}
.guided-story-de {
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
  overflow-wrap: anywhere;
}
.guided-story-en {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.guided-rubric {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: grid;
  gap: 8px;
}
.guided-rubric li label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  background: #15151e;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.guided-draft-box {
  width: 100%;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
  margin: 8px 0 12px;
}
.guided-phase-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.srs-panel {
  padding: 14px 18px;
  margin-bottom: 14px;
}
.srs-toolbar {
  margin: 0;
  gap: 12px;
}
.srs-cap-label,
.srs-mix-label,
.srs-draft-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}
.srs-toolbar select {
  min-height: 40px;
  padding: 6px 10px;
}
.srs-unit-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.srs-backlog-notice {
  margin-top: 10px;
  margin-bottom: 0;
}
.srs-rating-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-width: 720px;
  margin: 12px auto 18px;
}
.srs-rate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 8px 10px;
}
.srs-rate small {
  font-size: 11px;
  opacity: 0.85;
}
.srs-again {
  border-color: #f8717188;
  color: #fecaca;
}
.srs-hard {
  border-color: #fbbf2488;
  color: #fde68a;
}
.srs-easy {
  border-color: #38bdf888;
  color: #bae6fd;
}
@media (max-width: 520px) {
  .guided-phase-tab {
    flex: 1 1 calc(50% - 8px);
  }
  .srs-rating-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 320px) {
  .guided-phase-tab,
  .srs-rating-bar {
    grid-template-columns: 1fr;
    flex: 1 1 100%;
  }
}
/* Compact learning references keep patterns and their recordings together. */
.guided-reference-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 4px 16px;
  padding: 0;
  list-style: none;
}
.guided-reference-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid var(--line, #343044);
  font-size: 14px;
}
.guided-reference-entry strong { grid-column: 1; min-width: 0; overflow-wrap: anywhere; }
.guided-reference-entry span { grid-column: 1; min-width: 0; color: var(--muted, #b9b6c9); overflow-wrap: anywhere; }
.guided-reference-entry .listen { grid-column: 2; grid-row: 1 / span 2; padding: 4px 7px; }

/* Preserve separate audience components in authored comparison models. */
.guided-sample-text, .guided-sample-en { white-space: pre-line; }
.guided-context { margin: 1rem 0; }
.guided-context img { display: block; max-width: 100%; width: 56rem; height: auto; max-height: 24rem; object-fit: cover; border-radius: 1rem; }
.guided-oral { border: 1px solid currentColor; border-radius: 1rem; padding: 1rem; margin: 1rem 0; display: flow-root; }
.guided-sensei-pose { float: right; object-fit: contain; width: clamp(3.5rem, 17%, 6rem); height: auto; margin: 0 0 .5rem .8rem; }
.guided-oral-line { line-height: 1.6; }
