:root {
  --ink: #2d3142;
  --sun: #ffd166;
  --coral: #ef476f;
  --mint: #06d6a0;
  --sky: #4cc9f0;
  --cream: #fff8ee;
  --paper: #ffffff;
  --shadow: 0 12px 0 rgba(45, 49, 66, 0.12);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, #ffe8a3 0 12%, transparent 13%),
    radial-gradient(circle at 88% 12%, #ffc2d4 0 10%, transparent 11%),
    linear-gradient(180deg, #8ecae6 0%, #caf0f8 28%, #fff8ee 58%, #ffe5d0 100%);
  overflow-x: hidden;
}

h1, h2, h3, .brand strong, .btn, .chip, .kicker, .badge {
  font-family: "Fredoka", sans-serif;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--sun);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 999px;
  z-index: 30;
}

.skip:focus {
  left: 12px;
}

.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 40px;
  height: 48px;
  width: 140px;
  animation: drift 28s linear infinite;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.cloud::before {
  width: 54px;
  height: 54px;
  top: -24px;
  left: 22px;
}

.cloud::after {
  width: 72px;
  height: 72px;
  top: -34px;
  left: 58px;
}

.cloud-a { top: 90px; left: -160px; }
.cloud-b { top: 180px; left: -240px; animation-duration: 36s; }
.cloud-c { top: 48px; left: -200px; animation-duration: 42s; }

.balloon {
  position: absolute;
  width: 28px;
  height: 36px;
  border-radius: 50% 50% 50% 50% / 42% 42% 58% 58%;
  animation: float 7s ease-in-out infinite;
}

.balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: 42px;
  background: var(--ink);
}

.balloon-a { background: #ef476f; right: 8%; top: 120px; }
.balloon-b { background: #118ab2; right: 16%; top: 210px; animation-delay: -2s; }

header, main, footer, .player {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 6vw;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand strong {
  display: block;
  font-size: 1.6rem;
}

.brand small {
  display: block;
  font-weight: 800;
  opacity: 0.8;
}

.logo {
  filter: drop-shadow(0 6px 0 rgba(45, 49, 66, 0.12));
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav button,
.menu-btn,
.btn,
.chip,
.close {
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.nav button,
.menu-btn {
  padding: 10px 18px;
  box-shadow: var(--shadow);
}

.menu-btn {
  display: none;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 28px;
  padding: 10px 6vw 28px;
}

.welcome,
.hero-card,
.parents-card,
.grid article,
.player-box {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.welcome {
  padding: 32px 34px 34px;
  background: linear-gradient(180deg, #fffdf7 0%, #fff 72%);
}

.kicker {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 14px;
  background: var(--sun);
  border: 3px solid var(--ink);
  border-radius: 999px;
  font-size: 0.95rem;
}

.welcome h1 {
  margin: 0 0 16px;
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
  line-height: 1.12;
}

.lead {
  font-size: 1.12rem;
  line-height: 1.55;
  margin: 0 0 16px;
}

.highlights {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.highlights li {
  position: relative;
  margin: 8px 0;
  padding-left: 28px;
  font-weight: 800;
}

.highlights li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35em;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--mint);
  border: 2px solid var(--ink);
}

.hero-actions,
.gate {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
}

.btn {
  padding: 14px 22px;
  font-size: 1.05rem;
  box-shadow: var(--shadow);
}

.btn:hover,
.chip:hover,
.nav button:hover {
  transform: translateY(-2px);
}

.btn-sun { background: var(--sun); }
.btn-mint { background: var(--mint); }
.btn-coral { background: var(--coral); color: #fff; }

.hero-card {
  padding: 22px;
}

.badge {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 12px;
  background: #bde0fe;
  border: 3px solid var(--ink);
  border-radius: 999px;
  font-weight: 800;
}

.hero-art {
  border-radius: 22px;
  overflow: hidden;
  border: 3px solid var(--ink);
}

.trust {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 0 6vw 28px;
}

.trust p {
  margin: 0;
  padding: 14px 16px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: var(--shadow);
  font-weight: 700;
}

.ai-strip {
  padding: 8px 6vw 28px;
}

.ai-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 16px;
  overflow-x: auto;
  padding: 4px 4px 12px;
  scroll-snap-type: x mandatory;
}

.ai-card {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
  padding: 0 0 16px;
  min-width: 220px;
}

.ai-card:hover,
.ai-card:focus-within {
  transform: translateY(-6px);
}

.ai-card h3,
.ai-card p,
.ai-card .meta {
  margin: 10px 16px 0;
}

.ai-card h3 {
  font-size: 1.08rem;
}

.ai-strip .btn {
  margin-top: 8px;
}

.story-art.is-swap svg {
  animation: sceneIn 0.45s ease;
}

@keyframes sceneIn {
  from { opacity: 0.35; transform: scale(0.98); }
  to { opacity: 1; transform: none; }
}

.filters {
  padding: 0 6vw 12px;
}

.search-wrap {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  max-width: 520px;
}

.search-wrap label {
  font-weight: 800;
}

.search-wrap input,
.gate input,
.parents-panel select {
  width: 100%;
  padding: 14px 16px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  font: inherit;
  font-size: 1.05rem;
  background: #fff;
}

.chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.chip {
  padding: 10px 16px;
  background: #fff;
}

.chip.is-on {
  background: var(--ink);
  color: #fff;
}

.chip-ai {
  background: #caf7e2;
}

.chip-ai.is-on {
  background: #0b7a4b;
}

.catalog,
.parents {
  padding: 18px 6vw 48px;
}

.section-head h2,
.parents-card h2 {
  margin: 0 0 6px;
  font-size: 2rem;
}

.section-head p {
  margin: 0 0 18px;
  font-weight: 800;
}

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

.grid article {
  padding: 0 0 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.grid article:hover,
.grid article:focus-within {
  transform: translateY(-6px);
}

.thumb {
  height: 140px;
  display: grid;
  place-items: center;
  border-bottom: 4px solid var(--ink);
  position: relative;
}

.thumb svg {
  width: 72px;
  height: 72px;
}

.play-mark {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--ink);
  display: grid;
  place-items: center;
  font-size: 0;
}

.play-mark::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 10px solid var(--ink);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  margin-left: 3px;
}

.grid h3,
.grid p,
.meta {
  margin: 10px 16px 0;
}

.grid h3 {
  font-size: 1.15rem;
}

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

.tag {
  padding: 4px 10px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  background: var(--sun);
}

.tag.tag-ai {
  background: #caf7e2;
}

.tag.tag-fav {
  background: #ffd6e0;
}

.fav-btn {
  margin: 0 0 12px;
  padding: 8px 14px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.fav-btn.is-on {
  background: #ffd6e0;
}

.fav-btn[hidden] {
  display: none !important;
}

.chip-world.is-on {
  background: #118ab2;
  color: #fff;
}

.parents {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 22px;
}

.parents-card,
.promise {
  padding: 24px;
}

.promise {
  margin: 0;
  list-style: none;
  background: #fff3b0;
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.promise li {
  margin: 12px 0;
  padding-left: 8px;
  font-weight: 800;
}

.parents-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.parents-panel label {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.parents-note,
.gate-msg,
.timer,
.empty {
  font-weight: 800;
}

.empty {
  display: grid;
  justify-items: start;
  gap: 12px;
}

.gate-msg.is-ok {
  color: #0b7a4b;
}

.gate-msg.is-err {
  color: #b42318;
}

.foot {
  padding: 24px 6vw 40px;
  text-align: center;
  font-weight: 700;
}

.player {
  position: fixed;
  inset: 0;
  background: rgba(45, 49, 66, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.player[hidden],
.empty[hidden],
.parents-panel[hidden] {
  display: none !important;
}

.player-box {
  width: min(860px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 20px;
  position: relative;
}

.player-box video,
.story-stage {
  width: 100%;
  border-radius: 18px;
  border: 3px solid var(--ink);
  background: #000;
}

.player-box video[hidden],
.story-stage[hidden] {
  display: none !important;
}

.story-stage {
  background: linear-gradient(180deg, #7bdff2 0%, #90e0a8 55%, #fff3b0 100%);
  min-height: 280px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.story-art {
  min-height: 180px;
  border-radius: 16px;
  overflow: hidden;
}

.story-art svg {
  width: 100%;
  height: 220px;
  display: block;
}

.story-caption {
  margin: 0;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid var(--ink);
  border-radius: 16px;
  font-weight: 800;
  min-height: 3.2em;
}

.story-count {
  margin: 0;
  font-weight: 800;
  font-size: 0.95rem;
}

.story-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.story-controls .btn {
  padding: 10px 16px;
  box-shadow: none;
}

.story-controls .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.story-end {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid var(--ink);
  border-radius: 16px;
}

.story-end[hidden] {
  display: none !important;
}

.story-end p {
  margin: 0;
  flex: 1 1 100%;
  font-weight: 800;
}

.story-voice-on {
  background: #caf7e2;
}

.story-progress {
  height: 10px;
  background: rgba(255, 255, 255, 0.6);
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
}

.story-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--coral);
  transition: width 0.25s ease;
}

.close {
  position: absolute;
  right: 16px;
  top: 16px;
  padding: 8px 14px;
  background: var(--coral);
  color: #fff;
}

.timer {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: #caf7e2;
  border: 3px dashed var(--ink);
  border-radius: 16px;
}

.timer.is-end {
  background: #ffe0e6;
}

.nav button:focus-visible,
.btn:focus-visible,
.chip:focus-visible,
input:focus-visible,
select:focus-visible,
.close:focus-visible,
.grid article:focus-visible,
.menu-btn:focus-visible {
  outline: 4px solid var(--sky);
  outline-offset: 3px;
}

@keyframes drift {
  to { transform: translateX(120vw); }
}

@keyframes float {
  50% { transform: translateY(-14px); }
}

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

@media (max-width: 900px) {
  .hero,
  .parents {
    grid-template-columns: 1fr;
  }

  .nav {
    display: none;
  }

  .nav.is-open {
    display: flex;
    position: absolute;
    top: 76px;
    right: 6vw;
    background: #fff;
    border: 4px solid var(--ink);
    border-radius: 22px;
    padding: 12px;
    flex-direction: column;
    z-index: 5;
  }

  .menu-btn {
    display: inline-block;
  }
}

@media (max-width: 560px) {
  .trust {
    grid-template-columns: 1fr;
  }

  .welcome,
  .hero-card,
  .parents-card {
    padding: 20px;
  }

  .topbar {
    padding: 14px 5vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cloud,
  .balloon,
  .grid article,
  .ai-card,
  .btn,
  .chip,
  .nav button,
  .story-art.is-swap svg {
    animation: none;
    transition: none;
  }
}
