:root {
  color-scheme: light;
  --ink: #171411;
  --paper: #fffefa;
  --panel: #f7f0df;
  --accent: #d0472f;
  --accent-2: #1d756c;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: linear-gradient(180deg, #f8f4ea 0%, #e7f0ed 50%, #fbf7ef 100%);
  color: var(--ink);
  font-family: "Comic Sans MS", "Trebuchet MS", Arial, sans-serif;
}
.comic {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 20px 14px 44px;
}
.comic-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 0 4px 16px;
}
.eyebrow, .subtitle { margin: 0; font-weight: 800; color: #654734; }
.eyebrow { font-size: .8rem; text-transform: uppercase; }
h1 { margin: 2px 0 4px; font-size: clamp(2.2rem, 8vw, 5.2rem); line-height: .9; letter-spacing: 0; }
.subtitle { font-size: clamp(.95rem, 2.5vw, 1.1rem); }
.page-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  max-width: 46%;
}
.page-nav a {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: .8rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 3px 0 rgba(0,0,0,.14);
}
.page { margin: 0 0 30px; }
.page-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 993 / 1404;
  overflow: hidden;
  isolation: isolate;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: white;
  box-shadow: 0 16px 34px rgba(25, 20, 16, .13);
}
.page-art {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.cutout, .effect { position: absolute; pointer-events: none; }
.cutout {
  z-index: 3;
  height: auto;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.045));
}
.effect {
  z-index: 4;
  fill: none;
  stroke: var(--accent);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .72;
}
.motion { left: 18%; top: 14%; width: 26%; height: 10%; animation: slideMark 2.6s ease-in-out infinite; }
.alert { right: 8%; top: 8%; width: 18%; height: 10%; animation: blink 1.1s steps(2, jump-none) infinite; }
.story-box {
  margin-top: 10px;
  padding: 12px 15px 13px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 253, 246, .96);
}
.story-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}
.story-heading span {
  min-width: 42px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0 9px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #f7d55e;
  font-weight: 900;
}
.story-heading strong { font-size: clamp(1.05rem, 3vw, 1.45rem); }
.story-box p {
  margin: 0;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(.95rem, 2.65vw, 1.15rem);
  line-height: 1.38;
}
.voice-bubble {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #fff 0 28%, #a7dfd8 29% 56%, var(--accent-2) 57% 100%);
  box-shadow: 0 5px 0 rgba(0,0,0,.18);
  cursor: pointer;
}
.voice-bubble::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-28%, -50%);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 12px solid #171312;
}
.voice-bubble.is-playing,
.voice-bubble:hover,
.voice-bubble:focus-visible {
  outline: none;
  background: radial-gradient(circle at 38% 34%, #fff 0 26%, #ffe29f 27% 56%, #d85635 57% 100%);
}
.bob { animation: bob 3s ease-in-out infinite; }
.drift { animation: drift 3.4s ease-in-out infinite; }
.swing { animation: swing 2.1s ease-in-out infinite; transform-origin: 50% 0; }
.fly { animation: fly 3.2s ease-in-out infinite; }
.flag { animation: flag 1.8s ease-in-out infinite; transform-origin: 50% 8%; }
.boat { animation: boat 3.6s ease-in-out infinite; }
.boat-alt { animation: boatAlt 3.9s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes drift { 0%,100% { transform: translate(0,0) rotate(-1deg); } 50% { transform: translate(4px,-6px) rotate(1deg); } }
@keyframes swing { 0%,100% { transform: rotate(-1.3deg); } 50% { transform: rotate(1.3deg); } }
@keyframes fly { 0%,100% { transform: translate(0,0) rotate(0); } 50% { transform: translate(7px,-8px) rotate(2deg); } }
@keyframes flag { 0%,100% { transform: skewX(-1deg); } 50% { transform: skewX(4deg); } }
@keyframes boat { 0%,100% { transform: translateY(0) rotate(-.6deg); } 50% { transform: translateY(-5px) rotate(.6deg); } }
@keyframes boatAlt { 0%,100% { transform: translateY(0) rotate(.6deg); } 50% { transform: translateY(-5px) rotate(-.6deg); } }
@keyframes slideMark { 0%,100% { opacity: .32; transform: translateX(0); } 50% { opacity: .8; transform: translateX(7px); } }
@keyframes blink { 0%,100% { opacity: .18; } 50% { opacity: .82; } }
@media (max-width: 640px) {
  .comic { padding-inline: 8px; }
  .comic-header { align-items: start; flex-direction: column; }
  .page-nav { max-width: 100%; justify-content: flex-start; }
  .page-nav a { width: 29px; height: 29px; font-size: .75rem; }
  .story-box { padding: 11px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
