/* ═══════════════════════════════════════════════════════════════
   SecretChronicle — Global Styles
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Abril+Fatface&family=DM+Mono:wght@300;400;500&family=Lexend:wght@300;400;500;600;700&family=Orbitron:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg-deep: #070910;
  --bg-card: #0f1520;
  --bg-card-hover: #131b2a;
  --border: #1c2535;
  --border-glow: #2a3a50;
  --lime: #a0f060;
  --lime-dim: #7bc040;
  --lime-glow: rgba(160, 240, 96, 0.15);
  --lime-glow-strong: rgba(160, 240, 96, 0.3);
  --emerald: #2dd4a0;
  --emerald-dim: #1a9a72;
  --text-primary: #e8edf5;
  --text-secondary: #8899aa;
  --text-dim: #556677;
  --danger: #ff4466;
  --warning: #ffaa33;
  --font-heading: 'Orbitron', sans-serif;
  --font-body: 'Lexend', sans-serif;
  --font-chapter: 'Lexend', Georgia, serif;
  --font-title: 'Abril Fatface', serif;
  --font-mono: 'DM Mono', monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--lime); text-decoration: none; transition: all 0.3s; }
a:hover { color: var(--emerald); }

::selection {
  background: var(--lime);
  color: var(--bg-deep);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ─── Particles Canvas ─────────────────────────────────────── */
#particles-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ─── Navigation ───────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(7, 9, 16, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--lime);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.nav-logo span {
  color: var(--text-dim);
  font-weight: 400;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  padding-bottom: 4px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 2px;
  background: var(--lime);
  transition: width 0.3s;
}

.nav-links a:hover { color: var(--lime); }
.nav-links a:hover::after { width: 100%; }
.nav-links a.active { color: var(--lime); }
.nav-links a.active::after { width: 100%; }

/* ─── Hero / Landing ───────────────────────────────────────── */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 6rem 2rem 4rem;
}

.hero-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--lime);
  background: var(--lime-glow);
  border: 1px solid rgba(160, 240, 96, 0.2);
  padding: 0.4rem 1.2rem;
  border-radius: 20px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 2rem;
  animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 10px var(--lime-glow); }
  50% { box-shadow: 0 0 25px var(--lime-glow-strong); }
}

.hero h1 {
  font-family: var(--font-title);
  font-size: clamp(3rem, 8vw, 6rem);
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.hero h1 .accent {
  color: var(--lime);
  text-shadow: 0 0 40px var(--lime-glow);
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 3rem;
  font-weight: 300;
  line-height: 1.8;
}

.hero-stats {
  display: flex;
  gap: 3rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
  justify-content: center;
}

.hero-stat {
  text-align: center;
}

.hero-stat-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--lime);
  display: block;
}

.hero-stat-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 0.3rem;
  display: block;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 2.5rem;
  background: var(--lime);
  color: var(--bg-deep);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.hero-cta::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.hero-cta:hover {
  color: var(--bg-deep);
  box-shadow: 0 0 30px var(--lime-glow-strong), 0 0 60px var(--lime-glow);
  transform: translateY(-2px);
}

.hero-cta:hover::before {
  left: 100%;
}

.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 2px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ─── Story Premise Section ────────────────────────────────── */
.premise-section {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
  text-align: center;
}

.premise-section h2 {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--lime);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.premise-text {
  font-family: var(--font-chapter);
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 2;
  font-weight: 300;
  font-style: italic;
}

.premise-text strong {
  color: var(--text-primary);
  font-weight: 500;
}

.premise-rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
  text-align: left;
}

.rule-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.3s;
}

.rule-card:hover {
  border-color: var(--lime);
  box-shadow: 0 0 20px var(--lime-glow);
}

.rule-card h3 {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  color: var(--lime);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.rule-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ─── Page Container ───────────────────────────────────────── */
.page-container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
}

.page-container.wide {
  max-width: 1100px;
}

/* ─── Chapter Reading View ─────────────────────────────────── */
.chapter-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.chapter-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--lime);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.chapter-title {
  font-family: var(--font-title);
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 1rem;
}

.chapter-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Previous Decision Banner */
.prev-decision {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--emerald);
  border-radius: 6px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 3rem;
}

.prev-decision-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--emerald);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.prev-decision-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.prev-decision-text strong {
  color: var(--text-primary);
}

/* Chapter Content */
.chapter-content {
  font-family: var(--font-chapter);
  font-size: 1.1rem;
  line-height: 2;
  color: var(--text-primary);
  font-weight: 300;
  max-width: 700px;
  margin: 0 auto 4rem;
}

.chapter-content p {
  margin-bottom: 1.5rem;
  text-align: justify;
}

.chapter-content code,
.chapter-content pre {
  font-family: var(--font-mono);
  background: var(--bg-card);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.9rem;
  color: var(--lime);
}

/* ─── Voting Section ───────────────────────────────────────── */
.voting-section {
  max-width: 700px;
  margin: 0 auto;
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

.voting-header {
  text-align: center;
  margin-bottom: 2rem;
}

.voting-header h2 {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--lime);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.voting-header p {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.vote-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.vote-btn {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 2rem 1.5rem;
  cursor: pointer;
  transition: all 0.4s;
  text-align: left;
  overflow: hidden;
}

.vote-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--lime-glow), transparent);
  opacity: 0;
  transition: opacity 0.4s;
}

.vote-btn:hover {
  border-color: var(--lime);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px var(--lime-glow);
}

.vote-btn:hover::before {
  opacity: 1;
}

.vote-btn.voted {
  border-color: var(--lime);
  background: rgba(160, 240, 96, 0.05);
}

.vote-btn.not-chosen {
  opacity: 0.5;
}

.vote-btn-label {
  position: relative;
  z-index: 1;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  color: var(--lime);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
  display: block;
}

.vote-btn-text {
  position: relative;
  z-index: 1;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.6;
  display: block;
}

.vote-bar-container {
  position: relative;
  z-index: 1;
  margin-top: 1rem;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.vote-bar {
  height: 100%;
  background: var(--lime);
  border-radius: 2px;
  transition: width 1s ease;
  width: 0%;
}

.vote-percentage {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--lime);
  margin-top: 0.5rem;
  display: block;
}

/* Countdown Timer */
.countdown {
  text-align: center;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.countdown-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.countdown-timer {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--warning);
  letter-spacing: 3px;
}

.countdown-urgency {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--danger);
  margin-top: 0.5rem;
  letter-spacing: 1px;
}

/* ─── Archive Timeline ─────────────────────────────────────── */
.archive-header {
  text-align: center;
  margin-bottom: 4rem;
}

.archive-header h1 {
  font-family: var(--font-title);
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.5rem;
}

.archive-header p {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.timeline {
  position: relative;
  padding-left: 3rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--lime), var(--border));
}

.timeline-entry {
  position: relative;
  margin-bottom: 2.5rem;
  padding-left: 1.5rem;
}

.timeline-node {
  position: absolute;
  left: -3rem;
  top: 0.5rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 2px solid var(--lime);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--lime);
  z-index: 1;
}

.timeline-entry.active .timeline-node {
  background: var(--lime);
  color: var(--bg-deep);
  box-shadow: 0 0 15px var(--lime-glow-strong);
  animation: pulse-glow 2s infinite;
}

.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s;
}

.timeline-card:hover {
  border-color: var(--lime);
  transform: translateX(5px);
  box-shadow: 0 4px 20px var(--lime-glow);
}

.timeline-card h3 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.timeline-card-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 0.8rem;
}

.timeline-decision {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 0.8rem;
  background: rgba(160, 240, 96, 0.03);
  border-radius: 4px;
  border-left: 2px solid var(--emerald);
}

.timeline-decision strong {
  color: var(--emerald);
}

.timeline-votes {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
}

.timeline-active-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--bg-deep);
  background: var(--lime);
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

/* ─── Chapter Modal (Archive) ──────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(7, 9, 16, 0.92);
  backdrop-filter: blur(10px);
  z-index: 200;
  overflow-y: auto;
  padding: 4rem 2rem;
}

.modal-overlay.active {
  display: block;
}

.modal-content {
  max-width: 750px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem; right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: color 0.3s;
}

.modal-close:hover { color: var(--lime); }

/* ─── Admin Panel ──────────────────────────────────────────── */
.admin-login {
  max-width: 400px;
  margin: 8rem auto;
  text-align: center;
}

.admin-login h1 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--lime);
  letter-spacing: 3px;
  margin-bottom: 2rem;
}

.admin-input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  outline: none;
  transition: border-color 0.3s;
}

.admin-input:focus {
  border-color: var(--lime);
}

.admin-textarea {
  width: 100%;
  min-height: 200px;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  outline: none;
  resize: vertical;
  transition: border-color 0.3s;
}

.admin-textarea:focus {
  border-color: var(--lime);
}

.admin-btn {
  padding: 0.8rem 1.5rem;
  background: var(--lime);
  color: var(--bg-deep);
  border: none;
  border-radius: 6px;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.admin-btn:hover {
  box-shadow: 0 0 20px var(--lime-glow-strong);
  transform: translateY(-1px);
}

.admin-btn.danger {
  background: var(--danger);
}

.admin-btn.secondary {
  background: var(--border);
  color: var(--text-primary);
}

.admin-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.admin-section h2 {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  color: var(--lime);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.admin-chapter-list {
  list-style: none;
}

.admin-chapter-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-chapter-item.active-chapter {
  border-color: var(--lime);
  background: rgba(160, 240, 96, 0.03);
}

.admin-status-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.admin-status-badge.active {
  background: var(--lime);
  color: var(--bg-deep);
}

.admin-status-badge.closed {
  background: var(--border);
  color: var(--text-dim);
}

.admin-alert {
  padding: 1rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.admin-alert.success {
  background: rgba(160, 240, 96, 0.1);
  border: 1px solid var(--lime);
  color: var(--lime);
}

.admin-alert.error {
  background: rgba(255, 68, 102, 0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
}

/* ─── Loading States ───────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 4rem;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 2px;
}

/* ─── 404 Page ─────────────────────────────────────────────── */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.error-page h1 {
  font-family: var(--font-title);
  font-size: 6rem;
  color: var(--lime);
  margin-bottom: 1rem;
}

.error-page p {
  font-family: var(--font-body);
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav {
    padding: 1rem;
  }

  .nav-links {
    gap: 1rem;
  }

  .nav-links a {
    font-size: 0.7rem;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero-stats {
    gap: 1.5rem;
  }

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

  .premise-rules {
    grid-template-columns: 1fr;
  }

  .chapter-content {
    font-size: 1rem;
    line-height: 1.85;
  }

  .modal-content {
    padding: 1.5rem;
  }

  .timeline {
    padding-left: 2.5rem;
  }

  .timeline-entry {
    padding-left: 1rem;
  }

  .countdown-timer {
    font-size: 1.3rem;
  }
}

@media (max-width: 480px) {
  .nav-logo {
    font-size: 0.85rem;
  }

  .nav-links {
    gap: 0.8rem;
  }

  .hero-cta {
    padding: 0.8rem 1.5rem;
    font-size: 0.8rem;
  }

  .admin-chapter-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ─── Fade-in animation ────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }
.fade-in-delay-4 { animation-delay: 0.4s; }
.fade-in-delay-5 { animation-delay: 0.5s; }
