:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191b21;
  --panel-2: #22252d;
  --ink: #f4f1e8;
  --muted: #a9b0ba;
  --line: #363a45;
  --green: #4fd07b;
  --amber: #f3bc4b;
  --red: #f45f5f;
  --cyan: #4fbfe8;
  --magenta: #d779e8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(8, 10, 16, 0.78), rgba(10, 12, 18, 0.9)),
    radial-gradient(circle at 52% 42%, rgba(79, 191, 232, 0.22), transparent 28rem),
    url("assets/bg-energia.png") center / cover fixed no-repeat,
    #101114;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

.app {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  padding: 18px 0 22px;
}

.intro h1 {
  margin: 0;
  font-size: clamp(3rem, 7vw, 6.2rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.intro p {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.eyebrow,
.label {
  display: block;
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.target-panel,
.city-panel,
.console,
.alerts {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.28);
}

.target-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 1fr)) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
}

.target-panel strong {
  display: block;
  margin-top: 5px;
  font-size: 1.55rem;
}

#reset {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #2a2d35;
  color: var(--ink);
  cursor: pointer;
}

.simulator {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(500px, 1.42fr) minmax(280px, 0.82fr);
  gap: 18px;
  align-items: stretch;
}

.city-panel,
.console,
.alerts {
  border-radius: 8px;
  padding: 18px;
}

.city-header,
.console-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

h2 {
  margin: 6px 0 0;
  font-size: 1.1rem;
  line-height: 1.15;
}

.system-light {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 28px var(--green);
  flex: 0 0 auto;
}

.city {
  position: relative;
  overflow: hidden;
  min-height: 330px;
  margin: 20px 0;
  border: 1px solid #303540;
  border-radius: 8px;
  background: #071016;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.32);
}

.city::before,
.city::after {
  position: absolute;
  inset: 0;
  background-image: url("cidade.jpg");
  background-repeat: no-repeat;
  background-size: 200% 100%;
  content: "";
}

.city::before {
  background-position: left center;
}

.city::after {
  background-position: right center;
  opacity: 0;
  transition: opacity 420ms ease;
}

.city.warning::after {
  animation: city-fade 1.15s infinite ease-in-out;
}

.city.critical::after {
  opacity: 1;
  animation: none;
}

.city.critical {
  filter: saturate(0.82) brightness(0.88);
}

@keyframes city-fade {
  0%,
  100% {
    opacity: 0.18;
  }

  45% {
    opacity: 0.88;
  }

  62% {
    opacity: 0.34;
  }
}

.meters {
  display: grid;
  gap: 14px;
}

.meters > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
}

.bar {
  grid-column: 1 / -1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #30343d;
}

.bar span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 160ms ease, background-color 160ms ease;
}

#verdict {
  max-width: 240px;
  color: var(--amber);
  font-weight: 800;
  text-align: right;
}

.sliders {
  display: grid;
  grid-template-columns: repeat(5, minmax(82px, 1fr));
  gap: 14px;
  min-height: 462px;
  margin-top: 20px;
}

.channel {
  display: grid;
  grid-template-rows: 58px 1fr 58px;
  gap: 12px;
  min-width: 0;
  padding: 14px 10px;
  border: 1px solid #333846;
  border-radius: 8px;
  background: linear-gradient(180deg, #252934, #17191f);
}

.channel h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  line-height: 1.12;
  text-align: center;
}

.slider-wrap {
  display: grid;
  place-items: center;
  min-height: 270px;
  overflow: hidden;
}

input[type="range"] {
  width: 34px;
  height: 270px;
  accent-color: var(--cyan);
  direction: rtl;
  writing-mode: vertical-lr;
}

.readout {
  display: grid;
  gap: 6px;
  text-align: center;
}

.readout strong {
  font-size: 1.32rem;
}

.readout span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.alerts h2 {
  margin-bottom: 20px;
}

.alert-list {
  display: grid;
  gap: 12px;
}

.alert {
  padding: 13px;
  border-left: 4px solid var(--amber);
  border-radius: 6px;
  background: var(--panel-2);
}

.alert.danger {
  border-left-color: var(--red);
}

.alert.good {
  border-left-color: var(--green);
}

.alert strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.93rem;
}

.alert p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

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

  .target-panel {
    grid-template-columns: repeat(2, 1fr);
  }

  .sliders {
    min-height: 430px;
  }

  input[type="range"] {
    height: 250px;
  }
}

@media (max-width: 680px) {
  .app {
    padding: 16px;
  }

  .target-panel,
  .sliders {
    grid-template-columns: 1fr;
  }

  .sliders {
    min-height: 0;
  }

  .channel {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .channel h3 {
    min-height: 0;
  }

  .slider-wrap {
    min-height: auto;
  }

  input[type="range"] {
    width: 100%;
    height: auto;
    direction: ltr;
    writing-mode: horizontal-tb;
    transform: none;
  }

  .city {
    min-height: 280px;
  }
}

/* Wide layout: dashboard panels on top, mixer strip below. */
.app {
  width: min(1320px, 100%);
  padding: 18px 22px 24px;
}

.stage {
  padding: 10px 0 20px;
}

.intro h1 {
  font-size: clamp(3.2rem, 6.2vw, 5.8rem);
  line-height: 0.92;
}

.intro p {
  margin-top: 12px;
}

.simulator {
  grid-template-columns: minmax(420px, 0.95fr) minmax(420px, 1.05fr);
}

.console {
  grid-column: 1 / -1;
  order: 3;
}

.city-panel {
  order: 1;
}

.alerts {
  order: 2;
  max-height: 476px;
  overflow: auto;
}

.city {
  min-height: 292px;
  margin: 18px 0;
}

.meters {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.console-top {
  align-items: center;
}

#verdict {
  max-width: 420px;
}

.sliders {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  min-height: 0;
  margin-top: 16px;
}

.channel {
  grid-template-columns: minmax(0, 1fr) minmax(70px, auto);
  grid-template-rows: auto auto;
  gap: 10px 14px;
  padding: 14px;
}

.channel h3 {
  grid-column: 1;
  grid-row: 1;
  min-height: 36px;
  font-size: 0.92rem;
  text-align: left;
}

.slider-wrap {
  grid-column: 1 / -1;
  grid-row: 2;
  min-height: auto;
  overflow: visible;
  place-items: center stretch;
}

input[type="range"] {
  width: 100%;
  height: 30px;
  direction: ltr;
  writing-mode: horizontal-tb;
}

.readout {
  grid-column: 2;
  grid-row: 1;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.readout strong {
  font-size: 1.42rem;
  line-height: 1;
}

.readout span {
  font-size: 0.72rem;
}

@media (min-width: 1121px) and (max-height: 820px) {
  .alerts {
    max-height: 432px;
  }
}

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

  .alerts {
    max-height: none;
  }

  .sliders {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 760px) {
  .target-panel,
  .sliders,
  .meters {
    grid-template-columns: 1fr;
  }

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

  .readout {
    grid-column: 1;
    grid-row: auto;
    justify-items: start;
    text-align: left;
  }

  .channel h3,
  .slider-wrap {
    grid-column: 1;
    grid-row: auto;
  }
}

.target-panel {
  grid-template-columns: repeat(4, minmax(104px, 1fr)) auto;
}

@media (max-width: 1120px) {
  .target-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Embed the score panel inside the mixer header. */
.stage {
  grid-template-columns: minmax(0, 1fr);
  padding-bottom: 12px;
}

.console-top {
  align-items: start;
}

.console-status {
  display: grid;
  justify-items: end;
  gap: 10px;
  flex: 1 1 760px;
  min-width: min(760px, 58vw);
}

.console-status .target-panel {
  width: 100%;
  grid-template-columns: repeat(4, minmax(96px, 1fr)) auto;
  gap: 12px;
  padding: 10px;
  border-color: #303541;
  background: rgba(34, 37, 45, 0.74);
  box-shadow: none;
}

.console-status .target-panel strong {
  margin-top: 4px;
  font-size: 1.34rem;
}

.console-status #reset {
  min-height: 42px;
  padding: 0 14px;
}

.console-status #verdict {
  max-width: none;
  min-height: 20px;
  text-align: right;
}

@media (max-width: 1120px) {
  .console-top {
    flex-direction: column;
  }

  .console-status {
    width: 100%;
    min-width: 0;
  }

  .console-status .target-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .console-status #reset {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .console-status .target-panel {
    grid-template-columns: 1fr;
  }
}

/* Vertical indicator stack inside the city panel. */
.city-panel .meters {
  grid-template-columns: 1fr;
}

.city-panel .meters > div {
  grid-template-columns: 1fr auto;
}

/* Vertical indicators and vertical mixer controls. */
.city-panel .meters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.city-panel .meters > div {
  grid-template-columns: 1fr auto;
}

.sliders {
  grid-template-columns: repeat(5, minmax(118px, 1fr));
  align-items: stretch;
  min-height: 390px;
}

.channel {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(44px, auto) 1fr minmax(58px, auto);
  justify-items: center;
  gap: 14px;
  padding: 14px 12px;
}

.channel h3 {
  grid-column: 1;
  grid-row: 1;
  min-height: 44px;
  text-align: center;
}

.slider-wrap {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  place-items: center;
  min-height: 230px;
  width: 100%;
}

input[type="range"] {
  width: 34px;
  height: 230px;
  direction: rtl;
  writing-mode: vertical-lr;
}

input[type="range"]::-webkit-slider-thumb {
  width: 42px;
  height: 70px;
  border: 0;
  border-radius: 0;
  background: url("assets/fader-thumb.svg") center / contain no-repeat;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.54);
  cursor: grab;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-moz-range-thumb {
  width: 42px;
  height: 70px;
  border: 0;
  border-radius: 0;
  background: url("assets/fader-thumb.svg") center / contain no-repeat;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.54);
  cursor: grab;
}

input[type="range"]:active::-webkit-slider-thumb {
  cursor: grabbing;
}

input[type="range"]:active::-moz-range-thumb {
  cursor: grabbing;
}

.readout {
  grid-column: 1;
  grid-row: 3;
  justify-items: center;
  text-align: center;
}

@media (max-width: 1120px) {
  .sliders {
    grid-template-columns: repeat(3, minmax(118px, 1fr));
  }
}

@media (max-width: 760px) {
  .sliders {
    grid-template-columns: repeat(2, minmax(118px, 1fr));
  }
}

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

/* Technical LED-style vertical indicators. */
.console-top {
  justify-content: flex-end;
}

.console-status {
  flex-basis: 100%;
  min-width: 0;
  grid-template-columns: 1fr;
  justify-items: end;
}

.city-panel .meters {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.city-panel .meters > div {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 34px 168px 42px;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #323845;
  border-radius: 8px;
  background: linear-gradient(180deg, #222630, #16191f);
}

.city-panel .meters .label {
  min-height: 28px;
  line-height: 1.15;
}

.city-panel .meters .bar {
  position: relative;
  grid-column: auto;
  width: 100%;
  height: 168px;
  border: 1px solid #3a404b;
  border-radius: 6px;
  background:
    repeating-linear-gradient(
      to top,
      rgba(255, 255, 255, 0.08) 0 8px,
      rgba(0, 0, 0, 0.28) 8px 11px
    ),
    #101318;
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.48),
    0 0 18px rgba(79, 191, 232, 0.08);
}

.city-panel .meters .bar span {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: 100%;
  border-radius: 0 0 5px 5px;
  background-color: var(--green);
  background-image: repeating-linear-gradient(
    to top,
    rgba(255, 255, 255, 0.26) 0 8px,
    rgba(0, 0, 0, 0.2) 8px 11px
  );
  box-shadow: 0 0 16px currentColor;
  transition: height 180ms ease, background-color 180ms ease;
}

.city-panel .meters strong {
  font-size: 1.32rem;
  line-height: 1;
  display: flex;
  align-items: end;
  min-width: 0;
  white-space: nowrap;
}

#revenue {
  font-size: clamp(0.88rem, 1.1vw, 1.05rem);
}

@media (max-width: 760px) {
  .city-panel .meters {
    grid-template-columns: 1fr;
  }
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
  max-width: 520px;
  margin: 18px 0 0 auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 27, 33, 0.9);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
}

.scoreboard strong {
  display: block;
  margin-top: 4px;
  font-size: 1.65rem;
  line-height: 1;
}

@media (max-width: 760px) {
  .scoreboard {
    grid-template-columns: 1fr;
    max-width: none;
  }
}

/* Metric color hierarchy. */
.target-panel .metric {
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.08);
}

.target-panel .metric-goal {
  color: var(--cyan);
}

.target-panel .metric-saving {
  color: #f45f5f;
}

.target-panel .metric-saving.is-zero {
  color: #f45f5f;
}

.target-panel .metric-saving.is-progress {
  color: var(--amber);
}

.target-panel .metric-saving.is-reached {
  color: var(--green);
  text-shadow: 0 0 18px rgba(79, 208, 123, 0.36);
}

.target-panel .metric-bill {
  color: #f6d56f;
}

/* Final metric palette. */
.target-panel .metric-goal,
.controller-metrics .metric-goal {
  color: #d779e8;
  text-shadow: 0 0 18px rgba(215, 121, 232, 0.36);
}

.target-panel .metric-saving,
.controller-metrics .metric-saving {
  color: #f3bc4b;
}

.target-panel .metric-saving.is-negative,
.controller-metrics .metric-saving.is-negative {
  color: #f45f5f;
  text-shadow: 0 0 18px rgba(244, 95, 95, 0.35);
}

.target-panel .metric-saving.is-zero,
.controller-metrics .metric-saving.is-zero {
  color: #4fbfe8;
  text-shadow: 0 0 18px rgba(79, 191, 232, 0.32);
}

.target-panel .metric-saving.is-progress,
.controller-metrics .metric-saving.is-progress {
  color: #f3bc4b;
  text-shadow: 0 0 18px rgba(243, 188, 75, 0.32);
}

.target-panel .metric-saving.is-reached,
.controller-metrics .metric-saving.is-reached {
  color: #4fd07b;
  text-shadow: 0 0 18px rgba(79, 208, 123, 0.42);
}

.target-panel .metric-bill,
.controller-metrics .metric-bill {
  color: #ff8f70;
  text-shadow: 0 0 18px rgba(255, 143, 112, 0.32);
}

/* Force custom fader hardware over the browser's native range control. */
.channel input[type="range"] {
  width: 58px;
  height: 230px;
  background: transparent;
  color: var(--channel-color, var(--cyan));
  accent-color: var(--channel-color, var(--cyan));
  -webkit-appearance: none;
  appearance: none;
}

.channel input[type="range"]::-webkit-slider-runnable-track {
  width: 8px;
  height: 230px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  background:
    linear-gradient(
      to top,
      var(--channel-color, var(--cyan)) 0 var(--fill, 50%),
      rgba(255, 255, 255, 0.08) var(--fill, 50%) 100%
    ),
    #24272f;
  box-shadow:
    inset 0 0 10px rgba(0, 0, 0, 0.6),
    0 0 16px color-mix(in srgb, var(--channel-color, var(--cyan)) 40%, transparent);
}

.channel input[type="range"]::-moz-range-track {
  width: 8px;
  height: 230px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  background:
    linear-gradient(
      to top,
      var(--channel-color, var(--cyan)) 0 var(--fill, 50%),
      rgba(255, 255, 255, 0.08) var(--fill, 50%) 100%
    ),
    #24272f;
  box-shadow:
    inset 0 0 10px rgba(0, 0, 0, 0.6),
    0 0 16px color-mix(in srgb, var(--channel-color, var(--cyan)) 40%, transparent);
}

.channel input[type="range"]::-webkit-slider-thumb {
  width: 42px;
  height: 70px;
  margin-left: -17px;
  border: 0;
  border-radius: 0;
  background: url("assets/fader-thumb.svg") center / contain no-repeat;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--channel-color, var(--cyan)) 62%, transparent));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.54);
  cursor: grab;
  -webkit-appearance: none;
  appearance: none;
}

.channel input[type="range"]::-moz-range-thumb {
  width: 42px;
  height: 70px;
  border: 0;
  border-radius: 0;
  background: url("assets/fader-thumb.svg") center / contain no-repeat;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--channel-color, var(--cyan)) 62%, transparent));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.54);
  cursor: grab;
}

.channel:focus-within {
  border-color: color-mix(in srgb, var(--channel-color, var(--cyan)) 72%, #ffffff 18%);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--channel-color, var(--cyan)) 45%, transparent),
    0 0 28px color-mix(in srgb, var(--channel-color, var(--cyan)) 22%, transparent);
}

/* Stabilize dynamic text so slider updates do not make the layout jump. */
.target-panel .metric,
.readout strong,
.scoreboard strong,
.city-panel .meters strong {
  font-variant-numeric: tabular-nums;
}

.console-status #verdict {
  display: grid;
  place-items: center end;
  width: min(420px, 100%);
  min-height: 46px;
  max-height: 46px;
  overflow: hidden;
  text-align: right;
  line-height: 1.18;
  text-wrap: balance;
}

.alerts {
  min-height: 430px;
}

.alert-list {
  min-height: 342px;
  align-content: start;
}

.alert {
  min-height: 88px;
}

.city-panel .meters strong {
  min-height: 1.35rem;
  overflow-wrap: anywhere;
}

.target-panel .metric-bill {
  min-width: 7ch;
}

@media (max-width: 1120px) {
  .alerts,
  .alert-list {
    min-height: 0;
  }
}

/* Keep technical indicator values from changing height while numbers update. */
.city-panel .meters strong {
  height: 42px;
  min-height: 42px;
  display: flex;
  align-items: end;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

#revenue {
  font-size: clamp(0.86rem, 1vw, 1.02rem);
}

.fullscreen-button {
  position: fixed;
  z-index: 20;
  top: 12px;
  right: 12px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #3b424f;
  border-radius: 6px;
  background: rgba(34, 37, 45, 0.88);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
}

.fullscreen-button:hover,
.fullscreen-button:focus-visible {
  border-color: var(--cyan);
  outline: none;
}

/* Remote controller screen. */
.controller-page {
  min-height: 100vh;
}

.controller-shell {
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  margin: 0 auto;
  padding: clamp(10px, 1.1vw, 22px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(10px, 1vw, 18px);
  overflow: hidden;
}

.controller-header,
.controller-console,
.controller-footer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 27, 33, 0.76);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.24);
}

.controller-header {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(620px, 1.1fr);
  gap: clamp(12px, 1vw, 18px);
  align-items: center;
  padding: clamp(12px, 1vw, 18px);
}

.controller-header h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4.6vw, 4.8rem);
  line-height: 0.92;
}

.controller-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) auto;
  gap: 12px;
  align-items: center;
}

.controller-metrics > div,
.controller-metrics button {
  min-height: 72px;
  padding: 12px;
  border: 1px solid #303541;
  border-radius: 8px;
  background: rgba(34, 37, 45, 0.62);
}

.controller-metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 1.5rem;
}

.controller-console {
  min-height: 0;
  padding: clamp(12px, 1vw, 18px);
  display: grid;
  overflow: hidden;
}

.controller-console .sliders {
  min-height: 0;
  height: 100%;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.controller-console .slider-wrap {
  min-height: 0;
  height: 100%;
}

.controller-console input[type="range"],
.controller-console .channel input[type="range"] {
  height: clamp(190px, calc(100dvh - 560px), 430px);
}

.controller-console .channel input[type="range"]::-webkit-slider-runnable-track {
  height: clamp(190px, calc(100dvh - 560px), 430px);
}

.controller-console .channel input[type="range"]::-moz-range-track {
  height: clamp(190px, calc(100dvh - 560px), 430px);
}

.controller-console .channel {
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.controller-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: clamp(10px, 0.9vw, 14px) clamp(12px, 1vw, 18px);
  color: var(--muted);
}

.controller-footer output {
  color: var(--amber);
  font-weight: 800;
}

@media (max-width: 980px) {
  .controller-header {
    grid-template-columns: 1fr;
  }

  .controller-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .controller-shell {
    padding: 16px;
  }

  .controller-metrics {
    grid-template-columns: 1fr;
  }

  .controller-footer {
    display: grid;
  }
}
