:root {
  color-scheme: light;
  --ink: #3e2e35;
  --muted: #7b6970;
  --paper: #fffdf8;
  --cream: #fff8e9;
  --peach: #fce6d0;
  --rose: #dc6e76;
  --rose-dark: #a33e56;
  --gold: #f6ca4f;
  --gold-soft: #fff0a5;
  --border: #eadbd4;
  --shadow: 0 16px 40px rgba(99, 61, 58, .13);
  font-family: "Noto Naskh Arabic", Tahoma, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 13%, rgba(255, 211, 174, .54), transparent 30%),
    radial-gradient(circle at 94% 82%, rgba(246, 208, 129, .34), transparent 31%),
    linear-gradient(160deg, #fffdf8, #fff3e4);
}

button { font: inherit; }
button:focus-visible, .scene-card:focus-visible {
  outline: 4px solid #7552b8;
  outline-offset: 3px;
}

.app-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  min-height: 62px;
  padding: 10px max(28px, calc((100vw - 1440px) / 2));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr);
  align-items: center;
  border-bottom: 1px solid rgba(123, 84, 72, .13);
  background: rgba(255, 253, 248, .86);
  backdrop-filter: blur(16px);
}
.current-title {
  grid-column: 2;
  max-width: min(52vw, 720px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 700 22px/1.35 "Noto Naskh Arabic", Tahoma, serif;
  text-align: center;
  cursor: pointer;
}
.current-title span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.mode-menu { grid-column: 1; grid-row: 1; justify-self: start; display: flex; align-items: center; gap: 18px; }
.mode-select-wrap { position: relative; }
.mode-menu select {
  appearance: none;
  min-width: 178px;
  min-height: 44px;
  padding: 4px 16px 4px 36px;
  border: 1px solid #e9c9bf;
  border-radius: 14px;
  background: #fff;
  color: var(--rose-dark);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}
.mode-select-wrap::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  color: var(--rose-dark);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.mode-menu select:focus-visible { outline: 4px solid #7552b8; outline-offset: 3px; }
.story-list-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 9px;
  border: 1px solid #e9c9bf;
  border-radius: 14px;
  background: #fff;
  color: var(--rose-dark);
  cursor: pointer;
}
.story-list-button:hover { background: #fff0e9; }
.story-list-button svg { display: block; width: 24px; height: 24px; }
.app-content {
  width: min(1600px, calc(100% - 24px));
  flex: 1;
  margin: 0 auto;
  padding: 10px 0 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.eyebrow { color: var(--rose-dark); font: 800 14px/1.5 Nunito, sans-serif; letter-spacing: .16em; text-transform: uppercase; }
.catalog {
  width: min(1120px, 100%);
  flex: 1;
  min-height: 0;
  margin: 0 auto;
  padding: 12px 8px 24px;
  display: grid;
  align-content: safe center;
  gap: 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.catalog-hero {
  padding: 32px 40px;
  border: 1px solid rgba(189, 127, 108, .18);
  border-radius: 32px;
  background: linear-gradient(120deg, #fff9ec, #ffe9dc 66%, #fbe0de);
  box-shadow: var(--shadow);
}
.catalog-hero h1 { margin: 4px 0 0; font-size: clamp(36px, 4.7vw, 64px); line-height: 1.25; }
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); grid-auto-rows: 356px; gap: 24px; }
.story-card {
  overflow: hidden;
  display: grid;
  grid-template-rows: 236px minmax(0, 1fr);
  min-width: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: #fff;
  color: var(--ink);
  text-align: right;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
.story-card:hover { transform: translateY(-5px); box-shadow: 0 23px 48px rgba(99, 61, 58, .18); }
.story-card :is(img, canvas) { width: 100%; height: 236px; object-fit: cover; background: var(--peach); }
.story-card-copy { min-height: 0; display: grid; align-content: center; gap: 4px; padding: 12px 23px; }
.story-card-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 27px; font-weight: 700; }
.story-card-meta { color: var(--muted); font-size: 17px; }
.message-card {
  width: min(650px, 100%);
  margin: auto;
  padding: 36px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
}
.message-card h1, .message-card h2 { margin: 0 0 12px; font-size: 32px; }
.message-card p { margin: 0; font-size: 21px; color: var(--muted); }
.message-card .button { margin-top: 18px; }

.view-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 40px;
  margin-bottom: 8px;
}
.view-heading h1 { margin: 0; font-size: clamp(24px, 2.4vw, 34px); line-height: 1.25; }
.view-heading p { margin: 0; color: var(--muted); font-size: 17px; }
.reader-view, .word-view, .quiz-view, .ordering-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.quiz-view { position: relative; }
.reader-viewport { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: stretch; perspective: 1200px; }
.reader-stage {
  width: min(1600px, 100%);
  flex: 0 1 1600px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 27px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backface-visibility: hidden;
}
.reader-panels { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--panel-count), minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) auto; gap: 10px; padding: 16px 10px 0; overflow: hidden; }
.reader-panel { grid-row: 1 / span 2; min-width: 0; min-height: 0; display: grid; grid-template-rows: subgrid; overflow: hidden; background: #fff; }
.reader-panel .art-frame { grid-row: 1; min-height: 0; background: #fff; }
.reader-panel .art-frame :is(img, canvas) { width: 100%; height: 100%; object-fit: contain; }
.reader-panel .story-text { padding-inline: 6px; }
.art-frame { position: relative; flex: 1; min-height: 230px; display: flex; align-items: center; justify-content: center; margin: 0; overflow: hidden; background: #fff; }
.reader-stage:not(.has-panels) > .art-frame { margin-top: 16px; }
.art-frame :is(img, canvas) { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; object-position: center center; }
.image-error {
  display: grid;
  place-items: center;
  width: 100%; height: 100%;
  padding: 20px;
  color: var(--rose-dark);
  text-align: center;
  font-size: 20px;
}
.story-text {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 8px 24px 8px;
  background: #fff;
  text-align: center;
}
.story-text p, .exercise-text p {
  margin: 0;
  white-space: pre-line;
  font-size: clamp(31px, 3.05vw, 45px);
  font-weight: 700;
  line-height: 1.8;
}
.story-text p { line-height: 1.4; }
.story-text .missing-text, .exercise-text .missing-text { color: #9a8585; font-size: 24px; }
.turn-mask {
  position: fixed;
  z-index: 80;
  overflow: hidden;
  border-radius: 27px;
  pointer-events: none;
}
.turn-sheet {
  position: absolute;
  z-index: 1;
  margin: 0;
  pointer-events: none;
  will-change: clip-path;
}
.turn-fold {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  clip-path: polygon(0 0, 78% 0, 100% 100%, 22% 100%);
  background: linear-gradient(90deg, rgba(225, 205, 188, .18), #f6eee2 25%, #fffefb 47%, #d7c4b4 72%, rgba(101, 69, 58, .14));
  will-change: transform;
}
.turn-fold.turn-previous { clip-path: polygon(22% 0, 100% 0, 78% 100%, 0 100%); background: linear-gradient(90deg, rgba(101, 69, 58, .14), #d7c4b4 28%, #fffefb 53%, #f6eee2 75%, rgba(225, 205, 188, .18)); }
.turn-reveal-shadow { position: absolute; z-index: 0; pointer-events: none; filter: blur(15px); }

.word { display: inline; position: relative; padding: 0 .06em; margin: 0; border: 0; border-radius: .2em; background: transparent; color: inherit; cursor: pointer; line-height: inherit; }
.reader-stage .word { padding-inline: 0; }
.word-label { display: inline-block; position: relative; transform-origin: center bottom; transition: transform .17s, background .17s, box-shadow .17s; border-radius: .18em; }
.word:focus-visible .word-label, .word.is-peek .word-label {
  z-index: 1;
  transform: scale(1.12);
  background: var(--gold-soft);
  box-shadow: 0 0 0 .08em var(--gold-soft), 0 .12em .35em rgba(211, 164, 51, .3);
}
.word.is-marked .word-label {
  background: #ffe270;
  box-shadow: 0 0 0 .08em #ffe270, inset 0 -.1em 0 #efa944;
}
.word.is-marked:focus-visible .word-label { transform: scale(1.12); }
.word:focus-visible { outline-offset: .12em; }
@media (hover: hover) {
  .word:hover .word-label {
    z-index: 1;
    transform: scale(1.12);
    background: var(--gold-soft);
    box-shadow: 0 0 0 .08em var(--gold-soft), 0 .12em .35em rgba(211, 164, 51, .3);
  }
  .word.is-marked:hover .word-label { background: #ffe270; box-shadow: 0 0 0 .08em #ffe270, inset 0 -.1em 0 #efa944; transform: scale(1.12); }
}

.page-navigation {
  position: relative;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 4px 8px;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 253, 248, .96);
  box-shadow: 0 8px 22px rgba(99, 61, 58, .1);
}
.page-navigation > button { height: 46px; border: 0; cursor: pointer; }
.page-arrow {
  width: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fae9dc;
  color: var(--rose-dark);
}
.page-arrow::before { content: ""; display: block; width: 12px; height: 12px; border-top: 3px solid currentColor; border-right: 3px solid currentColor; }
.page-arrow.previous::before { transform: rotate(45deg); }
.page-arrow.next::before { transform: rotate(-135deg); }
.page-arrow:hover:not(:disabled) { background: #fbd4c7; }
.page-arrow:disabled { opacity: .32; cursor: default; }
.page-count {
  min-width: 106px;
  padding: 0 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 800 18px/1 Nunito, "Noto Naskh Arabic", sans-serif;
}
.page-count:hover, .page-count[aria-expanded="true"] { background: #fff0dc; }
.page-picker {
  position: absolute;
  z-index: 30;
  bottom: calc(100% + 10px);
  right: 50%;
  transform: translateX(50%);
  width: min(740px, calc(100vw - 42px));
  max-height: 185px;
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 19px;
  background: #fffdf9;
  box-shadow: var(--shadow);
}
.picker-item {
  flex: 0 0 108px;
  min-height: 126px;
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #f8eee7;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
}
.picker-item[aria-current="page"] { border-color: var(--rose-dark); }
.picker-item :is(img, canvas) { display: block; width: 100%; height: 83px; object-fit: cover; }
.picker-item span { display: block; padding: 3px 4px; font-size: 16px; line-height: 1.4; }
.picker-item.is-done span { color: #237b61; }

.exercise-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
@media (min-width: 901px) {
  .exercise-stage.wide-art {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .exercise-stage.wide-art .exercise-text {
    padding-block: 4px 12px;
  }
}
.exercise-art {
  position: relative;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border-radius: 19px;
  background: #fff;
}
.exercise-art :is(img, canvas) { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; }
.picture-group { display: grid; grid-template-rows: repeat(var(--panel-count), minmax(0, 1fr)); gap: 8px; padding: 4px; }
.picture-panel { position: relative; min-height: 0; display: flex; justify-content: center; margin: 0; overflow: hidden; background: #fff; }
.picture-panel :is(img, canvas) {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.exercise-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
  min-width: 0;
  padding: 20px 30px;
  border-radius: 19px;
  background: #fff;
  text-align: center;
}
.exercise-text p { font-size: clamp(37px, 3.6vw, 52px); }
.exercise-text.multi-text { justify-content: safe center; gap: clamp(44px, 7vh, 72px); overflow-y: auto; }
.exercise-text .claim { font-size: clamp(32px, 3.6vw, 54px); }
.hint { margin: 0; color: var(--muted); font-size: 18px; }
.clear-button {
  min-width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 13px;
  border: 1px solid #e7c6bd;
  border-radius: 999px;
  background: #fff;
  color: var(--rose-dark);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.clear-button:hover:not(:disabled) { background: #fff0e9; }
.clear-button:disabled { opacity: .4; cursor: default; }
.word-clear { position: absolute; z-index: 2; top: 16px; left: 16px; }
.quiz-reset { position: absolute; z-index: 2; top: 18px; left: 18px; width: 48px; padding: 0; }
.quiz-reset svg { width: 24px; height: 24px; }
.button {
  min-height: 52px;
  padding: 8px 23px;
  border-radius: 15px;
  border: 2px solid transparent;
  font-size: 21px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.button:hover:not(:disabled) { transform: translateY(-2px); }
.button:disabled { opacity: .45; cursor: default; }
.button-primary { background: var(--rose-dark); color: #fff; box-shadow: 0 7px 16px rgba(163, 62, 86, .18); }
.button-secondary { background: #fff; color: var(--rose-dark); border-color: #e9c9bf; }
.button-gold { background: var(--gold); color: #5e3b27; }

.ordering-toolbar { display: flex; gap: 10px; align-items: center; justify-content: flex-start; }
.ordering-toolbar .button { min-height: 44px; padding: 6px 16px; font-size: 18px; }
.ordering-toolbar .shuffle-button { width: 44px; min-width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border-radius: 14px; }
.shuffle-button svg { width: 24px; height: 24px; }
.ordering-board {
  width: min(1520px, 100%);
  flex: 1;
  min-height: 0;
  margin: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: center;
  gap: 14px;
}
.scene-card, .drop-slot {
  min-width: 0;
  min-height: clamp(350px, 61vh, 510px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 23px;
}
.scene-card {
  position: relative;
  border: 2px solid #e8d7cf;
  background: #fffdf9;
  box-shadow: 0 12px 25px rgba(95, 60, 51, .12);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: transform .16s, box-shadow .16s;
}
.scene-card:hover { transform: translateY(-4px); box-shadow: 0 18px 31px rgba(95, 60, 51, .18); }
.scene-card:active { cursor: grabbing; }
.scene-card > :is(img, canvas) { width: 100%; aspect-ratio: 1.15; object-fit: cover; background: var(--peach); }
.scene-card-pictures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; min-height: 0; aspect-ratio: 1.15; overflow: hidden; }
.scene-card-pictures :is(img, canvas) { width: 100%; height: 100%; min-height: 0; object-fit: cover; background: var(--peach); }
.scene-card-copy { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 11px 16px; text-align: center; }
.scene-card-copy p { margin: 0; white-space: pre-line; font-size: clamp(19px, 1.9vw, 27px); font-weight: 700; line-height: 1.5; }
.scene-card-copy .missing-text { color: #a18d8a; font-size: 17px; }
.scene-card-badge { position: absolute; margin: 9px; padding: 2px 9px; border-radius: 9px; background: rgba(255,255,255,.94); color: var(--rose-dark); font: 800 17px Nunito, sans-serif; }
.drop-slot {
  place-items: center;
  justify-content: center;
  border: 4px dashed #e5a62d;
  background: #fff2b5;
  color: #9b6224;
  font-size: 23px;
  font-weight: 700;
  box-shadow: inset 0 0 0 8px rgba(255,255,255,.55);
  animation: slot-pulse .8s ease-in-out infinite alternate;
}
@keyframes slot-pulse { to { background: #ffe58b; border-color: #ca832b; } }
.drag-ghost { position: fixed; z-index: 100; pointer-events: none; margin: 0; opacity: .94; transform: rotate(-3deg) scale(1.04); box-shadow: 0 25px 50px rgba(64, 41, 38, .28); }
.ordering-board.is-shuffling .scene-card { visibility: hidden; }
.shuffle-overlay { position: fixed; inset: 0; z-index: 90; overflow: hidden; pointer-events: none; }
.shuffle-card-back {
  position: absolute;
  display: grid;
  place-items: center;
  border: 3px solid #e2ae8f;
  border-radius: 23px;
  background: linear-gradient(145deg, #ffe9cc, #edb9a5 65%, #d99691);
  box-shadow: 0 20px 36px rgba(95, 60, 51, .24);
  transform-origin: center;
}
.shuffle-card-back::before { content: ""; position: absolute; inset: 11px; border: 2px solid rgba(255,255,255,.75); border-radius: 15px; }
.shuffle-card-glyph { color: rgba(255,255,255,.95); font-size: 65px; line-height: 1; text-shadow: 0 3px 8px rgba(140, 85, 72, .2); }
.feedback {
  align-self: center;
  min-height: 39px;
  margin: 8px 0 0;
  padding: 2px 16px;
  border-radius: 999px;
  font-size: 20px;
  font-weight: 700;
}
.feedback.good { color: #18745a; background: #e5f7ec; }
.feedback.try { color: #995543; background: #fff1df; }

.answer-buttons { display: flex; gap: 14px; justify-content: center; }
.answer-button { min-width: 135px; min-height: 65px; font-size: 30px; }
.answer-true { background: #198754; color: #fff; box-shadow: 0 7px 16px rgba(25, 135, 84, .2); }
.answer-false { background: #c43d4a; color: #fff; box-shadow: 0 7px 16px rgba(196, 61, 74, .2); }
.answer-button:disabled { opacity: .7; }
.answer-true[aria-pressed="true"] { outline: 4px solid #126b43; outline-offset: 3px; }
.answer-false[aria-pressed="true"] { outline: 4px solid #a52835; outline-offset: 3px; }
.quiz-result { display: grid; gap: 8px; justify-items: center; }
.quiz-finish { display: grid; place-items: center; flex: 1; text-align: center; }

.toast {
  position: fixed;
  z-index: 150;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 9px 20px;
  border-radius: 14px;
  background: #4b3440;
  color: #fff;
  font-size: 19px;
  box-shadow: var(--shadow);
  text-align: center;
}
.celebration-layer { position: fixed; z-index: 200; inset: 0; pointer-events: none; overflow: hidden; }
.confetti { position: absolute; top: -20px; width: 10px; height: 17px; border-radius: 3px; animation: confetti-fall 1.6s cubic-bezier(.2,.6,.4,1) forwards; }
@keyframes confetti-fall { to { transform: translate3d(var(--drift), 110vh, 0) rotate(var(--spin)); opacity: 0; } }
.celebration-label { position: absolute; top: 23%; left: 50%; transform: translateX(-50%); padding: 12px 32px; border-radius: 30px; background: #fffdf7; color: #218060; font-size: 39px; font-weight: 700; box-shadow: var(--shadow); animation: pop-in .4s ease-out both; }
@keyframes pop-in { from { transform: translateX(-50%) scale(.55); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

dialog { border: 1px solid var(--border); border-radius: 28px; box-shadow: 0 25px 80px rgba(42, 28, 36, .28); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: rgba(37, 26, 33, .45); backdrop-filter: blur(4px); }
.word-dialog { width: min(650px, calc(100vw - 36px)); min-height: 290px; padding: 36px; text-align: center; }
.dialog-close { position: absolute; top: 8px; left: 11px; width: 58px; height: 58px; border: 0; border-radius: 50%; background: #fae9dc; color: var(--rose-dark); font: 700 41px/1 Nunito, sans-serif; cursor: pointer; }
.dialog-hint { margin: 21px 0 14px; color: var(--muted); font-size: 22px; }
.focused-word { margin: 0; padding: 7px 18px; display: inline-block; border-radius: 18px; background: #ffe270; font-size: clamp(55px, 7vw, 95px); font-weight: 700; line-height: 1.8; }

.phone-gate { display: none; position: fixed; z-index: 1000; inset: 0; padding: 20px; place-items: center; background: #fff8e9; }
.phone-gate-card { max-width: 380px; padding: 30px; border-radius: 25px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.phone-gate-card > span { font-size: 54px; }
.phone-gate-card h1 { font-size: 27px; }
.phone-gate-card p { font-size: 21px; }

@media (max-width: 1040px) {
  .topbar { padding-inline: 24px; }
  .app-content { width: calc(100% - 30px); }
  .exercise-stage { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ordering-board { gap: 10px; }
  .scene-card, .drop-slot { min-height: clamp(260px, 54vh, 400px); }
}
@media (max-width: 900px) and (orientation: portrait) {
  .exercise-stage { grid-template-columns: 1fr; grid-template-rows: minmax(210px, .8fr) minmax(0, 1.2fr); }
  .exercise-text { padding: 16px 22px; }
  .exercise-text p { font-size: clamp(36px, 5vw, 53px); }
  .ordering-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scene-card, .drop-slot { min-height: 260px; }
  .scene-card > :is(img, canvas), .scene-card-pictures { aspect-ratio: 1.9; }
}
@media (max-width: 780px) {
  .current-title { max-width: 48vw; font-size: 19px; }
  .mode-menu select { min-width: 158px; font-size: 16px; }
  .view-heading { align-items: flex-start; }
  .view-heading p { display: none; }
}
@media (max-width: 700px), (max-height: 520px) and (pointer: coarse) {
  .app-shell { display: none; }
  .phone-gate { display: grid; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
