/* ===== Зара и Похищенные Ноты — Стили ===== */
:root {
  --bg-dark: #0a001f;
  --bg-darker: #050010;
  --gold: #ffd700;
  --gold-light: #ffeb3b;
  --gold-dim: rgba(255, 215, 0, 0.6);
  --text-light: #f5f5f5;
  --text-muted: #b0a0c0;
  --portal-bg: rgba(20, 10, 50, 0.9);
  --border-gold: 1px solid rgba(255, 215, 0, 0.5);
  --shadow-gold: 0 0 20px rgba(255, 215, 0, 0.3);
  --transition: 0.5s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', 'Roboto', sans-serif;
  background: var(--bg-dark);
  background-image: radial-gradient(ellipse at top, #1a0a3e 0%, var(--bg-dark) 50%, var(--bg-darker) 100%);
  color: var(--text-light);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Летающие ноты на фоне */
.notes-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.note-float {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0.3;
  animation: floatNote 15s ease-in-out infinite;
}

.note-float.delay-1 { left: 10%; top: 20%; animation-delay: -2s; }
.note-float.delay-2 { left: 25%; top: 60%; animation-delay: -4s; }
.note-float.delay-3 { left: 50%; top: 15%; animation-delay: -6s; }
.note-float.delay-4 { left: 70%; top: 45%; animation-delay: -8s; }
.note-float.delay-5 { left: 85%; top: 75%; animation-delay: -10s; }
.note-float.delay-6 { left: 15%; top: 80%; animation-delay: -12s; }
.note-float.delay-7 { left: 90%; top: 25%; animation-delay: -14s; }

@keyframes floatNote {
  0%, 100% { transform: translate(0, 0) rotate(0deg); opacity: 0.3; }
  25% { transform: translate(20px, -30px) rotate(10deg); opacity: 0.5; }
  50% { transform: translate(-15px, 20px) rotate(-5deg); opacity: 0.4; }
  75% { transform: translate(25px, 15px) rotate(8deg); opacity: 0.35; }
}

/* Мерцание */
@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

.note-float:nth-child(odd) {
  animation: floatNote 12s ease-in-out infinite, twinkle 3s ease-in-out infinite;
}

/* Страница пароля */
.password-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg-dark);
  background-image: radial-gradient(ellipse at top, #1a0a3e 0%, var(--bg-dark) 50%, var(--bg-darker) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.password-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.password-screen-content {
  text-align: center;
  max-width: 400px;
}

.password-title {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  color: var(--gold);
  margin-bottom: 16px;
  text-shadow: 0 0 20px var(--gold-dim);
}

.password-desc {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 1.05rem;
}

.password-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.password-input {
  width: 100%;
  max-width: 280px;
  padding: 14px 20px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: var(--border-gold);
  border-radius: 10px;
  color: var(--text-light);
}

.password-input::placeholder {
  color: var(--text-muted);
}

.password-input:focus {
  outline: none;
  box-shadow: var(--shadow-gold);
}

.password-error {
  margin-top: 16px;
  color: #ff6b6b;
  font-size: 0.95rem;
}

.password-error.hidden {
  display: none !important;
}

/* Выбор аватарки */
.avatar-selection {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-dark);
  background-image: radial-gradient(ellipse at top, #1a0a3e 0%, var(--bg-dark) 50%, var(--bg-darker) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.avatar-selection.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.avatar-selection-content {
  text-align: center;
  max-width: 500px;
}

.avatar-selection-title {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  color: var(--gold);
  margin-bottom: 12px;
  text-shadow: 0 0 20px var(--gold-dim);
}

.avatar-selection-desc {
  color: var(--text-muted);
  margin-bottom: 30px;
  font-size: 1.05rem;
}

.avatar-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  justify-items: center;
  max-width: 360px;
  margin: 0 auto;
}

.avatar-option {
  width: 140px;
  height: 140px;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
  transition: var(--transition);
}

.avatar-option:hover {
  border-color: var(--gold-dim);
  transform: scale(1.08);
  box-shadow: var(--shadow-gold);
}

.avatar-option.selected {
  border-color: var(--gold);
  box-shadow: var(--shadow-gold);
}

.avatar-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Аватарка пользователя в шапке */
.user-avatar-wrap {
  flex-shrink: 0;
}

.user-avatar-wrap.hidden {
  display: none !important;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-dim);
}

/* Прогресс-бар */
.progress-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 0, 31, 0.95);
  padding: 12px 20px;
  border-bottom: var(--border-gold);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-header-center {
  display: flex;
  align-items: center;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-back {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  padding: 8px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--gold);
  background: rgba(255, 215, 0, 0.1);
  border: var(--border-gold);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-back:hover {
  background: rgba(255, 215, 0, 0.2);
}

.btn-back.hidden {
  display: none !important;
}

.progress-container {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  max-width: 500px;
  flex: 1;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  transition: var(--transition);
}

.progress-bar::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--progress-width, 0%);
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 4px;
  transition: var(--transition);
}

.progress-steps {
  display: flex;
  gap: 4px;
}

.progress-step {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid var(--gold-dim);
  transition: var(--transition);
}

.progress-step.filled {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border-color: var(--gold);
  box-shadow: var(--shadow-gold);
}

.notes-collected {
  text-align: center;
  font-size: 0.9rem;
  color: var(--gold);
  flex-shrink: 0;
}

.notes-label {
  font-weight: 600;
}

.notes-count {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Основной контейнер */
.quest-container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 20px 100px;
}

/* Этапы */
.stage {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stage.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Портал */
.portal {
  background: var(--portal-bg);
  border: var(--border-gold);
  border-radius: 16px;
  padding: 40px 30px;
  box-shadow: var(--shadow-gold), inset 0 0 60px rgba(255, 215, 0, 0.05);
}

/* Заголовки */
.quest-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  text-align: center;
  color: var(--gold);
  margin-bottom: 30px;
  text-shadow: 0 0 30px var(--gold-dim);
}

.stage-title {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  color: var(--gold-light);
  text-align: center;
  margin-bottom: 15px;
}

.stage-title-glow {
  color: var(--gold);
  text-shadow: 0 0 20px var(--gold-dim), 0 0 40px rgba(255, 215, 0, 0.3);
  font-size: 1.8rem;
}

.stage-desc {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 25px;
  font-size: 1rem;
}

.stage-task {
  text-align: center;
  color: var(--gold);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 20px 0 20px;
}

/* Диалоги с аватарками (Портал 1) */
.story-dialogues {
  max-width: 700px;
  margin: 0 auto 30px;
}

.dialogue-block {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  align-items: flex-start;
}

.dialogue-block:last-child {
  margin-bottom: 0;
}

.dialogue-block.narrator-text {
  display: block;
  margin-bottom: 16px;
}

.intro-thief-image {
  text-align: center;
  margin: 20px 0 24px;
  position: relative;
}

.intro-thief-img {
  cursor: pointer;
  width: 70vmin;
  height: 70vmin;
  min-width: 180px;
  min-height: 180px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.15);
}

.intro-thief-image::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 8px 16px;
  background: rgba(10, 0, 31, 0.95);
  color: var(--gold);
  border: 2px solid var(--gold-dim);
  border-radius: 8px;
  font-size: 1rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.intro-thief-image:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-12px);
}

.dialogue-block.narrator-text p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
}

.dialogue-avatar {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 215, 0, 0.5);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.2);
}

.narrator-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: linear-gradient(135deg, rgba(100, 80, 180, 0.4), rgba(255, 215, 0, 0.15));
  border-color: rgba(180, 160, 255, 0.5);
}

.dialogue-content {
  flex: 1;
  min-width: 0;
}

.dialogue-name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 6px;
}

.dialogue-content p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
}

.dialogue-block[data-speaker="thief"] .dialogue-content {
  background: rgba(255, 215, 0, 0.06);
  border-left: 3px solid var(--gold-dim);
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
}

.dialogue-block[data-speaker="molly"] .dialogue-content {
  background: rgba(255, 215, 0, 0.04);
  border-left: 3px solid rgba(255, 215, 0, 0.4);
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
}

/* Кнопки */
.btn-gold {
  display: block;
  margin: 0 auto;
  padding: 14px 32px;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--bg-dark);
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.btn-gold:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 25px rgba(255, 215, 0, 0.5);
}

.btn-gold:active {
  transform: translateY(0);
}

.btn-start {
  font-size: 1.2rem;
  padding: 18px 40px;
}

.btn-next.hidden {
  display: none !important;
}

/* Портал 1: Нарратив и мем Вора */
.story-narrative {
  max-width: 680px;
  margin: 0 auto 25px;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.story-narrative p {
  margin-bottom: 12px;
}

.thief-meme-block {
  margin: 20px auto;
  text-align: center;
  padding: 15px;
  background: rgba(255, 215, 0, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(255, 215, 0, 0.2);
}

.thief-meme-img {
  max-width: 200px;
  max-height: 180px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  margin: 0 auto 10px;
}

.thief-meme-caption {
  font-style: italic;
  color: var(--gold-dim);
  font-size: 0.95rem;
}

/* Экран победы Memory */
.memory-victory-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(10, 0, 31, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.memory-victory-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.golden-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}

.golden-flash.flash {
  animation: goldenFlash 1.2s ease-out forwards;
}

@keyframes goldenFlash {
  0% { opacity: 0; }
  20% { opacity: 1; }
  60% { opacity: 0.6; }
  100% { opacity: 0; }
}

.flying-note {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 4rem;
  color: var(--gold);
  text-shadow: 0 0 30px var(--gold);
  z-index: 510;
  opacity: 0;
  pointer-events: none;
}

.flying-note.fly {
  animation: noteFlyUp 1.5s ease-out forwards;
}

@keyframes noteFlyUp {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(-10vh) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(-70vh) scale(1.5);
  }
}

.victory-content {
  max-width: 560px;
  position: relative;
  z-index: 502;
}

.victory-dialogue {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.victory-dialogue:last-of-type {
  margin-bottom: 0;
}

.victory-avatar {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 215, 0, 0.5);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.2);
}

.victory-bubble {
  flex: 1;
  min-width: 0;
  background: rgba(255, 215, 0, 0.06);
  border-left: 3px solid var(--gold-dim);
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
}

.victory-dialogue-thief .victory-bubble {
  border-left-color: rgba(255, 100, 100, 0.4);
}

.victory-text {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--text-light);
  line-height: 1.5;
}

.victory-text:last-child {
  margin-bottom: 0;
}

.victory-text-plain {
  text-align: center;
  margin: 0 0 20px !important;
}

.victory-text-plain:last-of-type {
  margin-bottom: 0 !important;
}

.victory-quote {
  font-style: italic;
  color: var(--gold);
  margin: 0;
  font-size: 1.05rem;
}

.btn-continue {
  margin-top: 28px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Memory-игра */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 520px;
  margin: 0 auto 25px;
}

.memory-card {
  aspect-ratio: 1;
  min-height: 110px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 235, 59, 0.1));
  border: var(--border-gold);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  transition: var(--transition);
  overflow: hidden;
}

.memory-card:hover:not(.flipped):not(.matched) {
  transform: scale(1.05);
  box-shadow: var(--shadow-gold);
}

.memory-card.flipped,
.memory-card.matched {
  background: rgba(255, 215, 0, 0.3);
}

.memory-card.matched {
  border-color: var(--gold);
  cursor: pointer;
}

.memory-card.matched:hover {
  box-shadow: var(--shadow-gold);
}

/* Lightbox для увеличенного просмотра найденных пар */
.memory-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.memory-lightbox.active {
  opacity: 1;
  visibility: visible;
}

.memory-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 12px;
  border: 3px solid var(--gold);
  box-shadow: var(--shadow-gold);
  animation: lightboxAppear 0.3s ease;
}

@keyframes lightboxAppear {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.memory-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(255, 215, 0, 0.2);
  border: var(--border-gold);
  border-radius: 50%;
  color: var(--gold);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.memory-lightbox-close:hover {
  background: rgba(255, 215, 0, 0.4);
}

/* Lightbox для увеличения мемов (Портал 8) */
.meme-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.meme-lightbox.active {
  opacity: 1;
  visibility: visible;
}

.meme-lightbox .memory-lightbox-close {
  z-index: 10;
  pointer-events: auto;
}

.meme-lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
  border: 3px solid var(--gold);
  box-shadow: var(--shadow-gold);
  cursor: default;
}

.meme-gallery-card img {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.meme-gallery-card img:hover {
  transform: scale(1.02);
}

/* Lightbox для выбора фото (Портал 2) */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.photo-lightbox.active {
  opacity: 1;
  visibility: visible;
}

.photo-lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.photo-lightbox-content img {
  max-width: 85vw;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  border: 3px solid var(--gold);
  box-shadow: var(--shadow-gold);
}

.btn-photo-confirm {
  flex-shrink: 0;
}

.memory-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-card .card-back {
  font-size: 2rem;
  color: var(--gold);
}

/* Фото-сетка (Stage 3) */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  max-width: 500px;
  margin: 0 auto 25px;
}

.photo-option {
  aspect-ratio: 1;
  border: 3px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  overflow: hidden;
  transition: var(--transition);
  background: rgba(255, 255, 255, 0.05);
}

.photo-option:hover {
  border-color: var(--gold-dim);
  transform: scale(1.03);
}

.photo-option.correct {
  border-color: var(--gold);
  box-shadow: var(--shadow-gold);
}

.photo-option.wrong {
  animation: shake 0.5s ease;
}

.photo-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Комплименты (Stage 4) */
.compliments-list {
  list-style: none;
  padding: 0;
  margin: 0 auto 25px;
  max-width: 640px;
}

.compliments-list li {
  margin-bottom: 12px;
}

.compliment-btn {
  width: 100%;
  padding: 14px 20px;
  text-align: left;
  background: rgba(255, 215, 0, 0.15);
  border: var(--border-gold);
  border-radius: 10px;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.4;
  transition: var(--transition);
}

.compliment-btn:hover {
  background: rgba(255, 215, 0, 0.25);
  transform: translateY(-2px);
}

.compliment-btn.selected {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--bg-dark);
  font-weight: 600;
}

.compliment-btn.wrong {
  animation: shake 0.5s ease;
}

/* Видео (Stage 5) */
.video-container {
  max-width: 560px;
  margin: 0 auto 20px;
  border-radius: 12px;
  overflow: hidden;
  border: var(--border-gold);
}

.portal-video {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
}

.video-placeholder {
  aspect-ratio: 16/9;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.video-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 10px;
}

.video-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 25px;
}

.btn-video-done {
  margin-bottom: 0;
}

.btn-video-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--gold);
  background: rgba(255, 215, 0, 0.1);
  border: var(--border-gold);
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-video-download:hover {
  background: rgba(255, 215, 0, 0.2);
}

.btn-video-download.hidden {
  display: none !important;
}

/* Песни (Stage 6) */
.songs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  margin: 0 auto 25px;
}

.song-btn {
  padding: 14px 20px;
  background: rgba(255, 215, 0, 0.1);
  border: var(--border-gold);
  border-radius: 10px;
  color: var(--text-light);
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}

.song-btn:hover {
  background: rgba(255, 215, 0, 0.2);
}

.song-btn.correct {
  background: rgba(255, 215, 0, 0.3);
  border-color: var(--gold);
}

.song-btn.wrong {
  animation: shake 0.5s ease;
}

/* Пазл (Stage 7) */
.puzzle-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}

.puzzle-board {
  display: grid;
  grid-template-columns: repeat(3, 100px);
  grid-template-rows: repeat(3, 100px);
  gap: 2px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 8px;
  border: var(--border-gold);
}

.puzzle-slot {
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 215, 0, 0.3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  overflow: hidden;
}

.puzzle-slot.drag-over {
  background: rgba(255, 215, 0, 0.2);
  border-color: var(--gold);
}

.puzzle-slot .piece {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
}

.puzzle-pieces {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 90px;
  padding: 12px;
  border-radius: 8px;
  transition: var(--transition);
}

.puzzle-pieces.drag-over {
  background: rgba(255, 215, 0, 0.1);
  border: 2px dashed var(--gold-dim);
}

.puzzle-piece {
  width: 80px;
  height: 80px;
  border: 2px solid var(--gold-dim);
  border-radius: 6px;
  cursor: grab;
  overflow: hidden;
  transition: var(--transition);
  user-select: none;
  -webkit-user-drag: element;
  position: relative;
}

.puzzle-piece:hover {
  border-color: var(--gold);
}

.puzzle-piece img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.puzzle-piece.dragging {
  opacity: 0.7;
  cursor: grabbing;
}

/* Ввод кода (Stage 8) */
.code-input-area {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 25px;
}

.code-input {
  padding: 14px 20px;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.1);
  border: var(--border-gold);
  border-radius: 10px;
  color: var(--text-light);
  min-width: 200px;
}

.code-input::placeholder {
  color: var(--text-muted);
}

.code-input:focus {
  outline: none;
  box-shadow: var(--shadow-gold);
}

/* Галерея мемов Вора (Stage 8) */
.meme-gallery {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  margin-bottom: 20px;
  border-radius: 12px;
  border: var(--border-gold);
  background: rgba(0, 0, 0, 0.2);
  scroll-behavior: smooth;
}

.meme-gallery-card {
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(255, 215, 0, 0.05);
  border-radius: 10px;
  border: 1px solid rgba(255, 215, 0, 0.2);
}

.meme-gallery-card:last-of-type {
  margin-bottom: 0;
}

.meme-gallery-card img {
  display: block;
  max-width: 280px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 0 auto 12px;
}

.meme-gallery-caption {
  font-size: 0.95rem;
  color: var(--text-light);
  font-style: italic;
  text-align: center;
  margin: 0;
}

.meme-gallery-sentinel {
  height: 1px;
  visibility: hidden;
  pointer-events: none;
}

.btn-memes-done {
  margin-bottom: 25px;
}

.btn-memes-done.hidden {
  display: none !important;
}

/* Область Мемного Вора */
.thief-area {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: rgba(10, 0, 31, 0.95);
  border-top: var(--border-gold);
  z-index: 50;
}

.thief-message-wrap {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  max-width: 700px;
  margin: 0 auto 12px;
  text-align: left;
}

.thief-area-avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 215, 0, 0.5);
  display: none;
}

.thief-message-wrap:has(.thief-message:not(:empty)) .thief-area-avatar {
  display: block;
}

.thief-message {
  flex: 1;
  font-size: 1rem;
  color: var(--gold);
  min-height: 24px;
}

.thief-area .btn-next {
  display: block;
  margin: 0 auto;
}

/* Финал */
.portal-final {
  text-align: center;
}

.final-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--gold);
  margin-bottom: 15px;
}

.final-subtitle {
  font-size: 1.2rem;
  margin-bottom: 30px;
  color: var(--text-muted);
}

.tickets-container {
  max-width: 500px;
  margin: 0 auto 25px;
  padding: 30px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  border: var(--border-gold);
}

.tickets-placeholder {
  color: var(--text-light);
  text-align: center;
}

.tickets-placeholder p {
  margin: 8px 0;
}

.btn-tickets-download {
  display: inline-block;
  margin-top: 20px;
  padding: 14px 28px;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--bg-dark);
}

.tickets-placeholder hr {
  border: none;
  border-top: 1px solid rgba(255, 215, 0, 0.3);
  margin: 20px 0;
}

.ticket-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.final-meme {
  font-size: 1.1rem;
  color: var(--gold);
  font-style: italic;
}

/* Музыка */
.music-control {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 60;
}

.btn-music {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 215, 0, 0.2);
  border: var(--border-gold);
  color: var(--gold);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-music:hover {
  background: rgba(255, 215, 0, 0.3);
  transform: scale(1.1);
}

/* Анимации */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

@keyframes noteReturn {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.8; }
  100% { transform: scale(0); opacity: 0; }
}

/* Конфетти canvas */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* Мем-область на этапах */
.meme-area {
  min-height: 40px;
  margin-top: 15px;
  font-size: 0.95rem;
  color: var(--gold-dim);
  font-style: italic;
}

/* Адаптив */
@media (max-width: 600px) {
  .portal {
    padding: 25px 20px;
  }

  .memory-grid {
    gap: 12px;
    max-width: 360px;
  }

  .memory-card {
    min-height: 75px;
    font-size: 1.5rem;
  }

  .story-narrative {
    font-size: 0.95rem;
  }

  .thief-meme-img {
    max-width: 160px;
  }

  .stage-title-glow {
    font-size: 1.4rem;
  }

  .avatar-options {
    gap: 20px;
    max-width: 300px;
  }

  .avatar-option {
    width: 120px;
    height: 120px;
  }

  .avatar-selection-title {
    font-size: 1.5rem;
  }


  .dialogue-block {
    gap: 12px;
    margin-bottom: 18px;
  }

  .dialogue-block.narrator-text p {
    font-size: 0.98rem;
  }

  .dialogue-avatar {
    width: 44px;
    height: 44px;
  }

  .narrator-avatar {
    font-size: 1.3rem;
  }

  .dialogue-content p {
    font-size: 0.98rem;
  }

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

  .meme-options {
    grid-template-columns: 1fr;
  }

  .puzzle-board {
    grid-template-columns: repeat(3, 80px);
    grid-template-rows: repeat(3, 80px);
  }

  .puzzle-slot {
    width: 80px;
    height: 80px;
  }

  .puzzle-slot .piece {
    width: 76px;
    height: 76px;
  }

  .puzzle-piece {
    width: 60px;
    height: 60px;
  }
}
