@font-face {
  font-family: 'Arial Black Local';
  src: local('Arial Black'), url('../../assets/fonts/ArialBlack.ttf') format('truetype');
  font-weight: 900;
}

:root {
  --bg: #f6f8fc;
  --bg-warm: #fffdf7;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;

  /* Child-friendly primary palette */
  --blue: #1d4ed8;
  --blue-dark: #1e3a8a;
  --blue-soft: #eff6ff;

  --coral: #e11d48;
  --coral-dark: #9f1239;
  --coral-soft: #fff1f2;

  --green: #059669;
  --green-dark: #065f46;
  --green-soft: #ecfdf5;

  --amber: #d97706;
  --amber-dark: #92400e;
  --amber-soft: #fffbeb;

  --purple: #6d28d9;
  --purple-dark: #4c1d95;
  --purple-soft: #f5f3ff;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 20px -4px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 18px 36px -8px rgba(15, 23, 42, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

/* ==========================================================================
   Top Kid-First Header & Primary Zone Navigation
   ========================================================================== */
.top-header {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-inline-size: 1440px;
  margin-inline: auto;
  padding-block: 12px;
  padding-inline: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "brand nav switch";
  align-items: safe center;
  gap: 10px 16px;
}

.brand {
  grid-area: brand;
  min-inline-size: 0;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  inline-size: 48px;
  block-size: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
  color: #ffffff;
  font-weight: 900;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 #172554;
  flex-shrink: 0;
}

.brand-title {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
  white-space: nowrap;
}

.brand-subtitle {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Main 5-Zone Navigation */
.main-nav {
  grid-area: nav;
  display: flex;
  flex-wrap: nowrap;
  align-items: safe center;
  gap: 7px;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-block: 8px;
  padding-inline: 13px;
  border-radius: 13px;
  border: 2px solid var(--border-strong);
  border-bottom-width: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.nav-pill svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-pill:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.nav-pill:active {
  transform: translateY(2px);
}

.nav-pill[aria-current="page"][data-view="atlas"] {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue-dark);
}

.nav-pill[aria-current="page"][data-view="coloring"] {
  background: var(--coral);
  color: #ffffff;
  border-color: var(--coral-dark);
}

.nav-pill[aria-current="page"][data-view="games"] {
  background: var(--green);
  color: #ffffff;
  border-color: var(--green-dark);
}

.nav-pill[aria-current="page"][data-view="passport"] {
  background: var(--amber);
  color: #ffffff;
  border-color: var(--amber-dark);
}

.nav-pill[aria-current="page"][data-view="parents"] {
  background: var(--purple);
  color: #ffffff;
  border-color: var(--purple-dark);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  background: rgba(15, 23, 42, 0.1);
}

.nav-pill[aria-current="page"] .nav-badge {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

/* ЋИР / LAT Switcher */
.script-switch {
  grid-area: switch;
  justify-self: end;
  flex-shrink: 0;
  display: inline-flex;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
}

.script-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 900;
  min-inline-size: 48px;
  text-align: center;
  padding-block: 6px;
  padding-inline: 10px;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.14s ease;
}

.script-btn.active {
  background: var(--text);
  color: #ffffff;
}

@media (max-width: 1250px) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand brand"
      "nav   switch";
  }
}

@media (max-width: 960px) {
  .header-inner {
    padding-inline: 16px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand switch"
      "nav   nav";
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-pill {
    justify-content: center;
    padding-inline: 10px;
    font-size: 13px;
  }

  .brand-subtitle {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .main-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-nav .nav-pill:last-child {
    grid-column: 1 / -1;
  }
}

/* ==========================================================================
   Shared View Shell & Tactile Buttons
   ========================================================================== */
.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 24px 72px;
}

.view-section[hidden] {
  display: none !important;
}

.section-hero {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-hero h2 {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.section-hero p {
  font-size: 14.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.kid-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  border-bottom-width: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.14s ease, border-color 0.14s ease;
}

.kid-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.kid-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.kid-btn:active {
  transform: translateY(2px);
}

.kid-btn-blue {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue-dark);
}
.kid-btn-blue:hover {
  background: #2563eb;
  border-color: var(--blue-dark);
}

.kid-btn-coral {
  background: var(--coral);
  color: #ffffff;
  border-color: var(--coral-dark);
}
.kid-btn-coral:hover {
  background: #f43f5e;
  border-color: var(--coral-dark);
}

.kid-btn-green {
  background: var(--green);
  color: #ffffff;
  border-color: var(--green-dark);
}
.kid-btn-green:hover {
  background: #10b981;
  border-color: var(--green-dark);
}

.kid-btn-amber {
  background: var(--amber-soft);
  color: var(--amber-dark);
  border-color: #f59e0b;
}
.kid-btn-amber:hover {
  background: #fef3c7;
}

.kid-btn-purple {
  background: var(--purple);
  color: #ffffff;
  border-color: var(--purple-dark);
}
.kid-btn-purple:hover {
  background: #7c3aed;
  border-color: var(--purple-dark);
}

/* ==========================================================================
   VIEW 1: ИСТРАЖИ ЗАСТАВЕ (Kid-Friendly Colorful Flag Atlas)
   ========================================================================== */
.atlas-filters {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Audience / Difficulty Tier Pills */
.tier-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.14s ease;
}

.tier-pill svg {
  width: 15px;
  height: 15px;
}

.tier-pill.active {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border-color: var(--blue);
}

/* Continent Visual Chips */
.continent-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cont-chip {
  padding: 7px 14px;
  border-radius: 11px;
  border: 2px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.12s ease;
}

.cont-chip:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
}

.cont-chip.active {
  background: var(--text);
  color: #ffffff;
  border-color: var(--text);
}

.cont-chip span {
  opacity: 0.72;
  font-size: 11.5px;
  margin-left: 3px;
}

/* Search + Counter Row */
.search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.search-box {
  position: relative;
  flex: 1 1 280px;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  outline: none;
}

.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

.shown-badge {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 7px 14px;
  border-radius: 999px;
}

/* Azbuka / Abeceda Bar */
.azbuka-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.azbuka-btn {
  min-width: 38px;
  height: 36px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: all 0.12s ease;
}

.azbuka-btn:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.azbuka-btn.active {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue-dark);
}

.azbuka-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.azbuka-count {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.78;
}

/* Colorful Kid-First Flag Cards Grid */
.atlas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
  gap: 20px;
}

/* Defer offscreen cards (strictly applied only to cards outside initial viewport, idx >= 12) */
.atlas-card-deferred {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 385px;
}

.atlas-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.atlas-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.atlas-card.is-learned {
  border-color: #f59e0b;
}

.atlas-card-head {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.letter-pill {
  font-family: 'Arial Black Local', 'Arial Black', sans-serif;
  font-size: 14px;
  font-weight: 900;
  color: var(--blue-dark);
  background: #dbeafe;
  padding: 3px 10px;
  border-radius: 8px;
}

.continent-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.star-toggle {
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: #64748b;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.14s ease;
}

.star-toggle svg {
  width: 15px;
  height: 15px;
}

.star-toggle.active {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.star-toggle.active svg {
  fill: #f59e0b;
  stroke: #b45309;
}

/* Vibrant Flag Stage */
.atlas-flag-stage {
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.atlas-flag-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(15, 23, 42, 0.16);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.14);
  background: #ffffff;
  display: block;
}

.atlas-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.atlas-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.atlas-country-name {
  font-size: 19px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.2;
}

.atlas-capital {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 2px;
}

.color-dots-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 4px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}

.swatch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #0f172a;
}

.atlas-story {
  font-size: 13px;
  line-height: 1.42;
  color: #1e293b;
  background: var(--bg-warm);
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  padding: 8px 10px;
  border-radius: 8px;
}

.atlas-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.card-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 2px solid var(--border-strong);
  border-bottom-width: 3px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.12s ease;
}

.card-action-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.card-action-speak {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border-color: #93c5fd;
}
.card-action-speak:hover {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue-dark);
}

.card-action-color {
  background: var(--coral-soft);
  color: var(--coral-dark);
  border-color: #fda4af;
}
.card-action-color:hover {
  background: var(--coral);
  color: #ffffff;
  border-color: var(--coral-dark);
}

.card-action-print {
  padding: 9px 11px;
  background: #f8fafc;
  color: var(--text-muted);
}
.card-action-print:hover {
  background: var(--purple-soft);
  color: var(--purple-dark);
  border-color: #c4b5fd;
}

/* ==========================================================================
   VIEW 2: БОЈАНКА НА ЕКРАНУ (Full Interactive Coloring Studio)
   ========================================================================== */
.studio-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 22px;
  align-items: start;
}

@media (max-width: 980px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }
}

.studio-sidebar {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.studio-flag-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 540px;
  overflow-y: auto;
  padding-right: 4px;
}

.studio-pick-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
}

.studio-pick-btn:hover {
  background: var(--blue-soft);
  border-color: #93c5fd;
}

.studio-pick-btn.active {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue-dark);
}

.studio-pick-btn img {
  width: 38px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  background: #fff;
  flex-shrink: 0;
}

.studio-main {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.studio-top-card {
  width: 100%;
  background: var(--bg-warm);
  border: 2px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.studio-ref-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.studio-ref-img {
  width: 116px;
  height: 87px;
  object-fit: cover;
  border-radius: 8px;
  border: 2.5px solid var(--text);
  background: #fff;
}

.crayon-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  background: #f8fafc;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
}

.crayon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 3px solid var(--border-strong);
  background: var(--surface);
  font-size: 14px;
  font-weight: 900;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.crayon-btn.needed-hint {
  border-color: #94a3b8;
}

.crayon-btn.active {
  border-color: var(--text);
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.16);
}

.crayon-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #0f172a;
}

.canvas-board {
  width: 100%;
  max-width: 620px;
  aspect-ratio: 4 / 3;
  border: 4px solid var(--text);
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.canvas-board svg {
  width: 100%;
  height: 100%;
  display: block;
}

.word-coloring-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.hollow-letter {
  font-family: 'Arial Black Local', 'Arial Black', sans-serif;
  font-size: 42px;
  font-weight: 900;
  padding: 2px 12px;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  color: #ffffff;
  -webkit-text-stroke: 2.4px #0f172a;
  transition: transform 0.1s ease;
}

.hollow-letter:hover {
  transform: scale(1.08);
  border-color: var(--coral);
}

/* ==========================================================================
   VIEW 3: ИГРАОНИЦА (3 Kid Games: Guess Flag, Missing Color, Memory Flip)
   ========================================================================== */
.game-mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.game-picker-card {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-bottom-width: 4px;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.14s ease;
}

.game-picker-card.active {
  background: var(--green-soft);
  border-color: var(--green);
}

.game-picker-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #e2e8f0;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.game-picker-card.active .game-picker-icon {
  background: var(--green);
  color: #ffffff;
}

.game-picker-icon svg {
  width: 24px;
  height: 24px;
}

.game-arena {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.quiz-choices-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  width: 100%;
  max-width: 720px;
}

@media (max-width: 600px) {
  .quiz-choices-grid {
    grid-template-columns: 1fr;
  }
}

.quiz-choice-btn {
  background: #ffffff;
  border: 3px solid var(--border-strong);
  border-bottom-width: 5px;
  border-radius: 18px;
  padding: 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.quiz-choice-btn:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
}

.quiz-choice-btn.correct {
  border-color: var(--green);
  background: var(--green-soft);
}

.quiz-choice-btn.wrong {
  border-color: var(--coral);
  background: var(--coral-soft);
  opacity: 0.6;
}

.quiz-choice-btn img {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(15, 23, 42, 0.14);
}

/* Memory Game Board (4x3 = 12 cards) */
.memory-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 165px));
  gap: 14px;
  justify-content: center;
  width: 100%;
}

@media (max-width: 640px) {
  .memory-board {
    grid-template-columns: repeat(3, 1fr);
  }
}

.memory-card {
  aspect-ratio: 4 / 3.4;
  border-radius: 16px;
  border: 3px solid var(--blue-dark);
  border-bottom-width: 5px;
  background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
  color: #ffffff;
  cursor: pointer;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.memory-card:hover {
  transform: translateY(-2px);
}

.memory-card.revealed,
.memory-card.matched {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border-strong);
}

.memory-card.matched {
  border-color: var(--green);
  background: var(--green-soft);
}

.memory-card img {
  width: 100%;
  max-height: 78px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

.memory-card-label {
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  line-height: 1.15;
}

/* ==========================================================================
   VIEW 4: МОЈ ПАСОШ (Explorer Ranks, Continent Progress & Stickers)
   ========================================================================== */
.rank-banner {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px solid #fcd34d;
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.continent-progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.cont-progress-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.progress-track {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 999px;
  transition: width 0.3s ease;
}

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

.sticker-item {
  background: var(--surface);
  border: 2px solid #fcd34d;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.sticker-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
}

/* ==========================================================================
   VIEW 5: ЗА РОДИТЕЉЕ — A4 ШТАМПАОНИЦА (Clean Parent Print Hub)
   ========================================================================== */
.print-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.worksheet-type-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.14s ease;
}

.worksheet-type-card:hover {
  border-color: var(--purple);
}

.worksheet-type-card.active {
  border-color: var(--purple);
  background: var(--purple-soft);
  box-shadow: var(--shadow-sm);
}

.worksheet-type-card img {
  width: 100%;
  aspect-ratio: 2480 / 3508;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
}

.parent-Print-table {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.batch-card {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.batch-card.selected {
  border: 2px solid var(--purple);
  background: var(--purple-soft);
}

.batch-card img {
  width: 100%;
  aspect-ratio: 2480 / 3508;
  object-fit: contain;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
}

/* ==========================================================================
   Native <dialog> Modal Styling (Modern Web Guidance Compliant)
   ========================================================================== */
dialog {
  margin: auto;
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 920px;
  width: min(94vw, 920px);
  max-height: 92vh;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

/* Scope display strictly to [open] so closed dialogs never show */
dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(3px);
}

.dialog-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-body {
  padding: 20px 22px;
  overflow-y: auto;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.dialog-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
}

.sheet-preview-img {
  max-width: 100%;
  max-height: 64vh;
  width: auto;
  height: auto;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
  border-radius: 4px;
}

/* ==========================================================================
   Dedicated Single-Sheet A4 Print Rules (Zero Trailing Blank Page)
   ========================================================================== */
#print-area {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  html,
  body {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: #ffffff !important;
    overflow: visible !important;
  }

  body > *:not(#print-area) {
    display: none !important;
  }

  #print-area {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .print-page {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
    font-size: 0 !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    overflow: hidden !important;
  }

  .print-page + .print-page {
    break-before: page !important;
    page-break-before: always !important;
  }

  .print-page img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 270mm !important;
    margin: 0 auto !important;
    object-fit: contain !important;
  }
}
