:root {
  color-scheme: light dark;
  /* Kids Mode palette (default): vivid pink-magenta primary with an amber
     gradient partner, bright teal accent, violet highlight. */
  --color-primary: #ff3d8a;
  --color-primary-2: #ff8a3d;
  --color-primary-ink: #ffffff;
  --color-accent-2: #00c2a8;
  --color-accent-3: #7c5cff;
  --color-bg: #f6f3ff;
  --color-surface: #ffffff;
  --color-text: #1c2433;
  --color-muted: #667085;
  --color-border: #e7e2fb;
  --color-danger: #e5484d;
  --radius-lg: 20px;
  --radius-md: 14px;
  --nav-height: 64px;
  --shadow-pop: 0 10px 24px -12px
    color-mix(in srgb, var(--color-primary) 55%, transparent);
}

/* Teen Mode re-tints the whole app via a violet-indigo primary, set purely
   through data-mode on <html> — every component below already references
   var(--color-primary) etc., so this single block is enough to retheme it. */
html[data-mode="teens"] {
  --color-primary: #7c5cff;
  --color-primary-2: #00c2a8;
  --color-accent-2: #ff3d8a;
  --color-accent-3: #ff8a3d;
  --color-bg: #f2f4ff;
  --color-border: #e2e4fb;
}

/* Width utility classes — used instead of inline style="width:...%" so the
   page can run under a strict Content-Security-Policy (no style-src 'unsafe-inline'). */
.w-0 {
  width: 0%;
}
.w-5 {
  width: 5%;
}
.w-10 {
  width: 10%;
}
.w-15 {
  width: 15%;
}
.w-20 {
  width: 20%;
}
.w-25 {
  width: 25%;
}
.w-30 {
  width: 30%;
}
.w-35 {
  width: 35%;
}
.w-40 {
  width: 40%;
}
.w-45 {
  width: 45%;
}
.w-50 {
  width: 50%;
}
.w-55 {
  width: 55%;
}
.w-60 {
  width: 60%;
}
.w-65 {
  width: 65%;
}
.w-70 {
  width: 70%;
}
.w-75 {
  width: 75%;
}
.w-80 {
  width: 80%;
}
.w-85 {
  width: 85%;
}
.w-90 {
  width: 90%;
}
.w-95 {
  width: 95%;
}
.w-100 {
  width: 100%;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html {
  scroll-padding-bottom: calc(var(--nav-height) + 24px);
}

body {
  font-family:
    "Nunito Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}

h1,
h2,
h3 {
  font-family: "Baloo 2", "Nunito Sans", sans-serif;
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  z-index: 1000;
  text-decoration: none;
  font-weight: 700;
}
.skip-link:focus {
  top: 8px;
}

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(
    120deg,
    var(--color-primary),
    var(--color-primary-2)
  );
  color: var(--color-primary-ink);
  padding: 16px 20px;
  padding-top: calc(16px + env(safe-area-inset-top));
  transition: background 0.4s ease;
}

.app-header .eyebrow {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 2px;
}

.app-header h1 {
  font-size: 1.2rem;
}

.app-main {
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.card h2 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}
.card p {
  color: var(--color-muted);
  line-height: 1.5;
  margin: 0 0 6px;
}
.muted {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.btn {
  min-height: 46px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(
    120deg,
    var(--color-primary),
    var(--color-primary-2)
  );
  color: var(--color-primary-ink);
  font-family: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0 18px;
  cursor: pointer;
  width: 100%;
  box-shadow: var(--shadow-pop);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.4s ease;
}
.btn:active:not(:disabled) {
  transform: scale(0.96);
  box-shadow: none;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}
.btn.outline {
  background: none;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
  box-shadow: none;
}
.btn.danger {
  color: var(--color-danger);
  border-color: var(--color-danger);
}
.btn.danger-solid {
  background: var(--color-danger);
  color: #ffffff;
  width: auto;
  flex: 1;
  box-shadow: none;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.confirm-actions .btn {
  width: auto;
  flex: 1;
}

.back-link {
  background: none;
  border: none;
  color: var(--color-muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 4px 0;
  cursor: pointer;
  align-self: flex-start;
}

/* Mode toggle */
.mode-toggle {
  display: flex;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px;
}
.mode-btn {
  flex: 1;
  border: none;
  background: none;
  border-radius: 999px;
  padding: 10px 0;
  font-family: inherit;
  font-weight: 700;
  color: var(--color-muted);
  cursor: pointer;
  transition:
    background 0.3s ease,
    color 0.3s ease,
    transform 0.15s ease;
}
.mode-btn:active {
  transform: scale(0.96);
}
.mode-btn.active {
  background: linear-gradient(
    120deg,
    var(--color-primary),
    var(--color-primary-2)
  );
  color: var(--color-primary-ink);
}

.hero {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--color-primary) 14%, var(--color-surface)),
    color-mix(in srgb, var(--color-accent-3) 8%, var(--color-surface))
  );
  transition: background 0.4s ease;
}

/* Tile grid (home) */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.tile {
  grid-column: span 1;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  font-family: inherit;
  animation: tile-pop 0.4s ease both;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.tile:active {
  transform: scale(0.97);
}
.tile-grid .tile:nth-child(1) {
  animation-delay: 0.03s;
}
.tile-grid .tile:nth-child(2) {
  animation-delay: 0.09s;
}
.tile-grid .tile:nth-child(3) {
  animation-delay: 0.15s;
}
.tile-wide {
  grid-column: span 2;
}
.tile.accent {
  grid-column: span 2;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  background: linear-gradient(
    120deg,
    color-mix(in srgb, var(--color-accent-2) 14%, var(--color-surface)),
    color-mix(in srgb, var(--color-accent-3) 10%, var(--color-surface))
  );
  border-color: color-mix(
    in srgb,
    var(--color-accent-2) 35%,
    var(--color-border)
  );
}
.tile-emoji {
  font-size: 1.6rem;
}
.tile-title {
  font-weight: 800;
  font-size: 0.95rem;
}
.tile-sub {
  color: var(--color-muted);
  font-size: 0.8rem;
}

/* Kids block builder */
.prompt-preview {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-weight: 700;
  color: var(--color-text) !important;
}
.score-bar,
.brain-meter {
  height: 10px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
  margin: 10px 0 4px;
}
.score-fill,
.brain-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-primary-2)
  );
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.brain-fill {
  background: linear-gradient(
    90deg,
    var(--color-accent-2),
    var(--color-primary-2)
  );
}
.brain-label {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin: 0;
}
.woof {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-primary);
}

.block-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.block-row-title {
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.block-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.block-chip {
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--color-text);
  transition:
    transform 0.15s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}
.block-chip:active {
  transform: scale(0.94);
}
.block-chip.role.selected {
  background: #ffe4dd;
  border-color: var(--color-primary);
}
.block-chip.task.selected {
  background: #dcf6f2;
  border-color: var(--color-accent-2);
}
.block-chip.context.selected {
  background: #e6e9ff;
  border-color: #6366f1;
}
.block-chip.format.selected {
  background: #fff3cf;
  border-color: #d4a017;
}

.demo-response {
  background: color-mix(
    in srgb,
    var(--color-accent-2) 10%,
    var(--color-surface)
  );
}
.demo-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent-2);
  margin-bottom: 6px;
}

/* Dog bot game */
.game-card {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
}
.game-card.trick {
  border-color: var(--color-primary);
}
.game-card {
  animation: card-flip-in 0.4s ease both;
}
.game-emoji {
  font-size: 3rem;
}
.game-label {
  font-weight: 800;
  margin-top: 6px;
}
.game-buttons {
  display: flex;
  gap: 10px;
}
.lesson p {
  color: var(--color-text);
}
.stat-line {
  font-weight: 700;
  font-size: 0.85rem;
}

/* Teen prompt studio */
.teen-textarea {
  color: var(--color-text);
  background: var(--color-surface);
  width: 100%;
  min-height: 110px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  padding: 12px;
  font-family: "Nunito Sans", sans-serif;
  font-size: 0.95rem;
  resize: vertical;
}
.teen-textarea::placeholder {
  color: var(--color-muted);
  opacity: 1;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.chip {
  color: var(--color-text);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition:
    transform 0.15s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}
.chip:active {
  transform: scale(0.94);
}
.lang-switcher {
  margin: 0;
}
.chip.lang-chip.selected {
  background: linear-gradient(
    120deg,
    var(--color-primary),
    var(--color-primary-2)
  );
  border-color: transparent;
  color: var(--color-primary-ink);
}
.slider-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 8px;
}
input[type="range"] {
  width: 100%;
  margin: 6px 0 14px;
}
.pillar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.pillar-row-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--color-muted);
  text-transform: uppercase;
}
.pillar-dots {
  display: flex;
  gap: 6px;
}
.pillar-dot {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--color-border);
  color: var(--color-muted);
  text-transform: capitalize;
}
.pillar-dot.active {
  background: var(--color-accent-2);
  color: white;
}
.score-chip {
  margin-left: auto;
  font-weight: 800;
  font-size: 0.8rem;
}

/* Spot the AI */
.tag-line {
  font-weight: 800;
  color: var(--color-primary);
  font-size: 0.85rem;
}
.spot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.spot-card {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px 10px;
  text-align: center;
  font-family: inherit;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    border-color 0.2s ease;
  animation: tile-pop 0.4s ease both;
}
.spot-card:active:not(:disabled) {
  transform: scale(0.96);
}
.spot-card:disabled {
  cursor: default;
}
.spot-card.is-ai {
  border-color: var(--color-danger);
}
.spot-card.is-real {
  border-color: var(--color-accent-2);
}
.spot-emoji {
  font-size: 2.2rem;
}
.spot-label {
  font-weight: 800;
  margin-top: 4px;
}
.spot-tag {
  font-size: 0.72rem;
  font-weight: 800;
  margin-top: 6px;
  text-transform: uppercase;
}

/* Explore */
.recipe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.recipe-tile {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 12px;
  min-width: 0;
}
.recipe-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-weight: 800;
  font-size: 0.75rem;
  margin-bottom: 6px;
}
.recipe-tile p {
  margin: 4px 0 0;
  font-size: 0.82rem;
}
.directory-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.directory-item {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 12px;
}
.directory-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.tag {
  font-size: 0.7rem;
  font-weight: 800;
  background: color-mix(in srgb, var(--color-accent-2) 20%, transparent);
  color: color-mix(in srgb, var(--color-accent-2) 65%, black);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.citizenship-item {
  font-size: 0.88rem;
  margin-bottom: 8px;
  color: var(--color-text);
}
.citizenship-item strong {
  color: var(--color-text);
}

/* Profile */
.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.avatar-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--color-accent-2),
    var(--color-accent-3)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.passkey-box {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 14px;
}
.passkey-words {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.passkey-chip {
  background: var(--color-surface);
  border: 2px solid var(--color-primary);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 0.85rem;
}
.badge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.badge-tile {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  min-width: 0;
}
.badge-tile.locked {
  opacity: 0.4;
  filter: grayscale(1);
}
.badge-tile:not(.locked) {
  background: color-mix(in srgb, var(--color-accent-3) 12%, var(--color-bg));
  animation: badge-bounce-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.badge-icon {
  font-size: 1.6rem;
}
.badge-name {
  font-weight: 800;
  font-size: 0.85rem;
  margin-top: 4px;
}
.badge-desc {
  font-size: 0.72rem;
  color: var(--color-muted);
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  max-width: 600px;
  margin: 0 auto;
}
.nav-item {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-muted);
  cursor: pointer;
  transition:
    color 0.3s ease,
    transform 0.15s ease;
}
.nav-item:active {
  transform: scale(0.9);
}
.nav-item.active {
  color: var(--color-primary);
}

/* Onboarding overlay + toast */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 19, 25, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.overlay-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}
.overlay-card h2 {
  margin-bottom: 8px;
}
.overlay-card .passkey-words {
  justify-content: center;
}

.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--color-text);
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  opacity: 0;
  transition:
    opacity 0.25s,
    transform 0.25s;
  z-index: 200;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Animations ---------- */

.app-main.view-enter {
  animation: view-fade-in 0.35s ease both;
}

@keyframes view-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tile-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes card-flip-in {
  from {
    opacity: 0;
    transform: rotateY(12deg) scale(0.96);
  }
  to {
    opacity: 1;
    transform: rotateY(0) scale(1);
  }
}

@keyframes badge-bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  70% {
    opacity: 1;
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

/* A broad, robust reduced-motion override: rather than hand-listing every
   animated selector above (easy to forget one as new animations are added),
   this collapses all animations/transitions to effectively-instant for
   anyone who has asked their OS for reduced motion. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #13111f;
    --color-surface: #1d1a2e;
    --color-text: #eef1f6;
    --color-muted: #a2a0bd;
    --color-border: #322d4c;
  }
  .prompt-preview {
    color: var(--color-text) !important;
  }
  .block-chip.role.selected {
    background: color-mix(
      in srgb,
      var(--color-primary) 18%,
      var(--color-surface)
    );
  }
  .block-chip.task.selected {
    background: color-mix(
      in srgb,
      var(--color-accent-2) 18%,
      var(--color-surface)
    );
  }
  .block-chip.context.selected {
    background: color-mix(in srgb, #6366f1 18%, var(--color-surface));
  }
  .block-chip.format.selected {
    background: color-mix(in srgb, #d4a017 18%, var(--color-surface));
  }
  .tag {
    color: var(--color-text);
  }
}

/* =====================================================================
   Visuals: artwork, welcome flow, install + notifications, confetti
   ===================================================================== */

/* ---------- Ambient background ---------- */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.22;
  pointer-events: none;
  animation: blob-drift 22s ease-in-out infinite alternate;
}
body::before {
  top: -25vmax;
  right: -20vmax;
  background: var(--color-primary);
}
body::after {
  bottom: -30vmax;
  left: -25vmax;
  background: var(--color-accent-3);
  animation-delay: -11s;
}
body.welcome-open {
  overflow: hidden;
}

@keyframes blob-drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(4vmax, 6vmax) scale(1.12);
  }
}

/* ---------- Art color tokens (SVG) ---------- */
.art-stop-1 {
  stop-color: var(--color-primary);
}
.art-stop-2 {
  stop-color: var(--color-primary-2);
}
.art-primary {
  fill: var(--color-primary);
}
.art-accent {
  fill: var(--color-accent-2);
}
.art-accent-3 {
  fill: var(--color-accent-3);
}
.art-visor {
  fill: #1c2433;
}
.art-eye {
  fill: #5ff5df;
}
.art-glint {
  fill: #ffffff;
}
.art-smile {
  stroke: #5ff5df;
}
.art-cheek {
  fill: #ffffff;
  opacity: 0.35;
}
.art-line {
  stroke: var(--color-text);
  opacity: 0.75;
}
.art-limb {
  fill: var(--color-primary-2);
}
.art-ink {
  fill: var(--color-text);
}
.art-tongue {
  stroke: #ff6f91;
}
.art-paper {
  fill: var(--color-surface);
  stroke: var(--color-border);
  stroke-width: 2;
}
.art-muted {
  fill: var(--color-border);
}
.art-lens {
  fill: color-mix(in srgb, var(--color-accent-2) 18%, transparent);
  stroke: var(--color-primary);
}
.art-stroke {
  stroke: currentColor;
}
.art-role {
  fill: var(--color-primary);
}
.art-task {
  fill: var(--color-accent-2);
}
.art-context {
  fill: #6366f1;
}
.art-format {
  fill: #f5b82e;
}
.m-shadow {
  fill: var(--color-text);
  opacity: 0.1;
}
.spark {
  fill: var(--color-primary-2);
}
.spark-2,
.spark-4 {
  fill: var(--color-accent-3);
}
.spark-5 {
  fill: var(--color-accent-2);
}

/* ---------- Mascot animation ---------- */
.mascot {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.mascot .m-bob {
  animation: m-bob 3s ease-in-out infinite;
}
.mascot .m-eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: m-blink 4.5s infinite;
}
.mascot .m-bulb {
  transform-box: fill-box;
  transform-origin: center;
  animation: m-pulse 1.8s ease-in-out infinite;
}
.mascot .m-heart {
  transform-box: fill-box;
  transform-origin: center;
  animation: m-pulse 1.2s ease-in-out infinite;
}
.mascot .m-arm-right {
  transform-origin: 136px 160px;
}
.mascot-wave .m-arm-right {
  animation: m-wave 1.6s ease-in-out infinite;
}
.mascot-cheer .m-bob {
  animation: m-jump 1.4s cubic-bezier(0.3, 0, 0.3, 1) infinite;
}
.mascot-cheer .m-arm-right {
  transform: rotate(-60deg);
}
.mascot-cheer .m-arm-left {
  transform-origin: 64px 160px;
  transform: rotate(60deg);
}

@keyframes m-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}
@keyframes m-jump {
  0%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-16px);
  }
  60% {
    transform: translateY(-16px);
  }
}
@keyframes m-blink {
  0%,
  92%,
  100% {
    transform: scaleY(1);
  }
  95% {
    transform: scaleY(0.1);
  }
}
@keyframes m-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.25);
    opacity: 0.75;
  }
}
@keyframes m-wave {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-55deg);
  }
  50% {
    transform: rotate(-30deg);
  }
  75% {
    transform: rotate(-55deg);
  }
}

/* ---------- Sparkles ---------- */
.sparkles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.spark {
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkle 2.4s ease-in-out infinite;
}
.spark-2 {
  animation-delay: 0.5s;
}
.spark-3 {
  animation-delay: 1s;
}
.spark-4 {
  animation-delay: 1.5s;
}
.spark-5 {
  animation-delay: 2s;
}
@keyframes twinkle {
  0%,
  100% {
    opacity: 0.15;
    scale: 0.6;
  }
  50% {
    opacity: 1;
    scale: 1.1;
  }
}

/* ---------- Home hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 76px 1fr auto;
  align-items: center;
  gap: 12px;
}
.hero-mascot {
  width: 76px;
  position: relative;
}
.hero-text {
  position: relative;
  min-width: 0;
}
.hero-text p {
  font-size: 0.85rem;
}
@media (max-width: 380px) {
  .hero {
    grid-template-columns: 64px 1fr;
  }
  .hero-mascot {
    width: 64px;
  }
  .hero .ring {
    display: none;
  }
}

.ring {
  position: relative;
  width: 64px;
  height: 64px;
}
.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ring-track {
  fill: none;
  stroke: color-mix(in srgb, var(--color-primary) 15%, transparent);
  stroke-width: 5;
}
.ring-fill {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 5;
  stroke-linecap: round;
  animation: ring-fill 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both;
}
.ring-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Baloo 2", "Nunito Sans", sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
}
@keyframes ring-fill {
  from {
    stroke-dashoffset: 100;
  }
}

/* ---------- Tiles with illustrations ---------- */
.tile-art {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  overflow: visible;
}
.tile-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tile:hover .tile-art,
.tile:focus-visible .tile-art {
  animation: art-wiggle 0.5s ease;
}
.t-float {
  animation: t-float 2.6s ease-in-out infinite;
}
.t-blink {
  transform-box: fill-box;
  transform-origin: center;
  animation: m-blink 3.8s infinite;
}
.t-write {
  animation: t-write 2.2s ease-in-out infinite;
}
.t-spark {
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkle 1.8s ease-in-out infinite;
}
.t-scan {
  animation: t-scan 3.2s ease-in-out infinite;
}
@keyframes t-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}
@keyframes t-write {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-4px, 2px);
  }
}
@keyframes t-scan {
  0%,
  100% {
    transform: translate(0, 0);
  }
  33% {
    transform: translate(-14px, -10px);
  }
  66% {
    transform: translate(-6px, -18px);
  }
}
@keyframes art-wiggle {
  0%,
  100% {
    transform: rotate(0);
  }
  30% {
    transform: rotate(-8deg) scale(1.08);
  }
  60% {
    transform: rotate(6deg) scale(1.08);
  }
}

/* ---------- Small buttons ---------- */
.btn-small {
  width: auto;
  min-height: 38px;
  font-size: 0.85rem;
  padding: 0 14px;
  flex-shrink: 0;
}
.icon-btn {
  border: none;
  background: none;
  color: var(--color-muted);
  font-size: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--color-bg);
}

/* ---------- Install banner (Home) ---------- */
.install-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 12px 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    120deg,
    color-mix(in srgb, var(--color-primary) 12%, var(--color-surface)),
    color-mix(in srgb, var(--color-primary-2) 12%, var(--color-surface))
  );
  border: 1px solid
    color-mix(in srgb, var(--color-primary) 30%, var(--color-border));
  animation: tile-pop 0.4s ease both;
}
.install-banner-icon {
  font-size: 1.6rem;
  animation: t-float 2.6s ease-in-out infinite;
}
.install-banner-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
}
.install-banner-text span {
  color: var(--color-muted);
  font-size: 0.78rem;
}

/* ---------- App extras rows (Profile + welcome) ---------- */
.extra-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  text-align: left;
}
.extra-row + .extra-row {
  border-top: 1px solid var(--color-border);
}
.extra-icon {
  font-size: 1.4rem;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: color-mix(
    in srgb,
    var(--color-primary) 12%,
    var(--color-surface)
  );
}
.extra-body {
  flex: 1;
  min-width: 0;
}
.extra-body h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}
.extra-body p {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--color-muted);
  line-height: 1.45;
}
.extra-body .extra-status {
  color: var(--color-text);
  font-weight: 700;
}

/* ---------- iOS install sheet ---------- */
.sheet-overlay {
  align-items: flex-end;
  animation: fade-in 0.25s ease both;
}
.sheet {
  max-width: 440px;
  border-radius: 28px 28px 20px 20px;
  margin-bottom: env(safe-area-inset-bottom);
  animation: sheet-up 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.sheet-mascot {
  width: 84px;
  margin: -6px auto 6px;
}
.ios-steps {
  text-align: left;
  margin: 12px 0;
  padding-left: 22px;
  line-height: 1.5;
}
.ios-steps li {
  margin-bottom: 10px;
}
.inline-icon {
  width: 1.3em;
  height: 1.3em;
  vertical-align: -0.3em;
  color: #0a84ff;
}
@media (min-width: 600px) {
  .sheet-overlay {
    align-items: center;
  }
}
@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* ---------- Welcome flow ---------- */
.welcome {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top)) 20px
    calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--color-primary) 22%, var(--color-bg)),
    var(--color-bg) 55%,
    color-mix(in srgb, var(--color-accent-3) 18%, var(--color-bg))
  );
  overflow: hidden;
  transition: background 0.5s ease;
  animation: fade-in 0.4s ease both;
}
.welcome.leaving {
  animation: welcome-out 0.45s ease forwards;
}
@keyframes welcome-out {
  to {
    opacity: 0;
    transform: scale(1.06);
  }
}
.welcome-bg span {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.35;
  animation: blob-drift 14s ease-in-out infinite alternate;
}
.welcome-bg span:nth-child(1) {
  width: 260px;
  height: 260px;
  top: -60px;
  left: -80px;
  background: var(--color-primary);
}
.welcome-bg span:nth-child(2) {
  width: 220px;
  height: 220px;
  bottom: 10%;
  right: -90px;
  background: var(--color-accent-2);
  animation-delay: -5s;
}
.welcome-bg span:nth-child(3) {
  width: 180px;
  height: 180px;
  bottom: -60px;
  left: 20%;
  background: var(--color-primary-2);
  animation-delay: -9s;
}
.welcome-top {
  position: relative;
  min-height: 40px;
  display: flex;
  justify-content: flex-end;
}
.welcome-skip {
  border: none;
  background: color-mix(in srgb, var(--color-surface) 70%, transparent);
  color: var(--color-muted);
  font-family: inherit;
  font-weight: 700;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}
.welcome-body {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  overflow-y: auto;
  padding: 8px 2px;
}
.welcome-body h2 {
  font-size: 1.7rem;
  line-height: 1.15;
  margin-bottom: 8px;
  outline: none;
}
.welcome-body > p {
  color: var(--color-muted);
  line-height: 1.5;
  margin: 0 auto 16px;
  max-width: 340px;
}
.welcome-body.step-forward > * {
  animation: step-in-right 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.welcome-body.step-back > * {
  animation: step-in-left 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.welcome-body > *:nth-child(2) {
  animation-delay: 0.05s;
}
.welcome-body > *:nth-child(3) {
  animation-delay: 0.1s;
}
.welcome-body > *:nth-child(4) {
  animation-delay: 0.15s;
}
@keyframes step-in-right {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
}
@keyframes step-in-left {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
}
.welcome-art {
  position: relative;
  width: 200px;
  margin: 0 auto 12px;
  padding: 10px 20px;
}
.welcome-art-sm {
  width: 120px;
  padding: 6px 10px;
}
.mascot-xl {
  filter: drop-shadow(
    0 18px 24px color-mix(in srgb, var(--color-primary) 35%, transparent)
  );
}
.welcome-footer {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}
.welcome-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-text) 18%, transparent);
  transition:
    width 0.35s ease,
    background 0.35s ease;
}
.dot.done {
  background: color-mix(in srgb, var(--color-primary) 50%, transparent);
}
.dot.active {
  width: 26px;
  background: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-primary-2)
  );
}
.welcome-actions {
  display: flex;
  gap: 10px;
}
.welcome-actions .btn {
  flex: 1;
}
.welcome-actions .btn.outline {
  flex: 0 0 auto;
  width: auto;
}

.choice-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.choice-pill,
.choice-card {
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    transform 0.15s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}
.choice-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px;
  font-weight: 700;
  font-size: 0.95rem;
}
.choice-flag {
  font-size: 1.4rem;
}
.choice-pill:active,
.choice-card:active {
  transform: scale(0.97);
}
.choice-pill.selected,
.choice-card.selected {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-pop);
  background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface));
}
.choice-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.choice-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  text-align: left;
  border-radius: var(--radius-lg);
}
.choice-card .tile-art {
  width: 60px;
  height: 60px;
}
.choice-card-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.choice-card-text strong {
  font-family: "Baloo 2", "Nunito Sans", sans-serif;
  font-size: 1.15rem;
}
.choice-card-text span {
  color: var(--color-muted);
  font-size: 0.85rem;
}
.choice-card.selected .tile-art {
  animation: art-wiggle 0.5s ease;
}

.flip-cards {
  display: flex;
  justify-content: center;
  gap: 10px;
  perspective: 600px;
}
.flip-card {
  flex: 1;
  max-width: 120px;
  padding: 16px 8px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    150deg,
    var(--color-primary),
    var(--color-primary-2)
  );
  color: var(--color-primary-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow-pop);
  animation: flip-reveal 0.7s cubic-bezier(0.2, 0.8, 0.3, 1.2) both;
}
.flip-card:nth-child(1) {
  animation-delay: 0.25s;
}
.flip-card:nth-child(2) {
  animation-delay: 0.55s;
}
.flip-card:nth-child(3) {
  animation-delay: 0.85s;
}
.flip-num {
  font-size: 0.7rem;
  font-weight: 800;
  opacity: 0.8;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}
.flip-word {
  font-family: "Baloo 2", "Nunito Sans", sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  word-break: break-word;
}
@keyframes flip-reveal {
  from {
    opacity: 0;
    transform: rotateY(90deg) translateY(10px);
  }
  to {
    opacity: 1;
    transform: rotateY(0) translateY(0);
  }
}

.welcome .app-extras {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 4px 14px;
}

/* ---------- Confetti ---------- */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 400;
  overflow: hidden;
}
.confetti i {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  background: var(--color-primary);
  animation: confetti-fall 1.6s cubic-bezier(0.25, 0.6, 0.4, 1) forwards;
}
.confetti i:nth-child(3n) {
  background: var(--color-accent-2);
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.confetti i:nth-child(3n + 1) {
  background: var(--color-primary-2);
}
.confetti i:nth-child(4n) {
  background: var(--color-accent-3);
}
.confetti i:nth-child(1) {
  left: 6%;
  --dx: 30px;
  animation-delay: 0s;
}
.confetti i:nth-child(2) {
  left: 12%;
  --dx: -20px;
  animation-delay: 0.1s;
}
.confetti i:nth-child(3) {
  left: 18%;
  --dx: 40px;
  animation-delay: 0.05s;
}
.confetti i:nth-child(4) {
  left: 24%;
  --dx: -35px;
  animation-delay: 0.2s;
}
.confetti i:nth-child(5) {
  left: 30%;
  --dx: 25px;
  animation-delay: 0.15s;
}
.confetti i:nth-child(6) {
  left: 36%;
  --dx: -15px;
  animation-delay: 0s;
}
.confetti i:nth-child(7) {
  left: 42%;
  --dx: 45px;
  animation-delay: 0.25s;
}
.confetti i:nth-child(8) {
  left: 48%;
  --dx: -40px;
  animation-delay: 0.1s;
}
.confetti i:nth-child(9) {
  left: 54%;
  --dx: 20px;
  animation-delay: 0.3s;
}
.confetti i:nth-child(10) {
  left: 60%;
  --dx: -25px;
  animation-delay: 0.05s;
}
.confetti i:nth-child(11) {
  left: 66%;
  --dx: 35px;
  animation-delay: 0.2s;
}
.confetti i:nth-child(12) {
  left: 72%;
  --dx: -30px;
  animation-delay: 0.15s;
}
.confetti i:nth-child(13) {
  left: 78%;
  --dx: 15px;
  animation-delay: 0.35s;
}
.confetti i:nth-child(14) {
  left: 84%;
  --dx: -45px;
  animation-delay: 0s;
}
.confetti i:nth-child(15) {
  left: 90%;
  --dx: 30px;
  animation-delay: 0.25s;
}
.confetti i:nth-child(16) {
  left: 95%;
  --dx: -20px;
  animation-delay: 0.1s;
}
.confetti i:nth-child(17) {
  left: 3%;
  --dx: 50px;
  animation-delay: 0.3s;
}
.confetti i:nth-child(18) {
  left: 51%;
  --dx: 10px;
  animation-delay: 0.4s;
}
@keyframes confetti-fall {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx, 0), 85vh) rotate(540deg);
    opacity: 0;
  }
}

/* ---------- Dark-mode art tweaks ---------- */
@media (prefers-color-scheme: dark) {
  /* html[data-mode="teens"] is more specific than :root, so its light
     surface tokens would otherwise win over the dark palette. */
  html[data-mode="teens"] {
    --color-bg: #13111f;
    --color-border: #322d4c;
  }
  .art-visor {
    fill: #0b0a14;
  }
  .art-cheek {
    opacity: 0.2;
  }
  body::before,
  body::after {
    opacity: 0.16;
  }
}

/* =====================================================================
   UI kit (js/ui-kit.js) — shared by every game module
   ===================================================================== */

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 6px;
}
.kit-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  background: color-mix(
    in srgb,
    var(--color-primary) 12%,
    var(--color-surface)
  );
  color: var(--color-text);
  border: 1px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
}
.kit-tag.streak {
  background: color-mix(in srgb, #ff8a3d 18%, var(--color-surface));
}
.kit-tag.good {
  background: color-mix(
    in srgb,
    var(--color-accent-2) 18%,
    var(--color-surface)
  );
}

.kit-header h2 {
  font-size: 1.35rem;
  margin: 0 0 2px;
}

/* Mascot speech bubble */
.kit-says {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.kit-says-mascot {
  width: 58px;
  flex-shrink: 0;
}
.kit-bubble {
  position: relative;
  flex: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px 18px 18px 4px;
  padding: 12px 14px;
  line-height: 1.45;
  font-weight: 600;
  animation: tile-pop 0.35s ease both;
}

/* Stars */
.kit-stars {
  letter-spacing: 1px;
  font-size: 1rem;
}
.kit-stars i {
  font-style: normal;
  color: color-mix(in srgb, var(--color-text) 18%, transparent);
}
.kit-stars i.on {
  color: #f5b82e;
  text-shadow: 0 1px 4px rgba(245, 184, 46, 0.5);
}

/* Stage map: zig-zag path of nodes */
.kit-stage-map {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kit-stage-map::before {
  content: "";
  position: absolute;
  top: 30px;
  bottom: 30px;
  left: 50%;
  border-left: 4px dotted
    color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
  transform: translateX(-50%);
}
.kit-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 72px 1fr;
  align-items: center;
  gap: 12px;
  animation: tile-pop 0.4s ease both;
}
.kit-stage:nth-child(2) {
  animation-delay: 0.05s;
}
.kit-stage:nth-child(3) {
  animation-delay: 0.1s;
}
.kit-stage:nth-child(4) {
  animation-delay: 0.15s;
}
.kit-stage:nth-child(5) {
  animation-delay: 0.2s;
}
.kit-stage:nth-child(n + 6) {
  animation-delay: 0.25s;
}
.kit-stage-node {
  grid-column: 2;
  grid-row: 1;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid var(--color-surface);
  background: linear-gradient(
    140deg,
    var(--color-primary),
    var(--color-primary-2)
  );
  color: var(--color-primary-ink);
  font-size: 1.6rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow:
    var(--shadow-pop),
    0 0 0 3px color-mix(in srgb, var(--color-primary) 30%, transparent);
  transition: transform 0.15s ease;
  display: grid;
  place-items: center;
}
.kit-stage-node:active:not(:disabled) {
  transform: scale(0.92);
}
.kit-stage.done .kit-stage-node {
  background: linear-gradient(
    140deg,
    var(--color-accent-2),
    var(--color-accent-3)
  );
}
.kit-stage.locked .kit-stage-node {
  background: var(--color-border);
  box-shadow: none;
  cursor: not-allowed;
  font-size: 1.2rem;
}
.kit-stage:not(.locked):not(.done) .kit-stage-node {
  animation: node-pulse 2s ease-in-out infinite;
}
@keyframes node-pulse {
  0%,
  100% {
    box-shadow:
      var(--shadow-pop),
      0 0 0 3px color-mix(in srgb, var(--color-primary) 30%, transparent);
  }
  50% {
    box-shadow:
      var(--shadow-pop),
      0 0 0 9px color-mix(in srgb, var(--color-primary) 12%, transparent);
  }
}
.kit-stage-text {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
  min-width: 0;
}
.kit-stage.left .kit-stage-text {
  grid-column: 3;
}
.kit-stage.right .kit-stage-text {
  grid-column: 1;
  text-align: right;
  align-items: flex-end;
}
.kit-stage-num {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}
.kit-stage-text strong {
  font-family: "Baloo 2", "Nunito Sans", sans-serif;
  font-size: 1rem;
  line-height: 1.2;
}
.kit-stage.locked .kit-stage-text {
  opacity: 0.55;
}

/* Round progress */
.kit-round {
  display: flex;
  align-items: center;
  gap: 10px;
}
.kit-round-label {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--color-muted);
  white-space: nowrap;
}
.kit-round .score-bar {
  flex: 1;
  margin: 0;
}

/* Choices */
.kit-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kit-choices.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.kit-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  min-height: 52px;
  transition:
    transform 0.15s ease,
    border-color 0.2s ease,
    background 0.2s ease;
  animation: tile-pop 0.35s ease both;
}
.kit-choice:nth-child(2) {
  animation-delay: 0.05s;
}
.kit-choice:nth-child(3) {
  animation-delay: 0.1s;
}
.kit-choice:nth-child(4) {
  animation-delay: 0.15s;
}
.kit-choice:active:not(:disabled) {
  transform: scale(0.97);
}
.kit-choice:disabled {
  cursor: default;
}
.kit-choice-icon {
  font-size: 1.5rem;
}
.kit-choice.correct {
  border-color: #16a34a;
  background: color-mix(in srgb, #16a34a 14%, var(--color-surface));
  animation: choice-pop 0.4s ease;
}
.kit-choice.wrong {
  border-color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 12%, var(--color-surface));
  animation: choice-shake 0.4s ease;
}
.kit-choice.dim {
  opacity: 0.55;
}
@keyframes choice-pop {
  50% {
    transform: scale(1.04);
  }
}
@keyframes choice-shake {
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}

/* Feedback */
.kit-feedback {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 2px solid;
  animation: tile-pop 0.3s ease both;
}
.kit-feedback.good {
  border-color: #16a34a;
  background: color-mix(in srgb, #16a34a 10%, var(--color-surface));
}
.kit-feedback.bad {
  border-color: #f5b82e;
  background: color-mix(in srgb, #f5b82e 12%, var(--color-surface));
}
.kit-feedback p {
  margin: 6px 0 0;
  line-height: 1.45;
  color: var(--color-text);
}

/* Result card */
.kit-result {
  text-align: center;
  animation: badge-bounce-in 0.5s ease both;
}
.kit-result-mascot {
  width: 96px;
  margin: 0 auto 4px;
}
.kit-result h2 {
  font-size: 1.6rem;
}
.kit-result-stars .kit-stars {
  font-size: 2.2rem;
}
.kit-result-stars .kit-stars i.on {
  display: inline-block;
  animation: star-in 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
.kit-result-stars .kit-stars i.on:nth-child(2) {
  animation-delay: 0.2s;
}
.kit-result-stars .kit-stars i.on:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes star-in {
  from {
    transform: scale(0) rotate(-90deg);
    opacity: 0;
  }
}
.kit-result-score {
  font-weight: 700;
}
.kit-xp {
  font-family: "Baloo 2", "Nunito Sans", sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-primary) !important;
  margin: 4px 0;
}
.kit-rankup {
  font-weight: 800;
  color: var(--color-text) !important;
}
.kit-lesson {
  text-align: left;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 10px 0;
}
.kit-lesson p {
  margin: 0;
  color: var(--color-text);
}
.kit-result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
