/* ==========================================================================
   CHRONOS - CINEMA TIMELINE GAME STYLES
   Art Direction: Darkroom Celluloid & Golden Chronology
   ========================================================================== */

:root {
  --cinema-black: #050608;
  --cinema-surface: rgba(18, 20, 28, 0.85);
  --cinema-card-bg: #0f1118;
  --cinema-border: rgba(255, 255, 255, 0.1);
  --cinema-border-hover: rgba(255, 215, 0, 0.4);
  
  --gold: #ffd700;
  --gold-glow: rgba(255, 215, 0, 0.35);
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.4);
  --ruby: #ef4444;
  --ruby-glow: rgba(239, 68, 68, 0.4);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--cinema-black);
  background-image: 
    radial-gradient(circle at 50% 5%, rgba(255, 215, 0, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 80% 90%, rgba(255, 77, 38, 0.04) 0%, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* MAIN CONTAINER */
.game-container {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* GAME HEADER */
.game-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.issue-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.25);
  padding: 0.25rem 0.85rem;
  border-radius: 999px;
}

.game-main-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #fff;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
}

.game-instruction {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 600px;
  line-height: 1.5;
}

/* STATUS HUD (LIVES & PROGRESS) */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 17, 24, 0.7);
  border: 1px solid var(--cinema-border);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 0.85rem 1.5rem;
  max-width: 700px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  gap: 1rem;
}

.view-toggle-container {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--cinema-border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-toggle-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.view-toggle-btn.active {
  background: rgba(255, 215, 0, 0.15);
  color: var(--gold);
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.1);
}

.lives-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lives-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.lives-hearts {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 1.25rem;
}

.heart {
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.heart.lost {
  opacity: 0.25;
  filter: grayscale(1);
  transform: scale(0.8);
}

.progress-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.progress-counter {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
}

/* ACTIVE CARD DRAWER (THE CARD TO BE PLACED) */
.active-card-drawer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: radial-gradient(circle at 50% 50%, rgba(255, 215, 0, 0.05) 0%, rgba(15, 17, 24, 0.9) 100%);
  border: 1px dashed rgba(255, 215, 0, 0.3);
  border-radius: 16px;
  padding: 1.25rem 1.25rem;
  text-align: center;
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.drawer-heading {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.active-card-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.mystery-card {
  width: 120px;
  height: 180px;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 215, 0, 0.2);
  border: 2px solid var(--gold);
  cursor: grab;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.mystery-card:active {
  cursor: grabbing;
  transform: scale(1.04);
}

.mystery-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.active-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
  max-width: 320px;
  text-align: center;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.drawer-instruction {
  font-size: 0.8rem;
  color: var(--gold);
  opacity: 0.9;
}

/* FEEDBACK MESSAGE TOAST */
.feedback-toast {
  text-align: center;
  min-height: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: opacity 0.3s ease;
}

.feedback-toast.success {
  color: var(--emerald);
}

.feedback-toast.error {
  color: var(--ruby);
}

/* TIMELINE TRACK */
.timeline-wrapper {
  position: relative;
  width: 100%;
  padding: 1rem 0;
  padding: 0.5rem 0;
}

/* Floating Navigation Buttons (Horizontal Reel Mode) */
.timeline-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 17, 24, 0.9);
  border: 1.5px solid var(--cinema-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.timeline-nav-btn.prev {
  left: 4px;
}

.timeline-nav-btn.next {
  right: 4px;
}

.timeline-nav-btn:hover:not(:disabled) {
  background: rgba(255, 215, 0, 0.15);
  border-color: var(--gold);
  color: var(--gold);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.timeline-nav-btn:disabled {
  opacity: 0;
  pointer-events: none;
  cursor: default;
}

/* HORIZONTAL TIMELINE CONTAINER */
.timeline-scroll-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1.5rem 1rem 2rem;
  padding: 1.25rem 2.5rem 2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--cinema-border) transparent;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}

.timeline-scroll-container.is-panning {
  cursor: grabbing;
  scroll-behavior: auto; /* Fast tracking when grabbing */
  user-select: none;
}

.timeline-scroll-container::-webkit-scrollbar {
  height: 8px;
}

.timeline-scroll-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.timeline-scroll-container::-webkit-scrollbar-thumb {
  background: var(--cinema-border);
  border-radius: 4px;
}

.timeline-scroll-container::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

/* INSERTION SLOT ([ + ] DROP ZONE / CLICK BUTTON) */
.timeline-slot {
  flex-shrink: 0;
  width: 48px;
  height: 180px;
  width: 44px;
  height: 172px;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.2s ease;
}

.timeline-slot:hover,
.timeline-slot.drag-over {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.1);
  color: var(--gold);
  transform: scale(1.08);
  transform: scale(1.06);
}

.slot-icon {
  font-size: 1.25rem;
  font-size: 1.2rem;
  font-weight: 700;
}

.slot-text {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  margin-top: 0.25rem;
}

/* TIMELINE PLACED MOVIE CARD */
.placed-card {
  flex-shrink: 0;
  width: 130px;
  height: 195px;
  width: 115px;
  height: 172px;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--cinema-card-bg);
  border: 2px solid var(--cinema-border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.placed-card.just-placed-success {
  animation: successFlash 1s ease;
  border-color: var(--emerald);
  box-shadow: 0 0 25px var(--emerald-glow);
}

.placed-card.just-placed-error {
  animation: errorShake 0.6s ease;
  border-color: var(--ruby);
  box-shadow: 0 0 25px var(--ruby-glow);
}

.placed-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.placed-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   VERTICAL TIMELINE LIST MODE (Ultra-Compact Mobile & Thumb-Friendly)
   ========================================================================== */
.timeline-scroll-container.is-vertical {
  flex-direction: column;
  overflow-x: visible;
  overflow-y: visible;
  align-items: stretch;
  max-width: 380px;
  width: 100%;
  margin: 0 auto;
  padding: 0.5rem 0.25rem 2rem;
  gap: 0.4rem;
  cursor: default;
}

.timeline-scroll-container.is-vertical ~ .timeline-nav-btn,
.timeline-wrapper.is-vertical .timeline-nav-btn {
  display: none !important;
}

.timeline-scroll-container.is-vertical .timeline-slot {
  width: 100%;
  height: 36px;
  flex-direction: row;
  gap: 0.4rem;
  border-radius: 8px;
  border: 1.5px dashed rgba(255, 215, 0, 0.35);
  background: rgba(255, 215, 0, 0.03);
  color: var(--gold);
  transform: none;
}

.timeline-scroll-container.is-vertical .timeline-slot:hover,
.timeline-scroll-container.is-vertical .timeline-slot.drag-over {
  background: rgba(255, 215, 0, 0.12);
  border-color: var(--gold);
  transform: scale(1.015);
}

.timeline-scroll-container.is-vertical .timeline-slot .slot-icon {
  font-size: 1.1rem;
  margin: 0;
  line-height: 1;
}

.timeline-scroll-container.is-vertical .timeline-slot .slot-text {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin: 0;
}

.timeline-scroll-container.is-vertical .placed-card {
  width: 100%;
  height: 48px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.85rem 0.35rem 0.5rem;
  border-radius: 10px;
  background: rgba(18, 20, 28, 0.9);
  border: 1.5px solid var(--cinema-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.timeline-scroll-container.is-vertical .placed-poster {
  width: 32px;
  height: 100%;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.timeline-scroll-container.is-vertical .placed-badge {
  position: static;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 215, 0, 0.4);
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* ANIMATIONS */
@keyframes successFlash {
  0% { transform: scale(1.1); filter: brightness(1.4); }
  50% { transform: scale(1.03); filter: brightness(1.2); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* OUTCOME MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 8, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-card {
  background: #0d0f17;
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.15);
  border-radius: 24px;
  max-width: 580px;
  width: 100%;
  padding: 2.25rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.modal-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.35rem 1rem;
  border-radius: 999px;
}

.modal-badge.success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.modal-badge.failure {
  background: rgba(239, 68, 68, 0.15);
  color: var(--ruby);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.modal-title {
  font-size: 1.75rem;
  font-weight: 900;
  color: #fff;
}

.modal-score-summary {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--cinema-border);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.score-big {
  font-size: 2.25rem;
  font-weight: 900;
  color: var(--gold);
  font-family: var(--font-mono);
}

.score-lives-left {
  font-size: 1.1rem;
  letter-spacing: 0.2em;
}

.timeline-recap {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-height: 130px;
  overflow-y: auto;
  text-align: left;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.75rem 1rem;
  border-radius: 8px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-primary {
  background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
  color: #000;
  font-weight: 800;
  font-size: 1rem;
  border: none;
  padding: 0.9rem 1.75rem;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--cinema-border);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.more-games-link {
  color: var(--gold);
  font-size: 0.85rem;
  text-decoration: underline;
}

/* FOOTER */
.game-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--cinema-border);
}

.game-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.game-footer a:hover {
  color: var(--gold);
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  .game-container {
    padding: 1rem 0.75rem 3rem;
    gap: 1rem;
  }

  .timeline-nav-btn {
    display: none !important;
  }

  .status-bar {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
  }

  .view-toggle-container {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 0.25rem;
  }

  .view-toggle-btn {
    flex: 1;
    justify-content: center;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }

  .active-card-drawer {
    padding: 0.85rem 1rem;
    gap: 0.5rem;
    max-width: 360px;
  }

  .mystery-card {
    width: 100px;
    height: 150px;
  }

  .active-card-title {
    font-size: 0.95rem;
  }

  .placed-card {
    width: 90px;
    height: 135px;
  }

  .timeline-slot {
    width: 34px;
    height: 135px;
  }

  .timeline-scroll-container {
    padding: 1rem 0.5rem 1.5rem;
  }
}

@media (max-width: 480px) {
  .game-main-title {
    font-size: 1.75rem;
  }

  .game-instruction {
    font-size: 0.85rem;
  }

  .mystery-card {
    width: 90px;
    height: 135px;
  }

  .timeline-scroll-container.is-vertical {
    max-width: 320px;
  }
}

