﻿:root {
  --bg1: #fff0f7;
  --bg2: #efe6ff;
  --ink: #3b1f47;
  --muted: #8a6a96;
  --card: #ffffff;
  --line: #f3d6e8;
  --pink: #ff6fae;
  --pink-deep: #e04a92;
  --lilac: #b58cff;
  --mint: #5ee8a8;
  --gold: #ffc94d;
  --shadow: 0 10px 30px rgba(180, 60, 130, 0.15);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Nunito, "Segoe UI", sans-serif; color: var(--ink);
  background: radial-gradient(1200px 600px at 10% -10%, #ffd9ec 0%, transparent 60%),
              radial-gradient(1000px 600px at 110% 10%, #e2d4ff 0%, transparent 60%),
              linear-gradient(180deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
}
body.playing { overflow: hidden; background: #12061a; }
h1, h2, h3, .grade { font-family: Fredoka, Nunito, sans-serif; }
kbd { display: inline-block; padding: 1px 7px; border-radius: 6px; border: 1px solid #e7bcd6; background: #fff;
  font: 700 12px Nunito, sans-serif; color: var(--pink-deep); box-shadow: 0 2px 0 #f3cfe3; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- frame (hearts + streamers) ---------- */
#frame { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
#frame svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.streamer { transform-box: fill-box; transform-origin: 50% 0; animation: sway 3.2s ease-in-out infinite alternate; }
.streamer.s2 { animation-duration: 2.6s; animation-delay: -1.2s; }
.streamer.s3 { animation-duration: 3.8s; animation-delay: -0.6s; }
@keyframes sway { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
.corner-heart { transform-box: fill-box; transform-origin: center; animation: beat 1.4s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.14); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }
.float-heart { position: absolute; bottom: -30px; color: var(--pink); opacity: 0; animation: rise linear infinite; font-size: 18px; }
@keyframes rise { 0% { transform: translateY(0) rotate(-10deg); opacity: 0; } 10% { opacity: 0.85; }
  100% { transform: translateY(-105vh) rotate(15deg); opacity: 0; } }
/* ---------- per-song themes (themes.js) ---------- */
#frame { --beat: 0.46s; }
.mascot { position: absolute; bottom: 14px; width: clamp(64px, 9vw, 112px); height: clamp(64px, 9vw, 112px); }
.mascot.left { left: 14px; }
.mascot.right { right: 14px; transform: scaleX(-1); }
.mascot svg { width: 100%; height: 100%; overflow: visible; }
.m-emoji { display: grid; place-items: center; width: 100%; height: 100%; font-size: clamp(48px, 7vw, 86px); line-height: 1; }
.m-bop, .m-bob { transform-box: fill-box; transform-origin: 50% 100%; animation: bop var(--beat) ease-out infinite; }
@keyframes bop { 0% { transform: scale(1.12, 0.9) translateY(0); } 30% { transform: scale(0.96, 1.06) translateY(-6%); } 100% { transform: scale(1) translateY(0); } }
.m-jaw { transform-box: fill-box; transform-origin: 90% 0; animation: chomp var(--beat) ease-in-out infinite; }
@keyframes chomp { 0%, 100% { transform: rotate(0deg); } 40% { transform: rotate(16deg) translateY(4px); } }
.m-eye { animation: look calc(var(--beat) * 8) steps(1) infinite; }
@keyframes look { 0%, 60% { transform: translateX(0); } 61%, 100% { transform: translateX(-3px); } }
.m-spin { transform-box: view-box; transform-origin: 50px 52px; animation: spin calc(var(--beat) * 2) linear infinite; }
.m-spin.slow { transform-origin: 50px 50px; animation-duration: calc(var(--beat) * 16); }
@keyframes spin { to { transform: rotate(360deg); } }
.m-up, .m-down { animation: lamp calc(var(--beat) * 2) steps(1) infinite; }
.m-down { animation-delay: calc(var(--beat) * -1); }
@keyframes lamp { 0% { fill: #ffe066; } 50% { fill: #fff; } }
.m-ear { transform-box: fill-box; transform-origin: 50% 100%; animation: twitch calc(var(--beat) * 4) ease-in-out infinite; }
.m-ear.r { animation-delay: calc(var(--beat) * -2); }
@keyframes twitch { 0%, 80%, 100% { transform: rotate(0); } 88% { transform: rotate(-14deg); } }
.m-whip { stroke-dasharray: 120; animation: whip calc(var(--beat) * 2) ease-in-out infinite; }
@keyframes whip { 0% { stroke-dashoffset: 120; } 40% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -120; } }
.bubble { position: absolute; bottom: 100%; white-space: nowrap; background: #fff; color: #3b1f47; border-radius: 14px; padding: 4px 10px;
  font: 700 14px Fredoka, sans-serif; box-shadow: 0 4px 12px rgba(0,0,0,.2); opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
.bubble.left { left: 40%; }
.bubble.right { left: 40%; transform: scaleX(-1) translateY(6px); }
.bubble.on { opacity: 1; transform: translateY(0); }
.bubble.right.on { transform: scaleX(-1); }
.top-icons { position: absolute; top: 18px; left: 40px; right: 40px; display: flex; justify-content: space-between; font-size: 26px;
  font-family: Fredoka, sans-serif; font-weight: 700; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.35); }
.top-icons span { display: inline-block; animation: sway calc(var(--beat) * 2) ease-in-out infinite alternate; }
.bulb { animation: glow calc(var(--beat) * 2) steps(1) infinite; }
.bulb.b1 { animation-delay: calc(var(--beat) * -1); }
@keyframes glow { 0% { opacity: 1; filter: drop-shadow(0 0 6px currentColor); } 50% { opacity: 0.35; } }
.twinkle { animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
.wave { animation: drift 6s linear infinite; }
.wave.w2 { animation-duration: 9s; animation-direction: reverse; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-60px); } }
.tape-text { animation: tape 22s linear infinite; }
@keyframes tape { from { transform: translateX(0); } to { transform: translateX(-300px); } }
/* neon themes (top:'neon', glow:true, mascot:'neon'): tubes pulse on the beat, the sign flickers now and then */
body:not(.playing) #frame .neon-signbox, body:not(.playing) #frame .neon-ring { display: none; }   /* the sign would cover the song pop-up's title */
.neon-border { animation: neon-pulse calc(var(--beat) * 2) ease-in-out infinite; }
@keyframes neon-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.72; } }
.neon-sign, .neon-tube { animation: neon-flicker calc(var(--beat) * 16) steps(1) infinite; }
@keyframes neon-flicker { 0%, 61%, 63%, 66%, 100% { opacity: 1; } 62%, 64.5% { opacity: 0.25; } }
.neon-dash { animation: glow calc(var(--beat) * 2) steps(1) infinite; }
.neon-ring { transform-box: fill-box; transform-origin: center; animation: beat calc(var(--beat) * 2) ease-in-out infinite; }
.neon-flick { animation: neon-flicker calc(var(--beat) * 12) steps(1) infinite; }
.neon-flick.f2 { animation-delay: calc(var(--beat) * -5); }
@media (prefers-reduced-motion: reduce) {
  .neon-border, .neon-sign, .neon-tube, .neon-dash, .neon-ring, .neon-flick { animation: none; }
  .streamer, .corner-heart, .float-heart, .m-bop, .m-bob, .m-jaw, .m-spin, .m-up, .m-down, .m-ear, .m-whip, .bulb, .twinkle, .wave, .tape-text, .top-icons span { animation: none; }
  .float-heart { display: none; }
}
#tint { position: absolute; inset: 0; pointer-events: none; }

/* ---------- play-screen key hints ---------- */
.play-hints { position: absolute; left: 30px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: flex-start;
  gap: 12px; z-index: 6; }
.play-hints button { display: flex; align-items: center; gap: 9px; cursor: pointer; border: 2px solid rgba(255,255,255,0.55);
  background: rgba(30, 8, 40, 0.72); color: #fff; padding: 9px 16px 9px 12px; border-radius: 999px;
  font: 800 17px Nunito, sans-serif; text-shadow: 0 1px 3px rgba(0,0,0,.6); box-shadow: 0 4px 14px rgba(0,0,0,.35); backdrop-filter: blur(4px); }
.play-hints button:hover { background: rgba(224, 74, 146, 0.85); border-color: #fff; }
.play-hints svg { width: 20px; height: 20px; flex: none; }
.play-hints kbd { font-size: 13px; padding: 1px 7px; }
.play-hints:has(~ #results:not(.hidden)), .play-hints:has(~ #pause:not(.hidden)) { display: none; }
.home-hints { margin-top: 6px; font-size: 13px; color: var(--muted); font-weight: 700; }

/* ---------- player / overall leaderboard ---------- */
.me-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; margin-top: 10px; font-weight: 800; color: var(--muted); font-size: 14px; }
.me-bar b { color: var(--pink-deep); font-family: Fredoka, sans-serif; letter-spacing: 1px; }
.me-bar button { border: 2px solid var(--line); background: #fff; color: var(--pink-deep); border-radius: 999px; padding: 3px 12px; font-weight: 800; font-size: 13px; }
.overall { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 16px; }
.overall .scores li { grid-template-columns: 32px 56px 1fr auto; }
.overall .you { margin-top: 8px; font-weight: 800; color: var(--muted); text-align: center; font-size: 14px; }
.ini-form { display: flex; gap: 8px; justify-content: center; align-items: center; }
.ini-form input { width: 120px; text-align: center; font: 700 30px Fredoka, sans-serif; letter-spacing: 10px; text-transform: uppercase;
  border: 3px solid var(--pink); border-radius: 12px; padding: 4px 6px 4px 14px; color: var(--ink); outline: none; }
.ini-form input:focus { box-shadow: 0 0 0 4px #ffd3e8; }
.saved-as { margin-top: 10px; text-align: center; font-weight: 800; color: var(--muted); font-size: 14px; }
.saved-as b { color: var(--pink-deep); }
.saved-as button { border: 0; background: none; color: var(--pink-deep); text-decoration: underline; font-weight: 800; }
.toggle, .settings label.toggle { display: flex; flex-direction: row; align-items: center; gap: 8px; color: var(--ink); cursor: pointer; }
.settings label.toggle.muted { color: var(--muted); cursor: default; }
.toggle input { width: 18px; height: 18px; accent-color: var(--pink); }

/* ---------- home ---------- */
#home { max-width: 1060px; margin: 0 auto; padding: 84px 36px 60px; }
.brand { text-align: center; margin-bottom: 26px; position: relative; }

.home-hints a { color: var(--pink-deep); font-weight: 800; text-decoration: none; }
.home-hints a:hover { text-decoration: underline; }

/* ---------- language flags ---------- */
.lang-picker { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0 auto 12px; }
.brand .lang-picker { position: absolute; right: 0; top: 0; margin: 0; max-width: 46%; justify-content: flex-end; }
.lang-btn { border: 2px solid transparent; background: #fff; border-radius: 8px; padding: 3px; cursor: pointer; line-height: 0;
  box-shadow: 0 2px 6px rgba(90, 20, 80, 0.15); transition: transform .12s; }
.lang-btn:hover { transform: translateY(-2px); }
.lang-btn.on { border-color: var(--pink); box-shadow: 0 0 0 2px #ffd3e8; }
.lang-btn .flag { width: 30px; height: 20px; display: block; border-radius: 3px; }
@media (max-width: 720px) { .brand .lang-picker { position: static; max-width: none; justify-content: center; margin-bottom: 10px; } }

/* ---------- mascot cat ---------- */
.home-cat { display: block; margin: 0 auto 6px; width: clamp(110px, 16vw, 170px); aspect-ratio: 1; object-fit: cover; border-radius: 50%;
  border: 5px solid #fff; box-shadow: 0 0 0 4px var(--pink), 0 10px 30px rgba(224, 74, 146, 0.35); animation: cat-bob 2.6s ease-in-out infinite; }
@keyframes cat-bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
.result-cat { position: absolute; left: 22px; top: 18px; width: 96px; aspect-ratio: 1; object-fit: cover; border-radius: 50%;
  border: 4px solid #fff; box-shadow: 0 0 0 4px var(--pink), 0 8px 22px rgba(90, 20, 80, 0.35); animation: cat-pop .5s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes cat-pop { from { transform: scale(0.3) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
.goodjob { position: absolute; top: 0; z-index: 60; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px;
  animation: goodjob-fall 4s ease-in-out both; }
.goodjob.left { left: 7%; } .goodjob.right { right: 7%; }
.goodjob img { width: clamp(120px, 15vw, 190px); aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 5px solid #fff;
  box-shadow: 0 0 0 4px var(--pink), 0 10px 30px rgba(0,0,0,0.45); animation: cat-wiggle .6s ease-in-out infinite alternate; }
.goodjob span { font: 700 clamp(26px, 3.4vw, 42px) Fredoka, Nunito, sans-serif; color: #fff; letter-spacing: 1px; white-space: nowrap;
  -webkit-text-stroke: 2px var(--pink-deep); paint-order: stroke fill; text-shadow: 0 4px 12px rgba(0,0,0,0.5); }
@keyframes goodjob-fall { from { transform: translateY(-110%); } to { transform: translateY(110vh); } }
@keyframes cat-wiggle { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
.brand h1 { font-size: clamp(40px, 7vw, 64px); margin: 0; color: var(--pink-deep); letter-spacing: 1px;
  text-shadow: 0 3px 0 #ffd0e6, 0 8px 24px rgba(255, 111, 174, 0.35); }
.brand-heart { color: var(--pink); display: inline-block; animation: beat 1.4s ease-in-out infinite; }
.brand p { margin: 6px 0 0; color: var(--muted); font-weight: 600; }
section { margin-top: 30px; }
section h2 { font-size: 22px; margin: 0 0 12px; color: var(--ink); }
.count { font: 600 15px Nunito, sans-serif; color: var(--muted); }
.sorts { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.sorts button { border: 2px solid var(--line); background: var(--card); color: var(--pink-deep); border-radius: 999px;
  padding: 4px 12px; font: 800 13px Nunito, sans-serif; cursor: pointer; }
.sorts button.on { background: var(--pink); border-color: var(--pink); color: #fff; }
.sorts button.rand { margin-left: auto; }

.featured { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.fcard { background: var(--card); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); border: 2px solid transparent;
  cursor: pointer; transition: transform .15s, border-color .15s; text-align: left; padding: 0; color: inherit; }
.fcard:hover, .fcard:focus-visible { transform: translateY(-4px) rotate(-0.5deg); border-color: var(--pink); outline: none; }
.fcard .thumb { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; display: block; background: #f6e3ef; }
.fcard .info { padding: 10px 12px 12px; }
.fcard .t { font: 600 17px Fredoka, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard .a { color: var(--muted); font-size: 13px; font-weight: 700; }
.fcard .best { margin-top: 6px; font-size: 12px; color: var(--pink-deep); font-weight: 800; }

.search form { display: flex; gap: 10px; background: var(--card); padding: 8px; border-radius: 999px; box-shadow: var(--shadow);
  border: 2px solid var(--line); }
.search form:focus-within { border-color: var(--pink); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; font: 600 16px Nunito, sans-serif; padding: 8px 14px; color: var(--ink); background: transparent; }
.search button, .primary { background: linear-gradient(180deg, #ff8cc0, var(--pink-deep)); color: #fff; border: 0; border-radius: 999px;
  padding: 10px 22px; font-weight: 800; box-shadow: 0 4px 0 #b8326f; }
.search button:active, .primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #b8326f; }
.ghost { background: #fff; color: var(--pink-deep); border: 2px solid var(--line); border-radius: 999px; padding: 9px 20px; font-weight: 800; }
.ghost:hover { border-color: var(--pink); }
.hint { margin: 10px 16px 0; color: var(--muted); font-weight: 600; font-size: 14px; min-height: 1em; }
.hint.err { color: #d63a6a; }
.yt-results { display: grid; gap: 8px; margin-top: 10px; }

.list { display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: center; background: var(--card); border-radius: 14px;
  padding: 8px; box-shadow: 0 4px 14px rgba(180, 60, 130, 0.08); border: 2px solid transparent; cursor: pointer; text-align: left; color: inherit; width: 100%; }
.row:hover, .row:focus-visible { border-color: var(--pink); outline: none; }
.row img { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 9px; background: #f6e3ef; }
.row .t { font: 600 16px Fredoka, sans-serif; }
.row .a { color: var(--muted); font-size: 13px; font-weight: 700; }
.row .side { text-align: right; font-size: 13px; color: var(--muted); font-weight: 700; padding-right: 8px; }
.row .side b { color: var(--pink-deep); }
.row.job { cursor: default; opacity: 0.9; }
.row.job.failed .side { color: #d63a6a; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #ffe3f1; color: var(--pink-deep); font-weight: 800; font-size: 12px; }
.spin { display: inline-block; animation: beat 1s ease-in-out infinite; }
.empty { color: var(--muted); padding: 16px; text-align: center; font-weight: 600; }

/* ---------- modal / cards ---------- */
.modal { position: fixed; inset: 0; background: rgba(60, 20, 70, 0.35); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 40; padding: 16px; }
.card { background: var(--card); border-radius: 22px; box-shadow: 0 20px 60px rgba(90, 20, 80, 0.3); border: 3px solid #ffd3e8; }
.song-card { width: min(560px, 100%); padding: 22px 24px; position: relative; max-height: calc(100vh - 32px); overflow: auto; }
.close { position: absolute; right: 12px; top: 8px; border: 0; background: none; font-size: 28px; color: var(--muted); }
.song-head { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: center; }
.song-head img { width: 160px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; }
.song-head h2 { margin: 0; font-size: 26px; }
.song-head p { margin: 2px 0; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 8px; }
.tab { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 10px; text-align: center; color: var(--ink); }
.tab b { display: block; font: 600 18px Fredoka, sans-serif; }
.tab span { font-size: 12px; color: var(--muted); font-weight: 700; }
.tab.sel { border-color: var(--pink); background: #fff0f7; }
.board h3, .card h3 { margin: 14px 0 6px; font-size: 17px; }
.scores { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; counter-reset: r; }
.scores li { display: grid; grid-template-columns: 32px 56px 1fr auto; gap: 8px; padding: 5px 10px; border-radius: 10px; background: #fff6fb; font-weight: 700; font-size: 14px; }
.scores li::before { counter-increment: r; content: counter(r); color: var(--muted); }
.scores li .ini { font-family: Fredoka, sans-serif; letter-spacing: 2px; color: var(--pink-deep); }
.scores li .acc { color: var(--muted); font-size: 12px; }
.scores li.me { background: #ffe0f0; outline: 2px solid var(--pink); }
.scores .none { display: block; color: var(--muted); text-align: center; background: none; }
.scores .none::before { content: none; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; font-weight: 700; font-size: 14px; }
.settings label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.stepper button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: #fff; color: var(--pink-deep); font-weight: 800; }
.stepper b { min-width: 64px; text-align: center; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.actions.col { flex-direction: column; }
.actions.center { justify-content: center; }
.actions .big { min-width: 200px; font-size: 20px; padding: 12px 30px; }

/* ---------- versions + ratings ---------- */
.version-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 4px 0 2px; font-weight: 700; font-size: 14px; color: var(--muted); }
.version-row label { display: flex; align-items: center; gap: 6px; }
.version-row select { border: 2px solid var(--line); border-radius: 10px; padding: 4px 8px; font: 700 14px Nunito, sans-serif; color: var(--ink); background: #fff; max-width: 260px; }
.vrating { color: var(--pink-deep); }
.edit-link { margin-left: auto; color: var(--pink-deep); text-decoration: none; font-weight: 800; }
.edit-link:hover { text-decoration: underline; }
.rate { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; margin: 10px 0 2px; font-weight: 800; color: var(--ink); }
.rate .hearts { display: inline-flex; gap: 2px; }
.rate .create { flex-basis: 100%; text-align: center; margin: 2px 0 0; font-size: 14px; }
.rate .hearts button { border: 0; background: none; font-size: 26px; line-height: 1; padding: 0 2px; color: #f1cfe0; cursor: pointer; transition: transform .1s; }
.rate .hearts button.on { color: var(--pink); }
.rate .hearts:hover button { color: var(--pink); }
.rate .hearts button:hover ~ button { color: #f1cfe0; }
.rate .hearts button:hover { transform: scale(1.2); }

/* ---------- play ---------- */
#play { position: fixed; inset: 0; }
#video-wrap { position: absolute; inset: 0; }
#video-wrap iframe, #player { width: 100%; height: 100%; border: 0; display: block; }
#click-shield { position: absolute; inset: 0; }
#hud { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.center-msg { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font: 600 22px Fredoka, sans-serif; }
.panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 32px));
  padding: 22px 24px; z-index: 45; max-height: calc(100vh - 100px); overflow: auto; }
.panel h2 { margin: 0 0 6px; text-align: center; }
.grade { text-align: center; font-size: 72px; line-height: 1; color: var(--pink-deep); text-shadow: 0 4px 0 #ffd0e6; }
.stats { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 4px 14px; margin-top: 10px; font-weight: 700; font-size: 14px; }
.stats span:nth-child(odd) { color: var(--muted); }
.stats span:nth-child(even) { text-align: right; }
.initials { text-align: center; margin-top: 14px; padding: 12px; border-radius: 16px; background: #fff0f7; }
.initials p { margin: 0 0 8px; font-weight: 800; color: var(--pink-deep); }
.initials p.small { margin: 8px 0 0; font-weight: 600; }
.slots { display: flex; justify-content: center; gap: 10px; }
.slot { width: 54px; height: 64px; border-radius: 12px; border: 3px solid var(--line); background: #fff; display: grid; place-items: center;
  font: 700 36px Fredoka, sans-serif; color: var(--ink); }
.slot.on { border-color: var(--pink); box-shadow: 0 0 0 4px #ffd3e8; animation: beat 1.2s ease-in-out infinite; }

.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-weight: 700; z-index: 60; box-shadow: var(--shadow); }

@media (max-width: 640px) {
  #home { padding: 72px 16px 40px; }
  .row { grid-template-columns: 72px 1fr; }
  .row img { width: 72px; }
  .row .side { grid-column: 1 / -1; text-align: left; }
  .song-head { grid-template-columns: 1fr; }
  .song-head img { width: 100%; }
  .settings { grid-template-columns: 1fr; }
}

/* ---------- share ---------- */
.share { margin-top: 14px; text-align: center; }
.share-label { display: block; font-weight: 800; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.share-btns { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.share-btn { border: 0; border-radius: 999px; padding: 7px 13px; font: 800 13px Nunito, sans-serif; color: #fff; text-decoration: none; cursor: pointer; }
.share-btn.x { background: #111; }
.share-btn.fb { background: #1877f2; }
.share-btn.bsky { background: #1185fe; }
.share-btn.rd { background: #ff4500; }
.share-btn.wa { background: #25d366; }
.share-btn.copy, .share-btn.native { background: #fff; color: var(--pink-deep); border: 2px solid var(--line); }
.share-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* ---------- ad break ---------- */
.ad-card { width: min(520px, 100%); padding: 18px 22px; }
.ad-label { margin: 0 0 8px; font: 800 11px Nunito, sans-serif; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.ad-slot { min-height: 250px; border-radius: 14px; background: #fff6fb; border: 2px dashed var(--line); display: grid; place-items: center; overflow: hidden; }
.house-ad { display: grid; gap: 6px; text-align: center; padding: 20px; color: var(--muted); }
.house-ad b { font: 600 24px Fredoka, sans-serif; color: var(--pink-deep); }
.ad-card .primary:disabled { opacity: 0.6; cursor: default; }

#results .grade { min-height: 100px; line-height: 100px; }

/* ---------- video stalled (YouTube ad / buffering) ---------- */
.stall-msg { position: absolute; left: 50%; top: 36%; transform: translate(-50%, -50%); z-index: 8; pointer-events: none;
  background: rgba(30, 8, 40, 0.82); color: #fff; border: 2px solid rgba(255,255,255,0.5); border-radius: 16px; padding: 12px 18px;
  display: flex; flex-direction: column; gap: 4px; text-align: center; max-width: min(460px, 80vw); font-weight: 700; }
.stall-msg b { font: 700 20px Fredoka, sans-serif; color: #ffd0e6; }
.stall-msg span { font-size: 14px; }
#click-shield.pass { pointer-events: none; }

/* ---------- the cat peeking in from the side during the bridge ---------- */
.peekcat { position: absolute; right: 0; top: 38%; z-index: 60; pointer-events: none; display: flex; align-items: center; gap: 8px;
  animation: peek 7s ease-in-out both; }
.peekcat img { width: clamp(150px, 19vw, 250px); aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 6px solid #fff;
  box-shadow: 0 0 0 5px var(--pink), 0 12px 34px rgba(0,0,0,0.45); animation: cat-tilt .9s ease-in-out infinite alternate; transform-origin: 50% 85%; }
.peekcat .bubble { position: static; opacity: 1; transform: none; background: #fff; color: var(--pink-deep); font: 800 clamp(24px, 2.8vw, 36px) Fredoka, sans-serif;
  letter-spacing: 1px; padding: 8px 18px; border-radius: 18px; box-shadow: 0 4px 14px rgba(0,0,0,0.3); white-space: nowrap;
  animation: distract-pop .45s ease-in-out infinite alternate; }
@keyframes peek { 0% { transform: translateX(110%); } 9%, 88% { transform: translateX(-24px); } 100% { transform: translateX(110%); } }
@keyframes cat-tilt { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
@keyframes distract-pop { from { transform: scale(1) rotate(-3deg); } to { transform: scale(1.08) rotate(3deg); } }

/* ---------- interlude cats: rise from the bottom, stay a while, sink back ---------- */
.breakcat { position: absolute; bottom: 0; z-index: 60; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 8px;
  animation: breakcat-rise 6s ease-in-out both; }
.breakcat.left { left: 5%; } .breakcat.right { right: 5%; }
.breakcat.center { left: 50%; top: 50%; bottom: auto; animation-name: breakcat-center; }
.breakcat.center img { width: clamp(200px, 26vw, 320px); }
@keyframes breakcat-center { 0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  10%, 88% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; } }
.breakcat img { width: clamp(150px, 18vw, 240px); aspect-ratio: 1; object-fit: cover; border-radius: 28px; border: 6px solid #fff;
  box-shadow: 0 0 0 4px var(--pink), 0 10px 30px rgba(0,0,0,0.45); }
.breakcat.impatient img { animation: impatient-tap 1.2s ease-in-out infinite; transform-origin: 50% 100%; }
.breakcat.shake img { animation: shake-bob .35s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.breakcat .bubble { position: static; opacity: 1; transform: none; background: #fff; color: var(--pink-deep); font: 800 clamp(20px, 2.4vw, 30px) Fredoka, sans-serif;
  padding: 6px 16px; border-radius: 16px; box-shadow: 0 4px 14px rgba(0,0,0,0.3); white-space: nowrap; }
@keyframes breakcat-rise { 0% { transform: translateY(110%); } 10%, 88% { transform: translateY(-4vh); } 100% { transform: translateY(110%); } }
@keyframes impatient-tap { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-4deg); } 80% { transform: rotate(3deg); } 90% { transform: rotate(-2deg); } }
@keyframes shake-bob { from { transform: rotate(-3deg) translateX(-4px); } to { transform: rotate(3deg) translateX(4px); } }

/* ---------- "Get Ready!" interlude between Play and the game ---------- */
#getready { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(30,8,40,.93), rgba(3,1,8,.99)); animation: gr-dim .25s ease-out both; }
#getready .gr-cat { transform-origin: 50% -60%; animation: gr-swing .75s cubic-bezier(.2,1.6,.4,1) .1s both; }
#getready .gr-cat img { width: min(56vh, 70vw); aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 18px 40px rgba(0,0,0,.6)); }
#getready.pose2 .gr-cat img { animation: gr-pop .22s ease-out; }
#getready .gr-text { position: relative; margin-top: -9vh; font: 700 clamp(48px, 9vw, 120px) Fredoka, sans-serif; color: #fff;
  letter-spacing: .02em; text-shadow: 0 0 18px var(--pink), 0 0 42px var(--pink), 0 6px 0 var(--pink-deep);
  animation: gr-slam .45s cubic-bezier(.3,1.8,.5,1) .45s both; }
#getready.out { animation: gr-out .5s ease-in both; }
#getready.out .gr-cat, #getready.out .gr-text { animation: gr-zoom .45s ease-in both; }
@keyframes gr-dim { from { opacity: 0; } to { opacity: 1; } }
@keyframes gr-swing { 0% { transform: translateX(-120vw) rotate(-75deg); } 70% { transform: translateX(0) rotate(12deg); } 100% { transform: translateX(0) rotate(0); } }
@keyframes gr-slam { 0% { transform: scale(3.2) rotate(-8deg); opacity: 0; } 100% { transform: scale(1) rotate(-3deg); opacity: 1; } }
@keyframes gr-pop { 0% { transform: scale(1.18) rotate(4deg); } 100% { transform: scale(1); } }
@keyframes gr-zoom { to { transform: scale(2.4); opacity: 0; } }
@keyframes gr-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #getready .gr-cat, #getready .gr-text, #getready.pose2 .gr-cat img { animation: none; } }

/* ---------- tribute ---------- */
.tribute { margin: 8px 0 2px; padding: 10px 10px 8px; border-radius: 14px; background: linear-gradient(180deg, #fff3fa, #fff); border: 2px solid #ffd3e8; }
.tribute h3 { margin: 0 0 2px; }
.tribute p { margin: 0 0 8px; }
.members { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.member { display: flex; align-items: center; gap: 6px; border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 10px 3px 3px;
  cursor: pointer; font: 800 13px Nunito, sans-serif; color: var(--ink); transition: transform .1s; }
.member:hover { transform: translateY(-2px); border-color: var(--pink); }
.member .av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 13px Fredoka, sans-serif;
  background: hsl(var(--hue), 70%, 62%); }
.tr-chart { display: grid; gap: 4px; }
.tr-row { display: grid; grid-template-columns: 20px 92px 1fr auto; gap: 6px; align-items: center; font-weight: 800; font-size: 13px; }
.tr-row .tr-rank { color: var(--muted); text-align: right; }
.tr-row .tr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-bar { height: 14px; background: #f8e6f0; border-radius: 999px; overflow: hidden; }
.tr-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ffb3d4, var(--pink)); }
.tr-row.you .tr-name { color: var(--pink-deep); }
.tr-row.you .tr-bar span { background: linear-gradient(90deg, #ffd36e, #ff8a3d); }
.tr-pts { font-size: 12px; color: var(--ink); white-space: nowrap; }
.tr-pts small { color: var(--muted); font-weight: 700; }

/* home page + song card: decorations hold still (they only move during a song) */
body:not(.playing) #frame *, body:not(.playing) #frame *::before, body:not(.playing) #frame *::after,
body:not(.playing) .brand-heart { animation: none !important; }
body:not(.playing) #frame .float-heart, body:not(.playing) #frame .floater { display: none; }

.home-cat { cursor: pointer; }
.home-cat.meowing { animation: cat-meow .5s ease-out; }
@keyframes cat-meow { 30% { transform: scale(1.12) rotate(-6deg); } 60% { transform: scale(0.96) rotate(4deg); } }

/* ---------- leaderboards: explicit place numbers, long (fake) names, your own row ---------- */
.scores li, .overall .scores li { grid-template-columns: 40px minmax(0, 1fr) auto 54px; }
.scores li::before { content: attr(data-rank); counter-increment: none; }
.scores li .ini { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 1px; }
.scores li .sc { text-align: right; font-variant-numeric: tabular-nums; }
.scores li .acc { text-align: right; }
.scores li.fake .ini { color: #b88aa8; font-style: italic; letter-spacing: 0; }
.scores li.fake .ini::after { content: " 🐾"; font-style: normal; }
.scores li.gap { display: block; text-align: center; background: none; color: var(--muted); padding: 0; line-height: 1; }
.scores li.gap::before { content: none; }
.row-wrap { display: flex; gap: 8px; align-items: stretch; }
.row-wrap.disabled { opacity: 0.5; filter: grayscale(0.8); }
.pending.off { color: #555; background: #eee; border-color: #ccc; }
.row-wrap .row { flex: 1; min-width: 0; }
.lb-btn { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 92px;
  border: 2px solid var(--line); background: var(--card); border-radius: 14px; color: var(--pink-deep); font: 800 12px Nunito, sans-serif;
  cursor: pointer; font-size: 22px; line-height: 1; }
.lb-btn span { font-size: 11.5px; line-height: 1.15; text-align: center; padding: 0 4px; }
.lb-btn:hover { border-color: var(--pink); background: #fff0f7; }
.lb-card { width: min(460px, 100%); padding: 22px 24px; position: relative; max-height: calc(100vh - 32px); overflow: auto; }
.lb-card h2 { margin: 0; font-size: 22px; padding-right: 30px; }
.lb-card p { margin: 2px 0 8px; }
.small-tabs { margin: 8px 0; }
.small-tabs .tab { padding: 6px; }
.pending { font: 800 11px Nunito, sans-serif; color: #c2570c; background: #fff1dc; border: 1px solid #ffcf94; border-radius: 999px; padding: 1px 7px; vertical-align: 2px; }
@media (max-width: 560px) { .lb-btn { width: 56px; } .lb-btn span { display: none; } }

/* ---------- categories + submissions ---------- */
.cats { margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip { border: 2px solid var(--line); background: #fff; color: var(--pink-deep); border-radius: 999px; padding: 7px 16px; font: 800 15px Nunito, sans-serif; cursor: pointer; }
.chip:hover { background: var(--pink); border-color: var(--pink); color: #fff; }
#sm-admin { margin: 10px 0 0; }
.admin-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; border: 2px dashed #d9c6f5; border-radius: 12px; font-weight: 800; font-size: 13px; color: #7a46c9; }
.admin-row button { padding: 5px 12px; }
.admin-row select { border: 2px solid var(--line); border-radius: 8px; padding: 3px 6px; font: 700 13px Nunito, sans-serif; }
.pending-note { margin: 0; padding: 8px 12px; border-radius: 12px; background: #fff1dc; color: #9a4a0c; font-weight: 700; font-size: 13px; }

/* ---------- refined vs AI-generated tracks ---------- */
.rec { display: inline-block; font: 800 11px Nunito, sans-serif; letter-spacing: .3px; text-transform: uppercase; vertical-align: 2px;
  color: #fff; background: linear-gradient(90deg, #ff6fae, #ffb347); border-radius: 999px; padding: 2px 8px; margin-right: 4px; }
.ai-note { margin: 12px 0 4px; padding: 8px 12px; border-radius: 12px; background: #f3f0ff; border: 2px dashed #c9b8ff;
  color: #5a4a8a; font-weight: 700; font-size: 14px; text-align: center; }
.link-btn { font-weight: 800; }
/* Play + Copy link stay in view at the bottom of the song pop-up, even with a long high-score list */
.song-card > .actions { position: sticky; bottom: -22px; margin: 14px -24px -22px; padding: 12px 24px 16px; background: linear-gradient(180deg, rgba(255,255,255,0.85), var(--card) 35%);
  border-top: 2px solid #ffe3f0; z-index: 2; flex-wrap: wrap; }

/* ---------- video sources (admin) ---------- */
.src-row label { display: flex; align-items: center; gap: 6px; font-weight: 800; color: var(--muted); font-size: 13px; }
.src-row select { max-width: 280px; }
.src-edit { margin: 6px 0 4px; padding: 10px; border-radius: 12px; border: 2px dashed #c9b8ff; background: #faf7ff; display: grid; gap: 6px; }
.src-line { display: grid; grid-template-columns: 110px 1fr 76px 1fr 34px; gap: 6px; }
.src-line input, .src-line select { min-width: 0; border: 2px solid var(--line); border-radius: 8px; padding: 4px 6px; font: 700 13px Nunito, sans-serif; }
.src-edit-actions { display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 560px) { .src-line { grid-template-columns: 1fr 1fr; } }

/* ---------- click-through (config.js play.clickThrough): the video gets the clicks, the game looks the same ---------- */
body.kc-clickthru #click-shield { pointer-events: none; }
body.kc-clickthru .play-hints, body.kc-clickthru .play-hints button { pointer-events: none; cursor: default; }
/* after the player clicks the video: only the video is left (plus a short message) */
#play.game-closed #hud, #play.game-closed #tint, #play.game-closed .play-hints, #play.game-closed #click-shield,
#play.game-closed #stall-msg, #play.game-closed #loading { display: none; }
.closed-msg { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); z-index: 70; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; text-align: center; max-width: min(520px, calc(100vw - 32px));
  background: rgba(30, 8, 40, 0.88); color: #fff; border: 2px solid #ff8fc4; border-radius: 16px; padding: 10px 18px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45); font-weight: 700; }
.closed-msg b { font: 700 22px Fredoka, sans-serif; color: #ffd0e6; }
.closed-msg span { font-size: 14px; }
.closed-msg.fade { animation: closed-msg 12s ease both; }
@keyframes closed-msg { 0% { opacity: 0; transform: translate(-50%, -10px); } 4%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -10px); } }
body.kc-closed #frame { display: none; }      /* the song's theme border/mascots would sit on the YouTube controls */
