:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07030c;
  color: #fff7f3;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #07030c; }
button { font: inherit; }

.instrument { position: relative; width: 100%; height: 100svh; overflow: hidden; isolation: isolate; background: radial-gradient(circle at 50% 45%, #31102e 0, #09030f 58%, #030206 100%); }
#field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.grain { position: absolute; inset: -50%; z-index: 1; pointer-events: none; opacity: .055; mix-blend-mode: soft-light; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E"); animation: grain .24s steps(2) infinite; }
@keyframes grain { 0% { transform: translate3d(-2%,1%,0) } 25% { transform: translate3d(2%,-1%,0) } 50% { transform: translate3d(1%,2%,0) } 75% { transform: translate3d(-1%,-2%,0) } }

.welcome { position: absolute; z-index: 5; left: clamp(1rem, 7vw, 7rem); top: 50%; width: min(35rem, calc(100vw - 2rem)); padding: clamp(1.5rem, 3vw, 2.8rem); transform: translateY(-50%); border: 1px solid rgba(255, 227, 241, .22); background: linear-gradient(135deg, rgba(12, 4, 22, .9), rgba(52, 10, 47, .54)); box-shadow: 0 2rem 9rem rgba(0,0,0,.58), inset 0 1px rgba(255,255,255,.06); backdrop-filter: blur(24px) saturate(1.2); transition: opacity .8s ease, transform .8s ease, visibility .8s; }
.welcome.is-hidden { opacity: 0; visibility: hidden; transform: translateY(-46%); pointer-events: none; }
.eyebrow { margin: 0 0 .9rem; color: #ffc4dd; font-size: .62rem; font-weight: 750; letter-spacing: .2em; text-transform: uppercase; }
.welcome h1 { max-width: 29rem; margin: 0; font-family: Iowan Old Style, Baskerville, Georgia, serif; font-size: clamp(3rem, 6.2vw, 5.8rem); font-weight: 400; letter-spacing: -.055em; line-height: .88; text-wrap: balance; }
.lede { max-width: 31rem; margin: 1.35rem 0 1.5rem; color: rgba(255,244,246,.78); font-size: .94rem; line-height: 1.65; }
.start-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
button { cursor: pointer; border-radius: 999px; border: 1px solid rgba(255,229,240,.28); color: #fff8fb; background: rgba(20,6,28,.52); padding: .82rem 1rem; font-size: .65rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; transition: transform .25s ease, background .25s ease, border-color .25s ease; }
button:hover, button:focus-visible { transform: translateY(-2px); border-color: rgba(255,234,196,.75); outline: none; }
button.primary { color: #301225; border: 0; padding: 1rem 1.25rem; background: linear-gradient(115deg, #ffe0ea, #f7a3cf 50%, #ffc77b); box-shadow: 0 .6rem 2.6rem rgba(237,92,171,.32); }
button.secondary { background: rgba(255,255,255,.07); }
button.text-button { padding-inline: .3rem; border: 0; background: transparent; color: rgba(255,238,245,.65); }
.consent { margin: 1.35rem 0 0; max-width: 31rem; color: rgba(255,240,246,.5); font-size: .65rem; line-height: 1.55; }
.consent strong { color: rgba(255,240,246,.76); }

.hud, .signal, .controls, .privacy { z-index: 3; opacity: 0; pointer-events: none; transition: opacity .8s ease; }
.instrument.is-running .hud, .instrument.is-running .signal, .instrument.is-running .privacy { opacity: 1; }
.instrument.is-running:hover .controls, .instrument.is-running .controls:focus-within { opacity: 1; pointer-events: auto; }
.hud { position: absolute; left: 1.5rem; top: 1.35rem; text-shadow: 0 2px 14px rgba(0,0,0,.8); }
.hud-label { margin: 0 0 .3rem; color: rgba(255,244,247,.5); font-size: .55rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.mode-line { display: flex; align-items: center; gap: .6rem; }
#mode-dot { width: .48rem; height: .48rem; border-radius: 50%; background: #ffd19b; box-shadow: 0 0 1.2rem #ff99c8; }
#mode { font-family: Iowan Old Style, Baskerville, Georgia, serif; font-size: clamp(1.25rem, 2vw, 1.8rem); }
#mode-detail { margin: .2rem 0 0 1.08rem; color: rgba(255,244,247,.55); font-size: .62rem; }
.signal { position: absolute; right: 1.5rem; top: 1.45rem; display: flex; gap: 1rem; color: rgba(255,247,243,.6); font-size: .62rem; letter-spacing: .12em; }
.controls { position: absolute; left: 1.25rem; bottom: 1.2rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.controls button { backdrop-filter: blur(10px); }
.privacy { position: absolute; right: 1.4rem; bottom: 1.4rem; max-width: 23rem; margin: 0; color: rgba(255,247,243,.43); font-size: .58rem; text-align: right; }

.guide { position: absolute; z-index: 6; right: 1.25rem; bottom: 1.25rem; width: min(30rem, calc(100vw - 2.5rem)); padding: 1.6rem; opacity: 0; visibility: hidden; transform: translateY(1rem); border: 1px solid rgba(255,229,240,.2); background: rgba(10,4,16,.9); backdrop-filter: blur(22px); transition: .4s ease; }
.guide.is-open { opacity: 1; visibility: visible; transform: none; }
.guide #guide-close { position: absolute; top: .7rem; right: .7rem; border: 0; padding: .35rem .55rem; background: transparent; font-size: 1.3rem; }
.guide h2 { margin: 0 0 1rem; font: 400 2rem/1 Iowan Old Style, Baskerville, Georgia, serif; }
.guide dl { display: grid; gap: .8rem; margin: 0; }
.guide dl div { display: grid; grid-template-columns: 6rem 1fr; gap: .75rem; padding-top: .75rem; border-top: 1px solid rgba(255,255,255,.09); }
.guide dt { color: #ffc5dd; font-size: .66rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.guide dd { margin: 0; color: rgba(255,244,247,.7); font-size: .72rem; line-height: 1.45; }
.fine { color: rgba(255,244,247,.45); font-size: .62rem; line-height: 1.5; }

body.projection .hud, body.projection .signal, body.projection .controls, body.projection .privacy, body.projection .grain { display: none !important; }
@media (max-width: 620px) { .welcome { left: 1rem; } .signal { display: none; } .privacy { display: none; } .controls { right: 1rem; } }
@media (prefers-reduced-motion: reduce) { .grain { animation: none; } * { transition-duration: .01ms !important; } }
