:root {
  color-scheme: dark;
  --bg: #100938;
  --panel: #25115f;
  --panel-2: #07194f;
  --line: #00f0ff;
  --text: #fff9f3;
  --muted: #9bf7ff;
  --accent: #ffe04f;
  --danger: #ff4f9f;
  --ok: #3dffb5;
  --violet: #9b5cff;
  --hot: #ff7a38;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 16%, rgba(255, 224, 79, 0.34), transparent 20rem),
    radial-gradient(circle at 82% 14%, rgba(0, 240, 255, 0.32), transparent 22rem),
    radial-gradient(circle at 55% 88%, rgba(255, 79, 159, 0.28), transparent 26rem),
    linear-gradient(135deg, #170050 0%, var(--bg) 42%, #003c66 70%, #290038 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
}

.stage {
  position: relative;
  min-height: 360px;
  border: 2px solid var(--line);
  background: #170050;
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.22), inset 0 0 40px rgba(255, 79, 159, 0.12);
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  image-rendering: auto;
}

.hud {
  position: absolute;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.hud.top {
  top: 14px;
}

.hud > div,
.toast {
  border: 1px solid rgba(255, 255, 255, 0.36);
  background:
    linear-gradient(135deg, rgba(255, 79, 159, 0.72), rgba(37, 17, 95, 0.78) 46%, rgba(0, 240, 255, 0.52));
  box-shadow: 0 0 18px rgba(255, 224, 79, 0.16);
  backdrop-filter: blur(8px);
}

.hud > div {
  min-width: 112px;
  padding: 9px 12px;
}

.label,
label span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hud strong {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
}

.toast {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(430px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  padding: 18px 20px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
}

.controls {
  display: grid;
  grid-template-columns: minmax(170px, 240px) minmax(320px, 1fr) minmax(170px, 240px);
  gap: 14px;
  align-items: stretch;
}

.meter,
.control-grid {
  border: 2px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 79, 159, 0.2), transparent 35%),
    linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: inset 0 0 26px rgba(0, 240, 255, 0.11), 0 0 18px rgba(155, 92, 255, 0.18);
  padding: 14px;
}

.meter {
  display: grid;
  align-content: center;
  gap: 10px;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.bar {
  height: 12px;
  background: #1b1450;
  border: 1px solid rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--ok), #70f5ff, var(--accent));
  transition: width 180ms ease;
}

.cpu .bar span {
  background: linear-gradient(90deg, #ff7a38, #ff4f9f, #9b5cff);
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(100px, 1.2fr) 1fr 1fr 90px 120px;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 9px;
  min-width: 0;
}

output {
  min-height: 1.2rem;
  color: var(--text);
  font-weight: 800;
}

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

select {
  width: 100%;
  background: #170050;
  color: var(--text);
  border: 1px solid rgba(0, 240, 255, 0.4);
  font: inherit;
  font-weight: 800;
  padding: 4px;
  min-height: 1.2rem;
  outline: none;
  cursor: pointer;
}
select:focus {
  border-color: var(--line);
}

button {
  min-height: 46px;
  border: 1px solid #70f5ff;
  background: linear-gradient(135deg, #4120a9, #006fd6);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.14);
}

button:hover:not(:disabled) {
  border-color: #ffe04f;
  background: linear-gradient(135deg, #6733ff, #00a4ff);
}

button:disabled {
  cursor: default;
  color: #9d91be;
  background: #201a4d;
  box-shadow: none;
}

.fire {
  border-color: #ffe04f;
  background: linear-gradient(135deg, #ffe04f, #ff7a38 48%, #ff4f9f);
  color: #190521;
}

.fire:hover:not(:disabled) {
  background: linear-gradient(135deg, #fff27a, #ff9d43 46%, #ff65bc);
}

@media (max-width: 880px) {
  .shell {
    padding: 10px;
    gap: 10px;
  }

  .stage,
  canvas {
    min-height: 300px;
  }

  .controls {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .control-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hud {
    left: 8px;
    right: 8px;
  }

  .hud > div {
    min-width: 0;
    width: 25%;
    padding: 6px;
    font-size: 0.9em;
  }
}

@media (max-width: 520px) {
  .stage,
  canvas {
    min-height: 260px;
  }

  .control-grid {
    grid-template-columns: 1fr;
  }

  .hud strong {
    font-size: 0.92rem;
  }
}
