:root {
  --cyan: #00e5ff;
  --cyan-dim: #0a8ea3;
  --ink: #05080a;
  --chassis-1: #23262a;
  --chassis-2: #121417;
  --text: #bfe9f0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px 16px 48px;
  background:
    radial-gradient(ellipse at 50% -10%, #10232a 0%, #05080a 60%),
    var(--ink);
  font-family: 'Courier New', Courier, monospace;
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

body.dragging #deck { outline: 3px dashed var(--cyan); outline-offset: 8px; }

/* ---------------------------- chassis ---------------------------- */
#deck {
  position: relative;
  width: min(1240px, 100%);
  padding: 22px;
  background: linear-gradient(160deg, var(--chassis-1), var(--chassis-2));
  border: 3px solid var(--cyan-dim);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px #000 inset,
    0 30px 70px rgba(0, 0, 0, 0.7),
    0 0 60px rgba(0, 229, 255, 0.12);
}

.bolt {
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6d757c, #2a2e33 70%);
  box-shadow: 0 1px 2px #000;
}
.bolt.top-left { top: 10px; left: 10px; }
.bolt.top-right { top: 10px; right: 10px; }
.bolt.bottom-left { bottom: 10px; left: 10px; }
.bolt.bottom-right { bottom: 10px; right: 10px; }

#deckHead {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 14px;
  border-bottom: 1px solid #2c3238;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.55);
}

.badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 6px 12px;
  background: #0a0d10;
  border: 1px solid #2c3238;
  border-radius: 4px;
  color: var(--cyan);
}
.badge .sep { color: #3a444b; }

.led {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #12ff7a;
  box-shadow: 0 0 8px #12ff7a;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.45; } }

/* ---------------------------- layout ----------------------------- */
#deckBody {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}

@media (max-width: 900px) {
  #deckBody { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------- screen ----------------------------- */
#tube {
  background: #000;
  border: 2px solid #10161a;
  border-radius: 14px;
  padding: 10px;
  box-shadow:
    0 0 0 1px #2c3238,
    0 12px 40px rgba(0, 0, 0, 0.8) inset;
}

#screen {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: #000;
}

#scope {
  display: block;
  width: 100%;
  height: 90px;
  margin-top: 12px;
  background: #04120f;
  border: 1px solid #163c37;
  border-radius: 4px;
}

#fatal {
  margin: 0 0 12px;
  padding: 14px;
  border: 1px solid #ff5c5c;
  border-radius: 4px;
  color: #ff9d9d;
  background: rgba(255, 92, 92, 0.08);
}

/* ---------------------------- controls --------------------------- */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}
.row .grow { flex: 1 1 140px; }
.scope-row { font-size: 12px; }
label.inline { display: flex; align-items: center; gap: 6px; }
label.inline input[type="range"] { flex: 1; }

button {
  flex: 1 1 auto;
  min-height: 34px;
  padding: 6px 12px;
  background: linear-gradient(#1b1f23, #101316);
  border: 1px solid #39424a;
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
button:hover { border-color: var(--cyan); color: var(--cyan); }
button.active,
button.recording {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #05080a;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.5);
}
button.recording { background: #ff4d4d; border-color: #ff4d4d; box-shadow: 0 0 14px rgba(255, 77, 77, 0.6); }

.transport { display: flex; gap: 6px; margin-top: 12px; }
.transport button { font-size: 15px; }
.transport button.wide { flex: 0 0 72px; font-size: 12px; }

.filebtn {
  flex: 1 1 160px;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  background: linear-gradient(#1b1f23, #101316);
  border: 1px solid #39424a;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}
.filebtn:hover { border-color: var(--cyan); color: var(--cyan); }
.filebtn input { display: none; }

.source { font-size: 12px; color: #6f8a92; margin: 12px 0 0; }
.source .hint { display: block; color: #46595f; margin-top: 2px; }

#panel { display: flex; flex-direction: column; }

.group {
  border: 1px solid #2c3238;
  border-radius: 4px;
  margin-top: 10px;
  background: #0a0d10;
}
.group > summary {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
  user-select: none;
}
.group[open] > summary { border-bottom: 1px solid #2c3238; }

.ctl { padding: 7px 12px; font-size: 12px; }
.ctl + .ctl { border-top: 1px solid #14191d; }
.ctl label { display: block; color: #93b4bc; }
.ctl .val { float: right; color: var(--cyan); font-variant-numeric: tabular-nums; }

.ctl-check { display: flex; align-items: center; gap: 8px; }
.ctl-check label { display: inline; }

select,
input[type="datetime-local"],
input[type="color"] {
  width: 100%;
  margin-top: 4px;
  padding: 5px 6px;
  background: #12171b;
  border: 1px solid #39424a;
  border-radius: 3px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
}
input[type="color"] { padding: 2px; height: 28px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  margin-top: 6px;
  height: 4px;
  background: #2a3238;
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--cyan);
  cursor: pointer;
  box-shadow: 0 0 7px rgba(0, 229, 255, 0.8);
}
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px;
  border: none;
  border-radius: 50%;
  background: var(--cyan);
  cursor: pointer;
}
input[type="checkbox"] { accent-color: var(--cyan); }

.notes {
  margin: 14px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: #55686e;
}

.sticker {
  position: absolute;
  right: 26px;
  bottom: -14px;
  padding: 4px 10px;
  background: #f2e14b;
  color: #1a1a1a;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.08em;
  transform: rotate(-2.5deg);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
}