/* ═══════════════════════════════════════════════════════════════
   STORY MODE — карта актов и карта глав
   Маршрут как в Angry Birds / мобильных RPG
   ═══════════════════════════════════════════════════════════════ */

.story-screen {
  min-height: 100vh;
  padding: 70px 24px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

/* текстурный фон-арена + туман */
.story-screen::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(160, 80, 220, 0.20) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(220, 80, 160, 0.16) 0%, transparent 50%),
    linear-gradient(180deg, rgba(8,4,14,0.74) 0%, rgba(8,4,14,0.90) 100%),
    url('../img/story_bg.png?v=1') center / cover no-repeat;
  pointer-events: none;
  z-index: 0;
}

.story-header {
  text-align: center;
  margin-bottom: 10px;
  position: relative; z-index: 1;
}
.story-eyebrow {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.55em;
  color: rgba(220, 180, 255, 0.55);
  text-transform: uppercase;
}
.story-title {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-weight: 700;
  font-size: 32px;
  letter-spacing: 0.18em;
  background: linear-gradient(180deg, #f5d8ff 0%, #d36ab6 60%, #a060ff 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  margin: 4px 0 2px;
}
.story-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14px;
  color: rgba(220, 180, 255, 0.6);
}

/* ═══════════════════════════════════════════════════════════════
   КАРТА АКТОВ — маршрут зигзагом
   ═══════════════════════════════════════════════════════════════ */

.act-map {
  position: relative;
  width: 100%;
  max-width: 900px;
  min-height: 340px;
  margin-top: 20px;
  z-index: 1;
}

/* SVG-линии маршрута между актами */
.act-map-path {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ── Узел акта ── */
.act-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.25s ease;
  z-index: 2;
}
.act-node:hover:not(.locked) { transform: translateY(-4px) scale(1.03); }

/* Круглая кнопка акта */
.act-btn {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--act-color, rgba(200, 140, 255, 0.5));
  background:
    radial-gradient(circle at 35% 35%,
      var(--act-color-soft, rgba(160, 100, 230, 0.3)) 0%,
      rgba(15, 8, 22, 0.95) 65%);
  box-shadow:
    0 0 30px var(--act-color-soft, rgba(160, 100, 230, 0.3)),
    inset 0 1px 0 rgba(255,255,255,0.1);
  transition: all 0.3s ease;
}
.act-node:hover:not(.locked) .act-btn {
  box-shadow:
    0 0 50px var(--act-color-soft, rgba(160, 100, 230, 0.5)),
    inset 0 1px 0 rgba(255,255,255,0.15);
  border-color: var(--act-color, #b88be3);
}
.act-btn.locked-btn {
  border-color: rgba(100, 80, 130, 0.4);
  background: rgba(10, 6, 16, 0.9);
  box-shadow: none;
  filter: grayscale(0.6);
  cursor: not-allowed;
}

.act-number {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--act-color, rgba(220, 180, 255, 0.6));
  text-transform: uppercase;
  margin-bottom: 2px;
}
.act-icon { font-size: 32px; line-height: 1; }
.act-lock-icon {
  font-size: 30px;
  color: rgba(100, 80, 130, 0.6);
}

/* Название акта под кнопкой */
.act-label {
  text-align: center;
  max-width: 140px;
}
.act-label-title {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--act-color, #d36ab6);
  text-transform: uppercase;
  text-shadow: 0 0 10px var(--act-color-soft, transparent);
}
.act-label-sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 11px;
  color: rgba(220, 180, 255, 0.5);
  margin-top: 2px;
}
.act-node.locked .act-label-title { color: rgba(100, 80, 130, 0.5); text-shadow: none; }

/* Звёзды под актом (прогресс) */
.act-stars {
  display: flex;
  gap: 4px;
}
.act-star {
  font-size: 14px;
  color: rgba(100, 80, 130, 0.4);
}
.act-star.earned { color: #ffd060; text-shadow: 0 0 8px rgba(255, 208, 64, 0.6); }

/* ═══════════════════════════════════════════════════════════════
   КАРТА ГЛАВ — маршрут зигзагом внутри акта
   ═══════════════════════════════════════════════════════════════ */

.chapter-map-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 3, 10, 0.92);
  backdrop-filter: blur(10px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: equip-fade 0.3s ease;
}

.chapter-map-box {
  width: min(960px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(28, 18, 38, 0.98), rgba(15, 8, 22, 0.98));
  border: 1.5px solid rgba(200, 140, 255, 0.35);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.9), 0 0 60px rgba(160, 100, 230, 0.18);
}

.chap-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(200, 140, 255, 0.15);
  background: rgba(0,0,0,0.3);
}
.chap-map-title {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.25em;
  color: var(--act-color, #d36ab6);
  text-shadow: 0 0 14px var(--act-color-soft, transparent);
  text-transform: uppercase;
}
.chap-map-sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13px;
  color: rgba(220, 180, 255, 0.55);
  margin-top: 3px;
}
.chap-map-close {
  background: transparent; border: none;
  font-size: 22px; color: rgba(220, 180, 255, 0.6);
  cursor: pointer; padding: 4px 10px;
  transition: color 0.2s;
}
.chap-map-close:hover { color: #fff; }

/* карта глав */
.chap-map-body {
  position: relative;
  flex: 1;
  min-height: 380px;
  overflow: hidden;
  padding: 30px 40px;
}

.chap-map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ── Узел главы ── */
.chap-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.25s ease;
  z-index: 2;
}
.chap-node:hover:not(.locked) { transform: translateY(-3px) scale(1.04); }

.chap-btn {
  position: relative;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2.5px solid rgba(200, 140, 255, 0.35);
  background: rgba(15, 8, 22, 0.92);
  transition: all 0.25s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* открытая глава */
.chap-btn.open {
  border-color: rgba(200, 140, 255, 0.7);
  background:
    radial-gradient(circle at 35% 35%,
      rgba(160, 100, 230, 0.28) 0%,
      rgba(15, 8, 22, 0.95) 65%);
  box-shadow: 0 0 22px rgba(160, 100, 230, 0.35), 0 4px 20px rgba(0,0,0,0.5);
}
.chap-node:hover:not(.locked) .chap-btn.open {
  box-shadow: 0 0 40px rgba(200, 140, 255, 0.55), 0 4px 24px rgba(0,0,0,0.6);
}

/* пройденная */
.chap-btn.completed {
  border-color: rgba(100, 200, 100, 0.7);
  background:
    radial-gradient(circle at 35% 35%,
      rgba(60, 180, 80, 0.25) 0%,
      rgba(15, 8, 22, 0.95) 65%);
  box-shadow: 0 0 20px rgba(80, 200, 80, 0.3), 0 4px 20px rgba(0,0,0,0.5);
}

/* БОСС */
.chap-btn.boss {
  border-color: rgba(255, 176, 64, 0.85);
  background:
    radial-gradient(circle at 35% 35%,
      rgba(255, 140, 30, 0.3) 0%,
      rgba(15, 8, 22, 0.95) 65%);
  box-shadow:
    0 0 30px rgba(255, 176, 64, 0.5),
    0 0 60px rgba(255, 140, 30, 0.25),
    0 4px 20px rgba(0,0,0,0.5);
  animation: boss-pulse 2.5s ease-in-out infinite;
}
@keyframes boss-pulse {
  0%, 100% { box-shadow: 0 0 30px rgba(255, 176, 64, 0.5), 0 0 60px rgba(255, 140, 30, 0.2), 0 4px 20px rgba(0,0,0,0.5); }
  50%      { box-shadow: 0 0 50px rgba(255, 176, 64, 0.8), 0 0 90px rgba(255, 140, 30, 0.4), 0 4px 20px rgba(0,0,0,0.5); }
}

/* заперта */
.chap-btn.locked-btn {
  border-color: rgba(80, 60, 100, 0.4);
  background: rgba(8, 5, 14, 0.9);
  box-shadow: none;
  filter: grayscale(0.5) brightness(0.6);
  cursor: not-allowed;
}

.chap-num {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-weight: 700;
  font-size: 22px;
  color: #f0e0ff;
  text-shadow: 0 0 10px rgba(220, 180, 255, 0.5);
  line-height: 1;
}
.chap-btn.boss .chap-num { color: #ffd060; text-shadow: 0 0 12px rgba(255, 208, 64, 0.7); }
.chap-btn.completed .chap-num { color: #5ad06f; text-shadow: 0 0 10px rgba(90, 208, 111, 0.6); }
.chap-btn.locked-btn .chap-num { display: none; }
.chap-lock { font-size: 22px; color: rgba(80, 60, 100, 0.7); }

.chap-label {
  text-align: center;
  max-width: 110px;
}
.chap-label-title {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-size: 9px;
  letter-spacing: 0.22em;
  color: rgba(220, 180, 255, 0.7);
  text-transform: uppercase;
}
.chap-btn.boss ~ .chap-label .chap-label-title { color: #ffd060; }
.chap-btn.completed ~ .chap-label .chap-label-title { color: #5ad06f; }
.chap-node.locked .chap-label-title { color: rgba(80, 60, 100, 0.5); }

.chap-label-name {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 11px;
  color: rgba(220, 180, 255, 0.5);
  margin-top: 2px;
  line-height: 1.3;
}

/* ── Требования к уровню ── */
.chap-req-badge {
  position: absolute;
  top: -6px; right: -6px;
  background: rgba(255, 100, 50, 0.9);
  border: 1px solid rgba(255, 150, 80, 0.8);
  border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 8px rgba(255, 100, 50, 0.6);
}

/* ── Модалка требований ── */
.req-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 3, 10, 0.85);
  backdrop-filter: blur(8px);
  z-index: 600;
  display: flex; align-items: center; justify-content: center;
  animation: equip-fade 0.2s ease;
}
.req-box {
  width: min(440px, 94vw);
  background: linear-gradient(180deg, rgba(30, 18, 48, 0.98), rgba(15, 8, 22, 0.98));
  border: 1.5px solid rgba(200, 140, 255, 0.4);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.85), 0 0 40px rgba(160, 100, 230, 0.18);
}
.req-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid rgba(200, 140, 255, 0.15);
  background: rgba(0,0,0,0.3);
  text-align: center;
}
.req-chapter-title {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.25em;
  color: #f0e0ff;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.req-chapter-sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13px;
  color: rgba(220, 180, 255, 0.55);
}
.req-body { padding: 20px 24px 22px; }
.req-section-title {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.38em;
  color: rgba(220, 180, 255, 0.5);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.req-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.req-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 3px;
  background: rgba(0,0,0,0.35);
}
.req-row.pass { border-left: 3px solid #5ad06f; }
.req-row.fail { border-left: 3px solid #ff5060; }
.req-stat-name {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(220, 180, 255, 0.75);
  text-transform: uppercase;
}
.req-needed {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-size: 12px;
  color: rgba(220, 180, 255, 0.55);
}
.req-have {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
}
.req-row.pass .req-have { color: #5ad06f; }
.req-row.fail .req-have { color: #ff5060; }
.req-check { font-size: 14px; }

.req-enemy-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(200, 140, 255, 0.18);
  border-radius: 3px;
  margin-bottom: 18px;
}
.req-enemy-name {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: #f0e0ff;
  text-transform: uppercase;
}
.req-enemy-stats {
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px;
  color: rgba(220, 180, 255, 0.55);
  margin-top: 2px;
}

.req-btn-row { display: flex; gap: 10px; }
.req-btn {
  flex: 1;
  padding: 12px;
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1.5px solid;
}
.req-btn-cancel {
  background: transparent;
  border-color: rgba(200, 140, 255, 0.3);
  color: rgba(220, 180, 255, 0.6);
}
.req-btn-cancel:hover { border-color: rgba(200, 140, 255, 0.6); color: #fff; }
.req-btn-go {
  background: linear-gradient(180deg, rgba(100, 50, 160, 0.6), rgba(60, 25, 100, 0.8));
  border-color: rgba(200, 140, 255, 0.7);
  color: #f0e0ff;
  box-shadow: 0 0 16px rgba(160, 100, 230, 0.3);
}
.req-btn-go:hover {
  background: linear-gradient(180deg, rgba(130, 70, 200, 0.7), rgba(80, 35, 130, 0.9));
  box-shadow: 0 0 24px rgba(200, 140, 255, 0.5);
}
.req-btn-go:disabled {
  opacity: 0.4; cursor: not-allowed;
  background: rgba(40, 25, 60, 0.5);
  box-shadow: none;
}
.req-btn-train {
  background: linear-gradient(180deg, rgba(80, 40, 120, 0.5), rgba(40, 20, 70, 0.7));
  border-color: rgba(160, 100, 200, 0.5);
  color: rgba(220, 180, 255, 0.8);
}
.req-btn-train:hover { border-color: rgba(200, 140, 255, 0.7); color: #fff; }


/* ═══════════════════════════════════════════════════════════════
   УЗЛЫ ГЛАВ НА КАРТЕ АКТА — медальоны вместо скучных кружков
   ═══════════════════════════════════════════════════════════════ */
.chap-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

/* медальон */
.chap-medallion {
  position: relative;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1), filter 0.22s ease;
  -webkit-tap-highlight-color: transparent;
}

/* вращающееся кольцо-ободок */
.chap-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1.5px dashed rgba(220, 180, 255, 0.28);
  pointer-events: none;
}

/* внутреннее ядро с контентом */
.chap-core {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  text-align: center;
  border: 2.5px solid;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.6);
}

.chap-num {
  font-family: 'Metamorphous', serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}
.chap-tag {
  font-family: 'Cinzel', serif;
  font-size: 8px;
  letter-spacing: 0.22em;
  font-weight: 700;
  opacity: 0.9;
}
.chap-glyph { font-size: 28px; line-height: 1; }

/* подпись под медальоном */
.chap-caption { text-align: center; max-width: 120px; }
.chap-cap-no {
  font-family: 'Cinzel', serif;
  font-size: 8px;
  letter-spacing: 0.28em;
  font-weight: 700;
  color: rgba(220, 180, 255, 0.55);
  margin-bottom: 1px;
}
.chap-cap-title {
  font-family: 'Metamorphous', serif;
  font-style: italic;
  font-size: 11px;
  color: rgba(232, 210, 255, 0.78);
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* ── СОСТОЯНИЕ: доступна ── */
.chap-medallion.available { cursor: pointer; }
.chap-medallion.available .chap-core {
  border-color: var(--act-color, #b56aff);
  background: radial-gradient(circle at 50% 35%,
              color-mix(in srgb, var(--act-color, #b56aff) 32%, #0e0618), #0a0414);
  color: var(--act-color, #d0a0ff);
}
.chap-medallion.available .chap-ring {
  border-color: color-mix(in srgb, var(--act-color, #b56aff) 55%, transparent);
  animation: chap-spin 14s linear infinite;
}
.chap-medallion.available .chap-num { color: #fff; }
/* пульсирующее свечение для активной главы */
.chap-medallion.available::before {
  content: "";
  position: absolute; inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--act-color, #b56aff) 45%, transparent) 0%, transparent 68%);
  opacity: 0.55;
  animation: chap-pulse 2.2s ease-in-out infinite;
  pointer-events: none;
}

/* ── СОСТОЯНИЕ: пройдена ── */
.chap-medallion.done { cursor: pointer; }
.chap-medallion.done .chap-core {
  border-color: #5ad06f;
  background: radial-gradient(circle at 50% 35%, rgba(40,110,55,0.6), #061206);
  color: #8af0a0;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.6), 0 0 18px rgba(90,208,80,0.28);
}
.chap-medallion.done .chap-ring { border-style: solid; border-color: rgba(90,208,80,0.4); }
.chap-medallion.done .chap-num { color: #7af090; font-size: 30px; }

/* ── СОСТОЯНИЕ: босс ── */
.chap-medallion.boss { cursor: pointer; width: 92px; height: 92px; }
.chap-medallion.boss .chap-core {
  border-color: #ffd060;
  background: radial-gradient(circle at 50% 35%, rgba(120,70,10,0.7), #140d00);
  color: #ffd060;
  box-shadow: inset 0 2px 12px rgba(0,0,0,0.7), 0 0 26px rgba(255,208,64,0.45);
}
.chap-medallion.boss .chap-ring {
  inset: -6px;
  border: 2px solid rgba(255,208,64,0.45);
  animation: chap-spin 10s linear infinite reverse;
}
.chap-medallion.boss::before {
  content: "";
  position: absolute; inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,208,64,0.5) 0%, transparent 66%);
  opacity: 0.6;
  animation: chap-pulse 1.8s ease-in-out infinite;
  pointer-events: none;
}

/* ── СОСТОЯНИЕ: заблокирована ── */
.chap-medallion.locked { cursor: not-allowed; filter: grayscale(0.7); }
.chap-medallion.locked .chap-core {
  border-color: rgba(90, 70, 110, 0.45);
  background: radial-gradient(circle at 50% 35%, rgba(30,22,40,0.9), #060310);
  color: rgba(150, 130, 175, 0.55);
}
.chap-medallion.locked .chap-ring { border-color: rgba(90, 70, 110, 0.25); }

/* ── HOVER (только для кликабельных) ── */
.chap-medallion.available:hover,
.chap-medallion.done:hover,
.chap-medallion.boss:hover {
  transform: scale(1.12) translateY(-2px);
  filter: brightness(1.18);
}
.chap-node:has(.chap-medallion:hover) .chap-cap-title { color: #fff; }

@keyframes chap-spin { to { transform: rotate(360deg); } }
@keyframes chap-pulse {
  0%, 100% { transform: scale(1);   opacity: 0.35; }
  50%      { transform: scale(1.18); opacity: 0.7; }
}
