:root {
  --ink: #0a0c0c;
  --paper: #eee4d2;
  --red: #ee1c18;
  --ice: #b8d8d2;
  --line: rgba(238, 228, 210, .28);
  --signal: 0;
}

* { box-sizing: border-box; }

html { background: var(--ink); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--paper);
  background: #090b0b;
  font-family: "Share Tech Mono", monospace;
  overflow-x: hidden;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.lab-atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8, 10, 10, .28), rgba(8, 10, 10, .82)),
    url("/assets/sound-lab/frozen-studio-face-integrated-v1.webp") center / cover no-repeat;
  filter: saturate(.72) contrast(1.08);
}

.lab-atmosphere::before,
.lab-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
}

.lab-atmosphere::before {
  opacity: calc(.1 + var(--signal) * .25);
  background: radial-gradient(circle at 72% 42%, rgba(238, 28, 24, .55), transparent 32%);
  mix-blend-mode: screen;
}

.lab-atmosphere::after {
  opacity: .2;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,0,0,.25) 4px);
}

.lab-header,
.lab-shell,
.lab-footer { position: relative; z-index: 1; }

.lab-header {
  min-height: 104px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: stretch;
  border-top: 12px solid #292a28;
  border-bottom: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  padding: 12px clamp(20px, 4vw, 76px);
}

.brand img { width: 126px; height: auto; display: block; }

.header-id {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 34px;
  border-left: 1px solid var(--ink);
  border-right: 1px solid var(--ink);
}

.header-id span { font-size: 11px; letter-spacing: .12em; }
.header-id strong { font-family: Impact, "Arial Narrow", sans-serif; font-size: 25px; letter-spacing: .03em; }

.exit-link {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 190px;
  padding: 0 34px;
  color: var(--paper);
  background: var(--ink);
  text-decoration: none;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: 21px;
  letter-spacing: .04em;
}

.exit-arrow {
  position: relative;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  transition: transform .18s ease;
}
.exit-arrow::before {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}
.exit-arrow::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: 4px;
  width: 16px;
  height: 2px;
  background: currentColor;
  transform: rotate(-45deg);
  transform-origin: left center;
}
.exit-link:hover .exit-arrow { transform: translate(3px, -3px); }

.lab-shell { width: min(1500px, calc(100% - 48px)); margin: 0 auto; }

.lab-intro {
  min-height: 390px;
  display: grid;
  grid-template-columns: 1.45fr .55fr;
  align-items: end;
  gap: 70px;
  padding: 80px 0 56px;
}

.eyebrow,
.panel-label {
  margin: 0 0 16px;
  font-size: 12px;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.status-dot,
.signal-status span {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--red);
  box-shadow: 0 0 12px var(--red);
  animation: statusBlink 2.6s steps(1) infinite;
}

.lab-intro h1,
.lab-outro h2 {
  margin: 0;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: clamp(76px, 10vw, 170px);
  font-weight: 900;
  line-height: .78;
  letter-spacing: -.035em;
  text-transform: uppercase;
  text-shadow: 0 4px 22px rgba(0,0,0,.4);
}

em { color: var(--red); font-style: normal; }

.intro-copy { padding-bottom: 8px; font-size: 18px; line-height: 1.5; }
.intro-copy > p:first-child { max-width: 440px; }
.headphones { margin-top: 28px; font-size: 12px; letter-spacing: .1em; color: var(--ice); }
.headphones span { color: var(--red); }

.lab-console {
  display: grid;
  grid-template-columns: minmax(340px, .84fr) minmax(520px, 1.16fr);
  border: 1px solid rgba(238, 228, 210, .58);
  background: rgba(10, 12, 12, .89);
  box-shadow: 0 35px 100px rgba(0,0,0,.56), inset 0 0 60px rgba(184,216,210,.035);
  backdrop-filter: blur(18px);
}

.embedded-screen-flicker {
  position: absolute;
  z-index: 5;
  left: 51.6%;
  top: 47%;
  width: clamp(8px, .72vw, 11px);
  aspect-ratio: .68;
  transform: translate(-50%, -50%);
  border-radius: 1px;
  opacity: .06;
  background: rgba(238, 28, 24, .7);
  box-shadow: 0 0 5px rgba(238, 28, 24, .68), 0 0 14px rgba(238, 28, 24, .24);
  mix-blend-mode: screen;
  animation: embeddedWake 8.8s steps(1, end) infinite;
  pointer-events: none;
}

body.is-playing .embedded-screen-flicker {
  opacity: calc(.22 + var(--signal) * .5);
  animation-duration: 4.2s;
}

.specimen-bay,
.experiment-bay { padding: clamp(22px, 3vw, 48px); }
.specimen-bay { border-right: 1px solid var(--line); }

.instrument-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.instrument-card {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  color: var(--paper);
  border: 1px solid var(--line);
  background: #050707;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s ease, transform .2s ease, background .2s ease;
}

.instrument-card:hover { transform: translateY(-4px); border-color: rgba(184,216,210,.72); }
.instrument-card.is-active { border-color: var(--holo-accent, var(--red)); background: #070a0a; box-shadow: 0 0 0 1px var(--holo-accent, var(--red)) inset, 0 0 32px color-mix(in srgb, var(--holo-accent, var(--red)) 22%, transparent); }
.instrument-card.is-active::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid var(--holo-accent, var(--red));
  box-shadow: inset 0 0 32px color-mix(in srgb, var(--holo-accent, var(--red)) 18%, transparent);
}

.specimen-number {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 9px;
  padding: 4px 6px;
  color: var(--ink);
  background: var(--paper);
  font-size: 10px;
}

.selected-mark {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 9px;
  display: none;
  align-items: center;
  gap: 5px;
  color: var(--paper);
  font-size: 9px;
  letter-spacing: .08em;
}
.selected-mark span { color: var(--holo-accent, var(--red)); text-shadow: 0 0 8px var(--holo-accent, var(--red)); }
.instrument-card.is-active .selected-mark { display: flex; }

.instrument-photo {
  position: relative;
  display: block;
  height: 305px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 87%, color-mix(in srgb, var(--holo-accent, var(--ice)) 18%, transparent), transparent 39%),
    linear-gradient(180deg, #050808, #010202 82%);
}
.instrument-photo::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: .28;
  background:
    repeating-linear-gradient(0deg, transparent 0 4px, rgba(184,216,210,.09) 5px),
    linear-gradient(90deg, transparent 49.7%, color-mix(in srgb, var(--holo-accent, var(--ice)) 28%, transparent) 50%, transparent 50.3%);
  pointer-events: none;
}
.instrument-photo::after {
  content: "";
  position: absolute;
  z-index: 3;
  left: 5%;
  right: 5%;
  top: -18%;
  height: 18%;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--holo-accent, var(--ice)) 34%, transparent), transparent);
  filter: blur(2px);
  animation: hologramScan 5.2s linear infinite;
}
.instrument-photo img { --holo-scale: .92; position: relative; z-index: 1; width: 100%; height: 100%; padding: 11px 3px 2px; object-fit: contain; opacity: .82; filter: saturate(.9) contrast(1.08) brightness(.84); transition: filter .25s ease, opacity .25s ease, transform .35s ease; animation: hologramFloat 4.6s ease-in-out infinite; }
.instrument-card:hover img,
.instrument-card.is-active img { opacity: 1; filter: saturate(1.08) contrast(1.12) brightness(1.06); }
.instrument-card.is-active .instrument-photo { box-shadow: inset 0 -42px 72px color-mix(in srgb, var(--holo-accent, var(--red)) 22%, transparent); }
.instrument-card[data-scene="rhythm"] { --holo-accent: #9df8ff; }
.instrument-card[data-scene="lead"] { --holo-accent: #ff4b1f; }
.instrument-card[data-scene="bass"] { --holo-accent: #f5a9c7; }
.instrument-card[data-scene="bass"] .instrument-photo img { --holo-scale: 1.08; }
.instrument-card[data-scene="lead"] .instrument-photo img { animation-delay: -.9s; }
.instrument-card[data-scene="bass"] .instrument-photo img { animation-delay: -1.8s; }

.instrument-name,
.instrument-mode { display: block; padding: 0 10px; }
.instrument-name { margin-top: 12px; font-family: Impact, "Arial Narrow", sans-serif; font-size: 23px; letter-spacing: .03em; }
.instrument-mode { min-height: 34px; margin: 3px 0 10px; color: rgba(238,228,210,.58); font-size: 10px; letter-spacing: .07em; }

.bank-total { display: flex; align-items: baseline; gap: 10px; margin: 14px 0 0; color: rgba(238,228,210,.55); font-size: 11px; letter-spacing: .08em; }
.bank-total b { color: var(--red); font-family: Impact, "Arial Narrow", sans-serif; font-size: 27px; }

.cleanup-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 12px;
  padding: 16px 18px;
  color: var(--paper);
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(184,216,210,.06), transparent 64%);
  text-align: left;
  cursor: pointer;
}

.cleanup-card:hover,
.cleanup-card.is-active { color: var(--ink); border-color: var(--ice); background: var(--ice); }
.cleanup-card b,
.cleanup-card small { display: block; }
.cleanup-card b { margin-top: 5px; font-family: Impact, "Arial Narrow", sans-serif; font-size: 20px; letter-spacing: .04em; }
.cleanup-card small { margin-top: 4px; opacity: .68; }
.cleanup-signal { margin-left: auto; color: var(--ice); font-size: 9px; letter-spacing: .07em; }
.cleanup-card:hover .cleanup-signal,
.cleanup-card.is-active .cleanup-signal { color: var(--ink); }
.cleanup-card i { color: var(--red); font-size: 28px; font-style: normal; }

.experiment-bay { min-width: 0; }
.experiment-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.experiment-head h2 { margin: 0; font-family: Impact, "Arial Narrow", sans-serif; font-size: clamp(30px, 4vw, 55px); letter-spacing: .025em; }
.selection-confirmation { margin: 7px 0 0; color: var(--red); font-size: 11px; letter-spacing: .08em; }
.signal-status { display: flex; align-items: center; white-space: nowrap; color: var(--ice); font-size: 12px; letter-spacing: .08em; }
.signal-status span { margin: 0 8px 0 0; }

.oscilloscope {
  position: relative;
  height: 285px;
  margin: 26px 0 18px;
  overflow: hidden;
  border: 1px solid rgba(184,216,210,.6);
  background: #050707;
  box-shadow: inset 0 0 70px rgba(184,216,210,.07);
}

#scope { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; }
.scope-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(184,216,210,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(184,216,210,.08) 1px, transparent 1px); background-size: 8.33% 25%; }
.scope-id { position: absolute; z-index: 3; top: 12px; left: 14px; right: 14px; display: flex; justify-content: space-between; color: rgba(184,216,210,.7); font-size: 10px; letter-spacing: .08em; }
.scope-message { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 90%; text-align: center; color: rgba(238,228,210,.48); font-size: 12px; letter-spacing: .12em; transition: opacity .2s ease; }
.is-playing .scope-message { opacity: 0; }

.reaction-switches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.reaction {
  position: relative;
  min-height: 112px;
  padding: 18px 12px 13px;
  color: var(--paper);
  border: 1px solid var(--line);
  background: #101312;
  text-align: left;
  cursor: pointer;
}
.reaction:hover { border-color: rgba(238,228,210,.66); }
.reaction:disabled { cursor: not-allowed; opacity: .34; }
.reaction.is-active { color: var(--ink); border-color: var(--red); background: var(--red); }
.reaction small,
.reaction strong,
.reaction i { display: block; }
.reaction small { opacity: .55; font-size: 10px; }
.reaction strong { margin-top: 9px; font-family: Impact, "Arial Narrow", sans-serif; font-size: 27px; letter-spacing: .035em; }
.reaction i { margin-top: 3px; font-size: 9px; font-style: normal; letter-spacing: .08em; opacity: .66; }
.lamp { position: absolute; top: 15px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: #4c4f4d; }
.reaction.is-active .lamp { background: var(--paper); box-shadow: 0 0 14px var(--paper); }

.transport { display: grid; grid-template-columns: 1.35fr .65fr; gap: 8px; margin-top: 8px; }
.play-button {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 0;
  color: var(--paper);
  background: var(--red);
  cursor: pointer;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: 21px;
  letter-spacing: .035em;
}
.play-button:hover { filter: brightness(1.08); }
.play-button:disabled { cursor: wait; filter: grayscale(.5); }
.play-icon { width: 0; height: 0; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 13px solid currentColor; }
.is-playing .play-icon { width: 12px; height: 14px; border: 0; border-left: 4px solid currentColor; border-right: 4px solid currentColor; }

.volume-control { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 0 13px; border: 1px solid var(--line); font-size: 10px; }
.volume-control input { width: 100%; accent-color: var(--red); }
.volume-control b { color: var(--ice); }

.progress-track { height: 3px; margin-top: 13px; background: rgba(238,228,210,.12); overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--red); }
.system-note { min-height: 16px; margin: 11px 0 0; color: rgba(238,228,210,.5); font-size: 10px; letter-spacing: .05em; }

.lab-outro {
  min-height: 430px;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  align-items: center;
  gap: 70px;
  padding: 85px 0;
}
.lab-outro h2 { font-size: clamp(62px, 8vw, 126px); }
.outro-action { align-self: end; padding-bottom: 8px; }
.outro-action p { max-width: 460px; line-height: 1.55; }
.outro-action a { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 30px; padding: 25px 28px; color: var(--paper); background: var(--red); text-decoration: none; font-family: Impact, "Arial Narrow", sans-serif; font-size: 26px; letter-spacing: .03em; }
.outro-action a:hover span { transform: translateX(5px); }
.outro-action a span { transition: transform .18s ease; }

.lab-footer { min-height: 70px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: 18px clamp(20px,4vw,76px); color: var(--ink); background: var(--paper); font-size: 11px; letter-spacing: .07em; }
.lab-footer a { color: inherit; }
.lab-footer .footer-language { flex: 1 0 100%; width: 100%; border-top-color: rgba(11,13,13,.25); }

@keyframes statusBlink { 0%, 89%, 100% { opacity: 1; } 90%, 94% { opacity: .2; } }
@keyframes embeddedWake {
  0%, 62%, 68%, 81%, 86%, 100% { opacity: .06; }
  63% { opacity: .58; }
  64% { opacity: .14; }
  65% { opacity: .42; }
  82% { opacity: .3; }
  83% { opacity: .08; }
  84% { opacity: .48; }
}
@keyframes hologramFloat {
  0%, 100% { transform: translateY(2px) scale(var(--holo-scale)); }
  50% { transform: translateY(-5px) scale(calc(var(--holo-scale) + .015)); }
}
@keyframes hologramScan {
  0% { transform: translateY(0); opacity: 0; }
  8%, 86% { opacity: .8; }
  100% { transform: translateY(700%); opacity: 0; }
}
@media (max-width: 1050px) {
  .lab-header { grid-template-columns: 1fr auto; }
  .header-id { display: none; }
  .lab-intro { grid-template-columns: 1fr; gap: 30px; }
  .intro-copy { max-width: 600px; }
  .lab-console { grid-template-columns: minmax(0, 1fr); }
  .specimen-bay { border-right: 0; border-bottom: 1px solid var(--line); }
  .specimen-bay { min-width: 0; }
  .instrument-photo { height: 330px; }
  .lab-outro { grid-template-columns: 1fr; gap: 50px; }
  .outro-action { max-width: 650px; }
}

@media (max-width: 650px) {
  .lab-header { min-height: 84px; border-top-width: 8px; }
  .brand { padding: 9px 17px; }
  .brand img { width: 108px; }
  .exit-link { min-width: 0; gap: 11px; padding: 0 17px; font-size: 18px; }
  .exit-arrow { width: 17px; height: 17px; flex-basis: 17px; }
  .exit-arrow::before { width: 9px; height: 9px; }
  .exit-arrow::after { width: 14px; bottom: 3px; }
  .lab-shell { width: min(100% - 24px, 1500px); }
  .lab-intro { min-height: 285px; gap: 18px; padding: 42px 0 28px; }
  .lab-intro h1 { font-size: clamp(62px, 20vw, 82px); }
  .intro-copy { padding: 0; font-size: 15px; }
  .intro-copy > p:first-child { margin: 0; }
  .headphones { margin-top: 14px; }
  .specimen-bay, .experiment-bay { padding: 15px 12px; }
  .embedded-screen-flicker { left: 56%; top: 47.5%; width: 10px; }
  .instrument-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .instrument-card { min-height: 214px; }
  .instrument-card:hover { transform: none; }
  .instrument-photo { height: 172px; }
  .instrument-photo img { padding: 10px 0 3px; }
  .specimen-number { top: 5px; left: 5px; padding: 3px 4px; font-size: 8px; }
  .selected-mark { top: 7px; right: 6px; font-size: 0; }
  .selected-mark span { font-size: 10px; }
  .instrument-name { margin-top: 8px; padding: 0 5px; font-size: 15px; text-align: center; }
  .instrument-mode { display: none; }
  .bank-total { margin-top: 10px; }
  .cleanup-card { align-items: flex-start; }
  .cleanup-signal { max-width: 92px; text-align: right; }
  .experiment-head { align-items: flex-end; }
  .experiment-head h2 { font-size: 31px; }
  .signal-status b { display: none; }
  .oscilloscope { height: 220px; margin-top: 18px; }
  .reaction { min-height: 96px; padding: 13px 8px; }
  .reaction strong { font-size: clamp(18px, 6vw, 25px); }
  .reaction i { font-size: 7px; }
  .lamp { top: 11px; right: 9px; }
  .transport { grid-template-columns: 1fr; }
  .play-button { min-height: 68px; }
  .volume-control { min-height: 56px; }
  .lab-outro { min-height: 390px; padding: 70px 0; }
  .lab-outro h2 { font-size: clamp(55px, 18vw, 84px); }
  .outro-action a { padding: 20px; font-size: 22px; }
  .lab-footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
