:root {
  --pink: #ff5fa2;
  --pink-soft: #ffe3ef;
  --purple: #8b5cf6;
  --blue: #3b82f6;
  --blue-soft: #e0edff;
  --ink: #1f2257;
  --muted: #5b5f86;
  --card: rgba(255, 255, 255, 0.92);
  --line: #ecebf5;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(31, 34, 87, 0.12);
  --c: var(--pink);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--ink);
  background: #bfe3ff url('../assets/img/hero.webp') center top / cover fixed;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
svg.flag { stroke: none; width: auto; height: auto; }
h1, h2, h3 { font-family: 'Baloo 2', 'Nunito', sans-serif; line-height: 1.1; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 16px 110px;
  animation: in .35s ease-out;
}
@keyframes in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Logo ---------- */
.logo { display: inline-flex; flex-direction: column; align-items: center; }
.logo-word {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: clamp(52px, 12vw, 96px);
  line-height: .9;
  letter-spacing: -1px;
  position: relative;
}
.logo-word span {
  display: inline-block;
  -webkit-text-stroke: 3px #fff;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #2b2d6e, 0 8px 18px rgba(31, 34, 87, .3);
  transform: rotate(calc((var(--i) - 4) * 1.5deg));
  color: hsl(calc(320 + var(--i) * 30) 85% 60%);
}
.logo-word sup { font-size: .22em; color: var(--ink); vertical-align: top; }
.logo-ribbon {
  margin-top: -4px;
  background: linear-gradient(#ffe066, #ffc83d);
  border: 3px solid #fff;
  box-shadow: 0 4px 0 #e2a400, var(--shadow);
  padding: 4px 18px;
  border-radius: 999px;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: clamp(13px, 3vw, 18px);
  text-transform: uppercase;
  letter-spacing: .5px;
  transform: rotate(-2deg);
}
.logo-sm .logo-word { font-size: clamp(40px, 9vw, 64px); }
.logo-sm .logo-ribbon { font-size: 12px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  text-align: center;
  padding: 24px 8px 28px;
}
.hero h1 { font-size: clamp(30px, 6vw, 46px); margin-top: 18px; text-shadow: 0 2px 0 #fff, 0 0 18px #fff; }
.hero .sub { font-size: clamp(15px, 2.6vw, 19px); font-weight: 700; margin: 8px auto 0; max-width: 34ch; text-shadow: 0 0 10px #fff, 0 0 4px #fff; }
.hero-sm { padding: 0 8px 20px; }

.hero-char {
  position: absolute;
  width: clamp(90px, 20vw, 190px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 28px;
  border: 5px solid #fff;
  box-shadow: var(--shadow);
  animation: bob 4s ease-in-out infinite;
}
.hc-1 { left: 0; top: 10px; --r: -8deg; }
.hc-2 { right: 0; top: 10px; --r: 7deg; animation-delay: -1s; }
.hc-3 { left: 4%; top: 58%; --r: 6deg; animation-delay: -2s; width: clamp(70px, 14vw, 150px); }
.hc-4 { right: 4%; top: 58%; --r: -6deg; animation-delay: -3s; width: clamp(70px, 14vw, 150px); }
@keyframes bob { 0%, 100% { transform: rotate(var(--r)) translateY(0); } 50% { transform: rotate(var(--r)) translateY(-8px); } }

@media (max-width: 640px) {
  .page-lang .hero { padding-top: 130px; }
  .hc-1 { left: 2%; top: 4px; } .hc-2 { right: 2%; top: 4px; }
  .hc-3, .hc-4 { display: none; }
  .page-lang .logo { margin-top: -10px; }
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border-radius: 30px;
  box-shadow: var(--shadow);
  padding: clamp(16px, 3vw, 28px);
  position: relative;
}

.lang-card { max-width: 760px; margin: 0 auto; }
.lang-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.lang-btn {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 8px 14px;
  box-shadow: 0 4px 0 var(--line), 0 6px 16px rgba(31, 34, 87, .08);
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: clamp(16px, 3vw, 22px);
  transition: transform .15s, box-shadow .15s;
}
.lang-btn .flag { width: clamp(54px, 11vw, 84px); border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.lang-btn:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--line), 0 12px 22px rgba(31, 34, 87, .14); }
.lang-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line); }

.features { list-style: none; padding: 0; margin: 22px 0 4px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; font-weight: 800; font-size: 13px; line-height: 1.2; }
.features i { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 6px; border-radius: 50%; font-size: 28px; }
.f-pink { background: #ffd9ec; color: #e0337f; }
.f-blue { background: #d8ebff; color: #2f74d8; }
.f-orange { background: #ffe1c9; color: #e8662a; }
.f-orange .slash { stroke: #e8413c; }
.f-green { background: #d4f5e2; color: #1e9e57; }

/* ---------- Top bar & language switch ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; position: relative; z-index: 5; }
.round-btn {
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow);
  font-size: 22px; color: var(--pink);
}
.lang-switch { position: relative; }
.lang-switch summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  background: #fff; padding: 8px 14px; border-radius: 999px;
  box-shadow: var(--shadow); font-weight: 800;
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary .flag { width: 28px; border-radius: 4px; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: #fff; border-radius: 18px; box-shadow: var(--shadow);
  padding: 6px; min-width: 180px; display: grid;
}
.lang-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-weight: 700; }
.lang-menu a .flag { width: 28px; border-radius: 4px; }
.lang-menu a:hover, .lang-menu a.active { background: var(--pink-soft); }

/* ---------- Characters ---------- */
.series-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.series-tabs button {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 10px; border-radius: 16px;
  font-weight: 800; font-size: clamp(14px, 2.6vw, 18px);
  background: #f3f2fa; color: var(--muted);
  transition: background .2s, color .2s;
}
.series-tabs button svg { font-size: 1.3em; }
.series-tabs .girls.active { background: var(--pink); color: #fff; box-shadow: 0 4px 0 #d93f84; }
.series-tabs .boys.active { background: var(--blue); color: #fff; box-shadow: 0 4px 0 #2459b8; }

.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 36vw), 1fr)); gap: 14px; }
.char-card {
  position: relative; display: block;
  border-radius: var(--radius); overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 0 var(--line), 0 8px 20px rgba(31, 34, 87, .1);
  transition: transform .2s;
}
.char-card img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform .35s; }
.char-card:hover { transform: translateY(-4px) rotate(-.6deg); }
.char-card:hover img { transform: scale(1.06); }
.char-name {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--c); color: #fff;
  border-radius: 14px; padding: 8px 12px;
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: clamp(14px, 2.6vw, 18px);
  text-transform: uppercase; letter-spacing: .3px;
  box-shadow: 0 3px 0 rgba(0,0,0,.18);
}
.char-grid.mini { grid-template-columns: repeat(auto-fill, minmax(min(150px, 28vw), 1fr)); }
.char-grid.mini .char-name { font-size: 12px; padding: 6px 8px; }

/* ---------- Tutorial ---------- */
.tut-hero {
  display: flex; align-items: center; gap: 18px;
  background: linear-gradient(135deg, #fff 0%, color-mix(in srgb, var(--c) 22%, #fff) 100%);
  border-radius: 30px; padding: 14px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.tut-hero img { width: clamp(110px, 26vw, 200px); aspect-ratio: 1; object-fit: cover; border-radius: 22px; border: 4px solid #fff; }
.tut-hero h1 {
  font-size: clamp(30px, 7vw, 56px); color: var(--c);
  -webkit-text-stroke: 2px #fff; paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(0,0,0,.12);
  text-transform: uppercase;
}
.meta { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.meta li { background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 14px; font-weight: 700; }
.meta b { color: var(--c); }

.tut-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: #f3f2fa; padding: 5px; border-radius: 16px; margin-bottom: 18px; }
.tut-tabs a {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 6px; border-radius: 12px; font-weight: 800; font-size: clamp(12px, 2.4vw, 15px);
  color: var(--muted); text-align: center;
}
.tut-tabs a svg { font-size: 1.2em; flex: none; }
.tut-tabs a.active { background: #fff; color: var(--c); box-shadow: 0 2px 8px rgba(31, 34, 87, .1); }

.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.step { background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: 0 3px 0 var(--line); }
.step-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.step-num {
  flex: none; display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--c); color: #fff;
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 28px;
  box-shadow: 0 3px 0 rgba(0,0,0,.18);
}
.step h3 { font-size: clamp(19px, 3.4vw, 24px); }
.step p { margin: 4px 0 0; color: var(--muted); font-weight: 600; }
.step-img { display: block; width: 100%; padding: 0; border-radius: 16px; overflow: hidden; cursor: zoom-in; }
.step-img img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .3s; }
.step-img:hover img { transform: scale(1.03); }

@media (min-width: 760px) {
  .step { display: grid; grid-template-columns: 1fr 1.2fr; gap: 18px; align-items: center; }
  .step-head { margin: 0; }
}

.big-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 20px auto 0; max-width: 340px;
  background: var(--c); color: #fff;
  border-radius: 999px; padding: 14px 24px;
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 22px;
  box-shadow: 0 5px 0 rgba(0,0,0,.2);
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.2); }

.parts { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.parts li { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 16px; padding: 14px; font-weight: 700; box-shadow: 0 3px 0 var(--line); }
.parts svg { flex: none; font-size: 22px; color: #fff; background: var(--c); border-radius: 50%; padding: 4px; width: 30px; height: 30px; }
.note { color: var(--muted); font-weight: 700; text-align: center; }
.parts-img { border-radius: 18px; width: 100%; aspect-ratio: 4/3; object-fit: cover; }

.finished { text-align: center; }
.finished img { width: min(420px, 100%); margin: 0 auto; border-radius: 28px; border: 6px solid #fff; box-shadow: var(--shadow); }
.finished p { font-size: 19px; font-weight: 800; max-width: 40ch; margin: 18px auto; }
.more-title { font-size: 22px; margin: 12px 0; }

.about h1 { font-size: 34px; margin-bottom: 10px; }
.about p { font-size: 17px; line-height: 1.6; font-weight: 600; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%);
  width: min(440px, calc(100% - 32px));
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: #fff; border-radius: 22px; padding: 6px;
  box-shadow: 0 10px 30px rgba(31, 34, 87, .2); z-index: 10;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; font-size: 12px; font-weight: 800; color: var(--muted); border-radius: 16px; }
.bottom-nav svg { font-size: 24px; }
.bottom-nav a.active { color: var(--pink); background: var(--pink-soft); }
.bottom-nav a.active svg { fill: currentColor; }

/* ---------- Lightbox ---------- */
#lightbox { border: 0; padding: 0; border-radius: 20px; max-width: min(1100px, 94vw); background: transparent; cursor: zoom-out; }
#lightbox::backdrop { background: rgba(20, 20, 50, .8); }
#lightbox img { width: 100%; border-radius: 20px; }

/* ---------- Themes ---------- */
.theme-boys .bottom-nav a.active { color: var(--blue); background: var(--blue-soft); }
.theme-boys .round-btn { color: var(--blue); }

@media (max-width: 480px) {
  .lang-grid { gap: 10px; }
  .features { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }
  .tut-tabs a span { font-size: 11px; }
  .tut-tabs a { flex-direction: column; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 480px) {
  .char-name { font-size: 12px; padding: 6px 8px; left: 6px; right: 6px; bottom: 6px; white-space: nowrap; }
  .char-name svg { flex: none; }
}
