/* ============================================================
   Лисьи острова — весёлая математика
   Дизайн-система: «конфетный» стиль для детей 3–7 лет,
   крупные цели для тапа, всё скруглено, яркая палитра.
   ============================================================ */

:root {
  --coral:   #FF6B6B;
  --coral-d: #E14E4E;
  --sun:     #FFD93D;
  --sun-d:   #E8B416;
  --grass:   #6BCB77;
  --grass-d: #4CA958;
  --sky:     #4D96FF;
  --sky-d:   #3572D6;
  --lilac:   #B39DDB;
  --lilac-d: #8f76c2;
  --pink:    #FF8FAB;
  --mint:    #4ECDC4;
  --ink:     #35405A;
  --ink-soft:#5D6A8C;
  --paper:   #FFFFFF;
  --cream:   #FFF7E6;

  --map-water-sun: #45BFE8;
  --map-water-strait: #168FC9;
  --map-water-far: #0968AA;
  --map-sand: #FFD45A;
  --map-route-done: #D94B43;
  --map-route-future: #197A4C;
  --map-panel: #FFFDF5;
  --map-focus: #FFE066;
  --map-hud-z: 30;
  --map-panel-z: 30;
  --map-modal-z: 40;

  --r-lg: 28px;
  --r-md: 20px;
  --r-sm: 14px;

  --shadow-card: 0 10px 24px rgba(53, 64, 90, .14);

  --font: "Baloo 2", "Arial Rounded MT Bold", "SF Pro Rounded",
          "Trebuchet MS", "Comic Sans MS", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, #8ED6FF 0%, #C9F0FF 55%, #A8E6CF 100%);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

img, svg { display: block; }
button { font-family: inherit; color: inherit; }

#app {
  height: 100%;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ---------- экраны ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  animation: screenIn .35s ease both;
  padding: max(10px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom));
}
.screen.active { display: flex; }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px) scale(.99); }
  to   { opacity: 1; transform: none; }
}

/* ---------- кнопки ---------- */

.btn {
  border: none;
  cursor: pointer;
  border-radius: var(--r-md);
  font-family: inherit;
  font-weight: 800;
  color: #fff;
  background: var(--sky);
  box-shadow: 0 6px 0 var(--sky-d);
  padding: 14px 28px;
  font-size: 22px;
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
  line-height: 1.1;
}
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--sky-d); }

.btn.coral { background: var(--coral); box-shadow: 0 6px 0 var(--coral-d); }
.btn.coral:active { box-shadow: 0 1px 0 var(--coral-d); }
.btn.grass { background: var(--grass); box-shadow: 0 6px 0 var(--grass-d); }
.btn.grass:active { box-shadow: 0 1px 0 var(--grass-d); }
.btn.sun   { background: var(--sun); box-shadow: 0 6px 0 var(--sun-d); color: #7A5A00; }
.btn.sun:active { box-shadow: 0 1px 0 var(--sun-d); }
.btn.lilac { background: var(--lilac); box-shadow: 0 6px 0 var(--lilac-d); }
.btn.lilac:active { box-shadow: 0 1px 0 var(--lilac-d); }

.btn.big { font-size: 30px; padding: 18px 46px; border-radius: 32px; }

.btn:disabled { filter: grayscale(.6) opacity(.6); cursor: default; }

.next-hint {
  display: block;
  font-size: .5em;
  font-weight: 600;
  opacity: .85;
  margin-top: 4px;
}

.btn-icon {
  border: none;
  cursor: pointer;
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 50%;
  background: #ffffffdd;
  box-shadow: 0 4px 0 rgba(53,64,90,.18);
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .08s;
}
.btn-icon:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(53,64,90,.18); }
.btn-icon .ui-icon { width: 27px; height: 27px; pointer-events: none; }
.btn-icon.holding { animation: holdPulse .5s infinite alternate; }
@keyframes holdPulse { from { transform: scale(1); } to { transform: scale(1.15); } }

/* ============================================================
   ДОМАШНИЙ ЭКРАН
   ============================================================ */

#screen-home { align-items: center; justify-content: center; gap: 8px; overflow: hidden; }

.home-clouds { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cloud {
  position: absolute;
  font-size: 54px;
  opacity: .85;
  animation: cloudDrift linear infinite;
}
@keyframes cloudDrift {
  from { transform: translateX(-140px); }
  to   { transform: translateX(calc(100vw + 140px)); }
}

.home-fox {
  font-size: clamp(84px, 16vh, 140px);
  line-height: 1;
  filter: drop-shadow(0 12px 16px rgba(53,64,90,.25));
  animation: foxBounce 2.4s ease-in-out infinite;
  z-index: 1;
}
@keyframes foxBounce {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-16px) rotate(4deg); }
}

.home-title {
  font-size: clamp(34px, 7vw, 58px);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 4px 0 rgba(53,64,90,.25);
  text-align: center;
  z-index: 1;
}
.home-sub {
  font-size: clamp(16px, 3vw, 22px);
  color: var(--ink);
  background: #ffffffcc;
  padding: 6px 18px;
  border-radius: 999px;
  margin-bottom: 14px;
  z-index: 1;
}
.home-stars {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 800;
  color: #7A5A00;
  background: #FFE9A8;
  border-radius: 999px;
  padding: 6px 16px;
  box-shadow: 0 3px 0 var(--sun-d);
  z-index: 1;
}
.home-age { margin-top: 8px; font-size: 14px; color: var(--ink-soft); z-index: 1; }
.home-version {
  position: absolute;
  left: 50%;
  bottom: max(5px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(53, 64, 90, .48);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .04em;
  white-space: nowrap;
  pointer-events: none;
}

/* ============================================================
   КАРТА ОСТРОВОВ
   ============================================================ */

#screen-map {
  padding: 0;
  overflow: hidden;
  isolation: isolate;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 5;
}
.topbar .title {
  flex: 1;
  text-align: center;
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.star-chip {
  background: #FFE9A8;
  color: #7A5A00;
  font-weight: 800;
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: 0 3px 0 var(--sun-d);
  font-size: 18px;
  white-space: nowrap;
}

.map-viewport {
  position: absolute;
  top: max(68px, calc(env(safe-area-inset-top) + 60px));
  right: 0;
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 84px));
  left: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: #ffffff99 transparent;
}
.map-scene {
  position: relative;
  width: 100%;
  min-width: 0;
  height: clamp(1660px, 250vh, 1960px);
  height: clamp(1660px, 250dvh, 1960px);
  overflow: hidden;
  background: var(--map-water-sun);
}
.map-zone {
  position: absolute;
  left: 0;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
}
.map-zone-sun { background: var(--map-water-sun); }
.map-zone-strait { background: var(--map-water-strait); }
.map-zone-far { background: var(--map-water-far); }
.map-zone-label {
  position: absolute;
  top: 74px;
  left: 50%;
  z-index: 1;
  transform: translateX(-50%);
  min-width: max-content;
  padding: 5px 14px;
  border: 2px solid #ffffff88;
  border-radius: 999px;
  color: #083F68;
  background: #E9FAFFD9;
  box-shadow: 0 3px 8px #064F7929;
  font-size: clamp(12px, 3.3vw, 15px);
  font-weight: 800;
  letter-spacing: .02em;
}
.map-zone-strait .map-zone-label,
.map-zone-far .map-zone-label { color: #fff; background: #075C8FD9; }
.map-zone-current { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-zone-current path { stroke: #fff; stroke-width: 1.15; opacity: .13; }

.map-route {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.map-route-underlay { stroke: #fff; stroke-width: 8px; opacity: .72; }
.map-route-future {
  stroke: var(--map-route-future);
  stroke-width: 5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 2 2.2;
}
.map-route-done {
  stroke: var(--map-route-done);
  stroke-width: 5px;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.map-route-marker-ring {
  fill: #EAFBF0;
  stroke: var(--map-route-future);
  stroke-width: .8px;
}
.map-route-marker.state-past .map-route-marker-ring {
  fill: var(--map-route-done);
  stroke: #fff;
}
.map-route-marker.state-current .map-route-marker-ring {
  fill: #fff;
  stroke: var(--map-route-done);
  stroke-width: 1.25px;
}
.map-route-marker.state-current::after { content: none; }
.map-route-marker-core { fill: var(--map-route-done); }
.map-route-marker-dot { fill: var(--map-route-future); }
.map-route-check {
  fill: none;
  stroke: #fff;
  stroke-width: .85px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-island {
  position: absolute;
  z-index: 5;
  width: clamp(142px, 45vw, 182px);
  min-width: 142px;
  min-height: 150px;
  padding: 4px 5px 8px;
  border: 3px solid transparent;
  border-radius: 26px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: transform 160ms ease-out, background-color 160ms ease-out,
              box-shadow 160ms ease-out, border-color 160ms ease-out;
  touch-action: manipulation;
}
.map-island-art {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  overflow: visible;
  filter: drop-shadow(0 8px 5px rgba(3, 55, 91, .24));
  pointer-events: none;
}
.map-island-name,
.map-island-stars,
.map-island-state,
.map-you-are-here {
  display: block;
  position: relative;
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
  border-radius: 999px;
  box-shadow: 0 3px 7px rgba(3, 55, 91, .2);
  text-align: center;
  white-space: nowrap;
}
.map-island-name {
  margin-top: -15px;
  padding: 5px 10px 4px;
  color: #27334B;
  background: #FFFDF5F2;
  font-size: clamp(12px, 3.3vw, 15px);
  font-weight: 850;
}
.map-island-stars {
  margin-top: 4px;
  padding: 3px 9px;
  color: #6A4C00;
  background: #FFE9A8F2;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.map-island-state,
.map-you-are-here {
  margin-top: 4px;
  padding: 3px 9px;
  color: #fff;
  background: #075C8FEF;
  font-size: 10px;
  font-weight: 850;
}
.map-you-are-here { background: var(--map-route-done); }
.map-island.state-past::before {
  content: "✓";
  position: absolute;
  top: 18px;
  right: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: var(--map-route-done);
  box-shadow: 0 3px 7px rgba(3, 55, 91, .3);
  font-size: 17px;
  font-weight: 900;
}
.map-island.state-current { border-color: #fff; box-shadow: 0 0 0 4px var(--map-route-done); }
.map-island.state-future { border-color: #E8FFF1; border-style: dashed; }
.map-island.selected {
  border-color: #fff;
  background: #ffffff24;
  box-shadow: 0 0 0 5px var(--map-focus), 0 8px 18px rgba(3, 55, 91, .28);
}
.map-island:active { transform: translate(-50%, -50%) scale(.97); }
.map-island:focus-visible,
.map-play:focus-visible,
.map-topbar .btn-icon:focus-visible {
  outline: 4px solid var(--map-focus);
  outline-offset: 3px;
}

.map-ship {
  position: absolute;
  z-index: 7;
  top: 0;
  left: 0;
  width: clamp(54px, 16vw, 72px);
  height: clamp(48px, 14vw, 64px);
  margin: calc(clamp(48px, 14vw, 64px) / -2) 0 0 calc(clamp(54px, 16vw, 72px) / -2);
  pointer-events: none;
  will-change: transform;
  transition: transform 220ms ease-out;
  filter: drop-shadow(0 5px 4px rgba(3, 55, 91, .32));
}
.map-ship svg { width: 100%; height: 100%; }
.map-sea-landmark {
  position: absolute;
  z-index: 3;
  width: clamp(90px, 31vw, 132px);
  height: auto;
  opacity: .92;
  filter: drop-shadow(0 7px 5px rgba(3, 55, 91, .2));
  pointer-events: none;
}
.map-landmark-wreck { top: 43%; left: 7%; transform: rotate(-7deg); }
.map-landmark-serpent { top: 73%; right: 4%; transform: rotate(6deg); }

.map-selection {
  position: absolute;
  z-index: var(--map-panel-z);
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  padding: 10px;
  border: 3px solid #ffffffcc;
  border-radius: 22px;
  background: var(--map-panel);
  box-shadow: 0 12px 34px rgba(3, 55, 91, .3);
}
.map-selection-live {
  min-width: 0;
  padding-inline: 5px;
  overflow-wrap: anywhere;
  font-size: clamp(14px, 3.8vw, 18px);
  font-weight: 800;
  line-height: 1.25;
}
.map-play {
  min-width: 104px;
  min-height: 48px;
  padding: 10px 18px;
  border: none;
  border-radius: 16px;
  color: #fff;
  background: var(--coral);
  box-shadow: 0 5px 0 var(--coral-d);
  cursor: pointer;
  font-size: clamp(17px, 4.3vw, 21px);
  font-weight: 850;
  transition: transform 140ms ease-out, box-shadow 140ms ease-out;
  touch-action: manipulation;
}
.map-play:active { transform: translateY(3px) scale(.98); box-shadow: 0 2px 0 var(--coral-d); }
.map-play:disabled { opacity: .5; cursor: default; }

.map-topbar {
  position: absolute;
  z-index: var(--map-hud-z);
  top: max(8px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  min-height: 52px;
  padding: 0;
  filter: drop-shadow(0 5px 10px rgba(3, 55, 91, .22));
}
.map-topbar::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -24px;
  right: -14px;
  bottom: -14px;
  left: -14px;
  background: linear-gradient(180deg, rgba(255,255,255,.78), rgba(255,255,255,0));
  pointer-events: none;
}

/* ============================================================
   ЭКРАН ОСТРОВА (выбор активности и уровня)
   ============================================================ */

#screen-island { gap: 12px; }

.island-hero {
  text-align: center;
  font-size: 15px;
  color: var(--ink-soft);
  margin-top: -4px;
}

.activity-list {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  align-content: center;
  justify-content: center;
  overflow-y: auto;
  padding: 6px;
}

.activity-card {
  background: var(--paper);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px 16px;
  width: min(420px, 94%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-top: 10px solid var(--sun);
}
.activity-icon { font-size: 54px; line-height: 1; }
.activity-name { font-size: 24px; font-weight: 800; }
.activity-skill { font-size: 14px; color: var(--ink-soft); margin-top: -6px; }

.level-row { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; justify-content: center; }
.level-btn {
  border: none;
  cursor: pointer;
  width: 60px;
  border-radius: 16px;
  background: var(--cream);
  box-shadow: 0 5px 0 #e3d5b3;
  padding: 8px 4px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: inherit;
  transition: transform .08s;
}
.level-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #e3d5b3; }
.level-btn .lv { font-size: 15px; font-weight: 800; color: var(--ink); }
.level-btn .st { font-size: 10.5px; letter-spacing: 0; }
.level-btn.locked { filter: grayscale(1) opacity(.55); }
.level-btn.locked .lv { color: var(--ink-soft); }

/* ============================================================
   ИГРОВОЙ ЭКРАН
   ============================================================ */

#screen-game { gap: 8px; }

.round-dots { display: flex; gap: 7px; align-items: center; justify-content: center; }
.rdot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #ffffffaa;
  box-shadow: inset 0 0 0 2px #ffffff;
  transition: background .3s, transform .3s;
}
.rdot.done { background: var(--sun); transform: scale(1.05); }
.rdot.now  { background: var(--coral); transform: scale(1.3); }

.fox-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
}
.fox-face {
  font-size: 46px;
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(53,64,90,.25));
  animation: foxTilt 3s ease-in-out infinite;
}
@keyframes foxTilt {
  0%,100% { transform: rotate(-5deg); }
  50%     { transform: rotate(6deg); }
}
.bubble {
  position: relative;
  flex: 1;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 10px 16px;
  font-size: clamp(17px, 3vw, 22px);
  font-weight: 800;
  min-height: 46px;
  display: flex;
  align-items: center;
  min-width: 0;
}
.bubble::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  width: 16px; height: 16px;
  background: var(--paper);
  transform: translateY(-50%) rotate(45deg);
  border-radius: 3px;
}
.bubble.pop { animation: bubblePop .3s ease; }

.hint-btn {
  flex: 0 0 auto;
  min-height: 48px;
  max-width: 124px;
  border: none;
  border-radius: 16px;
  padding: 8px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.15;
  color: #745400;
  background: #FFE9A8;
  box-shadow: 0 4px 0 var(--sun-d);
}
.hint-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--sun-d); }
.hint-btn[hidden] { display: none; }
@keyframes bubblePop {
  0% { transform: scale(.96); }
  60% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.stage {
  flex: 1;
  position: relative;
  background: #ffffffbb;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vh, 20px);
  padding: clamp(10px, 2.5vw, 24px);
}
.stage.locked { pointer-events: none; }

/* --- общие игровые элементы --- */

.opt-row {
  display: flex;
  gap: clamp(10px, 2vw, 18px);
  justify-content: center;
  flex-wrap: wrap;
}
.num-btn {
  border: none;
  cursor: pointer;
  width: clamp(66px, 11vw, 92px);
  height: clamp(66px, 11vw, 92px);
  border-radius: 26px;
  font-family: inherit;
  font-size: clamp(30px, 6vw, 44px);
  font-weight: 800;
  color: #fff;
  background: var(--sky);
  box-shadow: 0 7px 0 var(--sky-d);
  transition: transform .08s;
}
.num-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--sky-d); }
.num-btn.v2 { background: var(--coral); box-shadow: 0 7px 0 var(--coral-d); }
.num-btn.v2:active { box-shadow: 0 2px 0 var(--coral-d); }
.num-btn.v3 { background: var(--grass); box-shadow: 0 7px 0 var(--grass-d); }
.num-btn.v3:active { box-shadow: 0 2px 0 var(--grass-d); }
.num-btn.v4 { background: var(--lilac); box-shadow: 0 7px 0 var(--lilac-d); }
.num-btn.v4:active { box-shadow: 0 2px 0 var(--lilac-d); }
.num-btn.emoji-opt { font-size: clamp(34px, 6.5vw, 50px); background: var(--paper); box-shadow: 0 7px 0 #d8dcea; }
.num-btn.correct-glow { animation: correctGlow .8s ease; }
.num-btn.dim { filter: grayscale(.8) opacity(.45); pointer-events: none; }

@keyframes correctGlow {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(107,203,119,.8); }
  50%  { transform: scale(1.14); box-shadow: 0 0 0 18px rgba(107,203,119,0); }
  100% { transform: scale(1); }
}

.shake { animation: shakeX .45s ease; }
@keyframes shakeX {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-9px) rotate(-2deg); }
  40% { transform: translateX(9px) rotate(2deg); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.pop-in { animation: popIn .35s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.task-caption {
  font-size: clamp(20px, 4vw, 30px);
  font-weight: 800;
  text-align: center;
}

.game-hint {
  max-width: min(620px, 94%);
  border-radius: 14px;
  padding: 8px 14px;
  text-align: center;
  font-size: clamp(14px, 2.8vw, 18px);
  font-weight: 750;
  color: #745400;
  background: #FFF4C9;
  box-shadow: inset 0 0 0 2px #FFD76A;
}
.game-hint[hidden] { display: none; }

/* --- светлячки: субитизация --- */
.firefly-field {
  position: relative;
  width: min(430px, 92%);
  min-height: clamp(145px, 26vh, 230px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #30478c, #172653 72%);
  box-shadow: inset 0 0 35px #8ed6ff55, 0 8px 20px #17265333;
}
.firefly-dice {
  width: min(230px, 72%);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.firefly-frame {
  width: min(360px, 86%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 3px solid #ffffff55;
  border-radius: 18px;
  overflow: hidden;
}
.firefly-cell {
  min-width: 38px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ffffff22;
}
.firefly-split { display: flex; gap: clamp(18px, 6vw, 48px); align-items: center; }
.firefly-cluster {
  min-width: 96px;
  min-height: 96px;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 5px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px #ffffff33;
}
.firefly-light {
  display: inline-block;
  font-size: clamp(31px, 7vw, 48px);
  line-height: 1;
  filter: drop-shadow(0 0 8px #fff4a8);
  transition: opacity .28s ease, transform .28s ease;
  animation: fireflyGlow 1.4s ease-in-out infinite alternate;
}
.firefly-light:nth-child(even) { animation-delay: -.7s; }
.firefly-cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(48px, 13vw, 78px);
  color: #fff;
  background: #172653;
}
.firefly-cover[hidden] { display: none; }
.firefly-field.covered .firefly-light { opacity: 0; transform: scale(.7); }
.firefly-field.group-hint .firefly-cluster,
.firefly-field.group-hint .firefly-frame { box-shadow: 0 0 0 4px #FFD93D99; }
@keyframes fireflyGlow {
  from { transform: scale(.92); opacity: .75; }
  to { transform: scale(1.08); opacity: 1; }
}

/* --- состав числа: корзинки с орешками --- */
.bond-target {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 18px;
  font-weight: 800;
  background: #FFF4C9;
  box-shadow: 0 5px 0 #E7C15A;
}
.bond-target strong { font-size: clamp(34px, 7vw, 52px); color: var(--coral-d); }
.bond-target-dots { flex-basis: 100%; text-align: center; font-size: 18px; color: #A56D00; }
.bond-board {
  width: min(650px, 100%);
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: clamp(8px, 2.5vw, 18px);
}
.bond-basket {
  flex: 1 1 0;
  min-width: 0;
  max-width: 210px;
  min-height: 145px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 9px;
  border-radius: 22px 22px 32px 32px;
  background: linear-gradient(#FFF8E2, #E8B968);
  box-shadow: inset 0 0 0 3px #C88735, 0 7px 0 #A96328;
}
.bond-owner { font-size: clamp(30px, 7vw, 48px); line-height: 1; }
.bond-nuts {
  min-height: 45px;
  text-align: center;
  font-size: clamp(20px, 4.7vw, 31px);
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.bond-number { font-size: clamp(36px, 8vw, 56px); color: var(--ink); }
.bond-controls { display: flex; gap: 8px; }
.bond-step {
  width: 46px;
  height: 42px;
  border: none;
  border-radius: 13px;
  font-family: inherit;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  background: var(--sky);
  box-shadow: 0 4px 0 var(--sky-d);
}
.bond-step:disabled { opacity: .38; box-shadow: none; }
.bond-step[hidden] { display: none; }
.bond-total { font-size: clamp(17px, 3.2vw, 23px); font-weight: 850; text-align: center; }
.bond-found { font-size: 15px; font-weight: 750; color: #347C43; text-align: center; }
.bond-found[hidden] { display: none; }
.bond-done { min-width: 150px; }

@media (prefers-reduced-motion: reduce) {
  .firefly-light { animation: none; transition: none; }
  #screen-map,
  .map-island,
  .map-play,
  .map-ship { animation: none; transition: none; }
  .map-island:active { transform: translate(-50%, -50%); }
  .map-play:active { transform: none; }
}

/* --- счёт: поле с предметами --- */

.count-field {
  position: relative;
  width: min(680px, 100%);
  flex: 1;
  max-height: 46vh;
  min-height: 160px;
  background: linear-gradient(180deg, #EAF9FF, #DFF7E8);
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 3px #ffffff;
}
.float-item {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: clamp(38px, 9vw, 68px); /* переопределяется из игры по количеству */
  cursor: pointer;
  animation: itemWobble 2.6s ease-in-out infinite;
  line-height: 1;
}
@keyframes itemWobble {
  0%,100% { margin-top: 0; }
  50%     { margin-top: -7px; }
}
.count-badge {
  position: absolute;
  top: -0.28em; right: -0.34em;
  background: var(--coral);
  color: #fff;
  border-radius: 50%;
  min-width: 1.55em; height: 1.55em;
  font-size: max(14px, 0.3em); /* масштабируется вместе с предметом */
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,.25);
  padding: 0 0.2em;
}

/* --- цифры: тарелки --- */

.digit-card {
  background: var(--paper);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  padding: 6px 34px 10px;
  font-size: clamp(60px, 11vw, 96px);
  font-weight: 800;
  color: var(--coral);
  line-height: 1.15;
  text-align: center;
}
.digit-hint { font-size: 18px; letter-spacing: 3px; color: var(--ink-soft); }

.plate-row { display: flex; gap: clamp(10px, 2.5vw, 22px); justify-content: center; flex-wrap: wrap; }
.plate {
  cursor: pointer;
  border: none;
  font-family: inherit;
  width: clamp(120px, 22vw, 190px);
  min-height: clamp(100px, 18vw, 150px);
  background: var(--paper);
  border-radius: 24px;
  box-shadow: 0 7px 0 #d8dcea;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  align-content: center;
  gap: 4px;
  padding: 12px;
  font-size: clamp(22px, 4vw, 32px);
  transition: transform .08s;
}
.plate:active { transform: translateY(4px); box-shadow: 0 2px 0 #d8dcea; }

/* --- сравнение --- */

.halves { display: flex; gap: clamp(12px, 3vw, 26px); width: 100%; justify-content: center; }
.half {
  cursor: pointer;
  border: none;
  font-family: inherit;
  position: relative;
  width: min(330px, 44%);
  min-height: clamp(150px, 30vh, 260px);
  border-radius: var(--r-md);
  background: var(--paper);
  box-shadow: 0 8px 0 #d8dcea;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 12px 26px;
  transition: transform .08s;
}
.half:active { transform: translateY(5px); box-shadow: 0 2px 0 #d8dcea; }
.half .cnt {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sun);
  color: #7A5A00;
  border-radius: 999px;
  padding: 3px 16px;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--sun-d);
  opacity: 0;
  transition: opacity .3s;
}
.half.revealed .cnt { opacity: 1; }

/* --- сортировка --- */

.sort-item {
  font-size: clamp(64px, 13vw, 110px);
  line-height: 1.15;
  animation: popIn .35s cubic-bezier(.2,1.6,.4,1) both;
}
.sort-item.small-size { font-size: clamp(34px, 7vw, 56px); }
.basket-row { display: flex; gap: clamp(14px, 4vw, 40px); justify-content: center; width: 100%; }
.basket {
  cursor: pointer;
  border: none;
  font-family: inherit;
  width: min(300px, 42%);
  border-radius: var(--r-md);
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--cream);
  box-shadow: 0 7px 0 #e3d5b3;
  transition: transform .08s;
}
.basket:active { transform: translateY(4px); box-shadow: 0 2px 0 #e3d5b3; }
.basket .b-icon { font-size: clamp(36px, 7vw, 54px); line-height: 1.1; }
.basket .b-label { font-size: clamp(15px, 2.6vw, 20px); font-weight: 800; }
.basket .b-got { min-height: 30px; font-size: 20px; letter-spacing: 2px; }
.bounce { animation: basketBounce .4s ease; }
.basket-row.three .basket { width: 31%; min-width: 96px; }
@keyframes basketBounce {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.08); }
}
.sort-progress { font-size: 15px; color: var(--ink-soft); font-weight: 800; }

/* --- фигуры --- */

.shape-grid {
  display: grid;
  gap: clamp(8px, 1.6vw, 16px);
  width: min(640px, 100%);
  max-width: 100%;
}
.shape-cell {
  cursor: pointer;
  border: none;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: 0 5px 0 #d8dcea;
  aspect-ratio: 1;
  min-width: 0;   /* не даём ячейкам распирать сетку на телефонах */
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10%;
  transition: transform .08s;
}
.shape-cell:active { transform: translateY(3px); box-shadow: 0 1px 0 #d8dcea; }
.shape-cell svg { width: 100%; height: 100%; overflow: visible; }
.shape-cell.found {
  background: #E8F9EC;
  box-shadow: inset 0 0 0 4px var(--grass);
  pointer-events: none;
}
.found-check {
  position: absolute;
  font-size: 26px;
  transform: translate(28px, -26px);
}

/* --- симметрия --- */

.sym-wrap { position: relative; display: flex; justify-content: center; }
.sym-grid {
  display: grid;
  gap: 5px;
  background: #ffffff;
  padding: 10px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  position: relative;
}
.sym-cell {
  width: clamp(30px, 6.2vw, 52px);
  height: clamp(30px, 6.2vw, 52px);
  border-radius: 9px;
  background: #EEF1F8;
  border: none;
  cursor: default;
  transition: background .15s, transform .15s;
}
.sym-cell.left { cursor: default; }
.sym-cell.right { cursor: pointer; }
.sym-cell.right:hover { background: #E2E8F6; }
.sym-cell.hint { box-shadow: inset 0 0 0 2px #c6cfe4; }
.sym-cell.filled { transform: scale(1.03); }
.sym-cell.flash-bad { animation: flashBad .4s ease; }
@keyframes flashBad {
  0%,100% { background: #EEF1F8; }
  50%     { background: #FFC2C2; }
}
.sym-mirror-line {
  position: absolute;
  top: 6px; bottom: 6px;
  width: 0;
  border-left: 4px dashed var(--coral);
  opacity: .75;
  pointer-events: none;
}

/* --- узоры --- */

.pattern-row {
  display: flex;
  gap: clamp(5px, 1.2vw, 12px);
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  background: var(--paper);
  padding: clamp(10px, 2vw, 18px) clamp(12px, 2.5vw, 24px);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  max-width: 100%;
}
.pat-tile {
  font-size: clamp(32px, 6.5vw, 48px);
  line-height: 1.2;
}
.pat-slot {
  width: clamp(44px, 8vw, 64px);
  height: clamp(44px, 8vw, 64px);
  border-radius: 14px;
  border: 3px dashed var(--coral);
  background: #FFF3F3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(26px, 5vw, 40px);
  color: var(--coral);
  font-weight: 800;
}
.pat-slot.solved { border-style: solid; border-color: var(--grass); background: #E8F9EC; }

/* --- память --- */

.mem-grid { display: grid; gap: clamp(8px, 1.6vw, 14px); }
.mem-card {
  width: clamp(56px, 13vw, 116px);
  height: clamp(72px, 16vw, 140px);
  perspective: 700px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
}
.mem-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .4s;
}
.mem-card.flipped .mem-inner { transform: rotateY(180deg); }
.mem-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mem-back {
  background: linear-gradient(135deg, var(--sky), var(--lilac));
  box-shadow: 0 5px 0 var(--sky-d);
  color: #fff;
  font-size: clamp(28px, 5vw, 44px);
}
.mem-front {
  background: var(--paper);
  box-shadow: 0 5px 0 #d8dcea;
  transform: rotateY(180deg);
  flex-wrap: wrap;
  align-content: center;
  gap: 2px;
  padding: 8px;
  font-size: clamp(17px, 3vw, 24px);
}
.mem-front .big-num { font-size: clamp(40px, 8vw, 64px); font-weight: 800; color: var(--sky); }
.mem-card.matched { pointer-events: none; }
.mem-card.matched .mem-front {
  background: #E8F9EC;
  box-shadow: 0 5px 0 var(--grass-d), 0 0 0 3px var(--grass) inset;
  animation: matchGlow .6s ease;
}
@keyframes matchGlow {
  0% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.1); }
  100% { transform: rotateY(180deg) scale(1); }
}

/* --- арифметика --- */

.eq-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 18px);
  flex-wrap: wrap;
  width: 100%;
}
.eq-group {
  background: var(--paper);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  padding: clamp(10px, 2vw, 18px);
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  align-content: center;
  max-width: 300px;
  min-width: 86px;
  min-height: 80px;
  font-size: clamp(28px, 6vw, 44px);
}
.eq-group.mystery {
  border: 3px dashed var(--coral);
  background: #FFF3F3;
  color: var(--coral);
  font-weight: 800;
  align-items: center;
}
.eq-sign { font-size: clamp(34px, 6vw, 54px); font-weight: 800; color: var(--ink); }
.eq-item.gone { opacity: .28; filter: grayscale(1); position: relative; }
.eq-item.gone::after {
  content: "✖";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--coral);
  font-size: .8em;
}
.eq-item { position: relative; transition: opacity .5s, transform .5s; }
.eq-item.flyaway { transform: translateY(-70px) rotate(30deg); opacity: 0; }

/* --- точки по порядку --- */

.dots-svg {
  width: min(520px, 92%);
  max-height: 52vh;
  aspect-ratio: 1;
  background: var(--paper);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
}
.dot-circle { cursor: pointer; }
.dot-circle circle {
  fill: #fff;
  stroke: var(--sky);
  stroke-width: 2;
  transition: fill .15s;
}
.dot-circle text {
  font-family: var(--font);
  font-weight: 800;
  font-size: 7px;
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.dot-circle.done circle { fill: var(--grass); stroke: var(--grass-d); }
.dot-circle.done text { fill: #fff; }
.dot-circle.next circle { animation: dotPulse 1s infinite; }
@keyframes dotPulse {
  0%,100% { stroke-width: 2; r: 5.5; }
  50%     { stroke-width: 3.5; r: 6.5; }
}

/* --- пропущенное число --- */

.numline {
  display: flex;
  gap: clamp(6px, 1.5vw, 14px);
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.numline .nl-bubble {
  width: clamp(56px, 10vw, 84px);
  height: clamp(56px, 10vw, 84px);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 5px 0 #d8dcea;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(26px, 5vw, 40px);
  font-weight: 800;
  color: var(--ink);
}
.nl-bubble.gap {
  border: 3px dashed var(--coral);
  background: #FFF3F3;
  color: var(--coral);
}
.nl-bubble.gap.solved { border-style: solid; border-color: var(--grass); background: #E8F9EC; color: var(--grass-d); }
.nl-arrow { font-size: 22px; color: var(--ink-soft); }

/* ============================================================
   РЕЗУЛЬТАТЫ
   ============================================================ */

.results-overlay {
  position: absolute;
  inset: 0;
  background: rgba(40, 50, 80, .45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  animation: screenIn .3s ease both;
  padding: 16px;
}
.results-card {
  background: var(--paper);
  border-radius: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  padding: 26px 30px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 440px;
  width: 100%;
  text-align: center;
}
.results-fox { font-size: 62px; line-height: 1; animation: foxBounce 2s ease-in-out infinite; }
.results-title { font-size: 30px; font-weight: 800; }
.results-msg { font-size: 17px; color: var(--ink-soft); margin-top: -6px; }
.star-row { display: flex; gap: 10px; font-size: 58px; line-height: 1; min-height: 64px; }
.star-slot { filter: grayscale(1) opacity(.3); }
.star-slot.earned {
  filter: none;
  animation: starPop .5s cubic-bezier(.2, 1.8, .4, 1) both;
}
@keyframes starPop {
  from { transform: scale(0) rotate(-120deg); }
  to   { transform: scale(1) rotate(0); }
}
.unlock-note {
  background: #E8F9EC;
  color: var(--grass-d);
  font-weight: 800;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 15px;
}
.island-growth-note {
  margin: 2px 0 14px;
  padding: 9px 14px;
  border-radius: 14px;
  color: #2F6D3A;
  background: #E7F8D8;
  box-shadow: inset 0 0 0 2px #A8D98B;
  font-weight: 800;
  text-align: center;
}
.results-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

/* ============================================================
   РОДИТЕЛЬСКИЙ РАЗДЕЛ
   ============================================================ */

.parents-overlay {
  position: absolute;
  inset: 0;
  background: rgba(40, 50, 80, .5);
  backdrop-filter: blur(3px);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: screenIn .25s ease both;
}
.parents-card {
  background: var(--paper);
  border-radius: 26px;
  padding: 22px;
  width: min(640px, 100%);
  max-height: 88%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.parents-card h2 { font-size: 24px; }
.parents-card p { font-size: 14px; color: var(--ink-soft); line-height: 1.45; }

.parents-sub { margin: 18px 0 8px; font-size: 17px; }

.voice-help { margin-top: -4px; }
.voice-settings {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px;
  border: 2px solid #DED4F4;
  border-radius: 16px;
  background: #F8F4FF;
}
.voice-label { font-size: 13px; font-weight: 800; }
.voice-controls { display: flex; align-items: stretch; gap: 9px; flex-wrap: wrap; }
.voice-select {
  flex: 1 1 260px;
  min-width: 0;
  min-height: 44px;
  border: 2px solid #C9B9EA;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 8px 34px 8px 11px;
  font: inherit;
  font-size: 14px;
}
.voice-select:focus-visible { outline: 3px solid #8CB7FF; outline-offset: 2px; }
.voice-select:disabled { opacity: .6; }
.voice-preview { flex: 0 0 auto; }
.voice-status { min-height: 1.35em; color: var(--ink-soft); font-size: 12px; line-height: 1.35; }

.skills-help { margin-top: -4px; }

.skills-box { display: flex; flex-direction: column; gap: 10px; }

.skill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name note"
    "bar score"
    "meta meta";
  align-items: center;
  column-gap: 10px;
  row-gap: 5px;
  padding: 3px 0;
  font-size: 13px;
}
.skill-row.untouched { opacity: .55; }

.skill-name {
  grid-area: name;
  min-width: 0;
  font-weight: 750;
}

.skill-bar {
  grid-area: bar;
  width: 100%;
  min-width: 0;
  height: 9px;
  border-radius: 5px;
  background: #00000012;
  overflow: hidden;
}
.skill-fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #FFB703, #6BCB77);
  transition: width .4s ease;
}
.skill-note {
  grid-area: note;
  text-align: right;
  opacity: .78;
  white-space: nowrap;
}
.skill-score {
  grid-area: score;
  min-width: 3ch;
  text-align: right;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.skill-meta {
  grid-area: meta;
  text-align: right;
  font-size: 11px;
  opacity: .65;
}

.parents-week { margin-top: 12px; font-size: 14px; }

.progress-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.progress-table th, .progress-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #EEF1F8;
  text-align: left;
}
.progress-table th { color: var(--ink-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.parents-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}
.parents-actions > .btn { width: 100%; min-width: 0; }
.btn.small { font-size: 16px; padding: 10px 18px; }
.btn.danger { background: #98A2C0; box-shadow: 0 5px 0 #7c86a3; }
.btn.danger.armed { background: var(--coral); box-shadow: 0 5px 0 var(--coral-d); }

/* ============================================================
   КОНФЕТТИ
   ============================================================ */

.confetti-bit {
  position: fixed;
  width: 12px; height: 12px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 90;
  animation: confettiFly .9s ease-out both;
}
@keyframes confettiFly {
  from { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
  to   { transform: translate(var(--cx), var(--cy)) rotate(var(--cr)) scale(.4); opacity: 0; }
}

/* ============================================================
   Перетаскивание и новые игры
   ============================================================ */

.draggable { touch-action: none; cursor: grab; }
.dragging {
  z-index: 80;
  position: relative;
  animation: none !important;   /* иначе pop-in и т.п. перекрывают transform */
  transition: none !important;
  filter: drop-shadow(0 10px 14px rgba(53, 64, 90, .35));
}
.drag-return { transition: transform .3s cubic-bezier(.2, 1.2, .4, 1); }

/* пока тащим — подсвечиваем, куда можно бросить */
body.fx-dragging .drop-zone {
  outline: 3px dashed #4D96FF;
  outline-offset: 4px;
  animation: dropPulse 1s ease-in-out infinite;
}
@keyframes dropPulse {
  0%, 100% { outline-color: rgba(77, 150, 255, .35); }
  50%      { outline-color: rgba(77, 150, 255, .95); }
}

/* что лишнее */
.odd-row .num-btn.huge {
  width: clamp(84px, 21vw, 130px);
  height: clamp(84px, 21vw, 130px);
  font-size: clamp(46px, 12vw, 76px);
  border-radius: 30px;
}

/* найди тень */
.shadow-target {
  font-size: clamp(64px, 17vw, 110px);
  line-height: 1.1;
  filter: drop-shadow(0 8px 10px rgba(53, 64, 90, .25));
}
.shadow-row { display: flex; gap: clamp(10px, 2.5vw, 20px); flex-wrap: wrap; justify-content: center; }
.shadow-card {
  width: clamp(84px, 20vw, 130px);
  height: clamp(84px, 20vw, 130px);
  background: var(--paper);
  border: none;
  border-radius: 20px;
  box-shadow: 0 5px 0 #d8dcea;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shadow-sil {
  font-size: clamp(48px, 12vw, 80px);
  line-height: 1.1;
  filter: brightness(0);
  opacity: .72;
  transition: filter .3s, opacity .3s;
}
.shadow-card.sfound {
  background: #E8F9EC;
  box-shadow: 0 5px 0 var(--grass-d), inset 0 0 0 4px var(--grass);
}

/* накорми зверят */
.feed-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  padding: 12px 22px 10px;
  max-width: 94%;
}
.feed-animal { font-size: clamp(64px, 16vw, 104px); line-height: 1.1; }
.feed-plate {
  min-height: 46px;
  min-width: min(300px, 72vw);
  max-width: 100%;
  border: 3px dashed #c9d2e3;
  border-radius: 16px;
  background: #F7FAFF;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  font-size: clamp(22px, 5vw, 34px);
}
.feed-count { font-weight: 800; color: var(--ink-soft); font-size: 15px; }
.feed-pool {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 2vw, 16px);
  justify-content: center;
  max-width: 660px;
}
.feed-item { line-height: 1.1; }

/* заплатки */
.puzzle-board {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(10px, 2.5vw, 20px);
  justify-content: center;
  background: var(--cream);
  padding: clamp(10px, 2.5vw, 18px);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  max-width: 96%;
}
.hole {
  width: clamp(72px, 18vw, 112px);
  aspect-ratio: 1;
  background: #fff;
  border: 3px dashed #c9d2e3;
  border-radius: 18px;
  padding: 8%;
}
.hole svg { width: 100%; height: 100%; }
.hole.filled { border-style: solid; border-color: var(--grass); background: #F3FCF5; }
.puzzle-tray { display: flex; flex-wrap: wrap; gap: clamp(10px, 2.5vw, 20px); justify-content: center; }
.piece { width: clamp(64px, 16vw, 100px); aspect-ratio: 1; padding: 4%; }
.piece svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 5px rgba(53, 64, 90, .25)); }

/* по росту */
.slot-row {
  display: flex;
  align-items: flex-end;
  gap: clamp(8px, 2vw, 16px);
  justify-content: center;
  flex-wrap: wrap;
}
.size-slot {
  border: 3px dashed #c9d2e3;
  border-radius: 16px;
  background: #ffffffcc;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.size-slot.filled { border-style: solid; border-color: var(--grass); background: #F3FCF5; }
.size-tray {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3vw, 24px);
  justify-content: center;
  flex-wrap: wrap;
  min-height: 60px;
}
.size-piece { line-height: 1; }

/* по домикам */
.house-row { display: flex; gap: clamp(12px, 3vw, 28px); justify-content: center; width: 100%; }
.house {
  position: relative;
  width: min(240px, 42%);
  background: var(--cream);
  border-radius: 18px;
  padding: 8px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 6px 0 #e3d5b3;
}
.house-row.three .house { width: 31%; min-width: 96px; }
.h-roof { font-size: clamp(30px, 6vw, 44px); line-height: 1; }
.h-icon { font-size: clamp(24px, 5vw, 36px); line-height: 1.1; }
.house .b-got { min-height: 26px; font-size: 17px; }
.house-item-zone {
  min-height: clamp(64px, 14vw, 100px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.house-item { font-size: clamp(56px, 13vw, 92px); line-height: 1.1; }

/* три карточки в сравнении */
.halves.three .half {
  width: min(240px, 31%);
  min-height: clamp(130px, 24vh, 220px);
  padding: 12px 8px 24px;
}

/* плотная сетка памяти (8 пар) */
.mem-grid.dense .mem-card { width: clamp(48px, 11vw, 96px); height: clamp(62px, 14vw, 118px); }

/* горизонтальное зеркало */
.sym-mirror-line.h {
  top: 50%;
  left: 6px;
  right: 6px;
  bottom: auto;
  width: auto;
  height: 0;
  border-left: none;
  border-top: 4px dashed var(--coral);
}

/* ============================================================
   Вход и профиль
   ============================================================ */

#screen-login { align-items: center; justify-content: center; gap: 8px; overflow: hidden; }

.login-card {
  background: var(--paper);
  border-radius: 26px;
  box-shadow: var(--shadow-card);
  padding: 20px 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(400px, 94%);
  z-index: 1;
}
.g-btn-wrap { min-height: 0; display: flex; justify-content: center; width: 100%; }
.g-btn-wrap:not(:empty) { min-height: 44px; }
.login-note { font-size: 13px; color: var(--ink-soft); text-align: center; }
.login-note:empty { display: none; }
.login-current {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--cream);
  text-align: center;
  line-height: 1.35;
}
.login-current strong { font-size: 14px; }
.login-current span { color: var(--ink-soft); font-size: 12px; }
.login-divider {
  color: var(--ink-soft);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.login-divider::before, .login-divider::after {
  content: "";
  flex: 1;
  height: 2px;
  background: #EEF1F8;
  border-radius: 2px;
}
.login-hint { font-size: 12px; color: var(--ink-soft); text-align: center; line-height: 1.45; }
.btn.login-back {
  width: 100%;
  background: #F1ECFA;
  box-shadow: 0 5px 0 #D5C8EC;
  color: var(--ink);
}
.btn.login-back:active { box-shadow: 0 1px 0 #D5C8EC; }

/* кнопка «Войти через Google» (Firebase-путь) */
.btn.google {
  background: #fff;
  color: #3c4043;
  box-shadow: 0 5px 0 #d5d9e0, inset 0 0 0 2px #dadce0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn.google:active { box-shadow: 0 1px 0 #d5d9e0, inset 0 0 0 2px #dadce0; }
.btn.google .gmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 2px #e8eaed;
  color: #4285F4;
  font-weight: 800;
  font-size: 19px;
}

/* кнопка «Войти с Яндекс ID» */
.btn.yandex {
  background: #000;
  color: #fff;
  box-shadow: 0 5px 0 #3a3a3a;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn.yandex:active { box-shadow: 0 1px 0 #3a3a3a; }
.btn.yandex .ymark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #FC3F1D;
  color: #fff;
  font-weight: 800;
  font-size: 17px;
}

.profile-chip {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffffd9;
  border-radius: 999px;
  padding: 6px 14px 6px 8px;
  box-shadow: 0 3px 8px rgba(53, 64, 90, .18);
  z-index: 2;
  font-weight: 800;
  font-size: 14px;
  max-width: 46vw;
  border: 0;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.profile-chip:hover { box-shadow: 0 5px 12px rgba(53, 64, 90, .24); }
.profile-chip:active { transform: translateY(2px); box-shadow: 0 2px 5px rgba(53, 64, 90, .18); }
.profile-chip:focus-visible { outline: 3px solid #6A9BF7; outline-offset: 3px; }
.profile-chip img { width: 30px; height: 30px; border-radius: 50%; }
.profile-chip .pc-emoji { font-size: 22px; line-height: 1; }
.profile-chip .pc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.install-hint {
  font-size: 12.5px;
  color: var(--ink-soft);
  background: #ffffffcc;
  border-radius: 999px;
  padding: 6px 14px;
  z-index: 1;
  text-align: center;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cream);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
  flex-wrap: wrap;
}
.account-row img { width: 34px; height: 34px; border-radius: 50%; }
.account-row > span:not(.pc-emoji) { flex: 1; min-width: 140px; }

.account-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 2px solid #F1DFAE;
  border-radius: 18px;
  background: var(--cream);
}
.account-identity {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.account-avatar {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  font-size: 23px;
  overflow: hidden;
}
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.account-name { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.account-meta { color: var(--ink-soft); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.account-switch { width: 100%; }

/* ============================================================
   Mobile-first: PWA и телефоны
   ============================================================ */

html, body { overscroll-behavior: none; }
body { -webkit-touch-callout: none; }

/* Установленная PWA запрашивает portrait через manifest. Браузер может
   не применить это ограничение, поэтому в телефонном landscape не
   показываем сломанную игровую раскладку. */
.orientation-lock { display: none; }

@media (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  #app {
    visibility: hidden;
    pointer-events: none;
  }

  .orientation-lock {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: max(24px, env(safe-area-inset-top))
             max(28px, env(safe-area-inset-right))
             max(24px, env(safe-area-inset-bottom))
             max(28px, env(safe-area-inset-left));
    text-align: center;
    color: var(--ink);
    background: linear-gradient(180deg, #8ED6FF 0%, #C9F0FF 55%, #A8E6CF 100%);
  }

  .orientation-lock-icon {
    font-size: clamp(52px, 14vh, 88px);
    line-height: 1;
  }

  .orientation-lock strong { font-size: clamp(22px, 6vh, 34px); }
  .orientation-lock span:last-child { font-size: clamp(15px, 4vh, 20px); }
}

/* стабильная высота на мобильных (адресная строка браузера) */
@supports (height: 100dvh) {
  html, body { height: 100dvh; }
}

@media (max-width: 480px) {
  .btn-icon { width: 46px; height: 46px; min-width: 46px; font-size: 22px; }
  .topbar .title { font-size: 16px; }
  .star-chip { font-size: 15px; padding: 7px 11px; }
  .screen { padding-left: 10px; padding-right: 10px; }
  .stage { border-radius: 20px; }
  .profile-chip { font-size: 13px; }
  .voice-preview { flex: 1 1 100%; }
  .parents-card { padding: 18px 16px; }
  .parents-actions { grid-template-columns: 1fr; }
}

/* ============================================================
   Адаптив
   ============================================================ */

@media (max-width: 620px) {
  .half { min-height: 140px; }
  .activity-card { padding: 14px 14px 12px; }
  .level-btn { width: 78px; }
  .fox-face { font-size: 38px; }
  .bubble { font-size: 16px; padding: 8px 12px; }
  .btn.big { font-size: 24px; padding: 14px 34px; }
}

@media (max-height: 480px) {
  .fox-bar { min-height: 48px; }
  .fox-face { font-size: 34px; }
  .home-fox { font-size: 72px; }
  .count-field { max-height: 38vh; }
}
