/* The Studio (studio.js, MUSIC-CORNER-PLAN.md phase 3). The play button and ↻ come from
   beatlab.css and kitchen.css; this is the drum pad, the red button, the lights, the lamp
   and her shelf. */

#studio { --t-drums: #ff8a7a; --t-bass: #ffc46b; --t-chords: #5fd3c8; --t-melody: #b89cff; }

/* ---------------------------------------------------------------- the room */

.studio-panel { fill: rgba(7, 4, 15, 0.1); stroke: rgba(255, 196, 107, 0.04); stroke-width: 3; }
.studio-lamp-cap { fill: #2a2150; stroke: var(--rock-edge); stroke-width: 3; }
.studio-lamp {
  position: absolute; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #8a4a4a, #4a2020 70%);
  border: 3px solid rgba(255, 255, 255, 0.15); pointer-events: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
/* while recording the lamp glows red and breathes */
.recording .studio-lamp {
  background: radial-gradient(circle at 40% 35%, #ffd0c8, #ff4a3a 60%, #a3201a);
  box-shadow: 0 0 22px 8px rgba(255, 74, 58, 0.7);
  animation: lamp-breathe 1.09s ease-in-out infinite;
}
@keyframes lamp-breathe { 50% { box-shadow: 0 0 34px 14px rgba(255, 74, 58, 0.85); } }
#studio .creature-slot { width: 22%; }
.studio-fx { position: absolute; inset: 0; pointer-events: none; z-index: 6; }

/* ------------------------------------------------------------ the beat lights */

/* Eight, one per beat of her two bars: white for the count-in, red while recording
   (the ones already played stay faintly red), teal while her beat plays. */
.beat-lights {
  position: absolute; transform: translate(-50%, -50%); z-index: 3;
  display: flex; justify-content: space-between; pointer-events: none;
}
.beat-light {
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #2e2a4a, #15182a 70%);
  border: 3px solid rgba(255, 255, 255, 0.14);
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
.beat-light:nth-child(4n + 1) { border-color: rgba(255, 255, 255, 0.32); }
.beat-light.count { background: #ffffff; box-shadow: 0 0 16px 4px rgba(255, 255, 255, 0.7); }
.beat-light.rec { background: #ff4a3a; box-shadow: 0 0 16px 4px rgba(255, 74, 58, 0.8); }
.beat-light.done { background: #7a2a2a; }
.beat-light.on { background: #5fd3c8; box-shadow: 0 0 16px 4px rgba(95, 211, 200, 0.75); }

/* ---------------------------------------------------------------- the pad */

/* 4x4 square pads, each lit in its row's colour (drums coral, hand and foot gold,
   cymbals teal, the silly ones violet) with its picture. A hit flashes and squashes
   on the touch itself. */
.drum-pad {
  position: absolute; transform: translate(-50%, -50%); z-index: 3;
  display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap: 3.5%;
  padding: 2.5%; box-sizing: border-box; border-radius: 26px;
  background: linear-gradient(180deg, #2a2150, #1b1440);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.08), 0 12px 26px rgba(7, 4, 15, 0.5);
  pointer-events: auto; touch-action: none;
}
.pad {
  min-width: 0; min-height: 0; padding: 0; display: grid; place-items: center;
  border-radius: 18px; touch-action: none;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--t) 45%, #3b2a66), color-mix(in srgb, var(--t) 22%, #1b1440));
  border: 3px solid color-mix(in srgb, var(--t) 70%, transparent);
  box-shadow: inset 0 -5px 0 rgba(7, 4, 15, 0.35);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.pad img { width: 58%; height: 58%; object-fit: contain; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(7, 4, 15, 0.5)); }
.pad.hit { animation: pad-hit 0.28s ease-out; }
@keyframes pad-hit {
  0% { scale: 0.92; background: color-mix(in srgb, var(--t) 85%, #ffffff); box-shadow: 0 0 28px 8px var(--t); }
  100% { scale: 1; }
}
.pad.nudge { animation: jar-nudge 0.6s cubic-bezier(.3, 1.5, .5, 1); }

/* A kit swaps every pad with a flip across the pad, the picture changing while the pad
   is edge on (studio.js showKit). */
.pad.flip { animation: pad-flip 0.3s ease-in-out both; }
@keyframes pad-flip { 50% { scale: 0.05 1; filter: brightness(1.6); } }

/* ------------------------------------------------------------ the kit buttons */

/* One per kit, three across in a square left of the pad (eight kits since 2026-10-13; a
   column held only three): a picture on a plaque in the kit's colour, like the Beat Lab's
   category buttons. The open kit is lit and a little bigger; the others are dimmed, so she
   can see which one is on. The square's width is set (never under 150 px, so a button is
   never under 46), and its height follows, so the percentage gap works both ways. */
.kit-switch {
  position: absolute; transform: translate(-50%, -50%); z-index: 4;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 4%;
  aspect-ratio: 1; pointer-events: auto;
}
.kit-button {
  width: 100%; aspect-ratio: 1; padding: 0; position: relative;
  display: grid; place-items: center; border-radius: 22%;
  background: color-mix(in srgb, var(--t) 22%, #241847);
  border: 3px solid color-mix(in srgb, var(--t) 55%, transparent);
  box-shadow: inset 0 0 18px -8px var(--t), 0 6px 14px rgba(7, 4, 15, 0.5);
  filter: saturate(0.7) brightness(0.8);
  transition: transform 0.18s cubic-bezier(.3, 1.4, .5, 1), background 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.kit-button img { width: 66%; height: 66%; object-fit: contain; pointer-events: none; filter: drop-shadow(0 3px 4px rgba(7, 4, 15, 0.55)); }
.kit-button.open {
  filter: none; transform: scale(1.1); z-index: 1;
  background: color-mix(in srgb, var(--t) 50%, #241847);
  border-color: #ffffff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--t) 80%, transparent), 0 0 24px 4px color-mix(in srgb, var(--t) 60%, transparent);
}
.kit-button:active { transform: scale(0.95); }
.kit-button.nudge { animation: jar-nudge 0.6s cubic-bezier(.3, 1.5, .5, 1); }

/* ---------------------------------------------------------- the red button */

.record-button {
  position: absolute; transform: translate(-50%, -50%); z-index: 4;
  width: max(64px, 10%); aspect-ratio: 1; border-radius: 50%; padding: 0;
  background: radial-gradient(circle at 38% 32%, #ffd3cb, #ff5a4a 55%, #a3201a);
  border: 4px solid #2a2150;
  box-shadow: 0 0 0 4px #ffffff, 0 5px 0 #1b1440, 0 8px 14px rgba(7, 4, 15, 0.5);
  pointer-events: auto; transition: transform 0.1s ease;
  animation: rec-ready 1.4s ease-in-out infinite;
}
.record-button svg { width: 100%; height: 100%; display: block; }
.rec-track { fill: none; stroke: rgba(255, 255, 255, 0.0); stroke-width: 7; }
.rec-ring { fill: none; stroke: #ffffff; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100;
  transform: rotate(-90deg); transform-origin: 50% 50%; }
.rec-dot { fill: #ffffff; }
.record-button:active { transform: translate(-50%, -46%); }
@keyframes rec-ready { 50% { box-shadow: 0 0 0 4px #ffffff, 0 5px 0 #1b1440, 0 0 26px 8px rgba(255, 90, 74, 0.8); } }
/* counting in: it blinks on each click */
.record-button.counting { animation: rec-count 0.5455s steps(1) infinite; }
@keyframes rec-count { 50% { filter: brightness(1.5); } }
/* recording: the ring fills over the two bars and the dot pulses */
.record-button.recording { animation: none; box-shadow: 0 0 0 4px #ff4a3a, 0 0 30px 10px rgba(255, 74, 58, 0.7); }
.record-button.recording .rec-track { stroke: rgba(255, 255, 255, 0.25); }
.record-button.recording .rec-ring { animation: rec-fill var(--beat-ms, 4364ms) linear forwards; }
.record-button.recording .rec-dot { animation: rec-dot 0.5455s ease-in-out infinite; transform-origin: 50% 50%; }
@keyframes rec-fill { to { stroke-dashoffset: 0; } }
@keyframes rec-dot { 50% { scale: 0.8; } }
.record-button.nudge { animation: zap-nudge 0.4s ease; }

/* ------------------------------------------------------------- the bin */

/* Drag a beat from her library onto it to throw it away. It glows the moment a beat is
   picked up, and more when the beat is over it; with no beats it is dimmed. */
.studio-trash {
  position: absolute; transform: translate(-50%, -50%); z-index: 4;
  width: max(60px, 6.6%); aspect-ratio: 1; padding: 0; border-radius: 22px;
  display: grid; place-items: center; pointer-events: auto;
  background: linear-gradient(180deg, #3b2a66, #241847);
  border: 3px solid rgba(255, 196, 107, 0.45);
  box-shadow: 0 6px 14px rgba(7, 4, 15, 0.5);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
}
.studio-trash img { width: 66%; height: 66%; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(7, 4, 15, 0.5)); }
.studio-trash.idle { filter: saturate(0.5) brightness(0.75); }
.studio-trash.can-drop { border-color: #ffc46b; animation: trash-wants 1s ease-in-out infinite; }
.studio-trash.over { border-color: #ffffff; box-shadow: 0 0 0 5px rgba(255, 138, 122, 0.85), 0 0 30px 10px rgba(255, 138, 122, 0.6); animation: none; scale: 1.12; }
.studio-trash.nudge { animation: zap-nudge 0.4s ease; }
@keyframes trash-wants { 50% { box-shadow: 0 0 0 4px rgba(255, 196, 107, 0.7), 0 0 24px 6px rgba(255, 196, 107, 0.45); } }

/* ----------------------------------------------------------- her shelf */

/* Only the right bench: her beats, newest first, each with its picture. The one on the
   pad wears a white rim. Empty, it shows three dashed places waiting for beats. */
#studio .bench-shelf {
  grid-column: 3; align-self: stretch; max-height: none;
  margin-top: calc(74px + env(safe-area-inset-top, 0px));
  margin-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  --bench-edge: rgba(255, 138, 122, 0.55);
}
.beat-tile { border-color: rgba(255, 138, 122, 0.6); background: linear-gradient(180deg, #4a2a5a, #2a1840); }
.beat-tile.playing { border-color: #ffffff; box-shadow: 0 0 0 3px rgba(95, 211, 200, 0.85), 0 0 18px 4px rgba(95, 211, 200, 0.55); }
/* a beat just made glows gently until she taps one, so she can see which is new */
.beat-tile.fresh:not(.playing) { animation: beat-fresh 1.4s ease-in-out infinite; }
@keyframes beat-fresh { 50% { box-shadow: 0 0 0 3px rgba(255, 138, 122, 0.7), 0 0 20px 6px rgba(255, 138, 122, 0.5); } }
.beat-tile.lifted { opacity: 0.35; }
.beat-tile { touch-action: none; }
.beat-tile.nudge { animation: jar-nudge 0.6s cubic-bezier(.3, 1.5, .5, 1); }
.shelf-empty { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; justify-items: center; }
.shelf-empty span { width: 64px; height: 64px; border-radius: 16px; border: 2px dashed rgba(255, 138, 122, 0.35); }

@media (prefers-reduced-motion: reduce) {
  .record-button, .record-button.counting, .recording .studio-lamp, .pad.hit, .pad.nudge, .record-button.recording .rec-dot,
  .studio-trash.can-drop, .beat-tile.fresh:not(.playing), .pad.flip, .kit-button.nudge { animation: none; }
  .record-button.recording .rec-ring { animation: none; stroke-dashoffset: 0; }
}
