:root {
  --sky: #8ddcff;
  --cloud: #f7fbff;
  --sun: #ffe277;
  --grass: #95dd6f;
  --leaf: #43c486;
  --pink: #ff8db8;
  --orange: #ffb347;
  --ink: #24425a;
  --soft-ink: #45657f;
  --card: #ffffff;
  --card-soft: #fff9ef;
  --danger-soft: #ffdfe8;
  --good: #34c38f;
  --shadow: 0 10px 30px rgba(24, 83, 120, 0.22);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-display: "Baloo 2", "Trebuchet MS", "Comic Sans MS", cursive;
  --font-body: "Nunito", "Trebuchet MS", sans-serif;
  --tap-size: 56px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--ink);
  background: linear-gradient(180deg, #87d8ff 0%, #bbebff 55%, #ecffe9 100%);
}

body {
  min-height: 100dvh;
}

button,
input {
  font: inherit;
}

.app-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: calc(var(--vh, 1vh) * 100);
  height: 100dvh;
  min-height: calc(var(--vh, 1vh) * 100);
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}

.background-layers {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at 85% 12%, rgba(255, 239, 163, 0.8) 0 110px, transparent 115px),
    linear-gradient(180deg, #8ddcff 0%, #9be2ff 40%, #c4f4ff 100%);
}

.cloud {
  position: absolute;
  width: 190px;
  height: 72px;
  background: var(--cloud);
  border-radius: 50px;
  filter: drop-shadow(0 8px 8px rgba(72, 137, 176, 0.12));
}

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

.cloud::before {
  width: 72px;
  height: 72px;
  top: -28px;
  left: 24px;
}

.cloud::after {
  width: 90px;
  height: 90px;
  top: -36px;
  right: 22px;
}

.cloud-1 {
  top: 8%;
  left: -8%;
}

.cloud-2 {
  top: 18%;
  right: -7%;
}

.cloud-3 {
  top: 34%;
  left: 26%;
}

.spark {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff8b1;
  transform: rotate(45deg);
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(255, 237, 133, 0.9);
}

.spark-1 {
  top: 26%;
  left: 12%;
}

.spark-2 {
  top: 62%;
  right: 18%;
}

.spark-3 {
  top: 74%;
  left: 48%;
}

.screen-wrap {
  position: relative;
  height: 100%;
  z-index: 2;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  padding: calc(86px + env(safe-area-inset-top, 0px)) 16px 22px;
  overflow-y: hidden;
  z-index: 2;
}

.screen.active {
  display: block;
}

.title-card,
.start-panel,
.result-card,
.parents-card,
.challenge-panel,
.mascot-panel,
.map-top,
.world-node,
.map-actions,
.game-hud {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.app-bg.app-screen-map .cloud,
.app-bg.app-screen-map .spark,
.app-bg.app-screen-game .cloud,
.app-bg.app-screen-game .spark,
.app-bg.app-screen-result .cloud,
.app-bg.app-screen-result .spark {
  display: none;
}

.app-bg.app-screen-start .cloud,
.app-bg.app-screen-start .spark {
  display: block;
}

.title-card {
  max-width: 880px;
  margin: 0 auto 12px;
  text-align: center;
  padding: 12px 16px;
}

.tiny {
  margin: 0;
  color: var(--soft-ink);
  font-size: 0.92rem;
}

h1,
h2,
h3,
h4,
.label-big {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 7vw, 3.2rem);
}

h2 {
  font-size: clamp(1.45rem, 5vw, 2.1rem);
}

h3 {
  font-size: clamp(1.3rem, 4.6vw, 1.75rem);
}

.subtitle {
  margin: 6px 0 0;
  color: var(--soft-ink);
  font-size: 1.02rem;
  line-height: 1.35;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 14px;
  max-width: 980px;
  margin: 0 auto;
}

.mascot {
  width: 320px;
  height: 320px;
  max-width: 62vw;
  max-height: 62vw;
  margin: 0 auto;
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
}

.mascot::before {
  content: "";
  position: absolute;
  inset: 10% 10% 8%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #f4fbff 70%, #e6f5ff 100%);
  box-shadow: 0 8px 20px rgba(80, 156, 196, 0.2);
  z-index: -1;
}

.mascot-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  user-select: none;
  pointer-events: none;
}

#start-mascot {
  width: 340px;
  height: 340px;
  max-width: 68vw;
  max-height: 68vw;
}

.start-panel {
  padding: 16px;
  max-width: 560px;
  margin: 0 auto;
}

.label-big {
  display: block;
  font-size: 1.18rem;
  margin-bottom: 8px;
}

.kid-input {
  width: 100%;
  min-height: 58px;
  border: 3px solid #8ddcff;
  border-radius: 16px;
  padding: 10px 16px;
  font-size: 1.2rem;
  color: var(--ink);
}

.kid-input:focus {
  outline: none;
  border-color: #43c486;
  box-shadow: 0 0 0 4px rgba(67, 196, 134, 0.2);
}

.start-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  min-height: var(--tap-size);
  border: none;
  border-radius: 18px;
  padding: 12px 18px;
  font-weight: 800;
  font-size: 1.06rem;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}

.btn-primary {
  background: linear-gradient(180deg, #ffe37f 0%, #ffcd55 100%);
}

.btn-secondary {
  background: linear-gradient(180deg, #8ef0e3 0%, #57d8c9 100%);
}

.btn-soft {
  background: linear-gradient(180deg, #ffd6e6 0%, #ffb8d1 100%);
}

.btn-xl {
  font-size: 1.22rem;
  min-height: 62px;
}

.fab {
  position: fixed;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  z-index: 15;
  font-size: 1.4rem;
  cursor: pointer;
}

.fab-fullscreen {
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
}

.fab-sound {
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 76px;
}

.map-top {
  max-width: 1080px;
  margin: 0 auto 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.map-progress {
  display: flex;
  gap: 12px;
  font-size: 1.14rem;
  font-weight: 800;
}

.world-map {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.world-node {
  width: 100%;
  text-align: left;
  padding: 14px;
  border: 3px solid transparent;
}

.world-node[disabled] {
  opacity: 0.62;
}

.world-node .world-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  display: block;
}

.world-node .world-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: var(--soft-ink);
  font-weight: 700;
}

.map-actions {
  max-width: 1080px;
  margin: 14px auto 0;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.map-actions .btn {
  flex: 1;
}

.game-hud {
  max-width: 1080px;
  margin: 0 auto 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.hud-center {
  min-width: 0;
}

.progress-track {
  width: 100%;
  height: 15px;
  background: #e3f5ff;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #70d5ff, #43c486);
  border-radius: inherit;
}

.hud-stars {
  font-size: 1.2rem;
  font-weight: 800;
}

.game-main {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.mascot-panel {
  padding: 10px;
  text-align: center;
}

.speech-bubble {
  margin: 6px auto 2px;
  max-width: 360px;
  background: var(--card-soft);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 700;
}

.challenge-panel {
  padding: 14px;
}

.challenge-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.task-visual {
  min-height: 110px;
  border-radius: 16px;
  padding: 10px;
  background: #eef9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  text-align: center;
  font-size: clamp(1.3rem, 6vw, 2.5rem);
  font-weight: 800;
}

.visual-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

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

.option-btn {
  min-height: 72px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #e9f8ff);
  box-shadow: 0 6px 10px rgba(62, 124, 164, 0.16);
  font-size: clamp(1.3rem, 6vw, 2rem);
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
  padding: 12px 8px;
}

.option-btn.color-option {
  color: #17354a;
  font-size: 1.25rem;
}

.option-btn.correct {
  outline: 4px solid rgba(38, 188, 133, 0.58);
}

.option-btn.wrong {
  outline: 4px solid rgba(255, 102, 122, 0.45);
}

.result-card {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
  text-align: center;
}

.result-stars {
  min-height: 56px;
  font-size: 1.8rem;
  margin-top: 10px;
}

.result-actions {
  display: grid;
  gap: 10px;
}

.parents-panel {
  position: fixed;
  inset: 0;
  background: rgba(22, 57, 80, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 20;
}

.parents-panel.open {
  display: flex;
}

.parents-card {
  width: min(760px, 100%);
  max-height: calc(var(--vh, 1vh) * 90);
  overflow-y: auto;
  padding: 16px;
}

.parents-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.parents-summary {
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
}

.parents-item {
  background: #eef9ff;
  border-radius: 12px;
  padding: 10px;
  font-weight: 700;
}

.ranking-list {
  padding-left: 22px;
  margin: 8px 0 0;
}

.ranking-list li {
  margin-bottom: 6px;
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 12px 16px;
  background: rgba(20, 57, 80, 0.92);
  color: #fff;
  border-radius: 999px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 30;
}

.toast.show {
  opacity: 1;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 18px;
  opacity: 0.88;
}
