/* ===== Tokens ===== */
:root {
  --ink: #101418; --paper: #fffdf5; --cream: #fff7dc;
  --mint: #3ee8a4; --mint-deep: #12b57c; --pink: #ff6f91; --yellow: #ffd93d; --dark: #0d1f1a;
  --display: 'Bangers', Impact, sans-serif;
  --body: 'Comic Neue', 'Comic Sans MS', system-ui, sans-serif;
  --line: 4px;
  --top-h: 66px;
  --ctl-h: 110px;
  /* page geometry: height first, width = height * .72, spread must fit viewport */
  --ph: min(calc(100vh - var(--top-h) - var(--ctl-h) - 24px), calc((100vw - 48px) / 2 / .72), 900px);
  --pw: calc(var(--ph) * .72);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--body); color: var(--ink); background: var(--paper); line-height: 1.5; overflow-x: hidden; min-height: 100vh; }
img { max-width: 100%; display: block; }
a { color: var(--mint-deep); }
p { margin: 0 0 .9em; }
.center { text-align: center; }

/* ===== Background: halftone + shine ===== */
.bg-dots { position: fixed; inset: 0; z-index: -2; pointer-events: none; background-color: var(--cream);
  background-image: radial-gradient(circle, rgba(18,181,124,.18) 1.6px, transparent 2px), radial-gradient(circle, rgba(16,20,24,.06) 1.2px, transparent 1.8px);
  background-size: 22px 22px, 11px 11px; background-position: 0 0, 5px 5px; }
.bg-shine { position: fixed; inset: -50%; z-index: -1; pointer-events: none; mix-blend-mode: screen;
  background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.75) 48%, rgba(62,232,164,.35) 50%, rgba(255,255,255,.75) 52%, transparent 60%);
  animation: shine 7s ease-in-out infinite; }
@keyframes shine { from { transform: translateX(-60%); } to { transform: translateX(60%); } }

/* ===== Type & bits ===== */
.title { font-family: var(--display); font-size: clamp(3rem, 9vw, 5.4rem); line-height: .85; margin: 6px 0 10px; letter-spacing: .02em; color: #fff;
  -webkit-text-stroke: 2.5px var(--ink); text-shadow: 5px 5px 0 var(--ink); transform: rotate(-3deg); display: inline-block; }
.title__pop { color: var(--mint); }
.h2 { font-family: var(--display); font-size: clamp(1.6rem, 3.2vw, 2.3rem); letter-spacing: .04em; margin: 0 0 16px; text-align: center; line-height: 1; }
.h2::after { content: ''; display: block; width: 90px; height: 6px; background: var(--pink); border: 2px solid var(--ink); margin: 8px auto 0; transform: rotate(-2deg); }
.h2--mint { color: var(--mint); -webkit-text-stroke: 1px var(--ink); }
h3 { font-family: var(--display); font-size: 1.2rem; letter-spacing: .04em; margin: 0 0 4px; }
.lead { font-size: 1.1rem; font-weight: 700; }
.stamp { display: inline-block; font-family: var(--display); letter-spacing: .1em; background: var(--pink); color: #fff; padding: 2px 12px; border: 3px solid var(--ink); transform: rotate(-3deg); box-shadow: 3px 3px 0 var(--ink); margin-bottom: 10px; }
.pg { position: absolute; bottom: 8px; right: 14px; font-family: var(--display); font-size: .95rem; opacity: .55; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px; font-family: var(--display); font-size: 1.05rem; letter-spacing: .06em;
  border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); color: var(--ink); text-decoration: none; background: #fff; cursor: pointer; transition: transform .1s, box-shadow .1s; }
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btn--green { background: var(--mint); } .btn--yellow { background: var(--yellow); } .btn--pink { background: var(--pink); color: #fff; } .btn--white { background: #fff; }
.btn--lg { font-size: 1.3rem; padding: 12px 26px; } .btn--sm { font-size: .95rem; padding: 6px 14px; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.btns--center { justify-content: center; }
.copy { display: inline-flex; align-items: center; gap: 6px; background: var(--yellow); border: 3px solid var(--ink); padding: 4px 8px; font-family: var(--display); letter-spacing: .06em; cursor: pointer; color: var(--ink); }
.copy:hover { background: var(--mint); }
.copy--lg { padding: 6px 12px; font-size: 1rem; }

/* ===== Top bar ===== */
.top { position: sticky; top: 0; z-index: 50; height: var(--top-h); display: flex; align-items: center; gap: 16px; padding: 0 18px; background: #fff; border-bottom: var(--line) solid var(--ink); }
.top__brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 1.3rem; letter-spacing: .05em; color: var(--ink); text-decoration: none; }
.top__brand img { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--ink); }
.top__ca { margin-left: auto; display: flex; align-items: center; gap: 8px; background: var(--cream); border: 3px solid var(--ink); padding: 3px 4px 3px 10px; min-width: 0; max-width: 46vw; }
.top__tag { font-family: var(--display); color: var(--mint-deep); letter-spacing: .1em; }
.top__ca code { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top__cta { padding: 7px 14px; font-size: 1rem; }

/* ===== Stage & book ===== */
.stage { display: flex; flex-direction: column; align-items: center; padding: 12px 16px 16px; }
.book-wrap { perspective: 2600px; width: calc(var(--pw) * 2); height: var(--ph); position: relative; }
.book { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.4,0,.2,1); transform: translateX(-25%); }
.book.open { transform: translateX(0); }
.book.ended { transform: translateX(25%); }

.sheet { position: absolute; top: 0; left: 50%; width: 50%; height: 100%; transform-origin: left center; transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(.45,0,.2,1); }
.sheet.flipped { transform: rotateY(-180deg); }
.page { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: #fff; border: var(--line) solid var(--ink); overflow: hidden; }
.page--back { transform: rotateY(180deg); }
/* spine shading */
.page--front::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3; background: linear-gradient(90deg, rgba(0,0,0,.22), transparent 12%); }
.page--back::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3; background: linear-gradient(-90deg, rgba(0,0,0,.22), transparent 12%); }
.page--cover::before { display: none; }
/* stacked-paper edge on the closed book */
.book-wrap::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.page__inner { position: absolute; inset: 0; overflow-y: auto; padding: 22px 24px 30px; scrollbar-width: thin; }
.page--dark { background: var(--dark); color: #fff; background-image: radial-gradient(circle, rgba(62,232,164,.22) 1.6px, transparent 2px); background-size: 16px 16px; }
.page--dark .bubble, .page--dark .issue { color: var(--ink); }
.page--mint { background: var(--mint); background-image: radial-gradient(circle, rgba(16,20,24,.18) 1.6px, transparent 2px); background-size: 14px 14px; }

/* Cover */
.page--cover { background: var(--yellow); background-image: radial-gradient(circle, rgba(16,20,24,.15) 1.6px, transparent 2px); background-size: 16px 16px; box-shadow: inset -12px 0 20px -12px rgba(0,0,0,.35); }
.cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18px 18px 14px; }
.cover__banner { width: 100%; aspect-ratio: 16 / 7; border: var(--line) solid var(--ink); box-shadow: 6px 6px 0 var(--ink); overflow: hidden; transform: rotate(-1.5deg); margin-bottom: 18px; }
.cover__banner img { width: 100%; height: 100%; object-fit: cover; object-position: 30% center; }
.cover__logo { width: min(42%, 200px); border-radius: 50%; border: var(--line) solid var(--ink); box-shadow: 6px 6px 0 var(--ink); margin-top: auto; overflow: hidden; background: #fff; }
.cover__hint { margin-top: 14px; font-family: var(--display); letter-spacing: .12em; font-size: 1.1rem; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%,100% { transform: translateX(0); } 50% { transform: translateX(8px); } }
.burst { position: absolute; display: grid; place-items: center; width: 110px; height: 110px; font-family: var(--display); font-size: 1.7rem; color: var(--ink); background: var(--pink); text-align: center; line-height: 1;
  clip-path: polygon(50% 0%,61% 20%,82% 10%,80% 32%,100% 40%,84% 55%,96% 78%,72% 76%,64% 100%,50% 82%,36% 100%,28% 76%,4% 78%,16% 55%,0% 40%,20% 32%,18% 10%,39% 20%);
  animation: wobble 1.6s ease-in-out infinite; z-index: 4; }
.burst--cover { top: 8px; right: 8px; } .burst--end { top: 14px; left: 14px; font-size: 1.3rem; background: var(--yellow); }
@keyframes wobble { 0%,100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(6deg) scale(1.08); } }
.page--backcover { background: var(--dark); color: #fff; background-image: radial-gradient(circle, rgba(62,232,164,.2) 1.6px, transparent 2px); background-size: 16px 16px; }
.backcover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.backcover__logo { width: min(50%, 220px); border-radius: 50%; border: var(--line) solid #fff; margin-bottom: 20px; }
.backcover__disc { font-size: .9rem; opacity: .85; max-width: 380px; }
.backcover__copy { opacity: .6; font-size: .85rem; margin-bottom: 18px; }

/* Frames, SFX, bubbles */
.frame { position: relative; margin: 0 0 16px; border: var(--line) solid var(--ink); box-shadow: 5px 5px 0 var(--ink); overflow: hidden; aspect-ratio: 16 / 9; background: #fff; }
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame--tilt { transform: rotate(1.5deg); }
.frame--tall { aspect-ratio: 4 / 3; transform: rotate(-1.5deg); }
.caption { position: absolute; left: 0; right: 0; bottom: 0; background: var(--cream); border-top: 3px solid var(--ink); padding: 5px 10px; font-weight: 700; font-size: .85rem; color: var(--ink); }
.sfx { position: absolute; font-family: var(--display); font-size: 1.5rem; letter-spacing: .05em; color: var(--yellow); -webkit-text-stroke: 1.5px var(--ink); text-shadow: 3px 3px 0 var(--ink); transform: rotate(-8deg); pointer-events: none; }
.sfx--tl { top: 8px; left: 10px; } .sfx--tr { top: 8px; right: 10px; transform: rotate(8deg); } .sfx--bl { bottom: 8px; left: 10px; } .sfx--br { bottom: 8px; right: 10px; transform: rotate(6deg); }
.bubble { position: relative; background: #fff; border: 3px solid var(--ink); border-radius: 22px; padding: 14px 18px; box-shadow: 4px 4px 0 var(--ink); font-size: 1rem; margin: 18px 0 26px; }
.bubble p { margin: 0; }
.bubble--sm { font-size: .92rem; }
.bubble--speech::before { content: ''; position: absolute; bottom: -20px; left: 36px; border-style: solid; border-width: 20px 16px 0 0; border-color: var(--ink) transparent transparent; }
.bubble--speech::after { content: ''; position: absolute; bottom: -13px; left: 39px; border-style: solid; border-width: 14px 11px 0 0; border-color: #fff transparent transparent; }
.bubble--thought::before { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); left: 34px; bottom: -18px; }
.bubble--thought::after { content: ''; position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); left: 20px; bottom: -32px; }

/* CA box */
.ca { display: flex; align-items: center; gap: 10px; background: var(--cream); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); padding: 6px 6px 6px 12px; margin-top: 8px; }
.ca__tag { font-family: var(--display); color: var(--mint-deep); letter-spacing: .1em; }
.ca__addr { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }

/* Tokenomics */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.star { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink); text-align: center;
  clip-path: polygon(50% 0%,61% 20%,82% 10%,80% 32%,100% 40%,84% 55%,96% 78%,72% 76%,64% 100%,50% 82%,36% 100%,28% 76%,4% 78%,16% 55%,0% 40%,20% 32%,18% 10%,39% 20%); }
.star b { font-family: var(--display); font-size: clamp(1.1rem, 2.4vw, 1.7rem); line-height: 1; }
.star small { font-family: var(--display); font-size: .6rem; letter-spacing: .08em; }
.star--green { background: var(--mint); } .star--pink { background: var(--pink); } .star--yellow { background: var(--yellow); } .star--white { background: #fff; }

/* Steps */
.steps { list-style: none; padding: 0; margin: 8px 0 18px; display: grid; gap: 14px; }
.step { position: relative; background: var(--cream); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); padding: 12px 12px 10px 54px; }
.step:nth-child(even) { transform: rotate(.6deg); } .step:nth-child(odd) { transform: rotate(-.6deg); }
.step__n { position: absolute; top: 10px; left: 10px; width: 34px; height: 34px; display: grid; place-items: center; background: var(--pink); color: #fff; border: 3px solid var(--ink); border-radius: 50%; font-family: var(--display); font-size: 1.15rem; }
.step p { margin: 0; font-size: .92rem; }
.step a { font-weight: 700; }

/* Gallery */
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gal { margin: 0; aspect-ratio: 4 / 3; }
.gal--a { grid-column: span 2; aspect-ratio: 16 / 8; }

/* Issues */
.issues { display: grid; gap: 14px; }
.issue { position: relative; background: var(--cream); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); padding: 10px 12px 12px 62px; }
.issue:nth-child(even) { transform: rotate(.6deg); } .issue:nth-child(odd) { transform: rotate(-.6deg); }
.issue__no { position: absolute; left: 10px; top: 8px; font-family: var(--display); font-size: 1.9rem; color: var(--pink); -webkit-text-stroke: 1.2px var(--ink); line-height: 1; }
.issue p { margin: 0; font-size: .88rem; }
.issue__badge { position: absolute; top: -10px; right: 10px; font-family: var(--display); font-size: .8rem; letter-spacing: .08em; padding: 1px 9px; border: 2px solid var(--ink); background: #fff; transform: rotate(-3deg); }
.issue--done .issue__badge { background: var(--mint); }
.issue--now { background: var(--yellow); } .issue--now .issue__badge { background: var(--pink); color: #fff; }

/* ===== Controls ===== */
.controls { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; justify-content: center; }
.ctl { width: 48px; height: 48px; border: 3px solid var(--ink); background: var(--yellow); box-shadow: 4px 4px 0 var(--ink); font-size: 1.2rem; cursor: pointer; color: var(--ink); }
.ctl:hover { background: var(--mint); } .ctl:active { transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--ink); }
.ctl:disabled { opacity: .35; cursor: default; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.tabs button { font-family: var(--display); letter-spacing: .06em; font-size: .95rem; padding: 6px 12px; background: #fff; border: 3px solid var(--ink); cursor: pointer; color: var(--ink); }
.tabs button:hover { background: var(--cream); }
.tabs button.active { background: var(--pink); color: #fff; }
.hint { margin: 10px 0 0; font-size: .85rem; opacity: .6; font-weight: 700; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--yellow); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); padding: 8px 20px; font-family: var(--display); letter-spacing: .1em; font-size: 1.1rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== Single-page mode (mobile) ===== */
@media (max-width: 820px) {
  :root { --ctl-h: 150px; --pw: min(calc(100vw - 32px), 520px); --ph: min(calc(var(--pw) / .72), calc(100vh - var(--top-h) - var(--ctl-h) - 16px)); }
  .top { gap: 10px; padding: 0 12px; }
  .top__brand span { display: none; }
  .top__ca { max-width: none; flex: 1; }
  .top__cta { display: none; }
  .book-wrap { width: var(--pw); }
  .book, .book.open, .book.ended { transform: none; }
  .sheet { left: 0; width: 100%; transform: none !important; transition: none; }
  .page { display: none; transform: none; }
  .page.active { display: block; animation: pagein .55s ease-out; transform-origin: left center; }
  .page--front::before, .page--back::before { display: none; }
  .title { font-size: 3rem; }
}
@keyframes pagein { from { transform: rotateY(-70deg); opacity: 0; } to { transform: rotateY(0); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .bg-shine, .burst, .cover__hint { animation: none; }
  .book, .sheet { transition: none; }
  .page.active { animation: none; }
}
