:root {
  color-scheme: light;
  --bg: #fff8ef;
  --fg: #1a1a2e;
  --muted: #4a5568;
  --bolt: #1e90ff;
  --bolt-deep: #0b5fff;
  --gold: #f5a623;
  --card: #ffffff;
  --line: #ffd89a;
  --nav: rgba(255, 248, 239, 0.95);
  --pane: #1a1a2e;
  --tap: 3rem;
  --radius: 1.1rem;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
/* Hide native scrollbar; scrolling still works (wheel/touch/keys) */
html {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* legacy Edge */
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-size: 1.05rem;
  line-height: 1.45;
  position: relative;
  overflow-x: hidden;
}
body > .top,
body > .wrap {
  position: relative;
  z-index: 2;
}
a { color: var(--bolt-deep); text-decoration: none; font-weight: 700; }
a:hover { text-decoration: underline; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 0.75rem; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--nav);
  border-bottom: 3px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand {
  font-weight: 900; letter-spacing: 0.02em; color: var(--fg); font-size: 1.15rem;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--bolt-deep); }
.nav { display: flex; flex-wrap: wrap; gap: 0.35rem 0.85rem; justify-content: flex-end; }
.nav a {
  color: var(--muted); font-weight: 800; font-size: 1rem;
  min-height: 2.75rem; padding: 0.35rem 0.4rem;
  display: inline-flex; align-items: center;
}
.nav a[aria-current="page"] {
  color: var(--bolt-deep);
  text-decoration: underline;
  text-underline-offset: 0.35rem;
}

.wrap { max-width: 64rem; margin: 0 auto; padding: 1.35rem 1rem 3rem; }
.eyebrow {
  letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.75rem;
  color: var(--bolt-deep); margin: 0 0 0.45rem; font-weight: 800;
}
h1 { font-size: clamp(2rem, 7vw, 3rem); line-height: 1.05; margin: 0 0 0.65rem; font-weight: 900; }
h2 { font-size: 1.35rem; margin: 0 0 0.55rem; font-weight: 800; }
.lede { color: var(--muted); font-size: 1.125rem; line-height: 1.5; margin: 0 0 1.15rem; }
.note { color: var(--muted); font-size: 1rem; line-height: 1.45; }
.foot { margin-top: 2rem; color: #7a8499; font-size: 0.9rem; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); min-width: 3rem;
  padding: 0.7rem 1.25rem; border-radius: 999px;
  background: linear-gradient(135deg, #3aa0ff, #0b5fff);
  color: #fff; border: 3px solid #0847c7;
  font-weight: 900; font-size: 1.1rem; cursor: pointer;
  box-shadow: 0 4px 0 #0847c7;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; box-shadow: none; }
.btn-ghost {
  background: #fff;
  color: var(--fg);
  border-color: var(--line);
  box-shadow: 0 4px 0 #e8c078;
}

.hero {
  display: grid; gap: 1.35rem;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  margin-bottom: 1.75rem;
}
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; }
.actions .secondary { font-size: 1rem; }

.shot {
  border-radius: var(--radius); overflow: hidden;
  border: 3px solid var(--line);
  box-shadow: 0 12px 0 rgba(245, 166, 35, 0.35);
  background: #fff;
  aspect-ratio: 3 / 4;
  display: grid; place-items: center;
  padding: 0.5rem;
}
.shot img {
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: center;
}

.comic-placeholder-block {
  margin-top: 0.5rem;
  border-radius: var(--radius);
  border: 3px dashed #ffb84d;
  background: #fff;
  min-height: 12rem;
  display: grid; place-items: center;
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 1.1rem;
}

.grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(4, 1fr);
}
.card {
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 6px 0 rgba(245, 166, 35, 0.25);
}
.card .frame {
  aspect-ratio: 3 / 4;
  background: #1a1a2e;
  display: grid; place-items: center;
  padding: 0.55rem;
  border-bottom: 3px solid var(--line);
}
.card .frame img {
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: center;
}
.card .body { padding: 0.85rem 0.95rem 1rem; flex: 1; }
.card h3 { margin: 0 0 0.25rem; font-size: 1.1rem; font-weight: 900; }
.card .role { color: #c47a00; font-size: 0.8rem; margin: 0 0 0.35rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.4; font-weight: 600; }

/* Reader */
.reader-shell {
  display: flex; flex-direction: column; gap: 0.85rem;
  max-width: 1100px; margin: 0 auto;
}
.reader-bar {
  display: flex; flex-wrap: wrap; gap: 0.65rem;
  align-items: center; justify-content: space-between;
}
.reader-bar .meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem;
  align-items: center; color: var(--muted); font-weight: 800;
}
.reader-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.reader-controls .btn { min-width: 7.5rem; min-height: 3rem; }

#comic-pane {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  min-height: 55vh;
  border-radius: var(--radius);
  border: 4px solid #1a1a2e;
  background: var(--pane);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  touch-action: pan-y;
}
#comic-page {
  max-width: 100%;
  max-height: min(70vh, 820px);
  width: auto; height: auto;
  object-fit: contain;
}
#comic-placeholder {
  color: #c5d0e8;
  text-align: center;
  padding: 2rem 1.25rem;
  max-width: 22rem;
}
#comic-placeholder .ph-art {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}
#comic-placeholder .ph-msg {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
}
.issue-pick {
  background: #fff; color: var(--fg);
  border: 3px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.55rem 0.7rem;
  font-size: 1rem; font-weight: 800;
  min-height: 2.75rem;
}

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 1.125rem; }
  .wrap { padding: 1rem 0.75rem 2.5rem; }
  .brand { font-size: 1rem; }
  .grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  #comic-pane { min-height: 58vh; border-width: 3px; }
  #comic-page { max-height: 58vh; }
  .reader-controls { width: 100%; }
  .reader-controls .btn { flex: 1; min-height: 3.15rem; font-size: 1.15rem; }
  .reader-bar { flex-direction: column; align-items: stretch; }
}
@media (min-width: 901px) {
  .reader-shell.with-side {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto 1fr;
    gap: 0.75rem 0.85rem;
    align-items: center;
  }
}


/* === Electric motion background + scroll rails === */
.fx-root {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.fx-rail {
  position: fixed;
  top: 0;
  bottom: 0;
  width: clamp(2.4rem, 5.5vw, 4.5rem);
  z-index: 1;
  pointer-events: none;
  opacity: 0.88;
  transition: opacity 0.18s ease, filter 0.18s ease, transform 0.18s ease;
}
.fx-rail.is-scrolling {
  opacity: 1;
}
.fx-rail-left { left: 0; }
.fx-rail-right { right: 0; }
.fx-rail-right .fx-rail-inner { transform: scaleX(-1); }
.fx-rail-inner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.fx-rail svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 200%;
  will-change: transform;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.fx-rail svg.is-active {
  opacity: 1;
}
.fx-rail .bolt-stroke {
  fill: none;
  stroke-width: 6.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fx-rail .bolt-core {
  fill: none;
  stroke: #fffef8;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 1;
}

/* DOWN scroll: hot gold → cyan crackle, brighter, wider feel */
.fx-rail.dir-down {
  filter: saturate(1.55) brightness(1.2)
          drop-shadow(0 0 10px rgba(255, 200, 40, 0.85));
}
.fx-rail.dir-down .bolt-stroke {
  filter: drop-shadow(0 0 10px rgba(255, 210, 60, 1))
          drop-shadow(0 0 22px rgba(255, 140, 0, 0.9))
          drop-shadow(0 0 28px rgba(80, 200, 255, 0.75));
}

/* UP scroll: icy violet → pink rise, electric pulse */
.fx-rail.dir-up {
  filter: saturate(1.65) brightness(1.25)
          drop-shadow(0 0 12px rgba(180, 120, 255, 0.95));
}
.fx-rail.dir-up .bolt-stroke {
  filter: drop-shadow(0 0 10px rgba(160, 120, 255, 1))
          drop-shadow(0 0 22px rgba(255, 90, 200, 0.95))
          drop-shadow(0 0 30px rgba(120, 240, 255, 0.85));
}

.fx-rail.dir-down.is-scrolling {
  animation: railPulseDown 0.35s ease-in-out infinite alternate;
}
.fx-rail.dir-up.is-scrolling {
  animation: railPulseUp 0.28s ease-in-out infinite alternate;
}
@keyframes railPulseDown {
  from { filter: saturate(1.4) brightness(1.1) drop-shadow(0 0 8px rgba(255, 200, 40, 0.7)); }
  to   { filter: saturate(1.7) brightness(1.35) drop-shadow(0 0 16px rgba(255, 160, 0, 1)); }
}
@keyframes railPulseUp {
  from { filter: saturate(1.45) brightness(1.15) drop-shadow(0 0 8px rgba(160, 120, 255, 0.75)); }
  to   { filter: saturate(1.85) brightness(1.4) drop-shadow(0 0 18px rgba(255, 90, 220, 1)); }
}

@media (max-width: 640px) {
  .fx-rail { width: 1.45rem; opacity: 0.75; }
  .fx-rail.is-scrolling { opacity: 1; }
  .fx-rail .bolt-stroke { stroke-width: 5; }
  .wrap { padding-left: 1.35rem; padding-right: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) {
  .fx-rail.dir-down.is-scrolling,
  .fx-rail.dir-up.is-scrolling { animation: none; }
}
@media (min-width: 901px) {
  .wrap { padding-left: 3rem; padding-right: 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-root, .fx-rail { display: none !important; }
  body {
    background:
      radial-gradient(800px 420px at 10% -5%, rgba(60, 160, 255, 0.45), transparent 55%),
      radial-gradient(700px 400px at 95% 5%, rgba(255, 90, 180, 0.28), transparent 50%),
      radial-gradient(600px 360px at 50% 100%, rgba(255, 200, 40, 0.4), transparent 55%),
      #fff3d6;
  }
}
