:root {
  color-scheme: dark;
  --bg: #08090b;
  --panel: #13161a;
  --panel-2: #1c2127;
  --text: #f4f7f8;
  --muted: #99a4ac;
  --line: #323a43;
  --cyan: #67e8f9;
  --green: #22c55e;
  --amber: #facc15;
  --red: #f43f5e;
  --purple: #a78bfa;
  --blue: #60a5fa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 16%, rgba(250, 204, 21, 0.12), transparent 26rem),
    linear-gradient(180deg, #101317 0%, var(--bg) 46%, #050506 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

h1,
h2,
p {
  margin: 0;
}

.featstep-shell {
  width: min(1480px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 70px;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-title img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.app-title h1 {
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 0.95;
  letter-spacing: 0;
  color: #f8fafc;
  text-shadow: 0 2px 0 #111827, 0 0 24px rgba(103, 232, 249, 0.3);
}

.app-title span,
.rack-head span,
.field span,
.meter-stack span,
.video-badge span,
.pad span,
.panel-head span {
  color: var(--muted);
}

.transport {
  display: flex;
  gap: 8px;
}

button {
  min-width: 76px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

.transport button:first-child {
  background: var(--amber);
  color: #181405;
  border-color: transparent;
  font-weight: 800;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stage {
  display: grid;
  grid-template-columns: minmax(240px, 0.78fr) minmax(360px, 1.45fr) minmax(240px, 0.78fr);
  gap: 12px;
  align-items: stretch;
  margin-top: 12px;
}

.line-rack,
.center-step,
.control-panel,
.data-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(19, 22, 26, 0.92);
}

.line-rack {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  min-width: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.rack-a {
  border-left: 4px solid var(--cyan);
}

.rack-b {
  border-right: 4px solid var(--amber);
}

.rack-head,
.panel-head,
.video-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rack-head strong {
  font-size: 24px;
  line-height: 1;
  text-transform: uppercase;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field span,
.meter-stack span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select,
input[type="number"],
input[type="search"],
input[type="file"] {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #090b0e;
  color: var(--text);
  padding: 0 10px;
}

input[type="file"] {
  padding: 8px 10px;
  font-size: 13px;
}

.media-list {
  display: grid;
  gap: 6px;
  max-height: 146px;
  overflow: auto;
}

.media-item {
  display: block;
  width: 100%;
  min-height: 46px;
  min-width: 0;
  border-color: rgba(50, 58, 67, 0.9);
  background: #090b0e;
  padding: 7px 9px;
  text-align: left;
}

.media-item.active {
  border-color: var(--amber);
  box-shadow: inset 3px 0 0 var(--amber);
}

.media-item strong,
.media-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-item strong {
  font-size: 12px;
  line-height: 1.2;
}

.media-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--amber);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
}

.youtube-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.youtube-box button {
  min-width: 82px;
  background: #2a1117;
  border-color: rgba(244, 63, 94, 0.7);
}

.meter-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.meter-stack div {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #090b0e;
  padding: 9px;
}

.meter-stack strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(18px, 2vw, 24px);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.center-step {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 14px;
  min-width: 0;
  overflow: hidden;
}

.logo-step {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 154px;
  isolation: isolate;
}

.step-shadow {
  position: absolute;
  width: min(82%, 520px);
  height: 92px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.2), rgba(250, 204, 21, 0.22), rgba(96, 165, 250, 0.2));
  transform: perspective(500px) rotateX(58deg);
  filter: blur(1px);
  z-index: -1;
}

.logo-step img {
  position: absolute;
  width: min(150px, 24vw);
  aspect-ratio: 1;
  object-fit: contain;
  opacity: 0.16;
  filter: drop-shadow(0 0 24px rgba(250, 204, 21, 0.22));
  z-index: 1;
}

.logo-text {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(540px, 94%);
  text-align: center;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(30px, 4.7vw, 60px);
  line-height: 0.9;
  letter-spacing: 0;
  color: #f8fafc;
  text-shadow: 0 3px 0 #111827, 0 0 18px rgba(103, 232, 249, 0.42);
  pointer-events: none;
  z-index: 2;
}

.video-frame {
  position: relative;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #050506;
}

#videoCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 260px;
  aspect-ratio: 16 / 9;
}

.game-canvas,
video {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.video-badge {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(5, 5, 6, 0.7);
  padding: 8px 10px;
  backdrop-filter: blur(8px);
}

.video-badge strong {
  color: var(--amber);
}

.scope-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

canvas {
  display: block;
}

#lineACanvas,
#lineBCanvas {
  width: 100%;
  height: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050506;
}

.pad-bank {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.pad {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101317;
  padding: 12px;
  box-shadow: inset 0 -14px 28px rgba(0, 0, 0, 0.24);
}

.pad strong,
.pad span {
  display: block;
}

.pad strong {
  font-size: 18px;
  text-transform: uppercase;
}

.pad.red { border-top: 5px solid var(--red); }
.pad.blue { border-top: 5px solid var(--blue); }
.pad.green { border-top: 5px solid var(--green); }
.pad.purple { border-top: 5px solid var(--purple); }
.pad.amber { border-top: 5px solid var(--amber); }

.control-panel {
  display: grid;
  grid-template-columns: 120px 90px 110px repeat(2, minmax(140px, 1fr)) 92px repeat(4, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  margin-top: 12px;
}

.check-field {
  align-items: center;
}

.check-field input {
  justify-self: start;
}

.data-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 12px;
  margin-top: 12px;
}

.data-grid article {
  min-width: 0;
  padding: 14px;
}

.panel-head h2 {
  font-size: 16px;
  text-transform: uppercase;
}

.table-wrap {
  overflow: auto;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

th,
td {
  padding: 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-weight: 800;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.ring-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.ring-item {
  display: block;
  min-width: 0;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #090b0e;
  padding: 9px;
  text-align: left;
}

.ring-item strong,
.ring-item span {
  display: block;
}

.ring-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1120px) {
  .stage,
  .scope-row,
  .data-grid {
    grid-template-columns: 1fr;
  }

  .center-step {
    order: -1;
  }

  .control-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .featstep-shell {
    width: min(100vw - 18px, 1480px);
    padding-top: 10px;
  }

  .topbar,
  .transport,
  .pad-bank,
  .control-panel {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .transport {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .app-title img {
    width: 44px;
    height: 44px;
  }

  .logo-step {
    min-height: 128px;
  }

  .logo-text {
    font-size: clamp(31px, 12vw, 58px);
  }
}
