:root {
  color-scheme: light;
  --ink: #263447;
  --cream: #fff9e9;
  --yellow: #ffd85c;
  --coral: #ff6b6b;
  --blue: #55b9e9;
  --blue-dark: #287da9;
  --green: #63b56c;
  --green-dark: #2f7249;
  --purple: #8b76d7;
  --white: #fff;
  --shadow: 0 12px 0 rgba(38,52,71,.09), 0 22px 45px rgba(38,52,71,.12);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--cream); font-family: "Trebuchet MS", Arial, sans-serif; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }

.skip-link { position: fixed; z-index: 100; top: .75rem; left: .75rem; padding: .7rem 1rem; border-radius: .7rem; color: white; background: var(--ink); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.home-page {
  position: relative;
  overflow-x: hidden;
  color: var(--white);
  background: #07142f;
}
.home-page::before,
.home-page::after {
  content: "";
  position: fixed;
  z-index: 0;
  inset: -22%;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 24%, rgba(255,225,72,.92) 0 7px, rgba(255,225,72,.2) 8px 34px, transparent 76px),
    radial-gradient(circle at 82% 18%, rgba(113,215,255,.88) 0 6px, rgba(113,215,255,.18) 7px 39px, transparent 85px),
    radial-gradient(circle at 70% 67%, rgba(197,157,255,.88) 0 8px, rgba(197,157,255,.17) 9px 42px, transparent 90px),
    radial-gradient(circle at 26% 78%, rgba(130,241,166,.86) 0 7px, rgba(130,241,166,.16) 8px 40px, transparent 88px),
    radial-gradient(circle at 47% 12%, rgba(255,225,72,.84) 0 4px, rgba(255,225,72,.15) 5px 24px, transparent 58px),
    radial-gradient(circle at 93% 48%, rgba(113,215,255,.82) 0 5px, rgba(113,215,255,.14) 6px 27px, transparent 62px),
    radial-gradient(circle at 43% 56%, rgba(197,157,255,.8) 0 4px, rgba(197,157,255,.14) 5px 25px, transparent 60px),
    radial-gradient(circle at 62% 91%, rgba(130,241,166,.8) 0 5px, rgba(130,241,166,.13) 6px 28px, transparent 64px);
  filter: blur(1px);
  animation: magic-flow 15s ease-in-out infinite alternate;
}
.home-page::after {
  inset: -28%;
  opacity: .58;
  transform: rotate(180deg) scale(.78);
  animation-duration: 21s;
  animation-direction: alternate-reverse;
}
@keyframes magic-flow {
  0% { transform: translate3d(-2%,-1%,0) rotate(-2deg); }
  45% { transform: translate3d(4%,3%,0) rotate(3deg); }
  100% { transform: translate3d(-1%,7%,0) rotate(-1deg); }
}

.home-hero { position: relative; z-index: 1; min-height: 390px; padding: 4.8rem max(1.5rem, calc((100vw - 1080px)/2)); overflow: hidden; color: white; background: transparent; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.home-hero::after { display: none; }
.hero-copy { position: relative; z-index: 2; max-width: 650px; }
.kicker, .card-label { margin: 0 0 .3rem; font-size: .78rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, .game-card strong, .question, .finish-title { font-family: "Trebuchet MS", Arial, sans-serif; }
.home-hero h1 { max-width: 650px; margin: 0; font-size: clamp(3.2rem,8vw,6.6rem); line-height: .87; letter-spacing: -.055em; text-shadow: 0 5px 0 rgba(40,125,169,.22); }
.hero-text { max-width: 570px; margin: 1.7rem 0 0; font-size: clamp(1.05rem,2vw,1.28rem); font-weight: 700; line-height: 1.55; }
.hero-mascot { position: relative; z-index: 2; flex: 0 0 auto; width: clamp(150px,22vw,240px); aspect-ratio: 1; border: 10px solid rgba(255,255,255,.65); border-radius: 45% 45% 48% 48%; background: var(--yellow); box-shadow: 0 18px 0 rgba(40,125,169,.16); display: grid; place-items: center; transform: rotate(4deg); }
.mascot-ear { position: absolute; top: -30%; width: 35%; height: 48%; border: 9px solid rgba(255,255,255,.65); border-radius: 60% 60% 20% 20%; background: var(--yellow); }
.ear-left { left: 6%; transform: rotate(-18deg); }
.ear-right { right: 6%; transform: rotate(18deg); }
.mascot-face { position: relative; z-index: 1; font-size: clamp(2.4rem,6vw,4rem); font-weight: 800; }
.cloud { display: none; }
.cloud::before,.cloud::after { content: ""; position: absolute; bottom: 0; border-radius: 50%; background: inherit; }
.cloud::before { left: 22px; width: 62px; height: 62px; }
.cloud::after { right: 20px; width: 45px; height: 45px; }
.cloud-one { top: 12%; left: 5%; transform: scale(.7); }
.cloud-two { top: 18%; right: 28%; transform: scale(.52); }

.game-picker { position: relative; z-index: 1; width: min(1080px,calc(100% - 2rem)); margin: -1rem auto 0; padding: 2rem 0 5rem; }
.game-picker h2 { margin: 0 0 1.5rem; color: var(--yellow); text-align: center; font-size: clamp(2rem,4vw,3rem); line-height: 1; }
.game-cards { display: grid; grid-template-columns: repeat(2,1fr); gap: 1.5rem; }
.game-card { min-height: 390px; overflow: hidden; border: 2px solid rgba(170,215,255,.28); border-radius: 28px; color: var(--white); background: rgba(18,38,75,.88); box-shadow: 0 12px 0 rgba(0,0,0,.18),0 24px 55px rgba(0,0,0,.34); backdrop-filter: blur(14px); text-decoration: none; transition: transform .2s,box-shadow .2s,border-color .2s; }
.game-card:hover,.game-card:focus-visible { border-color: rgba(255,225,72,.72); transform: translateY(-7px) rotate(-.4deg); box-shadow: 0 17px 0 rgba(0,0,0,.16),0 30px 60px rgba(0,0,0,.42),0 0 34px rgba(113,215,255,.15); outline: 4px solid var(--yellow); outline-offset: 3px; }
.card-art { height: 205px; display: flex; align-items: center; justify-content: center; gap: 1rem; }
.balloon-art { background: linear-gradient(145deg,rgba(99,188,235,.28),rgba(136,111,214,.2)); }
.balloon-art span { width: 92px; aspect-ratio: .82; border-radius: 50% 50% 45% 45%; color: white; background: var(--coral); box-shadow: inset -8px -8px rgba(0,0,0,.07); display: grid; place-items: center; font-size: 2rem; font-weight: 800; transform: rotate(-7deg); }
.balloon-art span:nth-child(2) { color: var(--ink); background: var(--yellow); transform: translateY(-18px); }
.balloon-art span:nth-child(3) { background: var(--purple); transform: rotate(7deg); }
.forest-art { background: linear-gradient(rgba(113,215,255,.38) 0 58%,rgba(130,241,166,.34) 58%); }
.forest-art .tree { position: relative; flex: 0 0 84px; width: 84px; height: 126px; }
.forest-art .tree::before { content: ""; position: absolute; z-index: 1; inset: 0 0 20px; background: linear-gradient(145deg,#4f9f5b,#286841); clip-path: polygon(50% 0,100% 100%,0 100%); filter: drop-shadow(0 7px 0 rgba(0,0,0,.1)); }
.forest-art .tree::after { content: ""; position: absolute; bottom: 0; left: 34px; width: 18px; height: 35px; border-radius: 3px; background: #805236; }
.forest-art .treasure { position: relative; width: 90px; height: 60px; margin-top: 32px; border: 4px solid #71451f; border-radius: 10px 10px 14px 14px; background: linear-gradient(#d99b38,#a96625); box-shadow: inset 0 8px rgba(255,216,92,.45),0 7px 0 rgba(0,0,0,.12); }
.forest-art .treasure::before { content: ""; position: absolute; top: -28px; left: -4px; width: 90px; height: 31px; border: 4px solid #71451f; border-radius: 45px 45px 5px 5px; background: linear-gradient(#f0bc4c,#bd782b); }
.forest-art .treasure::after { content: ""; position: absolute; z-index: 2; top: 18px; left: 32px; width: 18px; height: 22px; border: 3px solid #71451f; border-radius: 5px; background: var(--yellow); }
.card-copy { display: flex; flex-direction: column; align-items: flex-start; padding: 1.5rem 1.7rem 1.8rem; }
.card-label { color: #8edcff; }
.forest-card .card-label { color: #9cf3b8; }
.game-card strong { margin-bottom: .3rem; color: var(--yellow); font-size: 2rem; line-height: 1.1; }
.card-copy > span:not(.card-label):not(.play-button) { line-height: 1.5; }
.play-button { margin-top: 1.2rem; padding: .62rem 1.1rem; border-radius: 999px; color: white; background: var(--blue-dark); font-weight: 800; }
.forest-card .play-button { background: var(--green-dark); }
.site-footer { position: relative; z-index: 1; padding: 0 1rem 2.5rem; text-align: center; color: rgba(255,255,255,.76); font-weight: 700; }

.home-page h1 { color: var(--yellow); }

.story-section {
  position: relative;
  z-index: 1;
  width: min(900px,100%);
  margin: 5rem auto 0;
}
.story-heading {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(190px,280px);
  align-items: center;
  gap: clamp(1.25rem,4vw,3.5rem);
  margin-bottom: 2rem;
  text-align: left;
}
.story-heading-copy { text-align: center; }
.story-heading .kicker { color: #9cf3b8; }
.story-heading h2 {
  max-width: 780px;
  margin: .4rem 0 .75rem;
  color: var(--yellow);
  font-size: clamp(2.2rem,6vw,4.2rem);
  line-height: 1.05;
}
.story-title-ru {
  margin: 0;
  color: #ffe97d;
  font-family: Georgia,serif;
  font-size: clamp(1.25rem,3vw,1.75rem);
  font-style: italic;
}
.story-fish {
  display: block;
  width: min(100%,260px);
  height: auto;
  justify-self: center;
  filter: drop-shadow(0 0 16px rgba(255,224,106,.38)) drop-shadow(0 16px 22px rgba(0,0,0,.28));
  animation: fish-float 5.5s ease-in-out infinite;
}
@keyframes fish-float {
  0%,100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-12px) rotate(1.5deg); }
}
.story-card {
  padding: clamp(1.5rem,5vw,4rem);
  border: 2px solid rgba(170,215,255,.28);
  border-radius: 30px;
  color: var(--white);
  background: rgba(11,28,61,.9);
  box-shadow: 0 18px 60px rgba(0,0,0,.35),inset 0 1px rgba(255,255,255,.08);
  backdrop-filter: blur(16px);
}
.story-text {
  max-width: 690px;
  margin: 0 auto;
  color: var(--white);
  font-family: Georgia,"Times New Roman",serif;
  font-size: clamp(1rem,2.2vw,1.16rem);
  line-height: 1.78;
  white-space: normal;
}
.story-credit {
  max-width: 690px;
  margin: 3rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(170,215,255,.24);
  color: rgba(255,255,255,.7);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .7rem 1.5rem;
  font-size: .85rem;
}
.story-credit a { color: #8edcff; text-underline-offset: 3px; }
.story-credit a:hover,.story-credit a:focus-visible { color: var(--yellow); }
/* Shared game layout */
.game-page { min-height: 100vh; padding: 1rem; }
.math-page { background: linear-gradient(170deg,#dff5ff,#fff7dc); }
.forest-page { background: linear-gradient(#b9e8ed 0 42%,#8fc66e 42%); }
.game-shell { width: min(100%,1020px); min-height: calc(100vh - 2rem); margin: 0 auto; overflow: hidden; border: 4px solid rgba(38,52,71,.12); border-radius: 30px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.game-topbar { min-height: 78px; padding: .8rem 1.2rem; border-bottom: 3px solid rgba(38,52,71,.08); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.home-link,.action-button { border: 0; border-radius: 999px; font-weight: 800; text-decoration: none; cursor: pointer; }
.home-link { padding: .7rem 1rem; background: #eef3f7; }
.home-link:hover,.home-link:focus-visible { outline: 3px solid var(--yellow); }
.game-name { margin: 0; font-size: clamp(1.1rem,3vw,1.55rem); line-height: 1; text-align: center; }
.game-stats { display: flex; gap: .6rem; }
.stat-pill { padding: .55rem .85rem; border-radius: 999px; background: #eef3f7; font-weight: 800; white-space: nowrap; }
.game-stage { position: relative; min-height: 650px; padding: clamp(1.2rem,4vw,2.5rem); }
.round-label { margin: 0; text-align: center; color: #607086; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.question { margin: .3rem 0 0; text-align: center; font-size: clamp(3.4rem,10vw,6.5rem); line-height: 1; }
.instruction { margin: .3rem 0 1.3rem; text-align: center; font-size: 1.05rem; font-weight: 700; }
.feedback { min-height: 2rem; margin: .7rem 0; text-align: center; font-size: 1.2rem; font-weight: 800; }
.feedback.good { color: var(--green-dark); }
.feedback.try { color: #b44c35; }
.balloon-field { min-height: 330px; padding: 1rem; display: grid; grid-template-columns: repeat(3,1fr); place-items: center; gap: 1.5rem; }
.answer-balloon { position: relative; width: clamp(90px,15vw,130px); aspect-ratio: .82; border: 0; border-radius: 50% 50% 46% 46%; color: white; background: var(--balloon-color,var(--coral)); box-shadow: inset -10px -12px rgba(0,0,0,.08),0 8px 0 rgba(38,52,71,.08); font-size: clamp(2rem,5vw,3.1rem); font-weight: 800; cursor: pointer; animation: float 2.8s ease-in-out infinite; animation-delay: var(--delay,0s); }
.answer-balloon::after { content: ""; position: absolute; top: 96%; left: 50%; width: 2px; height: 42px; background: rgba(38,52,71,.35); }
.answer-balloon:hover,.answer-balloon:focus-visible { outline: 5px solid var(--yellow); outline-offset: 5px; scale: 1.06; }
.answer-balloon.wrong { animation: shake .35s ease; }
.answer-balloon.pop { animation: pop .35s ease forwards; pointer-events: none; }
@keyframes float { 0%,100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes shake { 0%,100% { translate: 0; } 25% { translate: -10px; } 75% { translate: 10px; } }
@keyframes pop { 60% { scale: 1.25; opacity: 1; } 100% { scale: .1; opacity: 0; } }
.finish-panel { position: absolute; z-index: 20; inset: 0; padding: 2rem; background: rgba(255,255,255,.97); display: grid; place-items: center; text-align: center; }
.finish-panel[hidden] { display: none; }
.finish-content { max-width: 520px; }
.finish-icon { display: block; font-size: 6rem; animation: celebrate .8s ease infinite alternate; }
.finish-title { margin: .3rem 0; font-size: clamp(2.5rem,7vw,4.6rem); line-height: 1; }
.finish-message { font-size: 1.2rem; line-height: 1.5; }
.action-button { padding: .9rem 1.4rem; color: white; background: var(--blue-dark); font-size: 1.05rem; box-shadow: 0 5px 0 #175879; }
.action-button:hover,.action-button:focus-visible { transform: translateY(-2px); outline: 4px solid var(--yellow); outline-offset: 3px; }
@keyframes celebrate { to { transform: rotate(8deg) scale(1.08); } }

/* Forest game */
.forest-stage { padding: 0; overflow: hidden; background: linear-gradient(#bcebf1 0 48%,#9bd178 48%); }
.forest-info { position: relative; z-index: 10; padding: 1.2rem 1.5rem .5rem; }
.clue-card { max-width: 650px; margin: 0 auto; padding: 1rem 1.4rem; border: 3px solid rgba(47,114,73,.18); border-radius: 20px; background: rgba(255,255,255,.94); box-shadow: 0 7px 0 rgba(47,114,73,.12); text-align: center; }
.clue-card p { margin: 0; }
.clue-label { color: var(--green-dark); font-size: .76rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.clue-text { margin-top: .25rem!important; font-size: clamp(1rem,3vw,1.25rem); font-weight: 700; line-height: 1.4; }
.treasure-progress { margin-top: .7rem; display: flex; justify-content: center; gap: .55rem; }
.treasure-slot { width: 42px; height: 42px; border: 3px dashed rgba(47,114,73,.3); border-radius: 50%; background: rgba(255,255,255,.48); display: grid; place-items: center; font-size: 1.45rem; }
.treasure-slot.found { border-style: solid; background: var(--yellow); animation: celebrate .5s ease; }
.forest-scene { position: relative; min-height: 500px; }
.sun { position: absolute; top: 5%; right: 8%; width: 85px; height: 85px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 13px rgba(255,216,92,.22); }
.hill { position: absolute; bottom: 0; width: 70%; height: 52%; border-radius: 55% 55% 0 0; background: #78bb61; }
.hill-left { left: -15%; }
.hill-right { right: -20%; height: 45%; background: #66aa5c; }
.forest-tree { position: absolute; bottom: 8%; width: 95px; height: 250px; border-radius: 55% 55% 20% 20%; background: #3c8450; box-shadow: inset -18px 0 rgba(0,0,0,.08); }
.forest-tree::after { content: ""; position: absolute; bottom: -22%; left: 40%; width: 22%; height: 35%; background: #805236; }
.tree-a { left: 4%; transform: scale(1.05); }
.tree-b { left: 23%; bottom: 3%; transform: scale(.72); }
.tree-c { right: 5%; transform: scale(1.12); }
.tree-d { right: 25%; bottom: 1%; transform: scale(.65); }
.forest-item { position: absolute; z-index: 5; width: 66px; height: 66px; border: 3px solid rgba(38,52,71,.1); border-radius: 50%; background: rgba(255,255,255,.87); box-shadow: 0 6px 0 rgba(38,52,71,.1); display: grid; place-items: center; font-size: 2.35rem; cursor: pointer; transition: transform .15s; }
.forest-item:hover,.forest-item:focus-visible { transform: scale(1.14) rotate(5deg); outline: 5px solid var(--yellow); outline-offset: 3px; }
.forest-item.found { animation: collect .6s ease forwards; pointer-events: none; }
.forest-item.nope { animation: shake .35s ease; }
@keyframes collect { 45% { transform: scale(1.5) rotate(15deg); } 100% { transform: translateY(-90px) scale(.25); opacity: 0; } }
.item-0 { left: 12%; top: 48%; }.item-1 { left: 37%; top: 65%; }.item-2 { right: 17%; top: 45%; }.item-3 { left: 56%; top: 35%; }
.item-4 { left: 27%; top: 25%; }.item-5 { right: 5%; top: 72%; }.item-6 { left: 4%; top: 73%; }.item-7 { right: 34%; top: 76%; }
.forest-feedback { position: absolute; z-index: 8; right: 0; bottom: .5rem; left: 0; width: fit-content; margin: auto; padding: .45rem .9rem; border-radius: 999px; background: rgba(255,255,255,.9); }
.forest-finish .action-button { background: var(--green-dark); box-shadow: 0 5px 0 #1c4e31; }

@media (max-width:720px) {
  .home-hero { min-height: 460px; padding-top: 3rem; align-items: flex-start; }
  .hero-mascot { position: absolute; right: 1.5rem; bottom: 60px; width: 115px; border-width: 6px; }
  .mascot-ear { border-width: 5px; }
  .hero-copy { max-width: 90%; }
  .hero-text { max-width: 70%; }
  .game-cards { grid-template-columns: 1fr; }
  .game-card { min-height: 0; }
  .story-heading { grid-template-columns: 1fr; text-align: center; }
  .story-heading h2 { margin-inline: auto; }
  .story-fish { width: min(58vw,210px); }
  .game-topbar { flex-wrap: wrap; }
  .game-name { order: -1; width: 100%; }
  .game-stage { min-height: calc(100vh - 120px); }
  .balloon-field { grid-template-columns: repeat(2,1fr); gap: 1.2rem; }
  .forest-scene { min-height: 520px; }
  .forest-item { width: 57px; height: 57px; font-size: 2rem; }
  .forest-tree { width: 70px; height: 205px; }
}
@media (max-width:430px) {
  .game-page { padding: 0; }
  .game-shell { min-height: 100vh; border: 0; border-radius: 0; }
  .stat-pill { padding: .45rem .65rem; font-size: .9rem; }
  .balloon-field { padding: .3rem; }
  .answer-balloon { width: 92px; }
  .forest-info { padding-inline: .7rem; }
  .item-0 { left: 6%; }.item-2 { right: 8%; }.item-5 { right: 2%; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation-duration: .01ms!important; animation-iteration-count: 1!important; scroll-behavior: auto!important; } }
