:root {
  color-scheme: light;
  --bg: #f5fff8;
  --ink: #13201a;
  --muted: #64736b;
  --panel: #ffffff;
  --line: #d8eadf;
  --accent: #2ecb70;
  --accent-dark: #17934b;
  --accent-soft: #ddfae9;
  --blue: #3aa6ff;
  --blue-soft: #e3f3ff;
  --gold: #ffc83d;
  --gold-soft: #fff4c9;
  --danger: #ff5f6d;
  --success: #20b85a;
  --shadow: rgba(26, 42, 33, 0.1);
  font-family: "Nunito Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  transition: background-color 0.35s ease;
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  background: center top / cover no-repeat url("./assets/garden-path-bg.png?v=20260620-43");
  content: "";
  filter: saturate(0.58) brightness(1.12);
  opacity: 0.52;
  pointer-events: none;
}

body.splash-active {
  overflow: hidden;
}

.welcome-splash {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  opacity: 1;
  transition: opacity 650ms ease, visibility 650ms ease;
}

.welcome-splash::before {
  position: absolute;
  z-index: -2;
  inset: -3%;
  background: center / cover no-repeat url("./assets/garden-path-bg.png?v=20260620-43");
  content: "";
  animation: garden-breathe 9s ease-in-out infinite alternate;
}

.welcome-splash::after {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 45%, rgba(12, 68, 38, 0.24) 100%);
  content: "";
}

.welcome-splash.is-leaving {
  visibility: hidden;
  opacity: 0;
}

.splash-brand {
  position: absolute;
  top: max(34px, env(safe-area-inset-top));
  left: 50%;
  color: #145c37;
  font-size: clamp(1.7rem, 5vw, 3rem);
  text-shadow: 0 2px 14px rgba(255, 255, 255, 0.8);
  transform: translateX(-50%);
  white-space: nowrap;
}

.enter-garden-button {
  position: absolute;
  z-index: 4;
  bottom: max(36px, calc(22px + env(safe-area-inset-bottom)));
  min-width: 150px;
  min-height: 52px;
  border: 2px solid #fff;
  border-radius: 8px;
  padding: 0 26px;
  background: #17934b;
  color: #fff;
  box-shadow: 0 6px 0 #0f6d36, 0 12px 28px rgba(9, 64, 31, 0.25);
  font-weight: 950;
  text-transform: uppercase;
  cursor: pointer;
}

.splash-butterfly {
  position: absolute;
  z-index: 2;
  font-size: clamp(1.4rem, 3vw, 2.3rem);
  filter: drop-shadow(0 4px 5px rgba(19, 65, 39, 0.22));
  animation: butterfly-flight 7s ease-in-out infinite;
  will-change: transform;
}

.butterfly-one { top: 23%; left: 12%; animation-delay: -1.2s; }
.butterfly-two { top: 35%; left: 72%; animation-delay: -4.8s; animation-duration: 8.5s; }
.butterfly-three { top: 57%; left: 24%; animation-delay: -3.1s; animation-duration: 9.2s; }
.butterfly-four { top: 18%; left: 54%; animation-delay: -6.4s; animation-duration: 10s; }

@keyframes garden-breathe {
  from { transform: scale(1); }
  to { transform: scale(1.045); }
}

@keyframes butterfly-flight {
  0%, 100% { transform: translate3d(-18px, 8px, 0) rotate(-8deg) scale(0.92); }
  25% { transform: translate3d(34px, -22px, 0) rotate(8deg) scale(1.06); }
  52% { transform: translate3d(76px, 10px, 0) rotate(-4deg) scale(0.96); }
  76% { transform: translate3d(22px, 28px, 0) rotate(12deg) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .welcome-splash::before,
  .splash-butterfly {
    animation: none;
  }
}

body[data-play-level="1"] {
  --bg: #f5fff8;
  --accent: #2ecb70;
  --accent-dark: #17934b;
  --accent-soft: #ddfae9;
}

body[data-play-level="2"] {
  --bg: #f6fbff;
  --accent: #3aa6ff;
  --accent-dark: #1479d4;
  --accent-soft: #e3f3ff;
  --gold: #ffc83d;
}

body[data-play-level="3"] {
  --bg: #fff9ef;
  --accent: #ff8f3f;
  --accent-dark: #d96613;
  --accent-soft: #fff0df;
  --gold: #ffc83d;
}

body[data-play-level="training"] {
  --bg: #f5fff8;
  --accent: #2ecb70;
  --accent-dark: #17934b;
  --accent-soft: #ddfae9;
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.app-workspace {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.workspace-content {
  min-width: 0;
}

.main-rail {
  position: sticky;
  top: 18px;
  display: flex;
  min-height: 620px;
  flex-direction: column;
  gap: 10px;
}

.rail-button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 64px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  color: var(--muted);
  text-align: left;
  box-shadow: 0 4px 0 #dceee3;
}

.rail-button > span {
  display: grid;
  place-items: center;
  width: 38px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #eef7f1;
  font-size: 1.1rem;
}

.rail-icon::before {
  width: 22px;
  height: 22px;
  background: currentColor;
  content: "";
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}

.rail-icon-games::before {
  display: none;
}

.rail-icon-games {
  grid-template-columns: repeat(2, 8px);
  gap: 3px;
  align-content: center;
  justify-content: center;
}

.rail-icon-games i {
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 2px;
  background: currentColor;
}

.rail-icon-brain::before {
  -webkit-mask-image: url("./assets/nav-brain.svg");
  mask-image: url("./assets/nav-brain.svg");
}

.rail-icon-trophy::before {
  -webkit-mask-image: url("./assets/nav-trophy.svg");
  mask-image: url("./assets/nav-trophy.svg");
}

.rail-icon-stats::before {
  -webkit-mask-image: url("./assets/nav-stats.svg");
  mask-image: url("./assets/nav-stats.svg");
}

.rail-button.is-active {
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  box-shadow: 0 4px 0 #dceee3;
}

.rail-button[data-main-action="challenge"] strong {
  font-size: 0.86rem;
}

.rail-button.is-active .rail-icon-brain {
  color: var(--accent-dark);
}

.rail-button.is-active .rail-icon-trophy {
  color: #d6a700;
}

.rail-button.is-active .rail-icon-stats {
  color: #2563eb;
}

.rail-button.is-active .rail-icon-games i:nth-child(1) {
  border-color: #2563eb;
  background: #2563eb;
}

.rail-button.is-active .rail-icon-games i:nth-child(2) {
  border-color: #e5484d;
  background: #e5484d;
}

.rail-button.is-active .rail-icon-games i:nth-child(3) {
  border-color: #f2b705;
  background: #f2b705;
}

.rail-button.is-active .rail-icon-games i:nth-child(4) {
  border-color: #8b9490;
  background: transparent;
}

.rail-more {
  margin-top: auto;
}

.selector-shell {
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(14px, 2.5vw, 26px);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(3px);
  box-shadow: 0 12px 34px rgba(26, 42, 33, 0.08);
}

.selector-stage {
  position: relative;
  display: grid;
  align-content: center;
  gap: 18px;
  min-height: 420px;
}

.game-launch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.game-launch-button,
.challenge-launch-button,
.go-button {
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 950;
  box-shadow: 0 5px 0 #dceee3;
}

.game-launch-button {
  min-height: 118px;
  padding: 16px;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
}

.game-launch-button:hover,
.game-launch-button.is-selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: #1479d4;
  box-shadow: 0 6px 0 #1479d4;
  transform: translateY(-1px);
}

.challenge-launch-button {
  min-height: 92px;
  border-color: var(--gold);
  background: var(--gold-soft);
  color: #735400;
  font-size: 1.35rem;
  box-shadow: 0 6px 0 #d6a700;
}

.range-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(140px, 0.6fr);
  gap: 18px;
  width: min(100%, 760px);
  margin: 0 auto;
}

.range-grid label {
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 900;
}

.range-grid select {
  height: 54px;
  border: 2px solid var(--line);
  font-size: 16px;
  font-weight: 850;
}

.surah-search-input {
  width: 100%;
  height: 54px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 0 48px 0 14px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 850;
  outline: none;
}

.surah-combobox {
  position: relative;
  min-width: 0;
}

.surah-combobox-toggle {
  position: absolute;
  z-index: 2;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 42px;
  min-height: 44px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 6px 6px 0;
  padding: 0;
  background: #fff;
  color: var(--muted);
  font-size: 1.35rem;
  cursor: pointer;
}

.surah-combobox-options {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: min(320px, 48vh);
  overflow-y: auto;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(20, 45, 30, 0.18);
}

.surah-combobox-option {
  display: block;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.surah-combobox-option:hover,
.surah-combobox-option.is-active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.surah-combobox-empty {
  padding: 14px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.surah-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.surah-search-hint {
  min-height: 1.2em;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 850;
}


.journey-badge-summary .badge-image {
  width: min(190px, 48vw);
}

.memory-badge-visual {
  display: grid;
  place-items: center;
  width: min(150px, 42vw);
  aspect-ratio: 1;
  border: 6px solid #7be0a4;
  border-radius: 50%;
  background: #e7faef;
  box-shadow: 0 10px 0 #b8ebcc, 0 18px 30px rgba(23, 147, 75, 0.2);
  animation: reward-pop 0.42s ease-out both;
}

.memory-badge-visual > span {
  font-size: clamp(4.5rem, 20vw, 7.5rem);
  line-height: 1;
  filter: drop-shadow(0 8px 10px rgba(23, 147, 75, 0.2));
}

.memory-badge-visual.is-large {
  width: min(190px, 52vw);
}

.reward-claim-hint {
  margin: 2px 0 4px;
  color: var(--accent-dark);
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
}

.reward-claim-button {
  min-width: min(100%, 290px);
}

.selector-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 50%;
  background: #eef7f1;
  color: var(--accent-dark);
  font-size: 1.35rem;
}

.go-button {
  width: min(100%, 320px);
  min-height: 58px;
  margin: 12px auto 0;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 6px 0 var(--accent-dark);
}

.stats-view {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 3vw, 30px);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(5px);
  box-shadow: 0 18px 48px var(--shadow);
}

.topbar,
.status-panel,
.controls,
.game-card {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.game-card.is-split-game {
  gap: clamp(20px, 4vw, 34px);
  overflow: visible;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
}

.question-panel,
.answer-options-panel {
  display: grid;
  gap: 14px;
  padding: clamp(12px, 2vw, 18px);
  border: 1px solid rgba(216, 234, 223, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
  box-shadow: 0 7px 22px rgba(26, 42, 33, 0.09);
}

.answer-options-panel {
  background: rgba(255, 255, 255, 0.84);
}

.topbar {
  margin-bottom: 14px;
}

.brand-lockup {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1.8rem;
  font-weight: 950;
  box-shadow: 0 6px 0 var(--accent-dark);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.panel,
.game-card,
.controls {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 40px var(--shadow);
}

.panel {
  padding: 18px;
}

.status-panel {
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  color: #fff;
}

.status-panel::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -48px;
  width: 190px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.status-copy {
  position: relative;
  z-index: 1;
}

.status-copy h2 {
  margin: 8px 0 4px;
  color: #fff;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1;
}

.daily-pill {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

#statusText,
.source-note p,
.hint,
.meta {
  color: var(--muted);
}

.status-panel #statusText {
  max-width: 720px;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 800;
}

.score-pill {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 98px;
  min-height: 86px;
  border-radius: 8px;
  background: #fff;
  color: var(--accent-dark);
  font-weight: 950;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.16);
}

.score-pill span {
  font-size: 2.35rem;
  line-height: 1;
}

.score-pill small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 950;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stats-strip div {
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 0 #dceee3;
}

.stats-strip span {
  color: var(--accent-dark);
  font-size: 1.65rem;
  font-weight: 950;
  line-height: 1;
}

.stats-strip small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 950;
  text-transform: uppercase;
}

.level-path {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr) 44px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.path-node {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 92px;
  border: 2px solid #dceee3;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
  box-shadow: 0 4px 0 #dceee3;
}

.path-node strong {
  display: grid;
  place-items: center;
  width: 40px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #eef7f1;
  color: var(--muted);
  font-size: 1.25rem;
  font-weight: 950;
}

.path-node span {
  font-size: 0.8rem;
  font-weight: 950;
}

.path-line {
  height: 8px;
  border-radius: 999px;
  background: #dceee3;
}

body[data-play-level="1"] .path-node.level-1,
body[data-play-level="2"] .path-node.level-2,
body[data-play-level="3"] .path-node.level-3 {
  border-color: var(--accent);
  color: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 7px 0 var(--accent-dark);
}

body[data-play-level="1"] .path-node.level-1 strong,
body[data-play-level="2"] .path-node.level-2 strong,
body[data-play-level="3"] .path-node.level-3 strong {
  background: var(--accent);
  color: #fff;
}

.stats-strip .is-hot-streak {
  border-color: var(--gold);
  background: #fff7df;
  box-shadow: 0 0 0 2px rgba(177, 132, 45, 0.14);
}

.app-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.tab-button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  background: #fff;
  color: var(--ink);
}

.tab-button.is-active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.selection-intro {
  margin-bottom: 14px;
  border-left: 6px solid var(--accent);
}

.selection-intro .daily-pill {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.selection-intro h2 {
  margin: 12px 0 4px;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
}

.selection-intro p {
  margin-bottom: 0;
}

.activity-view {
  display: grid;
  gap: 14px;
}

.activity-header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px;
}

.activity-header h2 {
  margin: 2px 0 0;
  font-size: clamp(1.45rem, 4vw, 2.35rem);
}

.question-progress {
  display: grid;
  grid-template-columns: auto minmax(90px, 180px);
  gap: 9px;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 3px 0 #dceee3;
}

.question-progress strong {
  color: var(--accent-dark);
  font-size: 0.95rem;
  white-space: nowrap;
}

.question-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eee8;
}

.question-progress-track span {
  display: block;
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}

.activity-actions,
.memorization-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.memorization-reader {
  display: grid;
  gap: 24px;
}

.memorization-toolbar {
  position: sticky;
  z-index: 10;
  top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px var(--shadow);
}

.icon-command {
  width: 48px;
  min-width: 48px;
  padding: 0;
}

.memorization-page {
  display: grid;
  gap: 10px;
}

.memorization-page h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
}

.memorization-passage {
  border-top: 1px solid var(--line);
}

.memorization-ayah {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.memorization-ayah p {
  margin: 0;
  direction: rtl;
  font-family: "Traditional Arabic", "Amiri", "Scheherazade New", serif;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1.8;
  text-align: right;
}

.memorization-session {
  display: grid;
  gap: 18px;
  width: 100%;
}

.memorization-progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
}

.memorization-progress {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #dceee3;
}

.memorization-progress > div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transition: width 0.3s ease;
}

.memorization-step {
  display: grid;
  place-items: center;
  gap: 18px;
  min-height: 360px;
  text-align: center;
}

.memorization-instruction {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.05rem, 3vw, 1.35rem);
  font-weight: 900;
}

.memorization-segment {
  width: 100%;
  direction: rtl;
  padding: 20px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  font-family: "Traditional Arabic", "Amiri", "Scheherazade New", serif;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 1.8;
}

.memorization-segment.is-complete {
  border-color: var(--success);
  background: #e5f5ec;
}

.segment-audio-note {
  color: var(--muted);
  font-weight: 800;
}

.memorization-counter {
  display: grid;
  place-items: center;
  width: 72px;
  aspect-ratio: 1;
  border: 5px solid var(--accent);
  border-radius: 50%;
  color: var(--accent-dark);
  font-size: 2rem;
  font-weight: 950;
}

.memorization-play {
  min-width: 180px;
}

.skip-memorization-button {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.skip-memorization-button:hover {
  color: var(--accent-dark);
}

.memory-card {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 760px);
  min-height: 280px;
  overflow: hidden;
  border: 3px solid var(--accent);
  border-radius: 8px;
  padding: 24px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: 0 8px 0 var(--accent-dark);
}

.memory-card-front {
  font-size: clamp(1.25rem, 4vw, 2rem);
  font-weight: 950;
}

.memory-card-back {
  display: none;
  direction: rtl;
  font-family: "Traditional Arabic", "Amiri", "Scheherazade New", serif;
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1.8;
}

.memory-card.is-revealed {
  border-color: var(--gold);
  background: #fff9e6;
  color: var(--ink);
  box-shadow: 0 8px 0 #d6a700;
}

.memory-card.is-revealed .memory-card-front {
  display: none;
}

.memory-card.is-revealed .memory-card-back {
  display: block;
}

.memorization-decisions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.memorization-decisions > * {
  min-width: 180px;
}

.memorization-resume-choice {
  display: grid;
  place-items: center;
  gap: 18px;
  min-height: 360px;
  padding: 24px;
  text-align: center;
}

.memorization-resume-choice h2 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  line-height: 1.15;
}

.profile-stats-panel {
  display: grid;
  gap: 8px;
}

.stats-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 24px;
}

.stat-overview-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.stat-overview-item > div {
  display: grid;
  gap: 2px;
}

.stat-overview-item strong {
  color: var(--ink);
  font-size: 1.35rem;
}

.stat-overview-item span:last-child {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.stat-overview-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--accent-dark);
}

.stat-overview-icon::before {
  width: 30px;
  height: 30px;
  background: currentColor;
  content: "";
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}

.stat-icon-streak { color: #ef7c2f; }
.stat-icon-streak::before { -webkit-mask-image: url("./assets/stat-streak.svg"); mask-image: url("./assets/stat-streak.svg"); }
.stat-icon-hsn { color: #f2b705; }
.stat-icon-hsn::before { -webkit-mask-image: url("./assets/stat-hsn.svg"); mask-image: url("./assets/stat-hsn.svg"); }
.stat-icon-memory,
.stat-icon-memory-badge { font-size: 2rem; line-height: 1; }
.stat-icon-memory::before,
.stat-icon-memory-badge::before { display: none; }
.stat-icon-training { color: #2563eb; }
.stat-icon-training::before { -webkit-mask-image: url("./assets/stat-training.svg"); mask-image: url("./assets/stat-training.svg"); }
.stat-icon-trophy { color: #d6a700; }
.stat-icon-trophy::before { -webkit-mask-image: url("./assets/nav-trophy.svg"); mask-image: url("./assets/nav-trophy.svg"); }
.stat-icon-badge {
  background: center / contain no-repeat url("./assets/badge.png?v=20260618-27");
}
.stat-icon-badge::before { display: none; }
.stat-icon-zahra {
  color: #d64f87;
  font-size: 2rem;
  line-height: 1;
}
.stat-icon-zahra::before { display: none; }

.stats-collection {
  display: grid;
  gap: 12px;
  padding-top: 8px;
}

.stats-collection h3 {
  margin: 0;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.achievement-shelf,
.training-books,
.reward-shelf {
  display: grid;
  grid-auto-columns: 118px;
  grid-auto-flow: column;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 4px 14px;
  scroll-snap-type: x proximity;
}

.profile-reward {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  width: 112px;
  min-height: 132px;
  padding: 12px 10px;
  border: 2px solid #d9eadf;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  scroll-snap-align: start;
}

.profile-reward.is-zahra { border-color: #efb0ca; background: #fff2f7; color: #a52f60; }
.profile-reward.is-memory { border-color: #a9e7c2; background: #effcf4; color: #137a3d; }
.profile-reward.is-badge { border-color: #ecd587; background: #fff9df; color: #745800; }

.profile-reward-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  font-size: 2.7rem;
  line-height: 1;
}

.profile-reward-icon img { width: 100%; height: 100%; object-fit: contain; }
.profile-reward strong { font-size: 0.82rem; }
.profile-reward small { color: inherit; font-size: 0.68rem; overflow-wrap: anywhere; }

.achievement-badge {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  width: 112px;
  height: 126px;
  padding: 24px 12px 20px;
  clip-path: polygon(50% 0, 92% 17%, 86% 72%, 50% 100%, 14% 72%, 8% 17%);
  background: #f4c95d;
  color: #604500;
  filter: drop-shadow(0 6px 5px rgba(96, 69, 0, 0.18));
  text-align: center;
  scroll-snap-align: start;
}

.achievement-badge::before {
  position: absolute;
  top: 15px;
  width: 30px;
  height: 30px;
  background: #8b651d;
  content: "";
  opacity: 0.26;
  -webkit-mask: center / contain no-repeat url("./assets/nav-trophy.svg");
  mask: center / contain no-repeat url("./assets/nav-trophy.svg");
}

.achievement-badge small,
.achievement-badge span {
  position: relative;
  z-index: 1;
}

.achievement-badge small {
  font-weight: 950;
}

.achievement-badge span {
  max-width: 88px;
  overflow-wrap: anywhere;
  font-size: 0.8rem;
  font-weight: 950;
}

.training-book {
  position: relative;
  display: grid;
  align-content: center;
  gap: 8px;
  width: 110px;
  height: 142px;
  padding: 18px 12px 18px 22px;
  border-radius: 4px 8px 8px 4px;
  background: #2563eb;
  color: #fff;
  box-shadow: inset 8px 0 0 rgba(15, 46, 120, 0.34), 5px 6px 0 #dce4ee;
  text-align: center;
  scroll-snap-align: start;
}

.training-book:nth-child(3n + 2) { background: #168a4a; }
.training-book:nth-child(3n + 3) { background: #d45757; }

.training-book::after {
  position: absolute;
  right: 7px;
  bottom: 7px;
  left: 14px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.78);
  content: "";
}

.training-book small {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.68rem;
  font-weight: 850;
}

.training-book span {
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  font-weight: 950;
}

.stats-empty-state {
  width: max-content;
  max-width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.stats-view {
  display: grid;
  gap: 16px;
}

.learned-list {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 800;
}

.learned-list-row {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
}

.progress-track {
  height: 18px;
  overflow: hidden;
  margin: 0 0 14px;
  border: 0;
  border-radius: 999px;
  background: #dceee3;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.06);
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transition: width 0.25s ease;
}

.controls {
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 14px;
  border: 0;
  box-shadow: 0 6px 0 #dceee3;
}

label {
  display: grid;
  gap: 6px;
  min-width: 220px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

select,
input[type="number"] {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.game-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfffc;
}

.game-picker legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.game-picker label {
  display: flex;
  flex: 0 1 auto;
  grid-template-columns: none;
  gap: 6px;
  align-items: center;
  min-width: 0;
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.game-picker input {
  accent-color: var(--accent);
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

button:not(:disabled):active {
  transform: translateY(2px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button {
  align-self: end;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 5px 0 var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button.restart-button {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 5px 0 #1d4ed8;
}

.primary-button.restart-button:hover {
  background: #1d4ed8;
}

.icon-button,
.audio-button {
  width: 44px;
  padding: 0;
  background: var(--accent-dark);
  color: #fff;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
}

.home-button {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--accent-soft);
  background: #fff;
  box-shadow: 0 4px 0 rgba(23, 147, 75, 0.2);
}

.home-button:hover {
  border-color: #b9efd0;
  background: #f6fff9;
}

.home-button-icon {
  width: 32px;
  height: 28px;
  overflow: visible;
}

.home-button-icon path {
  stroke: var(--accent-dark);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6;
}

.home-button-roof,
.home-button-chimney,
.home-button-door {
  fill: none;
}

.home-button-house {
  fill: var(--accent-soft);
}

.audio-button.is-playing,
[data-audio-sequence].is-playing,
[data-play-all-memory].is-playing {
  background: #2563eb;
  box-shadow: 0 4px 0 #1d4ed8;
}

.game-card {
  min-height: 0;
  align-items: stretch;
  flex-direction: column;
  padding: clamp(12px, 2vw, 16px);
  overflow: hidden;
  border: 0;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(3px);
  box-shadow: 0 5px 0 rgba(220, 238, 227, 0.82), 0 12px 30px rgba(26, 42, 33, 0.08);
}

.timer-track {
  position: relative;
  height: 28px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: #e8f3ed;
}

.timer-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 0.1s linear, background 0.2s ease;
}

.timer-track.is-urgent .timer-bar {
  background: var(--danger);
}

.timer-track.is-infinite .timer-bar {
  background: var(--accent-soft);
}

.timer-track span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

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

.meta {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.ayah-display,
.answer-slot {
  direction: rtl;
  border-radius: 8px;
  background: #fbfaf7;
  border: 1px solid var(--line);
  padding: 22px;
  font-family: "Traditional Arabic", "Amiri", "Scheherazade New", serif;
  font-size: clamp(1.9rem, 5vw, 3.4rem);
  line-height: 1.8;
  text-align: center;
}

.answer-slot {
  min-height: 128px;
  outline: 2px dashed transparent;
}

.answer-slot.is-active {
  outline-color: var(--accent);
}

.scrambled-ayah-answer-slot {
  padding: 14px 16px;
  font-size: clamp(1.15rem, 2.5vw, 1.75rem);
  line-height: 1.45;
}

.scrambled-ayah-answer-slot > div + div {
  margin-top: 6px;
}

.drop-zone {
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.drop-zone.is-drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
}

.options-grid,
.word-bank,
.ordered-list {
  display: grid;
  gap: 10px;
}

.options-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-button,
.word-chip,
.ayah-row {
  min-height: 58px;
  border: 2px solid #dceee3;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  box-shadow: 0 3px 0 #d9ded8;
}

.choice-button:hover,
.word-chip:hover,
.ayah-row:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.choice-button {
  direction: rtl;
  width: 100%;
  font-family: "Traditional Arabic", "Amiri", "Scheherazade New", serif;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.55;
}

.choice-button.is-selected:not(.is-correct):not(.is-wrong),
.answer-slot.is-selected-slot,
.ayah-display.is-filled:not(.is-correct-slot):not(.is-wrong-slot) {
  border-color: #d6a700;
  background: #fff4bf;
  color: #6b5100;
  box-shadow: 0 4px 0 #d6a700;
}

.choice-button.is-correct,
.ayah-display.is-correct-slot {
  border-color: var(--success);
  background: #e5f5ec;
  color: var(--success);
  box-shadow: 0 0 0 3px rgba(25, 122, 67, 0.12);
}

.ayah-display.is-wrong-slot {
  border-color: var(--danger);
  background: #fbe8e8;
  color: var(--danger);
}

.multi-missing-slot small {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.85rem;
  vertical-align: super;
}

.missing-passage .ayah-display {
  padding: 14px 18px;
  font-size: clamp(1.55rem, 3.5vw, 2.35rem);
  line-height: 1.6;
}

.grouped-visible-block {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.ayah-number-marker {
  display: inline-grid;
  place-items: center;
  min-width: 1.8em;
  height: 1.8em;
  margin: 0 0.18em;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.48em;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
}

.answer-slot.is-correct-slot {
  border-color: var(--success);
  background: #e5f5ec;
  color: var(--success);
}

.choice-button.is-wrong {
  border-color: var(--danger);
  background: #fbe8e8;
  color: var(--danger);
  box-shadow: 0 0 0 3px rgba(167, 55, 55, 0.1);
}

.answer-slot.is-wrong-slot {
  border-color: var(--danger);
  background: #fbe8e8;
  color: var(--danger);
}

.missing-slot {
  color: var(--muted);
}

.option-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.missing-options-bank .option-row.is-used,
.single-answer-bank .option-row.is-used {
  visibility: hidden;
  pointer-events: none;
}

.missing-options-bank.is-drag-over,
.single-answer-bank.is-drag-over {
  outline: 3px dashed #d6a700;
  outline-offset: 6px;
  border-radius: 8px;
}

.multi-missing-slot.is-filled {
  cursor: grab;
}

.single-answer-slot.is-filled {
  cursor: grab;
}

.review-recap {
  display: grid;
  gap: 10px;
  width: min(100%, 760px);
  text-align: left;
}

.review-recap h3 {
  margin: 0;
  font-size: 1.05rem;
}

.review-ayah-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 2px solid #f1d3d3;
  border-radius: 8px;
  background: #fff8f8;
}

.review-ayah-row small {
  color: var(--danger);
  font-weight: 850;
}

.review-ayah-row p {
  margin: 4px 0 0;
  direction: rtl;
  font-family: "Traditional Arabic", "Amiri", "Scheherazade New", serif;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.5;
}

.training-summary {
  align-content: start;
}

.display-ayah-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.display-ayah-row .audio-button {
  align-self: center;
}

.word-bank {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

.word-answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 10px;
  min-height: 86px;
  padding: 8px;
  direction: rtl;
  font-family: "Traditional Arabic", "Amiri", "Scheherazade New", serif;
  font-size: 1.55rem;
  line-height: 1.55;
  text-align: center;
}

.word-place {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 64px;
  border: 2px dashed #b8cec0;
  border-radius: 8px;
  padding: 10px 30px 10px 10px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-family: "Traditional Arabic", "Amiri", "Scheherazade New", serif;
  font-size: 1.45rem;
  text-align: center;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.word-place.is-filled {
  border-style: solid;
  border-color: #d6a700;
  background: #fff4bf;
  color: #5f4900;
  cursor: grab;
}

.word-place.is-active,
.word-place.is-drag-over {
  border-color: #2563eb;
  outline: 3px solid rgba(37, 99, 235, 0.14);
}

.word-answer-grid.is-correct-slot .word-place {
  border-color: var(--success);
  background: #e5f5ec;
  color: var(--success);
}

.word-answer-grid.is-wrong-slot .word-place {
  border-color: var(--danger);
  background: #fbe8e8;
  color: var(--danger);
}

.remove-word-button {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  min-height: 0;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(95, 73, 0, 0.12);
  color: currentColor;
  font-size: 1.1rem;
  transform: translateY(-50%);
  cursor: pointer;
}

.word-bank.is-drag-over {
  outline: 3px dashed #2563eb;
  outline-offset: 5px;
  border-radius: 8px;
}

.word-chip {
  direction: rtl;
  font-family: "Traditional Arabic", "Amiri", "Scheherazade New", serif;
  font-size: 1.65rem;
  cursor: grab;
}

.word-chip.is-used {
  visibility: hidden;
}

.ordered-list {
  grid-template-columns: 1fr;
}

.ayah-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  text-align: right;
}

.draggable-ayah,
.draggable-missing-option {
  cursor: grab;
}

.draggable-ayah:active,
.draggable-ayah.is-dragging,
.draggable-missing-option:active,
.draggable-missing-option.is-dragging {
  cursor: grabbing;
  opacity: 0.62;
}

.ayah-row span {
  direction: rtl;
  font-family: "Traditional Arabic", "Amiri", "Scheherazade New", serif;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.secondary-button {
  padding: 0 16px;
  border: 2px solid #dceee3;
  background: #fff;
  box-shadow: 0 3px 0 #dceee3;
}

.control-actions {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.main-action-button {
  min-width: 220px;
  font-weight: 950;
  font-size: 1rem;
}

.skip-action-button {
  margin-left: auto;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.feedback {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 76px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 14px 18px;
  background: #fff;
  font-size: clamp(1.25rem, 3vw, 2.2rem);
  font-weight: 950;
  line-height: 1.2;
  text-align: center;
}

.answer-panel {
  position: sticky;
  z-index: 12;
  bottom: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  place-items: center stretch;
  gap: 14px;
  min-height: 74px;
  margin-top: 18px;
  border-width: 2px;
  box-shadow: 0 10px 30px rgba(18, 42, 29, 0.16);
}

.answer-panel.has-cancel {
  grid-template-columns: 48px minmax(0, 1fr);
}

.answer-panel .cancel-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 2px solid rgba(100, 115, 107, 0.18);
  border-radius: 8px;
  padding: 0;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  box-shadow: 0 3px 0 rgba(100, 115, 107, 0.16);
  font-size: 0;
  cursor: pointer;
}

.answer-panel .cancel-button::before {
  content: "×";
  font-size: 1.35rem;
  font-weight: 950;
  line-height: 1;
}

.answer-panel .cancel-button:hover {
  background: #f7faf8;
  color: var(--ink);
}

.answer-panel .verify-button {
  grid-column: 1 / -1;
  width: min(100%, 360px);
  justify-self: center;
}

.answer-panel.has-cancel .verify-button {
  grid-column: 2;
  width: 100%;
  max-width: none;
}

.answer-panel-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  text-align: left;
}

.answer-panel-copy strong {
  font-size: clamp(1.3rem, 5vw, 1.85rem);
}

.answer-panel-copy span,
.answer-panel-hint {
  font-size: 0.92rem;
  font-weight: 800;
}

.answer-panel .next-button {
  min-width: 130px;
}

.answer-panel.is-neutral {
  grid-template-columns: minmax(0, 1fr) auto;
  border-color: #dceee3;
  background: #fff;
  color: var(--muted);
}

.answer-panel.is-neutral .verify-button {
  grid-column: auto;
  width: auto;
}

.answer-panel.has-cancel .answer-panel-hint {
  grid-column: 1 / -1;
}

.answer-panel.is-neutral.has-cancel .verify-button {
  grid-column: 2;
  width: 100%;
}

.feedback strong {
  display: block;
  font-size: 1em;
}

.feedback span {
  display: block;
  color: inherit;
  font-size: 0.68em;
  font-weight: 850;
}

.feedback.ok {
  border-color: rgba(25, 122, 67, 0.28);
  background: #e5f5ec;
  color: var(--success);
}

.feedback.bad {
  border-color: rgba(167, 55, 55, 0.24);
  background: #fbe8e8;
  color: var(--danger);
}

.feedback.is-quiet {
  min-height: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}

.range-notice {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 320px;
  text-align: center;
}

.game-summary {
  position: relative;
  display: grid;
  place-items: center;
  gap: 16px;
  min-height: 360px;
  padding: 22px;
  text-align: center;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f9fffb);
}

.game-summary::before,
.game-summary::after {
  content: "";
  position: absolute;
  inset: auto;
  width: 140px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff7df;
  opacity: 0.75;
  z-index: 0;
}

.game-summary::before {
  top: -54px;
  left: -42px;
}

.game-summary::after {
  right: -48px;
  bottom: -56px;
  background: var(--accent-soft);
}

.game-summary > * {
  position: relative;
  z-index: 1;
}

.game-summary h2 {
  margin: 0;
  color: var(--accent-dark);
  font-size: clamp(2.4rem, 8vw, 4.7rem);
  line-height: 0.95;
}

.trophy-image {
  width: min(180px, 45vw);
  height: auto;
  filter: drop-shadow(0 18px 22px rgba(177, 132, 45, 0.24));
  animation: reward-pop 0.42s ease-out both;
}

.gain-badge {
  display: grid;
  place-items: center;
  width: min(150px, 38vw);
  aspect-ratio: 1;
  border: 6px solid rgba(177, 132, 45, 0.32);
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: clamp(4rem, 12vw, 6.5rem);
  font-weight: 950;
  box-shadow: 0 18px 30px rgba(177, 132, 45, 0.2);
  animation: reward-pop 0.42s ease-out both;
}

.gain-badge.is-muted {
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  animation: none;
}

.level-celebration {
  display: grid;
  gap: 6px;
  width: min(560px, 100%);
  padding: 18px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-soft), #fff);
  color: var(--accent-dark);
  box-shadow: 0 4px 0 #dceee3;
}

.level-celebration strong {
  font-size: clamp(1.7rem, 5vw, 3rem);
  line-height: 1;
}

.level-celebration span {
  color: var(--ink);
  font-weight: 850;
}

.level-celebration.is-trophy {
  border-color: rgba(177, 132, 45, 0.36);
  background: #fff7df;
  color: var(--gold);
}

.level-celebration.is-training,
.level-celebration.is-retry {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
  width: min(520px, 100%);
}

.summary-grid div {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 0 #dceee3;
}

.summary-grid strong {
  color: var(--accent-dark);
  font-size: 2rem;
}

.summary-grid span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.summary-grid .badge-stat-card {
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  text-align: left;
}

.summary-grid .badge-stat-icon {
  grid-row: 1 / 3;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.badge-image {
  width: min(170px, 42vw);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 16px 22px rgba(43, 107, 34, 0.22));
  animation: reward-pop 0.42s ease-out both;
}

.training-flower-reward {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: min(250px, 85%);
  margin: 8px auto 14px;
  border: 2px solid #ef96b7;
  border-radius: 8px;
  padding: 12px 16px;
  background: #fff1f6;
  color: #9f315d;
  box-shadow: 0 5px 0 #efbfd1;
}

.training-flower-reward > span {
  font-size: 2.6rem;
  line-height: 1;
  filter: drop-shadow(0 5px 8px rgba(201, 74, 124, 0.24));
}

.training-flower-reward strong {
  font-size: 1.15rem;
}

.training-flower-reward small {
  color: #7e5363;
  text-align: center;
}

.training-flower-reward.reward-claim-card {
  width: min(280px, 88%);
  min-height: 0;
  cursor: pointer;
  font: inherit;
}

.training-flower-reward.reward-claim-card:hover {
  border-color: #e66e9d;
  background: #ffe8f1;
}

.training-flower-reward.reward-claim-card em {
  color: #a52f60;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 950;
}

.reward-celebration {
  position: relative;
  isolation: isolate;
  min-height: min(580px, 72vh);
  overflow: hidden;
  border: 3px solid rgba(255, 200, 61, 0.65);
  background: radial-gradient(circle at 50% 35%, #fffbe8 0 25%, #f0fff6 66%, #dcfae8 100%);
}

.reward-celebration > *:not(.firework) {
  position: relative;
  z-index: 2;
}

.reward-celebration h2 {
  margin-bottom: 0;
  color: var(--accent-dark);
  font-size: clamp(2rem, 7vw, 3.8rem);
  text-align: center;
}

.reward-celebration-label {
  max-width: 520px;
  margin: 0 auto 10px;
  color: #52675a;
  font-weight: 900;
  text-align: center;
}

.reward-celebration-zahra {
  font-size: clamp(6rem, 22vw, 11rem);
  line-height: 1;
  filter: drop-shadow(0 18px 18px rgba(194, 67, 117, 0.24));
  animation: reward-pop 0.55s ease-out both, reward-float 2.6s 0.55s ease-in-out infinite;
}

.firework {
  position: absolute;
  z-index: 1;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  color: #ffc83d;
  box-shadow: 0 -48px currentColor, 34px -34px #ff6f91, 48px 0 #2ecb70, 34px 34px #3aa6ff,
    0 48px #ff8d3d, -34px 34px #a96cff, -48px 0 #f2b705, -34px -34px #20b85a;
  animation: firework-burst 1.15s ease-out infinite;
}

.firework-one { top: 22%; left: 18%; }
.firework-two { top: 18%; right: 18%; animation-delay: 0.36s; }
.firework-three { top: 49%; right: 10%; animation-delay: 0.72s; }

@keyframes firework-burst {
  0% { opacity: 0; transform: scale(0.15) rotate(0deg); }
  22% { opacity: 1; }
  78% { opacity: 0.95; }
  100% { opacity: 0; transform: scale(1.35) rotate(18deg); }
}

@keyframes reward-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

@keyframes reward-pop {
  0% {
    opacity: 0;
    transform: scale(0.7) rotate(-4deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.08) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.source-note {
  margin-top: 14px;
}

.memorization-launch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: min(620px, 100%);
}

.memorization-launch-button {
  min-height: 150px;
  padding: 22px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 5px 0 #dceee3;
  font-size: 1.08rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.memorization-launch-button:hover,
.memorization-launch-button.is-selected {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: #effbf3;
}

.simple-memory-view {
  display: grid;
  gap: 16px;
  width: 100%;
}

.simple-memory-toolbar,
.memory-challenge-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.memory-verse-list {
  display: grid;
  gap: 10px;
}

.memory-verse-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color 160ms ease, background 160ms ease;
}

.memory-verse-row.is-mastered {
  border-color: #57cc75;
  background: #effbf3;
}

.memory-verse-row.is-wrong-memory {
  border-color: #f0a33a;
  background: #fff7e8;
}

.memory-verse-text {
  min-width: 0;
  color: var(--ink);
  font-family: "Amiri Quran", "Amiri", serif;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  line-height: 2;
  text-align: right;
  direction: rtl;
}

.memory-mask {
  display: block;
  color: #9eaaa3;
  font-family: inherit;
  letter-spacing: 0;
  text-align: center;
  direction: ltr;
}

.memory-verse-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.memory-toggle-button,
.memory-self-check button {
  min-height: 44px;
  padding: 9px 13px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.memory-self-check {
  display: flex;
  gap: 8px;
}

.memory-self-check [data-memory-result="correct"] {
  border-color: #57cc75;
  color: #16803a;
}

.memory-self-check [data-memory-result="wrong"] {
  border-color: #f0a33a;
  color: #a75b00;
}

.memory-verse-row .audio-button:disabled {
  border-color: #d8dedb;
  background: #eef1ef;
  color: #9aa39e;
  box-shadow: none;
  cursor: not-allowed;
}

.memory-mastered-mark {
  color: #16803a;
  font-weight: 900;
}

.memory-challenge-progress {
  padding: 12px 14px;
  border-radius: 8px;
  background: #eef6ff;
  color: #23599b;
  font-weight: 900;
}

.memory-challenge-progress > div {
  width: min(320px, 55%);
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #d7e4ef;
}

.memory-challenge-progress > div span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}

.memory-complete-banner {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 28px 18px;
  border: 2px solid #57cc75;
  border-radius: 8px;
  background: #effbf3;
  text-align: center;
}

@media (max-width: 720px) {
  body {
    padding-bottom: 82px;
  }

  .app-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 18px;
  }

  .app-workspace {
    display: block;
  }

  .main-rail {
    position: fixed;
    z-index: 100;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    min-height: 72px;
    padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 24px var(--shadow);
  }

  .rail-button {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    place-items: center;
    min-height: 58px;
    border: 0;
    padding: 4px;
    text-align: center;
    box-shadow: none;
  }

  .rail-button > span {
    width: 28px;
    font-size: 0.9rem;
  }

  .rail-icon::before {
    width: 21px;
    height: 21px;
  }

  .rail-button strong {
    font-size: 0.72rem;
  }

  .rail-button[data-main-action="challenge"] strong {
    font-size: 0.62rem;
  }

  .rail-button.is-active {
    box-shadow: none;
  }

  .rail-more {
    margin-top: 0;
  }

  .selector-shell {
    min-height: 0;
    padding: 10px;
  }

  .selector-stage {
    min-height: 330px;
  }

  .game-launch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .memorization-launch-grid {
    grid-template-columns: 1fr;
  }

  .memorization-launch-button {
    min-height: 108px;
  }

  .simple-memory-toolbar,
  .memory-challenge-progress {
    align-items: stretch;
    flex-direction: column;
  }

  .memory-challenge-progress > div {
    width: 100%;
  }

  .memory-verse-row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
  }

  .memory-verse-action {
    grid-column: 1 / -1;
  }

  .memory-toggle-button,
  .memory-self-check {
    width: 100%;
  }

  .memory-self-check button {
    flex: 1;
  }

  .game-launch-button {
    min-height: 96px;
    padding: 10px;
  }

  .challenge-launch-button {
    min-height: 76px;
  }

  .range-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(92px, 0.65fr);
    gap: 12px 8px;
    margin-top: 46px;
  }

  .topbar,
  .status-panel,
  .game-header {
    align-items: flex-start;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .level-path {
    grid-template-columns: 1fr;
  }

  .path-line {
    display: none;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .stats-overview-grid {
    gap: 2px 14px;
  }

  .stat-overview-item {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    min-height: 68px;
  }

  .stat-overview-icon {
    width: 32px;
    height: 32px;
  }

  .stat-overview-icon::before {
    width: 26px;
    height: 26px;
  }

  .activity-header {
    align-items: stretch;
    flex-direction: column;
  }

  .question-progress {
    grid-template-columns: auto minmax(0, 1fr);
    width: 100%;
  }

  .activity-actions > * {
    flex: 1 1 180px;
  }

  .memorization-toolbar .secondary-button:not(.icon-command) {
    flex: 1 1 100%;
  }

  .answer-panel,
  .answer-panel.is-neutral {
    position: fixed;
    z-index: 90;
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(72px + env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    grid-template-columns: 1fr;
    gap: 10px;
    width: auto;
    margin: 0;
    padding: 12px;
  }

  .activity-view {
    padding-bottom: 230px;
  }

  .game-card.is-split-game {
    gap: 18px;
  }

  .question-panel,
  .answer-options-panel {
    padding: 10px;
  }

  .answer-panel-copy {
    text-align: center;
  }

  .answer-panel .next-button,
  .answer-panel.is-neutral .verify-button {
    width: 100%;
  }

  label,
  .primary-button {
    width: 100%;
  }

  .game-picker label {
    width: auto;
  }
}

.journey-home-active {
  overflow: hidden;
}

.journey-home-view {
  position: fixed;
  z-index: 900;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(180deg, #bcecff 0%, #e8f4ad 52%, #176843 100%);
}

.journey-map-canvas {
  position: relative;
  width: min(100vw, 150vh);
  aspect-ratio: 3 / 2;
  background: center / 100% 100% no-repeat url("./assets/journey-map-bg-v5.png?v=20260625-84");
  box-shadow: 0 0 70px rgba(12, 71, 43, 0.18);
}

.journey-stop {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 3px 8px 5px;
  background: transparent;
  color: #4d351d;
  box-shadow: none;
  font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  font-size: clamp(0.74rem, 1.25vw, 1.08rem);
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(255, 248, 218, 0.9);
  transform: translate(-50%, -50%);
  animation: journey-stop-glow 2.4s ease-in-out infinite alternate;
}

.journey-stop span {
  display: none;
}

.journey-stop strong {
  white-space: nowrap;
  font-weight: 700;
}

.journey-stop-memory {
  top: 71.7%;
  left: 67%;
  width: 10.5%;
}

.journey-stop-games {
  top: 43.2%;
  left: 34.3%;
  width: 11.4%;
}

.journey-stop-challenge {
  top: 25.2%;
  left: 69.4%;
  width: 7.7%;
  color: #38265f;
  font-size: clamp(0.58rem, 0.95vw, 0.84rem);
}

.journey-stop:not(:disabled):active {
  transform: translate(-50%, -48%) scale(0.98);
}

@keyframes journey-stop-glow {
  from { filter: brightness(1); }
  to { filter: brightness(1.08); }
}

@media (max-width: 720px) {
  .journey-map-canvas {
    width: min(100vw, 56.24vh);
    aspect-ratio: 942 / 1675;
    background-image: url("./assets/journey-map-mobile-bg-v5.png?v=20260625-84");
  }

  .journey-stop {
    min-height: 32px;
    padding: 2px 5px 4px;
    font-size: clamp(0.62rem, 2.65vw, 0.82rem);
  }

  .journey-stop-memory {
    top: 71.1%;
    left: 60.4%;
    width: 19.5%;
  }

  .journey-stop-games {
    top: 39.6%;
    left: 30.2%;
    width: 20.5%;
  }

  .journey-stop-challenge {
    top: 15.4%;
    left: 69%;
    width: 14.5%;
    font-size: clamp(0.46rem, 1.85vw, 0.62rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .journey-stop {
    animation: none;
  }
}

.memory-guide-scene {
  position: fixed;
  z-index: 910;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(243, 255, 238, 0.28), rgba(29, 104, 70, 0.2)),
    center / cover no-repeat url("./assets/journey-map-bg-v2.png?v=20260620-54");
}

.memory-guide-back {
  position: absolute;
  z-index: 8;
  top: max(18px, env(safe-area-inset-top));
  left: 18px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 2px solid rgba(255, 255, 255, 0.84);
  border-radius: 50%;
  background: rgba(23, 104, 67, 0.9);
  color: #fff;
  box-shadow: 0 5px 16px rgba(14, 61, 39, 0.25);
  font-size: 1.35rem;
  cursor: pointer;
}

.memory-guide-doorway {
  position: absolute;
  z-index: 1;
  bottom: 8%;
  left: 50%;
  width: min(38vw, 430px);
  height: min(72vh, 680px);
  border: clamp(12px, 1.5vw, 22px) solid #5e3b23;
  border-bottom: 0;
  border-radius: 48% 48% 4px 4px / 18% 18% 4px 4px;
  background: radial-gradient(circle at 50% 40%, #f8efb2, #98d9a2 55%, #246848);
  box-shadow: 0 22px 60px rgba(24, 70, 48, 0.35), inset 0 0 45px rgba(255, 255, 255, 0.55);
  transform: translateX(-50%);
}

.memory-guide-door {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #785030 0 49%, #58381f 49% 51%, #785030 51% 100%);
  box-shadow: inset 0 0 0 5px rgba(58, 35, 18, 0.35);
  transform-origin: left center;
  transition: transform 1.1s cubic-bezier(0.5, 0, 0.2, 1), opacity 750ms ease;
}

.memory-guide-scene.is-opening .memory-guide-door {
  opacity: 0.18;
  transform: perspective(900px) rotateY(-82deg);
}

.memory-guide-character {
  position: absolute;
  z-index: 3;
  bottom: 2%;
  left: 50%;
  width: min(45vw, 570px);
  max-height: 88vh;
  object-fit: contain;
  opacity: 0;
  filter: drop-shadow(0 18px 24px rgba(20, 67, 45, 0.3));
  transform: translate(-50%, 80px) scale(0.9);
  transition: opacity 550ms ease, transform 850ms cubic-bezier(0.2, 0.85, 0.25, 1.15);
}

.memory-guide-scene.is-guide-visible .memory-guide-character {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.memory-guide-name {
  position: absolute;
  z-index: 6;
  top: clamp(22px, 5vh, 58px);
  left: 50%;
  padding: 8px 18px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  background: rgba(29, 132, 85, 0.92);
  color: #fff;
  box-shadow: 0 6px 0 rgba(15, 94, 58, 0.85);
  font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  font-size: clamp(1.1rem, 2.2vw, 1.7rem);
  letter-spacing: 0;
  opacity: 0;
  transform: translate(-50%, -18px);
  transition: opacity 450ms ease, transform 550ms ease;
}

.memory-guide-scene.is-guide-visible .memory-guide-name {
  opacity: 1;
  transform: translate(-50%, 0);
}

.memory-guide-choices {
  position: absolute;
  z-index: 5;
  right: clamp(20px, 6vw, 100px);
  bottom: clamp(34px, 10vh, 120px);
  display: grid;
  gap: 16px;
  width: min(28vw, 320px);
  opacity: 0;
  pointer-events: none;
  transform: translateX(35px);
  transition: opacity 450ms ease, transform 550ms ease;
}

.memory-guide-scene.is-ready .memory-guide-choices {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.memory-guide-choices button {
  min-height: 74px;
  border: 3px solid #fff;
  border-radius: 8px;
  background: #25bd70;
  color: #fff;
  box-shadow: 0 7px 0 #168d51, 0 14px 28px rgba(15, 78, 49, 0.24);
  font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  font-size: clamp(1.05rem, 2vw, 1.55rem);
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

.memory-guide-choices button:last-child {
  background: #4c7ff0;
  box-shadow: 0 7px 0 #315ebd, 0 14px 28px rgba(31, 73, 153, 0.23);
}

.memory-guide-choices button:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.memory-guide-choices button:active {
  transform: translateY(5px);
}

@media (max-width: 720px) {
  .memory-guide-scene {
    background-image:
      linear-gradient(rgba(243, 255, 238, 0.2), rgba(29, 104, 70, 0.12)),
      url("./assets/journey-map-mobile-bg-v2.png?v=20260620-54");
  }

  .memory-guide-doorway {
    bottom: 16%;
    width: min(66vw, 330px);
    height: min(62vh, 570px);
  }

  .memory-guide-character {
    bottom: 12%;
    width: min(82vw, 430px);
    max-height: 74vh;
  }

  .memory-guide-choices {
    right: 16px;
    bottom: max(18px, env(safe-area-inset-bottom));
    left: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: auto;
    transform: translateY(28px);
  }

  .memory-guide-name {
    top: max(18px, env(safe-area-inset-top));
    font-size: 1.05rem;
  }

  .memory-guide-scene.is-ready .memory-guide-choices {
    transform: translateY(0);
  }

  .memory-guide-choices button {
    min-height: 62px;
    padding: 8px;
    font-size: clamp(0.94rem, 4.5vw, 1.2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .memory-guide-door,
  .memory-guide-character,
  .memory-guide-name,
  .memory-guide-choices {
    transition-duration: 1ms;
  }
}

/* Miss Who welcomes the learner inside the memorization cottage. */
.memory-guide-scene {
  isolation: isolate;
  background: #75421e;
}

.memory-guide-scene::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: center / cover no-repeat url("./assets/miss-who-cottage.png?v=20260620-57");
  content: "";
  opacity: 0;
  transform: scale(1.035);
  transition: opacity 700ms ease, transform 1100ms cubic-bezier(0.2, 0.75, 0.2, 1);
}

.memory-guide-scene.is-guide-visible::before {
  opacity: 1;
  transform: scale(1);
}

.memory-guide-name {
  top: 58.5%;
  left: 52.2%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #252b28;
  box-shadow: none;
  font-size: clamp(0.54rem, 0.82vw, 0.74rem);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  transform: translate(-50%, -50%);
}

.memory-guide-scene.is-guide-visible .memory-guide-name {
  transform: translate(-50%, -50%);
}

.memory-guide-choices {
  inset: 0;
  display: block;
  width: auto;
  transform: none;
}

.memory-guide-scene.is-ready .memory-guide-choices {
  transform: none;
}

.memory-guide-choices button {
  position: absolute;
  top: 54%;
  min-height: 64px;
  padding: 4px 8px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
  color: #7c241f;
  display: grid;
  place-items: center;
  font-family: inherit;
  font-size: clamp(0.72rem, 1.2vw, 1.02rem);
  line-height: 1.18;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 1px 0 #fff8dc;
  transform: translate(-50%, -50%);
}

.memory-guide-choices button:first-child {
  left: 18%;
  width: 20%;
}

.memory-guide-choices button:last-child {
  left: 74%;
  width: 26%;
  background: transparent;
  color: #205f2f;
  box-shadow: none;
}

.memory-guide-choices button:hover {
  filter: brightness(0.9);
  transform: translate(-50%, -53%) scale(1.04);
}

.memory-guide-choices button:active {
  transform: translate(-50%, -47%) scale(0.98);
}

@media (max-width: 720px) {
  .memory-guide-scene::before {
    background-image: url("./assets/miss-who-cottage-mobile.png?v=20260625-84");
  }

  .memory-guide-name {
    top: 56.4%;
    left: 64.2%;
    border: 1px solid rgba(29, 82, 70, 0.22);
    border-radius: 4px;
    padding: 1px 5px;
    background: rgba(255, 255, 255, 0.72);
    font-size: clamp(0.44rem, 1.75vw, 0.6rem);
    transform: translate(-50%, -50%) rotate(1deg);
  }

  .memory-guide-choices {
    inset: 0;
    display: block;
  }

  .memory-guide-choices button {
    top: 50.7%;
    height: 6.6%;
    min-height: 0;
    padding: 2px 5px;
    font-size: clamp(0.5rem, 2.18vw, 0.7rem);
    line-height: 1.12;
    align-content: center;
    justify-content: center;
  }

  .memory-guide-choices button:first-child {
    left: 0;
    width: 25.8%;
    transform: rotate(1.5deg);
  }

  .memory-guide-choices button:last-child {
    left: 74%;
    width: 26%;
    transform: rotate(-1.2deg);
  }
}

/* Focused selection screen for the guided learning path. */
.app-shell.is-learning-selection {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 22px max(16px, calc((100vw - 1280px) / 2)) 42px;
  background: linear-gradient(155deg, #eefaff 0%, #dceeff 48%, #c9e2ff 100%);
}

.app-shell.is-learning-selection .selector-shell {
  border: 0;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
}

.app-shell.is-learning-selection #rangeSelectorPanel {
  min-height: min(620px, calc(100vh - 150px));
}

.app-shell.is-learning-selection .range-grid {
  gap: 20px 16px;
  width: min(100%, 800px);
}

.app-shell.is-learning-selection .range-grid label {
  display: grid;
  gap: 9px;
  min-height: 112px;
  align-content: center;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, #347fdc 0%, #1f61c7 100%);
  color: #fff;
  box-shadow: 0 7px 0 #174eaa, 0 15px 28px rgba(30, 85, 164, 0.2);
  font-size: 0.92rem;
}

.app-shell.is-learning-selection .surah-search-input,
.app-shell.is-learning-selection .range-grid select {
  border-color: rgba(255, 255, 255, 0.92);
  background: #fff;
  color: #17375f;
  box-shadow: inset 0 0 0 1px rgba(28, 91, 181, 0.12);
}

.app-shell.is-learning-selection .surah-combobox-toggle {
  border-left-color: #d6e6fb;
  background: #fff;
  color: #1f61c7;
}

.app-shell.is-learning-selection .surah-search-hint {
  color: #e9f4ff;
}

.app-shell.is-learning-selection .selector-back {
  background: #fff;
  color: #1f61c7;
  box-shadow: 0 4px 0 #bed6f4;
}

.app-shell.is-learning-selection .go-button {
  border-color: #1753b5;
  background: #2168cf;
  color: #fff;
  box-shadow: 0 7px 0 #174b9f;
}

.app-shell.is-learning-selection .go-button:hover {
  background: #1759bd;
}

@media (max-width: 720px) {
  .app-shell.is-learning-selection {
    padding: 10px 10px calc(92px + env(safe-area-inset-bottom));
  }

  .app-shell.is-learning-selection #rangeSelectorPanel {
    min-height: calc(100vh - 150px);
  }

  .app-shell.is-learning-selection .range-grid {
    gap: 14px 8px;
  }

  .app-shell.is-learning-selection .range-grid label {
    min-height: 102px;
    padding: 10px;
    font-size: 0.8rem;
  }

  .app-shell.is-learning-selection .surah-search-input,
  .app-shell.is-learning-selection .range-grid select {
    height: 50px;
  }
}

/* The self-test path keeps the same layout with a warmer identity. */
.app-shell.is-learning-selection.is-learning-test-selection {
  background: linear-gradient(155deg, #fff8ed 0%, #ffead8 48%, #ffd9c7 100%);
}

.app-shell.is-learning-test-selection .range-grid label {
  border-color: rgba(255, 247, 235, 0.78);
  background: linear-gradient(180deg, #ef805b 0%, #d95a43 100%);
  box-shadow: 0 7px 0 #b84435, 0 15px 28px rgba(155, 65, 48, 0.2);
}

.app-shell.is-learning-test-selection .surah-search-input,
.app-shell.is-learning-test-selection .range-grid select {
  border-color: rgba(255, 255, 255, 0.94);
  color: #6d3026;
  box-shadow: inset 0 0 0 1px rgba(183, 69, 47, 0.14);
}

.app-shell.is-learning-test-selection .surah-combobox-toggle {
  border-left-color: #f3d2c6;
  color: #c74e39;
}

.app-shell.is-learning-test-selection .surah-search-hint {
  color: #fff3e9;
}

.app-shell.is-learning-test-selection .selector-back {
  color: #c74e39;
  box-shadow: 0 4px 0 #efc6b8;
}

.app-shell.is-learning-test-selection .go-button {
  border-color: #b94535;
  background: #df6249;
  box-shadow: 0 7px 0 #ac3e31;
}

.app-shell.is-learning-test-selection .go-button:hover {
  background: #ca503c;
}

.game-guide-scene {
  position: fixed;
  z-index: 910;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #4a2c18;
}

.game-guide-canvas {
  position: relative;
  width: min(100vw, 150vh);
  aspect-ratio: 3 / 2;
  background: center / 100% 100% no-repeat url("./assets/game-guide-stall.png?v=20260625-84");
  opacity: 0;
  transform: scale(1.025);
  transition: opacity 450ms ease, transform 700ms cubic-bezier(0.2, 0.75, 0.2, 1);
}

.game-guide-scene.is-visible .game-guide-canvas {
  opacity: 1;
  transform: scale(1);
}

.game-guide-intro {
  position: absolute;
  z-index: 8;
  top: 9%;
  left: 7.5%;
  display: grid;
  width: 28%;
  gap: 8px;
  border: 4px double #bc8b35;
  border-radius: 8px;
  padding: 14px 16px;
  background: linear-gradient(145deg, rgba(255, 250, 220, 0.97), rgba(246, 225, 166, 0.97));
  color: #49331f;
  box-shadow: 0 8px 22px rgba(49, 28, 12, 0.22);
  font-size: clamp(0.72rem, 1.2vw, 1rem);
  line-height: 1.32;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.game-guide-intro::after {
  position: absolute;
  right: -17px;
  bottom: 20px;
  width: 28px;
  height: 28px;
  border-top: 4px double #bc8b35;
  border-right: 4px double #bc8b35;
  background: #f8e9b9;
  content: "";
  transform: rotate(45deg);
}

.game-guide-intro strong,
.game-guide-intro span {
  position: relative;
  z-index: 1;
}

.game-guide-back {
  position: fixed;
  z-index: 12;
  top: max(18px, env(safe-area-inset-top));
  left: 18px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  background: rgba(32, 104, 68, 0.92);
  color: #fff;
  box-shadow: 0 5px 16px rgba(40, 23, 11, 0.28);
  font-size: 1.35rem;
  cursor: pointer;
}

.game-guide-choices {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: auto;
  transition: opacity 350ms ease;
}

.game-guide-scene.is-ready .game-guide-choices {
  opacity: 1;
  pointer-events: auto;
}

.game-box-choice {
  position: absolute;
  z-index: 3;
  border: 0;
  border-radius: 12px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transform: translate(-50%, -50%);
  transition: none;
}

.game-box-choice:hover,
.game-box-choice:active,
.game-box-choice:focus {
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  filter: none;
  transform: translate(-50%, -50%);
}

.game-box-label {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 6px 10px;
  color: #4d351d;
  font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  font-size: clamp(0.72rem, 1.3vw, 1.08rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
  text-align: center;
  text-wrap: balance;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  transform: translate(-50%, -50%);
}

.game-box-next {
  top: 70.2%;
  left: 16.6%;
  width: 22%;
  height: 40%;
}

.game-box-words {
  top: 70.5%;
  left: 39%;
  width: 22%;
  height: 40%;
}

.game-box-missing {
  top: 73.8%;
  left: 61.8%;
  width: 22%;
  height: 40%;
}

.game-box-order {
  top: 72.3%;
  left: 84%;
  width: 22%;
  height: 40%;
}

.game-box-label-next { top: 70.2%; left: 16.6%; width: 15.5%; height: 14%; }
.game-box-label-words { top: 70.5%; left: 39%; width: 16.5%; height: 14%; }
.game-box-label-missing { top: 73.8%; left: 61.8%; width: 17%; height: 14%; }
.game-box-label-order { top: 72.3%; left: 84%; width: 16.5%; height: 14%; }

@media (max-width: 720px) {
  .game-guide-canvas {
    width: min(100vw, 66.67vh);
    aspect-ratio: 2 / 3;
    background-image: url("./assets/game-guide-stall-mobile.png?v=20260625-84");
  }

  .game-guide-intro {
    top: 0.9%;
    left: 50%;
    width: 82%;
    gap: 3px;
    border-width: 1px;
    padding: 8px 10px;
    font-size: clamp(0.58rem, 2.65vw, 0.72rem);
    line-height: 1.2;
    transform: translateX(-50%);
  }

  .game-guide-intro::after {
    right: 20%;
    bottom: -8px;
    width: 14px;
    height: 14px;
    border-width: 1px;
    transform: rotate(135deg);
  }

  .game-box-label {
    padding: 5px;
    font-size: clamp(0.62rem, 3vw, 0.82rem);
  }

  .game-box-next {
    top: 55.2%;
    left: 27.2%;
    width: 45%;
    height: 19%;
  }

  .game-box-words {
    top: 55.2%;
    left: 73.2%;
    width: 45%;
    height: 19%;
  }

  .game-box-missing {
    top: 74.4%;
    left: 25.8%;
    width: 45%;
    height: 19%;
  }

  .game-box-order {
    top: 73.7%;
    left: 74.5%;
    width: 45%;
    height: 19%;
  }

  .game-box-label-next { top: 55.2%; left: 27.2%; width: 27%; height: 9%; }
  .game-box-label-words { top: 54.8%; left: 73.1%; width: 25%; height: 7.8%; }
  .game-box-label-missing { top: 74.4%; left: 25.8%; width: 30%; height: 9%; }
  .game-box-label-order { top: 73.7%; left: 74.5%; width: 30%; height: 9%; }
}

.challenge-guide-scene {
  position: fixed;
  z-index: 920;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #351c46;
}

.challenge-guide-canvas {
  position: relative;
  width: min(100vw, 124.78vh);
  aspect-ratio: 1400 / 1122;
  background: center / 100% 100% no-repeat url("./assets/challenge-princess-scene.png?v=20260625-84");
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 450ms ease, transform 650ms ease;
}

.challenge-guide-scene.is-visible .challenge-guide-canvas {
  opacity: 1;
  transform: scale(1);
}

.challenge-guide-back {
  position: fixed;
  z-index: 12;
  top: max(18px, env(safe-area-inset-top));
  left: 18px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  background: rgba(74, 38, 99, 0.92);
  color: #fff;
  box-shadow: 0 5px 16px rgba(31, 12, 43, 0.34);
  font-size: 1.35rem;
  cursor: pointer;
}

.challenge-guide-start {
  position: absolute;
  right: 38.2%;
  bottom: 65.6%;
  width: 27%;
  height: 12.9%;
  border: 0;
  border-radius: 7px;
  padding: 0;
  background: transparent;
  color: transparent;
  box-shadow: none;
  font-size: 0;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.challenge-guide-start:hover {
  background: transparent;
}

.challenge-guide-start:active {
  transform: none;
}

.challenge-guide-start:focus-visible {
  outline: 4px solid rgba(255, 230, 143, 0.9);
  outline-offset: 4px;
}

@media (max-width: 720px) {
  .challenge-guide-canvas {
    width: 100vw;
  }

  .challenge-guide-start {
    right: 38.2%;
    bottom: 65.6%;
    width: 27%;
    height: 12.9%;
  }
}

.app-shell.is-game-selection {
  --game-page-start: #effff8;
  --game-page-middle: #dcf7e9;
  --game-page-end: #c8efd9;
  --game-card-start: #2eb879;
  --game-card-end: #168858;
  --game-card-shadow: #0f6c45;
  --game-control-text: #174d38;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 22px max(16px, calc((100vw - 1280px) / 2)) 42px;
  background: linear-gradient(155deg, var(--game-page-start), var(--game-page-middle) 48%, var(--game-page-end));
}

.app-shell.is-game-selection.game-theme-words {
  --game-page-start: #fffbea;
  --game-page-middle: #fff0bf;
  --game-page-end: #ffe39b;
  --game-card-start: #e9ae2d;
  --game-card-end: #c98210;
  --game-card-shadow: #9b6209;
  --game-control-text: #66430b;
}

.app-shell.is-game-selection.game-theme-missing {
  --game-page-start: #fff4f1;
  --game-page-middle: #ffe2dd;
  --game-page-end: #ffcfc8;
  --game-card-start: #ed766f;
  --game-card-end: #ca4d55;
  --game-card-shadow: #9f3742;
  --game-control-text: #6c2932;
}

.app-shell.is-game-selection.game-theme-order {
  --game-page-start: #effdfd;
  --game-page-middle: #d5f4f2;
  --game-page-end: #bce9e7;
  --game-card-start: #24aaa8;
  --game-card-end: #137d88;
  --game-card-shadow: #0d626d;
  --game-control-text: #164e55;
}

.app-shell.is-game-selection .selector-shell {
  border: 0;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
}

.app-shell.is-game-selection #rangeSelectorPanel {
  min-height: min(620px, calc(100vh - 150px));
}

.app-shell.is-game-selection .range-grid {
  gap: 20px 16px;
  width: min(100%, 800px);
}

.app-shell.is-game-selection .range-grid label {
  display: grid;
  gap: 9px;
  min-height: 112px;
  align-content: center;
  border: 2px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, var(--game-card-start), var(--game-card-end));
  color: #fff;
  box-shadow: 0 7px 0 var(--game-card-shadow), 0 15px 28px rgba(24, 77, 54, 0.18);
  font-size: 0.92rem;
}

.app-shell.is-game-selection .surah-search-input,
.app-shell.is-game-selection .range-grid select {
  border-color: rgba(255, 255, 255, 0.94);
  background: #fff;
  color: var(--game-control-text);
}

.app-shell.is-game-selection .surah-combobox-toggle {
  border-left-color: #d7e8df;
  background: #fff;
  color: var(--game-card-end);
}

.app-shell.is-game-selection .surah-search-hint {
  color: rgba(255, 255, 255, 0.9);
}

.app-shell.is-game-selection .selector-back {
  background: #fff;
  color: var(--game-card-end);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--game-card-start) 32%, #fff);
}

.app-shell.is-game-selection .go-button {
  border-color: var(--game-card-shadow);
  background: var(--game-card-end);
  color: #fff;
  box-shadow: 0 7px 0 var(--game-card-shadow);
}

.app-shell.is-game-selection .go-button:hover {
  filter: brightness(0.92);
}

@media (max-width: 720px) {
  .app-shell.is-game-selection {
    padding: 10px 10px calc(92px + env(safe-area-inset-bottom));
  }

  .app-shell.is-game-selection #rangeSelectorPanel {
    min-height: calc(100vh - 150px);
  }

  .app-shell.is-game-selection .range-grid {
    gap: 14px 8px;
  }

  .app-shell.is-game-selection .range-grid label {
    min-height: 102px;
    padding: 10px;
    font-size: 0.8rem;
  }

  .app-shell.is-game-selection .surah-search-input,
  .app-shell.is-game-selection .range-grid select {
    height: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-guide-canvas,
  .game-guide-choices {
    transition-duration: 1ms;
  }
}
