/* =========================================================
   Pyama GAMES — showcase
   ========================================================= */
:root {
  --ink: #1b1446;
  --ink2: #0e0a28;
  --night: #241a63;
  --night2: #3a2690;
  --cream: #fff6e6;
  --paper: #fff1d6;
  --blue: #7ea6dc;
  --cap: #3a5aa8;
  --gold: #f2c560;
  --pink: #ff5fa2;
  --mint: #4ff0c0;
  --orange: #ff8a3d;
  --sky: #8fd3ff;
  --accent: var(--pink);
  --pix: 'Press Start 2P', monospace;
  --dot: 'DotGothic16', sans-serif;
  --pop: 'Dela Gothic One', 'M PLUS Rounded 1c', sans-serif;
  --body: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', sans-serif;
  --hud-h: 56px;
  --cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='30' viewBox='0 0 13 15' shape-rendering='crispEdges'%3E%3Cpath fill='%231b1446' d='M0 0h2v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h1v2H8v1h1v2H7v1H6v-1H5v-2H4v-1H3v1H2v1H0z'/%3E%3Cpath fill='%23fff' d='M1 1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1H7v2h1v1H7v-1H6v-2H5v-1H4v1H3v1H2v1H1z'/%3E%3Cpath fill='%23ff5fa2' d='M1 2h1v8H1z'/%3E%3C/svg%3E") 1 1, auto;
  --cursor-hand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='30' viewBox='0 0 14 15' shape-rendering='crispEdges'%3E%3Cpath fill='%231b1446' d='M4 0h2v1h1v4h2v1h2v1h2v1h1v5h-1v2H4v-1H3v-1H2v-1H1V9H0V7h2v1h1V1h1z'/%3E%3Cpath fill='%23fff' d='M4 1h2v5h1V6h2v1h1v1h1V8h2v4h-1v2H5v-1H4v-1H3v-1H2V10H1V8h1v1h1v1h1z'/%3E%3Cpath fill='%23f2c560' d='M5 11h7v2H5z'/%3E%3C/svg%3E") 5 1, pointer;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0; background: var(--night); color: var(--cream);
  font-family: var(--body); font-weight: 500; line-height: 1.8;
  overflow-x: hidden; cursor: var(--cursor);
}
body.booting, body.locked { overflow: hidden; }
a, button, [role='button'], .card { cursor: var(--cursor-hand); }
a { color: inherit; }
button { font: inherit; color: inherit; }
img, canvas { display: block; }
canvas.px, #logo, #boot-kun, #hud-kun, #about-kun { image-rendering: pixelated; image-rendering: crisp-edges; }
kbd { font-family: var(--pix); font-size: 0.62em; padding: 0.35em 0.5em 0.25em; border: 2px solid currentColor; border-bottom-width: 4px; border-radius: 6px; margin: 0 0.15em; display: inline-block; line-height: 1; }
.sp { display: none; }
@media (max-width: 640px) { .sp { display: inline; } }
:focus-visible { outline: 3px dashed var(--gold); outline-offset: 4px; }

/* ---------- shared pop button ---------- */
.pbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  font-family: var(--pix); font-size: 12px; letter-spacing: 0.06em; text-decoration: none; line-height: 1;
  padding: 14px 20px 12px; border: 3px solid var(--ink); border-radius: 10px;
  background: var(--accent); color: #fff; text-shadow: 2px 2px 0 var(--ink);
  box-shadow: 0 5px 0 var(--ink); transform: translateY(0);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.15s;
}
.pbtn:hover { transform: translateY(-3px); box-shadow: 0 8px 0 var(--ink); filter: brightness(1.08); }
.pbtn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.pbtn.ghost { background: var(--cream); color: var(--ink); text-shadow: none; }
.pbtn.big { font-size: 15px; padding: 18px 26px 15px; }
.pbtn.big::after { content: ''; width: 0; height: 0; border-left: 7px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; display: none; }

/* =========================================================
   BOOT
   ========================================================= */
#boot {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 60%, #2a1e6e 0%, var(--ink2) 70%);
  transition: opacity 0.5s, visibility 0.5s;
}
#boot::before { /* starfield */
  content: ''; position: absolute; inset: 0; opacity: 0.8;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 78% 14%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 64% 72%, #ffe8a0 50%, transparent 51%), radial-gradient(1.5px 1.5px at 30% 80%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 52%, #a8c8f0 50%, transparent 51%), radial-gradient(2px 2px at 44% 36%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 62%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 56% 8%, #a8c8f0 50%, transparent 51%);
  animation: twinkle 3s steps(3) infinite;
}
#boot.out { opacity: 0; visibility: hidden; }
.boot-inner { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 24px; }
#boot-kun { width: 136px; height: 152px; filter: drop-shadow(0 0 30px rgba(255, 190, 90, 0.35)); animation: bob 2.4s ease-in-out infinite; }
.boot-press { font-family: var(--pix); font-size: clamp(22px, 5vw, 40px); color: var(--gold); text-shadow: 4px 4px 0 #a8323a, 8px 8px 0 var(--ink2); letter-spacing: 0.06em; animation: blink 1.05s steps(2) infinite; }
.boot-hint { font-family: var(--pix); font-size: 11px; color: var(--blue); letter-spacing: 0.2em; }
.boot-note { font-family: var(--dot); font-size: 13px; color: #a89cc8; }
.boot-skip { position: absolute; bottom: 24px; right: 24px; background: none; border: 0; color: #8a80b0; font-family: var(--dot); font-size: 13px; text-decoration: underline; text-underline-offset: 4px; }
.boot-skip:hover { color: var(--cream); }

/* =========================================================
   HUD
   ========================================================= */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; height: var(--hud-h);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px;
  background: rgba(14, 10, 40, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--ink2);
  transform: translateY(-110%); transition: transform 0.6s cubic-bezier(0.2, 1.4, 0.4, 1);
}
body.ready #hud { transform: none; }
.hud-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--pix); font-size: 12px; color: var(--blue); }
.hud-brand b { color: var(--gold); margin-left: 0.6em; font-weight: normal; }
#hud-kun { width: 40px; height: 40px; border-radius: 8px; border: 2px solid var(--ink2); }
.hud-score { font-family: var(--pix); font-size: 11px; display: flex; align-items: center; gap: 8px; color: var(--cream); }
.hud-l { color: var(--pink); }
.hud-l.hi { color: var(--mint); margin-left: 14px; }
#score.bump { animation: bump 0.25s; color: var(--gold); }
.hud-nav { display: flex; align-items: center; gap: 18px; font-family: var(--pix); font-size: 10px; }
.hud-nav a { text-decoration: none; color: var(--cream); position: relative; }
.hud-nav a::before { content: '▶'; position: absolute; left: -14px; color: var(--gold); opacity: 0; transition: opacity 0.1s; }
.hud-nav a:hover::before { opacity: 1; animation: nudge 0.4s steps(2) infinite; }
#snd { display: flex; align-items: center; gap: 6px; background: var(--cream); color: var(--ink); border: 2px solid var(--ink2); border-radius: 8px; padding: 7px 9px 5px; font-family: var(--pix); font-size: 9px; box-shadow: 0 3px 0 var(--ink2); }
#snd i { width: 12px; height: 12px; display: inline-block; background: var(--ink);
  clip-path: polygon(0 35%, 30% 35%, 65% 0, 65% 100%, 30% 65%, 0 65%); position: relative; }
#snd[aria-pressed='false'] { background: #8a80b0; }
#snd[aria-pressed='false'] span { text-decoration: line-through; }
@media (max-width: 760px) {
  .hud-score .hi, #hiscore { display: none; }
  .hud-nav a { display: none; }
  .hud-brand span { display: none; }
}
@media (max-width: 400px) { .hud-score { font-size: 9px; } }

/* =========================================================
   HERO
   ========================================================= */
#hero {
  position: relative; min-height: 100vh; min-height: 100svh; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--hud-h) + 10px) 16px 110px;
  background: linear-gradient(180deg, #120c38 0%, #2b1e78 46%, #6a3fa0 74%, #ff7eb6 100%);
}
.hero-stage { position: relative; width: min(1100px, 100%); aspect-ratio: 16 / 9; max-height: 64vh; }
#logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.hero-copy { position: relative; text-align: center; margin-top: -2vh; opacity: 0; transform: translateY(30px); transition: opacity 0.8s, transform 0.8s cubic-bezier(0.2, 1.5, 0.4, 1); }
body.ready .hero-copy { opacity: 1; transform: none; }
.sticker {
  display: inline-block; font-family: var(--pix); font-size: 11px; color: var(--ink); background: var(--mint);
  padding: 8px 12px 6px; border: 3px solid var(--ink); border-radius: 999px; transform: rotate(-4deg);
  box-shadow: 3px 3px 0 var(--ink); animation: wiggle 2.4s ease-in-out infinite;
}
.tagline { font-family: var(--pop); font-weight: 400; font-size: clamp(28px, 5.6vw, 64px); line-height: 1.25; margin: 14px 0 10px; letter-spacing: 0.02em; }
.tagline span { display: inline-block; color: #fff; -webkit-text-stroke: 0; text-shadow: 3px 3px 0 var(--ink), 6px 6px 0 var(--pink); }
.tagline span:nth-child(2) { text-shadow: 3px 3px 0 var(--ink), 6px 6px 0 var(--cap); }
.hero-lead { font-size: clamp(14px, 1.8vw, 17px); color: #f5e9ff; margin: 0; text-shadow: 0 2px 0 rgba(20, 10, 60, 0.6); }
.scroll-cue {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); text-decoration: none;
  display: flex; flex-direction: column; align-items: center; gap: 10px; font-family: var(--pix); font-size: 11px; color: #fff;
  opacity: 0; transition: opacity 0.6s 0.5s; text-shadow: 2px 2px 0 var(--ink);
}
body.ready .scroll-cue { opacity: 1; }
.scroll-cue i { width: 22px; height: 14px; background: var(--gold); clip-path: polygon(0 0, 100% 0, 50% 100%); animation: hop 0.9s cubic-bezier(0.3, 0, 0.6, 1) infinite alternate; filter: drop-shadow(2px 2px 0 var(--ink)); }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; display: block; width: 14px; height: 14px; opacity: 0.9; animation: floaty linear infinite; }
.confetti .c-star { background: var(--gold); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.confetti .c-plus { background: var(--mint); clip-path: polygon(35% 0, 65% 0, 65% 35%, 100% 35%, 100% 65%, 65% 65%, 65% 100%, 35% 100%, 35% 65%, 0 65%, 0 35%, 35% 35%); }
.confetti .c-dot { background: var(--pink); border-radius: 50%; }
.confetti .c-sq { background: var(--sky); transform: rotate(45deg); }
@media (max-width: 640px) {
  .hero-stage { aspect-ratio: 4 / 3; }
  #logo { object-fit: cover; }
}

/* =========================================================
   MARQUEE
   ========================================================= */
.marquee {
  position: relative; z-index: 3; overflow: hidden; background: var(--gold); color: var(--ink);
  border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink); transform: rotate(-2deg) scale(1.04); margin: -26px 0 -10px;
}
.marquee-track { display: flex; width: max-content; animation: marquee 26s linear infinite; font-family: var(--pix); font-size: 14px; padding: 14px 0 11px; white-space: nowrap; }
.marquee-track span { padding: 0 22px; }
.marquee-track span:nth-child(3n + 2) { color: #c8264f; }
.marquee-track .sep { color: var(--cap); padding: 0; }

/* =========================================================
   SECTIONS
   ========================================================= */
section { position: relative; }
.sec-head { text-align: center; margin-bottom: 48px; }
.sec-kicker { font-family: var(--pix); font-size: 11px; color: var(--pink); letter-spacing: 0.3em; margin: 0 0 12px; }
.sec-title { font-family: var(--pix); font-weight: normal; font-size: clamp(30px, 6.5vw, 64px); margin: 0; line-height: 1.1; color: #fff; }
.sec-title .ch { display: inline-block; text-shadow: 4px 4px 0 var(--ink), 8px 8px 0 var(--pink); }
.sec-title.in .ch { animation: wave 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * 0.08s); }
.sec-sub { font-family: var(--dot); font-size: 16px; color: var(--ink); margin: 18px 0 0; }

/* ---------- works ---------- */
#works {
  padding: 120px 20px 110px; color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(255, 95, 162, 0.22) 2.4px, transparent 2.6px),
    radial-gradient(rgba(58, 90, 168, 0.12) 2.4px, transparent 2.6px);
  background-size: 28px 28px, 28px 28px; background-position: 0 0, 14px 14px;
  animation: dots 18s linear infinite;
}
#works .sec-title { color: var(--cream); }
#works .sec-head { margin-bottom: 96px; }
#works .sec-title .ch { text-shadow: 4px 4px 0 var(--ink), 8px 8px 0 var(--pink); -webkit-text-stroke: 0; color: var(--gold); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 40px 34px; max-width: 1180px; margin: 0 auto; perspective: 1200px; }
.cards-hint { text-align: center; font-family: var(--dot); color: #6a5e8a; margin: 46px 0 0; font-size: 14px; }
@media (hover: none) { .cards-hint { display: none; } }

.card {
  --c: var(--pink); --c2: var(--gold); --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%;
  position: relative; display: block; text-align: left; width: 100%; padding: 0; border: 0; background: none; color: var(--ink);
  transform-style: preserve-3d; transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.25s ease-out;
  opacity: 0; translate: 0 60px; scale: 0.85;
}
.card.in { animation: pop-in 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) forwards; animation-delay: calc(var(--i) * 0.12s); }
.card-shell {
  position: relative; border: 4px solid var(--ink); border-radius: 22px 22px 18px 18px; background: var(--c); padding: 14px 14px 18px;
  box-shadow: 10px 10px 0 var(--ink); transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover .card-shell, .card.focus .card-shell { box-shadow: 16px 16px 0 var(--ink); transform: translate(-4px, -6px); }
.card-shell::before { /* cartridge grip ridges */
  content: ''; position: absolute; top: 10px; right: 14px; width: 54px; height: 10px;
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.25) 0 4px, transparent 4px 8px); border-radius: 3px;
}
.card-top { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 10px; font-family: var(--pix); font-size: 10px; color: #fff; text-shadow: 2px 2px 0 var(--ink); }
.card-top .badge { background: var(--ink); color: var(--c2); padding: 5px 8px 3px; border-radius: 6px; text-shadow: none; }
.card-label { position: relative; border: 4px solid var(--ink); border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.card-label img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity 0.4s, transform 5s ease-out; }
.card-label img + img { opacity: 0; }
.card:hover .card-label img, .card.focus .card-label img { transform: scale(1.08); }
.card:hover .card-label img + img, .card.focus .card-label img + img { opacity: 1; }
.card-label::after { /* holo shine */
  content: ''; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(255, 255, 255, 0.55), transparent 45%),
    linear-gradient(115deg, transparent 30%, rgba(255, 95, 162, 0.35) 45%, rgba(79, 240, 192, 0.35) 55%, transparent 70%);
  background-size: 100% 100%, 250% 250%; background-position: 0 0, var(--mx) var(--my);
}
.card:hover .card-label::after, .card.focus .card-label::after { opacity: 1; }
.card-play {
  position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; margin: -34px 0 0 -34px; border-radius: 50%;
  background: var(--cream); border: 4px solid var(--ink); display: grid; place-items: center; box-shadow: 4px 4px 0 var(--ink);
  transform: scale(0) rotate(-90deg); transition: transform 0.35s cubic-bezier(0.2, 1.8, 0.4, 1);
}
.card-play::before { content: ''; margin-left: 6px; border-left: 20px solid var(--ink); border-top: 12px solid transparent; border-bottom: 12px solid transparent; }
.card:hover .card-play, .card.focus .card-play { transform: scale(1) rotate(0); }
.card-tv { position: absolute; left: 10px; bottom: 10px; font-family: var(--pix); font-size: 9px; color: #fff; background: rgba(0, 0, 0, 0.6); padding: 6px 8px 4px; border-radius: 6px; }
.card-tv::before { content: '● '; color: #ff3a3a; animation: blink 1s steps(2) infinite; }
.card-body { background: var(--cream); border: 4px solid var(--ink); border-radius: 12px; margin-top: 12px; padding: 16px 16px 14px; }
.card-logo { line-height: 1.1; margin: 0 0 6px; min-height: 1.2em; font-size: 26px; letter-spacing: 0.02em; }
.card-logo small { display: block; font-size: 0.42em; letter-spacing: 0.6em; margin-top: 0.4em; }
.card-logo-wrap { background: #16122e; border-radius: 8px; padding: 14px 12px 12px; margin: -4px -4px 12px; text-align: center; overflow: hidden; }
.card-kana { font-family: var(--dot); font-size: 12px; color: #6a5e8a; margin: 0; }
.card-catch { font-weight: 800; font-size: 17px; margin: 6px 0 10px; line-height: 1.5; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.card-tags li { font-family: var(--dot); font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; }
.card-tags li:first-child { background: var(--c2); }
.card-cursor { /* Pyama-kun hopping over the selected card */
  position: absolute; left: 50%; top: -74px; width: 68px; height: 76px; margin-left: -34px; pointer-events: none; z-index: 2;
  opacity: 0; transform: translateY(16px) scale(0.6); transition: opacity 0.15s, transform 0.25s cubic-bezier(0.2, 1.8, 0.4, 1);
}
.card:hover .card-cursor, .card.focus .card-cursor { opacity: 1; transform: none; }
.card-cursor canvas { width: 100%; height: 100%; animation: hop-kun 0.5s cubic-bezier(0.3, 0, 0.6, 1) infinite alternate; }
.card.coming { pointer-events: none; filter: grayscale(1); opacity: 0.6; }

/* ---------- about ---------- */
#about { padding: 130px 20px 120px; background: linear-gradient(180deg, #2b1e78 0%, var(--night) 100%); overflow: hidden; }
#about::before { /* big moon */
  content: ''; position: absolute; width: 520px; height: 520px; right: -160px; top: -120px; border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fff6d8, #f2c560 60%, #d89a3a); opacity: 0.12; filter: blur(2px);
}
.about-grid { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 30px; }
.about-card { position: relative; background: var(--cream); color: var(--ink); border: 4px solid var(--ink2); border-radius: 22px; padding: 30px 30px 26px 170px; box-shadow: 10px 10px 0 var(--ink2); }
.about-card h3 { font-family: var(--pix); font-weight: normal; font-size: 20px; margin: 0 0 14px; color: var(--cap); }
.about-card p { margin: 0 0 10px; }
.about-card .dim { color: #6a5e8a; font-family: var(--dot); }
#about-kun { position: absolute; left: 24px; top: 50%; width: 128px; height: 143px; margin-top: -72px; animation: bob 2.4s ease-in-out infinite; }
.powerups { grid-column: 1 / -1; list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.powerups li { background: var(--ink2); border: 3px solid var(--cap); border-radius: 18px; padding: 22px 22px 20px; display: grid; grid-template-columns: 48px 1fr; column-gap: 16px; align-items: center; transition: transform 0.2s, border-color 0.2s; }
.powerups li:hover { transform: translateY(-6px) rotate(-1deg); border-color: var(--gold); }
.powerups b { font-family: var(--pop); font-weight: 400; font-size: 18px; color: #fff; }
.powerups span { grid-column: 2; font-size: 13px; color: #cfc4ee; line-height: 1.6; }
.pu { grid-row: 1 / 3; width: 48px; height: 48px; image-rendering: pixelated; background-size: contain; background-repeat: no-repeat; animation: bob 2s ease-in-out infinite; }
.powerups li:nth-child(2) .pu { animation-delay: -0.6s; }
.powerups li:nth-child(3) .pu { animation-delay: -1.2s; }
.pu-browser { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Cpath fill='%231b1446' d='M0 1h12v10H0z'/%3E%3Cpath fill='%23fff6e6' d='M1 4h10v6H1z'/%3E%3Cpath fill='%23ff5fa2' d='M1 2h1v1H1z'/%3E%3Cpath fill='%23f2c560' d='M3 2h1v1H3z'/%3E%3Cpath fill='%234ff0c0' d='M5 2h1v1H5z'/%3E%3Cpath fill='%233a5aa8' d='M5 5l3 2-3 2z'/%3E%3C/svg%3E"); }
.pu-code { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Cpath fill='%234ff0c0' d='M3 3h1v1H3zM2 4h1v1H2zM1 5h1v2H1zM2 7h1v1H2zM3 8h1v1H3zM8 3h1v1H8zM9 4h1v1H9zM10 5h1v2h-1zM9 7h1v1H9zM8 8h1v1H8z'/%3E%3Cpath fill='%23ff5fa2' d='M6 2h1v2H6zM5 4h1v4H5zM4 8h1v2H4z'/%3E%3C/svg%3E"); }
.pu-note { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Cpath fill='%23f2c560' d='M4 1h7v2H6v6H4V3h0zM9 3h2v5H9z'/%3E%3Cpath fill='%23f2c560' d='M1 8h4v3H1zM7 7h4v3H7z'/%3E%3C/svg%3E"); }
@media (max-width: 860px) {
  .powerups { grid-template-columns: 1fr; }
  .about-card { padding: 150px 22px 22px; }
  #about-kun { left: 50%; top: 18px; margin: 0 0 0 -64px; }
}
.reveal { opacity: 0; transform: translateY(40px) scale(0.92); transition: opacity 0.6s, transform 0.7s cubic-bezier(0.2, 1.6, 0.4, 1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- continue footer ---------- */
#continue { text-align: center; padding: 90px 20px 50px; background: var(--ink2); border-top: 4px solid #000; }
.cont-title { font-family: var(--pix); font-size: clamp(22px, 5vw, 40px); color: #fff; margin: 0; text-shadow: 4px 4px 0 #a8323a; }
.cont-count { font-family: var(--pix); font-size: clamp(60px, 12vw, 110px); color: var(--gold); margin: 18px 0 26px; line-height: 1; text-shadow: 6px 6px 0 #a8323a; }
.cont-count.tick { animation: bump 0.3s; }
.cont-count.over { font-size: clamp(30px, 7vw, 60px); color: #ff3a3a; text-shadow: 4px 4px 0 #000; animation: shake 0.4s; }
.cont-btns { display: flex; gap: 16px; justify-content: center; }
.copy { font-family: var(--pix); font-size: 9px; color: #6a5e8a; margin: 60px 0 0; letter-spacing: 0.1em; line-height: 2; }

/* =========================================================
   TV ROOM
   ========================================================= */
#tv-room {
  --c: var(--pink); --c2: var(--gold);
  position: fixed; inset: 0; z-index: 80; overflow: auto; overscroll-behavior: contain;
  background: var(--c); color: var(--ink);
  display: flex; align-items: center; justify-content: center; padding: 70px 24px 40px;
}
#tv-room[hidden] { display: none; }
.rays {
  position: fixed; left: 50%; top: 50%; width: 260vmax; height: 260vmax; margin: -130vmax 0 0 -130vmax; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.16) 0deg 10deg, transparent 10deg 20deg);
  animation: spin 40s linear infinite;
}
#tv-room::before { content: ''; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 40% 50%, transparent 30%, rgba(20, 10, 60, 0.45) 100%); }
.tv-close {
  position: fixed; top: 16px; left: 16px; z-index: 5; display: flex; align-items: center; gap: 10px;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 12px; padding: 10px 14px 8px; font-family: var(--pix); font-size: 14px; box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.12s;
}
.tv-close span { font-size: 10px; }
.tv-close:hover { transform: translateY(-2px) rotate(-3deg); }
.tv-layout { position: relative; display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 34px; align-items: center; width: min(1320px, 100%); }
.tv-wrap { position: relative; }
#tv-room.show .tv { animation: tv-drop 0.8s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
#tv-room.show .tv-info { animation: slide-in 0.7s 0.2s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.tv { position: relative; padding-top: 70px; }
.antenna { position: absolute; left: 50%; top: 0; width: 0; height: 80px; }
.antenna i { position: absolute; bottom: 0; left: -3px; width: 6px; height: 110px; background: var(--ink); border-radius: 3px; transform-origin: 50% 100%; }
.antenna i::before { content: ''; position: absolute; top: -10px; left: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--c2); border: 3px solid var(--ink); }
.antenna i:first-child { transform: rotate(-32deg); animation: ant-l 2.2s ease-in-out infinite; }
.antenna i:last-child { transform: rotate(28deg); animation: ant-r 2.6s ease-in-out infinite; }
.antenna::after { content: ''; position: absolute; left: -36px; bottom: -14px; width: 72px; height: 30px; background: var(--ink); border-radius: 36px 36px 0 0; }
.tv-body {
  position: relative; display: grid; grid-template-columns: 1fr 112px; gap: 18px;
  background: #fff1d6; border: 5px solid var(--ink); border-radius: 34px; padding: 22px;
  box-shadow: inset -10px -12px 0 rgba(150, 100, 60, 0.18), inset 8px 8px 0 rgba(255, 255, 255, 0.7), 14px 14px 0 var(--ink);
  background-image: repeating-linear-gradient(0deg, rgba(150, 100, 60, 0.05) 0 3px, transparent 3px 9px);
}
.tv-screen { background: #2a2440; border: 5px solid var(--ink); border-radius: 26px; padding: 14px; box-shadow: inset 0 0 0 5px #4a4268; }
.tv-glass { position: relative; aspect-ratio: 16 / 9; border-radius: 22px / 26px; overflow: hidden; background: #000; isolation: isolate; }
.tv-frame { position: absolute; inset: 0; }
.tv-frame iframe { position: absolute; left: 0; top: 0; width: 960px; height: 540px; transform-origin: 0 0; border: 0; pointer-events: none; opacity: 0; transition: opacity 0.4s; background: #000; }
.tv-frame iframe.on { opacity: 1; }
.tv-static { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; opacity: 0; transition: opacity 0.2s; z-index: 2; }
.tv-static.on { opacity: 1; }
.tv-osd { position: absolute; left: 4%; top: 6%; right: 4%; z-index: 4; display: flex; justify-content: space-between; font-family: var(--pix); font-size: clamp(10px, 1.6vw, 18px); color: #5aff7a; text-shadow: 0 0 6px rgba(90, 255, 122, 0.9), 2px 2px 0 #000; pointer-events: none; opacity: 0; transition: opacity 0.2s; }
.tv-osd.on { opacity: 1; }
.osd-msg { animation: blink 0.9s steps(2) infinite; }
.tv-scan { position: absolute; inset: 0; z-index: 6; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.7);
  animation: flicker 0.12s steps(2) infinite;
}
.tv-scan::after { content: ''; position: absolute; inset: 0; background: linear-gradient(130deg, rgba(255, 255, 255, 0.14) 0%, transparent 28%); }
.tv-off { position: absolute; inset: 0; z-index: 5; background: #000; pointer-events: none; }
.tv-off::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; background: #fff; box-shadow: 0 0 20px #fff; transform: scaleX(0); opacity: 0; }
.tv-off.boot { animation: tv-on-bg 0.7s forwards; }
.tv-off.boot::after { animation: tv-on-line 0.7s forwards; }
.tv-off.hide { display: none; }
.tv-off.shutdown { display: block; animation: tv-off-bg 0.45s forwards; }
.tv-off.shutdown::after { animation: tv-off-line 0.45s forwards; }
.tv-end { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.4%; text-align: center; background: rgba(8, 6, 24, 0.78); opacity: 0; visibility: hidden; transition: opacity 0.6s, visibility 0.6s; padding: 0 6%; }
.tv-end.on { opacity: 1; visibility: visible; }
.end-logo { font-size: clamp(18px, 4vw, 48px); line-height: 1.1; }
.end-logo small { display: block; font-size: 0.4em; letter-spacing: 0.6em; margin-top: 0.4em; }
.end-catch { font-weight: 800; color: #fff; font-size: clamp(12px, 1.8vw, 20px); }
.end-btns .pbtn:not(.ghost) { background: var(--c); }
.end-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 1.5%; }
.tv-end.on .end-logo { animation: pop-in-s 0.6s cubic-bezier(0.2, 1.8, 0.4, 1) both; }
.tv-unmute { position: absolute; z-index: 7; right: 3%; bottom: 5%; font-family: var(--dot); font-size: 14px; background: var(--gold); color: var(--ink); border: 3px solid var(--ink); border-radius: 999px; padding: 6px 14px; box-shadow: 0 4px 0 var(--ink); animation: wiggle 1.4s ease-in-out infinite; }
.tv-unmute[hidden] { display: none; }
.tv-panel { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 10px 0; }
.tv-brand { font-family: var(--pix); font-size: 11px; color: #fff1d6; background: var(--ink); padding: 6px 8px 4px; border-radius: 6px; letter-spacing: 0.1em; }
.knob { width: 70px; height: 70px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #d8cbb0 60%, #a8987a); border: 4px solid var(--ink); position: relative; box-shadow: 0 5px 0 var(--ink); transition: transform 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); }
.knob i { position: absolute; left: 50%; top: 6px; width: 6px; height: 22px; margin-left: -3px; border-radius: 3px; background: var(--c); border: 2px solid var(--ink); }
.knob-vol { width: 52px; height: 52px; }
.knob-vol i { height: 16px; top: 4px; }
.tv-grill { width: 76px; height: 70px; border-radius: 12px; background: repeating-linear-gradient(0deg, var(--ink) 0 4px, transparent 4px 9px); opacity: 0.85; }
.tv-chbtns { display: flex; gap: 8px; }
.tv-chbtns button { width: 40px; height: 34px; border: 3px solid var(--ink); border-radius: 8px; background: var(--c2); font-size: 12px; box-shadow: 0 4px 0 var(--ink); line-height: 1; }
.tv-chbtns button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.tv-led { width: 14px; height: 14px; border-radius: 50%; background: #5a1a1a; border: 3px solid var(--ink); }
#tv-room.power .tv-led { background: #ff3a3a; box-shadow: 0 0 12px #ff3a3a; }
.tv-feet { display: flex; justify-content: space-between; padding: 0 12%; }
.tv-feet i { width: 70px; height: 22px; background: var(--ink); border-radius: 0 0 14px 14px; }
.tv-progress { position: relative; height: 12px; margin: 14px 4% 0; background: rgba(27, 20, 70, 0.35); border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; }
.tv-progress i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: repeating-linear-gradient(-45deg, var(--c2) 0 10px, #fff 10px 20px); background-size: 28px 28px; animation: barber 0.8s linear infinite; }

.tv-info {
  position: relative; background: var(--cream); border: 4px solid var(--ink); border-radius: 22px; padding: 26px 26px 22px; box-shadow: 12px 12px 0 var(--ink);
}
.info-no { position: absolute; top: -20px; left: 22px; font-family: var(--pix); font-size: 11px; background: var(--ink); color: var(--c2); padding: 9px 12px 7px; border-radius: 8px; transform: rotate(-3deg); }
.info-title { margin: 6px 0 2px; line-height: 1.15; font-size: 30px; font-weight: normal; }
.info-title small { display: block; font-size: 0.42em; letter-spacing: 0.6em; margin-top: 0.4em; }
.info-title-bg { background: #16122e; border-radius: 12px; padding: 16px 14px 14px; text-align: center; margin: 0 0 8px; }
.info-kana { font-family: var(--dot); font-size: 13px; color: #6a5e8a; margin: 6px 0 0; }
.info-genre { display: inline-block; font-family: var(--dot); font-size: 13px; background: var(--c2); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 12px; margin: 8px 0 0; }
.info-catch { font-weight: 800; font-size: 21px; line-height: 1.45; margin: 12px 0 8px; }
.info-desc { font-size: 14px; line-height: 1.85; margin: 0 0 12px; }
.info-feat { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 13px; }
.info-feat li::before { content: '★ '; color: var(--c); -webkit-text-stroke: 1px var(--ink); }
.info-song { font-family: var(--dot); font-size: 13px; margin: 0 0 16px; color: #4a3e6a; }
.info-btns { display: flex; flex-wrap: wrap; gap: 12px; }
.info-btns .pbtn.big { background: var(--c); }
.info-keys { font-family: var(--dot); font-size: 12px; color: #6a5e8a; margin: 16px 0 0; }
@media (hover: none) { .info-keys { display: none; } }
@media (max-width: 1000px) {
  #tv-room { align-items: flex-start; padding: 76px 16px 40px; }
  .tv-layout { grid-template-columns: 1fr; gap: 30px; }
  .tv-body { grid-template-columns: 1fr; padding: 14px; border-radius: 24px; }
  .tv-panel { flex-direction: row; justify-content: space-between; padding: 0 6px; gap: 10px; }
  .tv-grill { height: 34px; width: 90px; }
  .knob { width: 46px; height: 46px; }
  .knob i { height: 14px; top: 3px; }
  .knob-vol { width: 36px; height: 36px; }
  .knob-vol i { height: 10px; top: 2px; }
  .tv-screen { padding: 8px; border-radius: 18px; }
  .tv-glass { border-radius: 12px / 14px; }
  .tv { padding-top: 54px; }
  .antenna i { height: 80px; }
}
@media (max-width: 520px) {
  .tv-brand, .knob-vol { display: none; }
  .tv-feet i { width: 44px; height: 14px; }
  .info-feat { grid-template-columns: 1fr; }
  .tv-info { padding: 26px 18px 20px; }
  .tv-close span { display: none; }
}

/* =========================================================
   PAUSE
   ========================================================= */
#pause {
  position: fixed; inset: 0; z-index: 98; display: grid; place-items: center; padding: 16px;
  background: rgba(14, 10, 40, 0.82); backdrop-filter: blur(6px) grayscale(0.6); -webkit-backdrop-filter: blur(6px) grayscale(0.6);
  animation: pause-in 0.25s steps(4) both;
}
#pause[hidden] { display: none; }
.pause-box { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#pause-kun { width: 102px; height: 114px; image-rendering: pixelated; }
.pause-title { font-family: var(--pix); font-size: clamp(40px, 10vw, 88px); line-height: 1; margin: 6px 0 4px; color: var(--gold); text-shadow: 5px 5px 0 var(--pink), 10px 10px 0 var(--ink2); letter-spacing: 0.08em; animation: blink 1.2s steps(2) infinite; }
.pause-game { font-family: var(--pix); font-size: 12px; color: var(--mint); margin: 8px 0 0; letter-spacing: 0.1em; }
.pause-note { font-family: var(--dot); font-size: 15px; color: #e6dcff; margin: 4px 0 14px; line-height: 1.8; }
.pause-hint { font-family: var(--dot); font-size: 12px; color: #8a80b0; margin: 10px 0 0; }
@media (hover: none) { .pause-hint { display: none; } }
/* freeze everything behind the pause screen */
body.paused main *, body.paused main *::before, body.paused main *::after,
body.paused #hud *, body.paused #tv-room, body.paused #tv-room *, body.paused #tv-room *::before, body.paused #tv-room *::after,
body.paused #tv-room::before, body.paused main::before { animation-play-state: paused !important; }
@keyframes pause-in { from { opacity: 0; } to { opacity: 1; } }

/* =========================================================
   WIPE & FX
   ========================================================= */
#wipe { position: fixed; inset: 0; z-index: 90; pointer-events: none; display: grid; }
#wipe i { background: var(--ink2); transform: scale(0) rotate(45deg); transition: transform 0.32s cubic-bezier(0.6, 0, 0.4, 1); }
#wipe.cover i { transform: scale(1.5) rotate(45deg); }
#fx { position: fixed; inset: 0; z-index: 95; pointer-events: none; overflow: hidden; }
#fx .spark { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; }
#fx .pts { position: absolute; font-family: var(--pix); font-size: 12px; color: #fff; text-shadow: 2px 2px 0 var(--ink); animation: pts 0.9s ease-out forwards; }

/* =========================================================
   KEYFRAMES
   ========================================================= */
@keyframes blink { 50% { opacity: 0; } }
@keyframes twinkle { 33% { opacity: 0.5; } 66% { opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes bump { 40% { transform: scale(1.3); } }
@keyframes nudge { 50% { transform: translateX(3px); } }
@keyframes hop { to { transform: translateY(10px); } }
@keyframes hop-kun { to { transform: translateY(-10px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) scale(1.05); } }
@keyframes wave { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-14px); } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes dots { to { background-position: 280px 280px, 294px 294px; } }
@keyframes floaty { 0% { transform: translateY(0) rotate(0); } 100% { transform: translateY(-120vh) rotate(720deg); } }
@keyframes pop-in { 0% { opacity: 0; translate: 0 60px; scale: 0.85; } 100% { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes pop-in-s { 0% { transform: scale(0.3) rotate(-8deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ant-l { 50% { transform: rotate(-24deg); } }
@keyframes ant-r { 50% { transform: rotate(36deg); } }
@keyframes tv-drop { 0% { transform: translateY(-80vh) rotate(-8deg); } 100% { transform: none; } }
@keyframes slide-in { 0% { transform: translateX(60vw) rotate(10deg); } 100% { transform: none; } }
@keyframes tv-on-bg { 0%, 55% { background: #000; } 100% { background: transparent; } }
@keyframes tv-on-line { 0% { transform: scaleX(0); opacity: 1; } 40% { transform: scaleX(1); opacity: 1; height: 4px; } 70% { transform: scaleX(1) scaleY(60); opacity: 0.8; } 100% { transform: scaleX(1) scaleY(140); opacity: 0; } }
@keyframes tv-off-bg { 0% { background: transparent; } 30%, 100% { background: #000; } }
@keyframes tv-off-line { 0% { transform: scaleX(1) scaleY(100); opacity: 0.9; } 40% { transform: scaleX(1) scaleY(1); opacity: 1; } 100% { transform: scaleX(0); opacity: 1; } }
@keyframes flicker { 50% { opacity: 0.93; } }
@keyframes barber { to { background-position: 28px 0; } }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes pts { 0% { transform: translate(-50%, 0) scale(0.6); opacity: 1; } 30% { transform: translate(-50%, -20px) scale(1.2); } 100% { transform: translate(-50%, -60px) scale(1); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .card { opacity: 1; translate: none; scale: none; }
  html { scroll-behavior: auto; }
}
