:root {
  --ink: #182033;
  --muted: #647087;
  --paper: #ffffff;
  --soft: #f6f8fc;
  --line: #e5eaf3;
  --green: #35c976;
  --green-dark: #149c54;
  --blue: #3f8cff;
  --coral: #ff705d;
  --yellow: #ffc84a;
  --teal: #14b8a6;
  --shadow: 0 18px 45px rgba(31, 47, 79, 0.13);
  --small-shadow: 0 10px 25px rgba(31, 47, 79, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 200, 74, 0.28), transparent 28rem),
    linear-gradient(180deg, #edf7ff 0%, #f8fbff 42%, #ffffff 100%);
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.is-playing {
  overflow: hidden;
}

button,
a {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.is-hidden {
  display: none !important;
}

.app-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 14px 16px 36px;
}

.hero {
  display: grid;
  gap: 14px;
  padding-bottom: 12px;
}

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

.user-menu {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.nav-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 3px solid white;
  border-radius: 50%;
  background: white;
  box-shadow: var(--small-shadow);
  object-fit: cover;
}

.user-menu .pill {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.change-avatar {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  color: #2367c7;
  background: rgba(233, 242, 255, 0.9);
  box-shadow: 0 8px 20px rgba(31, 47, 79, 0.06);
  font-size: 0.86rem;
  font-weight: 900;
  white-space: nowrap;
}

.logout-button {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 999px;
  color: #2a3a56;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 20px rgba(31, 47, 79, 0.08);
  font-size: 0.86rem;
  font-weight: 900;
  white-space: nowrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 1.05rem;
  font-weight: 900;
}

.brand-logo {
  display: block;
  width: min(168px, 42vw);
  height: auto;
  object-fit: contain;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: white;
  background: linear-gradient(135deg, var(--coral), var(--yellow));
  box-shadow: var(--small-shadow);
  font-size: 1.6rem;
  line-height: 1;
}

.pill,
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid rgba(63, 140, 255, 0.18);
  border-radius: 999px;
  color: #2367c7;
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.88rem;
  font-weight: 900;
  white-space: nowrap;
}

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

.eyebrow {
  margin: 0;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(1.95rem, 10vw, 4.9rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 7vw, 2.45rem);
  line-height: 1;
  letter-spacing: 0;
}

.intro {
  max-width: 36rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.selected-program {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  min-height: 36px;
  align-items: center;
  margin: 2px 0 0;
  padding: 7px 13px;
  border-radius: 999px;
  color: #2367c7;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 20px rgba(31, 47, 79, 0.08);
  font-size: 0.86rem;
  font-weight: 900;
}

.progress-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--small-shadow);
  backdrop-filter: blur(16px);
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-weight: 900;
}

.progress-copy strong {
  color: var(--ink);
  font-size: 0.98rem;
}

.progress-track {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe7f5;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--teal));
  transition: width 500ms ease;
}

.reward-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.is-patatas-level .level-progress-card,
.is-patatas-level .reward-tile-completed {
  display: none;
}

.is-patatas-level .reward-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reward-tile {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 10px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(31, 47, 79, 0.08);
}

.reward-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: white;
  background: linear-gradient(135deg, var(--yellow), var(--coral));
  font-weight: 900;
}

.reward-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reward-tile strong {
  font-size: 1.2rem;
  line-height: 1;
}

main {
  display: grid;
  gap: 14px;
  padding-top: 12px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.patatas-dashboard {
  display: grid;
  gap: 16px;
}

.patatas-hero {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(255, 176, 32, 0.28);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 246, 216, 0.86), rgba(255, 255, 255, 0.96) 54%),
    var(--paper);
  box-shadow: var(--small-shadow);
}

.patatas-copy {
  display: grid;
  gap: 5px;
}

.patatas-copy h2,
.patatas-copy p,
.patatas-progress-card p,
.patatas-choice-card h3,
.patatas-choice-card p {
  margin: 0;
}

.patatas-copy h2 {
  font-size: clamp(1.85rem, 8vw, 2.85rem);
  line-height: 1;
  letter-spacing: 0;
}

.patatas-copy p,
.patatas-progress-card p,
.patatas-choice-card p {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.patatas-progress-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(31, 47, 79, 0.08);
}

.patatas-progress-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.patatas-progress-card strong {
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
}

.patatas-progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.patatas-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--yellow), var(--green));
  transition: width 220ms ease;
}

.patatas-choice-grid {
  display: grid;
  gap: 12px;
}

.patatas-choice-card {
  display: grid;
  gap: 18px;
  min-height: 250px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--small-shadow);
}

.patatas-choice-card > div {
  display: grid;
  align-content: start;
  gap: 10px;
}

.patatas-choice-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 20px;
  color: white;
  background: linear-gradient(135deg, var(--green), var(--teal));
  font-size: 1.55rem;
  font-weight: 900;
}

.patatas-choice-icon-grammar {
  background: linear-gradient(135deg, var(--yellow), var(--orange));
}

.patatas-choice-card h3 {
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1.08;
}

.patatas-choice-button,
.patatas-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  box-shadow: 0 10px 20px rgba(20, 184, 166, 0.2);
  font-size: 1rem;
  font-weight: 900;
}

.patatas-choice-button {
  align-self: end;
  width: 100%;
}

.patatas-back {
  justify-self: start;
}

.vocabulary-topic-back {
  margin-bottom: 2px;
}

.vocabulary-module-locked {
  opacity: 0.72;
}

.vocabulary-status {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #2a3a56;
  background: #eef4ff;
  font-size: 0.78rem;
  font-weight: 900;
}

.vocabulary-status-locked {
  color: #64748b;
  background: #eef2f7;
}

.vocabulary-status-in-progress {
  color: #92400e;
  background: #fff7d6;
}

.vocabulary-status-minimum-completed {
  color: #0d7d49;
  background: #e5f9ef;
}

.vocabulary-status-fully-completed {
  color: white;
  background: var(--green);
}

.vocabulary-progress-lines,
.vocabulary-progress-panel {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1.25;
}

.vocabulary-progress-panel {
  padding: 13px 14px;
  border: 1px solid rgba(20, 184, 166, 0.2);
  border-radius: 20px;
  color: #2367c7;
  background: rgba(233, 242, 255, 0.82);
}

.vocabulary-progress-panel strong {
  color: var(--ink);
}

.vocabulary-activity-card .module-title {
  overflow-wrap: anywhere;
}

.vocabulary-unlock-message {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(24, 32, 51, 0.48);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.vocabulary-unlock-message.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.vocabulary-unlock-panel {
  display: grid;
  gap: 13px;
  width: min(100%, 480px);
  padding: 18px;
  border-radius: 24px;
  background: white;
  box-shadow: var(--shadow);
}

.vocabulary-unlock-panel strong {
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1.08;
}

.vocabulary-unlock-panel p {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  line-height: 1.35;
}

.vocabulary-unlock-actions {
  display: grid;
  gap: 9px;
}

.view-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(63, 140, 255, 0.15);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 24px rgba(31, 47, 79, 0.08);
}

.view-tab {
  min-height: 46px;
  border-radius: 15px;
  color: var(--muted);
  background: transparent;
  font-size: 1rem;
  font-weight: 900;
  transition:
    color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.view-tab.is-active {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  box-shadow: 0 10px 20px rgba(20, 184, 166, 0.2);
}

.view-tab:active {
  transform: scale(0.98);
}

.status-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 18px;
  border: 1px dashed #cad5e6;
  border-radius: 22px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 800;
}

.status-box.is-hidden {
  display: none;
}

.filters {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  gap: 10px;
  margin-inline: -16px;
  padding: 10px 16px 2px;
  background: rgba(241, 248, 255, 0.92);
  backdrop-filter: blur(14px);
}

.filters-label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 900;
}

.filter-scroll {
  display: flex;
  gap: 9px;
  margin-inline: -16px;
  padding: 0 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.filter-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #2a3a56;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 20px rgba(31, 47, 79, 0.08);
  font-size: 0.94rem;
  font-weight: 900;
  scroll-snap-align: start;
  transition:
    transform 180ms ease,
    color 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.filter-chip.is-active {
  border-color: transparent;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--teal));
}

.filter-chip:active {
  transform: scale(0.97);
}

.badges-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--small-shadow);
}

.badges-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.badges-heading h2 {
  font-size: 1.28rem;
}

.badge-list {
  display: flex;
  gap: 9px;
  margin-inline: -14px;
  padding: 0 14px 2px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.badge-list::-webkit-scrollbar {
  display: none;
}

.badge-chip {
  flex: 0 0 178px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 64px;
  padding: 10px;
  border: 1px solid #e7edf6;
  border-radius: 18px;
  color: var(--muted);
  background: #f7f9fd;
  scroll-snap-align: start;
}

.badge-chip.is-unlocked {
  color: var(--ink);
  background: linear-gradient(135deg, #fff6d8, #eafaf1);
  border-color: rgba(255, 200, 74, 0.55);
  animation: badgePop 420ms ease both;
}

.badge-symbol {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #94a3b8;
  background: white;
  font-weight: 900;
}

.badge-chip.is-unlocked .badge-symbol {
  color: white;
  background: linear-gradient(135deg, var(--yellow), var(--coral));
}

.badge-chip strong,
.badge-chip small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-chip strong {
  font-size: 0.88rem;
  line-height: 1.05;
}

.badge-chip small {
  margin-top: 3px;
  font-size: 0.76rem;
  font-weight: 800;
}

.parent-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(63, 140, 255, 0.16);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--small-shadow);
}

.parent-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.parent-heading h2 {
  font-size: 1.28rem;
}

.parent-reset {
  min-height: 40px;
  padding: 8px 13px;
  border-radius: 999px;
  color: #b42318;
  background: #fff0ee;
  font-size: 0.9rem;
  font-weight: 900;
}

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

.parent-stat {
  display: grid;
  gap: 5px;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fbff;
}

.parent-stat span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parent-stat strong {
  align-self: end;
  overflow: hidden;
  font-size: 1.05rem;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reset-confirm {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 18px;
  color: #7a271a;
  background: #fff7ed;
  font-weight: 900;
}

.reset-confirm[hidden] {
  display: none;
}

.reset-confirm button {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #2a3a56;
  background: white;
  font-size: 0.86rem;
  font-weight: 900;
}

#resetConfirmButton {
  color: white;
  background: #e5484d;
}

.loader {
  width: 22px;
  height: 22px;
  border: 3px solid #dce5f4;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.modules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.module-card {
  position: relative;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  min-height: 142px;
  padding: 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: var(--small-shadow);
  animation: riseIn 420ms ease both;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.module-card.is-completed {
  border-color: rgba(53, 201, 118, 0.45);
  background:
    linear-gradient(135deg, rgba(229, 249, 239, 0.72), rgba(255, 255, 255, 0.94) 44%),
    var(--paper);
}

.module-card.is-completed::after {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: white;
  background: var(--green);
  box-shadow: 0 8px 18px rgba(53, 201, 118, 0.3);
  content: "✓";
  font-weight: 900;
}

.video-card {
  border-color: rgba(139, 92, 246, 0.22);
}

.video-art {
  background: linear-gradient(135deg, #8b5cf6, #3f8cff);
}

.video-badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #5b21b6;
  background: #f1eaff;
  font-size: 0.78rem;
  font-weight: 900;
}

.video-play {
  background: linear-gradient(135deg, #8b5cf6, #3f8cff) !important;
  box-shadow: 0 10px 20px rgba(63, 140, 255, 0.22) !important;
}

.module-card:active {
  transform: scale(0.985);
}

.module-art {
  display: grid;
  place-items: center;
  align-self: start;
  width: 76px;
  height: 76px;
  overflow: hidden;
  border-radius: 22px;
  color: white;
  background: var(--card-color, var(--blue));
  font-size: 2rem;
  font-weight: 900;
  box-shadow: inset 0 -18px 30px rgba(0, 0, 0, 0.08);
}

.module-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.module-body {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.module-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #2a3a56;
  background: #eef4ff;
  font-size: 0.78rem;
  font-weight: 900;
}

.tag.level {
  color: #0d7d49;
  background: #e5f9ef;
}

.done-badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.done-badge:empty {
  display: none;
}

.module-title {
  margin: 0;
  font-size: 1.17rem;
  line-height: 1.08;
  letter-spacing: 0;
}

.module-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.module-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 17px;
  border-radius: 999px;
  font-size: 0.98rem;
  font-weight: 900;
  transition:
    transform 180ms ease,
    filter 180ms ease;
}

.module-action.play {
  color: white;
  background: linear-gradient(135deg, var(--green), var(--teal));
  box-shadow: 0 10px 20px rgba(20, 184, 166, 0.24);
}

.module-action.done {
  color: var(--green-dark);
  background: #e5f9ef;
}

.module-action:disabled {
  cursor: not-allowed;
  color: #7b8798;
  background: #eef2f7;
  box-shadow: none;
  opacity: 0.76;
}

.is-completed .module-action.done {
  color: white;
  background: var(--green);
}

.module-action:focus-visible,
.brand:focus-visible,
.filter-chip:focus-visible,
.view-tab:focus-visible,
.parent-reset:focus-visible,
.reset-confirm button:focus-visible,
.logout-button:focus-visible,
.auth-button:focus-visible,
.avatar-option:focus-visible,
.program-option:focus-visible,
.materials-panel summary:focus-visible,
.flipbook-button:focus-visible,
.change-avatar:focus-visible,
.patatas-choice-button:focus-visible,
.patatas-back:focus-visible,
.icon-button:focus-visible,
.player-button:focus-visible {
  outline: 4px solid rgba(63, 140, 255, 0.28);
  outline-offset: 3px;
}

.module-action:active {
  transform: translateY(1px);
}

.grammar-dashboard {
  display: grid;
  gap: 14px;
}

.grammar-shell {
  display: grid;
  gap: 14px;
}

.grammar-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 176, 32, 0.28);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(255, 246, 216, 0.82), rgba(255, 255, 255, 0.95) 52%),
    var(--paper);
  box-shadow: var(--small-shadow);
}

.grammar-overview-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.grammar-kicker {
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.grammar-title,
.grammar-stage-title,
.grammar-roadmap-title {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.08;
}

.grammar-title {
  font-size: clamp(1.45rem, 7vw, 2.25rem);
}

.grammar-stage-title,
.grammar-roadmap-title {
  font-size: 1.25rem;
}

.grammar-goal {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.grammar-subtitle {
  margin: 0;
  color: #7a4f00;
  font-size: 1.04rem;
  font-weight: 900;
}

.grammar-score {
  display: grid;
  place-items: center;
  align-self: start;
  min-width: 86px;
  min-height: 70px;
  padding: 10px;
  border-radius: 20px;
  color: #2a3a56;
  background: white;
  box-shadow: 0 8px 18px rgba(31, 47, 79, 0.08);
  text-align: center;
}

.grammar-score strong {
  font-size: 1.35rem;
  line-height: 1;
}

.grammar-score span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
}

.grammar-progress {
  grid-column: 1 / -1;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.grammar-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--yellow), var(--green));
  transition: width 220ms ease;
}

.grammar-selection-header {
  align-items: stretch;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.grammar-selection-summary {
  display: grid;
  place-items: center;
  align-self: start;
  min-width: 86px;
  min-height: 70px;
  padding: 10px;
  border-radius: 20px;
  color: #2a3a56;
  background: #fff8dc;
  box-shadow: 0 8px 18px rgba(31, 47, 79, 0.08);
  text-align: center;
}

.grammar-selection-summary strong {
  font-size: 1.35rem;
  line-height: 1;
}

.grammar-selection-summary span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
}

.grammar-selection-grid {
  display: grid;
  gap: 12px;
}

.grammar-progress-panel,
.grammar-parent-summary {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--small-shadow);
}

.grammar-progress-panel-copy {
  display: grid;
  gap: 5px;
}

.grammar-progress-panel-copy p,
.grammar-parent-summary p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.grammar-parent-stats {
  display: grid;
  gap: 8px;
}

.grammar-parent-stats span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  color: var(--muted);
  background: #f8fafc;
  font-weight: 900;
}

.grammar-parent-stats strong {
  color: var(--ink);
  font-size: 1.1rem;
}

.grammar-parent-completed {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.grammar-parent-completed span {
  padding: 7px 10px;
  border-radius: 999px;
  color: #2a3a56;
  background: #e9f2ff;
  font-size: 0.82rem;
  font-weight: 900;
}

.grammar-activity-back {
  justify-self: start;
}

.grammar-module-card {
  display: grid;
  gap: 12px;
  min-height: 260px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 252, 239, 0.9)),
    var(--paper);
  box-shadow: var(--small-shadow);
}

.grammar-module-card-complete {
  border-color: rgba(20, 184, 166, 0.42);
  background:
    linear-gradient(180deg, rgba(234, 250, 241, 0.96), rgba(255, 255, 255, 0.95)),
    var(--paper);
}

.grammar-module-card-locked {
  opacity: 0.76;
}

.grammar-module-topline,
.grammar-module-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.grammar-module-number {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 36px;
  padding-inline: 10px;
  border-radius: 14px;
  color: #2367c7;
  background: #e9f2ff;
  font-weight: 900;
}

.grammar-module-status {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.grammar-module-status-complete {
  color: #0d7d49;
  background: #dff7e9;
}

.grammar-module-status-available {
  color: #7a4f00;
  background: #fff0bd;
}

.grammar-module-status-locked {
  color: #64748b;
  background: #edf2f7;
}

.grammar-module-copy {
  display: grid;
  align-content: start;
  gap: 6px;
}

.grammar-module-title,
.grammar-module-polish,
.grammar-module-description {
  margin: 0;
}

.grammar-module-title {
  color: var(--ink);
  font-size: 1.28rem;
  line-height: 1.08;
}

.grammar-module-polish {
  color: #7a4f00;
  font-weight: 900;
}

.grammar-module-description {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.35;
}

.grammar-module-progress {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.grammar-module-progress-track {
  flex: 1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.92);
}

.grammar-module-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--yellow), var(--green));
  transition: width 220ms ease;
}

.grammar-module-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.grammar-module-state strong {
  color: #7a4f00;
}

.grammar-module-button {
  align-self: end;
  width: 100%;
}

.grammar-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(76px, 1fr));
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.grammar-steps::-webkit-scrollbar {
  display: none;
}

.grammar-step {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 78px;
  min-width: 76px;
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 18px rgba(31, 47, 79, 0.07);
  font-weight: 900;
}

.grammar-step-active {
  border-color: rgba(20, 184, 166, 0.45);
  color: var(--ink);
  background: #eafaf1;
}

.grammar-step-done .grammar-step-number {
  color: white;
  background: var(--green);
}

.grammar-step-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 11px;
  color: #2367c7;
  background: #e9f2ff;
  font-size: 0.9rem;
}

.grammar-step-label {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grammar-stage,
.grammar-card,
.grammar-roadmap {
  display: grid;
  gap: 14px;
}

.grammar-card,
.grammar-roadmap {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--small-shadow);
}

.grammar-learn-grid,
.grammar-fmu-grid,
.grammar-color-grid,
.grammar-number-grid,
.grammar-animal-grid,
.grammar-food-grid,
.grammar-body-grid,
.grammar-emotion-grid,
.grammar-weather-grid,
.grammar-family-grid,
.grammar-ability-grid,
.grammar-choice-list,
.grammar-word-bank,
.grammar-name-list,
.grammar-chip-list,
.grammar-vocab-list,
.grammar-roadmap-list {
  display: grid;
  gap: 10px;
}

.grammar-learn-card,
.grammar-color-card,
.grammar-number-card,
.grammar-animal-card,
.grammar-food-card,
.grammar-body-card,
.grammar-emotion-card,
.grammar-weather-card,
.grammar-family-card,
.grammar-ability-card,
.grammar-fmu-card,
.grammar-roadmap-item {
  display: grid;
  gap: 4px;
  min-height: 82px;
  padding: 13px;
  border: 1px solid rgba(229, 234, 243, 0.9);
  border-radius: 18px;
  background: #f8fbff;
}

.grammar-learn-card strong {
  font-size: 1.2rem;
}

.grammar-number-card {
  justify-items: center;
  min-height: 128px;
  text-align: center;
}

.grammar-animal-card,
.grammar-food-card,
.grammar-body-card,
.grammar-emotion-card,
.grammar-weather-card,
.grammar-family-card,
.grammar-ability-card {
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  min-height: 112px;
}

.grammar-animal-card strong,
.grammar-food-card strong,
.grammar-body-card strong,
.grammar-emotion-card strong,
.grammar-weather-card strong,
.grammar-family-card strong,
.grammar-ability-card strong,
.grammar-animal-card span:not(.grammar-animal-emoji),
.grammar-food-card span:not(.grammar-food-emoji),
.grammar-body-card span:not(.grammar-body-emoji),
.grammar-emotion-card span:not(.grammar-emotion-emoji),
.grammar-weather-card span:not(.grammar-weather-emoji),
.grammar-family-card span:not(.grammar-family-emoji),
.grammar-ability-card span:not(.grammar-ability-emoji),
.grammar-animal-card small,
.grammar-food-card small,
.grammar-body-card small,
.grammar-emotion-card small,
.grammar-weather-card small,
.grammar-family-card small,
.grammar-ability-card small {
  grid-column: 2;
}

.grammar-animal-emoji,
.grammar-food-emoji,
.grammar-body-emoji,
.grammar-emotion-emoji,
.grammar-weather-emoji,
.grammar-family-emoji,
.grammar-ability-emoji {
  grid-row: 1 / span 3;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 17px;
  background: linear-gradient(135deg, #fff6d8, #eafaf1);
  box-shadow: inset 0 -10px 18px rgba(31, 47, 79, 0.06);
  font-size: 2rem;
}

.grammar-number-digit {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  box-shadow: 0 10px 20px rgba(63, 140, 255, 0.18);
  font-size: 1.75rem;
  font-weight: 900;
}

.grammar-number-card strong {
  font-size: 1.08rem;
}

.grammar-animal-card strong,
.grammar-food-card strong,
.grammar-body-card strong,
.grammar-emotion-card strong,
.grammar-weather-card strong,
.grammar-family-card strong,
.grammar-ability-card strong {
  font-size: 1.1rem;
}

.grammar-learn-card span,
.grammar-color-card span,
.grammar-number-card span,
.grammar-animal-card span:not(.grammar-animal-emoji),
.grammar-food-card span:not(.grammar-food-emoji),
.grammar-body-card span:not(.grammar-body-emoji),
.grammar-emotion-card span:not(.grammar-emotion-emoji),
.grammar-weather-card span:not(.grammar-weather-emoji),
.grammar-family-card span:not(.grammar-family-emoji),
.grammar-ability-card span:not(.grammar-ability-emoji),
.grammar-fmu-card span,
.grammar-roadmap-item strong {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.grammar-color-card {
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
}

.grammar-color-card strong,
.grammar-color-card span,
.grammar-color-card small {
  grid-column: 2;
}

.grammar-color-card small,
.grammar-animal-card small,
.grammar-food-card small,
.grammar-body-card small,
.grammar-emotion-card small,
.grammar-weather-card small,
.grammar-family-card small,
.grammar-ability-card small,
.grammar-fmu-card small {
  color: #2a3a56;
  font-size: 0.86rem;
  font-weight: 900;
}

.grammar-weather-section,
.grammar-family-section,
.grammar-ability-section {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.grammar-weather-section h4,
.grammar-family-section h4,
.grammar-ability-section h4 {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
}

.grammar-color-swatch {
  grid-row: 1 / span 3;
  display: block;
  width: 44px;
  height: 44px;
  border: 2px solid transparent;
  border-radius: 15px;
  box-shadow: inset 0 -12px 20px rgba(0, 0, 0, 0.08);
}

.grammar-fmu-card strong {
  font-size: 1.02rem;
  line-height: 1.18;
}

.grammar-tip,
.grammar-note-list p,
.grammar-feedback,
.grammar-built-sentence {
  margin: 0;
  font-weight: 900;
  line-height: 1.35;
}

.grammar-tip {
  padding: 13px;
  border-radius: 18px;
  color: #7a4f00;
  background: #fff6d8;
}

.grammar-note-list {
  display: grid;
  gap: 8px;
}

.grammar-note-list p {
  color: var(--muted);
}

.grammar-prompt,
.grammar-answer {
  display: grid;
  place-items: center;
  min-height: 76px;
  margin: 0;
  padding: 14px;
  border-radius: 20px;
  color: var(--ink);
  background: #eef4ff;
  font-size: 1.25rem;
  font-weight: 900;
  text-align: center;
}

.grammar-question {
  margin: 0;
  color: #2a3a56;
  font-weight: 900;
  line-height: 1.35;
}

.grammar-chip-list,
.grammar-vocab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.grammar-chip,
.grammar-vocab-list span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 999px;
  font-weight: 900;
}

.grammar-chip {
  color: #2367c7;
  background: #e9f2ff;
}

.grammar-vocab-list span {
  color: #2a3a56;
  background: #f8fbff;
  border: 1px solid var(--line);
}

.grammar-color-display {
  width: min(100%, 220px);
  min-height: 110px;
  border: 2px solid rgba(31, 47, 79, 0.08);
  border-radius: 24px;
  box-shadow: inset 0 -22px 35px rgba(0, 0, 0, 0.08), var(--small-shadow);
}

.grammar-color-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 1px solid rgba(31, 47, 79, 0.12);
  border-radius: 50%;
  box-shadow: inset 0 -5px 8px rgba(0, 0, 0, 0.08);
}

.grammar-count-display {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 84px;
  padding: 13px;
  border-radius: 20px;
  background: #eef4ff;
  font-size: 2rem;
}

.grammar-animal-display,
.grammar-food-display,
.grammar-body-display,
.grammar-emotion-display,
.grammar-weather-display,
.grammar-family-display,
.grammar-ability-display {
  display: grid;
  place-items: center;
  width: min(100%, 180px);
  min-height: 112px;
  border-radius: 24px;
  background: #eef4ff;
  box-shadow: inset 0 -18px 28px rgba(31, 47, 79, 0.06), var(--small-shadow);
  font-size: 4rem;
}

.grammar-choice,
.grammar-word,
.grammar-name,
.grammar-button {
  min-height: 46px;
  border-radius: 16px;
  font-weight: 900;
  transition:
    transform 180ms ease,
    filter 180ms ease,
    opacity 180ms ease;
}

.grammar-choice {
  padding: 11px 13px;
  color: #2a3a56;
  background: #f8fbff;
  border: 1px solid var(--line);
  text-align: left;
}

.grammar-word,
.grammar-name {
  padding: 10px 15px;
  color: #2367c7;
  background: #e9f2ff;
}

.grammar-color-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.grammar-animal-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.grammar-word:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

.grammar-word-bank,
.grammar-name-list,
.grammar-actions,
.grammar-final-actions,
.grammar-stars {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.grammar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  text-align: center;
}

.grammar-button-primary {
  color: white;
  background: linear-gradient(135deg, var(--green), var(--teal));
  box-shadow: 0 10px 20px rgba(20, 184, 166, 0.22);
}

.grammar-button-secondary {
  color: #2367c7;
  background: #e9f2ff;
}

.grammar-feedback {
  padding: 12px 13px;
  border-radius: 18px;
}

.grammar-feedback-correct {
  color: #0d7d49;
  background: #e5f9ef;
}

.grammar-feedback-incorrect {
  color: #b42318;
  background: #fff0ee;
}

.grammar-feedback-neutral {
  color: #2a3a56;
  background: #eef4ff;
}

.grammar-built-sentence {
  padding: 13px;
  border-radius: 18px;
  color: #2a3a56;
  background: #f8fbff;
  font-size: 1.08rem;
}

.grammar-final {
  border-color: rgba(53, 201, 118, 0.4);
  background:
    linear-gradient(135deg, rgba(229, 249, 239, 0.86), rgba(255, 255, 255, 0.96) 58%),
    var(--paper);
}

.grammar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 999px;
  color: #7a4f00;
  background: #fff6d8;
  box-shadow: 0 8px 18px rgba(255, 200, 74, 0.2);
  font-weight: 900;
}

.grammar-stars {
  color: var(--yellow);
  font-size: 1.55rem;
  line-height: 1;
  text-shadow: 0 3px 8px rgba(255, 200, 74, 0.3);
}

.grammar-preview-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(63, 140, 255, 0.16);
  border-radius: 20px;
  background: #f8fbff;
}

.grammar-preview-card p {
  margin: 0;
  color: #2a3a56;
  font-size: 1.08rem;
  font-weight: 900;
}

.grammar-production-group {
  display: grid;
  gap: 8px;
}

.grammar-production-group strong {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.grammar-production-selected {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--teal));
}

.grammar-roadmap-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 56px;
  text-align: left;
}

.grammar-roadmap-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.grammar-unit-tile {
  cursor: pointer;
}

.grammar-unit-active {
  border-color: rgba(20, 184, 166, 0.45);
  background: #eafaf1;
}

.grammar-unit-completed strong {
  color: #0d7d49;
}

.grammar-unit-tile:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.grammar-match-grid {
  display: grid;
  gap: 10px;
}

.grammar-match-column {
  display: grid;
  gap: 8px;
}

.grammar-match-color {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: #2a3a56;
  background: #f8fbff;
  font-weight: 900;
  text-align: left;
}

.grammar-match-selected {
  border-color: rgba(63, 140, 255, 0.55);
  background: #e9f2ff;
}

.grammar-match-done {
  border-color: rgba(53, 201, 118, 0.38);
  background: #e5f9ef;
}

.grammar-number-match {
  justify-content: center;
}

.grammar-animal-match,
.grammar-food-match,
.grammar-body-match,
.grammar-emotion-match,
.grammar-weather-match,
.grammar-family-match,
.grammar-ability-match {
  justify-content: flex-start;
}

.grammar-number-mini {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  font-weight: 900;
}

.grammar-animal-mini,
.grammar-food-mini,
.grammar-body-mini,
.grammar-emotion-mini,
.grammar-weather-mini,
.grammar-family-mini,
.grammar-ability-mini {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: #eef4ff;
  font-size: 1.55rem;
}

.grammar-choice:focus-visible,
.grammar-word:focus-visible,
.grammar-name:focus-visible,
.grammar-button:focus-visible,
.grammar-step:focus-visible,
.grammar-match-color:focus-visible {
  outline: 4px solid rgba(63, 140, 255, 0.28);
  outline-offset: 3px;
}

.grammar-choice:active,
.grammar-word:active,
.grammar-name:active,
.grammar-button:active,
.grammar-step:active,
.grammar-match-color:active {
  transform: scale(0.98);
}

.empty-state {
  padding: 22px;
  border-radius: 24px;
  color: var(--muted);
  background: var(--paper);
  font-weight: 800;
  text-align: center;
}

.player-view {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(237, 247, 255, 0.98), rgba(255, 255, 255, 0.98)),
    var(--soft);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
  transform: translateY(14px);
}

.player-view[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.player-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  width: min(100%, 1180px);
  min-height: calc(100vh - 20px);
  min-height: calc(100dvh - 20px);
  margin: 0 auto;
}

.player-topbar {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 6px 2px 2px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  color: var(--ink);
  background: white;
  box-shadow: var(--small-shadow);
  font-size: 1.4rem;
  font-weight: 900;
}

.player-title-wrap {
  min-width: 0;
}

.player-category {
  display: block;
  margin-bottom: 2px;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.player-title-wrap h2 {
  overflow: hidden;
  margin: 0;
  font-size: clamp(1.2rem, 6vw, 2rem);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-frame-wrap {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(63, 140, 255, 0.09), rgba(53, 201, 118, 0.1)),
    white;
  box-shadow: var(--shadow);
}

.frame-status {
  position: absolute;
  inset: auto 14px 14px;
  z-index: 2;
  display: grid;
  justify-items: start;
  gap: 5px;
  max-width: 340px;
  padding: 14px;
  border: 1px solid rgba(202, 213, 230, 0.8);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 28px rgba(31, 47, 79, 0.12);
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.frame-status strong {
  color: var(--ink);
}

.frame-status p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.25;
}

.game-frame-wrap.is-loading .frame-status {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.game-frame-wrap.is-ready .frame-status {
  opacity: 0;
  pointer-events: none;
}

.game-frame {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
  border: 0;
  background: white;
}

.video-frame-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #101827;
  box-shadow: var(--shadow);
}

.video-frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 230px;
  border: 0;
  background: #101827;
}

.flipbook-frame-wrap {
  position: relative;
  min-height: 480px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: white;
  box-shadow: var(--shadow);
}

.flipbook-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 480px;
  border: 0;
  background: white;
}

.player-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
}

.video-actions .player-button.primary {
  grid-column: 1 / -1;
}

.player-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 0.98rem;
  font-weight: 900;
  text-align: center;
  transition:
    transform 180ms ease,
    filter 180ms ease,
    opacity 180ms ease;
}

.player-button.primary {
  color: white;
  background: linear-gradient(135deg, var(--green), var(--teal));
  box-shadow: 0 12px 24px rgba(20, 184, 166, 0.22);
}

.player-button.secondary {
  color: #2367c7;
  background: #e9f2ff;
}

.player-button.quiet {
  grid-column: 1 / -1;
  color: var(--muted);
  background: white;
  border: 1px solid var(--line);
}

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

.player-button:active,
.icon-button:active {
  transform: scale(0.98);
}

.celebration {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 30;
  min-width: 190px;
  padding: 14px 18px;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, var(--coral), var(--yellow));
  box-shadow: var(--shadow);
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px) scale(0.96);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.celebration.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.auth-page {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
}

.auth-shell {
  display: grid;
  width: min(100%, 520px);
  padding: 18px;
}

.avatar-shell {
  display: grid;
  width: min(100%, 980px);
  padding: 18px;
}

.program-shell {
  display: grid;
  width: min(100%, 860px);
  padding: 18px;
}

.auth-card {
  display: grid;
  gap: 22px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.avatar-card {
  display: grid;
  gap: 20px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.program-card {
  display: grid;
  gap: 22px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

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

.program-top .auth-logo-link {
  justify-self: auto;
}

.program-top .auth-logo {
  width: min(168px, 42vw);
}

.program-user {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.auth-logo-link {
  display: grid;
  justify-items: center;
  gap: 10px;
  justify-self: center;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.auth-logo {
  display: block;
  width: min(190px, 56vw);
  height: auto;
  object-fit: contain;
}

.auth-copy {
  display: grid;
  gap: 8px;
}

.auth-copy h1 {
  font-size: clamp(2rem, 10vw, 3.4rem);
}

.auth-copy p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: #2a3a56;
  font-weight: 900;
}

.auth-form input {
  width: 100%;
  min-height: 54px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: #f8fbff;
  font: inherit;
  font-weight: 800;
  outline: 0;
}

.auth-form input:focus {
  border-color: rgba(63, 140, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(63, 140, 255, 0.16);
}

.auth-button {
  min-height: 54px;
  border-radius: 18px;
  color: white;
  background: linear-gradient(135deg, var(--green), var(--teal));
  box-shadow: 0 12px 24px rgba(20, 184, 166, 0.22);
  font-size: 1rem;
  font-weight: 900;
}

.auth-message {
  min-height: 22px;
  margin: 0;
  color: #b42318;
  font-weight: 900;
}

.auth-link {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.auth-link a {
  color: #2367c7;
}

.program-grid {
  display: grid;
  gap: 12px;
}

.program-option {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 132px;
  padding: 16px;
  border: 3px solid transparent;
  border-radius: 24px;
  color: var(--ink);
  background: #f8fbff;
  box-shadow: 0 10px 24px rgba(31, 47, 79, 0.08);
  text-align: left;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.program-option strong,
.program-option small,
.program-description {
  display: block;
}

.program-option strong {
  margin-bottom: 4px;
  font-size: 1.45rem;
  line-height: 1;
}

.program-option small {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.25;
}

.program-description {
  margin-top: 7px;
  color: #42516d;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.28;
}

.program-option.is-selected {
  border-color: var(--program-color);
  box-shadow: 0 0 0 5px rgba(63, 140, 255, 0.14), var(--shadow);
}

.program-option:active {
  transform: scale(0.98);
}

.program-bubble {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 20px;
  color: white;
  background: linear-gradient(135deg, var(--program-color), var(--teal));
  box-shadow: var(--small-shadow);
  font-size: 1.65rem;
  font-weight: 900;
}

.program-start {
  grid-column: 1 / -1;
  display: inline-flex;
  justify-content: center;
  min-height: 48px;
  align-items: center;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, var(--program-color), var(--blue));
  font-weight: 900;
}

.program-footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.materials-panel {
  overflow: hidden;
  border: 1px solid rgba(63, 140, 255, 0.14);
  border-radius: 24px;
  background: rgba(248, 251, 255, 0.88);
  box-shadow: 0 10px 24px rgba(31, 47, 79, 0.08);
}

.materials-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 16px;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 900;
  list-style: none;
}

.materials-panel summary::-webkit-details-marker {
  display: none;
}

.materials-arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #2367c7;
  background: #e9f2ff;
  font-size: 1.35rem;
  transition: transform 180ms ease;
}

.materials-panel[open] .materials-arrow {
  transform: rotate(180deg);
}

.materials-content {
  display: grid;
  gap: 14px;
  padding: 0 14px 14px;
}

.materials-heading {
  display: grid;
  gap: 4px;
}

.materials-heading h2 {
  font-size: clamp(1.35rem, 6vw, 2rem);
}

.flipbook-grid {
  display: grid;
  gap: 12px;
}

.flipbook-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(229, 234, 243, 0.9);
  border-radius: 22px;
  background: white;
  box-shadow: 0 10px 24px rgba(31, 47, 79, 0.08);
}

.flipbook-thumb {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border-radius: 18px;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  font-size: 1.4rem;
  font-weight: 900;
}

.flipbook-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.flipbook-copy {
  min-width: 0;
}

.flipbook-copy span {
  display: block;
  margin-bottom: 3px;
  color: var(--green-dark);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.flipbook-copy h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.08;
}

.flipbook-button {
  grid-column: 1 / -1;
  min-height: 48px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, var(--green), var(--teal));
  box-shadow: 0 10px 20px rgba(20, 184, 166, 0.2);
  font-size: 0.96rem;
  font-weight: 900;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.avatar-option {
  display: grid;
  gap: 10px;
  justify-items: center;
  min-height: 176px;
  padding: 12px;
  border: 3px solid transparent;
  border-radius: 24px;
  color: var(--ink);
  background: #f8fbff;
  box-shadow: 0 10px 24px rgba(31, 47, 79, 0.08);
  font-weight: 900;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.avatar-option img {
  width: 100%;
  max-width: 128px;
  aspect-ratio: 1;
  border-radius: 22px;
  object-fit: contain;
  background: white;
}

.avatar-option.is-selected {
  border-color: var(--green);
  box-shadow: 0 0 0 5px rgba(53, 201, 118, 0.18), var(--shadow);
}

.avatar-option:active {
  transform: scale(0.98);
}

.avatar-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  padding-top: 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.95) 30%);
}

@media (hover: hover) {
  .module-card:hover {
    transform: translateY(-4px);
    border-color: rgba(63, 140, 255, 0.32);
    box-shadow: var(--shadow);
  }

  .module-action:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
  }

  .auth-button:hover,
  .avatar-option:hover,
  .program-option:hover,
  .change-avatar:hover,
  .logout-button:hover,
  .player-button:not(:disabled):hover,
  .icon-button:hover,
  .grammar-choice:hover,
  .grammar-word:not(:disabled):hover,
  .grammar-name:hover,
  .grammar-button:hover,
  .grammar-step:hover,
  .grammar-match-color:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
  }
}

@media (min-width: 680px) {
  .app-shell {
    padding: 26px 28px 48px;
  }

  .hero {
    gap: 24px;
  }

  .progress-card {
    grid-template-columns: minmax(180px, 260px) 1fr;
    align-items: center;
    padding: 18px 20px;
  }

  .progress-copy {
    display: grid;
    gap: 2px;
  }

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

  .patatas-hero {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 0.8fr);
    align-items: center;
  }

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

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

  .grammar-progress-panel {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.8fr);
    align-items: center;
  }

  .grammar-progress-panel .grammar-progress {
    grid-column: auto;
  }

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

  .filter-scroll {
    flex-wrap: wrap;
    margin-inline: 0;
    padding-inline: 0;
    overflow: visible;
  }

  .filters {
    margin-inline: 0;
    padding-inline: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .reward-strip {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .badge-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-inline: 0;
    padding: 0;
    overflow: visible;
  }

  .badge-chip {
    flex-basis: auto;
  }

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

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

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

  .grammar-learn-grid,
  .grammar-color-grid,
  .grammar-number-grid,
  .grammar-animal-grid,
  .grammar-food-grid,
  .grammar-body-grid,
  .grammar-emotion-grid,
  .grammar-weather-grid,
  .grammar-family-grid,
  .grammar-ability-grid,
  .grammar-fmu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .grammar-roadmap-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .flipbook-card {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .flipbook-button {
    grid-column: 2;
  }

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

  .player-view {
    padding: 18px;
  }

  .player-panel {
    min-height: calc(100vh - 36px);
    min-height: calc(100dvh - 36px);
  }

  .player-actions {
    grid-template-columns: minmax(160px, 0.8fr) minmax(170px, 0.8fr) minmax(180px, 1fr);
  }

  .video-actions {
    grid-template-columns: minmax(240px, 1.2fr) minmax(170px, 0.8fr) minmax(180px, 0.8fr);
  }

  .video-actions .player-button.primary {
    grid-column: auto;
  }

  .player-button.quiet {
    grid-column: auto;
  }
}

@media (max-width: 420px) {
  .grammar-selection-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .grammar-selection-summary,
  .grammar-score {
    width: 100%;
  }

  .topbar {
    align-items: flex-start;
  }

  .brand {
    font-size: 0.98rem;
  }

  .user-menu {
    display: grid;
    justify-items: end;
    gap: 6px;
  }

  .nav-avatar {
    width: 38px;
    height: 38px;
  }

  .pill,
  .count-badge {
    font-size: 0.8rem;
    padding-inline: 10px;
  }

  .reward-tile {
    padding: 10px 8px;
    border-radius: 17px;
  }

  .reward-icon {
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

  .module-card {
    grid-template-columns: 70px 1fr;
    gap: 12px;
  }

  .module-art {
    width: 70px;
    height: 70px;
    border-radius: 20px;
  }

  .module-actions {
    gap: 7px;
  }

  .grammar-overview {
    grid-template-columns: 1fr;
  }

  .grammar-score {
    justify-self: start;
  }

  .grammar-final-actions .grammar-button {
    width: 100%;
  }

  .reset-confirm {
    grid-template-columns: 1fr;
  }

  .reset-confirm button {
    width: 100%;
  }

  .game-frame-wrap,
  .game-frame,
  .video-frame-wrap,
  .flipbook-frame-wrap,
  .flipbook-frame {
    min-height: 360px;
  }

  .player-actions {
    gap: 8px;
  }

  .player-button {
    min-height: 48px;
    border-radius: 16px;
  }

  .program-top {
    align-items: flex-start;
  }

  .program-user {
    display: grid;
    justify-items: end;
  }
}

@media (min-width: 1024px) {
  .grammar-selection-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-shell {
    padding-top: 34px;
  }

  .hero {
    grid-template-columns: 1fr minmax(320px, 420px);
    align-items: end;
  }

  .topbar,
  .welcome {
    grid-column: 1 / -1;
  }

  .progress-card {
    grid-column: 2;
  }

  .reward-strip {
    grid-column: 1;
    grid-row: 3;
    align-self: stretch;
  }

  .is-patatas-level .reward-strip {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .modules-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }

  .module-card {
    grid-template-columns: 1fr;
    min-height: 260px;
  }

  .module-art {
    width: 88px;
    height: 88px;
  }

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

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

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes badgePop {
  from {
    transform: scale(0.96);
  }

  to {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
