/* css/style.css - Обновленный стиль с экраном «О проекте» вместо тяжелой модалки */

/* ==========================================================================
   1. ТЕМА 1: СОЛНЕЧНЫЙ ПЕРСИК (day)
   ========================================================================== */
:root,
:root[data-theme="day"] {
  --theme-name: "day";
  --font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  --font-title: 'Comfortaa', 'Nunito', cursive, sans-serif;

  --body-bg: linear-gradient(135deg, #FFE8D6 0%, #FFF3E2 40%, #E8F5E9 80%, #E0F2FE 100%);
  --app-bg: var(--screen-bg);
  --app-border: #FDBA74;
  --app-shadow: 0 24px 50px rgba(249, 115, 22, 0.16), 0 8px 20px rgba(0, 0, 0, 0.04);

  /* Мягкий сливочно-персиковый фон для экранов и контейнеров */
  --screen-bg: #FFF5EB;

  /* Выразительная персиковая шапка */
  --header-bg: linear-gradient(180deg, #FFE7D1 0%, #FFF0DE 100%);
  --header-border: #FB923C;
  --header-title-color: #9A3412;

  --text-main: #0F172A;
  --text-muted: #64748B;

  --icon-btn-bg: #FFFFFF;
  --icon-btn-border: #FDBA74;
  --icon-btn-hover: #FED7AA;
  --icon-btn-shadow: 0 6px 14px rgba(249, 115, 22, 0.15);

  --card-bg: #FFFFFF;
  --card-border: #FFEDD5;
  --card-shadow: 0 6px 18px rgba(251, 146, 60, 0.08);
  --card-hover-border: #FB923C;

  --bubble-bg: #FFFFFF;
  --bubble-border: #FED7AA;
  --tag-bg: #FFEDD5;
  --tag-color: #C2410C;

  --badge-empty-border: #CBD5E1;
  --badge-filled-border: #F97316;
  --badge-filled-bg: #FFF7ED;

  --shimmer-gradient: linear-gradient(90deg, #FDBA74 0%, #FED7AA 25%, #FDE047 50%, #86EFAC 75%, #FDBA74 100%);
}

/* ==========================================================================
   2. ТЕМА 2: МЯТНАЯ СКАЗКА (mint)
   ========================================================================== */
:root[data-theme="mint"] {
  --theme-name: "mint";
  --font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  --font-title: 'Comfortaa', 'Nunito', cursive, sans-serif;

  --body-bg: linear-gradient(135deg, #D1FAE5 0%, #E0F2FE 50%, #EDE9FE 100%);
  --app-bg: var(--screen-bg);
  --app-border: #6EE7B7;
  --app-shadow: 0 24px 50px rgba(16, 185, 129, 0.16), 0 8px 20px rgba(0, 0, 0, 0.04);

  /* Нежнейший мятный фон для экранов и контейнеров */
  --screen-bg: #EDFFF6;

  /* Чистая мятная шапка */
  --header-bg: linear-gradient(180deg, #c0ffe0 0%, #E6FBF0 100%);
  --header-border: #34D399;
  --header-title-color: #065F46;

  --text-main: #0F172A;
  --text-muted: #64748B;

  --icon-btn-bg: #FFFFFF;
  --icon-btn-border: #6EE7B7;
  --icon-btn-hover: #D1FAE5;
  --icon-btn-shadow: 0 6px 14px rgba(16, 185, 129, 0.15);

  --card-bg: #FFFFFF;
  --card-border: #D1FAE5;
  --card-shadow: 0 6px 18px rgba(16, 185, 129, 0.08);
  --card-hover-border: #10B981;

  --bubble-bg: #FFFFFF;
  --bubble-border: #A7F3D0;
  --tag-bg: #D1FAE5;
  --tag-color: #047857;

  --badge-empty-border: #CBD5E1;
  --badge-filled-border: #10B981;
  --badge-filled-bg: #F0FDF4;

  --shimmer-gradient: linear-gradient(90deg, #34D399 0%, #6EE7B7 25%, #38BDF8 50%, #A78BFA 75%, #34D399 100%);
}

/* ==========================================================================
   БАЗОВЫЕ СТИЛИ
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html,
body {
  overscroll-behavior: none;
  touch-action: pan-y;
}

body {
  font-family: var(--font-family);
  background: var(--body-bg);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  transition: background 0.35s ease;
}

#app-container {
  width: 100%;
  max-width: 1024px;
  height: 94vh;
  height: 94dvh;
  min-height: 580px;
  background: var(--app-bg);
  border-radius: 32px;
  box-shadow: var(--app-shadow);
  display: grid;
  grid-template-rows: auto 1fr;
  position: relative;
  overflow: hidden;
  border: 4px solid var(--app-border);
  transition: all 0.35s ease;
}

.header-bar {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  padding: 10px 18px;
  background: var(--header-bg);
  border-bottom: 2.5px solid var(--header-border);
  min-height: 68px;
  transition: all 0.35s ease;
  z-index: 10;
}

.header-bar > :first-child {
  justify-self: start;
}

.header-bar > .header-title-container {
  justify-self: center;
  text-align: center;
}

.header-bar > .header-actions {
  justify-self: end;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn-icon {
  background: var(--icon-btn-bg);
  border: 2px solid var(--icon-btn-border);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 22px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  color: var(--header-title-color);
  transition: transform 0.2s, background-color 0.2s;
  outline: none;
}

.btn-back-arrow {
  width: 24px;
  height: 24px;
  stroke: var(--header-title-color);
  stroke-width: 3.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display: block;
}

.btn-icon:hover {
  transform: scale(1.08);
  background: var(--icon-btn-hover);
}

.btn-icon:active {
  transform: scale(0.95);
}

.header-title-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
}

.header-title {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--header-title-color);
  letter-spacing: 0.3px;
  text-align: center;
  transition: color 0.35s ease;
}

.choice-badges-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
}

.choice-badge-slot {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 2px dashed var(--badge-empty-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 20px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.choice-badge-slot.filled {
  border: 2px solid var(--badge-filled-border);
  background: var(--badge-filled-bg);
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.25); }
  100% { transform: scale(1.08); opacity: 1; }
}

.screen {
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
  background-color: var(--screen-bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: fadeIn 0.35s ease;
  min-height: 0;
}

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

/* ==========================================================================
   ЦВЕТАСТЫЕ КАРТОЧКИ СЕТОВ И СКАЗОК (ОБЪЁМНЫЕ, «КОНФЕТНЫЕ» И АДАПТИВНЫЕ)
   ========================================================================== */
.sets-grid,
.stories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  align-content: center;
  justify-content: center;
  margin-top: auto;
  margin-bottom: auto;
  width: 100%;
}

.set-card,
.story-card {
  border-radius: 24px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 2.5px solid transparent;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.set-card:hover,
.story-card:hover {
  transform: translateY(-5px) scale(1.02);
}

.set-card:active,
.story-card:active {
  transform: scale(0.97);
}

/* ➔ ОРАНЖЕВАЯ (День и ритуалы / Большая прогулка) */
.set-card--theme-orange,
.story-card--theme-orange {
  background: linear-gradient(135deg, #FFF5EB 0%, #FED7AA 100%);
  border-color: #FB923C;
  box-shadow: 0 8px 22px rgba(251, 146, 60, 0.18);
}
.set-card--theme-orange:hover,
.story-card--theme-orange:hover {
  box-shadow: 0 14px 30px rgba(251, 146, 60, 0.28);
}

/* ➔ ЖЁЛТАЯ (Мир эмоций / Кашка) */
.set-card--theme-yellow,
.story-card--theme-yellow {
  background: linear-gradient(135deg, #FEFCE8 0%, #FEF08A 100%);
  border-color: #EAB308;
  box-shadow: 0 8px 22px rgba(234, 179, 8, 0.18);
}
.set-card--theme-yellow:hover,
.story-card--theme-yellow:hover {
  box-shadow: 0 14px 30px rgba(234, 179, 8, 0.28);
}

/* ➔ ЗЕЛЁНАЯ (Выход в мир / Зубки) */
.set-card--theme-green,
.story-card--theme-green {
  background: linear-gradient(135deg, #F0FDF4 0%, #BBF7D0 100%);
  border-color: #22C55E;
  box-shadow: 0 8px 22px rgba(34, 197, 94, 0.18);
}
.set-card--theme-green:hover,
.story-card--theme-green:hover {
  box-shadow: 0 14px 30px rgba(34, 197, 94, 0.28);
}

/* ➔ ГОЛУБАЯ (Исследователи) */
.set-card--theme-blue,
.story-card--theme-blue {
  background: linear-gradient(135deg, #F0F9FF 0%, #BAE6FD 100%);
  border-color: #38BDF8;
  box-shadow: 0 8px 22px rgba(56, 189, 248, 0.18);
}
.set-card--theme-blue:hover,
.story-card--theme-blue:hover {
  box-shadow: 0 14px 30px rgba(56, 189, 248, 0.28);
}

/* ➔ СИРЕНЕВАЯ (Пора баиньки / Сны) */
.set-card--theme-purple,
.story-card--theme-purple {
  background: linear-gradient(135deg, #FAF5FF 0%, #DDD6FE 100%);
  border-color: #A855F7;
  box-shadow: 0 8px 22px rgba(168, 85, 247, 0.18);
}
.set-card--theme-purple:hover,
.story-card--theme-purple:hover {
  box-shadow: 0 14px 30px rgba(168, 85, 247, 0.28);
}

/* Заблокированная сказка */
.story-card.disabled,
.story-card--disabled {
  opacity: 0.65;
  cursor: not-allowed;
  filter: grayscale(25%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}
.story-card.disabled:hover,
.story-card--disabled:hover {
  transform: none !important;
}

/* Мягкий матовый островок под иконку (не чисто белый, нежный бархатистый оттенок слоновой кости) */
.story-card-icon,
.set-icon-box {
  font-size: 46px;
  background: #F4EFEB;
  width: 70px;
  height: 70px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid transparent;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.8), 0 4px 10px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease;
}

/* Тонкие цветные рамочки в тон темы карточки */
.set-card--theme-orange .set-icon-box,
.story-card--theme-orange .story-card-icon {
  border-color: #FB923C;
}

.set-card--theme-yellow .set-icon-box,
.story-card--theme-yellow .story-card-icon {
  border-color: #EAB308;
}

.set-card--theme-green .set-icon-box,
.story-card--theme-green .story-card-icon {
  border-color: #22C55E;
}

.set-card--theme-blue .set-icon-box,
.story-card--theme-blue .story-card-icon {
  border-color: #38BDF8;
}

.set-card--theme-purple .set-icon-box,
.story-card--theme-purple .story-card-icon {
  border-color: #A855F7;
}

.card-title {
  font-family: var(--font-title);
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.card-subtitle {
  font-size: 0.92rem;
  color: #334155;
  margin-top: 4px;
  font-weight: 600;
}

.badge-tag {
  display: inline-block;
  font-size: 0.8rem;
  background: #FFFFFF;
  color: var(--text-main);
  padding: 4px 12px;
  border-radius: 14px;
  margin-top: 8px;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}

.badge-tag--hit {
  background: #FFEDD5;
  color: #C2410C;
}

/* Кнопка «О нас» внизу */
.footer-about-container {
  margin-top: auto;
  padding-top: 20px;
  display: flex;
  justify-content: center;
}

.btn-about {
  font-family: var(--font-title);
  background: #FFFFFF;
  border: 2px solid var(--app-border);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 10px 22px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-about:hover {
  color: var(--header-title-color);
  border-color: var(--header-title-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.btn-about:active {
  transform: scale(0.96);
}

/* ==========================================================================
   ЭКРАН «О ПРОЕКТЕ» (КОМПАКТНЫЙ И АДАПТИВНЫЙ)
   ========================================================================== */
.about-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  background-color: var(--screen-bg);
}

.about-card-box {
  background: #FFFFFF;
  border: 2.5px solid var(--app-border);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.about-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--header-bg);
  border: 1.5px solid var(--card-border);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
}

.about-item-icon {
  font-size: 26px;
}

/* Экран обложки: чистое центрирование */
.story-cover-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
  padding: 20px;
  margin: 0 auto;
  max-width: 640px;
  width: 100%;
  background-color: var(--screen-bg);
}

.cover-avatar-box {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--header-bg);
  border: 4px solid var(--header-border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  padding: 0;
}

.cover-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  display: block;
}

.card-icon-img,
.set-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
  transform: scale(1.12);
}

.final-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
  padding: 20px;
  margin: 0 auto;
  max-width: 600px;
  width: 100%;
  background-color: var(--screen-bg);
}

.final-avatar-box {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--header-bg);
  border: 4px solid var(--header-border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  animation: popIn 0.6s ease;
  overflow: hidden;
  padding: 0;
  margin: 0 auto;
}

.final-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  display: block;
}

@keyframes pulseStartBtn {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.15);
  }
}

.cover-title {
  font-family: var(--font-title);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--header-title-color);
}

.cover-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.45;
}

.btn-start-story {
  font-family: var(--font-title);
  background: #FFFFFF;
  border-radius: 28px;
  padding: 16px 36px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  animation: pulseStartBtn 2.2s infinite ease-in-out;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-start-story:hover {
  transform: translateY(-4px) scale(1.04);
}

.btn-start-story:active {
  transform: scale(0.96);
}

/* Игровая сцена: чистый flex/grid с центрированием */
.quest-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  height: 100%;
  min-height: 0;
  width: 100%;
  background-color: var(--screen-bg);
}

.scene-illustration {
  width: 100%;
  max-width: min(680px, calc(40vh * 16 / 9));
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  border: 3px solid var(--card-border);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #FFFBEB;
  transition: opacity 0.25s ease, transform 0.25s ease;
  flex-shrink: 0;
}

.scene-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.scene-incoming-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 2;
}

.scene-incoming-layer.fade-in {
  opacity: 1;
}

.scene-incoming-layer img,
.scene-incoming-layer svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.badge-slot-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 3px;
  display: block;
}

.quest-content-col {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.speech-bubble {
  width: 100%;
  max-width: 720px;
  background: var(--bubble-bg);
  border: 2.5px solid var(--bubble-border);
  border-radius: 20px;
  padding: 14px 20px;
  font-size: 1.15rem;
  line-height: 1.45;
  color: var(--text-main);
  text-align: center;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.3s ease;
}

.speech-sound-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tag-bg);
  color: var(--tag-color);
  padding: 4px 14px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.95rem;
}

.speaking-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px;
  font-size: 0.92rem;
  color: var(--text-muted);
  font-weight: 700;
}

.choices-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  width: 100%;
  flex-shrink: 0;
  margin: 0;
  padding: 4px 0;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.choices-row.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.choice-btn {
  flex: 1;
  max-width: 200px;
  min-width: 100px;
  min-height: 90px;
  background: #FFFFFF;
  border-radius: 22px;
  padding: 6px 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  border: 3.5px solid transparent;
  outline: none;
  overflow: hidden;
}

.choice-btn-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 88px;
  object-fit: contain;
  transform: scale(1.4);
  margin: 0;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.10));
}

.choice-btn:hover {
  transform: translateY(-4px) scale(1.03);
}

.choice-btn:active {
  transform: scale(0.96);
}

.glowing-border {
  border: 4px solid transparent;
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  background-image: 
    linear-gradient(to right, #FFFFFF, #FFFFFF), 
    var(--shimmer-gradient);
  background-size: 100% 100%, 300% 300%;
  animation: shimmerEvery5Sec 5s ease-in-out infinite;
}

@keyframes shimmerEvery5Sec {
  0%   { background-position: 0% 50%, 0% 50%; }
  25%  { background-position: 0% 50%, 100% 50%; }
  40%  { background-position: 0% 50%, 0% 50%; }
  100% { background-position: 0% 50%, 0% 50%; }
}

.choice-icon {
  font-size: 50px;
  margin-bottom: 8px;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.06));
}

.choice-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.speaking-indicator {
  font-size: 0.95rem;
  color: var(--header-title-color);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px;
  animation: pulseIndicator 1.5s infinite;
}

@keyframes pulseIndicator {
  0%, 100% { opacity: 0.6; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.02); }
}

/* ==========================================================================
   АДАПТИВНОСТЬ: СИСТЕМА ШАГОВ (1024px, 768px, 425px, 320px и Landscape)
   ========================================================================== */

/* ➔ ШАГ 1: ПЛАНШЕТЫ (<= 1024px) */
@media (max-width: 1024px) {
  body {
    padding: 0;
    align-items: stretch;
  }

  #app-container {
    max-width: 100%;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .sets-grid,
  .stories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .header-bar {
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
    padding-bottom: 10px;
    min-height: calc(64px + env(safe-area-inset-top));
  }
}

/* ➔ ШАГ 2: МИНИ-ПЛАНШЕТЫ И ВЕРТИКАЛЬНЫЕ ЭКРАНЫ (<= 768px) */
@media (max-width: 768px) {
  .sets-grid,
  .stories-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .screen {
    padding: 18px;
  }

  .scene-illustration {
    max-width: min(600px, calc(38vh * 16 / 9));
  }

  .cover-avatar-box,
  .final-avatar-box {
    width: 100px;
    height: 100px;
  }
}

/* ➔ ШАГ 3: СТАНДАРТНЫЕ СМАРТФОНЫ (<= 425px) */
@media (max-width: 425px) {
  .screen {
    padding: 12px;
    gap: 10px;
  }

  .screen h2 {
    font-size: 1.25rem !important;
  }

  .screen p {
    font-size: 0.85rem !important;
  }

  .header-bar {
    grid-template-columns: auto 1fr auto;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px 12px;
    min-height: calc(58px + env(safe-area-inset-top));
  }

  .header-title {
    font-size: 0.95rem;
    line-height: 1.1;
  }

  .choice-badge-slot {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .btn-icon {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .set-card,
  .story-card {
    padding: 10px 12px;
    gap: 10px;
    border-radius: 16px;
  }

  .set-icon-box,
  .story-card-icon {
    width: 46px;
    height: 46px;
    font-size: 30px;
    border-radius: 14px;
  }

  .card-title {
    font-size: 0.98rem;
  }

  .card-subtitle {
    font-size: 0.78rem;
  }

  .badge-tag {
    font-size: 0.74rem;
    padding: 3px 9px;
  }

  .quest-stage {
    gap: 10px;
    justify-content: flex-start;
  }

  .scene-illustration {
    max-width: min(100%, calc(34vh * 16 / 9));
    border-radius: 18px;
  }

  .quest-content-col {
    gap: 8px;
  }

  .speech-bubble {
    font-size: 0.98rem;
    padding: 10px 14px;
    border-radius: 16px;
  }

  .speech-sound-tag {
    font-size: 0.82rem;
    padding: 3px 10px;
  }

  .choices-row {
    gap: 10px;
  }

  .choice-btn {
    min-height: 80px;
    padding: 6px 8px;
    border-radius: 18px;
  }

  .choice-btn-img {
    max-height: 76px;
    transform: scale(1.35);
  }

  .footer-about-container {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* ➔ ШАГ 4: УЛЬТРА-КОМПАКТНЫЕ СМАРТФОНЫ (<= 320px) */
@media (max-width: 320px) {
  .screen {
    padding: 8px;
    gap: 8px;
  }

  .header-bar {
    padding: max(6px, env(safe-area-inset-top)) 8px 6px 8px;
    min-height: calc(52px + env(safe-area-inset-top));
  }

  .header-title {
    font-size: 0.88rem;
  }

  .choice-badge-slot {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .set-card,
  .story-card {
    padding: 10px 10px;
    gap: 10px;
    border-radius: 14px;
  }

  .set-icon-box,
  .story-card-icon {
    width: 44px;
    height: 44px;
    font-size: 26px;
    border-radius: 12px;
  }

  .card-title {
    font-size: 0.92rem;
  }

  .card-subtitle {
    font-size: 0.78rem;
  }

  .scene-illustration {
    max-width: min(100%, calc(30vh * 16 / 9));
    border-radius: 14px;
  }

  .speech-bubble {
    font-size: 0.9rem;
    padding: 8px 10px;
  }

  .choice-btn {
    min-height: 70px;
    padding: 4px 6px;
    border-radius: 14px;
  }

  .choice-btn-img {
    max-height: 64px;
    transform: scale(1.35);
  }
}

/* ➔ ШАГ 5: АЛЬБОМНЫЙ РЕЖИМ (ПЕРЕВЁРНУТЫЙ ЭКРАН / LANDSCAPE) */
@media (orientation: landscape) and (max-height: 560px) {
  body {
    padding: 0;
    align-items: stretch;
  }

  #app-container {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .header-bar {
    min-height: 44px;
    padding: max(4px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 4px max(14px, env(safe-area-inset-left));
  }

  .header-title {
    font-size: 0.95rem;
  }

  .choice-badge-slot {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .screen {
    padding: 6px 14px max(6px, env(safe-area-inset-bottom)) 14px;
    height: 100%;
    max-height: 100%;
    min-height: 0;
  }

  .screen h2 {
    font-size: 1.15rem !important;
    margin-bottom: 2px;
  }

  .screen p {
    font-size: 0.78rem !important;
  }

  /* Сетки на главном экране в 2 компактные колонки */
  .sets-grid,
  .stories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 2px;
    margin-bottom: 2px;
  }

  .set-card,
  .story-card {
    padding: 6px 10px;
    border-radius: 14px;
    gap: 8px;
  }

  .set-icon-box,
  .story-card-icon {
    width: 38px;
    height: 38px;
    font-size: 22px;
  }

  .card-title {
    font-size: 0.88rem;
  }

  .card-subtitle {
    font-size: 0.74rem;
  }

  .badge-tag {
    font-size: 0.7rem;
    padding: 2px 7px;
  }

  .footer-about-container {
    margin-top: 4px;
    padding-top: 2px;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
  }

  .btn-about {
    padding: 6px 16px;
    font-size: 0.82rem;
    border-radius: 16px;
  }

  /* ➔ ОБЛОЖКА И ФИНАЛ В АЛЬБОМНОМ РЕЖИМЕ */
  .story-cover-stage,
  .final-stage {
    gap: 8px;
    padding: 8px 12px;
    margin: 0 auto;
    height: 100%;
    max-height: 100%;
  }

  .cover-avatar-box,
  .final-avatar-box {
    width: 76px;
    height: 76px;
    flex-shrink: 0;
  }

  .cover-title,
  .final-title {
    font-size: 1.15rem;
    margin-bottom: 2px;
  }

  .cover-desc,
  .final-desc {
    font-size: 0.82rem;
    line-height: 1.3;
    max-width: 540px;
  }

  .btn-start-story,
  .btn-primary {
    padding: 8px 20px;
    font-size: 0.92rem;
    min-height: 44px;
  }

  /* ➔ КВЕСТ В 2 КОЛОНКИ: Иллюстрация слева, диалог и кнопки справа */
  .quest-stage {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
  }

  .scene-illustration {
    width: 100%;
    max-width: min(50%, calc((100vh - 64px) * 16 / 9));
    aspect-ratio: 16 / 9;
    height: auto;
    max-height: calc(100vh - 64px);
    flex: 0 1 auto;
    border-radius: 16px;
  }

  .quest-content-col {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: center;
    gap: 8px;
    min-height: 0;
    max-width: 48%;
  }

  .speech-bubble {
    font-size: 0.92rem;
    padding: 8px 12px;
    line-height: 1.35;
    border-radius: 14px;
  }

  .speech-sound-tag {
    font-size: 0.78rem;
    padding: 2px 8px;
    margin-top: 2px;
  }

  .speaking-indicator {
    font-size: 0.82rem;
    padding: 2px;
  }

  .choices-row {
    gap: 10px;
    padding: 0;
    margin: 0;
  }

  .choice-btn {
    min-height: 66px;
    padding: 4px 8px;
    border-radius: 16px;
  }

  .choice-btn-img {
    max-height: 60px;
    transform: scale(1.3);
  }
}
