:root {
  --bg-color: #0b0d19;
  --bg-gradient: radial-gradient(circle at 50% 20%, #1f1b3c 0%, #0b0d19 80%);
  --card-bg: rgba(22, 27, 46, 0.75);
  --border-color: rgba(255, 105, 180, 0.25);
  --primary-pink: #ff4d8d;
  --primary-glow: rgba(255, 77, 141, 0.45);
  --cyan-neon: #00f2fe;
  --danger-red: #ff2a5f;
  --danger-glow: rgba(255, 42, 95, 0.5);
  --text-main: #f0f3fc;
  --text-muted: #9aa5ce;
  --accent-gold: #ffbe3b;
  --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;
}

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

body {
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
  position: relative;
  padding-bottom: 120px;
}

#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

.top-bar {
  width: 100%;
  max-width: 900px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  z-index: 10;
}

.version-tag {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--cyan-neon);
  background: rgba(0, 242, 254, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(0, 242, 254, 0.3);
  letter-spacing: 1px;
}

.audio-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.audio-btn:hover {
  background: var(--primary-pink);
  box-shadow: 0 0 12px var(--primary-glow);
}

.container {
  width: 100%;
  max-width: 820px;
  padding: 0 20px;
  z-index: 10;
  animation: fadeIn 0.8s ease forwards;
}

.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 40px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.02);
  margin-top: 15px;
  position: relative;
  overflow: hidden;
}

.glass-card.glitch-border {
  border-color: var(--danger-red);
  box-shadow: 0 0 30px var(--danger-glow);
}

.card-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 20px;
  margin-bottom: 25px;
}

.chapter-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--primary-pink);
  display: inline-block;
  margin-bottom: 8px;
}

.card-title {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, var(--primary-pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.25;
}

.card-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 8px;
}

.story-content {
  font-size: 1.15rem;
  line-height: 1.85;
  color: #e2e8f0;
}

.story-content p {
  margin-bottom: 22px;
}

.highlight-box {
  background: rgba(255, 77, 141, 0.08);
  border-left: 4px solid var(--primary-pink);
  padding: 16px 20px;
  margin: 25px 0;
  border-radius: 0 10px 10px 0;
  font-style: italic;
  color: #fff;
}

.fatal-error-box {
  background: rgba(255, 42, 95, 0.12);
  border-left: 4px solid var(--danger-red);
  padding: 20px;
  margin: 30px 0;
  border-radius: 0 10px 10px 0;
  font-family: var(--font-mono);
}

.fatal-error-box .error-code {
  color: var(--danger-red);
  font-weight: bold;
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.fatal-error-box .bhai-quote {
  font-size: 1.6rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: 1px;
}

.btn-group {
  display: flex;
  gap: 15px;
  margin-top: 35px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-pink);
  color: #ffffff;
  text-decoration: none;
  padding: 14px 28px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow: 0 0 20px var(--primary-glow);
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px var(--primary-pink);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  text-decoration: none;
  padding: 14px 28px;
  border-radius: 10px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.chapter-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 20px;
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.chapter-card:hover {
  border-color: var(--primary-pink);
  transform: translateY(-4px);
  background: rgba(255, 77, 141, 0.05);
}

.chapter-card .num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--cyan-neon);
  margin-bottom: 8px;
}

.chapter-card .title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.chapter-card .status {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Floating Cyber Dock */
.cyber-dock {
  position: fixed;
  bottom: 24px;
  background: rgba(15, 18, 35, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  z-index: 100;
  max-width: 90%;
}

.dock-links {
  display: flex;
  gap: 8px;
}

.dock-item {
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 15px;
  transition: all 0.2s ease;
}

.dock-item:hover, .dock-item.active {
  color: #fff;
  background: rgba(255, 77, 141, 0.2);
  border: 1px solid var(--primary-pink);
}

.bhai-meter-container {
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  padding-left: 20px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.meter-bar {
  width: 90px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.meter-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease, background 0.6s ease;
}

.meter-fill.safe {
  width: 5%;
  background: #00ff88;
}

.meter-fill.danger {
  width: 95%;
  background: var(--danger-red);
  box-shadow: 0 0 10px var(--danger-red);
}

.meter-fill.fatal {
  width: 100%;
  background: var(--accent-gold);
  box-shadow: 0 0 10px var(--accent-gold);
}

/* Glitch Effect Keyframes */
@keyframes glitch {
  0% { transform: translate(0) }
  20% { transform: translate(-3px, 3px) }
  40% { transform: translate(-3px, -3px) }
  60% { transform: translate(3px, 3px) }
  80% { transform: translate(3px, -3px) }
  100% { transform: translate(0) }
}

.glitch-active {
  animation: glitch 0.2s ease infinite;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  .glass-card { padding: 25px 20px; }
  .card-title { font-size: 1.6rem; }
  .story-content { font-size: 1rem; }
  .bhai-meter-container { display: none; }
  .cyber-dock { padding: 8px 16px; bottom: 15px; }
  .dock-item { padding: 5px 10px; font-size: 0.75rem; }
}