/* ==========================================================================
   ScienceHutch: "Create your first song" / Song Studio (song.html only).
   Colors, buttons and type come from main.css. Same playful layout as the
   other game pages (this file was started from motion.css): intro, "how it
   works" card, sticky progress bar, step cards, trophy room.
   Colors: orange = kick drum + main accent, pink = snare, gold = hi-hat,
   violet = clap and word chips, cyan = melody.
   Everything that moves stops for people who ask for reduced motion (bottom).
   ========================================================================== */

.sg-page {
  --mood: #FF8A2B;   /* glow color; js/song.js changes it to match the vibe picked in step 1 */
  --push: #FF8A2B;   /* slider color */
  --pink: #FF6FA8;
  --gold: #FFD45A;
  --violet: #B79CFF;
  --cyan: #6FE3FF;
  --good: #7CFF9E;
  --bad: #FF9B8A;
  --glass: rgba(30, 22, 20, 0.72);
  --glass-border: rgba(255, 255, 255, 0.09);
}
.sg-wrap { width: min(100% - 2rem, 72rem); margin-inline: auto; }
.sg-page [hidden] { display: none !important; }
.sg-page h1, .sg-page h2 { font-family: var(--font-display); font-weight: 400; line-height: 1.08; }
.sg-page button { font: inherit; }
.sg-page button:focus-visible, .sg-page input:focus-visible, .sg-page summary:focus-visible, .sg-page a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }


/* ======= INTRO ======= */
.sg-hero {
  position: relative;
  overflow: hidden;
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
  background:
    radial-gradient(ellipse 55% 50% at 80% 35%, rgba(255, 111, 168, 0.14), transparent 70%),
    radial-gradient(ellipse 45% 45% at 15% 80%, rgba(183, 156, 255, 0.12), transparent 70%),
    radial-gradient(ellipse 60% 40% at 60% 100%, rgba(255, 138, 43, 0.12), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}
.sg-sky, .sg-sky::after {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 30% 60%, #ffe9c7, transparent),
    radial-gradient(1.3px 1.3px at 48% 12%, #fff, transparent), radial-gradient(1px 1px at 66% 42%, #cfeaff, transparent),
    radial-gradient(1.2px 1.2px at 88% 20%, #fff, transparent), radial-gradient(1px 1px at 8% 70%, #fff, transparent);
  background-size: 380px 380px; opacity: 0.55;
}
.sg-sky::after { content: ""; background-size: 280px 280px; background-position: 90px 40px; animation: sg-twinkle 5s ease-in-out infinite alternate; }
@keyframes sg-twinkle { from { opacity: 0.1; } to { opacity: 0.8; } }
.sg-hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-block: clamp(2.5rem, 7vw, 5rem) clamp(1.5rem, 4vw, 2.5rem);
}
.sg-hero h1 { margin: 0; font-size: clamp(2.8rem, 8.5vw, 5.4rem); }
.sg-hero h1 span {
  background: linear-gradient(90deg, #FF8A2B, #FF6FA8 35%, #B79CFF 65%, #FFD45A);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sg-shimmer 7s ease-in-out infinite alternate;
}
@keyframes sg-shimmer { from { background-position: 0% 0; } to { background-position: 100% 0; } }
.sg-lead { max-width: 36em; margin: 18px 0 12px; font-size: clamp(1.08rem, 2.2vw, 1.25rem); }
.sg-promise { max-width: 40em; margin: 0 0 26px; color: var(--muted); }
.sg-hero-ctas { justify-content: flex-start; }

/* How to play */
.sg-how {
  position: relative;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  scroll-margin-top: 80px;
}
.sg-how::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; border-radius: 22px 22px 0 0; background: linear-gradient(90deg, var(--push), var(--pink), var(--violet), var(--gold)); }
.sg-how h2 { margin: 0 0 16px; font-size: clamp(1.5rem, 3.5vw, 2rem); }
.sg-how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0; padding: 0; list-style: none; }
.sg-how-step { padding: 18px 18px 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); }
.sg-how-step h3 { margin: 4px 0 6px; font-size: 1.2rem; }
.sg-how-step p { margin: 0; color: var(--muted); }
.sg-how-num { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--orange); color: var(--on-accent); font-weight: 800; box-shadow: 0 0 18px rgba(255, 138, 43, 0.6); }
.sg-how-tip { margin: 18px 0 0; }

/* ======= STICKY PROGRESS BAR ======= */
.sg-questbar {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(10, 9, 8, 0.84);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.sg-questbar-inner { display: flex; align-items: center; gap: 8px 12px; min-height: 52px; padding-block: 6px; }
.sg-bar-pill {
  display: inline-flex; align-items: center;
  min-height: 40px; padding: 6px 12px;
  border: 1px solid #9A6A58; border-radius: 999px;
  background: transparent; color: var(--ink); font-weight: 700; text-decoration: none; white-space: nowrap;
}
a.sg-bar-pill:hover, .sg-sound:hover { border-color: var(--orange); }
.sg-sound { gap: 6px; cursor: pointer; font-weight: 600; }
.sg-sound[aria-pressed="true"] { border-color: var(--orange); background: rgba(255, 138, 43, 0.12); }
@media (max-width: 599px) {
  .sg-sound-label { display: none; }
  .sg-questbar-inner { gap: 6px; flex-wrap: wrap; }
  .sg-bar-pill { padding: 6px 9px; }
}

/* ======= LEVELS ======= */
.sg-level { padding-block: clamp(2.5rem, 6vw, 4.5rem); scroll-margin-top: 60px; }
.sg-level-alt {
  background: radial-gradient(ellipse 60% 40% at 10% 0%, rgba(255, 138, 43, 0.08), transparent 70%), radial-gradient(ellipse 50% 40% at 100% 100%, rgba(183, 156, 255, 0.08), transparent 70%), #0E0B0B;
  border-block: 1px solid var(--border);
}
.sg-level-head { margin-bottom: 28px; }
.sg-level-tag {
  display: inline-block; margin: 0 0 10px; padding: 4px 12px;
  border-radius: 999px; background: linear-gradient(90deg, #FFB45A, #FF8FB8);
  color: #120A06; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
}
.sg-level h2 { margin: 0 0 12px; font-size: clamp(1.9rem, 4.6vw, 2.9rem); }
.sg-intro { max-width: 46em; margin: 0; color: var(--muted); font-size: 1.1rem; }
.sg-intro strong { color: var(--ink); }

/* ======= GAME CARDS ======= */
.sg-game {
  position: relative;
  margin-top: 28px;
  padding: clamp(1.1rem, 3vw, 2rem);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(40, 28, 24, 0.75), rgba(18, 14, 14, 0.88));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  scroll-margin-top: 64px;
}
.sg-game-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.sg-game-head h3 { margin: 0 0 4px; font-size: clamp(1.3rem, 3vw, 1.6rem); }
.sg-game-head p { max-width: 52em; margin: 0; color: var(--muted); }
.sg-bigidea { margin-top: 22px; padding: 16px 18px; border-left: 4px solid var(--orange); border-radius: 0 14px 14px 0; background: rgba(255, 138, 43, 0.07); }
.sg-bigidea p { margin: 0; }

/* Step layout: the toy on the left, checklist on the right */
.sg-lab { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: clamp(1rem, 3vw, 1.75rem); align-items: start; }
.sg-controls { display: flex; flex-direction: column; gap: 12px; }
.sg-slider { display: grid; grid-template-columns: 1fr 5.4em; gap: 4px 10px; align-items: center; }
.sg-slider label { grid-column: 1 / -1; font-weight: 700; }
.sg-slider output { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.sg-slider input[type="range"] { width: 100%; height: 32px; margin: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; }
.sg-slider input::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), var(--track, var(--push))); }
.sg-slider input::-moz-range-track { height: 10px; border-radius: 999px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), var(--track, var(--push))); }
.sg-slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -8px; border: 3px solid #fff; border-radius: 50%; background: var(--track, var(--push)); box-shadow: 0 0 12px var(--track, var(--push)); }
.sg-slider input::-moz-range-thumb { width: 22px; height: 22px; border: 3px solid #fff; border-radius: 50%; background: var(--track, var(--push)); }
.sg-slider-b { --track: #6FE3FF; }
.sg-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.sg-seg-btn, .sg-small-btn {
  min-height: 42px; padding: 6px 12px;
  border: 1px solid #6B5A54; border-radius: 999px;
  background: rgba(255, 255, 255, 0.03); color: var(--ink);
  font-size: 0.9rem; font-weight: 700; cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s;
}
.sg-seg-btn:hover, .sg-small-btn:hover { border-color: var(--orange); }
.sg-seg-btn[aria-pressed="true"] { border-color: var(--orange); background: rgba(255, 138, 43, 0.16); }
.sg-row-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.sg-status { min-height: 3em; margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); }

/* Discovery checklists */
.sg-finds { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.sg-finds li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); transition: background-color 0.3s; }
.sg-check-dot { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid #6B5A54; border-radius: 50%; font-size: 0.85rem; font-weight: 900; }
.sg-finds li.done { background: rgba(124, 255, 158, 0.10); }
.sg-finds li.done .sg-check-dot { border-color: var(--good); background: var(--good); color: #062010; }
.sg-finds li.done .sg-check-dot::before { content: "✓"; }

/* ======= FINISH ======= */
.sg-bigideas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: idea; }
.sg-bigideas li { position: relative; padding: 16px 18px 16px 58px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); counter-increment: idea; }
.sg-bigideas li::before { content: counter(idea); position: absolute; left: 16px; top: 14px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--orange); color: var(--on-accent); font-weight: 900; box-shadow: 0 0 14px rgba(255, 138, 43, 0.5); }
.sg-badges-title { margin: 40px 0 14px; font-size: 1.4rem; }
.sg-badges { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.sg-badge a { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; padding: 16px 8px; border: 1px dashed #6B5A54; border-radius: 18px; color: var(--muted); text-align: center; text-decoration: none; transition: border-color 0.2s, transform 0.2s; }
.sg-badge a:hover { border-color: var(--orange); transform: translateY(-2px); }
.sg-badge-icon { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: rgba(255, 255, 255, 0.05); font-size: 1.7rem; font-weight: 800; }
.sg-badge-name { color: var(--ink); font-weight: 800; font-size: 0.95rem; }
.sg-badge-desc { font-size: 0.8rem; }
.sg-badge.is-earned a { border: 1px solid rgba(255, 212, 90, 0.55); background: radial-gradient(ellipse at 50% 0%, rgba(255, 212, 90, 0.14), transparent 70%); }
.sg-badge.is-earned .sg-badge-icon { background: radial-gradient(circle, #FFE9A8, #FF9F43); box-shadow: 0 0 22px rgba(255, 180, 70, 0.55); }
.sg-cert-wrap { margin-top: 28px; }
.sg-cert-locked { padding: 18px 20px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); text-align: center; }
.sg-cert-locked p { margin: 0; }
.sg-cert { max-width: 720px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 3rem); border-radius: 22px; background: #FFFBF3; color: #2A1A12; text-align: center; box-shadow: 0 0 0 6px #120A06, 0 0 0 10px #FF8A2B, 0 30px 60px rgba(0, 0, 0, 0.5); }
.sg-cert p { margin: 0 0 10px; }
.sg-cert-eyebrow { color: #8A3A10; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
.sg-cert-title { font-family: var(--font-display); font-size: clamp(2rem, 6vw, 3.2rem); line-height: 1.05; background: linear-gradient(90deg, #D9480F, #E2412F, #B87400); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sg-cert-name { display: inline-block; padding: 0 18px 4px; border-bottom: 2px solid #D9C7B5; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.6rem, 5vw, 2.4rem); font-style: italic; }
.sg-cert-text, .sg-cert-date { color: #5A4436; }
.sg-cert-date { font-size: 0.9rem; }
.sg-cert-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 20px; }
.sg-cert-actions label { font-weight: 700; }
.sg-cert-actions input { min-height: 48px; padding: 8px 14px; border: 1px solid #9A6A58; border-radius: 12px; background: var(--surface-2); color: var(--ink); font: inherit; }
.sg-reset-row { margin: 28px 0 0; color: var(--muted); font-size: 0.92rem; text-align: center; }
.sg-link-btn { min-height: 40px; padding: 4px 2px; border: 0; background: none; color: var(--orange); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.sg-teacher { margin-top: 32px; padding: 16px 20px; border: 1px solid var(--border); border-radius: 16px; background: rgba(255, 255, 255, 0.02); }
.sg-teacher h3 { margin: 18px 0 6px; }
.sg-teacher ul { margin: 0; padding-left: 1.2em; color: var(--muted); }
.sg-teacher li { margin-bottom: 6px; }
.sg-teacher strong { color: var(--ink); }
.sg-more { text-align: center; }
.sg-more h2 { margin: 0 0 20px; font-size: clamp(1.6rem, 4vw, 2.2rem); }

/* ======= LITTLE REACTIONS ======= */
.sg-pop { animation: sg-pop 0.45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes sg-pop { 0% { transform: scale(0.92); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.sg-shake { animation: sg-shake 0.35s; }
@keyframes sg-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes sg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sg-reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
.sg-reveal.in { opacity: 1; transform: none; }


/* ======= STEP CARDS: number, milestone, toy box ======= */
.sg-step-num {
  flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.06); color: var(--orange);
  font-family: var(--font-display); font-size: 1.25rem; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 2px rgba(255, 138, 43, 0.5);
  transition: background-color 0.4s, color 0.4s, box-shadow 0.4s;
}
.sg-game.is-done { border-color: rgba(255, 212, 90, 0.45); }
.sg-game.is-done .sg-step-num { background: radial-gradient(circle, #FFE9A8, #FF9F43); color: #3A2400; box-shadow: 0 0 22px rgba(255, 180, 70, 0.55); }
.sg-game-head .sg-milestone { margin-top: 10px; color: var(--ink); }
.sg-milestone strong { margin-right: 6px; padding: 2px 10px; border-radius: 999px; background: rgba(255, 212, 90, 0.14); color: #FFD45A; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; }
/* Steps 7 and 8 are demonstrations of a real session, not real recording (2026-11-20). */
.sg-game-head .sg-demo-tag { display: inline-block; margin: 6px 0 4px; padding: 3px 12px; border: 1px solid rgba(111, 227, 255, 0.45); border-radius: 999px; background: rgba(111, 227, 255, 0.1); color: #A8EEFF; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.sg-done-tag { display: inline-block; margin: 10px 0 0; padding: 3px 12px; border-radius: 999px; background: rgba(124, 255, 158, 0.14); color: var(--good); font-weight: 800; font-size: 0.9rem; }
.sg-stage { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 16px; border-radius: 18px; background: rgba(0, 0, 0, 0.28); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); }
.sg-controls { min-width: 0; }
.sg-toy-title { margin: 0; color: #FFB86B; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.sg-label { margin: 0; font-weight: 700; }
.sg-note { margin: 0; color: var(--muted); font-size: 0.9rem; }
.sg-play { min-width: 12.5em; }
.sg-play.is-playing { border-color: var(--orange); background: rgba(255, 138, 43, 0.16); }
.sg-small-btn:disabled { opacity: 0.5; cursor: default; }

/* Text boxes */
.sg-fields { display: grid; gap: 12px; }
.sg-fields label, .sg-add label { display: grid; gap: 6px; font-weight: 700; }
.sg-fields input, .sg-fields textarea, .sg-add input {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1px solid #9A6A58; border-radius: 12px;
  background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 400;
}
.sg-fields textarea { line-height: 1.5; resize: vertical; }
.sg-page ::placeholder { color: #A89A92; opacity: 1; }
.sg-page textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ======= HERO: the playable bars ======= */
.sg-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.2;
  background: radial-gradient(ellipse 50% 55% at 82% 38%, var(--mood), transparent 70%);
  transition: opacity 0.8s;
}
.sg-hero-art { display: grid; justify-items: center; gap: 10px; width: 100%; max-width: 480px; justify-self: center; }
.sg-eq { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; cursor: pointer; }
.sg-eq rect { fill: var(--red); transform-box: fill-box; transform-origin: center; animation: sg-eq 1.5s ease-in-out infinite alternate; transition: fill 0.5s; }
.sg-eq rect:nth-child(3n) { fill: var(--orange); }
.sg-eq rect:nth-child(4n + 1) { fill: #FF6FA8; }
.sg-eq rect:nth-child(7n) { fill: #FFD45A; }
.sg-eq rect.hit { fill: #fff; transition: none; filter: drop-shadow(0 0 6px #fff); }
@keyframes sg-eq { from { transform: scaleY(0.55); } to { transform: scaleY(1.08); } }
.sg-eq-hint { margin: 0; color: var(--muted); font-size: 0.9rem; text-align: center; }
.sg-how-step h3 a { color: var(--ink); text-underline-offset: 4px; }
.sg-how-step h3 a:hover { color: var(--orange); }

/* ======= STICKY BAR: 10-bar meter ======= */
.sg-meter { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.sg-meter-bars { display: flex; align-items: flex-end; gap: 3px; height: 30px; }
.sg-meter-bars i { width: 7px; border-radius: 3px; background: #3A2A26; transition: background-color 0.4s, box-shadow 0.4s; }
.sg-meter-bars i:nth-child(1) { height: 36%; } .sg-meter-bars i:nth-child(2) { height: 52%; } .sg-meter-bars i:nth-child(3) { height: 44%; }
.sg-meter-bars i:nth-child(4) { height: 66%; } .sg-meter-bars i:nth-child(5) { height: 58%; } .sg-meter-bars i:nth-child(6) { height: 78%; }
.sg-meter-bars i:nth-child(7) { height: 68%; } .sg-meter-bars i:nth-child(8) { height: 88%; } .sg-meter-bars i:nth-child(9) { height: 80%; }
.sg-meter-bars i:nth-child(10) { height: 100%; }
.sg-meter-bars i.on { background: linear-gradient(#FFD45A, #FF8A2B); box-shadow: 0 0 8px rgba(255, 138, 43, 0.7); }
.sg-meter.full .sg-meter-bars i { background: linear-gradient(#E9FFD0, #7CFF9E); box-shadow: 0 0 10px rgba(124, 255, 158, 0.7); }
.sg-meter-num { color: var(--muted); font-weight: 800; font-size: 0.9rem; }
.sg-stop { border-color: #FF7A6E; background: rgba(255, 90, 78, 0.16); cursor: pointer; }

/* ======= STEP 1: vibes ======= */
.sg-moods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sg-mood {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 84px; padding: 12px;
  border: 1px solid #6B5A54; border-radius: 16px; background: rgba(255, 255, 255, 0.03);
  color: var(--ink); text-align: left; cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s, box-shadow 0.3s;
}
.sg-mood:hover { border-color: var(--c); transform: translateY(-2px); }
.sg-mood-icon { font-size: 1.5rem; line-height: 1.1; }
.sg-mood-name { font-weight: 800; }
.sg-mood-words { color: var(--muted); font-size: 0.82rem; }
.sg-mood[aria-pressed="true"] { border-color: var(--c); background: rgba(255, 255, 255, 0.08); box-shadow: 0 0 0 1px var(--c), 0 0 22px -4px var(--c); }
.sg-mood.playing { animation: sg-pulse 0.6s ease-in-out infinite alternate; }
@keyframes sg-pulse { from { box-shadow: 0 0 0 1px var(--c), 0 0 8px -4px var(--c); } to { box-shadow: 0 0 0 1px var(--c), 0 0 30px 0 var(--c); } }

/* ======= STEPS 2 AND 4: the grids ======= */
.sg-grid { display: grid; gap: 5px; }
.sg-beat { grid-template-columns: 3.6em repeat(8, minmax(0, 1fr)); }
.sg-mel { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.sg-grid-label { align-self: center; color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.sg-grid-count { color: var(--muted); font-size: 0.8rem; font-weight: 800; text-align: center; }
.sg-cell {
  min-height: 30px; padding: 0; border: 1px solid #5A4A44; border-radius: 8px;
  background: rgba(255, 255, 255, 0.04); cursor: pointer;
  transition: background-color 0.12s, transform 0.12s, box-shadow 0.2s;
}
.sg-beat .sg-cell { aspect-ratio: 1; max-height: 54px; }
.sg-mel .sg-cell { height: 32px; border-color: color-mix(in srgb, var(--c) 40%, #5A4A44); }
.sg-cell.beat { background: rgba(255, 255, 255, 0.09); }
.sg-cell:hover { border-color: var(--c); }
.sg-cell[aria-pressed="true"] { border-color: var(--c); background: var(--c); box-shadow: 0 0 12px -2px var(--c); }
.sg-cell.now { outline: 2px solid rgba(255, 255, 255, 0.85); outline-offset: -2px; }
.sg-cell.now[aria-pressed="true"] { transform: scale(1.12); }
.sg-page .sg-cell:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; z-index: 1; position: relative; }
.sg-fav { padding-top: 4px; }

/* ======= STEP 3: sparks and words ======= */
.sg-spark { padding: 16px 18px; border: 1px solid rgba(183, 156, 255, 0.4); border-radius: 16px; background: linear-gradient(135deg, rgba(183, 156, 255, 0.14), rgba(255, 111, 168, 0.10)); }
.sg-spark-line { margin: 0 0 6px; font-size: 1.1rem; }
.sg-spark-line:last-child { margin-bottom: 0; }
.sg-spark-label { color: var(--muted); }
.sg-reel { color: #FFD45A; font-weight: 800; }
.sg-reel.spin { opacity: 0.65; }
.sg-cloud, .sg-bank { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.sg-chip {
  min-height: 40px; padding: 6px 14px; border: 1px solid #6B5A54; border-radius: 999px;
  background: rgba(255, 255, 255, 0.03); color: var(--ink); font-weight: 600; cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s;
}
.sg-chip:hover { border-color: #B79CFF; transform: translateY(-1px); }
.sg-chip[aria-pressed="true"] { border-color: #B79CFF; background: rgba(183, 156, 255, 0.2); }
.sg-bank { min-height: 44px; }
.sg-bank li { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 14px; border-radius: 999px; background: rgba(183, 156, 255, 0.18); font-weight: 600; }
.sg-bank li.sg-bank-empty { padding: 10px 14px; background: rgba(255, 255, 255, 0.04); color: var(--muted); font-weight: 400; }
.sg-icon-btn { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid #6B5A54; border-radius: 8px; background: rgba(0, 0, 0, 0.3); color: var(--ink); cursor: pointer; }
.sg-icon-btn:hover { border-color: var(--orange); }
.sg-icon-btn:disabled { opacity: 0.35; cursor: default; }
.sg-bank .sg-icon-btn { border-radius: 50%; }
.sg-add-row { display: flex; gap: 8px; }
.sg-add-row input { flex: 1; min-width: 0; }

/* ======= STEP 5: syllable counts and the beat counter ======= */
.sg-syl { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 0; padding: 0; list-style: none; min-height: 1.6em; }
.sg-syl li { padding: 2px 10px; border-radius: 999px; background: rgba(111, 227, 255, 0.12); color: #BFEFFF; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.sg-count { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.sg-count span { display: grid; place-items: center; height: 46px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); color: var(--muted); font-weight: 800; transition: transform 0.1s, background-color 0.1s; }
.sg-count span:nth-child(odd) { color: var(--ink); background: rgba(255, 255, 255, 0.09); }
.sg-count span.now { background: var(--orange); color: var(--on-accent); transform: scale(1.1); }

/* ======= STEP 6: song map ======= */
.sg-map { display: flex; flex-wrap: wrap; gap: 8px; min-height: 96px; margin: 0; padding: 0; list-style: none; counter-reset: block; }
.sg-block {
  display: flex; flex-direction: column; gap: 6px; min-width: 106px; padding: 10px;
  border: 1px solid var(--c); border-radius: 14px; background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 3px 0 var(--c); counter-increment: block;
  transition: transform 0.2s, box-shadow 0.2s;
}
.sg-block-name { font-weight: 800; }
.sg-block-name::before { content: counter(block) ". "; color: var(--muted); font-weight: 600; }
.sg-block-hint { color: var(--muted); font-size: 0.78rem; }
.sg-block-btns { display: flex; gap: 4px; }
.sg-block.now { transform: translateY(-4px); box-shadow: inset 0 3px 0 var(--c), 0 0 0 2px #fff, 0 0 24px -2px var(--c); }
.sg-map-empty { padding: 14px; border: 1px dashed #6B5A54; border-radius: 14px; color: var(--muted); }

/* ======= STEP 7: sound check ======= */
.sg-vu { position: relative; padding-bottom: 26px; }
.sg-vu::before { content: ""; display: block; height: 34px; border-radius: 10px; background: linear-gradient(90deg, #1F2A33 0 40%, #153222 40% 80%, #3A1614 80% 100%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.sg-vu-bar { position: absolute; inset: 0 0 auto 0; height: 34px; border-radius: 10px; background: linear-gradient(90deg, #6FE3FF, #7CFF9E 40%, #7CFF9E 78%, #FFD45A 86%, #FF5A4E); clip-path: inset(0 100% 0 0); }
.sg-vu-zones { position: absolute; inset: auto 0 0 0; display: grid; grid-template-columns: 40fr 40fr 20fr; color: var(--muted); font-size: 0.75rem; font-weight: 700; text-align: center; }
.sg-vu-zones i { font-style: normal; }
.sg-clip { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: #9A8A84; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.12em; }
.sg-clip-light { width: 14px; height: 14px; border-radius: 50%; background: #3A2622; }
.sg-clip.on { color: #FF9B8A; }
.sg-clip.on .sg-clip-light { background: #FF3B30; box-shadow: 0 0 14px #FF3B30; }
.sg-checks { margin: 0; padding: 10px 14px 12px; border: 1px solid var(--border); border-radius: 14px; }
.sg-checks legend { padding: 0 6px; font-weight: 800; }
.sg-check { display: flex; align-items: center; gap: 10px; min-height: 42px; font-weight: 600; cursor: pointer; }
.sg-check input { flex: none; width: 24px; height: 24px; accent-color: var(--orange); }
.sg-pledge { padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); }

/* ======= STEP 8: tracks ======= */
.sg-tracks { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.sg-track { display: grid; grid-template-columns: minmax(0, 9em) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); transition: box-shadow 0.2s; }
.sg-track-name { font-weight: 800; }
.sg-track-sub { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 400; }
.sg-wave { display: block; width: 100%; height: 34px; border-radius: 8px; background: rgba(0, 0, 0, 0.35); }
.sg-wave g { fill: var(--c); clip-path: inset(0 100% 0 0); }
.sg-track.recording { box-shadow: inset 0 0 0 2px #FF5A4E, 0 0 18px -4px #FF5A4E; }
.sg-rec { min-width: 6.6em; min-height: 40px; padding: 6px 12px; border: 1px solid #9A6A58; border-radius: 999px; background: rgba(255, 255, 255, 0.03); color: var(--ink); font-weight: 700; cursor: pointer; }
.sg-rec:hover { border-color: #FF7A6E; }
.sg-rec-dot { color: #FF6A5E; }
.sg-track.recording .sg-rec-dot { animation: sg-blink 0.5s steps(2) infinite; }
@keyframes sg-blink { 50% { opacity: 0.2; } }
.sg-track-ok { color: var(--good); font-weight: 800; font-size: 0.9rem; white-space: nowrap; }

/* ======= STEP 9: faders ======= */
.sg-faders { display: grid; gap: 10px; }
.sg-slider label small { color: var(--muted); font-weight: 400; }

/* ======= STEP 10: song sheet ======= */
.sg-sheet-wrap { margin-top: 22px; }
.sg-sheet { max-width: 720px; margin: 0 auto; padding: clamp(1.25rem, 4vw, 2.5rem); border-radius: 18px; background: #FFFBF3; color: #2A1A12; box-shadow: 0 0 0 6px #120A06, 0 0 0 9px #FF8A2B, 0 30px 60px rgba(0, 0, 0, 0.5); }
.sg-sheet:focus-visible { outline: 3px solid var(--focus); outline-offset: 12px; }
.sg-sheet-eyebrow { margin: 0 0 4px; color: #8A3A10; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
.sg-sheet-title { margin: 0 0 6px; font-family: var(--font-display); font-size: clamp(1.7rem, 5vw, 2.6rem); line-height: 1.08; color: #B5380C; overflow-wrap: anywhere; }
.sg-sheet-meta { margin: 0 0 14px; color: #5A4436; font-weight: 600; }
.sg-sheet h4 { margin: 18px 0 4px; color: #8A3A10; font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase; }
.sg-sheet p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.sg-sheet .sg-sheet-empty { color: #6A5446; font-style: italic; }
.sg-sheet-map { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.sg-sheet-map li { padding: 3px 12px; border: 1px solid #C9B6A2; border-radius: 999px; background: #FFF3DE; font-weight: 700; font-size: 0.9rem; }
.sg-sheet-beat { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; line-height: 1.5; white-space: pre; overflow-x: auto; }
.sg-cert-song { color: #5A4436; font-weight: 700; }

/* ======= TEACHERS: details + the budget worksheet ======= */
.sg-teacher { margin-top: 12px; scroll-margin-top: 70px; }
.sg-teacher summary { display: flex; align-items: center; min-height: 44px; font-weight: 800; font-size: 1.1rem; cursor: pointer; }
.sg-teacher summary::after { content: ""; flex: none; width: 0.55rem; height: 0.55rem; margin: 0 0.3rem 0 auto; border: solid var(--orange); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform 0.2s; }
.sg-teacher[open] summary::after { transform: rotate(225deg); }
.sg-teacher summary::-webkit-details-marker { display: none; }
.sg-teacher summary { list-style: none; }
.sg-teacher-body { padding-top: 6px; }
.sg-teacher-body p, .sg-teacher-body li { max-width: 70ch; color: var(--muted); }
.sg-teacher h3 { color: var(--ink); font-size: 1.05rem; }
.sg-notes { margin: 0; padding-left: 1.4em; }
.sg-notes li { margin-bottom: 10px; }
.song-item { min-width: 0; margin: 0 0 1rem; padding: .65rem .9rem .9rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--surface); }
.song-item legend { padding-inline: .35rem; font-weight: 700; }
.song-item p { margin: 0 0 .6rem; }
.song-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 8rem)) minmax(0, 1fr); gap: .65rem; align-items: end; }
.song-fields input, .song-extra input { display: block; width: 100%; min-height: 44px; padding: .45rem; margin-top: .2rem; border: 1px solid #9a6a58; border-radius: .4rem; background: var(--bg); color: var(--ink); font: inherit; }
.song-fields input[aria-invalid="true"], .song-extra input[aria-invalid="true"] { border-color: var(--orange); border-width: 2px; }
.song-line strong { display: block; color: var(--ink); }
.song-extra { display: block; max-width: 12rem; }
.song-total { display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: space-between; margin-block: 1rem; padding: .75rem 1rem; border-radius: .6rem; background: var(--surface-2); font-weight: 750; }
.song-total output { color: var(--orange); }
.sg-more-text { margin: -8px 0 20px; color: var(--muted); }

/* ======= POP-UP + CONFETTI LAYER ======= */
.sg-toast {
  position: fixed; left: 50%; top: 14px; z-index: 60;
  display: flex; align-items: center; gap: 12px;
  max-width: min(92vw, 460px); padding: 12px 18px 12px 12px;
  border: 1px solid rgba(255, 212, 90, 0.6); border-radius: 18px;
  background: rgba(24, 18, 16, 0.96);
  box-shadow: 0 0 30px rgba(255, 180, 70, 0.35), 0 18px 40px rgba(0, 0, 0, 0.5);
  color: var(--ink);
  transform: translate(-50%, -140%); opacity: 0; pointer-events: none;
  transition: transform 0.5s cubic-bezier(.2, 1.4, .4, 1), opacity 0.3s;
}
.sg-toast { width: max-content; }
.sg-toast.show { transform: translate(-50%, 0); opacity: 1; }
.sg-toast:empty { display: none; }
.sg-toast-icon { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle, #FFE9A8, #FF9F43); color: #3A2400; font-family: Georgia, serif; font-weight: 700; font-size: 1.4rem; }
.sg-toast-body { display: flex; flex-direction: column; }
.sg-toast-body span { color: var(--muted); font-size: 0.9rem; }
.sg-fx { position: fixed; inset: 0; z-index: 55; width: 100vw; height: 100vh; pointer-events: none; }

/* ======= TABLETS ======= */
@media (max-width: 899px) {
  .sg-hero-inner { grid-template-columns: 1fr; }
  .sg-lab { grid-template-columns: 1fr; }
  .sg-badges { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* ======= PHONES ======= */
@media (max-width: 640px) {
  .sg-how-steps, .sg-bigideas { grid-template-columns: 1fr; }
  .sg-badges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sg-game-head { flex-direction: column; gap: 10px; }
  .sg-step-num { width: 46px; height: 46px; font-size: 1.05rem; }
  .sg-game { padding: 14px 12px; border-radius: 18px; }
  .sg-stage { padding: 12px 10px; }
  .sg-play { width: 100%; }
  .sg-moods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sg-eq { max-width: 300px; }
  .sg-eq-hint { display: none; }
  .sg-track { grid-template-columns: minmax(0, 1fr) auto; }
  .sg-track .sg-wave { grid-column: 1 / -1; grid-row: 2; }
  .song-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .song-line { grid-column: 1 / -1; }
  .song-line strong { display: inline; margin-inline-start: .25rem; }
  .sg-hero-ctas { flex-direction: column; align-items: stretch; }
}
/* Small phones: the drum names move above their rows so every square stays easy to tap. */
@media (max-width: 480px) {
  .sg-beat { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
  .sg-beat .sg-grid-label { grid-column: 1 / -1; margin-top: 4px; }
  .sg-beat .sg-grid-corner { display: none; }
  .sg-mel { gap: 4px; }
  .sg-count { gap: 4px; }
}
@media (max-width: 379px) {
  .sg-meter-bars i { width: 5px; }
  .sg-stop-label { display: none; }
  .sg-meter { gap: 6px; }
  .sg-bar-pill { padding: 5px 8px; font-size: 0.85rem; min-height: 38px; }
}

/* ======= REDUCED MOTION: everything holds still ======= */
@media (prefers-reduced-motion: reduce) {
  .sg-page *, .sg-page *::before, .sg-page *::after, .sg-toast { animation: none !important; transition: none !important; }
}

/* ======= PRINT: only the certificate, or only the song sheet, when its Print button is pressed ======= */
@media print {
  body.sg-print-cert * { visibility: hidden; }
  body.sg-print-cert .sg-cert, body.sg-print-cert .sg-cert * { visibility: visible; }
  body.sg-print-cert .sg-cert { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: 6px double #FF8A2B; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.sg-print-sheet * { visibility: hidden; }
  body.sg-print-sheet .sg-sheet, body.sg-print-sheet .sg-sheet * { visibility: visible; }
  body.sg-print-sheet .sg-sheet { position: absolute; left: 0; top: 0; width: 100%; max-width: none; box-shadow: none; border: 4px double #FF8A2B; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
