/* src/styles.css
 *
 * Dark-first theme, mobile-first layout. Inspired by the reference: a
 * self-contained "lesson card" with header + prompt banner + scene + mode
 * nav footer, sitting on a near-black page background.
 *
 * Type stack:
 *   --font-display-te : Ramaraja (serif Telugu, for headlines)
 *   --font-body-te    : Anek Telugu (variable-weight sans, for UI labels)
 *   --font-en         : Inter (Latin UI)
 *
 * Every colour is a token — no hex values elsewhere in the sheet.
 */

:root {
  color-scheme: dark;

  /* Layered surfaces */
  --page:           #0A0F1C;       /* body / page beyond the card */
  --card:           #12182A;       /* main lesson card */
  --card-border:    #232B44;
  --surface:        #1A2038;       /* elevated surfaces inside card */
  --surface-2:      #232B44;
  --scene-bg:       #1D2233;       /* dark room */
  --scene-floor-1:  #78502F;       /* wooden floor top */
  --scene-floor-2:  #5A3B23;       /* wooden floor bottom */
  --banner:         #182451;       /* prompt banner (indigo) */
  --banner-2:       #21306F;

  /* Text */
  --text:           #EAEEF7;
  --text-muted:     #8B93A7;
  --text-faint:     #5A6178;
  --text-on-banner: #EAEEF7;
  --text-hint:      #A6B0CE;       /* prompt sub-line */

  /* Semantic accents */
  --primary:        #5B9BFF;       /* active blue (like reference "Find it") */
  --primary-hover:  #7BB3FF;
  --primary-soft:   rgba(91, 155, 255, .14);
  --primary-glow:   rgba(91, 155, 255, .35);

  --accent:         #F5A55B;       /* warm gold, for stars and highlights */
  --accent-soft:    rgba(245, 165, 91, .16);

  --success:        #4ADE80;
  --success-strong: #86EFAC;
  --danger:         #F87171;

  /* Type */
  --font-display-te: 'Ramaraja', 'Noto Sans Telugu', 'Telugu Sangam MN', serif;
  --font-body-te:    'Ramaraja', 'Noto Sans Telugu', 'Telugu Sangam MN', serif;
  --font-en:         'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-en-display: 'Playfair Display', 'Inter', serif;

  /* Motion & shape */
  --radius:  18px;
  --radius-lg: 24px;
  --radius-sm: 10px;
  --tap: 52px;
  --shadow:      0 10px 30px rgba(0, 0, 0, .45);
  --shadow-card: 0 24px 60px -20px rgba(0, 0, 0, .7);
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ============================================================ */
/* Reset & base                                                 */
/* ============================================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-en);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  /* Subtle indigo glow pulled toward the top center */
  background:
    radial-gradient(1200px 600px at 50% -100px, rgba(91, 155, 255, .09), transparent 60%),
    var(--page);
}

#root {
  height: 100%;
  padding: max(env(safe-area-inset-top), 12px)
           max(env(safe-area-inset-right), 12px)
           max(env(safe-area-inset-bottom), 12px)
           max(env(safe-area-inset-left), 12px);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

button:disabled { opacity: .35; cursor: not-allowed; }

.te { font-family: var(--font-body-te); }
.te-display { font-family: var(--font-display-te); }
.en { font-family: var(--font-en); }

/* ============================================================ */
/* Boot screen                                                  */
/* ============================================================ */

.boot {
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  text-align: center;
  padding: 24px;
}
.boot-title, .boot-title-2 {
  font-family: var(--font-en-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.boot-title-2 {
  font-style: italic;
  color: var(--accent);
}
.boot-sub {
  font-family: var(--font-en);
  color: var(--text-muted);
  letter-spacing: .22em;
  text-transform: uppercase;
  font-size: .72rem;
  margin-top: 18px;
  font-weight: 600;
}

/* ============================================================ */
/* App frame                                                    */
/* ============================================================ */

.app-frame {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

/* Loading state inside a page */
.loading-inline {
  padding: 40px;
  color: var(--text-muted);
  font-family: var(--font-body-te);
  text-align: center;
}

/* ============================================================ */
/* Home (HouseMap)                                              */
/* ============================================================ */

.home {
  width: 100%;
  max-width: 720px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 12px;
  overflow-y: auto;
}

.home-hero {
  padding: 40px 24px 32px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 30% 20%, rgba(245, 165, 91, .18), transparent 55%),
    linear-gradient(160deg, var(--banner), var(--banner-2));
  border: 1px solid var(--card-border);
  text-align: center;
}

.home-hero-eyebrow {
  font-family: var(--font-en-display);
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--text);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.home-hero-title {
  font-family: var(--font-en-display);
  font-weight: 600;
  font-style: italic;
  font-size: 2rem;
  color: var(--accent);
  line-height: 1.05;
  margin-top: 6px;
  letter-spacing: -0.01em;
}

.home-hero-byline {
  font-family: var(--font-en);
  font-weight: 600;
  font-size: .82rem;
  color: var(--text);
  letter-spacing: .22em;
  text-transform: uppercase;
  margin-top: 20px;
}

.home-hero-publisher {
  font-family: var(--font-en);
  font-style: italic;
  font-size: .82rem;
  color: var(--text-hint);
  margin-top: 6px;
  opacity: .85;
}

.home-hero-progress {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: var(--accent);
  font-family: var(--font-en);
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .02em;
}

@media (min-width: 640px) {
  .home-hero { padding: 56px 32px 40px; }
  .home-hero-eyebrow { font-size: 2rem; }
  .home-hero-title { font-size: 2.6rem; }
}

.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.unit-tile {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  transition: transform .12s var(--ease), border-color .12s var(--ease);
}

.unit-tile:not(.locked):active { transform: scale(.97); border-color: var(--primary); }
.unit-tile.locked { opacity: .45; }
.unit-tile-num {
  font-family: var(--font-en);
  color: var(--text-muted);
  font-size: .75rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.unit-tile-icon { font-size: 2.4rem; line-height: 1; }
.unit-tile-title {
  font-family: var(--font-body-te);
  font-weight: 600;
  color: var(--text);
  font-size: 1.05rem;
}
.unit-tile-lock {
  position: absolute; top: 10px; right: 10px;
  color: var(--text-faint);
}

/* ============================================================ */
/* Lesson card — the reference layout                          */
/* ============================================================ */

.lesson-shell {
  width: 100%;
  max-width: 520px;
  height: 100%;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
}

.lesson-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* -- Header -- */

.lesson-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--card-border);
  background: var(--card);
  min-height: 56px;
}

.lesson-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.lesson-header-back {
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
}

.lesson-header-back:active { color: var(--text); background: var(--surface-2); }

.lesson-header-title {
  font-family: var(--font-en);
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lesson-header-title .sep { color: var(--text-faint); margin: 0 8px; }
.lesson-header-title .sub { color: var(--text-muted); }

.words-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--primary);
  font-family: var(--font-en);
  font-weight: 700;
  font-size: .85rem;
  border: 1px solid transparent;
  transition: background .12s var(--ease);
}

.words-badge:active { background: var(--primary-soft); }

/* -- Prompt banner --
 *
 * Hierarchy per "IAST is the hero" rule:
 *   .prompt-iast → biggest (Inter 700, tracked)
 *   .prompt-te   → smaller Telugu (Anek Telugu, muted)
 *   .prompt-hint → tiniest italic hint
 */

.prompt-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(120deg, var(--banner), var(--banner-2));
  border-bottom: 1px solid var(--card-border);
  color: var(--text-on-banner);
  min-height: 84px;
}

.prompt-avatar {
  flex: 0 0 44px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5A55E0, #3A3695);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display-te);
  font-size: 1.6rem;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}

.prompt-body { flex: 1; min-width: 0; }

.prompt-iast {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--text-on-banner);
  letter-spacing: -0.005em;
}

.prompt-te {
  font-family: var(--font-body-te);
  font-size: 1.35rem;
  line-height: 1;
  color: var(--text-hint);
  margin-top: 8px;
  opacity: .95;
}

.prompt-hint {
  font-family: var(--font-en);
  font-style: italic;
  font-size: .82rem;
  color: var(--text-hint);
  margin-top: 6px;
  opacity: .7;
  line-height: 1;
}

.prompt-speaker {
  flex: 0 0 44px;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, .35);
  color: white;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s var(--ease), transform .12s var(--ease);
}
.prompt-speaker:active { background: rgba(255, 255, 255, .12); transform: scale(.94); }

/* -- Scene canvas -- */

.scene-frame {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--scene-bg);
}

.scene {
  position: absolute;
  inset: 0;
}

.scene-floor {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 32%;
  background: linear-gradient(180deg, var(--scene-floor-1), var(--scene-floor-2));
  border-top: 3px solid #4A2E19;
  box-shadow: inset 0 6px 12px rgba(0, 0, 0, .3);
}

.scene-avatar {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5A55E0, #3A3695);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-family: var(--font-display-te);
  font-size: 1.8rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5);
  pointer-events: none;
  z-index: 3;
}

.hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform .1s var(--ease);
  z-index: 2;
}

.hotspot-art {
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .45));
  transition: transform .12s var(--ease);
}

.hotspot:active .hotspot-art { transform: scale(1.08); }

.hotspot.proximity-far .hotspot-art { transform: scale(.72); }
.hotspot.proximity-far:active .hotspot-art { transform: scale(.78); }

.hotspot.target-glow .hotspot-art {
  filter: drop-shadow(0 0 12px var(--primary-glow)) drop-shadow(0 4px 8px rgba(0, 0, 0, .45));
}

.hotspot-label {
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  max-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  line-height: 1;
  overflow: hidden;
}

.hotspot-label-primary {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: .88rem;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.005em;
}

.hotspot-label-secondary {
  font-family: var(--font-body-te);
  font-size: .9rem;
  color: var(--text-hint);
  white-space: nowrap;
  line-height: 1;
}

.hotspot-label.en .hotspot-label-secondary {
  font-family: var(--font-en);
  font-style: italic;
  color: var(--text-muted);
}

.hotspot-label.masked {
  background: rgba(91, 155, 255, .18);
  border: 1px solid rgba(91, 155, 255, .4);
}
.hotspot-label.masked .hotspot-label-primary {
  color: var(--primary);
  font-size: 1.1rem;
}

/* -- Mode nav (bottom) -- */

.mode-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 12px 12px 14px;
  border-top: 1px solid var(--card-border);
  background: var(--card);
}

.mode-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 10px 8px;
  border-radius: 14px;
  border: 1.5px solid var(--card-border);
  background: transparent;
  color: var(--text);
  font-family: var(--font-en);
  font-weight: 600;
  font-size: .88rem;
  transition: border-color .12s var(--ease), background .12s var(--ease), color .12s var(--ease);
}

.mode-nav-btn:active { transform: scale(.97); }
.mode-nav-btn:disabled { opacity: .32; cursor: not-allowed; }

.mode-nav-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* ============================================================ */
/* Explore-mode phrase card                                     */
/* ============================================================ */

.phrase-inline {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: rgba(10, 15, 28, .85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
  animation: slide-up .18s var(--ease);
}

@keyframes slide-up {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

.phrase-inline-body { flex: 1; min-width: 0; }
.phrase-inline-te {
  font-family: var(--font-display-te);
  font-size: 1.5rem;
  color: var(--text);
  line-height: 1.1;
}
.phrase-inline-sub {
  font-family: var(--font-en);
  font-size: .82rem;
  color: var(--text-hint);
  font-style: italic;
  margin-top: 2px;
}
.phrase-inline-speaker {
  flex: 0 0 40px;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
}
.phrase-inline-speaker:active { transform: scale(.94); }

/* ============================================================ */
/* Produce (Say it) — tiles inside the card                    */
/* ============================================================ */

.produce-wrapper {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  gap: 8px;
  overflow-y: auto;
}

.produce-target {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}

.produce-target-art { flex: 0 0 auto; }
.produce-target-info { flex: 1; min-width: 0; }
.produce-target-hint {
  font-family: var(--font-en);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.produce-target-hint .te-hint {
  font-family: var(--font-body-te);
  font-size: 1.25em;
  color: var(--primary);
  margin-right: 8px;
}

.assembly {
  display: flex;
  gap: 6px;
  padding: 10px;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .04);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius);
}

.assembly-slot {
  padding: 6px 16px;
  border-radius: 10px;
  min-width: 96px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  line-height: 1;
  color: var(--text-faint);
}
.assembly-slot.filled { color: var(--text); background: var(--surface); padding: 8px 18px; }

.assembly-iast {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.assembly-te {
  font-family: var(--font-body-te);
  font-size: 1.2rem;
  color: var(--text-muted);
  min-height: 1em;
  line-height: 1;
}

.tile-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tile-row-label {
  font-family: var(--font-en);
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-left: 4px;
  font-weight: 600;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
/* DEM grid — only two options, so cap column width so tiles don't sprawl
 * on wide screens. Center the pair. */
.tile-grid.dem {
  grid-template-columns: repeat(2, minmax(0, 180px));
  justify-content: center;
}
/* Human DEM grid — 4 tiles (āyana/īyana/āme/īme). 2×2 on mobile, 4-across on tablet. */
.tile-grid.dem-human {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 480px) {
  .tile-grid.nouns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tile-grid.dem-human { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.tile {
  padding: 14px 8px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1.5px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform .12s var(--ease), border-color .12s var(--ease), background .12s var(--ease);
}
.tile:active { transform: scale(.96); }
.tile.picked { border-color: var(--primary); background: var(--primary-soft); }

.tile-iast-hero {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.01em;
}
.tile-iast-hero.small { font-size: 1.15rem; }

.tile-te-sub {
  font-family: var(--font-body-te);
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1;
}

.tile-en-tiny {
  font-family: var(--font-en);
  font-style: italic;
  font-size: .72rem;
  color: var(--text-hint);
  line-height: 1;
  margin-top: 3px;
}

.tile-emoji { font-size: 1.6rem; line-height: 1; }

.submit-btn {
  margin-top: 4px;
  padding: 14px 20px;
  border-radius: 14px;
  background: var(--primary);
  color: white;
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .02em;
  min-height: var(--tap);
}
.submit-btn:active { transform: scale(.98); }

/* ============================================================ */
/* Feedback overlay                                             */
/* ============================================================ */

.feedback-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  animation: fb-in .2s var(--ease);
  pointer-events: none;
}

.feedback-overlay .fb-panel {
  padding: 24px 28px;
  border-radius: var(--radius);
  background: rgba(10, 15, 28, .92);
  border: 1px solid;
  text-align: center;
  min-width: 220px;
}
.feedback-right .fb-panel { border-color: var(--success); }
.feedback-wrong .fb-panel { border-color: var(--danger); }

.fb-icon {
  width: 56px; height: 56px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--card);
}
.feedback-right .fb-icon { background: var(--success); }
.feedback-wrong .fb-icon { background: var(--danger); }

.fb-line {
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.feedback-right .fb-line { color: var(--success-strong); }
.feedback-wrong .fb-line { color: var(--danger); }

.fb-answer-iast {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 1.7rem;
  color: var(--text);
  margin-top: 8px;
  letter-spacing: -0.01em;
}

@keyframes fb-in {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* Round progress dots (Comprehend) */
.round-dots {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  z-index: 4;
}
.round-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255, 255, 255, .25);
}
.round-dot.done { background: var(--success); }
.round-dot.miss { background: var(--danger); }
.round-dot.current { background: var(--primary); box-shadow: 0 0 0 3px rgba(91, 155, 255, .25); }

/* Round-complete card */
.round-done {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: rgba(10, 15, 28, .95);
  text-align: center;
  z-index: 30;
}
.round-done-title {
  font-family: var(--font-display-te);
  font-size: 2.2rem;
  color: var(--accent);
}
.round-done-sub {
  font-family: var(--font-en);
  font-size: 1rem;
  color: var(--text-muted);
}
.round-done .submit-btn { max-width: 240px; }

/* ============================================================ */
/* Words collection                                             */
/* ============================================================ */

.words-page {
  width: 100%;
  max-width: 720px;
  height: 100%;
  padding: 12px;
  overflow-y: auto;
}

.words-header { padding: 12px 8px 16px; }
.words-title {
  font-family: var(--font-display-te);
  font-size: 2.4rem;
  color: var(--text);
}
.words-sub {
  font-family: var(--font-en);
  color: var(--text-muted);
  margin-top: 2px;
}

.words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.word-card {
  padding: 16px 8px 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--card-border);
  display: flex; flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color .12s var(--ease);
}
.word-card.uncaptured { opacity: .6; }
.word-card.captured { border-color: rgba(74, 222, 128, .3); }

.word-card-art { opacity: 1; margin-bottom: 4px; }
.word-card.uncaptured .word-card-art { filter: grayscale(.6) opacity(.55); }

.word-card-iast {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.005em;
  line-height: 1;
}
.word-card.uncaptured .word-card-iast { color: var(--text-muted); }

.word-card-te {
  font-family: var(--font-body-te);
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1;
}
.word-card-en {
  font-family: var(--font-en);
  font-style: italic;
  font-size: .82rem;
  color: var(--text-hint);
  line-height: 1;
}

.fb-answer-te {
  font-family: var(--font-body-te);
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1;
}

/* ============================================================ */
/* Tablet refinements                                           */
/* ============================================================ */

@media (min-width: 768px) {
  #root { padding: 24px; }
  .lesson-shell { max-width: 640px; }
  .prompt-iast { font-size: 2.2rem; }
  .prompt-te { font-size: 1.5rem; }
  .hotspot-label-primary { font-size: .95rem; }
  .hotspot-label-secondary { font-size: 1rem; }
  .assembly-iast { font-size: 2rem; }
  .assembly-te { font-size: 1.35rem; }
  .tile-iast-hero { font-size: 1.55rem; }
  .tile-iast-hero.small { font-size: 1.25rem; }
  .tile-te-sub { font-size: 1.3rem; }
}

/* ============================================================ */
/* Drills mode — book DRILLS + EXERCISES                        */
/* ============================================================ */

.drills-shell {
  padding: 14px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: calc(100vh - 260px);
}

.drills-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
}
.drills-empty-title { font-size: 1.05rem; margin-bottom: 6px; color: var(--text); }
.drills-empty-sub   { font-size: .88rem; }

.drill-card {
  border: 1.5px solid var(--card-border);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}
.drill-card.open { border-color: var(--primary); }

.drill-card-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: var(--font-en);
  text-align: left;
  cursor: pointer;
}

.drill-badge {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  white-space: nowrap;
}
.drill-badge.type-substitution   { background: rgba(91,155,255,.12); color: #86b5ff; }
.drill-badge.type-response       { background: rgba(226,140,86,.14); color: #f2b28b; }
.drill-badge.type-fill-blank     { background: rgba(120,205,150,.14); color: #9fddb7; }
.drill-badge.type-transformation { background: rgba(200,140,220,.14); color: #d7b3e6; }

.drill-title {
  flex: 1;
  font-weight: 600;
  font-size: .95rem;
}
.drill-bookref {
  font-size: .72rem;
  color: var(--text-muted);
  font-style: italic;
}
.drill-chevron { color: var(--text-muted); font-size: .8rem; }

.drill-card-body { padding: 0 14px 16px; }

.drill-model {
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  margin-bottom: 14px;
}
.drill-model-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.drill-model-body { line-height: 1.55; }
.drill-model-iast { font-weight: 700; font-family: var(--font-en); font-size: 1.05rem; }
.drill-model-te   { font-family: var(--font-body-te); font-size: 1.35rem; margin-top: 2px; }
.drill-model-en   { color: var(--text-muted); font-style: italic; font-size: .85rem; margin-top: 4px; }
.drill-model-arrow { color: var(--text-muted); text-align: center; margin: 6px 0; }

.drill-progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 14px;
}

.drill-prompt {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(91,155,255,.06);
  margin-bottom: 12px;
  line-height: 1.5;
}
.drill-prompt-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-right: 8px;
}
.drill-prompt-iast { font-family: var(--font-en); font-weight: 700; font-size: 1.05rem; }
.drill-prompt-te   { font-family: var(--font-body-te); font-size: 1.35rem; }
.drill-prompt-cue  { font-family: var(--font-en); font-weight: 700; color: var(--primary); }
.drill-prompt-cue-te { font-family: var(--font-body-te); color: var(--primary); margin-left: 8px; }
.drill-prompt-cue-row { margin-top: 6px; }
.drill-prompt-line { margin-bottom: 6px; }

.drill-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 380px) {
  .drill-choices { grid-template-columns: 1fr; }
}

.drill-choice {
  padding: 12px 10px;
  border: 1.5px solid var(--card-border);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  line-height: 1.35;
  transition: all .15s var(--ease);
}
.drill-choice:disabled { cursor: default; }
.drill-choice.correct { border-color: #6ecf8a; background: rgba(110,207,138,.12); }
.drill-choice.wrong   { border-color: #e56b6f; background: rgba(229,107,111,.12); }
.drill-choice.faded   { opacity: .4; }

.drill-choice-iast { font-family: var(--font-en); font-weight: 700; font-size: 1rem; }
.drill-choice-te   { font-family: var(--font-body-te); font-size: 1.2rem; margin-top: 2px; }
.drill-choice-en   { font-size: .72rem; color: var(--text-muted); font-style: italic; margin-top: 2px; }

.drill-feedback {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  font-family: var(--font-en);
}
.drill-feedback.feedback-right { background: rgba(110,207,138,.12); color: #9fddb7; }
.drill-feedback.feedback-wrong { background: rgba(229,107,111,.12); color: #f0a6a8; }
.drill-fb-answer { display: block; font-size: .9rem; margin-top: 2px; }
.drill-fb-iast   { font-weight: 700; }
.drill-fb-te     { font-family: var(--font-body-te); }

.drill-done {
  padding: 24px;
  text-align: center;
}
.drill-done-score { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.drill-done-sub   { color: var(--text-muted); margin-bottom: 14px; }

.drill-placeholder {
  padding: 20px 14px;
  color: var(--text-muted);
  text-align: center;
  font-size: .9rem;
}
.drill-placeholder .drill-note { margin-top: 8px; font-style: italic; }
