/* 📜 CSS-стили для сюжетного режима «Хроники» */
/* (Antigravity, Gemini draft — требуется review Codex/Claude) */

.chronicles-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(10px, 3vh, 30px) 15px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: calc(100vh - var(--header-height, 70px) - 80px);
}

/* Glassmorphism Карточки */
.chronicles-card {
  background: var(--card);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(15px, 4vh, 30px);
  box-shadow: var(--glow);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.chronicles-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--purple), var(--pink), transparent);
  opacity: 0.7;
}

/* Сцена / Арт */
.chronicle-scene-frame {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  margin-bottom: 20px;
  background: #030206;
}

.chronicle-scene-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s ease;
}

.chronicles-card:hover .chronicle-scene-art {
  transform: scale(1.02);
}

.chronicle-scene-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.chronicle-location {
  font-size: 0.85rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

/* Текст истории */
.chronicle-story-text {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 25px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chronicle-story-text p {
  margin: 0;
  text-indent: 10px;
}

/* Выборы */
.chronicle-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chronicle-choice-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.chronicle-choice-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.05));
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 0;
}

.chronicle-choice-btn:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.15);
}

.chronicle-choice-btn:hover::before {
  opacity: 1;
}

.chronicle-choice-text {
  position: relative;
  z-index: 1;
  flex: 1;
}

.chronicle-choice-hint {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  position: relative;
  z-index: 1;
  margin-left: 10px;
}

/* Панель отношений / Спутники */
.chronicle-companions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.companion-status-badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.companion-status-badge.active {
  color: var(--text);
  border-color: var(--border-glow);
  background: rgba(139, 92, 246, 0.08);
}

/* Испытания (Optional Challenge) */
.chronicle-challenge-panel {
  background: rgba(236, 72, 153, 0.04);
  border: 1.5px solid rgba(236, 72, 153, 0.2);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 25px;
  text-align: center;
  position: relative;
}

.chronicle-challenge-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 14px;
  box-shadow: inset 0 0 15px rgba(236, 72, 153, 0.1);
  pointer-events: none;
}

.challenge-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--pink);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.challenge-desc {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.challenge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.btn-challenge-play {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.btn-challenge-play:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.4);
}

.btn-challenge-skip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-challenge-skip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-glow);
}

/* Состояния Экранов */
.chronicle-state-container {
  display: none;
}

.chronicle-state-container.active {
  display: block;
}

/* Начальный Экран (no_active_run) */
.chronicle-start-screen {
  text-align: center;
  padding: 40px 20px;
}

.chronicle-start-logo {
  font-size: 4rem;
  margin-bottom: 15px;
  filter: drop-shadow(0 0 15px var(--purple));
  animation: float-logo 4s ease-in-out infinite;
}

@keyframes float-logo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.chronicle-start-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--text), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.chronicle-start-desc {
  max-width: 500px;
  margin: 0 auto 30px;
  color: var(--muted);
  line-height: 1.5;
}

.chronicle-main-actions {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 320px;
  margin: 0 auto;
}

.btn-new-run {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.btn-new-run:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(139, 92, 246, 0.5);
}

.chronicle-sub-actions {
  display: flex;
  gap: 10px;
}

.chronicle-sub-actions button {
  flex: 1;
}

/* Галерея концовок */
.endings-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.ending-gallery-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ending-gallery-card.unlocked {
  background: rgba(226, 184, 83, 0.03);
  border-color: rgba(226, 184, 83, 0.3);
  box-shadow: 0 4px 15px rgba(226, 184, 83, 0.05);
}

.ending-gallery-card.locked {
  opacity: 0.65;
}

.ending-card-icon {
  font-size: 2.2rem;
  margin: 0 auto;
}

.ending-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.ending-gallery-card.unlocked .ending-card-name {
  color: var(--gold);
}

.ending-card-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.ending-card-status {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  margin-top: auto;
}

.ending-card-status.unlocked {
  color: var(--green);
}

.ending-card-status.locked {
  color: var(--muted);
}

/* Архив прохождений */
.archive-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.archive-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.archive-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-glow);
  transform: translateX(4px);
}

.archive-item-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.archive-item-title {
  font-weight: 600;
  font-size: 1rem;
}

.archive-item-date {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Навигация Хроник (Header-bar) */
.chronicles-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.chronicles-back-link {
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.chronicles-back-link:hover {
  color: var(--text);
}

/* Информационное предупреждение о перезапуске */
.reset-disclaimer-box {
  background: rgba(226, 184, 83, 0.04);
  border: 1px solid rgba(226, 184, 83, 0.2);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 15px;
}

/* Адаптивность под мобильные */
@media (max-width: 600px) {
  .chronicles-wrapper {
    padding: 10px;
  }
  
  .chronicles-card {
    padding: 15px;
    border-radius: 14px;
  }
  
  .chronicle-scene-frame {
    aspect-ratio: 4 / 3;
  }
  
  .chronicle-choice-btn {
    padding: 12px 16px;
    font-size: 0.95rem;
  }
  
  .challenge-actions {
    flex-direction: column;
  }
  
  .challenge-actions button {
    width: 100%;
  }
}
