/* Masker page: the device */

.masker-page {
  background:
    radial-gradient(ellipse 70% 50% at 50% 28%, #24395f 0%, rgba(36, 57, 95, 0) 70%),
    var(--night);
}

.intro {
  display: grid;
  grid-template-columns: 6fr 6fr;
  gap: 1.5rem 4rem;
  align-items: end;
  padding-top: clamp(7rem, 12vw, 10rem);
  padding-bottom: clamp(2rem, 4vw, 3.5rem);
}
.intro h1 { font-size: clamp(2.6rem, 1rem + 6vw, 5.75rem); }
.intro-copy p { color: #d5deea; }
.intro-safety { color: var(--mist) !important; font-size: var(--step--1); margin: 0; }

@media (max-width: 860px) {
  .intro { grid-template-columns: 1fr; }
}

/* Faceplate */

.device {
  --plate: #e7edf4;
  --plate-ink: #1a2b47;
  --plate-print: #566a8a;
  --groove: rgba(26, 43, 71, 0.16);
  --key: #f5f8fb;
  --key-edge: #b7c4d5;

  position: relative;
  color: var(--plate-ink);
  background: linear-gradient(180deg, #f0f4f8 0%, #dfe6ee 100%);
  border-radius: 28px;
  padding: clamp(12px, 2.4vw, 28px);
  box-shadow:
    inset 0 1px 0 #fff,
    inset 0 -3px 0 #c2cddb,
    0 60px 100px -50px rgba(4, 10, 24, 0.9),
    0 24px 40px -24px rgba(4, 10, 24, 0.7);
}

.panel-print {
  display: block;
  margin: 0 0 1rem;
  padding: 0;
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--plate-print);
}

/* Screen */

.screen {
  position: relative;
  background: #0f1c33;
  border-radius: 18px;
  padding: 14px 18px 10px;
  box-shadow:
    inset 0 2px 14px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 1px 0 #fff;
  color: var(--mist);
}

.screen-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  min-height: 1.4rem;
}
.screen-status,
.screen-timer {
  margin: 0;
  font-family: var(--display);
  font-size: 0.78rem;
  line-height: 1.5;
  max-width: none;
}
.screen-timer { color: var(--signal-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }

#spectrum {
  display: block;
  width: 100%;
  height: clamp(150px, 22vw, 250px);
  margin-top: 6px;
}

.screen-axis {
  position: relative;
  height: 18px;
  font-family: var(--display);
  font-size: 0.66rem;
  color: rgba(157, 178, 207, 0.7);
}
.screen-axis span { position: absolute; top: 2px; transform: translateX(-50%); white-space: nowrap; }
.screen-axis span:first-child { transform: none; }
.screen-axis span:last-child { transform: translateX(-100%); }

/* Presets */

.presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 1.4rem 4px 1.2rem;
}
.presets .panel-print { margin: 0 0.6rem 0 0; }

.key,
.presets button {
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--plate-ink);
  background: var(--key);
  border: 1px solid var(--key-edge);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 var(--key-edge);
  transition: transform 0.08s, box-shadow 0.08s, background-color 0.2s;
}
.presets button:hover { background: #fff; }
.presets button:active { transform: translateY(2px); box-shadow: inset 0 1px 0 #fff, 0 0 0 var(--key-edge); }

/* Deck: four modules separated by engraved grooves */

.deck {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  border-top: 1px solid var(--groove);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.module {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 1.5rem clamp(0.5rem, 2vw, 1.6rem) 1.6rem;
}
.mixer,
.timer { border-right: 1px solid var(--groove); box-shadow: 1px 0 0 rgba(255, 255, 255, 0.85); }
.timer,
.experiment { border-top: 1px solid var(--groove); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85); }
.timer { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 1px 0 0 rgba(255, 255, 255, 0.85); }

fieldset.module legend { float: left; width: 100%; }
fieldset.module legend + * { clear: both; }

/* Mixer strips */

.strips {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.25rem;
}

.strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.55rem;
}
.strip-name {
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
}
.strip-hint {
  font-size: 0.78rem;
  font-style: italic;
  line-height: 1.3;
  color: var(--plate-print);
  min-height: 2.6em;
  margin: -0.3rem 0 0;
}
.strip-value {
  font-family: var(--display);
  font-size: 0.72rem;
  color: var(--plate-print);
  font-variant-numeric: tabular-nums;
}

.led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b4c0d0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: background-color 0.3s, box-shadow 0.3s;
}
.led.on {
  background: var(--signal);
  box-shadow: 0 0 0 2px rgba(239, 75, 63, 0.18), 0 0 12px 1px rgba(239, 75, 63, 0.75);
}

/* Fader */

.fader {
  position: relative;
  width: 48px;
  height: clamp(150px, 20vw, 200px);
  cursor: pointer;
  touch-action: none;
  border-radius: 8px;
}
.fader::before {
  content: "";
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: calc(50% + 11px);
  width: 6px;
  background: repeating-linear-gradient(to top, #9fb0c7 0 1px, transparent 1px 10%);
}
.fader-slot {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: 50%;
  width: 6px;
  transform: translateX(-50%);
  background: #182742;
  border-radius: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6), 0 1px 0 #fff;
  overflow: hidden;
}
.fader-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #7f9bc2;
}
.fader-cap {
  position: absolute;
  left: 50%;
  width: 42px;
  height: 22px;
  border-radius: 6px;
  transform: translate(-50%, 50%);
  background: linear-gradient(180deg, #ffffff 0%, #e3e9f1 45%, #cdd7e4 100%);
  box-shadow:
    inset 0 1px 0 #fff,
    0 2px 0 #a3b2c7,
    0 8px 12px -5px rgba(10, 20, 40, 0.55);
  pointer-events: none;
}
.fader-cap::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: var(--plate-ink);
  border-radius: 1px;
}
.fader:focus-visible { outline-offset: 2px; }
.fader.dragging .fader-cap { box-shadow: inset 0 1px 0 #fff, 0 1px 0 #a3b2c7, 0 4px 8px -4px rgba(10, 20, 40, 0.5); }

/* Master */

.master {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.master .panel-print { align-self: flex-start; }

.play {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  background: none;
  border: 0;
  padding: 0;
  color: var(--plate-ink);
  cursor: pointer;
  border-radius: 999px;
}
.play-ring {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  color: var(--white);
  background: radial-gradient(circle at 40% 30%, #2d4572 0%, #172846 60%, #0f1c33 100%);
  box-shadow:
    0 0 0 6px #d3dce7,
    0 0 0 7px #b7c4d5,
    0 14px 24px -10px rgba(10, 20, 40, 0.7);
  transition: box-shadow 0.35s;
}
.play-ring svg { width: 34px; height: 34px; }
.play .icon-pause { display: none; }
.play[aria-pressed="true"] .icon-play { display: none; }
.play[aria-pressed="true"] .icon-pause { display: block; }
.play[aria-pressed="true"] .play-ring {
  box-shadow:
    0 0 0 6px #d3dce7,
    0 0 0 8px var(--signal),
    0 0 28px 6px rgba(239, 75, 63, 0.45),
    0 14px 24px -10px rgba(10, 20, 40, 0.7);
}
.play:active .play-ring { transform: scale(0.98); }
.play-label { font-family: var(--display); font-size: 0.8rem; font-weight: 500; }
.play:focus-visible { outline-offset: 6px; }

.knobs {
  display: flex;
  justify-content: center;
  gap: clamp(1rem, 3vw, 2rem);
  margin-top: 1.8rem;
}
.knob-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.knob-name { font-family: var(--display); font-size: 0.75rem; font-weight: 500; }
.knob-value { font-family: var(--display); font-size: 0.7rem; color: var(--plate-print); font-variant-numeric: tabular-nums; min-height: 1.2em; }

.knob {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
}
.knob:active { cursor: grabbing; }
.knob svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.knob .arc-track { stroke: #c2cddb; }
.knob .arc-value { stroke: var(--plate-ink); }
.knob-body {
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 28%, #ffffff 0%, #e2e8f0 50%, #bfcbda 100%);
  box-shadow: 0 2px 0 #a3b2c7, 0 10px 14px -6px rgba(10, 20, 40, 0.55), inset 0 -2px 3px rgba(26, 43, 71, 0.12);
}
.knob-body::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 6px;
  width: 3px;
  height: 30%;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--plate-ink);
}

/* Segmented radio groups */

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  border-radius: 999px;
  border: 1px solid var(--key-edge);
  background: var(--key);
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 var(--key-edge);
  padding: 3px;
  gap: 2px;
}
.segmented label { position: relative; cursor: pointer; }
.segmented input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.segmented span {
  display: block;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.2s, color 0.2s;
}
.segmented label:hover span { background: rgba(26, 43, 71, 0.07); }
.segmented input:checked + span { background: var(--plate-ink); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--signal); outline-offset: 2px; }
.segmented.small span { padding: 0.4rem 0.75rem; font-size: 0.74rem; }

.field-label {
  font-family: var(--display);
  font-size: 0.74rem;
  color: var(--plate-print);
  margin: 1.2rem 0 0.5rem;
}

.timer-bar {
  height: 4px;
  margin-top: 1.4rem;
  border-radius: 2px;
  background: #cad5e2;
  overflow: hidden;
}
.timer-bar span { display: block; height: 100%; width: 0; background: var(--signal); transition: width 1s linear; }

/* Experiment */

.exp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; }
.exp-head .panel-print { margin-bottom: 0.8rem; }
.badge {
  font-family: var(--display);
  font-size: 0.68rem;
  font-weight: 500;
  color: #c4372c;
  border: 1px solid var(--signal);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

.exp-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.exp-tone { margin: 0; font-size: 0.92rem; line-height: 1.45; }
.exp-tone strong { font-family: var(--display); font-weight: 500; font-variant-numeric: tabular-nums; }
.exp-note { font-size: 0.86rem; line-height: 1.55; color: #45597a; margin: 1rem 0 0; }

.switch {
  flex: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 999px;
}
.switch-track {
  display: block;
  position: relative;
  width: 58px;
  height: 32px;
  border-radius: 999px;
  background: #b4c1d2;
  box-shadow: inset 0 2px 4px rgba(10, 20, 40, 0.3);
  transition: background-color 0.25s;
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #dfe6ef);
  box-shadow: 0 2px 4px rgba(10, 20, 40, 0.35);
  transition: transform 0.25s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.switch[aria-checked="true"] .switch-track { background: var(--signal); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(26px); }
.switch:disabled { cursor: not-allowed; opacity: 0.45; }

@media (max-width: 900px) {
  .deck { grid-template-columns: 1fr; }
  .mixer,
  .timer { border-right: 0; box-shadow: none; }
  .master,
  .timer,
  .experiment { border-top: 1px solid var(--groove); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85); }
  .master { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 1rem 2.5rem; }
  .master .panel-print { width: 100%; }
  .knobs { margin-top: 0; }
}

@media (max-width: 520px) {
  .device { border-radius: 20px; }
  .strip-hint { display: none; }
  .strip-name { font-size: 0.66rem; min-height: 2.4em; }
  .screen-axis span:nth-child(2),
  .screen-axis span:nth-child(5) { display: none; }
  .fader { width: 40px; }
  .fader-cap { width: 36px; }
  .fader::before { left: calc(50% + 9px); }
  .knob { width: 72px; height: 72px; }
  .knob-body { inset: 11px; }
  .play-ring { width: 88px; height: 88px; }
}

/* Tone finder */

.finder {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 2.5rem 4rem;
  align-items: start;
  padding-block: clamp(5rem, 10vw, 8rem) clamp(3rem, 6vw, 5rem);
}
.finder-copy h2 { margin-bottom: 1.4rem; }
.finder-copy > p { color: #d5deea; }

.finder-steps {
  margin: 1.6rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  color: #d5deea;
}
.finder-steps li {
  counter-increment: step;
  position: relative;
  padding: 0.85rem 0 0.85rem 2.6rem;
  border-top: 1px solid var(--line);
}
.finder-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.95rem;
  font-family: var(--display);
  font-size: 0.85rem;
  color: var(--signal-soft);
}

.finder-panel {
  background: var(--panel);
  border-radius: 22px;
  padding: clamp(1.4rem, 3.5vw, 2.6rem);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.finder-readout {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(3.4rem, 2rem + 6vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.finder-readout .unit { font-size: 0.24em; letter-spacing: 0; margin-left: 0.4em; color: var(--mist); }

.finder-slider { margin-top: 1.8rem; }

input[type="range"].styled,
.finder-slider input,
.finder-volume input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
  margin: 0;
  height: 32px;
  cursor: pointer;
}
.finder-slider input::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #3a5788, #9db2cf 60%, #f5f8fc);
}
.finder-slider input::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #3a5788, #9db2cf 60%, #f5f8fc);
}
.finder-slider input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -11px;
  border-radius: 50%;
  background: var(--white);
  border: 7px solid var(--signal);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}
.finder-slider input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--white);
  border: 7px solid var(--signal);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}

.finder-volume input::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line); }
.finder-volume input::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
.finder-volume input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--white);
}
.finder-volume input::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--white); }

.finder-scale {
  position: relative;
  height: 1.2rem;
  margin-inline: 14px;
  font-family: var(--display);
  font-size: 0.68rem;
  color: var(--mist);
  margin-top: 0.2rem;
}
.finder-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.finder-scale span:first-child { transform: translateX(-14px); }
.finder-scale span:last-child { transform: translateX(calc(-100% + 14px)); }
@media (max-width: 520px) {
  .finder-scale span:nth-child(2),
  .finder-scale span:nth-child(4),
  .finder-scale span:nth-child(6) { display: none; }
}

.finder-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 1.8rem;
}
.finder-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.chip {
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--white);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.chip:hover { border-color: var(--mist); background: rgba(245, 248, 252, 0.06); }

.segmented.dark { background: transparent; border-color: var(--line); box-shadow: none; }
.segmented.dark label:hover span { background: rgba(245, 248, 252, 0.08); }
.segmented.dark input:checked + span { background: var(--white); color: var(--night); }

.finder-volume {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 1 1 220px;
  font-family: var(--display);
  font-size: 0.74rem;
  color: var(--mist);
}
.finder-volume span { white-space: nowrap; }

.finder-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }
#tone-play[aria-pressed="true"] { background: var(--white); color: var(--night); border-color: var(--white); }

.finder-saved { margin: 1rem 0 0; color: var(--mist); font-size: var(--step--1); min-height: 1.5em; }

@media (max-width: 900px) {
  .finder { grid-template-columns: 1fr; }
}

/* Tips */

.tips { padding-block: clamp(3rem, 6vw, 5rem) clamp(5rem, 9vw, 7rem); }
.tips h2 { margin-bottom: 2.5rem; }
.tips-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.5rem 2.5rem;
}
.tips-list li { border-top: 1px solid var(--mist); padding-top: 1.2rem; }
.tips-list h3 { margin-bottom: 0.7rem; }
.tips-list p { color: #d5deea; font-size: 1rem; margin: 0; }

@media (max-width: 1000px) {
  .tips-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .tips-list { grid-template-columns: 1fr; }
}
