/* Direction: Saturday-morning comic book — warm newsprint paper, halftone dots, hot pink + sunny yellow, thick ink outlines, Bangers display */
/* Completed by the platform from the short form: both modes, every
   palette token, each text-on-ground pair at its floor. To restyle, write the
   short form again (the decisions in one :root) and it is completed again. */

:root {
  --canvas: #fff1bd;
  --surface: #ffffff;
  --surface-2: #ffe28a;
  --border: #e0d1a5;
  --border-strong: #bdac8a;
  --ink: #1b1233;
  --muted: #6d6262;
  --accent: #ff4f8b;
  --accent-hover: #d94376;
  --accent-ink: #240b13;
  --accent-text: #b50f4c;
  --accent-strong: #a8345c;
  --accent-soft: #ffdab6;
  --accent-border: #ffa8a7;
  --success: #15803d;
  --success-ink: #ffffff;
  --success-soft: #e3e3ae;
  --success-strong: #116d34;
  --warning: #b45309;
  --warning-ink: #ffffff;
  --warning-soft: #f6dea7;
  --warning-strong: #994607;
  --danger: #b91c1c;
  --danger-ink: #ffffff;
  --danger-soft: #f7d7aa;
  --danger-strong: #b91c1c;
  --chart-1: #f0407f;
  --chart-2: #c6760d;
  --chart-3: #67831a;
  --chart-4: #239a8d;
  --chart-5: #157aba;
  --chart-6: #a865eb;

  --font-display: "Bangers", "Comic Sans MS", cursive;
  --font-body: "Comic Neue", "Comic Sans MS", system-ui, sans-serif;
  --display-weight: 400;
  --display-tracking: 0.03em;
  --radius-card: 20px;
  --radius-btn: 14px;
  --radius-input: 12px;
  --x-pink: #ff4f8b;
  --x-yellow: #ffd23f;
  --x-blue: #3ec5ff;
  --x-green: #4cd98a;
  --x-purple: #a47bff;
  --x-orange: #ff8a3d;
  --x-brown: #6b3f2a;
  --x-dark: #1b1233;
  --x-skin: #f6c8a2;
  --x-skin2: #d9996b;
  --x-skin3: #a96a45;
  --x-on-photo: #ffffff;
  --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: "Comic Neue", "Comic Sans MS", system-ui, sans-serif;
  --eyebrow-tracking: 0.08em;
}

html[data-theme="dark"] {
  --canvas: #16070c;
  --surface: #2d2024;
  --surface-2: #221318;
  --border: #372a2e;
  --border-strong: #5c5155;
  --ink: #fff1bd;
  --muted: #a29376;
  --accent: #ff4f8b;
  --accent-hover: #ff699c;
  --accent-ink: #240b13;
  --accent-text: #ff4f8b;
  --accent-strong: #ff4f8b;
  --accent-soft: #491728;
  --accent-border: #7f2745;
  --success: #15803d;
  --success-ink: #ffffff;
  --success-soft: #162217;
  --success-strong: #499c68;
  --warning: #b45309;
  --warning-ink: #ffffff;
  --warning-soft: #39180b;
  --warning-strong: #c57a40;
  --danger: #b91c1c;
  --danger-ink: #ffffff;
  --danger-soft: #3a0c10;
  --danger-strong: #d16969;
  --chart-1: #ff4f8b;
  --chart-2: #ff9c21;
  --chart-3: #71901a;
  --chart-4: #1bcbba;
  --chart-5: #1687ce;
  --chart-6: #c79bfc;
}

body {
  background-color: var(--canvas);
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 16%, transparent) 1.6px, transparent 1.9px);
  background-size: 18px 18px;
  font-weight: 700;
  overflow-x: hidden;
}
h1, h2, h3, .bang { font-family: var(--font-display); letter-spacing: 0.03em; font-weight: 400; }

.topbar { border-bottom: 4px solid var(--ink); background: var(--x-yellow); color: var(--x-dark); }
.topbar .btn { border: 3px solid var(--x-dark); background: var(--surface); color: var(--x-dark); }
.snd-off { display: none; }
.is-muted .snd-on { display: none; }
.is-muted .snd-off { display: inline-block; }

.panel {
  position: relative;
  background: var(--surface);
  color: var(--ink);
  border: 4px solid var(--ink);
  border-radius: 22px;
  box-shadow: 8px 8px 0 var(--ink);
  padding: 1.25rem;
}
@media (min-width: 768px) { .panel { padding: 2rem; } }
.enter { animation: popin 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes popin { from { transform: translateY(26px) scale(0.96); } to { transform: none; } }

.caption {
  display: inline-block;
  background: var(--x-yellow);
  color: var(--x-dark);
  border: 3px solid var(--ink);
  padding: 0.3rem 0.8rem;
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-1.5deg);
  font-size: 0.95rem;
}

.bubble {
  position: relative;
  background: var(--surface);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 22px;
  padding: 0.9rem 1.1rem;
  line-height: 1.45;
}
.bubble::after {
  content: "";
  position: absolute;
  top: 22px;
  left: -11px;
  width: 18px;
  height: 18px;
  background: var(--surface);
  border-left: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  transform: rotate(45deg);
}
.dlg.right .bubble::after {
  left: auto;
  right: -11px;
  border-left: 0;
  border-bottom: 0;
  border-right: 3px solid var(--ink);
  border-top: 3px solid var(--ink);
}
.dlg { display: flex; gap: 0.9rem; align-items: flex-start; margin-top: 1.1rem; }
.dlg.right { flex-direction: row-reverse; }
.dlg .stack { display: flex; flex-direction: column; gap: 0.7rem; min-width: 0; flex: 1; }
.dlg .bubble { animation: popin 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both; animation-delay: calc(var(--d, 0) * 0.45s); }
.dlg .bubble p, .bubble p { margin: 0; overflow-wrap: anywhere; }
.nametag {
  display: inline-block;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  font-size: 1.15rem;
  background: var(--x-pink);
  color: var(--x-dark);
  border: 3px solid var(--ink);
  padding: 0 0.6rem;
  transform: rotate(-1deg);
  width: fit-content;
}
.dlg.right .nametag { background: var(--x-blue); margin-left: auto; }
.av { flex: none; filter: drop-shadow(3px 3px 0 var(--ink)); }
.av-big { width: 150px; height: 150px; }
@media (min-width: 768px) { .av-big { width: 220px; height: 220px; } }

.rhead { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.chip-c {
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  background: var(--x-blue);
  color: var(--x-dark);
  border: 3px solid var(--ink);
  padding: 0 0.6rem;
  font-size: 1.05rem;
  white-space: nowrap;
}
.chip-c.score { background: var(--x-green); }
.dots { display: none; gap: 5px; }
@media (min-width: 480px) { .dots { display: flex; } }
.dots i { width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: 50%; background: var(--surface); }
.dots i.done { background: var(--x-green); }
.dots i.now { background: var(--x-pink); transform: scale(1.3); }

.mystery { display: flex; gap: 0.9rem; align-items: flex-start; margin-top: 1.1rem; }
.quote { font-size: 1.1rem; }
@media (min-width: 768px) { .quote { font-size: 1.35rem; } }
.clue {
  margin-top: 0.8rem;
  background: color-mix(in srgb, var(--x-yellow) 40%, var(--surface));
  color: var(--ink);
  border: 3px dashed var(--ink);
  border-radius: 12px;
  padding: 0.45rem 0.8rem;
  font-size: 0.95rem;
}
.flash { min-height: 1.8rem; margin-top: 0.8rem; font-family: var(--font-display); font-size: 1.4rem; letter-spacing: 0.05em; color: var(--accent-text); }

.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; margin-top: 0.6rem; }
.opt {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--surface);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  text-align: left;
  min-width: 0;
}
.opt .av { width: 48px; height: 48px; filter: none; }
.opt:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); background: var(--x-yellow); color: var(--x-dark); }
.opt:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.opt:focus-visible, .pu:focus-visible, .cbtn:focus-visible { outline: 4px solid var(--x-blue); outline-offset: 3px; }
.opt:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.opt.wrong { background: var(--x-pink); color: var(--x-dark); text-decoration: line-through; }
.opt.shake { animation: shake 0.45s; }
@keyframes shake { 20% { transform: translateX(-9px) rotate(-2deg); } 40% { transform: translateX(9px) rotate(2deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }

.pus { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 3px dashed var(--ink); }
.pus .pu:last-child { grid-column: span 2; }
@media (min-width: 640px) { .pus { grid-template-columns: repeat(5, minmax(0, 1fr)); } .pus .pu:last-child { grid-column: auto; } }
.pu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.4rem 0.3rem;
  background: var(--x-purple);
  color: var(--x-dark);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.12s;
  line-height: 1.1;
}
.pu b { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: 0.04em; font-weight: 400; }
.pu small { font-size: 0.72rem; font-weight: 700; }
.pu .em { font-size: 1.6rem; }
.pu:hover:not(:disabled) { transform: translateY(-3px) rotate(-2deg); }
.pu:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.pu.on { background: var(--x-orange); animation: wob 0.8s infinite alternate; }
.pu.used:not(.on) { opacity: 0.4; box-shadow: none; cursor: not-allowed; }
@keyframes wob { to { transform: rotate(3deg) scale(1.04); } }

.cbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  font-size: 1.5rem;
  padding: 0.35rem 1.4rem;
  background: var(--x-yellow);
  color: var(--x-dark);
  border: 4px solid var(--ink);
  border-radius: 16px;
  box-shadow: 5px 5px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.cbtn:hover { transform: translate(-2px, -2px) rotate(-1deg); box-shadow: 8px 8px 0 var(--ink); }
.cbtn:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.cbtn-pink { background: var(--x-pink); }
.cbtn-blue { background: var(--x-blue); }
.cbtn-sm { font-size: 1.1rem; padding: 0.1rem 0.9rem; box-shadow: 3px 3px 0 var(--ink); }
.pulse { animation: pulse 1.1s infinite alternate; }
@keyframes pulse { to { transform: scale(1.06) rotate(-1deg); } }

.stamp {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 9vw, 4.5rem);
  line-height: 1;
  color: var(--x-dark);
  background: var(--x-yellow);
  border: 4px solid var(--ink);
  padding: 0.1rem 1rem;
  box-shadow: 5px 5px 0 var(--ink);
  transform: rotate(-3deg);
  animation: stampin 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
@keyframes stampin { from { transform: rotate(-12deg) scale(2); } to { transform: rotate(-3deg) scale(1); } }

.term { background: var(--x-dark); color: var(--x-green); }
.term .termbar { display: flex; gap: 6px; margin-bottom: 0.8rem; }
.term .termbar i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--x-green); }
.term pre { font-family: var(--font-mono, monospace); font-size: 0.8rem; white-space: pre-wrap; margin: 0; min-height: 7.5rem; font-weight: 700; }
@media (min-width: 768px) { .term pre { font-size: 1.05rem; } }
.bigline { margin-top: 1.2rem; min-height: 11rem; }
.bigline .bubble { background: var(--x-yellow); color: var(--x-dark); font-size: 1.15rem; border-color: var(--x-green); animation: none; }
.bigline .bubble::after { background: var(--x-yellow); border-color: var(--x-green); }
@media (min-width: 768px) { .bigline .bubble { font-size: 1.5rem; } }
.caret::after { content: "\2588"; animation: blink 0.7s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.cover-title { font-size: clamp(3.6rem, 14vw, 8rem); line-height: 0.92; color: var(--accent-text); text-shadow: 4px 4px 0 var(--x-yellow); }
.cover-title span { display: block; font-size: 0.4em; color: var(--ink); text-shadow: none; margin-bottom: 0.2em; }
.step { background: var(--x-blue); color: var(--x-dark); border: 3px solid var(--ink); border-radius: 14px; padding: 0.6rem 0.8rem; box-shadow: 3px 3px 0 var(--ink); }
.step:nth-child(2) { background: var(--x-green); }
.step:nth-child(3) { background: var(--x-orange); }
.step:nth-child(4) { background: var(--x-pink); }
.favs span { background: var(--x-purple); color: var(--x-dark); border: 3px solid var(--ink); border-radius: 999px; padding: 0.1rem 0.8rem; box-shadow: 3px 3px 0 var(--ink); width: fit-content; }

.burst {
  position: absolute;
  display: grid;
  place-items: center;
  width: 130px;
  height: 130px;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--x-dark);
  background: var(--x-pink);
  clip-path: polygon(50% 0, 61% 18%, 80% 8%, 78% 30%, 100% 35%, 84% 52%, 98% 72%, 76% 74%, 72% 98%, 54% 84%, 36% 100%, 30% 78%, 4% 80%, 18% 58%, 0 40%, 22% 32%, 20% 8%, 40% 18%);
  animation: floaty 3s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes floaty { from { transform: translateY(0) rotate(-8deg); } to { transform: translateY(-14px) rotate(6deg); } }

.wall { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) { .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wall .card-c { background: var(--surface); color: var(--ink); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 5px 5px 0 var(--ink); padding: 1rem; }
.wall .card-c p { margin: 0.5rem 0 0; font-size: 0.95rem; line-height: 1.45; overflow-wrap: anywhere; }

.confetti { position: fixed; top: -20px; width: 12px; height: 18px; border: 2px solid var(--x-dark); z-index: 60; pointer-events: none; animation: fall 2.8s linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(720deg); } }

.timer { height: 16px; border: 3px solid var(--ink); border-radius: 999px; background: var(--surface); overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--x-green); transition: width 0.1s linear, background 0.2s; }
.timer.low i { background: var(--x-pink); }
.emo { font-size: 2.4rem; line-height: 1.25; text-align: center; letter-spacing: 0.2em; }
@media (min-width: 768px) { .emo { font-size: 3.2rem; } }
.shakeall { animation: shake 0.45s; }

.arena {
  position: relative;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 4px solid var(--ink);
  border-radius: 18px;
  background: linear-gradient(var(--x-blue), color-mix(in srgb, var(--x-blue) 35%, var(--surface)));
  color: var(--x-dark);
  user-select: none;
  touch-action: manipulation;
}
.shuttle, .drop { position: absolute; font-size: 3rem; line-height: 1; width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--ink); background: var(--x-yellow); cursor: pointer; display: grid; place-items: center; box-shadow: 3px 3px 0 var(--ink); }
.shuttle { transition: left 0.18s, top 0.18s; animation: wob 0.4s infinite alternate; }
.drop { top: 0; font-size: 2.2rem; animation: drop 2s linear forwards; }
@keyframes drop { from { transform: translateY(-70px) rotate(0); } to { transform: translateY(340px) rotate(40deg); } }
.bed { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 1rem 2rem; background: var(--x-purple); color: var(--x-dark); border: 4px solid var(--ink); border-radius: 24px; box-shadow: 6px 6px 0 var(--ink); cursor: pointer; transition: transform 0.08s; }
.bed:active { transform: scale(0.92) rotate(-3deg); box-shadow: 2px 2px 0 var(--ink); }
.zzz { position: absolute; bottom: 20px; font-family: var(--font-display); color: var(--x-dark); animation: zfloat 1.2s ease-out forwards; pointer-events: none; }
@keyframes zfloat { from { transform: translateY(0) rotate(0); } to { transform: translateY(-260px) rotate(25deg); opacity: 0; } }

.kapow {
  position: fixed;
  left: 50%;
  top: 40%;
  z-index: 70;
  pointer-events: none;
  font-family: var(--font-display);
  font-size: clamp(3rem, 14vw, 7rem);
  color: var(--x-dark);
  background: var(--x-yellow);
  padding: 2.2rem 3rem;
  clip-path: polygon(50% 0, 61% 18%, 80% 8%, 78% 30%, 100% 35%, 84% 52%, 98% 72%, 76% 74%, 72% 98%, 54% 84%, 36% 100%, 30% 78%, 4% 80%, 18% 58%, 0 40%, 22% 32%, 20% 8%, 40% 18%);
  animation: kapow 0.9s ease-out forwards;
}
@keyframes kapow {
  0% { transform: translate(-50%, -50%) scale(0.2) rotate(-20deg); }
  30% { transform: translate(-50%, -50%) scale(1.15) rotate(6deg); }
  80% { transform: translate(-50%, -70%) scale(1) rotate(-3deg); opacity: 1; }
  100% { transform: translate(-50%, -80%) scale(1) rotate(-3deg); opacity: 0; }
}

html.reduced-motion *, html.reduced-motion *::before, html.reduced-motion *::after { animation: none !important; transition: none !important; }
