/* Recompile — A Time Loop CYOA Webbook */
/* Dark glitch theme, phosphor green accent */

:root {
  --bg-deep: #050708;
  --bg-surface: #0a0d10;
  --bg-card: #141820;
  --bg-hover: #1c222c;
  --text-primary: #d8dce0;
  --text-secondary: #8a9098;
  --text-muted: #555d66;
  --accent: #6cc47e;
  --accent-dim: #3d7a4c;
  --accent-glow: #6cc47e18;
  --border: #222830;
  --code-bg: #080a0e;
  --link: #88d498;
  --link-hover: #b0e8bc;
  --ending-true: #6cc47e;
  --ending-false: #c4a86c;
  --ending-dark: #c46c6c;
  --ending-bittersweet: #8b9ec4;
  --serif: 'Georgia', 'Times New Roman', 'Palatino', serif;
  --sans: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'Consolas', 'Fira Code', 'Courier New', monospace;
  --max-width: 680px;
  --sidebar-width: 240px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 17px;
}

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--serif);
  line-height: 1.85;
  min-height: 100vh;
}

/* Layout */
.book-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 2rem 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sidebar-title {
  font-family: var(--sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.sidebar-subtitle {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--text-primary);
  font-style: italic;
}

.sidebar nav {
  padding: 0 0.75rem;
}

.sidebar nav a {
  display: block;
  padding: 0.55rem 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 0.82rem;
  border-radius: 6px;
  transition: all 0.2s;
  line-height: 1.4;
}

.sidebar nav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar nav a.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.sidebar nav .sc-label {
  display: inline-block;
  width: 2.5rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0.75rem;
}

.nav-note {
  padding: 0 0.75rem;
  font-family: var(--sans);
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-style: italic;
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  font-family: var(--sans);
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.sidebar-footer .sig {
  color: var(--accent-dim);
  font-style: italic;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.chapter {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--accent);
  width: 44px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  align-items: center;
  justify-content: center;
}

/* Typography */
h1 {
  font-family: var(--sans);
  font-size: 1.8rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.02em;
}

h2 {
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 400;
  font-style: italic;
}

p {
  margin-bottom: 1.3rem;
}

.meta {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  line-height: 1.8;
  letter-spacing: 0.03em;
}

/* Narration */
.narration {
  margin-bottom: 2rem;
}

/* Strong / emphasis */
strong {
  color: var(--accent);
  font-weight: 700;
}

em {
  font-style: italic;
}

/* Horizontal rules */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Lists */
ol {
  margin: 1rem 0 1.25rem 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

li::marker {
  color: var(--accent-dim);
}

/* Links */
a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--link-hover);
}

/* Choice buttons */
.choices {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-btn {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.25s;
  line-height: 1.4;
  cursor: pointer;
}

.choice-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-dim);
  color: var(--accent);
  transform: translateX(4px);
}

.start-btn {
  display: inline-block;
  padding: 1rem 3rem;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  border-color: var(--accent-dim);
  color: var(--accent);
}

.start-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(108,196,126,0.15);
}

/* Ending badges */
.ending-badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 2rem;
}

.ending-true {
  color: var(--ending-true);
  background: rgba(108,196,126,0.1);
  border: 1px solid rgba(108,196,126,0.3);
}

.ending-false {
  color: var(--ending-false);
  background: rgba(196,168,108,0.1);
  border: 1px solid rgba(196,168,108,0.3);
}

.ending-dark {
  color: var(--ending-dark);
  background: rgba(196,108,108,0.1);
  border: 1px solid rgba(196,108,108,0.3);
}

.ending-bittersweet {
  color: var(--ending-bittersweet);
  background: rgba(139,158,196,0.1);
  border: 1px solid rgba(139,158,196,0.3);
}

/* Cover page */
.cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 85vh;
  text-align: center;
  padding: 4rem 2rem;
}

.cover h1 {
  font-size: 3rem;
  margin-bottom: 0.3rem;
  letter-spacing: 0.06em;
  font-family: var(--sans);
  font-weight: 900;
  text-transform: uppercase;
}

.cover .cover-subtitle {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.25rem;
}

.cover .author {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 1rem;
  letter-spacing: 0.05em;
}

.cover .epigraph {
  max-width: 440px;
  margin-top: 3rem;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.8;
}

.cover .divider {
  width: 60px;
  height: 1px;
  background: var(--accent-dim);
  margin: 2rem auto;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }

  .menu-toggle {
    display: flex;
  }

  .main-content {
    margin-left: 0;
  }

  .chapter {
    padding: 4rem 1.25rem 4rem;
  }

  h1 { font-size: 1.5rem; }

  .cover h1 { font-size: 2.2rem; }
}

@media (max-width: 500px) {
  html { font-size: 16px; }
  .chapter { padding: 3.5rem 1rem 3rem; }
  .cover h1 { font-size: 1.8rem; }
}

/* Overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
}

.sidebar-overlay.show {
  display: block;
}

/* Print */
@media print {
  .sidebar, .menu-toggle, .choices { display: none; }
  .main-content { margin-left: 0; }
  body { background: white; color: black; }
  h1, strong { color: #333; }
}
