:root {
  --ink: #f6f1e7;
  --muted: #9997a2;
  --line: rgba(246, 241, 231, .16);
  --field: #080b16;
  --warm: #ffbe5c;
  --violet: #8d7dff;
  --pink: #ff7baf;
  --display: Georgia, 'Times New Roman', serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--field); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--field); color: var(--ink); font-family: var(--sans); }
button, select, input { font: inherit; }
button { cursor: pointer; }
.camera-feed { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; transition: opacity .4s ease; }
.gesture-canvas { position: fixed; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity .25s ease; }
.volume-hud { --volume-scale: .94; position: fixed; z-index: 6; left: 50%; bottom: 8vh; width: 138px; display: grid; justify-items: center; gap: 8px; opacity: 0; pointer-events: none; transform: translate(-50%, 10px) scale(.92); transition: opacity .4s ease, transform .4s cubic-bezier(.2,.8,.2,1); }
.volume-hud-bloom { position: relative; width: 78px; aspect-ratio: 1; border: 1px solid rgba(255, 228, 185, .2); border-radius: 26px; display: grid; place-items: center; color: rgba(255, 246, 230, .92); background: radial-gradient(circle at 34% 28%, rgba(255, 218, 159, .2), rgba(20, 17, 28, .58) 58%, rgba(9, 10, 18, .72)); box-shadow: 0 18px 44px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.08); backdrop-filter: blur(16px); transform: scale(var(--volume-scale)); transition: transform .18s cubic-bezier(.2,.8,.2,1), filter .2s ease, box-shadow .2s ease; }
.volume-hud-bloom svg { position: absolute; left: 50%; top: 50%; width: 29px; fill: rgba(255, 234, 201, .18); stroke: rgba(255, 234, 201, .5); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; transform: translate(-50%, -50%); }
.volume-hud-bloom strong { position: relative; z-index: 1; padding-top: 1px; font-size: 13px; font-weight: 500; letter-spacing: .04em; text-shadow: 0 2px 8px rgba(0,0,0,.42); }
.volume-hud-label { color: rgba(255, 244, 226, .52); font-size: 8px; letter-spacing: .18em; text-transform: uppercase; }
.volume-hud-track { width: 112px; height: 2px; overflow: hidden; background: rgba(255,255,255,.12); }
.volume-hud-track i { display: block; width: 48%; height: 100%; background: linear-gradient(90deg, rgba(169, 139, 233, .9), rgba(255, 196, 105, .98)); box-shadow: 0 0 12px rgba(255, 190, 92, .5); transition: width .12s linear; }
body.camera-active.drone-active .volume-hud { opacity: .58; transform: translate(-50%, 0) scale(1); }
body.camera-active.drone-active.volume-changing .volume-hud { opacity: 1; transform: translate(-50%, -3px) scale(1.05); }
body.volume-changing .volume-hud-bloom { filter: brightness(1.16) saturate(1.12); box-shadow: 0 22px 58px rgba(0,0,0,.34), 0 0 34px rgba(255, 190, 92, .18), inset 0 1px 0 rgba(255,255,255,.12); }

.app-shell { height: 100vh; min-height: 640px; overflow: hidden; display: flex; flex-direction: column; position: relative; z-index: 1; }
.topbar { height: 74px; padding: 0 clamp(20px, 4vw, 64px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); position: relative; z-index: 4; }
.wordmark { color: var(--ink); text-decoration: none; font-size: 15px; letter-spacing: .08em; text-transform: lowercase; }
.wordmark span { color: var(--warm); margin-left: 3px; }
.status { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 10px; letter-spacing: .14em; }
.status i { width: 7px; height: 7px; border-radius: 100%; background: #535461; box-shadow: 0 0 0 3px rgba(255,255,255,.04); }
.status.active i { background: var(--warm); box-shadow: 0 0 14px var(--warm); }
.topbar-actions { display: flex; align-items: center; gap: 23px; }
.ghost-button { border: 0; padding: 8px 0; background: transparent; color: var(--muted); font-size: 12px; }
.ghost-button:hover { color: var(--ink); }
.camera-button { border: 1px solid rgba(255, 190, 92, .58); border-radius: 999px; padding: 8px 13px; color: var(--warm); background: rgba(255, 190, 92, .04); font-size: 11px; letter-spacing: .04em; transition: color .2s ease, background .2s ease; }
.camera-button:hover { color: #1d1720; background: var(--warm); }

.experience { flex: 1; min-height: 0; position: relative; isolation: isolate; padding: clamp(28px, 4.5vw, 65px) clamp(20px, 8vw, 130px) 28px; display: grid; grid-template-columns: minmax(300px, .84fr) minmax(430px, 1.16fr); grid-template-rows: 1fr auto; align-items: center; overflow: hidden; }
.ambient { position: absolute; z-index: -1; border-radius: 50%; filter: blur(18px); opacity: .45; pointer-events: none; }
.ambient-one { width: 45vw; height: 45vw; top: -31vw; left: -18vw; background: radial-gradient(circle, rgba(117, 70, 182, .45), transparent 67%); }
.ambient-two { width: 49vw; height: 49vw; right: -19vw; bottom: -37vw; background: radial-gradient(circle, rgba(230, 129, 74, .28), transparent 66%); }
.camera-exit { display: none; position: absolute; z-index: 7; top: 24px; left: clamp(20px, 4vw, 64px); border: 0; padding: 8px 0; color: rgba(255,255,255,.78); background: transparent; font-size: 12px; }
.camera-controls-trigger { display: none; position: absolute; z-index: 7; top: 22px; right: clamp(24px, 5vw, 84px); border: 1px solid rgba(255,255,255,.34); border-radius: 999px; padding: 7px 13px; color: rgba(255,255,255,.9); background: rgba(8,8,11,.42); backdrop-filter: blur(8px); font-size: 11px; }
.practice-copy { max-width: 470px; align-self: center; position: relative; z-index: 1; }
.eyebrow, .lesson-kicker, .stream-label { color: var(--muted); font-size: 10px; letter-spacing: .16em; line-height: 1.5; text-transform: uppercase; }
h1, h2 { margin: 16px 0 20px; font-family: var(--display); font-weight: 400; letter-spacing: -.04em; }
h1 { font-size: clamp(48px, 4.45vw, 72px); line-height: .94; }
h2 { font-size: clamp(40px, 4vw, 62px); line-height: .96; }
.intro { max-width: 390px; margin: 0; color: #c1bec7; font-size: 15px; line-height: 1.7; }

.field-wrap { width: min(51vw, 585px); max-height: min(67vh, 585px); aspect-ratio: 1; justify-self: center; position: relative; display: grid; place-items: center; transition: filter .5s ease; }
.field-wrap::before { content: ""; position: absolute; inset: 3%; border: 1px solid transparent; border-radius: 50%; opacity: 0; transition: opacity .5s ease; }
.is-listening .field-wrap::before { border-color: rgba(200, 133, 156, .46); opacity: 1; animation: listen-bloom 3.2s ease-in-out infinite; }
.is-listening .field-wrap { filter: saturate(1.18); }
#field { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fifths-overlay { position: absolute; z-index: 0; width: 63%; aspect-ratio: 1; border: 1px solid rgba(222, 211, 185, .22); border-radius: 50%; opacity: 0; transform: scale(.82); pointer-events: none; transition: opacity .24s ease, transform .34s cubic-bezier(.2,.8,.24,1); box-shadow: 0 0 54px rgba(196, 215, 162, .06), inset 0 0 32px rgba(196, 215, 162, .04); }
.fifths-overlay::before, .fifths-overlay::after { content: ""; position: absolute; inset: 12%; border: 1px solid rgba(222, 211, 185, .12); border-radius: inherit; }
.fifths-overlay::after { inset: 30%; border-color: rgba(222, 211, 185, .09); }
.is-grabbing-orb .fifths-overlay { opacity: 1; transform: scale(1); }
.fifths-note { position: absolute; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(246,241,231,.14); border-radius: 50%; color: rgba(246,241,231,.58); background: rgba(11,10,15,.3); box-shadow: 0 4px 15px rgba(0,0,0,.16); font-size: 10px; letter-spacing: .03em; transform: translate(-50%, -50%); transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.fifths-note.active { color: #fff4cd; border-color: rgba(255, 196, 105, .9); background: rgba(255, 184, 92, .18); box-shadow: 0 0 20px rgba(255, 183, 87, .46); transform: translate(-50%, -50%) scale(1.2); }
.orb-button { width: clamp(125px, 16vw, 178px); aspect-ratio: 1; position: relative; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; color: var(--ink); transition: transform .3s ease; z-index: 1; }
.orb-button:hover { transform: scale(1.04); }
.is-grabbing-orb .orb-button { transform: scale(1.08); filter: drop-shadow(0 0 18px rgba(196, 215, 162, .58)); }
.orb-button.orb-key-shift .orb-core { animation: orb-key-shift .42s cubic-bezier(.2, .85, .25, 1); }
.orb-core { width: 68%; height: 68%; display: block; border-radius: 50%; background: radial-gradient(circle at 36% 30%, #fff3bd 0, var(--warm) 20%, #aa593c 51%, #43305f 78%, transparent 80%); box-shadow: 0 0 35px rgba(255, 179, 87, .36), inset -13px -10px 22px rgba(30, 11, 42, .34); transition: filter .3s ease; }
.orb-button.active .orb-core { filter: brightness(1.15) saturate(1.1); animation: breathe 4s ease-in-out infinite; }
.is-listening .orb-core { background: radial-gradient(circle at 36% 30%, #ffd9ba 0, #d99a68 19%, #aa596d 46%, #546d58 72%, transparent 81%); box-shadow: 0 0 52px rgba(220, 132, 153, .43), inset -13px -10px 22px rgba(27, 50, 35, .38); }
.is-listening .orb-button.active .orb-core { animation: listen-breathe 2.1s ease-in-out infinite; }
.orb-ring { position: absolute; inset: 5%; border: 1px solid rgba(255, 214, 153, .42); border-radius: 50%; opacity: .6; }
.ring-one { animation: turn 22s linear infinite; border-left-color: transparent; border-bottom-color: transparent; }
.ring-two { inset: -14%; border-color: rgba(160, 135, 255, .20); border-right-color: transparent; animation: turn 34s linear infinite reverse; }
.orb-copy { position: absolute; font-size: 12px; letter-spacing: .12em; line-height: 1.25; text-transform: uppercase; pointer-events: none; }
.target-label { position: absolute; top: 13%; color: rgba(246,241,231,.54); font-size: 10px; letter-spacing: .16em; }
.pitch-readout { position: absolute; bottom: 13%; margin: 0; font: 400 33px/1 var(--display); letter-spacing: -.03em; }
.pitch-detail { position: absolute; bottom: 8%; margin: 0; color: var(--muted); font-size: 11px; letter-spacing: .04em; }
.gesture-state { position: absolute; top: 18%; margin: 0; color: rgba(246,241,231,.62); font-size: 10px; letter-spacing: .13em; text-transform: uppercase; opacity: 0; transform: translateY(-4px); transition: opacity .25s ease, transform .25s ease; }

.descriptor-stream { align-self: end; justify-self: end; width: min(100%, 238px); margin: 0 0 7px 0; }
.descriptor-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.descriptor { padding: 7px 10px; border: 1px solid rgba(246,241,231,.17); border-radius: 100px; background: rgba(255,255,255,.02); color: #c9c3d0; font-size: 12px; opacity: .36; transform: translateY(5px); transition: opacity .45s ease, transform .45s ease, border-color .2s ease, color .2s ease; }
.descriptor.visible { opacity: 1; transform: translateY(0); }
.descriptor.selected { border-color: var(--warm); color: var(--warm); }
.descriptor:hover { border-color: rgba(255,190,92,.65); }
.lesson-card { max-width: 337px; align-self: end; padding-bottom: 7px; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.lesson-card p { margin: 0; }
#lesson-text { margin-top: 10px; color: #ddd8df; font-family: var(--display); font-size: 20px; line-height: 1.25; }
.lesson-meter { height: 2px; margin-top: 20px; background: rgba(255,255,255,.1); }
.lesson-meter span { display: block; width: 8%; height: 100%; background: var(--warm); transition: width .6s ease; }

.controls { position: absolute; z-index: 5; top: 22px; right: clamp(20px, 8vw, 130px); box-sizing: border-box; width: min(1120px, calc(100% - 48px)); min-width: 0; padding: 20px 22px 18px; border: 1px solid rgba(246, 241, 231, .14); border-radius: 4px; background: linear-gradient(100deg, rgba(20, 23, 30, .92), rgba(29, 26, 36, .82)); box-shadow: 0 18px 55px rgba(0, 0, 0, .28); backdrop-filter: blur(18px); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px 18px; align-items: end; transform-origin: top right; transition: opacity .2s ease, transform .25s ease; }
.controls.is-collapsed { opacity: 0; pointer-events: none; transform: translateY(-10px) scale(.98); }
.control-group { min-width: 0; }
.tonic-control, .register-control, .profile-control { grid-column: span 2; }
.mic-source { grid-column: span 6; min-width: 0; }
.sensitivity-control, .warmth-control, .volume-control { grid-column: span 4; }
.control-group label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; margin-bottom: 10px; color: var(--muted); font-size: 10px; letter-spacing: .12em; line-height: 1.25; text-transform: uppercase; }
output { flex: 0 0 auto; color: #cac4ce; letter-spacing: .04em; white-space: nowrap; }
select { width: 100%; appearance: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 6px 22px 9px 0; color: var(--ink); background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23c9c3d0'/%3E%3C/svg%3E") right 8px center / 12px no-repeat; }
select option { background: #171725; }
input[type="range"] { width: 100%; margin: 8px 0 5px; accent-color: var(--warm); }
.mic-button { grid-column: 1 / span 3; align-self: end; min-width: 0; width: 100%; border: 1px solid rgba(255,190,92,.56); border-radius: 100px; padding: 11px 16px; color: var(--warm); background: rgba(255,190,92,.04); font-size: 12px; transition: background .2s, color .2s; }
.mic-button.active, .mic-button:hover { background: var(--warm); color: #1b1520; }
.gesture-button { grid-column: span 3; min-width: 0; justify-self: start; border: 0; padding: 3px 0; color: var(--muted); background: transparent; font-size: 10px; letter-spacing: .11em; text-align: left; text-transform: uppercase; }
#record-cue-motion { grid-column: span 4; }
.gesture-button:hover { color: var(--warm); }
.practice-note { display: none; }
.practice-note p { max-width: 640px; margin: 0; }
.practice-note strong { color: #d7d0d9; font-weight: 500; }

body.camera-active { background: #0b0a0d; }
body.camera-active .camera-feed { opacity: 1; transform: scaleX(-1); }
body.camera-active .gesture-canvas { opacity: 1; }
body.camera-active .topbar { display: none; }
body.camera-active .experience { position: fixed; inset: 0; z-index: 2; display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr; padding: 44px clamp(24px, 5vw, 84px); background: radial-gradient(circle at center, rgba(11, 10, 13, .08) 0, rgba(8, 8, 13, .42) 64%, rgba(5, 5, 8, .72) 100%); }
body.camera-active .ambient, body.camera-active .practice-copy { display: none; }
body.camera-active .camera-exit { display: block; }
body.camera-active .camera-controls-trigger { display: block; }
body.camera-active .field-wrap { width: min(75vw, 690px); max-height: min(82vh, 690px); grid-column: 1; grid-row: 1; transform: translateX(clamp(-310px, -15vw, -130px)); }
body.camera-active .field-wrap::after { content: "CAMERA PRACTICE"; position: absolute; bottom: -4%; color: rgba(255,255,255,.64); font-size: 10px; letter-spacing: .16em; }
body.camera-active .descriptor-stream { position: absolute; z-index: 4; left: clamp(24px, 5vw, 84px); bottom: 42px; width: min(300px, 36vw); }
body.camera-active .lesson-card { position: absolute; z-index: 4; right: clamp(24px, 5vw, 84px); bottom: 42px; width: min(330px, 36vw); }
body.camera-active .controls { top: 22px; right: clamp(24px, 5vw, 84px); left: auto; transform-origin: top right; background: rgba(12, 11, 15, .68); }
body.camera-active .controls.is-collapsed { display: none; }
body.camera-active .target-label, body.camera-active .pitch-readout, body.camera-active .pitch-detail { text-shadow: 0 2px 10px rgba(0,0,0,.72); }
body.camera-active .gesture-state { opacity: 1; transform: translateY(0); text-shadow: 0 2px 10px rgba(0,0,0,.72); }
body.camera-active.is-recording .gesture-state { top: 8%; padding: 9px 13px; border: 1px solid rgba(255, 211, 130, .36); border-radius: 999px; color: rgba(255, 231, 183, .98); background: rgba(12, 10, 15, .56); box-shadow: 0 10px 30px rgba(0,0,0,.22); font-size: 11px; letter-spacing: .15em; }
body.is-cue-mode .orb-core { background: radial-gradient(circle at 36% 30%, #fff1c8 0, #d9ad68 20%, #9b5d6f 46%, #496851 72%, transparent 81%); box-shadow: 0 0 64px rgba(213, 179, 117, .58), inset -13px -10px 22px rgba(27, 50, 35, .38); }
body.is-cue-mode .field-wrap::before { border-color: rgba(222, 190, 122, .72); opacity: .9; animation: listen-bloom 2s ease-in-out infinite; }

dialog { max-width: min(530px, calc(100% - 36px)); border: 1px solid rgba(255,255,255,.2); border-radius: 2px; padding: 38px; color: var(--ink); background: #141322; box-shadow: 0 25px 80px rgba(0,0,0,.6); }
dialog::backdrop { background: rgba(4, 5, 11, .72); backdrop-filter: blur(7px); }
dialog p { color: #c6c0ca; line-height: 1.65; }
.dialog-close { position: absolute; right: 16px; top: 11px; border: 0; color: var(--muted); background: none; font-size: 25px; }
.dialog-note { font-size: 12px; }

@keyframes turn { to { rotate: 360deg; } }
@keyframes breathe { 50% { transform: scale(1.06); filter: brightness(1.25) saturate(1.18); } }
@keyframes orb-key-shift { 50% { transform: scale(1.2) rotate(12deg); filter: brightness(1.35) saturate(1.25); } }
@keyframes listen-breathe { 50% { transform: scale(1.09); filter: brightness(1.23) saturate(1.34); } }
@keyframes listen-bloom { 50% { transform: scale(1.12); opacity: .18; } }

@media (max-width: 850px) {
  .app-shell { height: auto; min-height: 100vh; overflow: visible; }
  .experience { min-height: calc(100vh - 62px); grid-template-columns: 1fr; padding-top: 40px; padding-bottom: 36px; text-align: center; overflow: visible; }
  .practice-copy { justify-self: center; }
  .intro { margin-inline: auto; }
  .field-wrap { width: min(76vw, 470px); margin-top: 6px; }
  .descriptor-stream { justify-self: center; align-self: start; width: min(95%, 460px); margin: 0; }
  .descriptor-list { justify-content: center; }
  .lesson-card { justify-self: center; margin-top: 20px; margin-bottom: 0; text-align: left; }
  .controls { top: 18px; right: 20px; left: 20px; width: auto; grid-template-columns: 1fr 1fr; gap: 18px; }
  .tonic-control, .register-control, .profile-control, .wide-control { grid-column: span 1; }
  .mic-source { grid-column: span 2; }
  .mic-button { grid-column: span 2; justify-self: start; }
  .gesture-button, #record-cue-motion { grid-column: span 2; }
  .practice-note { display: block; padding: 0 20px 16px; color: var(--muted); font-size: 10px; line-height: 1.4; }
  body.camera-active .experience { padding: 60px 20px 28px; }
  body.camera-active .field-wrap { width: min(94vw, 560px); max-height: 62vh; transform: translateX(-8vw); }
  body.camera-active .descriptor-stream { left: 20px; bottom: 26px; width: min(270px, 66vw); text-align: left; }
  body.camera-active .lesson-card { display: none; }
  body.camera-active .controls { top: 54px; }
  body.camera-active .camera-controls-trigger { top: 18px; right: 20px; left: auto; }
}

@media (max-width: 500px) {
  .topbar { height: 62px; }
  .status { display: none; }
  .experience { min-height: 0; padding-bottom: 40px; }
  h1 { font-size: 53px; }
  .field-wrap { width: min(87vw, 410px); margin-top: 18px; }
  .target-label { top: 6%; }
  .pitch-readout { bottom: 6%; }
  .pitch-detail { bottom: 1%; }
  .controls { grid-template-columns: 1fr; max-height: calc(100vh - 110px); overflow-y: auto; }
  .tonic-control, .register-control, .profile-control, .wide-control, .mic-source, .mic-button { grid-column: auto; }
  .gesture-button, #record-cue-motion { grid-column: auto; }
  .mic-button { width: 100%; }
  .camera-button { padding: 7px 10px; font-size: 10px; }
  .topbar-actions { gap: 12px; }
  body.camera-active .field-wrap { max-height: 56vh; }
}
