/* ============================================================
   Phonics Party 1 — الأنماط الأساسية
   ============================================================ */

@font-face {
  font-family: 'Baloo2';
  src: url('../assets/fonts/baloo2/baloo-2-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Baloo2';
  src: url('../assets/fonts/baloo2/baloo-2-latin-600-normal.woff2') format('woff2');
  font-weight: 600; font-display: swap;
}
@font-face {
  font-family: 'Baloo2';
  src: url('../assets/fonts/baloo2/baloo-2-latin-700-normal.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: 'Baloo2';
  src: url('../assets/fonts/baloo2/baloo-2-latin-800-normal.woff2') format('woff2');
  font-weight: 800; font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('../assets/fonts/fredoka/fredoka-latin-500-normal.woff2') format('woff2');
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('../assets/fonts/fredoka/fredoka-latin-600-normal.woff2') format('woff2');
  font-weight: 600; font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('../assets/fonts/fredoka/fredoka-latin-700-normal.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: 'Cairo';
  src: url('../assets/fonts/cairo/cairo-arabic-400-normal.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Cairo';
  src: url('../assets/fonts/cairo/cairo-arabic-600-normal.woff2') format('woff2');
  font-weight: 600; font-display: swap;
}
@font-face {
  font-family: 'Cairo';
  src: url('../assets/fonts/cairo/cairo-arabic-700-normal.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: 'Cairo';
  src: url('../assets/fonts/cairo/cairo-arabic-800-normal.woff2') format('woff2');
  font-weight: 800; font-display: swap;
}

:root {
  --cream: #FBF3E6;
  --cream-2: #F5E9D6;
  --ink: #4A3226;
  --ink-soft: #7A6252;
  --coral: #EE8B6E;
  --teal: #3FA79C;
  --gold: #F0B23E;
  --purple: #9083E0;
  --sky: #4CACBE;
  --rose: #E0708B;
  --sage: #5FAE9D;
  --card-shadow: 0 6px 0 rgba(74, 50, 38, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Cairo', 'Segoe UI', sans-serif;
  direction: rtl;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 8% 12%, rgba(238,139,110,0.10) 0, transparent 40%),
    radial-gradient(circle at 92% 18%, rgba(76,172,190,0.12) 0, transparent 38%),
    radial-gradient(circle at 85% 85%, rgba(240,178,62,0.10) 0, transparent 42%);
}

.eng { font-family: 'Baloo2', 'Fredoka', sans-serif; direction: ltr; unicode-bidi: isolate; }

button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(251, 243, 230, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 3px solid rgba(74,50,38,0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  color: var(--ink);
}
.brand .bubble {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--coral), var(--rose));
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 3px 0 rgba(74,50,38,0.2);
}
.brand small { display:block; font-weight: 500; font-size: 12px; color: var(--ink-soft); }

.home-btn {
  background: white;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  box-shadow: var(--card-shadow);
  display: flex; align-items: center; gap: 6px;
  transition: transform .15s ease;
}
.home-btn:hover { transform: translateY(-2px); }

.parent-btn {
  background: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  color: white;
  box-shadow: var(--card-shadow);
  transition: transform .15s ease;
}
.parent-btn:hover { transform: translateY(-2px); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.language-btn {
  background: var(--teal);
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  color: white;
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--card-shadow);
  transition: transform .15s ease;
}
.language-btn:hover { transform: translateY(-2px); }

body.is-english .section-nav { direction: ltr; }
body.is-english .unit-card {
  direction: ltr;
  text-align: left !important;
}
body.is-english .unit-card .letters-row,
body.is-english .unit-card .words {
  direction: ltr !important;
  text-align: left !important;
}
body.is-english .parent-letter-card,
body.is-english .parent-game-row {
  direction: ltr;
  text-align: left;
}
body.is-english .parent-letter-card > span:last-child {
  margin-inline-start: auto;
  margin-inline-end: 0;
}
body.is-english .license-panel ul { padding: 0 0 0 20px; }

.install-btn {
  background: linear-gradient(145deg, var(--teal), var(--sage));
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 14px;
  color: white;
  box-shadow: var(--card-shadow);
  display: flex; align-items: center; gap: 6px;
  transition: transform .15s ease;
}
.install-btn:hover { transform: translateY(-2px); }

@media (max-width: 520px) {
  .install-btn span.install-btn-label { display: none; }
}

.install-instructions-body ol {
  margin: 0 0 12px;
  padding-inline-start: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 15px;
  line-height: 1.6;
}
.install-instructions-note {
  color: var(--ink-soft);
  font-size: 13px;
  margin: 0;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* ---------- Nav pills (bottom on mobile, section nav) ---------- */
.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 28px;
}
.section-nav button {
  background: white;
  border: none;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--ink-soft);
  box-shadow: var(--card-shadow);
}
.section-nav button.active {
  background: var(--ink);
  color: white;
  box-shadow: 0 6px 0 rgba(74,50,38,0.35);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #F6D9C4, #F3E3C9);
  padding: 40px 32px;
  margin-bottom: 32px;
  overflow: hidden;
  text-align: center;
}
.hero::before, .hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  opacity: .55;
}
.hero::before {
  width: 140px; height: 140px;
  background: var(--sky);
  top: -50px; right: -30px;
}
.hero::after {
  width: 100px; height: 100px;
  background: var(--gold);
  bottom: -40px; left: 6%;
}
.hero h1 {
  position: relative;
  font-family: 'Baloo2', sans-serif;
  font-size: 40px;
  margin: 0 0 8px;
  color: var(--ink);
}
.hero .eng-title {
  position: relative;
  font-family: 'Fredoka', sans-serif;
  font-size: 22px;
  color: var(--coral);
  font-weight: 600;
  margin-bottom: 14px;
}
.hero p {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.8;
}

.source-cover-feature {
  display: flex;
  align-items: center;
  gap: 22px;
  background: white;
  border-radius: var(--radius-lg);
  padding: 14px;
  margin: -12px 0 24px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.source-cover-feature img {
  display: block;
  width: min(250px, 38%);
  aspect-ratio: 1200 / 829;
  object-fit: cover;
  border-radius: 16px;
}
.source-cover-copy {
  padding: 8px 10px;
}
.source-cover-kicker {
  color: var(--coral);
  font-family: 'Fredoka', sans-serif;
  font-size: 15px;
  font-weight: 600;
}
.source-cover-copy h2 {
  margin: 5px 0 6px;
  font-family: 'Baloo2', sans-serif;
  font-size: 23px;
}
.source-cover-copy p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

/* ---------- Grid of cards (units) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.unit-card {
  border: none;
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: right;
  background: white;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .15s ease;
  position: relative;
  overflow: hidden;
}
.unit-card:hover { transform: translateY(-3px); }
.unit-card .badge {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 19px;
  align-self: flex-start;
}
.unit-card .letters-row {
  font-family: 'Baloo2', sans-serif;
  font-size: 24px;
  font-weight: 700;
  direction: ltr;
  text-align: right;
}
.unit-card .words {
  font-size: 13px;
  color: var(--ink-soft);
  direction: ltr;
  text-align: right;
  line-height: 1.6;
}
.unit-card .meta {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 600;
}

/* ---------- Letter tiles ---------- */
.letters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 12px;
}
.letter-tile {
  border: none;
  border-radius: 18px;
  aspect-ratio: 1;
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-size: 30px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--card-shadow);
  transition: transform .15s ease;
}
.letter-tile:hover { transform: translateY(-3px) scale(1.03); }

/* ---------- Letter detail panel ---------- */
.letter-detail {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--card-shadow);
}
.letter-detail-head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.letter-detail-head .big-letters {
  font-family: 'Fredoka', sans-serif;
  font-size: 64px;
  font-weight: 600;
  color: white;
  width: 110px; height: 110px;
  border-radius: 26px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--card-shadow);
  flex-shrink: 0;
}
.letter-detail-head .unit-tag {
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 14px;
}

.word-list-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.word-card {
  background: var(--cream-2);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: 'Baloo2', sans-serif;
  font-weight: 600;
  font-size: 17px;
  direction: ltr;
  text-align: center;
  color: var(--ink);
}

.audio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.audio-btn {
  background: var(--cream-2);
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--card-shadow);
}
.audio-btn:hover { background: #efe0c4; }
.audio-btn .icon { font-size: 16px; }

.video-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  background: var(--coral, #EE8B6E);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 14px 18px;
  font-weight: 800;
  font-size: 15px;
  font-family: 'Baloo2', sans-serif;
  box-shadow: var(--card-shadow);
  cursor: pointer;
}
.video-btn:hover { filter: brightness(1.05); }

/* ---------- Video modal ---------- */
.video-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 10, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}
.video-modal-box {
  background: var(--cream, #FFF9F0);
  border-radius: 18px;
  max-width: 720px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.video-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-family: 'Baloo2', sans-serif;
  font-size: 16px;
  color: var(--ink);
}
.video-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 4px 8px;
}
.video-modal-body {
  background: black;
  position: relative;
}
.video-modal-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}
.video-modal-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.video-modal-error {
  padding: 40px 24px;
  text-align: center;
  color: white;
  font-size: 14px;
  line-height: 1.7;
}

/* ---------- Book flipbook viewer ---------- */
.book-viewer {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--card-shadow);
}
.book-viewer .page-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream-2);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 320px;
  max-height: 72vh;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.book-viewer img {
  display: block;
  max-width: 100%;
  max-height: 68vh;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(74,50,38,0.18);
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
}
.book-viewer .page-wrap.is-zoomed {
  align-items: flex-start;
  justify-content: flex-start;
  cursor: grab;
  touch-action: none;
}
.book-viewer .page-wrap.is-zoomed:active { cursor: grabbing; }
.page-swipe-hint {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(74,50,38,0.72);
  color: white;
  font-size: 11px;
  pointer-events: none;
  opacity: .85;
  transition: opacity .3s ease;
}
.page-wrap:hover .page-swipe-hint,
.page-wrap.is-zoomed .page-swipe-hint { opacity: 0; }
.viewer-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.viewer-tools button {
  min-width: 42px;
  height: 36px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: var(--cream-2);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(74,50,38,0.12);
}
.viewer-tools button:first-child,
.viewer-tools button:nth-child(3) {
  font-family: 'Fredoka', sans-serif;
  font-size: 22px;
}
.viewer-tools button:last-child { background: var(--ink); color: white; }
.viewer-tools button:disabled { opacity: .35; cursor: default; }
.page-wrap:fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
  background: #201812;
}
.page-wrap:fullscreen img {
  max-height: 92vh;
}
.book-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 16px;
}
.book-controls button {
  background: var(--ink);
  color: white;
  border: none;
  width: 46px; height: 46px;
  border-radius: 50%;
  font-size: 18px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.2);
}
.book-controls button:disabled { opacity: .35; }
.page-indicator {
  font-weight: 700;
  font-family: 'Baloo2', sans-serif;
  min-width: 70px;
  text-align: center;
}

/* ---------- Games ---------- */
.game-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: right;
}
.game-card .icon-badge {
  font-size: 34px;
  width: 60px; height: 60px;
  border-radius: 18px;
  display: flex; align-items:center; justify-content:center;
  color: white;
}
.game-card h3 { margin: 4px 0 0; font-family:'Baloo2'; font-size: 19px; }
.game-card p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height:1.6; }
.game-card .play-btn {
  margin-top: 8px;
  align-self: flex-start;
  background: var(--ink);
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: 999px;
  font-weight: 700;
}

.game-stage {
  background: white;
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--card-shadow);
  text-align: center;
}
.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-weight: 700;
  color: var(--ink-soft);
}
.game-topbar .score { color: var(--teal); }

.training-mode-banner {
  background: #FFF6E5;
  border: 2px dashed var(--gold, #F0B23E);
  color: var(--ink-soft);
  border-radius: 16px;
  padding: 12px 18px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.big-prompt {
  font-family: 'Baloo2', sans-serif;
  font-size: 22px;
  margin-bottom: 24px;
}
.sound-btn {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--coral), var(--rose));
  border: none;
  color: white;
  font-size: 36px;
  box-shadow: 0 6px 0 rgba(74,50,38,0.25);
  margin-bottom: 26px;
}
.sound-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(74,50,38,0.25); }
.word-sound-btn {
  width: auto;
  min-width: 150px;
  height: auto;
  border-radius: 22px;
  padding: 14px 24px;
  font-size: 19px;
}
.word-sound-btn span { font-family: 'Baloo2', sans-serif; }

.choices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 14px;
  max-width: 520px;
  margin: 0 auto;
}
.choice-btn {
  background: var(--cream-2);
  border: 3px solid transparent;
  border-radius: 18px;
  padding: 20px 10px;
  font-family: 'Fredoka', sans-serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
}
.choice-btn.word-choice { font-size: 16px; padding: 18px 10px; }
.choice-btn.correct { background: #CFEFCB; border-color: #6BBF59; }
.choice-btn.wrong { background: #F6C9C0; border-color: #DD6E5B; }
.choice-btn:disabled { opacity: .6; }

.feedback {
  min-height: 30px;
  font-weight: 700;
  margin-top: 18px;
  font-size: 16px;
}
.feedback.good { color: #3C9A44; }
.feedback.bad { color: #C1503C; }

.game-end {
  text-align: center;
}
.game-end .big-score {
  font-family: 'Fredoka', sans-serif;
  font-size: 54px;
  color: var(--coral);
  margin: 6px 0 18px;
}
.restart-btn, .back-btn {
  background: var(--ink);
  color: white;
  border: none;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 700;
  margin: 6px;
}
.back-btn { background: white; color: var(--ink); box-shadow: var(--card-shadow); }

/* Memory game */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
}
.memory-card {
  aspect-ratio: 1;
  border-radius: 14px;
  border: none;
  background: var(--ink);
  color: transparent;
  font-family: 'Fredoka', sans-serif;
  font-size: 26px;
  font-weight: 600;
  display: flex; align-items:center; justify-content:center;
  transition: background .2s;
}
.memory-card.flipped, .memory-card.matched {
  background: white;
  color: var(--ink);
  box-shadow: var(--card-shadow);
}
.memory-card.matched { background: #CFEFCB; }

/* Ordering game */
.order-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 26px;
  min-height: 70px;
}
.order-slot {
  width: 58px; height: 58px;
  border-radius: 14px;
  background: var(--cream-2);
  border: 2px dashed #d9c6a5;
  display: flex; align-items:center; justify-content:center;
  font-family: 'Fredoka';
  font-size: 24px;
}
.order-slot.filled { border-style: solid; border-color: var(--teal); background: white; }
.order-bank {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.order-chip {
  width: 58px; height: 58px;
  border-radius: 14px;
  background: var(--coral);
  color: white;
  border: none;
  font-family: 'Fredoka';
  font-size: 24px;
  font-weight: 600;
  box-shadow: 0 4px 0 rgba(74,50,38,0.2);
}
.order-chip:disabled { opacity: .25; }

/* Word builder */
.word-builder-word {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  min-height: 78px;
  margin: -4px auto 24px;
  color: var(--ink);
  font-family: 'Baloo2', sans-serif;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 2px;
}
.word-builder-word span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
}
.word-builder-word .missing-letter {
  min-width: 42px;
  color: var(--coral);
  border-bottom: 5px dashed var(--coral);
}

/* Letter hunt */
.hunt-target {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 190px;
  margin: 0 auto 24px;
  padding: 10px 20px 10px 14px;
  border: none;
  border-radius: 999px;
  background: var(--cream-2);
  color: var(--ink);
  font-weight: 700;
  box-shadow: var(--card-shadow);
}
.hunt-target-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--rose);
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-size: 25px;
  direction: ltr;
}
.hunt-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(60px, 1fr));
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
}
.hunt-cell {
  aspect-ratio: 1;
  border: 3px solid transparent;
  border-radius: 18px;
  background: var(--cream-2);
  color: var(--ink);
  font-family: 'Fredoka', sans-serif;
  font-size: 26px;
  font-weight: 600;
  transition: transform .15s ease, background .15s ease;
}
.hunt-cell:hover { transform: translateY(-2px); }
.hunt-cell.found { background: #CFEFCB; border-color: #6BBF59; }
.hunt-cell.missed { background: #F6C9C0; border-color: #DD6E5B; animation: shake .2s linear; }
.hunt-cell:disabled { opacity: 1; cursor: default; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  33% { transform: translateX(-4px); }
  66% { transform: translateX(4px); }
}

footer.app-footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 30px 20px 40px;
}
.reset-progress-link {
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 12px;
  text-decoration: underline;
  padding: 6px;
}
.reset-progress-link:hover { color: var(--rose); }
.license-link {
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  padding: 6px;
}
.license-link:hover { color: var(--coral); }

/* ---------- Copyright & license page ---------- */
.license-page { max-width: 900px; margin: 0 auto; }
.license-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 28px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #fff 0%, #F5E9D6 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}
.license-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  border-radius: 22px;
  background: var(--ink);
  color: white;
  font-family: Georgia, serif;
  font-size: 38px;
  box-shadow: 0 5px 0 rgba(74,50,38,0.18);
}
.license-hero h1 {
  margin: 3px 0 4px;
  font-family: 'Baloo2', sans-serif;
  font-size: 27px;
}
.license-hero p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}
.license-owner-card {
  position: relative;
  overflow: hidden;
  padding: 28px;
  margin-bottom: 18px;
  background: white;
  border: 2px solid rgba(238,139,110,0.25);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  text-align: center;
}
.license-owner-card::after {
  content: '©';
  position: absolute;
  left: 24px;
  bottom: -24px;
  color: rgba(238,139,110,0.08);
  font: 120px Georgia, serif;
}
.license-kicker {
  color: var(--coral);
  font-size: 13px;
  font-weight: 800;
}
.license-owner-card h2 {
  margin: 6px 0 0;
  font-family: 'Baloo2', sans-serif;
  font-size: 29px;
}
.license-owner-en {
  margin-top: 2px;
  color: var(--ink-soft);
  font-family: 'Fredoka', sans-serif;
  font-size: 20px;
  letter-spacing: 1px;
}
.license-owner-card p {
  max-width: 680px;
  margin: 16px auto 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.9;
}
.license-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.license-panel {
  padding: 22px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
}
.license-panel-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: var(--cream-2);
  font-size: 22px;
}
.license-panel h2, .license-notice h2 {
  margin: 0 0 8px;
  font-family: 'Baloo2', sans-serif;
  font-size: 19px;
}
.license-panel p, .license-panel li {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.8;
}
.license-panel p { margin: 0; }
.license-panel ul {
  margin: 0;
  padding: 0 20px 0 0;
}
.license-notice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  margin-bottom: 14px;
  background: #FFF7E7;
  border: 1px solid rgba(240,178,62,0.5);
  border-radius: var(--radius-md);
}
.license-notice-icon {
  color: var(--gold);
  font-size: 27px;
  line-height: 1;
}
.license-notice p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.8;
}
.license-bottom-line {
  margin: 22px 0 8px;
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
}
.developer-credit {
  padding: 14px 18px 4px;
  color: var(--ink-soft);
  text-align: center;
}
.developer-credit-label {
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
}
.developer-credit strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
}
.developer-credit small {
  display: block;
  margin-top: 2px;
  font-family: 'Fredoka', sans-serif;
  font-size: 12px;
}

/* ---------- Progress tracking ---------- */
.progress-strip {
  background: white;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--card-shadow);
  margin-bottom: 18px;
}
.progress-strip-label {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 8px;
}
.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--cream-2);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--sage));
  transition: width .3s ease;
}

/* ---------- Parent dashboard ---------- */
.parent-hero { margin-bottom: 18px; }
.parent-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.parent-stat {
  background: white;
  border-radius: var(--radius-md);
  padding: 18px 14px;
  text-align: center;
  box-shadow: var(--card-shadow);
}
.parent-stat strong {
  display: block;
  color: var(--coral);
  font-family: 'Fredoka', sans-serif;
  font-size: 30px;
  line-height: 1.1;
}
.parent-stat strong small {
  font-size: 17px;
  color: var(--ink-soft);
}
.parent-stat span {
  display: block;
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
}
.parent-panel {
  background: white;
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--card-shadow);
}
.parent-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.parent-panel-head h2 {
  margin: 0 0 4px;
  font-family: 'Baloo2', sans-serif;
  font-size: 21px;
}
.parent-panel-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}
.parent-panel-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 16px;
  background: var(--cream-2);
  font-size: 25px;
}
.parent-progress-bar { margin-bottom: 18px; }
.letter-status-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 8px;
}
.letter-status {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 10px;
  font-family: 'Fredoka', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  background: #CFEFCB;
}
.letter-status.review {
  background: #F6C9C0;
  border-color: #DD6E5B;
}
.letter-status.new {
  background: var(--cream-2);
  color: var(--ink-soft);
}
.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}
.status-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #CFEFCB;
}
.legend-dot.review { background: #F6C9C0; border: 1px solid #DD6E5B; }
.legend-dot.new { background: var(--cream-2); border: 1px solid #d9c6a5; }
.parent-games-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.parent-game-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--cream-2);
  border-radius: 14px;
  background: #fffdf9;
  color: var(--ink);
  text-align: right;
}
.parent-game-row:hover { border-color: var(--gold); }
.parent-game-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 12px;
  color: white;
  font-size: 21px;
}
.parent-game-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}
.parent-game-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.parent-game-name small {
  color: var(--ink-soft);
  font-size: 11px;
}
.parent-game-arrow {
  margin-inline-start: auto;
  color: var(--ink-soft);
  font-size: 18px;
}
.parent-letter-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.parent-letter-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--cream-2);
  border-radius: 14px;
  background: #fffdf9;
  color: var(--ink);
  text-align: right;
}
.parent-letter-card:hover { border-color: var(--coral); }
.parent-letter-card > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.parent-letter-card strong { font-size: 13px; }
.parent-letter-card small {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.5;
}
.parent-letter-card > span:last-child {
  margin-inline-start: auto;
  color: var(--ink-soft);
}
.parent-letter-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 13px;
  color: white;
  font-size: 19px;
  font-weight: 600;
}
.parent-empty {
  grid-column: 1 / -1;
  padding: 14px;
  border-radius: 12px;
  background: #F4FAF0;
  color: #3C9A44;
  text-align: center;
  font-weight: 700;
}
.parent-next-action {
  border: none;
  border-radius: 999px;
  background: var(--teal);
  color: white;
  padding: 12px 20px;
  font-weight: 700;
}
.parent-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}
.parent-local-note {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
}

.letter-tile { position: relative; }
.tile-check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 0 rgba(74,50,38,0.15);
}

.best-score-pill {
  display: inline-block;
  align-self: flex-start;
  background: var(--cream-2);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
}

.best-badge {
  font-family: 'Baloo2', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--gold);
  margin-bottom: 6px;
}

.continue-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: linear-gradient(135deg, var(--ink), #3a2419);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 18px;
  box-shadow: var(--card-shadow);
  text-align: right;
  transition: transform .15s ease;
}
.continue-card:hover { transform: translateY(-2px); }
.continue-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.continue-text { display: flex; flex-direction: column; gap: 2px; }
.continue-label { font-size: 12.5px; color: rgba(255,255,255,0.75); font-weight: 700; }
.continue-title { font-family: 'Baloo2', sans-serif; font-size: 17px; font-weight: 700; }

@media (max-width: 640px) {
  .hero h1 { font-size: 30px; }
  .license-hero { align-items: flex-start; padding: 20px; gap: 12px; }
  .license-symbol { flex-basis: 54px; width: 54px; height: 54px; border-radius: 17px; font-size: 30px; }
  .license-hero h1 { font-size: 22px; }
  .license-owner-card { padding: 22px 16px; }
  .license-owner-card h2 { font-size: 24px; }
  .license-grid { grid-template-columns: 1fr; gap: 14px; }
  .letter-detail-head .big-letters { width: 84px; height: 84px; font-size: 46px; }
  main { padding: 20px 14px 70px; }
  .audio-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .audio-row .audio-btn:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .game-stage { padding: 22px 14px; }
  .book-viewer .page-wrap { max-height: 66vh; min-height: 260px; }
  .page-swipe-hint { bottom: 12px; font-size: 10px; }
  .viewer-tools button { height: 34px; padding: 0 10px; }
  .viewer-tools button:last-child span { display: none; }
  .source-cover-feature { align-items: flex-start; gap: 12px; }
  .source-cover-feature img { width: 42%; border-radius: 12px; }
  .source-cover-copy { padding: 2px 0; }
  .source-cover-copy h2 { font-size: 18px; }
  .source-cover-copy p { font-size: 11.5px; }
  .word-builder-word { font-size: 34px; }
  .word-builder-word span { min-width: 28px; }
  .word-builder-word .missing-letter { min-width: 34px; }
  .hunt-grid { gap: 8px; }
  .hunt-cell { border-radius: 14px; font-size: 22px; }
  .parent-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .parent-panel { padding: 18px 14px; }
  .letter-status-grid { grid-template-columns: repeat(7, 1fr); }
  .parent-games-list, .parent-letter-list { grid-template-columns: 1fr; }
  .parent-btn { padding: 10px 12px; }
  .header-actions { gap: 6px; }
  .language-btn { padding: 9px 11px; }
}

@media print {
  body { background: white; }
  .app-header, .section-nav, .parent-actions, .parent-local-note { display: none !important; }
  main { max-width: none; padding: 0; }
  .parent-hero, .parent-panel, .parent-stat { box-shadow: none; border: 1px solid #ddd; }
  .parent-panel { break-inside: avoid; }
}
