:root {
  --bg: #fff7dc;
  --card: #ffffff;
  --text: #2d2a32;
  --muted: #6d6875;
  --primary: #ff8fab;
  --primary-dark: #fb6f92;
  --yellow: #ffd166;
  --blue: #90dbf4;
  --green: #b9fbc0;
  --purple: #cdb4db;
  --bg-a: #ffcad4;
  --bg-b: #bde0fe;
  --panel: rgba(255, 255, 255, 0.72);
  --shadow: 0 18px 40px rgba(45, 42, 50, 0.14);
  --menu-height: clamp(58px, 9svh, 74px);
  --page-pad: clamp(10px, 2svh, 18px);
  --gap: clamp(10px, 2svh, 18px);
  --cursor-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cpath d='M8 5l25 23-13 1-6 10z' fill='%23fff' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 8 5, default;
  --theme-bg-icons: "🌈  🎈  ⭐  📚  🎨  🌈  🎈  ⭐  📚  🎨";
}

* {
  box-sizing: border-box;
  cursor: var(--cursor-default);
}

html {
  min-height: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  height: auto;
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--bg-a) 0, transparent 28%),
    radial-gradient(circle at bottom right, var(--bg-b) 0, transparent 32%),
    var(--bg);
  overflow: auto;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: var(--theme-bg-icons);
  display: grid;
  place-items: center;
  padding: 8svh 4vw;
  color: rgba(45, 42, 50, 0.18);
  font-size: clamp(3rem, 9vw, 8rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  line-height: 1.6;
  text-align: center;
  white-space: pre-wrap;
  opacity: 0.18;
  filter: saturate(1.12);
}

button {
  cursor: pointer;
  font-family: inherit;
  transition:
    transform 170ms ease,
    filter 170ms ease,
    background 170ms ease,
    box-shadow 170ms ease;
}

a,
select,
label,
[role="button"],
.home-card,
.home-card *,
.home-quiz-btn,
.home-quiz-btn *,
.letter-card,
.quiz-option,
.quiz-option *,
.theme-choice,
.theme-choice *,
.menu-btn,
.menu-btn *,
.action-btn,
.action-btn *,
.coloring-link,
.coloring-link * {
  cursor: pointer;
}

button:not(:disabled):hover {
  filter: saturate(1.08) brightness(1.02);
}

.top-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(6px, 1vw, 10px);
  height: var(--menu-height);
  min-height: var(--menu-height);
  padding: 8px 14px;
  background: rgba(255, 247, 220, 0.9);
  border-bottom: 4px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 28px rgba(45, 42, 50, 0.1);
  backdrop-filter: blur(10px);
}

.menu-btn,
.about-close {
  border: 0;
  border-radius: 18px;
  background: var(--text);
  color: white;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, filter 160ms ease;
}

.menu-btn {
  min-height: clamp(38px, 5.8svh, 48px);
  padding: 0 clamp(10px, 1.8vw, 16px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.brand-menu {
  padding-left: 8px;
}

.menu-logo {
  width: clamp(28px, 4.8svh, 40px);
  height: clamp(28px, 4.8svh, 40px);
  flex: 0 0 auto;
  border-radius: 12px;
}

.menu-btn.active {
  background: var(--yellow);
  color: var(--text);
}

.icon-menu {
  min-width: clamp(76px, 8vw, 94px);
  font-size: 1rem;
}

.language-field,
.select-field {
  min-height: clamp(38px, 5.8svh, 48px);
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 18px;
  background: var(--text);
  color: white;
  box-shadow: var(--shadow);
}

.language-select,
.menu-select {
  max-width: clamp(118px, 14vw, 190px);
  border: 0;
  background: transparent;
  color: white;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 900;
  outline: 0;
  cursor: pointer;
}

.page-field .menu-select {
  max-width: clamp(124px, 12vw, 160px);
}

.language-select option,
.menu-select option {
  color: var(--text);
}

.about-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 35;
  width: min(720px, calc(100vw - 28px));
  padding: clamp(50px, 6vw, 64px) clamp(24px, 5vw, 46px) clamp(24px, 5vw, 46px);
  border: 5px solid white;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  text-align: center;
  max-height: calc(100svh - 28px);
  overflow: auto;
}

.about-panel h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.about-brand {
  display: inline-grid;
  justify-items: center;
  gap: 8px;
}

.about-logo {
  width: clamp(58px, 9svh, 88px);
  height: clamp(58px, 9svh, 88px);
  filter: drop-shadow(0 10px 12px rgba(45, 42, 50, 0.14));
}

.about-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: auto;
  min-width: 74px;
  height: 42px;
  padding-inline: 14px;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
}

.about-panel.info-page {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  z-index: 1;
  width: min(1120px, 100%);
  min-height: calc(100svh - var(--menu-height) - (var(--page-pad) * 2));
  max-height: none;
  margin: 0 auto;
  padding: clamp(18px, 3svh, 34px);
  display: grid;
  align-content: center;
  gap: clamp(10px, 2svh, 18px);
  background: rgba(255, 255, 255, 0.84);
  overflow: visible;
}

.about-panel.info-page.hidden {
  display: none;
}

.info-page .about-close {
  top: clamp(12px, 2svh, 22px);
  right: clamp(12px, 2svh, 22px);
}

.info-page .about-brand {
  gap: 4px;
}

.info-page .about-logo {
  width: clamp(62px, 10svh, 104px);
  height: clamp(62px, 10svh, 104px);
}

.info-page .subtitle {
  max-width: 880px;
  margin: 0 auto;
  font-size: clamp(1rem, 2.1svh, 1.25rem);
  line-height: 1.25;
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(var(--menu-height) + var(--page-pad)) var(--page-pad) var(--page-pad);
  display: grid;
  grid-template-rows: minmax(0, 0.38fr) minmax(0, 0.62fr);
  gap: var(--gap);
  overflow: visible;
}

.app.quiz-mode {
  width: 100%;
  padding: calc(var(--menu-height) + var(--page-pad)) var(--page-pad) var(--page-pad);
  display: block;
}

.app.theme-dock-mode {
  grid-template-rows: minmax(0, 0.35fr) minmax(0, 0.55fr) auto;
}

.app.quiz-mode.theme-dock-mode {
  min-height: 100svh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--gap);
}

.app.quiz-mode.theme-dock-mode .quiz-panel {
  min-height: 0;
}

.app.home-mode {
  display: block;
}

.app.info-mode {
  display: block;
}

.app.quiz-mode .display-card,
.app.quiz-mode .letters-section {
  display: none;
}

body.lesson-theme-bg::after {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.5)),
    var(--lesson-bg-image);
  background-position: center;
  background-size: cover;
  opacity: 0.76;
}

body.theme-changing::after {
  animation: page-theme-shift 950ms ease-out both;
}

body.lesson-theme-bg::before {
  display: none;
}

body[data-lesson-theme="home"] {
  --lesson-bg-image: url("assets/themes/home.png");
}

body[data-lesson-theme="mix"] {
  --lesson-bg-image: url("assets/themes/mix.png");
}

body[data-lesson-theme="numbers"] {
  --lesson-bg-image: url("assets/themes/numbers.svg");
}

body[data-lesson-theme="animals"] {
  --lesson-bg-image: url("assets/themes/animals.png");
}

body[data-lesson-theme="food_drink"] {
  --lesson-bg-image: url("assets/themes/food-drink.png");
}

body[data-lesson-theme="school_home"] {
  --lesson-bg-image: url("assets/themes/school-home.png");
}

body[data-lesson-theme="nature_weather"] {
  --lesson-bg-image: url("assets/themes/nature-weather.png");
}

body[data-lesson-theme="travel_transport"] {
  --lesson-bg-image: url("assets/themes/travel-transport.png");
}

body[data-lesson-theme="country_flags"] {
  --lesson-bg-image: url("assets/themes/country-flags.png");
}

body[data-lesson-theme="seasons"] {
  --lesson-bg-image: url("assets/themes/seasons.svg");
}

body[data-lesson-theme="months"] {
  --lesson-bg-image: url("assets/themes/months.svg");
  --theme-bg-icons: "📅  🌱  ☀️  🍂  ❄️  📅  🌱  ☀️  🍂  ❄️";
}

body[data-lesson-theme="shapes"] {
  --lesson-bg-image: url("assets/themes/shapes.svg");
  --theme-bg-icons: "▲  ■  ●  ◆  ★  ⬟  ⬢  ▲  ■  ●";
}

body[data-lesson-theme="colors"] {
  --lesson-bg-image: url("assets/themes/colors.svg");
  --theme-bg-icons: "🎨  🍓  🫐  🍌  🌸  🎨  🥦  🍇  ☁️  🎨";
}

body[data-lesson-theme="info"] {
  --lesson-bg-image: url("assets/themes/info.svg");
}

.home-panel {
  width: min(1240px, 100%);
  margin: 0 auto;
  min-height: calc(100svh - var(--menu-height) - (var(--page-pad) * 2));
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: center;
  gap: clamp(10px, 1.8svh, 18px);
}

.home-heading {
  text-align: center;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  justify-items: center;
  gap: clamp(6px, 1.2svh, 12px);
}

.home-heading h1 {
  font-size: clamp(2.6rem, 7svh, 5.4rem);
  min-width: 0;
  text-align: left;
  overflow-wrap: anywhere;
}

.home-logo {
  width: clamp(64px, 12svh, 118px);
  height: clamp(64px, 12svh, 118px);
  filter: drop-shadow(0 12px 16px rgba(45, 42, 50, 0.16));
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 2.6svh, 28px);
  align-content: center;
}

.home-card {
  min-height: clamp(160px, 27svh, 260px);
  border: 5px solid white;
  border-radius: clamp(20px, 3svh, 30px) clamp(20px, 3svh, 30px) clamp(14px, 2svh, 20px) clamp(14px, 2svh, 20px);
  padding: clamp(12px, 2svh, 20px);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(7px, 1.3svh, 14px);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  text-align: center;
  transition:
    transform 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
  user-select: none;
}

.home-card * {
  user-select: none;
}

.home-card-wrap {
  display: grid;
  gap: 0;
  align-content: center;
}

.home-card:hover {
  background: linear-gradient(135deg, white, rgba(255, 209, 102, 0.62));
  transform: translateY(-4px) scale(1.025);
}

.home-card:focus-visible {
  outline: 5px solid var(--yellow);
  outline-offset: 4px;
}

.home-card-icon {
  font-size: clamp(3.2rem, 9svh, 7rem);
  line-height: 1;
  animation: icon-dance 2200ms ease-in-out infinite;
}

.home-card-title {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(1.3rem, 3svh, 2.2rem);
  font-weight: 900;
}

.home-card-description {
  color: var(--muted);
  font-size: clamp(0.9rem, 1.9svh, 1.1rem);
  font-weight: 900;
  line-height: 1.2;
}

.home-quiz-btn {
  min-height: clamp(44px, 6svh, 62px);
  width: min(92%, 300px);
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 0 0 24px 24px;
  padding: 0 16px;
  background: #06a77d;
  color: white;
  font-size: clamp(0.95rem, 2.2svh, 1.25rem);
  font-weight: 900;
  box-shadow: 0 7px 0 rgba(45, 42, 50, 0.1);
  cursor: pointer;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
}

h1 {
  margin: 0;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(2.8rem, 8vw, 5.8rem);
  line-height: 0.95;
}

.subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.25rem;
  font-weight: 800;
}

.about-meta,
.about-contact {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.2svh, 1.2rem);
  font-weight: 900;
}

.about-contact {
  display: inline-block;
  color: #118ab2;
  text-decoration: none;
}

.how-to-grid {
  margin-top: clamp(16px, 3svh, 26px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: clamp(10px, 2vw, 16px);
}

.how-to-card {
  min-height: 108px;
  padding: 12px;
  border-radius: 18px;
  background: #fff7dc;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 6px;
}

.how-to-card span {
  font-size: clamp(1.9rem, 4svh, 2.4rem);
  line-height: 1;
}

.how-to-card strong {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(0.98rem, 2svh, 1.1rem);
}

.how-to-card p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.82rem, 1.6svh, 0.96rem);
  font-weight: 900;
  line-height: 1.2;
}

.shortcut-table {
  width: 100%;
  margin-top: clamp(16px, 3svh, 26px);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 3px solid rgba(45, 42, 50, 0.1);
  border-radius: 18px;
  text-align: left;
  font-weight: 900;
}

.shortcut-table th,
.shortcut-table td {
  padding: 10px 12px;
  border-bottom: 2px solid rgba(45, 42, 50, 0.08);
}

.shortcut-table th {
  background: var(--yellow);
  font-family: "Fredoka", system-ui, sans-serif;
}

.shortcut-table tr:last-child td {
  border-bottom: 0;
}

.action-btn {
  border: 0;
  border-radius: 999px;
  padding: clamp(10px, 1.7svh, 16px) clamp(14px, 2vw, 22px);
  background: var(--text);
  color: white;
  font-size: clamp(0.9rem, 2.2svh, 1.05rem);
  font-weight: 900;
  box-shadow: var(--shadow);
}

.menu-btn:hover,
.about-close:hover,
.action-btn:hover {
  transform: translateY(-2px) scale(1.03);
}

.menu-btn:active,
.about-close:active,
.action-btn:active,
.letter-card:active,
.quiz-option:active {
  transform: scale(0.96);
}

.display-card {
  background: rgba(255, 255, 255, 0.88);
  border: clamp(4px, 0.9svh, 6px) solid white;
  border-radius: clamp(22px, 4svh, 36px);
  position: relative;
  padding: clamp(10px, 1.8svh, 18px) clamp(76px, 9vw, 132px);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  justify-items: center;
  gap: clamp(10px, 2svh, 26px);
  margin: 0;
  text-align: center;
  min-height: 0;
  overflow: visible;
}

.lesson-theme-panel {
  order: 3;
  align-self: center;
  width: calc(100vw - (var(--page-pad) * 2));
  max-width: none;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(8px, 1.4svh, 14px);
  padding: clamp(8px, 1.3svh, 13px);
  border-radius: clamp(18px, 2.6svh, 26px);
  background: rgba(255, 255, 255, 0.9);
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  overflow: visible;
  text-align: center;
  margin-top: auto;
}

.app.quiz-mode .lesson-theme-panel {
  margin-top: 0;
}

.coloring-link {
  position: absolute;
  left: clamp(14px, 2vw, 28px);
  top: clamp(12px, 2svh, 24px);
  pointer-events: auto;
  min-height: clamp(46px, 6.4svh, 66px);
  padding-inline: clamp(16px, 3vw, 28px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #7c3aed;
  color: white;
  font-size: clamp(1rem, 2.3svh, 1.3rem);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.theme-eyebrow {
  margin: 0 0 2px;
  color: var(--primary-dark);
  font-size: clamp(0.78rem, 1.5svh, 0.96rem);
  font-weight: 900;
  text-transform: uppercase;
}

.lesson-theme-panel h2 {
  max-width: clamp(110px, 13vw, 180px);
  margin: 0;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(0.88rem, 1.9svh, 1.15rem);
  line-height: 1;
}

.theme-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(78px, 9vw, 118px), 1fr));
  gap: clamp(7px, 1svh, 10px);
  overflow: visible;
  padding: 2px;
}

.theme-choice {
  min-height: clamp(54px, 6.8svh, 72px);
  border: 0;
  border-radius: clamp(16px, 2.4svh, 24px);
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  gap: 4px;
  background: white;
  color: var(--text);
  box-shadow: 0 6px 0 rgba(45, 42, 50, 0.08);
  text-align: center;
}

.theme-choice:hover {
  background: linear-gradient(135deg, #fff1a8, #b9fbc0);
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 9px 0 rgba(45, 42, 50, 0.08),
    0 16px 22px rgba(45, 42, 50, 0.14);
}

.theme-choice.active {
  background: var(--yellow);
  color: var(--text);
  transform: translateY(-2px);
}

.theme-choice-icon {
  font-size: clamp(1.8rem, 4.6svh, 3.2rem);
  line-height: 1;
}

.theme-choice-label {
  min-width: 0;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(0.74rem, 1.6svh, 0.95rem);
  font-weight: 900;
  line-height: 1;
}

@media (max-width: 1100px) {
  .app.theme-dock-mode {
    display: block;
    min-height: auto;
    padding-bottom: var(--page-pad);
  }

  .app.quiz-mode.theme-dock-mode {
    display: block;
  }

  .app.theme-dock-mode .display-card,
  .app.theme-dock-mode .letters-section,
  .app.theme-dock-mode .quiz-panel {
    margin-bottom: var(--gap);
  }

  .lesson-theme-panel {
    max-height: none;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    padding: 8px;
    border-radius: 20px;
    overflow: hidden;
  }

  .lesson-theme-panel h2 {
    max-width: 150px;
    font-size: clamp(0.82rem, 1.8svh, 1rem);
  }

  .theme-eyebrow {
    font-size: 0.72rem;
  }

  .theme-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
    gap: 8px;
    overflow: visible;
    padding: 2px;
  }

  .theme-choice {
    min-height: 58px;
    padding: 6px;
    border-radius: 16px;
  }

  .theme-choice-icon {
    font-size: clamp(1.55rem, 4svh, 2.35rem);
  }

  .theme-choice-label {
    font-size: clamp(0.68rem, 1.55svh, 0.86rem);
  }
}

.display-card.simple-card {
  grid-template-columns: 1fr;
  background: rgba(255, 255, 255, 0.88);
  border-color: var(--lesson-accent);
}

.display-card.shape-card {
  overflow: hidden;
}

.big-letter {
  width: clamp(98px, 19svh, 210px);
  aspect-ratio: 1;
  border-radius: clamp(18px, 3svh, 32px);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--yellow), #ffafcc);
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(4.2rem, 11svh, 8.2rem);
  color: white;
  text-shadow: 0 8px 0 rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.08);
}

.big-letter.long-symbol {
  font-size: clamp(3.4rem, 9svh, 6.4rem);
}

.big-letter.word-symbol {
  padding: 0.08em;
  font-size: clamp(1.85rem, 5.2svh, 4.8rem);
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.word-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.6svh, 22px);
  text-align: center;
  min-width: 0;
  max-width: 100%;
}

.simple-card .word-row {
  flex-direction: row;
  gap: clamp(14px, 3svh, 34px);
}

.word-row.shape-mode {
  --shape-size: clamp(82px, 17svh, 168px);
  --wide-shape-width: clamp(118px, 24svh, 232px);
  --shape-rect-height: clamp(52px, 10.5svh, 104px);
  --shape-oval-height: clamp(54px, 11svh, 108px);
  width: 100%;
  max-width: min(100%, 840px);
  gap: clamp(12px, 2.2svh, 28px);
  padding-inline: clamp(44px, 8vw, 120px);
  box-sizing: border-box;
}

.word-row.shape-mode > div {
  min-width: 0;
}

.word-row.shape-mode .word {
  font-size: clamp(1.8rem, 5.4svh, 4.2rem);
  white-space: normal;
}

.word-row.shape-mode .sentence {
  max-width: 42ch;
  line-height: 1.12;
}

.word-row.number-mode {
  flex-direction: row;
  gap: clamp(4px, 0.8svh, 10px);
}

.word-row.number-mode .number-visual {
  width: min(34vw, 430px);
}

.big-emoji {
  max-width: min(52vw, 580px);
  max-height: 32svh;
  font-size: clamp(6rem, 21svh, 14rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
  animation: icon-dance 1700ms ease-in-out infinite;
  filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.12));
}

.simple-card .big-emoji {
  max-width: min(76vw, 820px);
  max-height: 42svh;
  font-size: clamp(8rem, 30svh, 20rem);
}

.big-emoji.shape-visual {
  width: min(42vw, calc(var(--wide-shape-width, clamp(118px, 24svh, 232px)) + 36px));
  max-width: min(42vw, 320px);
  max-height: none;
  aspect-ratio: 1.25;
  display: grid;
  place-items: center;
  overflow: visible;
  font-size: initial;
  pointer-events: none;
}

.simple-card .big-emoji.shape-visual {
  width: min(42vw, calc(var(--wide-shape-width, clamp(118px, 24svh, 232px)) + 36px));
  max-width: min(42vw, 320px);
  max-height: none;
}

.shape-visual-shape {
  --shape-fill: linear-gradient(135deg, #38bdf8, #8b5cf6);
  width: var(--shape-size, clamp(82px, 17svh, 168px));
  height: var(--shape-size, clamp(82px, 17svh, 168px));
  display: grid;
  place-items: center;
  background: var(--shape-fill);
  color: #ffcf33;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(4.5rem, 13svh, 9rem);
  line-height: 1;
  filter: drop-shadow(0 14px 12px rgba(0, 0, 0, 0.14));
  animation: icon-dance 2200ms ease-in-out infinite;
}

.shape-line {
  width: var(--wide-shape-width, clamp(118px, 24svh, 232px));
  height: clamp(14px, 2.8svh, 28px);
  border-radius: 999px;
  --shape-fill: linear-gradient(90deg, #f97316, #facc15);
}

.shape-triangle {
  clip-path: polygon(50% 4%, 5% 96%, 95% 96%);
  --shape-fill: linear-gradient(135deg, #fb7185, #f97316);
}

.shape-rectangle {
  width: var(--wide-shape-width, clamp(118px, 24svh, 232px));
  height: var(--shape-rect-height, clamp(52px, 10.5svh, 104px));
  border-radius: 16px;
  --shape-fill: linear-gradient(135deg, #22c55e, #14b8a6);
}

.shape-square {
  border-radius: 18px;
  --shape-fill: linear-gradient(135deg, #60a5fa, #2563eb);
}

.shape-pentagon {
  clip-path: polygon(50% 3%, 96% 38%, 79% 96%, 21% 96%, 4% 38%);
  --shape-fill: linear-gradient(135deg, #a78bfa, #ec4899);
}

.shape-hexagon {
  clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%);
  --shape-fill: linear-gradient(135deg, #2dd4bf, #0ea5e9);
}

.shape-heptagon {
  clip-path: polygon(50% 3%, 88% 20%, 100% 58%, 72% 96%, 28% 96%, 0 58%, 12% 20%);
  --shape-fill: linear-gradient(135deg, #facc15, #f97316);
}

.shape-octagon {
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
  --shape-fill: linear-gradient(135deg, #ef4444, #dc2626);
}

.shape-circle {
  border-radius: 50%;
  --shape-fill: linear-gradient(135deg, #34d399, #22c55e);
}

.shape-oval {
  width: var(--wide-shape-width, clamp(118px, 24svh, 232px));
  height: var(--shape-oval-height, clamp(54px, 11svh, 108px));
  border-radius: 999px;
  --shape-fill: linear-gradient(135deg, #f59e0b, #fde047);
}

.shape-diamond {
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  border-radius: 0;
  --shape-fill: linear-gradient(135deg, #38bdf8, #6366f1);
}

.shape-star,
.shape-heart,
.shape-crescent {
  background: none;
  filter: drop-shadow(0 14px 12px rgba(0, 0, 0, 0.14));
}

.shape-heart {
  color: #ec4899;
}

.shape-crescent {
  color: #facc15;
}

.number-visual {
  width: min(38vw, 480px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  gap: clamp(3px, 0.8svh, 8px);
  white-space: normal;
}

.number-visual[data-count="1"] {
  width: clamp(100px, 17svh, 178px);
  grid-template-columns: 1fr;
}

.number-visual[data-count="2"] {
  width: clamp(118px, 19svh, 205px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.number-visual[data-count="3"] {
  width: clamp(190px, 30svh, 330px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.number-visual[data-count="4"] {
  width: clamp(220px, 34svh, 380px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.number-visual .visual-icon {
  display: inline-block;
  font-size: clamp(3rem, 10svh, 7rem);
  line-height: 1;
  animation: icon-dance 2200ms ease-in-out infinite;
}

.number-visual[data-count="1"] .visual-icon {
  font-size: clamp(5.8rem, 18svh, 12rem);
}

.number-visual[data-count="2"] .visual-icon {
  font-size: clamp(4.8rem, 15svh, 9.5rem);
}

.number-visual[data-count="3"] .visual-icon,
.number-visual[data-count="4"] .visual-icon {
  font-size: clamp(4.1rem, 12.5svh, 8rem);
}

.number-visual[data-count="5"] .visual-icon,
.number-visual[data-count="6"] .visual-icon {
  font-size: clamp(3.5rem, 10.8svh, 7.1rem);
}

.number-visual[data-count="7"] .visual-icon,
.number-visual[data-count="8"] .visual-icon,
.number-visual[data-count="9"] .visual-icon,
.number-visual[data-count="10"] .visual-icon {
  font-size: clamp(3rem, 9.4svh, 6.4rem);
}

.word {
  margin: 0;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(2.6rem, 7svh, 5.4rem);
  line-height: 1;
  overflow-wrap: anywhere;
  white-space: nowrap;
}

.sentence {
  margin: clamp(5px, 1svh, 12px) 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.8svh, 1.5rem);
  font-weight: 900;
}

.actions {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.lesson-quiz {
  position: absolute;
  right: clamp(14px, 2vw, 28px);
  top: clamp(12px, 2svh, 24px);
  pointer-events: auto;
  background: #06a77d;
  min-height: clamp(46px, 6.4svh, 66px);
  padding-inline: clamp(16px, 3vw, 28px);
  font-size: clamp(1rem, 2.3svh, 1.3rem);
}

.back-lesson {
  justify-self: start;
  background: #06a77d;
}

.action-btn {
  background: var(--primary-dark);
}

.action-btn.coloring-link {
  background: #7c3aed;
}

.action-btn.small {
  padding: 13px 18px;
  font-size: 0.98rem;
}

.nav-btn {
  position: absolute;
  top: 50%;
  width: clamp(46px, 8svh, 70px);
  height: clamp(46px, 8svh, 70px);
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: clamp(1.8rem, 4.8svh, 3rem);
  line-height: 1;
  pointer-events: auto;
  transform: translateY(-50%);
}

.nav-btn.prev {
  left: clamp(10px, 1.8vw, 24px);
}

.nav-btn.next {
  right: clamp(14px, 2vw, 28px);
  top: auto;
  bottom: clamp(12px, 2svh, 24px);
  background: #118ab2;
}

.nav-btn:hover {
  transform: translateY(-50%) scale(1.08);
}

.action-btn:disabled {
  cursor: not-allowed;
  filter: grayscale(0.8);
  opacity: 0.7;
}

.quiz-panel {
  background: var(--panel);
  border-radius: clamp(20px, 3svh, 32px);
  padding: clamp(8px, 1.3svh, 14px);
  box-shadow: var(--shadow);
}

.letters-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
  padding: clamp(4px, 1svh, 10px);
  background: transparent;
  box-shadow: none;
}

.letters-section h2,
.quiz-panel h2 {
  margin: 0 0 clamp(4px, 0.7svh, 8px);
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(0.95rem, 2svh, 1.45rem);
}

.letters-section > h2 {
  order: 1;
}

.letters-grid {
  order: 2;
  width: min(100%, 1160px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(54px, 8svh, 88px), 1fr));
  justify-content: center;
  gap: clamp(9px, 1.7svh, 18px);
  overflow: visible;
  padding: 2px;
}

.letters-grid.grouped {
  display: block;
  width: min(100%, 1040px);
}

.letters-grid.word-grid {
  width: min(100%, 1180px);
  grid-template-columns: repeat(auto-fit, minmax(clamp(112px, 16svh, 180px), 1fr));
  gap: clamp(9px, 1.5svh, 16px);
}

.letter-groups {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  justify-content: center;
  align-items: start;
  gap: clamp(14px, 2.5svh, 28px);
}

.letter-group {
  display: grid;
  justify-items: center;
  gap: clamp(7px, 1.2svh, 12px);
}

.letter-group-title {
  margin: 0;
  color: var(--primary-dark);
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(0.95rem, 2svh, 1.35rem);
  line-height: 1;
}

.letter-group-grid {
  display: grid;
  justify-content: center;
  gap: clamp(8px, 1.4svh, 14px);
}

.letter-group-grid.soroborno {
  grid-template-columns: repeat(auto-fit, minmax(clamp(48px, 7svh, 76px), 1fr));
  width: min(100%, 420px);
}

.letter-group-grid.benjonborno {
  grid-template-columns: repeat(auto-fit, minmax(clamp(48px, 7svh, 76px), 1fr));
  width: min(100%, 720px);
}

.letter-group-grid .letter-card {
  border-radius: clamp(12px, 1.8svh, 18px);
  font-size: clamp(1.45rem, 4svh, 2.5rem);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.08);
}

.letter-card {
  width: 100%;
  min-height: 0;
  aspect-ratio: 1;
  border: 0;
  border-radius: clamp(10px, 1.8svh, 18px);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(1.45rem, 4svh, 2.5rem);
  font-weight: 800;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.08);
  transition:
    transform 170ms ease,
    background 170ms ease,
    box-shadow 170ms ease,
    color 170ms ease;
}

.letter-card:hover {
  background: linear-gradient(135deg, #fff1a8, #b9fbc0);
  box-shadow:
    0 7px 0 rgba(0, 0, 0, 0.08),
    0 12px 18px rgba(45, 42, 50, 0.14);
  transform: translateY(-2px) scale(1.03);
}

.letter-card.word-card {
  aspect-ratio: auto;
  min-height: clamp(50px, 8svh, 84px);
  padding: 8px 12px;
  font-size: clamp(1.05rem, 2.45svh, 1.75rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.letter-card.selected {
  background: var(--yellow);
  color: white;
  transform: translateY(-2px) scale(1.04);
}

.quiz-panel {
  margin: 0;
  border: 5px solid white;
}

.app.quiz-mode .quiz-panel {
  min-height: calc(100svh - var(--menu-height) - (var(--page-pad) * 2));
  height: auto;
  width: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  align-content: stretch;
  gap: clamp(6px, 1.2svh, 14px);
  overflow: visible;
}

.quiz-prompt {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  text-align: center;
  gap: clamp(4px, 1svh, 10px);
  min-height: 0;
  overflow: visible;
}

.quiz-emoji {
  max-width: 88vw;
  max-height: min(52svh, 100%);
  font-size: clamp(6rem, 28svh, 16rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
  animation: icon-dance 2400ms ease-in-out infinite;
  filter: drop-shadow(0 16px 12px rgba(0, 0, 0, 0.12));
}

.quiz-emoji.shape-visual {
  --shape-size: clamp(92px, 22svh, 220px);
  --wide-shape-width: clamp(132px, 32svh, 320px);
  --shape-rect-height: clamp(66px, 14svh, 148px);
  --shape-oval-height: clamp(68px, 14svh, 150px);
  width: min(80vw, calc(var(--wide-shape-width) + 44px));
  max-width: min(80vw, 560px);
  max-height: min(40svh, 100%);
  display: grid;
  place-items: center;
  overflow: visible;
  font-size: initial;
  pointer-events: none;
}

.quiz-emoji.shape-visual .shape-visual-shape {
  width: var(--shape-size);
  height: var(--shape-size);
}

.quiz-emoji.shape-visual .shape-line,
.quiz-emoji.shape-visual .shape-rectangle,
.quiz-emoji.shape-visual .shape-oval {
  width: var(--wide-shape-width);
}

.quiz-emoji.shape-visual .shape-line {
  height: clamp(16px, 3svh, 30px);
}

.quiz-emoji.shape-visual .shape-rectangle {
  height: var(--shape-rect-height);
}

.quiz-emoji.shape-visual .shape-oval {
  height: var(--shape-oval-height);
}

.quiz-emoji.number-visual {
  width: min(88vw, 920px);
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.quiz-emoji.number-visual[data-count="1"] {
  width: min(46vw, 420px);
}

.quiz-emoji.number-visual[data-count="2"] {
  width: min(58vw, 540px);
}

.quiz-emoji.number-visual[data-count="3"],
.quiz-emoji.number-visual[data-count="4"] {
  width: min(72vw, 720px);
}

.quiz-emoji.number-visual .visual-icon {
  font-size: clamp(3.4rem, 11svh, 7.6rem);
}

.quiz-emoji.number-visual[data-count="1"] .visual-icon {
  font-size: clamp(7rem, 26svh, 16rem);
}

.quiz-emoji.number-visual[data-count="2"] .visual-icon {
  font-size: clamp(5.8rem, 21svh, 13rem);
}

.quiz-emoji.number-visual[data-count="3"] .visual-icon,
.quiz-emoji.number-visual[data-count="4"] .visual-icon {
  font-size: clamp(4.8rem, 17svh, 10rem);
}

.quiz-prompt h2 {
  margin: 0;
  font-size: clamp(1.35rem, 4svh, 3rem);
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: clamp(10px, 1.6svh, 16px);
}

.quiz-option {
  border: 0;
  border-radius: clamp(18px, 3svh, 28px);
  min-height: clamp(68px, 13svh, 128px);
  color: white;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(3.2rem, 10svh, 7rem);
  font-weight: 900;
  line-height: 1;
  overflow-wrap: anywhere;
  cursor: pointer;
  box-shadow:
    0 10px 0 rgba(0, 0, 0, 0.08),
    0 18px 26px rgba(45, 42, 50, 0.12);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.quiz-option.word-option {
  font-size: clamp(1.2rem, 4.2svh, 3rem);
  padding: 8px;
}

.quiz-option:hover {
  color: white;
  box-shadow:
    0 14px 0 rgba(0, 0, 0, 0.08),
    0 24px 34px rgba(45, 42, 50, 0.18);
  transform: translateY(-7px) scale(1.045);
}

.option-red {
  background: linear-gradient(135deg, #ff5d73, #ef476f);
}

.option-red:hover {
  background: linear-gradient(135deg, #ff7a8d, #e8315f);
}

.option-blue {
  background: linear-gradient(135deg, #3aa7ff, #118ab2);
}

.option-blue:hover {
  background: linear-gradient(135deg, #60bcff, #087da8);
}

.option-green {
  background: linear-gradient(135deg, #35d98b, #06a77d);
}

.option-green:hover {
  background: linear-gradient(135deg, #5de8a4, #00916e);
}

.quiz-feedback {
  min-height: 40px;
  margin: 0;
  max-width: min(92vw, 900px);
  font-size: clamp(1.05rem, 2.7svh, 1.5rem);
  font-weight: 900;
  line-height: 1.15;
  color: var(--primary-dark);
}

.answer-correct .quiz-feedback {
  color: #07814f;
}

.answer-wrong .quiz-feedback {
  color: #d62828;
}

.feedback-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 72px;
  text-align: center;
}

.next-feedback {
  flex: 0 0 auto;
  background: #118ab2;
}

.next-feedback:hover {
  background: #0b7fa4;
}

.hidden {
  display: none;
}

#trail-layer {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  overflow: hidden;
}

.result-burst {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 9999;
  pointer-events: none;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  font-weight: 900;
  animation: result-float 3600ms ease-out forwards;
  filter: drop-shadow(0 12px 10px rgba(45, 42, 50, 0.2));
}

.result-burst.correct {
  padding: 8px 12px;
  border: 3px solid rgba(6, 167, 125, 0.45);
  border-radius: 999px;
  background: rgba(185, 251, 192, 0.82);
  box-shadow: 0 0 26px rgba(6, 167, 125, 0.28);
}

.result-burst.wrong {
  padding: 8px 12px;
  border: 3px solid rgba(239, 71, 111, 0.42);
  border-radius: 999px;
  background: rgba(255, 205, 210, 0.86);
  color: #ef476f;
  box-shadow: 0 0 26px rgba(239, 71, 111, 0.28);
}

.theme-splash {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 9999;
  pointer-events: none;
  min-width: min(72vw, 360px);
  padding: clamp(16px, 3vw, 28px) clamp(20px, 5vw, 42px);
  display: grid;
  justify-items: center;
  gap: 8px;
  border: 5px solid rgba(255, 255, 255, 0.9);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow: 0 24px 50px rgba(45, 42, 50, 0.24);
  font-family: "Fredoka", system-ui, sans-serif;
  text-align: center;
  animation: theme-splash-pop 1400ms ease-out forwards;
}

.theme-splash::before {
  position: fixed;
  inset: -18vmax;
  z-index: -1;
  content: "";
  background:
    radial-gradient(circle at center, rgba(255, 209, 102, 0.48), transparent 34%),
    radial-gradient(circle at 35% 42%, rgba(144, 219, 244, 0.35), transparent 28%),
    radial-gradient(circle at 66% 58%, rgba(255, 143, 171, 0.32), transparent 30%);
  animation: theme-wash 1200ms ease-out forwards;
}

.theme-splash span {
  font-size: clamp(3rem, 9vw, 6rem);
  line-height: 1;
}

.theme-splash strong {
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  line-height: 1;
}

@keyframes icon-dance {
  0%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }

  35% {
    transform: translateY(-7px) rotate(-2deg) scale(1.03);
  }

  70% {
    transform: translateY(3px) rotate(2deg) scale(0.99);
  }
}

@keyframes theme-splash-pop {
  0% {
    transform: translate(-50%, -50%) scale(0.74);
    opacity: 0;
  }

  18% {
    transform: translate(-50%, -50%) scale(1.04);
    opacity: 1;
  }

  72% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -58%) scale(0.92);
    opacity: 0;
  }
}

@keyframes page-theme-shift {
  0% {
    opacity: 0.3;
    filter: saturate(0.7) brightness(1.12);
    transform: scale(1.04);
  }

  42% {
    opacity: 0.88;
    filter: saturate(1.35) brightness(1.05);
  }

  100% {
    opacity: 0.76;
    filter: saturate(1) brightness(1);
    transform: scale(1);
  }
}

@keyframes theme-wash {
  0% {
    opacity: 0;
    transform: scale(0.6) rotate(-8deg);
  }

  35% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: scale(1.18) rotate(4deg);
  }
}

.answer-correct .quiz-prompt,
.answer-correct .feedback-row {
  animation: happy-pop 2200ms ease;
}

.answer-wrong .quiz-prompt,
.answer-wrong .feedback-row {
  animation: try-again-shake 2000ms ease;
}

@keyframes result-float {
  0% {
    transform: translate(-50%, 20%) scale(0.6) rotate(-8deg);
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -170%) scale(1.45) rotate(18deg);
    opacity: 0;
  }
}

@keyframes happy-pop {
  0%,
  100% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.06);
  }
}

@keyframes try-again-shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-8px);
  }

  50% {
    transform: translateX(8px);
  }

  75% {
    transform: translateX(-4px);
  }
}

/* Mouse/touch sparkle */
.sparkle-trail {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 9999;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 209, 102, 0.9) 0 28%, transparent 30%),
    radial-gradient(circle, rgba(144, 219, 244, 0.62) 0 70%, transparent 72%);
  box-shadow: 0 0 18px rgba(255, 143, 171, 0.38);
  animation: sparkle-trail-fade 560ms ease-out forwards;
  will-change: transform, opacity;
}

@keyframes sparkle-trail-fade {
  0% {
    transform: translate(-50%, -50%) scale(0.55);
    opacity: 0.55;
  }

  100% {
    transform: translate(-50%, -50%) scale(1.9);
    opacity: 0;
  }
}

.bounce {
  animation: bounce 450ms ease;
}

.big-emoji.bounce {
  animation:
    icon-pop 700ms ease,
    icon-dance 1700ms ease-in-out 700ms infinite;
}

@keyframes icon-pop {
  0% {
    transform: scale(0.88) rotate(0deg);
  }

  38% {
    transform: scale(1.18) rotate(-5deg);
  }

  68% {
    transform: scale(0.96) rotate(4deg);
  }

  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes bounce {
  0% {
    transform: scale(1);
  }

  35% {
    transform: scale(1.15) rotate(-2deg);
  }

  70% {
    transform: scale(0.95) rotate(2deg);
  }

  100% {
    transform: scale(1);
  }
}

@media (min-height: 850px) {
  .app {
    grid-template-rows: minmax(0, 0.38fr) minmax(0, 0.62fr);
  }

  .big-letter {
    width: clamp(112px, 20svh, 220px);
    font-size: clamp(4.8rem, 11.5svh, 8.4rem);
  }

  .big-letter.long-symbol {
    font-size: clamp(3.8rem, 9.4svh, 6.8rem);
  }

  .big-emoji {
    max-height: 34svh;
    font-size: clamp(6rem, 20svh, 14rem);
  }

  .number-visual .visual-icon {
    font-size: clamp(3rem, 8.8svh, 6.2rem);
  }

  .quiz-emoji {
    font-size: clamp(7rem, 31svh, 18rem);
  }

  .quiz-emoji.number-visual .visual-icon {
    font-size: clamp(4rem, 12.5svh, 8.8rem);
  }
}

@media (max-width: 760px) {
  :root {
    --menu-height: clamp(126px, 20svh, 150px);
    --page-pad: 10px;
    --gap: 10px;
  }

  .top-menu {
    height: var(--menu-height);
    overflow: hidden;
    justify-content: center;
    align-content: center;
    padding: 6px 8px;
    gap: 6px;
  }

  .app.theme-dock-mode {
    padding-bottom: var(--page-pad);
  }

  .menu-btn {
    min-height: 34px;
    padding: 0 8px;
    font-size: 0.78rem;
    border-radius: 14px;
  }

  .icon-menu {
    min-width: auto;
  }

  .language-field {
    min-height: 34px;
    padding: 0 8px;
    border-radius: 14px;
  }

  .select-field {
    min-height: 34px;
    padding: 0 8px;
    border-radius: 14px;
  }

  .language-select,
  .menu-select {
    max-width: 126px;
    font-size: 0.78rem;
  }

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

  .home-heading {
    grid-template-columns: auto minmax(0, auto);
    gap: 8px;
  }

  .home-heading h1 {
    font-size: clamp(1.75rem, 5.2svh, 2.8rem);
  }

  .home-logo {
    width: clamp(46px, 9svh, 72px);
    height: clamp(46px, 9svh, 72px);
  }

  .home-card {
    min-height: 150px;
  }

  .home-quiz-btn {
    min-height: 42px;
    font-size: 0.9rem;
  }

  .display-card {
    grid-template-columns: auto auto;
    grid-template-rows: auto auto;
    padding: 7px 10px;
    gap: 8px;
  }

  .actions {
    position: static;
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
  }

  .lesson-quiz,
  .coloring-link,
  .nav-btn,
  .nav-btn.prev,
  .nav-btn.next {
    position: static;
    transform: none;
  }

  .nav-btn:hover {
    transform: scale(1.06);
  }

  .lesson-quiz {
    order: 2;
    min-height: 40px;
    padding-inline: 14px;
    font-size: 0.9rem;
  }

  .coloring-link {
    order: 4;
    min-height: 40px;
    padding-inline: 14px;
    font-size: 0.9rem;
  }

  .nav-btn.prev {
    order: 1;
  }

  .nav-btn.next {
    order: 3;
    top: auto;
    bottom: auto;
  }

  .lesson-theme-panel {
    max-height: none;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    overflow: hidden;
  }

  .lesson-theme-panel h2 {
    max-width: none;
    font-size: 0.88rem;
  }

  .theme-eyebrow {
    font-size: 0.64rem;
  }

  .theme-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    max-height: none;
    overflow: visible;
    overscroll-behavior-y: contain;
    padding: 2px 4px 6px;
    scrollbar-width: thin;
  }

  .theme-choice {
    min-height: 48px;
    border-radius: 14px;
    padding: 7px 12px;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .theme-choice-icon {
    font-size: clamp(1.7rem, 4svh, 2.3rem);
  }

  .theme-choice-label {
    font-size: clamp(0.9rem, 2.1svh, 1.05rem);
  }

  .big-letter {
    width: clamp(58px, 11svh, 92px);
    height: auto;
    font-size: clamp(2.6rem, 7svh, 4rem);
  }

  .big-letter.long-symbol {
    font-size: clamp(2.2rem, 6svh, 3.6rem);
  }

  .big-letter.word-symbol {
    font-size: clamp(1.05rem, 3svh, 1.8rem);
  }

  .word-row {
    flex-direction: row;
    text-align: center;
    gap: 7px;
  }

  .word-row.number-mode {
    flex-direction: row;
    gap: 4px;
  }

  .word-row.number-mode .number-visual {
    width: min(38vw, 280px);
  }

  .big-emoji {
    max-width: 44vw;
    max-height: 12svh;
    font-size: clamp(2.55rem, 6.8svh, 4.6rem);
  }

  .simple-card .big-emoji {
    max-height: 20svh;
    font-size: clamp(4rem, 13svh, 8rem);
  }

  .big-emoji.shape-visual,
  .simple-card .big-emoji.shape-visual {
    width: min(68vw, calc(var(--wide-shape-width, clamp(96px, 20svh, 178px)) + 28px));
    max-width: min(68vw, 240px);
    max-height: none;
    aspect-ratio: 1.25;
  }

  .word-row.shape-mode {
    --shape-size: clamp(64px, 13svh, 118px);
    --wide-shape-width: clamp(96px, 20svh, 178px);
    --shape-rect-height: clamp(40px, 8svh, 74px);
    --shape-oval-height: clamp(42px, 8.3svh, 76px);
    gap: 8px;
    padding-inline: 0;
  }

  .shape-visual-shape {
    width: var(--shape-size, clamp(64px, 13svh, 118px));
    height: var(--shape-size, clamp(64px, 13svh, 118px));
    font-size: clamp(3.6rem, 10svh, 6.2rem);
  }

  .shape-line {
    width: var(--wide-shape-width, clamp(96px, 20svh, 178px));
    height: clamp(10px, 2svh, 20px);
  }

  .shape-rectangle,
  .shape-oval {
    width: var(--wide-shape-width, clamp(96px, 20svh, 178px));
  }

  .shape-rectangle {
    height: var(--shape-rect-height, clamp(40px, 8svh, 74px));
  }

  .shape-oval {
    height: var(--shape-oval-height, clamp(42px, 8.3svh, 76px));
  }

  .simple-card .word-row {
    flex-direction: column;
    gap: 8px;
  }

  .sentence {
    display: none;
  }

  .simple-card .sentence {
    display: block;
    font-size: clamp(0.92rem, 2.4svh, 1.2rem);
  }

  .number-visual {
    width: min(38vw, 280px);
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .number-visual[data-count="1"] {
    width: clamp(72px, 12svh, 110px);
  }

  .number-visual[data-count="2"] {
    width: clamp(88px, 14svh, 130px);
  }

  .number-visual[data-count="3"] {
    width: clamp(130px, 20svh, 190px);
  }

  .number-visual[data-count="4"] {
    width: clamp(150px, 23svh, 220px);
  }

  .number-visual .visual-icon {
    font-size: clamp(1.35rem, 4.4svh, 2.7rem);
  }

  .number-visual[data-count="1"] .visual-icon {
    font-size: clamp(3.5rem, 11svh, 6rem);
  }

  .number-visual[data-count="2"] .visual-icon {
    font-size: clamp(2.6rem, 8.5svh, 4.6rem);
  }

  .number-visual[data-count="3"] .visual-icon,
  .number-visual[data-count="4"] .visual-icon {
    font-size: clamp(2rem, 6.5svh, 3.4rem);
  }

  .number-visual[data-count="5"] .visual-icon,
  .number-visual[data-count="6"] .visual-icon,
  .number-visual[data-count="7"] .visual-icon,
  .number-visual[data-count="8"] .visual-icon,
  .number-visual[data-count="9"] .visual-icon,
  .number-visual[data-count="10"] .visual-icon {
    font-size: clamp(1.35rem, 4.4svh, 2.7rem);
  }

  .quiz-emoji {
    max-height: 27svh;
    font-size: clamp(3.8rem, 14svh, 7.4rem);
  }

  .quiz-emoji.shape-visual {
    --shape-size: clamp(68px, 14svh, 128px);
    --wide-shape-width: clamp(104px, 22svh, 200px);
    --shape-rect-height: clamp(42px, 8.8svh, 82px);
    --shape-oval-height: clamp(44px, 9svh, 84px);
    width: min(84vw, calc(var(--wide-shape-width) + 32px));
    max-width: min(84vw, 380px);
    max-height: 22svh;
  }

  .quiz-emoji.shape-visual .shape-visual-shape {
    width: var(--shape-size);
    height: var(--shape-size);
  }

  .quiz-emoji.shape-visual .shape-line,
  .quiz-emoji.shape-visual .shape-rectangle,
  .quiz-emoji.shape-visual .shape-oval {
    width: var(--wide-shape-width);
  }

  .quiz-emoji.shape-visual .shape-line {
    height: clamp(10px, 2svh, 18px);
  }

  .quiz-emoji.shape-visual .shape-rectangle {
    height: var(--shape-rect-height);
  }

  .quiz-emoji.shape-visual .shape-oval {
    height: var(--shape-oval-height);
  }

  .quiz-emoji.number-visual {
    width: min(86vw, 420px);
  }

  .quiz-emoji.number-visual[data-count="1"] {
    width: min(54vw, 260px);
  }

  .quiz-emoji.number-visual[data-count="2"] {
    width: min(68vw, 330px);
  }

  .quiz-emoji.number-visual .visual-icon {
    font-size: clamp(1.8rem, 6.2svh, 3.6rem);
  }

  .quiz-emoji.number-visual[data-count="1"] .visual-icon {
    font-size: clamp(5.2rem, 18svh, 9rem);
  }

  .quiz-emoji.number-visual[data-count="2"] .visual-icon {
    font-size: clamp(3.8rem, 13svh, 6.6rem);
  }

  .quiz-emoji.number-visual[data-count="3"] .visual-icon,
  .quiz-emoji.number-visual[data-count="4"] .visual-icon {
    font-size: clamp(2.8rem, 9.2svh, 5rem);
  }

  .quiz-emoji.number-visual[data-count="5"] .visual-icon,
  .quiz-emoji.number-visual[data-count="6"] .visual-icon,
  .quiz-emoji.number-visual[data-count="7"] .visual-icon,
  .quiz-emoji.number-visual[data-count="8"] .visual-icon,
  .quiz-emoji.number-visual[data-count="9"] .visual-icon,
  .quiz-emoji.number-visual[data-count="10"] .visual-icon {
    font-size: clamp(1.8rem, 6.2svh, 3.6rem);
  }

  .word {
    font-size: clamp(1.15rem, 3.2svh, 1.9rem);
  }

  .nav-btn {
    width: clamp(40px, 7svh, 54px);
    height: clamp(40px, 7svh, 54px);
    font-size: clamp(1.5rem, 4svh, 2.2rem);
  }

  .feedback-row .action-btn {
    padding: 8px 11px;
  }

  .about-panel {
    width: calc(100vw - 20px);
  }

  .how-to-grid {
    grid-template-columns: 1fr;
  }

  .shortcut-table {
    font-size: 0.82rem;
  }

  .letters-grid {
    grid-template-columns: repeat(auto-fit, minmax(clamp(40px, 6svh, 58px), 1fr));
    gap: 8px;
  }

  .letters-grid.grouped {
    width: min(100%, 520px);
  }

  .letters-grid.word-grid {
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 9px;
  }

  .letter-card.word-card {
    min-height: 44px;
    padding: 6px 8px;
  }

  .letter-groups {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 6px;
  }

  .letter-group-grid.soroborno {
    grid-template-columns: repeat(auto-fit, minmax(clamp(28px, 4.6svh, 42px), 1fr));
    width: min(100%, 220px);
  }

  .letter-group-grid.benjonborno {
    grid-template-columns: repeat(auto-fit, minmax(clamp(28px, 4.6svh, 42px), 1fr));
    width: min(100%, 360px);
  }

  .letter-group-title {
    font-size: clamp(0.72rem, 1.8svh, 0.95rem);
  }

  .letter-group-grid .letter-card {
    border-radius: 9px;
    font-size: clamp(1.15rem, 3.2svh, 1.65rem);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
  }

  .letter-card {
    border-radius: 9px;
    font-size: clamp(1.15rem, 3.2svh, 1.65rem);
  }

  .quiz-options {
    gap: 10px;
  }

  .quiz-option {
    min-height: 72px;
  }

  .feedback-row {
    flex-direction: column;
  }
}
