*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #14141f;
  font-family: 'Comic Neue', cursive, sans-serif;
  color: #e8e6f0;
}

.comic-page {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.5vmin;
  padding: 0.5vmin;
  background: #0d0d14;
}

/* ---------- panel base ---------- */

.panel {
  background: #201d2e;
  border: 2px solid #000;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 3vmin rgba(0,0,0,0.45);
  animation: pop 0.4s ease both;
  animation-delay: calc((var(--i, 0)) * 0.08s);
}

.panel-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1vmin 1.1vmin;
  gap: 0.6vmin;
}

.scene {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2vmin;
  min-height: 0;
}

/* ---------- characters ---------- */

.char {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.char .face {
  font-size: clamp(1.6rem, 6vmin, 4.2rem);
  display: inline-block;
}

.char.pepe .face { filter: drop-shadow(0 0 0.6vmin rgba(120,220,120,0.4)); }
.char.kuro .face { filter: drop-shadow(0 0 0.6vmin rgba(150,150,255,0.4)); }
.char.big .face { font-size: clamp(2rem, 8vmin, 5rem); }

.pepe .face { animation: bob 2.4s ease-in-out infinite; }
.kuro .face { animation: bob 2.4s ease-in-out infinite 0.4s; }

/* ---------- speech bubbles ---------- */

.bubble {
  position: relative;
  background: #f3f0e6;
  color: #16141f;
  border: 2px solid #000;
  border-radius: 0.9vmin;
  padding: 0.8vmin 1vmin;
  font-size: clamp(0.62rem, 1.55vmin, 1rem);
  font-weight: 700;
  line-height: 1.15;
  width: 100%;
  text-align: center;
  box-shadow: 0.4vmin 0.4vmin 0 rgba(0,0,0,0.4);
}

.bubble b { color: #b02020; }
.bubble.kuro-bubble { background: #dfe3f5; }
.bubble::after {
  content: "";
  position: absolute;
  top: -1.1vmin;
  width: 0; height: 0;
  border-left: 1vmin solid transparent;
  border-right: 1vmin solid transparent;
  border-bottom: 1.2vmin solid #000;
}
.bubble.left::after  { left: 12%; }
.bubble.right::after { right: 12%; }
.bubble.tiny { font-size: clamp(0.5rem, 1.25vmin, 0.8rem); padding: 0.6vmin; }

/* ---------- title panel ---------- */

.panel-title {
  background: radial-gradient(circle at 50% 30%, #33284a 0%, #1a1626 100%);
}
.panel-title .panel-inner { justify-content: center; gap: 1vmin; }
.title-cast { display: flex; align-items: center; gap: 1.4vmin; }
.title-cast .face { font-size: clamp(2rem, 8vmin, 4.6rem); }
.title-vs { font-size: clamp(1rem, 3vmin, 2rem); color: #ffcf6b; font-weight: 700; }
.title-text {
  font-family: 'Bangers', cursive;
  font-size: clamp(1.4rem, 5.2vmin, 3.4rem);
  letter-spacing: 0.1vmin;
  color: #ffcf6b;
  text-shadow: 0.35vmin 0.35vmin 0 #000;
}
.title-sub { font-style: italic; font-size: clamp(0.7rem, 2vmin, 1.2rem); color: #cbb9ef; }
.title-by { font-size: clamp(0.6rem, 1.5vmin, 0.95rem); color: #9d94b8; }
.title-by b { color: #e8e6f0; }

/* ---------- doodles / props ---------- */

.doodle, .diagram, .trash, .clamp, .timer, .keyboard, .linespam, .masterpiece {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.doodle svg, .masterpiece svg {
  width: clamp(60px, 14vmin, 130px);
  height: auto;
}
.doodle svg path, .masterpiece svg path {
  fill: none;
  stroke: #7ad07a;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.masterpiece svg path { stroke: #8be08b; }

.reject {
  position: absolute; right: -0.4vmin; top: -0.4vmin;
  color: #ff5555; font-weight: 700;
  font-size: clamp(1rem, 3vmin, 2rem);
  animation: shake 0.6s ease-in-out infinite;
}
.approve { position: absolute; right: -0.8vmin; bottom: -0.4vmin; font-size: clamp(1rem, 3vmin, 2rem); }

.diagram { flex-direction: column; gap: 0.5vmin; }
.diag-part {
  background: #2c2740; border: 1px dashed #6a5f8f;
  border-radius: 0.5vmin; padding: 0.3vmin 0.7vmin;
  font-size: clamp(0.55rem, 1.4vmin, 0.9rem);
  color: #c9bdf0; font-weight: 700;
}

.keyboard, .clamp, .timer, .trash { font-size: clamp(1.4rem, 5vmin, 3rem); }
.trash { flex-direction: column; gap: 0.2vmin; }
.trash-code, .timer-label {
  font-size: clamp(0.5rem, 1.3vmin, 0.85rem);
  color: #9d94b8; font-weight: 700;
}
.timer { flex-direction: column; gap: 0.2vmin; }

.doodle-explode { flex-direction: column; }
.blast { font-size: clamp(1.6rem, 6vmin, 3.4rem); animation: shake 0.4s ease-in-out infinite; }
.geo { font-size: clamp(0.9rem, 3vmin, 1.8rem); letter-spacing: 0.3vmin; color: #c9bdf0; }

.linespam { gap: 0.15vmin; font-size: clamp(0.9rem, 3vmin, 1.8rem); font-weight: 700; }
.linespam span { color: #8be08b; }
.linespam span:nth-child(even) { color: #ff6b6b; }

/* ---------- finale ---------- */

.panel-finale {
  grid-column: span 1;
  background: radial-gradient(circle at 50% 40%, #2a3a2a 0%, #1a1626 100%);
}
.finale-scene { gap: 0.8vmin; }
.finale-scene .face { font-size: clamp(1.4rem, 5vmin, 3rem); }
.bubble-row { display: flex; gap: 0.6vmin; width: 100%; }
.bubble-row .bubble { flex: 1; }
.finale-caption {
  font-family: 'Bangers', cursive;
  font-size: clamp(0.6rem, 1.7vmin, 1.1rem);
  color: #ffcf6b; letter-spacing: 0.05vmin;
  text-align: center;
}

/* ---------- animations ---------- */

@keyframes pop {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-0.6vmin); }
}
@keyframes shake {
  0%, 100% { transform: rotate(-8deg); }
  50%      { transform: rotate(8deg); }
}

/* ---------- portrait fallback ---------- */
@media (max-aspect-ratio: 3/4) {
  .comic-page {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(5, 1fr);
  }
}
