/* =========================================================
   HEMEL // EPISODE 01 — Manga / Anime style
   ========================================================= */

:root {
  --paper:    #fff8ec;
  --paper-2:  #fff1d6;
  --ink:      #0a0a0a;
  --ink-soft: #1a1a1a;
  --red:      #e63946;
  --red-deep: #b8232e;
  --pink:     #ff3b9a;
  --pink-2:   #ff7ab8;
  --yellow:   #ffd400;
  --yellow-2: #ffec5c;
  --blue:     #2563eb;
  --mint:     #2dd4bf;
  --line:     #0a0a0a;

  --comic:    'Bangers', 'Bowlby One', system-ui, sans-serif;
  --display:  'Bowlby One', 'Bangers', system-ui, sans-serif;
  --tall:     'Bebas Neue', Impact, system-ui, sans-serif;
  --jp:       'RocknRoll One', 'Bowlby One', system-ui, sans-serif;
  --body:     'Inter', system-ui, -apple-system, sans-serif;

  --ease:     cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --pad-x:    clamp(20px, 5vw, 80px);
  --border:   3px solid var(--ink);
  --border-thick: 5px solid var(--ink);
  --shadow:   6px 6px 0 var(--ink);
  --shadow-lg: 10px 10px 0 var(--ink);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 500;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Paper texture + subtle halftone field over the whole page */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    radial-gradient(rgba(10,10,10,0.07) 1px, transparent 1.2px);
  background-size: 5px 5px;
  mix-blend-mode: multiply;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.18) 100%);
}

::selection { background: var(--yellow); color: var(--ink); }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
strong { font-weight: 800; color: var(--red); }
em { font-style: italic; color: var(--pink); font-weight: 600; }

/* =========================================================
   Scotch-tape decorations on the page corners
   ========================================================= */
.page-tape {
  position: fixed;
  width: 90px; height: 22px;
  background: rgba(255, 212, 0, 0.55);
  border: 1px solid rgba(0,0,0,0.15);
  z-index: 70;
  pointer-events: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.page-tape--tl { top: 14px;    left: -22px;  transform: rotate(-40deg); }
.page-tape--tr { top: 14px;    right: -22px; transform: rotate(40deg);  }
.page-tape--bl { bottom: 14px; left: -22px;  transform: rotate(40deg);  }
.page-tape--br { bottom: 14px; right: -22px; transform: rotate(-40deg); }
@media (max-width: 720px) {
  .page-tape { width: 70px; }
}

/* =========================================================
   Custom cursor + sparkle layer
   ========================================================= */
.cursor {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 9999;
  width: 18px; height: 18px;
  transform: translate(-50%, -50%);
}
.cursor__dot {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 2px var(--ink);
  transition: transform .15s var(--ease), background-color .2s var(--ease);
}
.cursor.is-hover-link .cursor__dot {
  background: var(--red);
  transform: scale(1.7);
}
.cursor.is-hover-cta .cursor__dot {
  background: var(--pink);
  transform: scale(2.4);
}
.cursor.is-hover-card .cursor__dot {
  background: var(--yellow);
  transform: scale(3);
}
@media (hover: none) { .cursor { display: none; } body { cursor: auto; } }

.sparkle-layer {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9998;
  overflow: hidden;
}
.sparkle {
  position: absolute;
  font-family: var(--comic);
  color: var(--ink);
  pointer-events: none;
  text-shadow: 1px 1px 0 var(--paper);
  user-select: none;
  will-change: transform, opacity;
}

/* =========================================================
   LOADER — manga title page
   ========================================================= */
.loader {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at center, var(--paper) 0%, var(--paper-2) 70%, #f0d9a0 100%);
  z-index: 1000;
  display: grid; place-items: center;
  transition: opacity .6s var(--ease), transform 1.1s var(--ease);
}
.loader.is-hidden {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}
/* Loader background: speed lines */
.loader::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-conic-gradient(from 0deg at 50% 50%,
      transparent 0deg 4deg,
      rgba(10,10,10,0.08) 4deg 5deg);
  opacity: .7;
}
.loader__inner {
  position: relative;
  text-align: center;
  padding: 40px;
}
.loader__small {
  font-family: var(--tall);
  letter-spacing: .5em;
  font-size: 14px;
  background: var(--ink);
  color: var(--paper);
  padding: 6px 16px 4px;
  display: inline-block;
  margin-bottom: 24px;
  transform: rotate(-2deg);
}
.loader__big {
  font-family: var(--display);
  font-size: clamp(80px, 18vw, 200px);
  line-height: .9;
  color: var(--ink);
  letter-spacing: .02em;
  text-shadow:
    6px 6px 0 var(--red),
    12px 12px 0 var(--pink);
  transform: rotate(-3deg);
}
.loader__sub {
  margin-top: 28px;
  font-family: var(--tall);
  font-size: clamp(16px, 1.8vw, 22px);
  letter-spacing: .35em;
  color: var(--ink);
}
.loader__progress {
  margin: 28px auto 14px;
  width: min(360px, 70vw);
  height: 10px;
  border: var(--border);
  background: var(--paper);
  position: relative;
  box-shadow: var(--shadow);
}
.loader__progress span {
  position: absolute;
  inset: 0;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .15s linear;
}
.loader__hint {
  font-family: var(--tall);
  letter-spacing: .35em;
  font-size: 12px;
  color: var(--ink-soft);
  animation: blink 1.2s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.loader__sparkle {
  position: absolute;
  font-family: var(--comic);
  color: var(--red);
  font-size: 40px;
  animation: spin 3s linear infinite;
}
.loader__sparkle--1 { top: -10px;  left:  10%; color: var(--red);   font-size: 48px; }
.loader__sparkle--2 { top:  20%;   right: 5%;  color: var(--pink);  font-size: 36px; animation-duration: 4s; }
.loader__sparkle--3 { bottom: 20%; left:  6%;  color: var(--yellow);font-size: 50px; animation-duration: 5s; }
.loader__sparkle--4 { bottom: -5%; right: 12%; color: var(--blue);  font-size: 42px; animation-duration: 3.5s; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* =========================================================
   TOPBAR
   ========================================================= */
.topbar {
  position: fixed;
  top: 18px; left: 18px; right: 18px;
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--tall);
  letter-spacing: .25em;
  font-size: 13px;
  border: var(--border);
  box-shadow: var(--shadow);
}
.topbar__brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px;
}
.topbar__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--paper);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(.6); }
}
.topbar__divider { color: var(--red); }
.topbar__ep { color: var(--yellow); }
.topbar__nav { display: flex; gap: 22px; }
.topbar__nav a { position: relative; transition: color .2s ease; }
.topbar__nav a:hover { color: var(--yellow); }
.topbar__time { font-variant-numeric: tabular-nums; color: var(--yellow); }
@media (max-width: 860px) {
  .topbar__nav { display: none; }
}

/* =========================================================
   PAGE / PANELS
   ========================================================= */
.page {
  position: relative;
  z-index: 3;
  padding: 100px var(--pad-x) 60px;
  display: flex;
  flex-direction: column;
  gap: 80px;
}
.panel {
  position: relative;
  background: var(--paper);
  border: var(--border-thick);
  box-shadow: var(--shadow-lg);
  padding: clamp(28px, 5vw, 60px);
  overflow: hidden;
  min-height: 60vh;
}

/* =========================================================
   HALFTONE + SPEED LINES (decorative bg layers)
   ========================================================= */
.halftone {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--ink) 2px, transparent 2.3px);
  background-size: 12px 12px;
  opacity: 0.18;
  mask-image: radial-gradient(ellipse at top right, black 0%, transparent 60%);
  -webkit-mask-image: radial-gradient(ellipse at top right, black 0%, transparent 60%);
}
.halftone--hero { background-size: 14px 14px; opacity: .22; }

.speed-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-conic-gradient(from 0deg at 70% 50%,
      transparent 0deg 3deg,
      rgba(10,10,10,0.18) 3deg 4deg,
      transparent 4deg 7deg);
  mask-image: radial-gradient(ellipse at 70% 50%, transparent 12%, black 35%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 50%, transparent 12%, black 35%, transparent 75%);
  animation: speedSpin 60s linear infinite;
}
@keyframes speedSpin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}

/* =========================================================
   SOUND-EFFECT (SFX) TEXT
   ========================================================= */
.sfx {
  font-family: var(--comic);
  font-weight: 400;
  color: var(--yellow);
  -webkit-text-stroke: 2px var(--ink);
  text-stroke: 2px var(--ink);
  text-shadow: 5px 5px 0 var(--ink);
  user-select: none;
  pointer-events: none;
  line-height: .9;
  letter-spacing: .04em;
  transform-origin: center;
  filter: drop-shadow(0 0 1px var(--ink));
}
.sfx--dramatic {
  position: absolute;
  top: 22%; right: 6%;
  font-size: clamp(36px, 7vw, 96px);
  color: var(--red);
  transform: rotate(8deg);
  z-index: 5;
}
.sfx--boom {
  font-size: clamp(40px, 6vw, 90px);
  color: var(--yellow);
  transform: rotate(-5deg);
}
.sfx--pow {
  font-size: clamp(34px, 5.5vw, 80px);
  color: var(--pink);
  transform: rotate(7deg);
}
.sfx--zap {
  font-size: clamp(30px, 5vw, 70px);
  color: var(--mint);
  transform: rotate(-9deg);
}
.sfx--star { font-size: 60px; color: var(--yellow); }
.sfx--kira { font-size: 50px; color: var(--pink); transform: rotate(15deg); }
.sfx--gasp { font-size: clamp(28px, 4vw, 50px); color: var(--blue); transform: rotate(-10deg); }
.sfx--doki { font-size: clamp(26px, 3.5vw, 44px); color: var(--red); transform: rotate(5deg); text-align: center; }
.sfx--wow  { font-size: clamp(32px, 4.5vw, 60px); color: var(--yellow); transform: rotate(-6deg); }
.sfx--zoom { font-size: clamp(40px, 7vw, 100px); color: var(--pink); transform: rotate(-10deg); }

/* =========================================================
   SPEECH BUBBLES
   ========================================================= */
.speech {
  position: relative;
  background: var(--paper);
  border: var(--border);
  border-radius: 28px;
  padding: 22px 26px;
  box-shadow: var(--shadow);
  font-family: var(--body);
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.45;
  z-index: 3;
}
.speech__body p { margin-bottom: 12px; }
.speech__body p:last-child { margin-bottom: 0; }
.speech__tail {
  position: absolute;
  bottom: -20px;
  right: 60px;
  width: 36px; height: 36px;
  background: var(--paper);
  border-right: var(--border);
  border-bottom: var(--border);
  transform: rotate(45deg);
}
.speech__tail--left { right: auto; left: 60px; }

.speech--hero {
  max-width: 380px;
  margin-top: 24px;
  transform: rotate(-1deg);
}
.speech--big {
  padding: 36px 42px;
  font-family: var(--body);
  font-size: clamp(17px, 1.4vw, 22px);
  line-height: 1.5;
  border-width: 4px;
}
.speech--big p { margin-bottom: 16px; }
.speech--small {
  display: inline-block;
  padding: 14px 22px;
  font-size: 16px;
  margin-bottom: 36px;
  transform: rotate(-1.5deg);
}
.speech__corner {
  position: absolute;
  top: -16px;
  right: 20px;
  background: var(--red);
  color: var(--paper);
  padding: 4px 12px;
  font-family: var(--tall);
  letter-spacing: .25em;
  font-size: 13px;
  border: var(--border);
  transform: rotate(3deg);
}

/* =========================================================
   STICKERS (CTA buttons)
   ========================================================= */
.sticker {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 18px 28px;
  background: var(--pink);
  color: var(--ink);
  border: var(--border);
  border-radius: 50px;
  font-family: var(--display);
  font-size: clamp(16px, 1.5vw, 22px);
  letter-spacing: .04em;
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  position: relative;
  transform: rotate(-2deg);
  will-change: transform;
}
.sticker:hover {
  transform: rotate(0deg) translate(-2px, -2px);
  box-shadow: 10px 10px 0 var(--ink);
}
.sticker:active {
  transform: rotate(-1deg) translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--ink);
}
.sticker--cta { background: var(--pink); color: var(--ink); font-size: clamp(20px, 1.8vw, 28px); padding: 22px 36px; }
.sticker--ig   { background: var(--pink); }
.sticker--tt   { background: var(--mint);   transform: rotate(2deg); }
.sticker--fb   { background: var(--blue);   color: var(--paper); transform: rotate(-1deg); }
.sticker--mail { background: var(--yellow); transform: rotate(1.5deg); }

/* =========================================================
   HERO (PANEL 01)
   ========================================================= */
.hero {
  min-height: 90svh;
  background: var(--paper);
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(20px, 4vw, 60px);
  align-items: center;
}
/* The title is sized against THIS box, not the viewport — it sits in a
   1.2fr column, so a vw-based size overflowed and (because splitChars
   makes every letter inline-block) broke one character per line. */
.hero__title-wrap {
  position: relative;
  z-index: 3;
  container-type: inline-size;
}

/* The decorative SFX were never taken out of flow, so they were being
   auto-placed as grid items and consuming the hero's two columns —
   which pushed the title into column 2 and the photo down to row 3.
   Scoped to .hero so the BGM / gallery SFX keep their own rules. */
.hero > .sfx {
  position: absolute;
  z-index: 5;
}
.hero > .sfx--boom { top: 8%;  left: 5%; }
.hero > .sfx--kira { top: 74%; left: 42%; }
.hero > .sfx--star { top: 6%;  left: 40%; }
.hero__episode {
  display: inline-flex; align-items: center; gap: 14px;
  margin-bottom: 12px;
}
.hero__ep-num {
  background: var(--ink);
  color: var(--yellow);
  font-family: var(--display);
  font-size: 28px;
  padding: 4px 14px 2px;
  transform: rotate(-3deg);
}
.hero__ep-label {
  font-family: var(--tall);
  letter-spacing: .35em;
  font-size: 14px;
}
.hero__title {
  font-family: var(--display);
  white-space: nowrap;              /* never break between the char spans */
  font-size: clamp(56px, 11vw, 200px);   /* fallback */
  font-size: clamp(56px, 24cqw, 200px);  /* sized to the column */
  line-height: .85;
  letter-spacing: .02em;
  color: var(--ink);
  text-shadow:
    6px 6px 0 var(--red),
    12px 12px 0 var(--pink),
    18px 18px 0 var(--yellow);
  transform: rotate(-2deg);
  margin-bottom: 30px;
  overflow: visible;
}
.hero__title .char {
  display: inline-block;
  transform: translateY(110%);
  will-change: transform;
}
.hero__credit {
  margin-top: 28px;
  display: flex; flex-direction: column;
  gap: 4px;
  font-family: var(--tall);
  letter-spacing: .25em;
  font-size: 12px;
  color: var(--ink-soft);
}
.hero__credit-by { color: var(--red); }

.hero__photo {
  position: relative;
  justify-self: end;
  width: 100%;
  max-width: 480px;
  z-index: 3;
}
.hero__photo-stamp {
  position: absolute;
  top: -20px; left: -20px;
  background: var(--red);
  color: var(--paper);
  font-family: var(--display);
  padding: 12px 18px;
  border: var(--border);
  border-radius: 50%;
  width: 100px; height: 100px;
  display: grid; place-items: center;
  text-align: center;
  font-size: 13px;
  letter-spacing: .1em;
  transform: rotate(-15deg);
  box-shadow: var(--shadow);
  z-index: 4;
}

.jagged-frame {
  position: relative;
  background: var(--ink);
  padding: 12px;
  border: var(--border-thick);
  box-shadow: var(--shadow-lg);
  transform: rotate(2deg);
  /* zig-zag torn edge top */
  clip-path: polygon(
    0% 4%, 5% 0%, 10% 4%, 15% 0%, 20% 4%, 25% 0%, 30% 4%, 35% 0%, 40% 4%, 45% 0%, 50% 4%, 55% 0%, 60% 4%, 65% 0%, 70% 4%, 75% 0%, 80% 4%, 85% 0%, 90% 4%, 95% 0%, 100% 4%,
    100% 100%, 0% 100%
  );
}
.jagged-frame img {
  width: 100%; aspect-ratio: 3/4; object-fit: cover;
  filter: grayscale(.85) contrast(1.25) brightness(.95);
}
.jagged-frame__caption {
  position: absolute;
  bottom: 12px; left: 12px; right: 12px;
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: 6px 10px;
  font-family: var(--tall);
  letter-spacing: .2em;
  font-size: 12px;
  color: var(--ink);
}

.scroll-hint {
  position: absolute;
  bottom: 18px; left: var(--pad-x);
  display: inline-flex; flex-direction: column; align-items: center;
  gap: 6px;
  font-family: var(--tall);
  letter-spacing: .25em;
  font-size: 12px;
  color: var(--ink);
  z-index: 5;
}
.scroll-hint__arrow {
  font-size: 18px;
  animation: bounce 1.4s ease-in-out infinite;
  color: var(--red);
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero__photo { justify-self: center; max-width: 360px; }
  .sfx--dramatic { right: 4%; top: 4%; }
}

/* =========================================================
   CHAPTER HEAD (used in panels 2-5)
   ========================================================= */
.chapter-head {
  margin-bottom: clamp(28px, 4vw, 56px);
  position: relative;
  z-index: 3;
}
.chapter-head__num {
  display: inline-block;
  background: var(--ink);
  color: var(--yellow);
  font-family: var(--tall);
  letter-spacing: .3em;
  font-size: 14px;
  padding: 6px 14px 4px;
  transform: rotate(-2deg);
  margin-bottom: 16px;
}
.chapter-head__title {
  font-family: var(--display);
  font-size: clamp(40px, 8vw, 120px);
  line-height: .9;
  letter-spacing: .02em;
  color: var(--ink);
}
.chapter-head__title span {
  display: inline-block;
  margin-right: .35em;
}
.chapter-head__title em {
  font-style: normal;
  color: var(--red);
  font-family: var(--display);
  text-shadow: 4px 4px 0 var(--ink);
}
.chapter-head__line {
  margin-top: 14px;
  width: 0;
  height: 6px;
  background: var(--ink);
  box-shadow: 4px 4px 0 var(--red);
}

/* =========================================================
   ABOUT — speech bubble + mini panel + stats
   ========================================================= */
.about__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(24px, 4vw, 60px);
  align-items: start;
  position: relative;
  z-index: 3;
}
.mini-panel {
  position: relative;
  background: var(--ink);
  padding: 10px;
  border: var(--border-thick);
  box-shadow: var(--shadow);
  transform: rotate(3deg);
}
.mini-panel__media {
  overflow: hidden;
  border: 2px solid var(--paper);
}
.mini-panel__media img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  filter: grayscale(1) contrast(1.3) brightness(.9);
}
.mini-panel__caption {
  margin-top: 10px;
  font-family: var(--body);
  font-size: 14px;
  color: var(--paper);
  text-align: center;
  font-style: italic;
}
.mini-panel__stamp {
  position: absolute;
  top: -14px; right: -14px;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--display);
  font-size: 14px;
  padding: 6px 12px;
  border: var(--border);
  transform: rotate(12deg);
  box-shadow: var(--shadow);
}

.about__zoom {
  position: absolute;
  bottom: 6%;
  right: 4%;
  z-index: 4;
}

@media (max-width: 860px) {
  .about__grid { grid-template-columns: 1fr; }
  .mini-panel { max-width: 320px; margin: 0 auto; }
  /* Once the stats stack they reach the panel floor, so give ZOOOM!
     its own room instead of letting it land on top of them. */
  .about { padding-bottom: 110px; }
  .about__zoom { bottom: 24px; }
}

.stats {
  margin-top: clamp(40px, 5vw, 80px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  position: relative;
  z-index: 3;
}
.stat {
  background: var(--paper);
  border: var(--border);
  padding: 22px 18px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease);
}
.stat:nth-child(1) { transform: rotate(-1deg); }
.stat:nth-child(2) { transform: rotate(1deg);  }
.stat:nth-child(3) { transform: rotate(-1.5deg); }
.stat:nth-child(4) { transform: rotate(1.2deg); }
.stat:hover { transform: rotate(0) scale(1.05); }
.stat__num {
  font-family: var(--display);
  font-size: clamp(36px, 4.5vw, 60px);
  line-height: 1;
  color: var(--red);
  text-shadow: 3px 3px 0 var(--ink);
}
.stat__num i { font-style: normal; font-size: .55em; color: var(--ink); }
.stat__label {
  margin-top: 8px;
  font-family: var(--tall);
  letter-spacing: .25em;
  font-size: 12px;
  color: var(--ink-soft);
}
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* =========================================================
   GALLERY — manga panel grid
   ========================================================= */
.manga-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 130px;
  gap: 14px;
  position: relative;
  z-index: 3;
}
.frame {
  position: relative;
  background: var(--ink);
  padding: 8px 8px 36px;
  border: var(--border-thick);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .25s var(--ease);
  will-change: transform;
}
.frame--big  { grid-column: span 4; grid-row: span 4; transform: rotate(-1deg); }
.frame--tall { grid-column: span 2; grid-row: span 4; transform: rotate(1.5deg); }
.frame--wide { grid-column: span 6; grid-row: span 3; transform: rotate(-0.5deg); }
.frame:hover { transform: rotate(0deg) translate(-3px, -3px); box-shadow: var(--shadow-lg); }
.frame__media {
  position: absolute;
  inset: 8px 8px 36px 8px;
  overflow: hidden;
  border: 2px solid var(--paper);
}
.frame__media img,
.frame__media video {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.3) brightness(.92);
  transition: transform .8s var(--ease), filter .5s var(--ease);
}
.frame:hover .frame__media img,
.frame:hover .frame__media video {
  transform: scale(1.06);
  filter: grayscale(.5) contrast(1.25) brightness(1);
}
.frame__cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--paper);
  border-top: 2px solid var(--ink);
  padding: 8px 14px;
  font-family: var(--tall);
  font-size: 12px;
  letter-spacing: .2em;
  color: var(--ink);
}
.frame__num { color: var(--red); margin-right: 6px; }
.frame__sfx {
  position: absolute;
  z-index: 4;
  pointer-events: none;
}
.frame--big .frame__sfx  { top: 16px; right: 16px; }
.frame--tall .frame__sfx { bottom: 50px; left: 50%; transform: translateX(-50%) rotate(-5deg); }
.frame--wide .frame__sfx { top: 14px; right: 16px; }

@media (max-width: 900px) {
  .manga-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 180px; }
  .frame--big  { grid-column: span 2; grid-row: span 3; }
  .frame--tall { grid-column: span 1; grid-row: span 3; }
  .frame--wide { grid-column: span 2; grid-row: span 2; }
}

/* =========================================================
   BGM — tape + waveform + sfx
   ========================================================= */
.bgm__stage {
  position: relative;
  display: grid;
  gap: 36px;
  justify-items: center;
  text-align: center;
  z-index: 3;
}
.bgm__tape {
  position: relative;
  width: min(560px, 90vw);
  aspect-ratio: 2/1;
  background: var(--yellow);
  border: var(--border-thick);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 30px;
  gap: 40px;
  transform: rotate(-2deg);
}
.bgm__reel {
  position: relative;
  width: 100%; aspect-ratio: 1;
  border-radius: 50%;
  background: var(--ink);
  border: 4px solid var(--paper);
  box-shadow: inset 0 0 0 14px var(--ink-soft), inset 0 0 0 18px var(--paper);
  animation: spin 6s linear infinite;
  animation-play-state: paused;
}
body.bgm-on .bgm__reel { animation-play-state: running; }
.bgm__reel div {
  position: absolute;
  top: 50%; left: 50%;
  width: 8px; height: 8px;
  background: var(--paper);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow:
     0  -22px 0 var(--paper),
     22px 0   0 var(--paper),
     0   22px 0 var(--paper),
    -22px 0   0 var(--paper);
}
.bgm__tape-strip {
  position: absolute;
  top: 50%;
  left: -8%; right: -8%;
  height: 24px;
  background: var(--ink);
  border-top: 3px solid var(--paper);
  border-bottom: 3px solid var(--paper);
  transform: translateY(-50%);
  z-index: -1;
}
.bgm__tape-label {
  position: absolute;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  background: var(--paper);
  border: var(--border);
  padding: 4px 12px;
  font-family: var(--tall);
  letter-spacing: .2em;
  font-size: 12px;
}

.waveform {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 120px;
  width: 100%;
  max-width: 720px;
}
.waveform i {
  flex: 1;
  background: var(--red);
  border: 1.5px solid var(--ink);
  height: 8px;
  border-radius: 3px 3px 0 0;
  transition: height .08s linear, background-color .2s ease;
}
.waveform i:nth-child(odd)  { background: var(--pink); }
.waveform i:nth-child(3n)   { background: var(--yellow); }
.waveform i:nth-child(5n)   { background: var(--mint); }

.bgm__sfx { position: absolute; z-index: 4; }
.bgm__sfx--1 { top: 10%;  left: 6%;   }
.bgm__sfx--2 { top: 22%;  right: 8%;  }
.bgm__sfx--3 { bottom: 28%; left: 8%; }
.bgm__sfx--4 { bottom: 16%; right: 10%; font-size: 60px; color: var(--yellow); }

.bgm__hint {
  font-family: var(--tall);
  letter-spacing: .25em;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  padding: 8px 16px;
  border: var(--border);
  transform: rotate(-1deg);
  box-shadow: var(--shadow);
}

/* =========================================================
   TALK — stickers grid + end card
   ========================================================= */
.talk__speech { margin-bottom: 36px; }
.stickers {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  position: relative;
  z-index: 3;
}
.stickers .sticker {
  font-size: clamp(18px, 1.6vw, 24px);
  padding: 16px 28px;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  line-height: 1;
}
.stickers .sticker em {
  font-family: var(--body);
  font-size: 11px;
  font-style: normal;
  letter-spacing: .25em;
  color: rgba(10,10,10,0.7);
  text-transform: uppercase;
}
.sticker--fb em { color: rgba(255,248,236,0.85); }

.endcard {
  margin-top: 80px;
  text-align: center;
  position: relative;
  z-index: 3;
}
.endcard__tbc {
  font-family: var(--display);
  font-size: clamp(24px, 3vw, 38px);
  letter-spacing: .04em;
  color: var(--ink);
  text-shadow: 3px 3px 0 var(--pink);
  margin-bottom: 30px;
  transform: rotate(-2deg);
  display: inline-block;
}
.endcard__stamp {
  display: inline-grid;
  place-items: center;
  width: clamp(160px, 22vw, 260px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 8px solid var(--red);
  color: var(--red);
  font-family: var(--display);
  font-size: clamp(54px, 9vw, 110px);
  letter-spacing: .04em;
  margin: 0 auto 30px;
  transform: rotate(-8deg);
  filter: drop-shadow(0 0 0 var(--red));
  position: relative;
}
.endcard__stamp::before {
  content: '';
  position: absolute;
  inset: -14px;
  border: 2px dashed var(--red);
  border-radius: 50%;
  opacity: .6;
}
.endcard__stamp-inner { line-height: 1; }
.endcard__credit {
  margin-top: 30px;
  font-family: var(--tall);
  letter-spacing: .3em;
  font-size: 12px;
  color: var(--ink-soft);
}

/* =========================================================
   MUSIC BUTTON
   ========================================================= */
.music-btn {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 70;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--pink);
  color: var(--ink);
  border: var(--border);
  border-radius: 999px;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: .05em;
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.music-btn:hover {
  transform: translate(-2px, -2px) rotate(-2deg);
  box-shadow: 10px 10px 0 var(--ink);
}
.music-btn__icon--pause { display: none; }
.music-btn.is-playing { background: var(--yellow); }
.music-btn.is-playing .music-btn__icon--play  { display: none; }
.music-btn.is-playing .music-btn__icon--pause { display: inline-block; }
.music-btn__bars {
  display: inline-flex; align-items: flex-end; gap: 2px; height: 16px;
}
.music-btn__bars i {
  width: 3px; background: var(--ink);
  height: 4px; border-radius: 1px;
}
.music-btn.is-playing .music-btn__bars i { animation: mb 1s ease-in-out infinite; }
.music-btn.is-playing .music-btn__bars i:nth-child(2) { animation-delay: .15s; }
.music-btn.is-playing .music-btn__bars i:nth-child(3) { animation-delay: .3s; }
@keyframes mb { 0%, 100% { height: 4px; } 50% { height: 16px; } }

/* =========================================================
   DAY / NIGHT — swap paper & ink for a night chapter
   ========================================================= */
html.night {
  --paper:    #161320;
  --paper-2:  #211c30;
  --ink:      #fff3e0;
  --ink-soft: #cdbfae;
  --line:     #fff3e0;
}
html, body { transition: background-color .4s ease, color .4s ease; }
.panel, .topbar { transition: background-color .4s ease, border-color .4s ease, color .4s ease; }

.topbar__right { display: flex; align-items: center; gap: 14px; }
.topbar__toggle {
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  transition: transform .2s var(--ease);
}
.topbar__toggle:hover { transform: scale(1.25) rotate(-12deg); }

/* =========================================================
   EXTRAS — super mode, progress bar, unlock toasts
   ========================================================= */

/* --- Reading-progress brush bar --- */
.read-bar {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 6px;
  z-index: 80;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, var(--red), var(--pink), var(--yellow));
  border-bottom: 2px solid var(--ink);
  will-change: transform;
}

/* --- Konami SUPER MODE --- */
body.super-mode .page {
  animation: superHue 1.1s linear infinite, superShake .32s linear infinite;
}
@keyframes superHue {
  to { filter: hue-rotate(360deg) saturate(1.5); }
}
@keyframes superShake {
  0%, 100% { transform: translate(0, 0); }
  25%      { transform: translate(-5px, 3px); }
  50%      { transform: translate(4px, -4px); }
  75%      { transform: translate(-3px, -2px); }
}
.super-banner {
  position: fixed;
  inset: 0;
  z-index: 9996;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-family: var(--comic);
  font-size: clamp(48px, 13vw, 180px);
  color: var(--yellow);
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 8px 8px 0 var(--red), 16px 16px 0 var(--pink);
  text-align: center;
  animation: superBanner .9s var(--ease-out) infinite alternate;
}
@keyframes superBanner {
  from { transform: scale(.9) rotate(-4deg); }
  to   { transform: scale(1.08) rotate(4deg); }
}

/* --- "PANEL XX UNLOCKED" toasts --- */
.unlock-host {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 75;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
}
.unlock-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--paper);
  border: var(--border);
  box-shadow: var(--shadow);
  padding: 10px 16px;
  transform: translateX(-120%) rotate(-2deg);
  opacity: 0;
  transition: transform .45s var(--ease-out), opacity .3s ease;
}
.unlock-toast.is-in {
  transform: translateX(0) rotate(-2deg);
  opacity: 1;
}
.unlock-toast__tag {
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--tall);
  letter-spacing: .2em;
  font-size: 11px;
  padding: 3px 8px;
}
.unlock-toast__label {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: .03em;
  color: var(--yellow);
}
@media (max-width: 720px) {
  .unlock-host { left: 12px; bottom: 12px; }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .hero__title .char { transform: none !important; }
}

/* =========================================================
   FX LAYER — depth, velocity reaction, ambience
   Added by fx.js. Uses the individual `translate` / `scale`
   properties so it composes with (never overwrites) the
   `transform` values GSAP and :hover rules already write.
   ========================================================= */

/* Parallax carrier. --py / --ps are driven by ScrollTrigger. */
.fx-par {
  translate: 0 var(--py, 0px);
  scale: var(--ps, 1);
}

/* ---------- Film grain ---------------------------------- */
.fx-grain {
  position: fixed;
  inset: -120px;
  z-index: 4;
  pointer-events: none;
  opacity: .30;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  animation: grainShift .6s steps(1) infinite;
}
@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-14px, 8px); }
  40%  { transform: translate(10px, -12px); }
  60%  { transform: translate(-8px, -6px); }
  80%  { transform: translate(12px, 10px); }
  100% { transform: translate(0, 0); }
}
html.night .fx-grain { mix-blend-mode: screen; opacity: .16; }

/* ---------- Velocity motion blur ------------------------ */
/* --vblur is written by fx.js from scroll velocity. */
.manga-grid .frame,
.mini-panel,
.jagged-frame {
  filter: blur(var(--vblur, 0px));
}

/* Chromatic split on the big display type while moving fast.
   The hero keeps its layered red/pink/yellow stack — the split
   is added in front of it, not in place of it. */
.chapter-head__title {
  text-shadow:
    calc(var(--vshift, 0px) * -1) 0 0 var(--red),
    var(--vshift, 0px) 0 0 var(--mint);
}
.hero__title {
  text-shadow:
    calc(var(--vshift, 0px) * -1) 0 0 var(--mint),
    var(--vshift, 0px) 0 0 var(--blue),
    6px 6px 0 var(--red),
    12px 12px 0 var(--pink),
    18px 18px 0 var(--yellow);
}

/* ---------- Marquee ticker strip ------------------------ */
.ticker {
  position: relative;
  z-index: 3;
  overflow: hidden;
  background: var(--yellow);
  border-top: var(--border);
  border-bottom: var(--border);
  padding: 10px 0;
  rotate: -1.1deg;
  box-shadow: var(--shadow);
  user-select: none;
}
.ticker--alt { background: var(--pink); rotate: .9deg; }
.ticker--alt .ticker__track { animation-direction: reverse; }
.ticker__track {
  display: flex;
  width: max-content;
  gap: 40px;
  padding-right: 40px;
  animation: tickerRun 26s linear infinite;
}
.ticker:hover .ticker__track { animation-play-state: paused; }
.ticker__item {
  font-family: var(--comic);
  font-size: clamp(20px, 2.4vw, 34px);
  letter-spacing: .06em;
  color: var(--ink);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 40px;
}
.ticker__item i { font-style: normal; color: var(--red); }
@keyframes tickerRun {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

/* ---------- Cursor trailing ring ------------------------ */
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  opacity: .55;
  transition: width .25s var(--ease), height .25s var(--ease),
              margin .25s var(--ease), background-color .25s var(--ease),
              opacity .25s var(--ease);
}
.cursor-ring.is-wide {
  width: 78px; height: 78px; margin: -39px 0 0 -39px;
  background: rgba(255, 212, 0, .18);
}
.cursor-ring.is-down { width: 30px; height: 30px; margin: -15px 0 0 -15px; opacity: 1; }
@media (hover: none) { .cursor-ring { display: none; } }

/* ---------- Hover shine sweep --------------------------- */
.frame::after,
.sticker::after {
  content: '';
  position: absolute;
  top: -60%; bottom: -60%;
  left: -140%;
  width: 55%;
  background: linear-gradient(100deg,
    transparent, rgba(255, 255, 255, .75), transparent);
  transform: rotate(14deg);
  pointer-events: none;
  z-index: 6;
}
.frame:hover::after,
.sticker:hover::after { animation: shineSweep .85s var(--ease-out) forwards; }
@keyframes shineSweep {
  to { left: 160%; }
}
.sticker { position: relative; overflow: hidden; }

/* ---------- Audio-reactive pulse ------------------------ */
/* --beat (0..1) is written by fx.js from the BGM analyser. */
body.bgm-on .topbar__dot { scale: calc(1 + var(--beat, 0) * 1.4); }
body.bgm-on .music-btn   { scale: calc(1 + var(--beat, 0) * .10); }
body.bgm-on .bgm__tape   { scale: calc(1 + var(--beat, 0) * .05); }
body.bgm-on .halftone {
  opacity: calc(.18 + var(--beat, 0) * .35);
}

/* ---------- Ambient depth on the page ------------------- */
.speed-lines { opacity: var(--speed-op, 1); }

@media (prefers-reduced-motion: reduce) {
  .fx-grain,
  .ticker__track { animation: none !important; }
  .fx-par { translate: none !important; scale: none !important; }
  .manga-grid .frame,
  .mini-panel,
  .jagged-frame { filter: none !important; }
}

/* =========================================================
   HERO PATH-DRAWING  (SVG built by js/path-draw.js)
   The red/pink/yellow text-shadow stack that .hero__title
   drew in CSS is recreated as offset <text> layers inside the
   SVG, plus an animated gradient stroke on top. The <h1> stays
   in the DOM — screen readers still announce it, and scroll.js
   still finds it for splitChars(). It is hidden by JS only
   after the SVG draws, so a script failure falls back to the
   original CSS title instead of an empty hero.
   ========================================================= */
.hero__title--sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.hero__draw {
  width: 100%;
  max-width: 780px;
  margin-bottom: 30px;
  color: var(--ink);           /* drives the SVG's currentColor fill */
  transform: rotate(-2deg);    /* matches the old .hero__title tilt */
  opacity: 0;
  transition: opacity .7s var(--ease);
}
.hero__draw.is-ready { opacity: 1; }

.hero__draw svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

@media (prefers-reduced-motion: reduce) {
  .hero__draw { transition: none; }
}

/* =========================================================
   PAGE-TURN  (wrappers built by js/page-turn.js)
   .turn is created at runtime around each .panel. Only
   page-turn.js writes its transform, so it composes cleanly
   with scroll.js (which tweens .panel) and fx.js (which
   drives --py / --ps on .fx-par children).
   ========================================================= */
.turn {
  position: relative;
  transform-origin: center center;
  will-change: transform;
}
.turn__shade {
  position: absolute;
  inset: 0;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.45) 0%,
    transparent 32%,
    transparent 68%,
    rgba(0, 0, 0, 0.45) 100%
  );
}

/* =========================================================
   HAND-DRAWN DOODLES  (built by js/annotations.js)
   Positioned absolutely inside the nearest .panel, which is
   already position:relative. Clamped to the panel box because
   .panel is overflow:hidden.
   ========================================================= */
.doodle {
  position: absolute;
  z-index: 6;
  color: var(--red);
  pointer-events: none;
}
.doodle svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.doodle path {
  transition: stroke-dashoffset .85s var(--ease);
}
.doodle.is-drawn path {
  stroke-dashoffset: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
  .doodle path { transition: none; }
  .turn { transform: none !important; }
  .turn__shade { opacity: 0 !important; }
}

/* At phone width the DRAMATIC ENTRANCE!! sound effect lands on top
   of the "01 FIRST PANEL" strip. The hero is already busy at this
   size, so drop that one — BOOM!, ★ and KIRA✦ still carry the panel. */
@media (max-width: 560px) {
  .sfx--dramatic { display: none; }
}
