/* ============================================
   Оболочка тренажёра в стиле основных тренажёров MindWorld
   (образец — Cabinet-multiplication-division/styles.css).
   Игровое поле, Лео, порталы, кометы и стрелка-указатель
   рисуются как раньше (Tailwind-классы в index.html), здесь
   только шапка, шаги, карточки и кнопки вокруг игры.
   ============================================ */
:root {
  --color-primary:    #ff7c00;
  --color-primary-dark: #e06600;
  --color-background: #fdf8f3;
  --color-surface:    #f8f6f0;
  --color-text:       #333333;
  --color-muted:      #7d733a;
  --radius-large:     24px;
  --radius-medium:    16px;
  --radius-small:     10px;
  --shadow-soft:      0 12px 30px rgba(255, 124, 0, 0.15);
  --shadow-inset:     inset 0 -8px 15px rgba(0, 0, 0, 0.15);
  --transition:       0.25s ease;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: "Montserrat", system-ui, -apple-system, sans-serif;
  color: var(--color-text);
  background: var(--color-background);
}

/* ============================================
   ШАПКА
   ============================================ */
.hero {
  position: relative;
  background: linear-gradient(135deg, var(--color-primary) 0%, #ff9a2b 100%);
  color: #fff8ec;
  padding: 2px 48px;
  box-shadow: var(--shadow-inset);
  min-height: 46px;
}

.hero-inner {
  position: relative;
  max-width: 2400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
}

.hero-brand {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
}

.hero-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  padding: 2px;
  display: block;
}

.hero-title {
  font-family: "Baloo 2", cursive;
  font-size: clamp(20px, 2.5vw, 32px);
  font-weight: 800;
  color: #fff8ec;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  margin: 0;
  line-height: 1;
}

.lang-capsule {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 248, 236, 0.8);
  border-radius: 999px;
  padding: 2px;
  backdrop-filter: blur(8px);
}

.lang-capsule button {
  border: 0;
  background: transparent;
  color: #fff8ec;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.lang-capsule button.active {
  background: #fff8ec;
  color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.35);
}

/* ============================================
   ИНДИКАТОР ШАГОВ
   ============================================ */
.steps-nav {
  background: var(--color-surface);
  border-bottom: 1px solid rgba(255, 124, 0, 0.15);
  padding: 10px 24px;
}

.step-indicator {
  display: flex;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.step-indicator__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: rgba(51, 51, 51, 0.4);
  transition: var(--transition);
}

.step-indicator__item.active { color: var(--color-primary); }
.step-indicator__item.complete { color: rgba(51, 51, 51, 0.35); }

.step-indicator__badge {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 124, 0, 0.1);
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 700;
  transition: var(--transition);
  flex-shrink: 0;
}

.step-indicator__item.active .step-indicator__badge {
  background: var(--color-primary);
  color: #fff8ec;
  box-shadow: 0 4px 10px rgba(255, 124, 0, 0.3);
}

.step-indicator__item.complete .step-indicator__badge {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.step-indicator__sep {
  color: rgba(125, 115, 58, 0.3);
  font-size: 16px;
  line-height: 1;
}

@media (max-width: 480px) {
  .step-indicator__label { display: none; }
  .step-indicator { gap: 4px; }
}

/* ============================================
   ЭКРАНЫ И КАРТОЧКИ
   ============================================ */
.screen { padding: 32px 12px 60px; }
.screen--play { padding: 12px 8px 24px; }

.panel,
.confirm-card,
.result-card {
  width: 100%;
  margin: 0 auto;
  background: var(--color-surface);
  border: 1px solid rgba(255, 124, 0, 0.15);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-soft);
  padding: 32px 40px 28px;
  color: var(--color-text);
}

.panel {
  max-width: 960px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.confirm-card { max-width: 760px; }
.result-card { max-width: 896px; text-align: center; margin-bottom: 16px; }

.panel h2,
.confirm-card h2,
.result-card h2 {
  flex: 1 1 100%;
  margin: 0 0 4px;
  color: var(--color-muted);
  font-family: "Baloo 2", cursive;
  font-weight: 800;
  font-size: 26px;
  line-height: 1.2;
}

/* Блоки настроек */
.settings-block {
  flex: 1 1 45%;
  min-width: 240px;
  background: rgba(255, 248, 236, 0.7);
  border: 1px solid rgba(255, 124, 0, 0.2);
  border-radius: var(--radius-medium);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-block-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--color-text);
}

.field-label b { color: var(--color-primary); }

.range {
  width: 100%;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(125, 115, 58, 0.25);
  border-radius: var(--radius-medium);
  background: #fff;
  font-weight: 600;
  font-size: 1rem;
  font-family: "Montserrat", sans-serif;
  color: var(--color-text);
  transition: var(--transition);
}

.select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 124, 0, 0.12);
}

.panel-btn {
  flex: 1 1 100%;
  display: flex;
  flex-direction: column;
}

/* Подтверждение */
.confirm-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

.confirm-list li b { color: var(--color-primary); }

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* Результаты */
.result-card p { margin: 0 0 8px; color: var(--color-muted); font-weight: 600; }

.result-stats {
  margin: 12px 0 8px;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 16px;
}

.result-stats li {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 124, 0, 0.06);
  border: 1px solid rgba(255, 124, 0, 0.15);
  border-radius: var(--radius-medium);
  padding: 12px 8px;
}

.result-stats span { font-size: 13px; color: var(--color-muted); }

.result-stats b {
  font-family: "Baloo 2", cursive;
  font-size: 20px;
  color: var(--color-primary);
}

.result-stats b.ok { color: #10b981; }
.result-stats b.bad { color: #e23d3d; }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

/* ============================================
   КНОПКИ
   ============================================ */
.btn {
  padding: 10px 20px;
  border-radius: 999px;
  border: 0;
  background: rgba(125, 115, 58, 0.1);
  cursor: pointer;
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-muted);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.btn:disabled { opacity: 0.6; cursor: default; transform: none; }

.btn.start {
  background: var(--color-primary);
  color: #fff8ec;
  box-shadow: 0 12px 20px rgba(255, 124, 0, 0.25);
  font-size: 16px;
  padding: 12px 24px;
}

.btn.start:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 26px rgba(255, 124, 0, 0.3);
}

.btn.green {
  background: #10b981;
  color: #fff;
  box-shadow: 0 8px 16px rgba(16, 185, 129, 0.25);
}

.btn.green:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px rgba(16, 185, 129, 0.3);
}

.btn.ghost { background: rgba(125, 115, 58, 0.12); color: var(--color-muted); }
.btn.ghost:hover:not(:disabled) { background: rgba(125, 115, 58, 0.2); }

/* «Зберегти як ДЗ» у вчителя — в правом нижнем углу, как раньше */
.save-hw-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10000;
}

/* ============================================
   ИГРОВОЙ ЭКРАН (только обёртка вокруг поля)
   ============================================ */
.play-wrap { max-width: 896px; margin: 0 auto; }

.play-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.play-top__side { flex: 1; display: flex; justify-content: flex-end; }

.status-text {
  margin-top: 10px;
  text-align: center;
  font-weight: 600;
  font-size: 16px;
  color: var(--color-muted);
}

/* ============================================
   ПАНЕЛЬ КАБИНЕТА (iframe): своя шапка не нужна —
   у кабинета есть своя, а язык приходит в URL (?lang=)
   ============================================ */
.mode-embedded .hero { display: none; }
/* Поле в панели подстраивается под её размер: рамка как в отдельном окне
   (896px), но растёт, если поле в большой панели шире */
.mode-embedded .play-wrap { max-width: none; width: fit-content; min-width: min(896px, 100%); }
.mode-embedded .result-card { max-width: 896px; }

@media (max-width: 640px) {
  .hero { padding: 6px 12px; }
  .hero-brand { left: 4px; }
  .hero-brand img { width: 34px; height: 34px; }
  .lang-capsule { right: 4px; }
  .lang-capsule button { padding: 4px 6px; }
  .hero-title { font-size: 18px; }
  .panel, .confirm-card, .result-card { padding: 20px 16px; }
  .confirm-list { grid-template-columns: 1fr; }
  .confirm-actions { flex-direction: column-reverse; }
  .result-stats { gap: 6px; }
  .screen { padding: 16px 8px 40px; }
}
