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

:root {
  --bg:      #07070d;
  --text:    #e2d8cc;
  --muted:   #8a7e72;
  --accent:  #c4956a;
  --glow:    rgba(196, 149, 106, 0.08);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.9;
  min-height: 100vh;
  overflow-x: hidden;
}

#canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

nav.sidebar {
  position: fixed;
  left: clamp(1rem, 3vw, 2.5rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.sidebar-line {
  width: 1px;
  height: 2rem;
  background: linear-gradient(to bottom, transparent, rgba(196,149,106,0.25));
}
.sidebar-line.bottom {
  background: linear-gradient(to bottom, rgba(196,149,106,0.25), transparent);
}

.story-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 0.4rem;
  transition: color 0.35s ease;
  line-height: 1;
}
.story-btn:hover { color: var(--text); }
.story-btn.active { color: var(--accent); font-weight: 400; }
.story-btn + .story-btn { border-top: 1px solid rgba(196,149,106,0.12); }

.sidebar-scroll {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sidebar-scroll::-webkit-scrollbar { display: none; }

main {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(3rem, 10vw, 8rem) 2rem clamp(5rem, 12vw, 10rem);
}

.story { display: none; }
.story.active { display: block; }

header {
  text-align: center;
  margin-bottom: 5rem;
  opacity: 0;
  transform: translateY(24px);
  animation: rise 1.4s ease forwards 0.3s;
}

header h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 300;
  line-height: 1.2;
  color: var(--text);
}

header h1 em { font-style: italic; color: var(--accent); }

header .subtitle {
  margin-top: 1rem;
  font-style: italic;
  font-weight: bold;
  color: var(--text);
  font-size: 1rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin: 3.5rem 0;
  opacity: 0.35;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
}
.divider span {
  font-family: 'Inter', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--accent);
}

section {
  margin-bottom: 4rem;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
section.visible { opacity: 1; transform: translateY(0); }

.section-label {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.section-label::after {
  content: '';
  display: inline-block;
  width: 2rem;
  height: 1px;
  background: var(--accent);
  opacity: 0.5;
}

p { margin-bottom: 1.2rem; }
p:last-child { margin-bottom: 0; }

.highlight {
  border-left: 2px solid var(--accent);
  padding: 1.2rem 1.6rem;
  background: var(--glow);
  border-radius: 0 6px 6px 0;
  font-style: italic;
  margin: 2rem 0;
}

footer {
  text-align: center;
  margin-top: 6rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  opacity: 0.4;
}

.lock-panel {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  opacity: 0;
  animation: rise 0.8s ease forwards 0.4s;
}

.lock-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
}

.lock-input {
  background: transparent;
  border: 1px solid rgba(196,149,106,0.3);
  border-radius: 4px;
  padding: 0.6rem 1.2rem;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-align: center;
  width: 240px;
  outline: none;
  transition: border-color 0.3s;
}
.lock-input:focus { border-color: var(--accent); }
.lock-input.error { border-color: #c46a6a; animation: shake 0.3s ease; }

.lock-error {
  font-family: 'Inter', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: #c46a6a;
  opacity: 0;
  transition: opacity 0.3s;
}
.lock-error.visible { opacity: 1; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-6px); }
  75%       { transform: translateX(6px); }
}

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


@media print {
  #canvas, nav.sidebar { display: none; }

  body {
    background: #fff;
    color: #1a1a1a;
    font-size: 9.5pt;
    line-height: 1.6;
  }

  main {
    max-width: 100%;
    padding: 0.5cm 1.5cm;
    margin: 0;
  }

  header h1 {
    font-size: 18pt;
    color: #1a1a1a;
  }

  header h1 em { color: #8a6a45; }

  header .subtitle {
    color: #444;
    font-size: 10pt;
  }

  .section-label {
    color: #8a6a45;
    font-size: 8pt;
    letter-spacing: 0.25em;
  }

  .section-label::after { display: none; }

  .highlight {
    border-left: 2px solid #8a6a45;
    background: none;
    color: #1a1a1a;
  }

  .divider { opacity: 0.2; margin: 0.4rem 0 !important; }

  section { margin-bottom: 0.6rem !important; padding: 0 !important; }

  header { margin-bottom: 0.8rem !important; }

  p { margin-bottom: 0.5rem !important; }

  .highlight { margin: 0.6rem 0 !important; padding: 0.6rem 1rem !important; }

  footer {
    color: #888;
    opacity: 1;
  }

  section {
    opacity: 1;
    transform: none;
  }

  header {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 560px) {
  body {
    display: flex;
    align-items: flex-start;
  }
  nav.sidebar {
    position: sticky;
    top: 0;
    left: unset;
    transform: none;
    height: 100vh;
    flex-shrink: 0;
    width: 2.5rem;
    justify-content: flex-start;
    padding-top: 1rem;
  }
  .sidebar-line { display: none; }
  .sidebar-scroll {
    max-height: calc(100vh - 2rem);
  }
  main {
    flex: 1;
    min-width: 0;
    padding-left: 1rem;
    padding-right: 1.5rem;
    margin: 0;
  }
}
