/* ==========================================================================
   styles.css — Tactile, Kid-Friendly iPhone-First UI for "Остров Слов"
   ========================================================================== */

:root {
  --bg: #FFF4FA;
  --bg-accent: #FFE3F1;
  --card: #FFFFFF;
  --text: #322342;
  --text-soft: #7A678E;

  --vowel: #FF4D6D;
  --vowel-dark: #D93253;
  --vowel-bg: #FFF0F3;

  --consonant: #2380FF;
  --consonant-dark: #155CC2;
  --consonant-bg: #EEF5FF;

  --orange: #FF8A3D;
  --orange-dark: #D96518;
  --green: #38C976;
  --green-dark: #229B56;
  --blue: #3B9BFF;
  --blue-dark: #1C73D1;
  --purple: #9B6BFF;
  --purple-dark: #7444D9;
  --pink: #FF6B9D;
  --pink-dark: #D64576;
  --teal: #22C3B8;
  --teal-dark: #15948B;
  --yellow: #FFD23F;
  --yellow-dark: #D9A60B;

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow-soft: 0 10px 28px rgba(43, 35, 56, 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  outline: none;
}

.hidden {
  display: none !important;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* ---------- App Shell & Screens ---------- */

.app-shell {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 100dvh;
  margin: 0 auto;
  background: radial-gradient(circle at top right, #FFE6F5 0%, #FFF4FA 48%, #F6EEFF 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding-top: calc(10px + var(--safe-top));
  padding-bottom: calc(12px + var(--safe-bottom));
  padding-left: 16px;
  padding-right: 16px;
  overflow: hidden;
}

.screen--active {
  display: flex;
  animation: fadeIn 0.25s ease-out;
}

/* ---------- 3D Tactile Buttons ---------- */

.btn-3d {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 24px;
  border-radius: 22px;
  font-size: 20px;
  font-weight: 900;
  color: #FFFFFF;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-3d:active {
  transform: translateY(4px);
}

.btn-3d--orange {
  background: linear-gradient(180deg, #FF9B54 0%, var(--orange) 100%);
  box-shadow: 0 6px 0 var(--orange-dark), 0 12px 22px rgba(255, 138, 61, 0.35);
}
.btn-3d--orange:active { box-shadow: 0 2px 0 var(--orange-dark); }

.btn-3d--green {
  background: linear-gradient(180deg, #4AD987 0%, var(--green) 100%);
  box-shadow: 0 6px 0 var(--green-dark), 0 10px 20px rgba(56, 201, 118, 0.3);
}
.btn-3d--green:active { box-shadow: 0 2px 0 var(--green-dark); }

.btn-3d--blue {
  background: linear-gradient(180deg, #5BB0FF 0%, var(--blue) 100%);
  box-shadow: 0 6px 0 var(--blue-dark), 0 10px 20px rgba(59, 155, 255, 0.28);
}
.btn-3d--blue:active { box-shadow: 0 2px 0 var(--blue-dark); }

.btn-3d--pink {
  background: linear-gradient(180deg, #FF82AD 0%, var(--pink) 100%);
  box-shadow: 0 6px 0 var(--pink-dark);
}
.btn-3d--pink:active { box-shadow: 0 2px 0 var(--pink-dark); }

.btn-3d--soft {
  background: #FFFFFF;
  color: var(--text);
  box-shadow: 0 5px 0 #E3D8C8, var(--shadow-soft);
}
.btn-3d--soft:active { box-shadow: 0 1px 0 #E3D8C8; }

.btn-wide { width: 100%; }
.btn-sm { padding: 10px 16px; font-size: 16px; border-radius: 16px; }

.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.1s ease;
}
.icon-btn:active { transform: translateY(3px); }

.icon-btn--soft {
  background: #FFFFFF;
  box-shadow: 0 4px 0 #E3D8C8;
}
.icon-btn--blue {
  background: var(--blue);
  color: #FFFFFF;
  box-shadow: 0 4px 0 var(--blue-dark);
}
.icon-btn--mint {
  background: #2FD4B4;
  box-shadow: 0 4px 0 #1B9E85;
}
.icon-btn--pink {
  background: var(--pink);
  color: #FFFFFF;
  box-shadow: 0 4px 0 var(--pink-dark);
}
.icon-btn--purple {
  background: var(--purple);
  color: #FFFFFF;
  box-shadow: 0 4px 0 var(--purple-dark);
}
.icon-btn--gold {
  background: linear-gradient(180deg, #FFE066 0%, #FFD23F 100%);
  color: #322342;
  box-shadow: 0 4px 0 var(--yellow-dark);
}

.btn-repeat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #5BB0FF 0%, var(--blue) 100%);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 4px 0 var(--blue-dark);
  flex-shrink: 0;
  transition: transform 0.1s ease;
}
.btn-repeat-pill:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--blue-dark);
}

/* ---------- Welcome Screen ---------- */

#screen-welcome {
  justify-content: center;
  align-items: center;
}

.welcome-card {
  width: 100%;
  background: var(--card);
  border-radius: 34px;
  padding: 32px 24px 28px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(255, 138, 61, 0.16);
  border: 3px solid #FFE8CC;
}

.welcome-clouds {
  font-size: 28px;
  letter-spacing: 12px;
  margin-bottom: 6px;
}

.mascot-hero {
  font-size: 104px;
  line-height: 1.05;
  margin: 4px 0 8px;
  display: inline-block;
  animation: floatSlow 2.6s ease-in-out infinite;
}

.welcome-title {
  margin: 0;
  font-size: 34px;
  font-weight: 900;
  color: var(--pink-dark);
  letter-spacing: -0.5px;
}

.welcome-subtitle {
  margin: 8px 0 26px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-soft);
}

.btn-start-huge {
  width: 100%;
  padding: 20px 28px;
  font-size: 26px;
  border-radius: 26px;
}

.welcome-tip {
  margin: 20px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-soft);
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0 10px;
  flex-shrink: 0;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.screen-title {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 900;
  background: #FFFFFF;
  box-shadow: 0 4px 0 #E3D8C8;
}

.stat-pill--stars { color: #C98600; }
.stat-pill--stickers { color: var(--purple-dark); }

/* ---------- Map Screen ---------- */

.map-hero-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FFFFFF;
  border-radius: 22px;
  padding: 10px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
  border: 2px solid #FFE5C7;
  flex-shrink: 0;
}

.fox-avatar-sm {
  font-size: 38px;
  line-height: 1;
}

.speech-bubble-sm {
  flex: 1;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
}

.speak-mini-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: #EAF4FF;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stage-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: var(--shadow-soft);
  border: 2px solid rgba(0, 0, 0, 0.04);
}

.stage-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 18px;
  color: #FFFFFF;
}

.stage-header--coral  { background: linear-gradient(135deg, #FF6B8B, #FF4D6D); }
.stage-header--blue   { background: linear-gradient(135deg, #4EA8FF, #2380FF); }
.stage-header--green  { background: linear-gradient(135deg, #4CD986, #26B563); }
.stage-header--purple { background: linear-gradient(135deg, #AD7EFF, #834CEB); }
.stage-header--orange { background: linear-gradient(135deg, #FFA347, #FF7A26); }
.stage-header--teal   { background: linear-gradient(135deg, #32D4C8, #19A89E); }
.stage-header--pink   { background: linear-gradient(135deg, #FF7BA9, #F04884); }

.stage-emoji { font-size: 32px; }
.stage-title { margin: 0; font-size: 19px; font-weight: 900; }
.stage-subtitle { font-size: 13px; font-weight: 700; opacity: 0.92; }

.levels-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.level-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 8px 12px;
  border-radius: 22px;
  background: #FFF9F0;
  border: 2px solid #F3E5D0;
  box-shadow: 0 5px 0 #E7D6BE;
  text-align: center;
  transition: transform 0.12s ease;
}

.level-node:active:not(.level-node--locked) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #E7D6BE;
}

.level-node--current {
  background: #FFF2D6;
  border-color: var(--orange);
  box-shadow: 0 5px 0 var(--orange-dark), 0 0 0 4px rgba(255, 138, 61, 0.2);
  animation: pulseRing 2s infinite;
}

.level-node--done {
  background: #EFFCF4;
  border-color: var(--green);
  box-shadow: 0 5px 0 var(--green-dark);
}

.level-node--locked {
  opacity: 0.52;
  filter: grayscale(0.6);
  cursor: not-allowed;
}

.level-num-badge {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 11px;
  font-weight: 900;
  color: var(--text-soft);
}

.level-icon {
  font-size: 36px;
  line-height: 1.1;
}

.level-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
}

.level-stars {
  font-size: 13px;
  letter-spacing: 1px;
}

/* ---------- Game Screen ---------- */

.game-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 10px;
  flex-shrink: 0;
}

.progress-track {
  flex: 1;
  height: 18px;
  background: #EFE4D4;
  border-radius: 999px;
  overflow: hidden;
  padding: 3px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4CD986, #2CC96E);
  transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-mascot-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.fox-avatar-game {
  width: 56px;
  height: 56px;
  border-radius: 20px;
  background: #FFEBD2;
  box-shadow: 0 4px 0 #E8C79E;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fox-avatar-game:active { transform: translateY(2px); }

.game-prompt-bubble {
  flex: 1;
  background: #FFFFFF;
  border-radius: 20px;
  padding: 12px 15px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  box-shadow: var(--shadow-soft);
  border: 2px solid #F2E6D5;
  line-height: 1.25;
}

.game-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  overflow-y: auto;
  padding-bottom: 8px;
}

/* Letter color coding */
.char-vowel { color: var(--vowel); }
.char-consonant { color: var(--consonant); }

/* ---------- Game 1: Intro Letters ---------- */

.intro-card {
  width: 100%;
  background: #FFFFFF;
  border-radius: 32px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  border: 3px solid #FFE3EA;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.intro-big-letter {
  font-size: 112px;
  font-weight: 900;
  line-height: 1;
  padding: 8px 28px;
  border-radius: 28px;
  background: var(--vowel-bg);
  color: var(--vowel);
  box-shadow: 0 6px 0 #FFD0DC;
}
.intro-big-letter:active { transform: scale(0.95); }

.intro-emoji { font-size: 72px; line-height: 1.1; }
.intro-word { font-size: 30px; font-weight: 900; letter-spacing: 2px; }

.intro-dots {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.intro-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #E5D9C8;
}
.intro-dot--active { background: var(--orange); transform: scale(1.2); }

/* Quiz options */
.choice-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.choice-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.tile-btn {
  min-height: 88px;
  border-radius: 24px;
  background: #FFFFFF;
  border: 3px solid #EFE4D4;
  box-shadow: 0 6px 0 #DDD0BE, var(--shadow-soft);
  font-size: 40px;
  font-weight: 900;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, background 0.15s ease;
}
.tile-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #DDD0BE; }

.tile-btn--vowel {
  color: var(--vowel);
  border-color: #FFD1DC;
  background: var(--vowel-bg);
  box-shadow: 0 6px 0 #F2B5C4;
}

.tile-btn--syllable {
  font-size: 32px;
  min-height: 82px;
  background: #F4F9FF;
  border-color: #CBE3FF;
  box-shadow: 0 6px 0 #A8CEFA;
}

.tile-btn--used {
  opacity: 0.25;
  pointer-events: none;
  transform: scale(0.92);
}

.audio-center-btn {
  width: 112px;
  height: 112px;
  border-radius: 34px;
  background: linear-gradient(180deg, #5BB0FF 0%, var(--blue) 100%);
  box-shadow: 0 8px 0 var(--blue-dark), 0 14px 28px rgba(59, 155, 255, 0.35);
  font-size: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
}
.audio-center-btn:active { transform: translateY(5px); box-shadow: 0 3px 0 var(--blue-dark); }

/* ---------- Game 2: Bubbles ---------- */

.bubbles-arena {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 8px 4px;
}

.bubble-btn {
  aspect-ratio: 1 / 1;
  max-height: 144px;
  width: 100%;
  border-radius: 50%;
  font-size: 40px;
  font-weight: 900;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset -8px -10px 18px rgba(0, 0, 0, 0.14), inset 8px 8px 16px rgba(255, 255, 255, 0.45), 0 10px 20px rgba(0, 0, 0, 0.1);
  animation: bubbleFloat 3s ease-in-out infinite;
}

.bubble-btn:nth-child(2) { animation-delay: 0.5s; }
.bubble-btn:nth-child(3) { animation-delay: 1.0s; }
.bubble-btn:nth-child(4) { animation-delay: 1.5s; }

.bubble-btn--0 { background: radial-gradient(circle at 30% 30%, #FF9EB5, #FF4D6D); }
.bubble-btn--1 { background: radial-gradient(circle at 30% 30%, #7CC4FF, #2380FF); }
.bubble-btn--2 { background: radial-gradient(circle at 30% 30%, #7CE8A8, #2CC96E); }
.bubble-btn--3 { background: radial-gradient(circle at 30% 30%, #C59EFF, #8A52F5); }

.bubble-btn:active { transform: scale(0.92); }

/* ---------- Game 3: Syllable Train ---------- */

.train-stage {
  width: 100%;
  background: #FFFFFF;
  border-radius: 30px;
  padding: 24px 16px;
  box-shadow: var(--shadow-soft);
  border: 3px solid #DCEEFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.train-track {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-height: 112px;
  position: relative;
  transition: gap 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.train-track--merged {
  gap: 0px;
}

.train-car {
  width: 96px;
  height: 96px;
  border-radius: 26px;
  font-size: 54px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  transition: transform 0.35s ease, border-radius 0.35s ease;
}

.train-car--c {
  background: var(--consonant);
  box-shadow: 0 7px 0 var(--consonant-dark);
}
.train-car--v {
  background: var(--vowel);
  box-shadow: 0 7px 0 var(--vowel-dark);
}

.train-track--merged .train-car--c {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}
.train-track--merged .train-car--v {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

.train-plus {
  font-size: 32px;
  font-weight: 900;
  color: var(--orange);
  transition: opacity 0.25s ease, width 0.25s ease;
}

.train-track--merged .train-plus {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.train-result-pill {
  font-size: 36px;
  font-weight: 900;
  color: var(--green-dark);
  background: #EAFDF2;
  padding: 6px 24px;
  border-radius: 999px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Game 4: Build Syllables / Missing Letter ---------- */

.word-picture-hero {
  font-size: 84px;
  line-height: 1.05;
  background: #FFFFFF;
  width: 130px;
  height: 130px;
  border-radius: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
  border: 3px solid #FFE8CC;
}

.slots-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.word-slot {
  min-width: 74px;
  height: 74px;
  padding: 0 14px;
  border-radius: 20px;
  background: #FFFDF9;
  border: 3px dashed #D7C5AC;
  font-size: 34px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.word-slot--filled {
  border-style: solid;
  border-color: var(--green);
  background: #EEFCF4;
  color: var(--green-dark);
  animation: popIn 0.25s ease;
}

.word-slot--static {
  border-style: solid;
  border-color: #E7DAC8;
  background: #FFFFFF;
}

.word-slot--missing {
  border-color: var(--orange);
  background: #FFF5E6;
  color: var(--orange);
}

/* ---------- Game 5: Read & Match ---------- */

.read-word-box {
  width: 100%;
  background: #FFFFFF;
  border-radius: 28px;
  padding: 20px 14px;
  box-shadow: var(--shadow-soft);
  border: 3px solid #FFE3C2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.syllable-chip {
  padding: 10px 16px;
  border-radius: 18px;
  background: #FFF6EA;
  border: 2px solid #F7DFC0;
  box-shadow: 0 4px 0 #E8CEAD;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--text);
}
.syllable-chip:active {
  transform: translateY(2px);
  background: #FFE8CC;
}

.syllable-chip--phrase {
  font-size: 26px;
  padding: 8px 13px;
}

.syllable-dash {
  font-size: 26px;
  font-weight: 900;
  color: #C9B79F;
}

.read-hint-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
}

.picture-choices {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.picture-choice-btn {
  min-height: 112px;
  border-radius: 26px;
  background: #FFFFFF;
  border: 3px solid #EFE4D4;
  box-shadow: 0 6px 0 #DDD0BE, var(--shadow-soft);
  font-size: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}
.picture-choice-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #DDD0BE; }
.picture-choice-btn--phrase { font-size: 38px; }

/* ---------- Game 6: True or False ---------- */

.tf-card {
  width: 100%;
  background: #FFFFFF;
  border-radius: 30px;
  padding: 22px 16px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  border: 3px solid #E5DBFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.tf-emoji { font-size: 62px; }

.tf-sentence {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.tf-word-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.tf-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.tf-btn {
  min-height: 86px;
  font-size: 24px;
  border-radius: 24px;
}

/* ---------- Game 7: Story ---------- */

.story-book-card {
  width: 100%;
  background: #FFFFFF;
  border-radius: 30px;
  padding: 20px 18px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  border: 3px solid #FFE2B8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.story-scene {
  font-size: 58px;
  letter-spacing: 6px;
}

.story-text {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.45;
  color: var(--text);
}

.story-blank {
  display: inline-block;
  min-width: 100px;
  padding: 2px 12px;
  border-radius: 14px;
  background: #FFF3D9;
  border: 3px dashed var(--orange);
  color: var(--orange-dark);
}

.story-options {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.story-opt-btn {
  width: 100%;
  padding: 14px 18px;
  border-radius: 22px;
  background: #FFFFFF;
  border: 3px solid #EFE4D4;
  box-shadow: 0 5px 0 #DDD0BE;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
}
.story-opt-btn:active { transform: translateY(3px); }

/* ---------- Victory Screen ---------- */

#screen-victory {
  justify-content: center;
  align-items: center;
}

.victory-card {
  width: 100%;
  background: #FFFFFF;
  border-radius: 34px;
  padding: 28px 22px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(56, 201, 118, 0.18);
  border: 3px solid #D9F7E6;
}

.victory-fox { font-size: 72px; margin-bottom: 4px; }
.victory-title { margin: 0; font-size: 30px; font-weight: 900; color: var(--green-dark); }
.victory-stars { font-size: 46px; margin: 10px 0 16px; letter-spacing: 6px; }

.victory-sticker-box {
  background: linear-gradient(135deg, #FFF7DF, #FFE9F2);
  border: 3px solid #FFD23F;
  border-radius: 24px;
  padding: 14px;
  margin-bottom: 20px;
  animation: popIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sticker-badge-label {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--orange-dark);
  letter-spacing: 0.6px;
}

.victory-sticker-emoji { font-size: 64px; margin: 4px 0; }
.victory-sticker-name { font-size: 20px; font-weight: 900; }

.victory-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.victory-secondary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ---------- Sticker Album ---------- */

.album-hint {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-soft);
  text-align: center;
}

.stickers-grid {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-bottom: 24px;
  align-content: start;
}

.sticker-cell {
  background: #FFFFFF;
  border-radius: 22px;
  padding: 14px 8px;
  text-align: center;
  box-shadow: 0 5px 0 #E7DAC8;
  border: 2px solid #F2E6D5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.sticker-cell--unlocked {
  background: linear-gradient(180deg, #FFFFFF, #FFF9EB);
  border-color: #FFD966;
  box-shadow: 0 5px 0 #E8BE43;
}
.sticker-cell--unlocked:active { transform: translateY(3px); }

.sticker-cell--locked {
  opacity: 0.55;
  background: #F4EFE8;
}

.sticker-cell-emoji { font-size: 46px; line-height: 1.1; }
.sticker-cell-name { font-size: 12px; font-weight: 800; color: var(--text); }

/* ---------- Sandbox / Magnetic Board ---------- */

.sandbox-board-wrap {
  background: #FFFFFF;
  border-radius: 26px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
  border: 3px solid #D5F3EB;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.sandbox-word-display {
  min-height: 76px;
  border-radius: 18px;
  background: #F7FCFA;
  border: 2px dashed #A7E3D4;
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sandbox-placeholder {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-soft);
}

.sandbox-placed-chip {
  padding: 6px 12px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 2px solid #BCE9DD;
  box-shadow: 0 3px 0 #9AD7C7;
  font-size: 30px;
  font-weight: 900;
}

.btn-sandbox-read { width: 100%; padding: 13px; font-size: 20px; }

.sandbox-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.sandbox-tab {
  padding: 10px;
  border-radius: 16px;
  background: #EFE4D4;
  color: var(--text-soft);
  font-size: 16px;
  font-weight: 900;
}

.sandbox-tab--active {
  background: var(--orange);
  color: #FFFFFF;
  box-shadow: 0 4px 0 var(--orange-dark);
}

.sandbox-tiles {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  padding-bottom: 24px;
  align-content: start;
}

.magnet-tile {
  height: 58px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 2px solid #E7DAC8;
  box-shadow: 0 4px 0 #D8C7B0;
  font-size: 24px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.magnet-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 #D8C7B0; }

/* ---------- Settings Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(43, 35, 56, 0.45);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #FFFFFF;
  border-radius: 28px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  max-height: 88dvh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 { margin: 0; font-size: 20px; font-weight: 900; }

.setting-group {
  padding: 12px 0;
  border-bottom: 1px solid #F2E8DB;
}

.setting-label {
  display: block;
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 6px;
}

.setting-desc {
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 600;
}

.setting-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 2px solid #E5D9C8;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  background: #FFFBF5;
  color: var(--text);
}

.setting-range {
  width: 100%;
  accent-color: var(--orange);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
}

.setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 30px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: #DDD3C5;
  border-radius: 999px;
  transition: 0.2s;
  cursor: pointer;
}
.slider::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  top: 3px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(24px); }

.setting-footer {
  padding-top: 16px;
  display: flex;
  justify-content: flex-end;
}

/* ---------- Feedback & Animations ---------- */

.wobble {
  animation: wobble 0.4s ease;
}

.pop-success {
  background: #E8FCEF !important;
  border-color: var(--green) !important;
  color: var(--green-dark) !important;
  animation: popIn 0.35s ease;
}

.hint-glow {
  animation: hintGlow 1.1s ease-in-out infinite !important;
  border-color: var(--yellow-dark) !important;
}

.pulse-gentle {
  animation: pulseSoft 2.4s ease-in-out infinite;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes wobble {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px) rotate(-3deg); }
  50% { transform: translateX(8px) rotate(3deg); }
  75% { transform: translateX(-5px); }
}

@keyframes popIn {
  0% { transform: scale(0.85); }
  55% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes pulseRing {
  0%, 100% { box-shadow: 0 5px 0 var(--orange-dark), 0 0 0 0 rgba(255, 138, 61, 0.4); }
  50% { box-shadow: 0 5px 0 var(--orange-dark), 0 0 0 10px rgba(255, 138, 61, 0); }
}

@keyframes pulseSoft {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes hintGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 210, 63, 0.7), 0 6px 0 var(--yellow-dark); }
  50% { box-shadow: 0 0 0 12px rgba(255, 210, 63, 0), 0 6px 0 var(--yellow-dark); }
}

/* ---------- Game 8: Read Aloud (Mic) + Type (Keyboard) ---------- */

.rt-phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: #FFEAF2;
  color: var(--pink-dark);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.3px;
}

.rt-phase-badge--type {
  background: #EFEAFF;
  color: var(--purple-dark);
}

.mic-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.mic-big-btn {
  width: 100%;
  padding: 18px 22px;
  border-radius: 26px;
  font-size: 21px;
  font-weight: 900;
  color: #FFFFFF;
  background: linear-gradient(180deg, #FF7AA8 0%, var(--pink) 100%);
  box-shadow: 0 6px 0 var(--pink-dark), 0 12px 24px rgba(255, 107, 157, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.1s ease;
}
.mic-big-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--pink-dark);
}

.mic-big-btn--listening {
  background: linear-gradient(180deg, #FF5E62 0%, #E63946 100%);
  box-shadow: 0 6px 0 #B5232E, 0 0 0 8px rgba(230, 57, 70, 0.25);
  animation: micPulse 1.1s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 6px 0 #B5232E, 0 0 0 0 rgba(230, 57, 70, 0.45); }
  50% { box-shadow: 0 6px 0 #B5232E, 0 0 0 14px rgba(230, 57, 70, 0); }
}

.mic-status {
  min-height: 24px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-soft);
  text-align: center;
}

.btn-link-soft {
  background: transparent;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Typing Phase */
.type-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.type-emoji-mini {
  font-size: 54px;
  width: 78px;
  height: 78px;
  border-radius: 22px;
  background: #FFFFFF;
  border: 3px solid #FFE4C4;
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.type-peek-word {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 3px;
  background: #FFF3D6;
  padding: 6px 16px;
  border-radius: 16px;
  border: 2px solid #FFD23F;
  animation: fadeIn 0.2s ease;
}

.type-slots-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
}

.type-slot {
  width: 48px;
  height: 58px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 3px dashed #D7C5AC;
  font-size: 30px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.type-slot--active {
  border-style: solid;
  border-color: var(--purple);
  background: #F6F1FF;
  box-shadow: 0 0 0 4px rgba(155, 107, 255, 0.2);
}

.type-slot--filled {
  border-style: solid;
  border-color: var(--green);
  background: #EEFCF4;
  animation: popIn 0.22s ease;
}

.type-tools-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.type-tool-btn {
  padding: 8px 13px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 2px solid #E8DBC8;
  box-shadow: 0 3px 0 #DACBB4;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}
.type-tool-btn:active { transform: translateY(2px); }

.native-input-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.native-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 3px solid var(--purple);
  background: #FFFFFF;
  font-family: inherit;
  font-size: 28px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 6px;
  color: var(--text);
  outline: none;
}

/* Built-in Russian QWERTY (ЙЦУКЕН) Keyboard for iPhone */
.kb-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #F1E7D8;
  padding: 8px 5px 10px;
  border-radius: 20px;
  margin-top: auto;
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: 3.5px;
}

.kb-key {
  flex: 1;
  min-width: 0;
  height: 46px;
  border-radius: 10px;
  background: #FFFFFF;
  box-shadow: 0 3px 0 #CBBBA5;
  font-size: 19px;
  font-weight: 900;
  color: var(--consonant);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.08s ease;
}

.kb-key--vowel {
  color: var(--vowel);
  background: #FFF5F7;
}

.kb-key:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #CBBBA5;
}

.kb-key.hint-glow {
  background: #FFF2B3 !important;
  border: 2px solid var(--yellow-dark);
  box-shadow: 0 0 0 4px rgba(255, 210, 63, 0.65), 0 3px 0 var(--yellow-dark) !important;
}

/* ---------- Animated SVG Companion "Сиричка" ---------- */

.sirichka-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.mascot-hero-svg {
  width: 172px;
  height: 164px;
  margin: 0 auto 6px;
  animation: floatSlow 2.6s ease-in-out infinite;
}

.sirichka-avatar-sm {
  width: 58px;
  height: 55px;
  flex-shrink: 0;
}

.sirichka-avatar-game {
  width: 66px;
  height: 64px;
  border-radius: 22px;
  background: #FFEAF4;
  box-shadow: 0 4px 0 #F0BBD6;
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sirichka-avatar-game:active { transform: translateY(2px); }

.victory-sirichka {
  width: 132px;
  height: 126px;
  margin: 0 auto 4px;
  animation: sirichkaBounce 1.1s ease-in-out infinite;
}

/* Mouth states */
.sirichka-mouth-talk {
  opacity: 0;
  transform-origin: 100px 129px;
}
.sirichka-mouth-idle {
  opacity: 1;
}

.sirichka--speaking .sirichka-mouth-idle,
.sirichka--happy .sirichka-mouth-idle {
  opacity: 0;
}

.sirichka--speaking .sirichka-mouth-talk {
  opacity: 1;
  animation: mouthTalk 0.24s ease-in-out infinite alternate;
}

.sirichka--happy .sirichka-mouth-talk {
  opacity: 1;
  transform: scale(1.18);
}

.sirichka--happy .sirichka-svg {
  animation: sirichkaBounce 0.55s ease-in-out infinite;
}

.sirichka--listening .sirichka-svg {
  animation: sirichkaTilt 1.2s ease-in-out infinite alternate;
}

.sirichka--oops .sirichka-svg {
  animation: wobble 0.45s ease;
}

/* Eye blinking & ear wiggle */
.sirichka-eyes {
  transform-origin: 100px 98px;
  animation: sirichkaBlink 4.2s infinite;
}

.sirichka-sparkles {
  animation: sparklePulse 2.4s ease-in-out infinite;
}

.sirichka-wings {
  transform-origin: 100px 118px;
  animation: wingFlap 1.6s ease-in-out infinite alternate;
}

@keyframes mouthTalk {
  0% { transform: scaleY(0.45) scaleX(0.95); }
  100% { transform: scaleY(1.25) scaleX(1.05); }
}

@keyframes sirichkaBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.1); }
}

@keyframes sirichkaBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-9px) scale(1.04); }
}

@keyframes sirichkaTilt {
  0% { transform: rotate(-6deg); }
  100% { transform: rotate(6deg); }
}

@keyframes sparklePulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@keyframes wingFlap {
  0% { transform: scaleX(0.92); }
  100% { transform: scaleX(1.08); }
}

/* ---------- Story Castle & Daily Adventure Plan on Map ---------- */

.castle-story-card {
  background: linear-gradient(135deg, #FFF0F8 0%, #F3EBFF 100%);
  border: 2.5px solid #F7C6E0;
  border-radius: 26px;
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.castle-title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  color: var(--pink-dark);
}

.castle-sub {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
}

.crystals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.crystal-orb {
  flex: 1;
  height: 40px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 2px dashed #DEC7E8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  filter: grayscale(1);
  opacity: 0.45;
  transition: transform 0.2s ease;
}

.crystal-orb--lit {
  filter: none;
  opacity: 1;
  border-style: solid;
  border-color: #FFD23F;
  background: #FFFFFF;
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.28);
  animation: floatSlow 2.6s ease-in-out infinite;
}

.plan-box {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 12px 14px;
  border: 2px solid #F5E1EE;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.plan-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--purple-dark);
}

.plan-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.plan-item--done {
  color: var(--green-dark);
  text-decoration: line-through;
  opacity: 0.85;
}

/* ---------- Wardrobe Screen ---------- */

.stat-pill--wardrobe {
  color: var(--pink-dark);
  background: #FFF0F7;
  border: 2px solid #FFC9E3;
}

.wardrobe-preview {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF0F8 100%);
  border: 3px solid #FFD1E8;
  border-radius: 28px;
  padding: 14px;
  text-align: center;
  margin-bottom: 12px;
  flex-shrink: 0;
  box-shadow: var(--shadow-soft);
}

.wardrobe-sirichka-stage {
  width: 148px;
  height: 140px;
  margin: 0 auto 6px;
}

.wardrobe-speech {
  font-size: 15px;
  font-weight: 800;
  color: var(--pink-dark);
}

.wardrobe-grid {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding-bottom: 24px;
  align-content: start;
}

.wardrobe-item {
  background: #FFFFFF;
  border-radius: 22px;
  padding: 14px 10px;
  text-align: center;
  border: 3px solid #F3DCEB;
  box-shadow: 0 5px 0 #E5C8DC;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.wardrobe-item:active { transform: translateY(3px); }

.wardrobe-item--equipped {
  background: #FFF6FA;
  border-color: var(--pink);
  box-shadow: 0 5px 0 var(--pink-dark);
}

.wardrobe-item--locked {
  opacity: 0.58;
  background: #F6F0F5;
}

.wardrobe-item-emoji { font-size: 40px; line-height: 1.1; }
.wardrobe-item-name { font-size: 14px; font-weight: 900; color: var(--text); }
.wardrobe-item-req {
  font-size: 12px;
  font-weight: 800;
  color: var(--purple-dark);
  background: #F3EBFF;
  padding: 3px 10px;
  border-radius: 999px;
}

/* ---------- Animated Picture Hero & Speaking Syllable Highlight ---------- */

.word-picture-hero,
.intro-emoji {
  animation: floatSlow 2.8s ease-in-out infinite;
}

.syllable-chip--speaking {
  background: #FFE066 !important;
  border-color: var(--orange) !important;
  transform: scale(1.12);
  transition: transform 0.15s ease, background 0.15s ease;
}
