/* ============ BOP! the blue pup dance party ============ */

@font-face {
  font-family: 'Titan One';
  src: url('./fonts/titan-one-latin.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('./fonts/nunito-latin.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --ink: #271a46;
  --paper: #fff7e6;
  --sky: #7fd0ff;
  --grass: #67c04c;
  --sun: #ffd23e;
  --coral: #ff6b57;
  --pup-blue: #7ac2f1;
  --pup-yellow: #f7cc69;
  --mint: #4fe3c1;
  --pink: #ff5fa8;
  --grape: #8a63ff;
  --shadow: 0 4px 0 var(--ink);
  --shadow-lg: 0 6px 0 var(--ink);
  --display: 'Titan One', 'Comic Sans MS', cursive;
  --body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: linear-gradient(#8fd8ff 0%, #cdefff 55%, #9fdc72 56%, #6dbd4e 100%);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app { position: fixed; inset: 0; }

#stage {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cg fill='%23271a46'%3E%3Cellipse cx='15' cy='19' rx='6.5' ry='5.5'/%3E%3Ccircle cx='7' cy='11' r='3'/%3E%3Ccircle cx='13' cy='7.5' r='3'/%3E%3Ccircle cx='19.5' cy='8' r='3'/%3E%3Ccircle cx='24.5' cy='12.5' r='2.7'/%3E%3C/g%3E%3C/svg%3E") 15 15, pointer;
}

.hud { position: absolute; z-index: 5; }

/* ---------- title ---------- */
#titleBlock { top: 14px; left: 18px; pointer-events: none; }
.logo {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(44px, 7vw, 76px);
  line-height: 0.9;
  letter-spacing: 0.01em;
  display: flex;
  filter: drop-shadow(0 5px 0 rgba(39, 26, 70, 0.9));
}
.lg {
  display: inline-block;
  -webkit-text-stroke: 2.5px var(--ink);
  paint-order: stroke fill;
  animation: letter-bounce 2.4s ease-in-out infinite;
}
.lg-b   { color: var(--pup-blue);   transform: rotate(-7deg); }
.lg-o   { color: var(--sun);        transform: rotate(4deg) translateY(4px);  animation-delay: .12s; }
.lg-p   { color: var(--coral);      transform: rotate(-3deg);                 animation-delay: .24s; }
.lg-bang{ color: var(--mint);       transform: rotate(9deg) translateY(-2px); animation-delay: .36s; }
@keyframes letter-bounce {
  0%, 100% { translate: 0 0; }
  30%      { translate: 0 -7px; }
  45%      { translate: 0 1px; }
}
.ribbon {
  display: inline-block;
  margin: 8px 0 0 6px;
  padding: 5px 14px 6px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--display);
  font-size: clamp(12px, 1.7vw, 16px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 4px 14px 4px 14px;
  transform: rotate(-2deg);
  box-shadow: 0 3px 0 rgba(39,26,70,.45);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding: 7px 14px 8px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 14px;
}
.now-playing { pointer-events: none; }
.eq { display: inline-flex; align-items: flex-end; gap: 2.5px; height: 15px; }
.eq i {
  width: 4px; border-radius: 2px; background: var(--coral);
  height: 30%;
}
.eq i:nth-child(2) { background: var(--sun); animation-delay: .15s !important; }
.eq i:nth-child(3) { background: var(--mint); animation-delay: .3s !important; }
.beat-on .eq i { animation: eq-jump .42s ease-out; }
@keyframes eq-jump { 0% { height: 100%; } 100% { height: 30%; } }

/* ---------- side controls ---------- */
#sideControls {
  top: 16px; right: 16px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
.round-btn {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  transition: transform .12s ease, box-shadow .12s ease, background .25s ease;
}
.round-btn:hover { transform: translateY(-3px) rotate(-4deg); box-shadow: var(--shadow-lg); }
.round-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.round-btn svg { width: 26px; height: 26px; }

#moodBtn .ic-moon { display: none; }
#moodBtn.mood-night { background: #2b2f63; }
#moodBtn.mood-night .ic-sun { display: none; }
#moodBtn.mood-night .ic-moon { display: block; }

#soundBtn .ic-snd-off { display: none; }
#soundBtn.muted .ic-snd-on { display: none; }
#soundBtn.muted .ic-snd-off { display: block; }
#soundBtn.muted { background: #ffe3dc; }

.cam-cluster { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.cam { width: 46px; height: 46px; font-size: 19px; }
.cam.active { background: var(--sun); }

/* ---------- story card ---------- */
#storyCard {
  left: 18px;
  bottom: calc(var(--deck-h, 168px) + 16px);
  width: min(360px, calc(100vw - 36px));
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 18px 18px 18px 4px;
  box-shadow: var(--shadow-lg);
  padding: 12px 16px 14px;
  transform: rotate(-0.6deg);
  animation: card-pop .45s cubic-bezier(.2,1.6,.4,1);
}
@keyframes card-pop { 0% { transform: scale(.6) rotate(-6deg); opacity: 0; } 100% { transform: scale(1) rotate(-0.6deg); opacity: 1; } }
.story-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.story-chapter {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--coral);
}
.story-close {
  border: 0; background: none; cursor: pointer;
  font: 800 12px var(--body); color: var(--ink); opacity: .55;
  padding: 2px 4px; border-radius: 6px;
}
.story-close:hover { opacity: 1; background: rgba(39,26,70,.08); }
.story-text {
  margin: 6px 0 8px;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.42;
  min-height: 3.6em;
}
.story-dots { display: flex; gap: 6px; }
.story-dots i {
  width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid var(--ink);
  background: transparent;
  transition: background .3s;
}
.story-dots i.done { background: var(--coral); }
.story-dots i.live { background: var(--sun); animation: dot-pulse 1s infinite; }
@keyframes dot-pulse { 50% { transform: scale(1.35); } }

/* ---------- hint ---------- */
.hint {
  right: 18px;
  bottom: calc(var(--deck-h, 168px) + 14px);
  font-size: 12.5px;
  font-weight: 800;
  background: rgba(255,247,230,.85);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  box-shadow: 0 3px 0 var(--ink);
  transform: rotate(1deg);
  opacity: 0;
  animation: hint-in .6s ease 1.2s forwards;
  pointer-events: none;
  max-width: 44vw;
  text-align: center;
}
@keyframes hint-in { to { opacity: 1; } }
.hint.bye { animation: hint-out .5s ease forwards; }
@keyframes hint-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- bottom deck ---------- */
#deck {
  left: 0; right: 0; bottom: 0;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(to top, rgba(39,26,70,.30), rgba(39,26,70,0));
  pointer-events: none;
}
#deck > * { pointer-events: auto; }

.transport { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font: 800 14px var(--body);
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .2s ease;
}
.pill:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: var(--shadow-lg); }
.pill:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.pill-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #c9c2b4; border: 2px solid var(--ink);
  transition: background .2s;
}
.party-on { background: var(--mint); }
.party-on .pill-dot { background: var(--coral); animation: dot-pulse 0.9s infinite; }

.tempo {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 6px 16px 6px 14px;
  box-shadow: var(--shadow);
}
.tempo-label { font: 400 12px var(--display); letter-spacing: .1em; text-transform: uppercase; }
.tempo-val { font-weight: 900; font-size: 15px; min-width: 62px; text-align: right; }
.tempo-val small { font-size: 10px; font-weight: 800; opacity: .6; margin-left: 2px; }
input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: clamp(110px, 22vw, 210px); height: 26px; background: transparent; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 10px; border-radius: 6px;
  background: repeating-linear-gradient(90deg, var(--pup-blue) 0 12px, var(--sun) 12px 24px);
  border: 2.5px solid var(--ink);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px; margin-top: -9.5px;
  border-radius: 50%;
  background: var(--coral);
  border: 3px solid var(--ink);
  box-shadow: 0 2.5px 0 var(--ink);
  transition: transform .1s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type=range]::-moz-range-track {
  height: 10px; border-radius: 6px;
  background: repeating-linear-gradient(90deg, var(--pup-blue) 0 12px, var(--sun) 12px 24px);
  border: 2.5px solid var(--ink);
}
input[type=range]::-moz-range-thumb {
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--coral); border: 3px solid var(--ink);
}

.dance-menu {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding: 6px 4px 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  justify-content: safe center;
}
.dance-menu::-webkit-scrollbar { height: 8px; }
.dance-menu::-webkit-scrollbar-thumb { background: rgba(39,26,70,.4); border-radius: 4px; }

.dance-card {
  scroll-snap-align: center;
  flex: 0 0 auto;
  min-width: 96px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 12px 8px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 16px 16px 16px 6px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: var(--body);
  transition: transform .13s cubic-bezier(.3,1.5,.5,1), box-shadow .13s ease, background .2s ease;
  position: relative;
}
.dance-card:nth-child(odd)  { transform: rotate(-1.3deg); }
.dance-card:nth-child(even) { transform: rotate(1.1deg); }
.dance-card:hover { transform: translateY(-5px) rotate(0deg) scale(1.05); box-shadow: var(--shadow-lg); z-index: 2; }
.dance-card:active { transform: translateY(1px) scale(.98); box-shadow: 0 1px 0 var(--ink); }
.dance-card .dc-emoji { font-size: 26px; line-height: 1; filter: drop-shadow(0 2px 0 rgba(39,26,70,.25)); }
.dance-card .dc-name { font: 400 13.5px var(--display); letter-spacing: .02em; }
.dance-card .dc-key {
  position: absolute; top: -9px; right: -7px;
  min-width: 22px; height: 22px; padding: 0 5px;
  display: grid; place-items: center;
  background: var(--ink); color: var(--paper);
  font: 800 11px var(--body);
  border-radius: 7px;
  transform: rotate(8deg);
  box-shadow: 0 2px 0 rgba(39,26,70,.4);
}
.dance-card.playing { background: var(--sun); animation: card-groove .5s ease infinite alternate; }
@keyframes card-groove { from { rotate: -1.5deg; } to { rotate: 1.5deg; } }
.dance-card.pop { animation: card-pop2 .35s cubic-bezier(.2,1.8,.4,1); }
@keyframes card-pop2 { 0% { transform: scale(.7); } 100% { transform: scale(1); } }

/* ---------- overlays ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: rgba(39,26,70,.35);
  backdrop-filter: blur(3px);
  transition: opacity .45s ease;
}
.overlay.gone { opacity: 0; pointer-events: none; }
.overlay[hidden] { display: none; }

.loader-card {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 26px;
  box-shadow: 0 8px 0 var(--ink);
  padding: 26px 38px 24px;
  text-align: center;
  transform: rotate(-1deg);
}
.paw-walk { display: flex; gap: 14px; justify-content: center; font-size: 26px; margin-bottom: 10px; }
.paw { display: inline-block; animation: paw-step 1s ease-in-out infinite; opacity: .25; }
.paw:nth-child(2) { animation-delay: .18s; }
.paw:nth-child(3) { animation-delay: .36s; }
.paw:nth-child(4) { animation-delay: .54s; }
@keyframes paw-step { 0%,100% { opacity:.25; transform: translateY(0) rotate(0); } 30% { opacity:1; transform: translateY(-9px) rotate(-14deg); } }
.load-title { font-family: var(--display); font-size: 21px; margin-bottom: 12px; }
.load-bar {
  width: 240px; height: 18px;
  border: 3px solid var(--ink); border-radius: 999px;
  background: #fff; overflow: hidden;
  margin: 0 auto;
}
.load-fill {
  height: 100%; width: 4%;
  background: repeating-linear-gradient(45deg, var(--pup-blue) 0 12px, var(--mint) 12px 24px);
  border-radius: 999px;
  transition: width .25s ease;
}
.load-msg { margin-top: 10px; font-weight: 800; font-size: 13px; opacity: .75; }

.start-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--sun);
  border: 4px solid var(--ink);
  border-radius: 30px;
  box-shadow: 0 9px 0 var(--ink);
  padding: 26px 52px 22px;
  cursor: pointer;
  font-family: var(--body);
  animation: start-throb 1.1s ease-in-out infinite;
  transition: transform .12s;
}
.start-btn:hover { transform: scale(1.05) rotate(-1.5deg); }
.start-btn:active { transform: scale(.97) translateY(4px); box-shadow: 0 4px 0 var(--ink); }
@keyframes start-throb { 0%,100% { scale: 1; } 50% { scale: 1.045; } }
.start-tri { font-size: 40px; line-height: 1; color: var(--coral); -webkit-text-stroke: 2.5px var(--ink); }
.start-line1 { font: 400 30px var(--display); letter-spacing: .02em; }
.start-line2 { font-weight: 800; font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .65; }

.nogl-card {
  background: var(--paper); border: 4px solid var(--ink); border-radius: 26px;
  box-shadow: 0 8px 0 var(--ink);
  padding: 30px 36px; text-align: center; max-width: 420px;
}
.nogl-card h2 { font-family: var(--display); font-size: 30px; margin: 12px 0 8px; }
.nogl-card p { font-weight: 700; line-height: 1.5; margin: 0; }
.nogl-pup {
  width: 92px; height: 92px; margin: 0 auto;
  border-radius: 50%;
  background: var(--pup-blue);
  border: 4px solid var(--ink);
  position: relative;
}
.nogl-pup::before, .nogl-pup::after {
  content: ''; position: absolute; top: -20px;
  width: 30px; height: 38px;
  background: var(--pup-blue); border: 4px solid var(--ink);
  border-radius: 50% 50% 40% 40%;
}
.nogl-pup::before { left: -6px; transform: rotate(-24deg); }
.nogl-pup::after  { right: -6px; transform: rotate(24deg); }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  #titleBlock { top: 10px; left: 12px; }
  .logo { font-size: 42px; }
  #sideControls { top: 10px; right: 10px; gap: 8px; }
  .round-btn { width: 46px; height: 46px; }
  .cam { width: 40px; height: 40px; font-size: 16px; }
  .hint { display: none; }
  #storyCard { bottom: calc(var(--deck-h, 190px) + 10px); }
  .story-text { font-size: 15px; min-height: 4.4em; }
  .dance-menu { justify-content: flex-start; }
  .dc-key { display: none; }
}
@media (pointer: coarse) {
  .dance-card { min-width: 88px; padding: 10px 12px 9px; }
  .pill { padding: 10px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .lg, .paw, .start-btn, .dance-card.playing, .party-on .pill-dot { animation: none !important; }
}
