:root {
  --magenta: #ff2bd6;
  --magenta-hot: #ff6be6;
  --magenta-deep: #8a0f73;
  --ink: #12030f;
  --panel: #1d0a1a;
  --panel-2: #2a1026;
  --lcd-bg: #1a0016;
  --lcd-fg: #ff7cf0;
  --text: #ffe6fb;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--ink);
}

/* ---------- Splash ---------- */

body.splash {
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 43, 214, 0.45), transparent 60%),
    radial-gradient(circle at 50% 120%, var(--magenta-deep), var(--ink) 70%);
}

.splash-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
  animation: fade-in 1.2s ease-out both;
}

.splash-image {
  width: min(70vw, 420px);
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(255, 43, 214, 0.7), 0 0 0 2px rgba(255, 255, 255, 0.15);
  animation: pulse 4s ease-in-out infinite;
}

.splash-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.band-name {
  margin: 0.5rem 0 0;
  font-size: clamp(2.5rem, 9vw, 5.5rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  line-height: 1;
  text-shadow: 0 0 18px var(--magenta), 0 0 2px #fff;
}

.band-name span,
.brand span {
  color: var(--magenta);
  text-shadow: 0 0 18px var(--magenta);
}

.tagline {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.4em;
  font-size: 0.85rem;
  opacity: 0.85;
}

/* Styled like a chunky keyboard key */
.take-ctrl {
  margin-top: 1rem;
  display: inline-block;
  padding: 1rem 2.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(#3a1435, #200a1d);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow:
    0 6px 0 #0a0209,
    0 0 25px rgba(255, 43, 214, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.08s, box-shadow 0.08s, color 0.2s;
}

.take-ctrl:hover,
.take-ctrl:focus-visible {
  color: var(--magenta-hot);
  outline: none;
  box-shadow:
    0 6px 0 #0a0209,
    0 0 45px rgba(255, 43, 214, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.take-ctrl:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 #0a0209, 0 0 30px rgba(255, 43, 214, 0.8);
}

.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.18) 0,
    rgba(0, 0, 0, 0.18) 1px,
    transparent 2px,
    transparent 4px
  );
  mix-blend-mode: multiply;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 50px rgba(255, 43, 214, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.15); }
  50% { box-shadow: 0 0 90px rgba(255, 43, 214, 0.95), 0 0 0 2px rgba(255, 255, 255, 0.25); }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Synth page ---------- */

body.synth-page {
  position: relative;
  min-height: 100vh;
  background: transparent;
}

/* Splash image, zoomed out and blurred to hide upscaling artifacts, with edges faded into the page */
body.synth-page::before,
body.synth-page::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
}

body.synth-page::before {
  inset: 0;
  /* splash.png is 257x242, so 79.6vh x 75vh keeps its proportions */
  background: url("../assets/splash.png") center bottom / 79.6vh 75vh no-repeat;
  filter: blur(14px) saturate(1.3);
  -webkit-mask:
    linear-gradient(to right, transparent, #000 8%, #000 92%, transparent) center bottom / 79.6vh 75vh no-repeat,
    linear-gradient(to bottom, transparent, #000 8%, #000 92%, transparent) center bottom / 79.6vh 75vh no-repeat;
  -webkit-mask-composite: source-in;
  mask:
    linear-gradient(to right, transparent, #000 8%, #000 92%, transparent) center bottom / 79.6vh 75vh no-repeat,
    linear-gradient(to bottom, transparent, #000 8%, #000 92%, transparent) center bottom / 79.6vh 75vh no-repeat;
  mask-composite: intersect;
}

/* Darken so the synth stays readable */
body.synth-page::after {
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 43, 214, 0.2), transparent 55%),
    linear-gradient(rgba(18, 3, 15, 0.45), rgba(18, 3, 15, 0.7));
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
}

.back {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  background: var(--panel-2);
  box-shadow: 0 3px 0 #0a0209;
}

.back:hover { color: var(--magenta-hot); }

.brand {
  font-weight: 900;
  letter-spacing: 0.15em;
  font-size: 1.3rem;
}

.synth {
  max-width: 1000px;
  margin: 0 auto 3rem;
  padding: 0 1rem;
}

.panel {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(160deg, #3b1636, var(--panel) 60%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.badge {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-right: 1rem;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.badge .model {
  font-size: 2rem;
  font-weight: 900;
  color: var(--magenta);
  text-shadow: 0 0 12px rgba(255, 43, 214, 0.7);
}

.badge .sub {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  opacity: 0.7;
}

.section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  opacity: 0.7;
  margin-bottom: 0.5rem;
}

.module-selector {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.module-selector .section-label { margin: 0; }

/* ---------- Green dot-matrix LCD ---------- */
.lcd.matrix {
  --mx-fg: #3dff6e;
  --mx-dim: rgba(61, 255, 110, 0.55);
  --mx-bg: #010a03;
  position: relative;
  min-width: 0;
  padding: 0.5rem 0.7rem 0.4rem;
  background:
    radial-gradient(ellipse at center, rgba(30, 120, 50, 0.18), transparent 75%),
    var(--mx-bg);
  border-radius: 8px;
  border: 3px solid #050505;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 0 22px rgba(0, 0, 0, 0.9),
    inset 0 0 40px rgba(61, 255, 110, 0.08);
  font-family: "VT323", "Consolas", "Courier New", monospace;
  color: var(--mx-fg);
  text-shadow: 0 0 4px rgba(61, 255, 110, 0.8), 0 0 10px rgba(61, 255, 110, 0.35);
  overflow: hidden;
}

/* Pixel grid: dark gaps between "dots", plus faint unlit pixels behind the text */
.lcd.matrix::before,
.lcd.matrix::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.lcd.matrix::before {
  background: radial-gradient(circle, rgba(61, 255, 110, 0.07) 0.7px, transparent 1.1px) 0 0 / 3px 3px;
}

.lcd.matrix::after {
  z-index: 2;
  background:
    linear-gradient(rgba(0, 0, 0, 0.55) 1px, transparent 1px) 0 0 / 3px 3px,
    linear-gradient(90deg, rgba(0, 0, 0, 0.55) 1px, transparent 1px) 0 0 / 3px 3px,
    linear-gradient(rgba(255, 255, 255, 0.05), transparent 40%);
}

/* Higher-res matrix: finer, lighter pixel grid and less glow.
   Remove the "hires" class from .lcd.matrix in synth.html to revert to the chunkier look. */
.lcd.matrix.hires {
  text-shadow:
    0 0 1px rgba(160, 255, 180, 0.9),
    0 0 5px rgba(61, 255, 110, 0.75),
    0 0 12px rgba(61, 255, 110, 0.35);
}

/* Slight bleed so the pixels soften into each other like an old screen */
.lcd.matrix.hires .lcd-row,
.lcd.matrix.hires .module-list {
  filter: blur(0.35px) contrast(1.15);
}

.lcd.matrix.hires::before {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.24 0 0 0 0 1 0 0 0 0 0.43 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 160px 160px,
    radial-gradient(circle, rgba(61, 255, 110, 0.06) 0.5px, transparent 0.8px) 0 0 / 2px 2px;
  opacity: 0.55;
  mix-blend-mode: screen;
}

.lcd.matrix.hires::after {
  background:
    linear-gradient(rgba(0, 0, 0, 0.32) 1px, transparent 1px) 0 0 / 2px 2px,
    linear-gradient(90deg, rgba(0, 0, 0, 0.32) 1px, transparent 1px) 0 0 / 2px 2px,
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(rgba(255, 255, 255, 0.05), transparent 40%);
  animation: mx-flicker 4s steps(1) infinite;
}

@keyframes mx-flicker {
  0%, 100% { opacity: 1; }
  41% { opacity: 0.9; }
  42% { opacity: 1; }
  77% { opacity: 0.94; }
  78% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .lcd.matrix.hires::after { animation: none; }
}

.lcd.matrix.hires .lcd-row { color: rgba(61, 255, 110, 0.7); }

.lcd-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  font-size: 1.15rem;
  line-height: 1.1;
  letter-spacing: 0.08em;
  color: var(--mx-dim);
  border-bottom: 1px dashed rgba(61, 255, 110, 0.3);
  padding-bottom: 0.2rem;
}

.lcd-menu {
  --row: 1.7rem;
  --pos: 0;
  position: relative;
  display: flex;
  gap: 0.5rem;
  margin: 0.35rem 0;
}

#scope {
  position: relative;
  display: block;
  width: 100%;
  height: 40px;
  border-top: 1px dashed rgba(61, 255, 110, 0.3);
}

.btn {
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: linear-gradient(#4a1c44, #2a0f26);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  box-shadow: 0 3px 0 #0a0209;
  transition: transform 0.06s, box-shadow 0.06s, color 0.15s;
}

.btn:hover { color: var(--magenta-hot); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0a0209; }

.module-list {
  position: relative;
  flex: 1;
  min-width: 0;
  height: calc(var(--row) * 3);
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  scrollbar-width: none;
  outline: none;
}

.module-list::-webkit-scrollbar { display: none; }

.module-list li {
  cursor: pointer;
  display: flex;
  gap: 0.6em;
  height: var(--row);
  line-height: var(--row);
  padding: 0 0.4rem;
  font-size: 1.45rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  user-select: none;
}

.module-list li .name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.module-list li::before {
  content: " ";
  white-space: pre;
  width: 0.6em;
  flex: none;
}

.module-list li:hover { background: rgba(61, 255, 110, 0.1); }

.module-list li[aria-selected="true"] {
  color: var(--mx-bg);
  background: var(--mx-fg);
  text-shadow: none;
  box-shadow: 0 0 10px rgba(61, 255, 110, 0.6);
}

.module-list li[aria-selected="true"]::before { content: ">"; content: ">" / ""; }

.module-list li[aria-selected="true"].playing::before {
  content: "\25B6";
  content: "\25B6" / "";
  font-size: 0.7em;
  animation: mx-blink 1s steps(2) infinite;
}

.module-list:focus-visible li[aria-selected="true"] { outline: 2px dashed var(--mx-bg); outline-offset: -4px; }

@keyframes mx-blink { 50% { opacity: 0.2; } }

.lcd-arrows {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  width: 1.7rem;
}

.lcd-arrow {
  cursor: pointer;
  width: 100%;
  height: 1.5rem;
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--mx-fg);
  text-shadow: inherit;
  background: transparent;
  border: 1px solid rgba(61, 255, 110, 0.55);
  border-radius: 2px;
  transition: background 0.1s, color 0.1s;
}

.lcd-arrow:hover,
.lcd-arrow:focus-visible {
  outline: none;
  background: rgba(61, 255, 110, 0.18);
}

.lcd-arrow:active {
  color: var(--mx-bg);
  background: var(--mx-fg);
  text-shadow: none;
}

.lcd-scrollbar {
  position: relative;
  flex: 1;
  width: 4px;
  background: rgba(61, 255, 110, 0.15);
}

.lcd-scrollbar span {
  position: absolute;
  left: -1px;
  right: -1px;
  height: 10px;
  top: calc(var(--pos) * (100% - 10px));
  background: var(--mx-fg);
  box-shadow: 0 0 6px var(--mx-fg);
  transition: top 0.15s;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding-left: 1rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.knobs { display: flex; gap: 0.7rem; }

.knob-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.knob {
  --angle: 0deg;
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5a2553, #1a0718 70%);
  border: 2px solid #0a0209;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6), 0 0 0 4px rgba(255, 43, 214, 0.15);
  transform: rotate(var(--angle));
}

.knob .pointer {
  position: absolute;
  left: 50%;
  top: 5px;
  width: 3px;
  height: 14px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--magenta);
  box-shadow: 0 0 6px var(--magenta);
}

/* Invisible range input over the knob for keyboard/screen-reader access */
.knob-wrap input[type="range"] {
  position: absolute;
  top: 0;
  left: 50%;
  width: 54px;
  height: 54px;
  margin: 0 0 0 -27px;
  opacity: 0;
  pointer-events: none;
}

.knob { cursor: ns-resize; touch-action: none; }

.knob-wrap:focus-within .knob { box-shadow: 0 0 0 3px var(--magenta-hot); }

.switches {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.btn.stop { padding: 0.35rem 0.8rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.15em; }

.knob-wrap output {
  color: var(--magenta-hot);
  font-family: "Consolas", "Courier New", monospace;
  letter-spacing: 0;
}

#filter-value {
  display: inline-block;
  width: 7ch;
  text-align: left;
  white-space: nowrap;
}

.btn.knob-reset {
  padding: 0.15rem 0.5rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  touch-action: manipulation;
}

.btn.knob-reset.flash {
  color: #fff;
  box-shadow: 0 1px 0 #0a0209, 0 0 14px rgba(255, 43, 214, 0.9);
}

.btn.roll-pad {
  flex: 1;
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  touch-action: none;
  user-select: none;
  border-color: rgba(255, 43, 214, 0.45);
}

.btn.roll-pad.active {
  color: #fff;
  background: linear-gradient(var(--magenta), var(--magenta-deep));
  box-shadow: 0 1px 0 #0a0209, 0 0 18px rgba(255, 43, 214, 0.9);
  transform: translateY(2px);
  animation: roll-flash 0.12s steps(2) infinite;
}

@keyframes roll-flash {
  50% { filter: brightness(1.35); }
}

.leds {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3d1238;
}

.led.on {
  background: var(--magenta);
  box-shadow: 0 0 10px var(--magenta);
}

/* ---------- Keyboard ---------- */

.keyboard-wrap {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem 1.5rem;
  background: linear-gradient(#1a0717, #0d030b);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 3px solid var(--magenta-deep);
  border-radius: 0 0 18px 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 60px rgba(255, 43, 214, 0.15);
}

.wheels {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.wheel {
  width: 18px;
  border-radius: 6px;
  background: repeating-linear-gradient(#2a0f26 0 4px, #140511 4px 8px);
  border: 1px solid #000;
  box-shadow: inset 0 0 6px rgba(255, 43, 214, 0.3);
}

.keyboard {
  position: relative;
  flex: 1;
  height: 190px;
  display: flex;
  user-select: none;
  touch-action: none;
}

.key {
  position: relative;
  cursor: pointer;
}

.key.white {
  flex: 1;
  margin: 0 1px;
  background: linear-gradient(#fff 0%, #f1e6ef 85%, #d9c6d5 100%);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 0 #b9a1b4, inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.key.black {
  position: absolute;
  top: 0;
  z-index: 2;
  height: 62%;
  background: linear-gradient(#3b1636, #0d030b);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 3px 0 #000, inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.key.white.active {
  background: linear-gradient(#ffd1f6, var(--magenta-hot));
  box-shadow: 0 1px 0 #b9a1b4, 0 0 20px rgba(255, 43, 214, 0.8);
  transform: translateY(3px);
}

.key.black.active {
  background: linear-gradient(var(--magenta), var(--magenta-deep));
  box-shadow: 0 1px 0 #000, 0 0 16px rgba(255, 43, 214, 0.9);
}

.hint {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.75;
  line-height: 1.6;
}

.file-note {
  margin-top: 0.5rem;
  color: #ffb347;
  opacity: 0.9;
}

.info-area {
  margin-top: 1.25rem;
}

.info-box {
  position: relative;
  padding: 1.25rem 1.5rem;
  background: rgba(29, 10, 26, 0.85);
  border: 1px solid rgba(255, 43, 214, 0.4);
  border-left: 4px solid var(--magenta);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 43, 214, 0.2);
  line-height: 1.6;
}

.info-box[hidden] { display: none; }

.info-box.reveal { animation: info-reveal 0.35s ease-out; }

.info-box h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--magenta);
  text-shadow: 0 0 10px rgba(255, 43, 214, 0.6);
}

.info-box p { margin: 0; }

.splash-social,
.info-box a {
  color: var(--magenta-hot);
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-all;
}

.splash-social:hover,
.splash-social:focus-visible,
.info-box a:hover,
.info-box a:focus-visible {
  color: #fff;
  text-shadow: 0 0 8px var(--magenta);
}

.info-box ul {
  margin: 0;
  padding-left: 1.2rem;
}

.info-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}

.info-close:hover { opacity: 1; color: var(--magenta-hot); }

@keyframes info-reveal {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}

kbd {
  font-family: inherit;
  font-size: 0.75rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--panel-2);
  box-shadow: 0 2px 0 #0a0209;
}

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
  .panel {
    grid-template-columns: 1fr;
  }
  .badge, .controls {
    border: none;
    padding: 0;
  }
  .controls {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  .wheels { display: none; }
  .keyboard { height: 150px; }
}

@media (max-width: 480px) {
  .module-list li { font-size: 1.25rem; }
}
