@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;600;700&family=Noto+Sans+Thai:wght@400;600;700;900&display=swap');

:root { --ink: #16151a; --paper: #fffaf0; --yellow: #ffd84d; --pink: #ff4f91; --green: #91d66d; --line: 3px solid var(--ink); }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #25232a; font-family: 'Noto Sans Thai', sans-serif; }
.site-header, .site-footer { text-align: center; color: #fff; }
.site-header { padding: 4rem 1.5rem 2rem; }
.home-link { display: inline-block; margin-top: 1rem; padding: .45rem .8rem; border: 2px solid var(--ink); border-radius: 8px; background: var(--yellow); color: var(--ink) !important; text-decoration: none !important; font-size: 1rem; font-weight: 900; box-shadow: 3px 3px 0 var(--ink); }
.eyebrow, .page-heading span, .the-end { font-family: 'Chakra Petch', sans-serif; letter-spacing: .12em; font-weight: 700; }
.eyebrow { color: var(--yellow); font-size: .8rem; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .1rem; font-size: clamp(2.5rem, 7vw, 5rem); line-height: .95; }
.subtitle { color: var(--pink); font-size: clamp(1.25rem, 3vw, 2rem); font-weight: 900; }
.lead { max-width: 38rem; margin: 1rem auto 0; color: #d8d3dd; }
.manga-book { width: min(100% - 2rem, 1000px); margin: 0 auto 3rem; }
.page { position: relative; margin: 2rem 0; padding: clamp(1rem, 3vw, 2rem); background: var(--paper); box-shadow: 0 12px 0 #111; overflow: hidden; }
.page-heading { display: flex; align-items: baseline; gap: 1rem; border-bottom: var(--line); margin-bottom: 1rem; padding-bottom: .5rem; }
.page-heading span { color: var(--pink); font-size: .8rem; }
.page-heading h2 { margin: 0; font-size: clamp(1.2rem, 3vw, 2rem); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.illustrated-page { position: relative; border: var(--line); overflow: hidden; line-height: 1.35; background: #fff; }
.illustrated-page { aspect-ratio: 2 / 3; container-type: inline-size; }
.illustrated-page > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.story-page-art { line-height: 1.25; }
.story-page-art > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.story-bubble { width: fit-content; max-width: 40%; height: auto; font-size: clamp(.5rem, 1vw, .72rem); overflow-wrap: anywhere; }
.story-two-one, .story-three-one { top: 4%; left: 3%; }
.story-two-two, .story-three-two { top: 4%; right: 3%; }
.story-two-three, .story-three-three { top: 53%; left: 3%; }
.story-two-four, .story-three-four { top: 53%; right: 3%; }
.story-two-five { right: 3%; bottom: 4%; }
.story-four-one { top: 4%; left: 3%; }
.story-four-two { top: 4%; right: 3%; }
.story-four-three { top: 53%; left: 3%; }
.story-four-three-reply { left: 3%; bottom: 4%; max-width: 43%; }
.story-four-four { top: 53%; right: 3%; }
.story-four-four-reply { right: 3%; bottom: 4%; }
.story-five-one { top: 4%; left: 3%; }
.story-five-two { top: 4%; right: 3%; }
.story-five-two-reply { right: 3%; top: 27%; bottom: auto !important; height: auto !important; }
.story-five-three { top: 53%; left: 3%; }
.story-five-four { top: 53%; right: 3%; }
.story-five-four-reply { right: 3%; bottom: 4%; }
.story-six-one { top: 4%; left: 3%; }
.story-six-two { top: 4%; right: 3%; }
.story-six-three { top: 53%; left: 3%; }
.story-six-four { top: 53%; right: 3%; }
.story-six-four-reply { right: 3%; bottom: 4%; }
.story-seven-one { top: 4%; left: 3%; right: auto !important; bottom: auto !important; width: fit-content; max-width: 43%; height: auto !important; min-height: 0; background: var(--yellow); }
.story-seven-two { top: 4%; right: 3%; }
.story-seven-three { top: 53%; left: 3%; }
.story-seven-four { top: 53%; right: 3%; }
.story-seven-four-reply-one { right: 3%; bottom: 17%; }
.story-seven-four-reply-two { right: 3%; bottom: 4%; }
.story-seven-four-replies, .story-eight-three-replies { position: absolute; z-index: 2; right: 3%; bottom: 2%; width: 42%; display: flex; flex-direction: column; gap: .35rem; align-items: stretch; }
.story-seven-four-replies .bubble-small, .story-eight-three-replies .bubble-small { position: relative; inset: auto; width: 100%; max-width: none; margin: 0; }
.story-eight-one { top: 4%; right: 3%; bottom: auto; }
.story-eight-one-caption { top: 28%; left: 3%; right: auto !important; bottom: auto !important; width: fit-content; max-width: 43%; height: auto !important; min-height: 0; }
.story-eight-two { top: 4%; right: 3%; }
.story-eight-two-reply { right: 3%; bottom: 4%; }
.story-eight-three { top: 53%; left: 3%; }
.story-eight-three-reply-one { left: 3%; bottom: 17%; }
.story-eight-three-reply-two { left: 3%; bottom: 4%; }
.story-eight-four { top: 53%; right: 3%; }
.story-eight-four-reply-one { right: 3%; bottom: 17%; }
.story-eight-four-reply-two { right: 3%; bottom: 9%; }
.story-eight-four-reply-three { right: 3%; bottom: 2%; }
.story-eight-four-replies { position: absolute; z-index: 2; right: 3%; bottom: 2%; width: 42%; display: flex; flex-direction: column; gap: .35rem; align-items: stretch; }
.story-eight-four-replies .bubble-small { position: relative; inset: auto; width: 100%; max-width: none; margin: 0; }
.page-copy { position: absolute; z-index: 2; margin: 0; padding: .55rem .7rem; border: 2px solid var(--ink); background: rgba(255,255,255,.94); box-shadow: 3px 3px 0 var(--ink); font-weight: 900; text-align: center; }
.page-one-caption { top: 1.5%; left: 3%; width: 94%; background: var(--yellow); font-size: clamp(.62rem, 1.35vw, .9rem); }
.page-one-question { top: 29%; left: 7%; width: 43%; border-radius: 16px; font-size: clamp(.7rem, 1.6vw, 1.05rem); }
.page-one-hunger { top: 62%; left: 5%; width: 44%; border-radius: 16px; background: #ffe6f2; font-size: clamp(.62rem, 1.35vw, .9rem); }
.page-one-plan { top: 85%; left: 51%; width: 45%; border-radius: 16px; background: var(--yellow); font-size: clamp(.58rem, 1.25vw, .82rem); }
.page-one-reply { top: 84%; left: 5%; width: 44%; font-size: clamp(.55rem, 1.2vw, .8rem); }
.panel { position: relative; min-height: 250px; border: var(--line); overflow: hidden; background: #f2d59b; }
.panel-wide { grid-column: 1 / -1; min-height: 310px; }
.panel-art { position: absolute; inset: 0; background-image: linear-gradient(135deg, rgba(255,235,181,.22), rgba(74,136,103,.2)), url('../../locations/cafeteria.webp'); background-size: cover; background-position: center; filter: saturate(1.05); }
.classroom .panel-art { background-image: linear-gradient(135deg, rgba(255,255,255,.12), rgba(61,83,120,.18)), url('../../locations/classroom-m4-1.webp'); }
.panel::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(255,255,255,.05), transparent 45%, rgba(21,19,25,.18)); }
.bubble, .caption, .sfx { position: absolute; z-index: 2; margin: 0; }
.bubble { max-width: 86%; padding: .55rem .7rem; border: 2px solid var(--ink); border-radius: 16px; background: rgba(255,255,255,.94); box-shadow: 3px 3px 0 var(--ink); font-weight: 900; line-height: 1.35; text-align: center; }
.bubble-top { top: 6%; left: 4%; }
.bubble-center { top: 38%; left: 50%; transform: translateX(-50%); }
.bubble-bottom { bottom: 6%; left: 4%; }
.bubble-small { right: 4%; bottom: 6%; max-width: 42%; padding: .35rem .5rem; border-radius: 12px; font-size: clamp(.5rem, 1vw, .7rem); overflow-wrap: anywhere; }
.caption { left: auto; right: auto; bottom: auto; width: fit-content; max-width: 86%; height: auto; padding: .55rem .7rem; background: rgba(255,255,255,.9); font-size: clamp(.65rem, 1.35vw, .9rem); font-weight: 700; line-height: 1.4; }
.sfx { right: 6%; bottom: 8%; color: var(--pink); font: 900 clamp(1.3rem, 4vw, 3rem) 'Chakra Petch', sans-serif; transform: rotate(-8deg); text-shadow: 2px 2px 0 var(--ink); }
.sfx.giant { top: 8%; bottom: auto; font-size: clamp(1.7rem, 5vw, 4rem); }
.data-card { display: grid; gap: .2rem; width: min(90%, 620px); margin: 0 auto 1rem; padding: .7rem 1rem; border: var(--line); background: var(--yellow); transform: rotate(-2deg); text-align: center; font-weight: 900; }
.data-card span { font-size: clamp(.75rem, 1.6vw, 1rem); }
.data-card em { color: #8e3157; }
.the-end { width: fit-content; margin: 1.5rem auto 0; padding: .7rem 1.5rem; border: var(--line); background: var(--ink); color: var(--yellow); transform: rotate(-3deg); }
.site-footer { padding: 1rem; color: #bdb7c5; font-size: .8rem; }
.episode-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; margin: 1rem auto 0; padding: 0 1rem; }
.episode-nav a { padding: .55rem .9rem; border: 2px solid var(--ink); border-radius: 8px; background: var(--yellow); color: var(--ink); text-decoration: none; font-weight: 900; box-shadow: 3px 3px 0 var(--ink); }
@media (max-width: 620px) {
  .site-header { padding-top: 2.5rem; }
  .manga-book { width: min(100% - 1rem, 1000px); }
  .page { padding: .65rem; margin: 1rem 0; box-shadow: 0 7px 0 #111; }
  .grid { gap: .4rem; }
  .panel { min-height: 190px; }
  .panel-wide { min-height: 250px; }
  .page-copy { padding: .35rem .45rem; border-width: 1px; box-shadow: 2px 2px 0 var(--ink); font-size: .62rem; }
  .page-one-caption { font-size: .58rem; }
  .page-one-question { top: 29%; }
  .page-one-hunger { top: 62%; }
  .page-one-plan { top: 85%; }
  .page-one-reply { top: 84%; }
  .story-bubble { width: fit-content; max-width: 40%; font-size: .52rem; }
  .story-two-one, .story-three-one, .story-two-two, .story-three-two { top: 3%; }
  .story-two-three, .story-three-three, .story-two-four, .story-three-four { top: 52%; }
  .story-two-five { bottom: 3%; }
  .story-four-one, .story-four-two { top: 3%; }
  .story-four-three, .story-four-four { top: 52%; }
  .story-four-three-reply, .story-four-four-reply { bottom: 3%; }
  .story-five-one, .story-five-two { top: 3%; }
  .story-five-two-reply { top: 27%; }
  .story-five-three, .story-five-four { top: 52%; }
  .story-five-four-reply { bottom: 3%; }
  .story-six-one, .story-six-two { top: 3%; }
  .story-six-three, .story-six-four { top: 52%; }
  .story-six-four-reply { bottom: 3%; }
  .story-seven-one, .story-seven-two { top: 3%; }
  .story-seven-three, .story-seven-four { top: 52%; }
  .story-seven-four-reply-one { bottom: 17%; }
  .story-seven-four-reply-two { bottom: 3%; }
  .story-eight-one { top: 3%; }
  .story-eight-one-caption { top: 27%; }
  .story-eight-two { top: 3%; }
  .story-eight-two-reply { bottom: 3%; }
  .story-eight-three, .story-eight-four { top: 52%; }
  .story-eight-three-reply-one, .story-eight-four-reply-one { bottom: 17%; }
  .story-eight-three-reply-two, .story-eight-four-reply-three { bottom: 3%; }
  .story-eight-four-reply-two { bottom: 9%; }
  .story-seven-four-replies, .story-eight-three-replies, .story-eight-four-replies { width: 42%; gap: .2rem; }
  .bubble { padding: .35rem .45rem; border-width: 1px; box-shadow: 2px 2px 0 var(--ink); font-size: .68rem; }
  .bubble-small { max-width: 42%; font-size: .52rem; }
  .caption { padding: .35rem .45rem; font-size: .62rem; }
  .data-card { width: 96%; font-size: .72rem; }
}
@media print {
  body { background: #fff; }
  .site-header { color: var(--ink); padding: 1rem; }
  .lead { color: var(--ink); }
  .manga-book { width: 100%; }
  .page { min-height: 100vh; margin: 0; box-shadow: none; page-break-after: always; }
  .site-footer { color: var(--ink); }
}
