/* ==========================================================================
   Adaptação para telas pequenas, médias e baixas
   ========================================================================== */

@media (max-width: 1180px) {
  .cabinet-body {
    grid-template-columns: minmax(0, 1fr) clamp(8.4rem, 14.4%, 9.7rem);
  }

  .control-panel {
    padding-inline: clamp(.5rem, .8vw, .7rem);
  }

  .control-panel__identity strong {
    font-size: .66rem;
  }

  .sound-deck__badges span:first-child {
    display: none;
  }
}

@media (max-width: 1000px) {
  .cabinet-crown__vents {
    max-width: 9rem;
  }

  .screen-meta__spec {
    font-size: .38rem;
  }

  .sound-deck {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .sound-deck__badges {
    display: none;
  }
}

/* Em janelas baixas, reduz a TV para o conjunto caber sem rolagem excessiva. */
@media (min-width: 861px) and (max-height: 980px) {
  .tv-set {
    width: min(100%, 66rem, calc((100svh - 17rem) * 1.35));
  }
}

/* --------------------------------------------------------------------------
   Até 860px: painel vira uma mesa de controles sob a tela
   -------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .tv-stage {
    margin-top: clamp(.7rem, 2vh, 1.2rem);
  }

  .stage-wall-copy {
    top: clamp(3rem, 8vh, 5rem);
    font-size: clamp(3.6rem, 15vw, 7.5rem);
  }

  .cabinet-body {
    display: flex;
    flex-direction: column;
    gap: clamp(.55rem, 1.4vw, .9rem);
  }

  .screen-bezel {
    border-radius: clamp(1.2rem, 3.1vw, 1.9rem);
  }

  .control-panel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto;
    align-items: center;
    gap: .55rem clamp(.7rem, 2vw, 1.15rem);
    padding: clamp(.6rem, 1.7vw, .9rem) clamp(.7rem, 2vw, 1rem);
    border-radius: clamp(.8rem, 2vw, 1.2rem);
  }

  .control-panel::after {
    right: 1.2rem;
    left: 1.2rem;
  }

  .control-panel__identity,
  .control-panel__footer {
    display: none;
  }

  .power-unit {
    grid-column: 1;
    grid-row: 1;
    padding: 0;
    column-gap: .4rem;
    row-gap: .28rem;
  }

  .power-button {
    width: clamp(2.65rem, 8vw, 3.15rem);
  }

  .power-led {
    width: clamp(.36rem, 1.4vw, .46rem);
    height: clamp(.36rem, 1.4vw, .46rem);
  }

  .rocker-stack {
    grid-column: 2;
    grid-row: 1;
    flex-direction: row;
    gap: clamp(.6rem, 3vw, 1.4rem);
  }

  .rocker {
    flex: 1 1 0;
    gap: .25rem .35rem;
  }

  .rocker__label {
    font-size: clamp(.44rem, 1.15vw, .52rem);
    letter-spacing: .12em;
  }

  .readout {
    min-width: 1.8rem;
    padding: .2rem .32rem .16rem;
    font-size: clamp(.58rem, 1.55vw, .7rem);
  }

  .rocker__buttons {
    gap: clamp(.2rem, .55vw, .3rem);
  }

  .rocker-button {
    height: clamp(2.35rem, 6.2vw, 2.75rem);
    font-size: 1.1rem;
  }

  .sound-toggle {
    grid-column: 3;
    grid-row: 1;
    flex-direction: column;
    gap: .22rem;
    width: clamp(2.65rem, 7.4vw, 3rem);
    min-width: clamp(2.65rem, 7.4vw, 3rem);
    min-height: clamp(2.75rem, 7.6vw, 3.1rem);
    padding: .32rem .25rem;
  }

  .sound-toggle svg {
    width: .95rem;
    height: .95rem;
  }

  .sound-toggle .control-caption {
    font-size: .4rem;
  }

  .control-caption {
    font-size: .42rem;
  }

  .sound-deck {
    margin-top: .5rem;
  }

  .under-tv {
    margin-top: .85rem;
  }

  .tv-status {
    flex: 1 1 auto;
    font-size: .56rem;
  }

  /* OSD e textos internos ganham pisos de legibilidade em telas pequenas. */
  .osd--channel {
    gap: 1.4cqw;
    min-width: 0;
    padding: 1.1cqw 2cqw 1.2cqw 1.5cqw;
  }

  .osd__number {
    font-size: clamp(1.45rem, 6.8cqw, 2.6rem);
  }

  .osd__tag {
    font-size: clamp(.42rem, 1.55cqw, .62rem);
    letter-spacing: .16em;
  }

  .osd__title {
    font-size: clamp(.5rem, 2.1cqw, .75rem);
  }

  .osd--volume {
    gap: .55rem;
    padding: .42rem .65rem;
  }

  .osd--volume .osd__tag {
    font-size: clamp(.42rem, 1.55cqw, .6rem);
  }

  .volume-meter {
    gap: .12rem;
    width: clamp(3.8rem, 13cqw, 6rem);
    height: clamp(.8rem, 2.6cqw, 1.1rem);
  }

  .volume-value {
    min-width: 1.1rem;
    font-size: clamp(.48rem, 1.65cqw, .65rem);
  }

  .ident__top,
  .ident__bottom {
    font-size: clamp(.44rem, 1.3cqw, .62rem);
    letter-spacing: .12em;
  }

  .ident__kicker {
    font-size: clamp(.44rem, 1.7cqw, .66rem);
    letter-spacing: .28em;
    text-indent: .28em;
  }

  .ident__sub {
    font-size: clamp(.4rem, 1.3cqw, .58rem);
    letter-spacing: .13em;
  }

  .ident__rings {
    width: 62cqw;
  }

  .bars__plate {
    width: 66%;
    padding: 1.4cqw 2cqw 1.5cqw;
  }

  .bars__brand {
    font-size: clamp(.42rem, 1.3cqw, .58rem);
  }

  .bars__plate strong {
    font-size: clamp(1rem, 4.6cqw, 1.85rem);
  }

  .bars__sub {
    font-size: clamp(.38rem, 1.1cqw, .5rem);
    letter-spacing: .1em;
  }

  .bars__lower-top,
  .bars__lower-bottom {
    font-size: clamp(.38rem, 1.12cqw, .52rem);
    letter-spacing: .08em;
  }

  .bars__number {
    font-size: clamp(1rem, 5cqw, 1.8rem);
  }

  .pixel__top,
  .pixel__footer {
    font-size: clamp(.38rem, 1.15cqw, .52rem);
    letter-spacing: .1em;
  }

  .pixel__title > span {
    font-size: clamp(.38rem, 1.2cqw, .54rem);
  }

  .pixel__title strong {
    font-size: clamp(2rem, 12cqw, 4.8rem);
  }

  .pixel__title small {
    font-size: clamp(.34rem, 1cqw, .47rem);
    letter-spacing: .08em;
  }

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

/* --------------------------------------------------------------------------
   Até 620px: cabeçalho, rodapé e ajustes compactos
   -------------------------------------------------------------------------- */

@media (max-width: 620px) {
  :root {
    --page-padding: clamp(.8rem, 3.6vw, 1.15rem);
    --tv-radius: clamp(1.25rem, 5vw, 1.8rem);
  }

  .site-header {
    padding-top: 1rem;
    gap: .75rem;
  }

  .header-plate {
    gap: .5rem;
    padding: .4rem .55rem;
  }

  .header-plate__block small {
    font-size: .4rem;
  }

  .header-plate__block strong {
    font-size: .56rem;
  }

  .header-plate__rule {
    height: 1.1rem;
  }

  .stage-kicker {
    gap: .5rem;
    max-width: 28rem;
    font-size: .46rem;
    letter-spacing: .18em;
  }

  .stage-wall-copy {
    top: 3.4rem;
    font-size: clamp(3.2rem, 17vw, 5.6rem);
  }

  .tv-cabinet {
    padding: clamp(.45rem, 2vw, .7rem);
  }

  .cabinet-crown {
    margin-inline: .1rem;
    margin-bottom: .4rem;
    padding-inline: .25rem;
    font-size: .36rem;
  }

  .cabinet-crown__vents {
    max-width: 5rem;
  }

  .screen-bezel {
    padding: clamp(.35rem, 1.8vw, .55rem);
  }

  .screen-meta {
    min-height: 1rem;
    padding-top: .4rem;
    font-size: .36rem;
  }

  .screen-meta__brand {
    font-size: .42rem;
  }

  .screen-meta__spec {
    display: none;
  }

  .screw {
    width: .32rem;
    height: .32rem;
  }

  .screw--tl { top: .28rem; left: .35rem; }
  .screw--tr { top: .28rem; right: .35rem; }
  .screw--bl { bottom: .38rem; left: .35rem; }
  .screw--br { right: .35rem; bottom: .38rem; }

  .sound-deck {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 2.9rem;
    padding: .45rem .65rem;
    border-radius: .7rem .7rem 1.2rem 1.2rem;
  }

  .sound-deck__brand strong {
    font-size: .68rem;
  }

  .sound-deck__brand small {
    font-size: .3rem;
  }

  .speaker-grille {
    height: 1.7rem;
  }

  .tv-feet {
    width: 84%;
  }

  .under-tv {
    flex-direction: column;
    align-items: stretch;
    gap: .55rem;
  }

  .tv-status {
    width: 100%;
    min-height: 2.55rem;
    font-size: .54rem;
  }

  .tv-shortcut {
    display: none;
  }

  .settings-trigger {
    align-self: flex-end;
    min-height: 2.6rem;
  }

  .settings-panel {
    padding: .85rem;
    border-radius: .6rem;
  }

  .settings-panel__head {
    gap: .75rem;
  }

  .settings-panel h2 {
    font-size: clamp(1.45rem, 7vw, 1.9rem);
  }

  .settings-close {
    width: 2.55rem;
    height: 2.55rem;
  }

  .settings-group {
    padding: .75rem;
  }

  .switch-row {
    min-height: 2.6rem;
  }

  .switch-copy strong {
    font-size: .61rem;
  }

  .switch-copy small {
    font-size: .46rem;
  }

  .switch {
    width: 2.75rem;
    height: 1.5rem;
  }

  .switch::before {
    width: 1.12rem;
    height: 1.12rem;
  }

  .switch-row input:checked + .switch::before {
    left: calc(100% - 1.3rem);
  }

  .settings-panel__foot {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-reset {
    min-height: 2.75rem;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: .3rem;
    padding-bottom: max(1.1rem, env(safe-area-inset-bottom));
    font-size: .47rem;
  }
}

/* --------------------------------------------------------------------------
   Até 560px: controles em duas fileiras, alvos de toque maiores
   -------------------------------------------------------------------------- */

@media (max-width: 560px) {
  .control-panel {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "power badge sound"
      "rockers rockers rockers";
    gap: .6rem .5rem;
    padding: .65rem .7rem .7rem;
  }

  .power-unit {
    grid-area: power;
    justify-self: start;
    column-gap: .35rem;
    row-gap: .22rem;
  }

  .control-panel__footer {
    display: flex;
    grid-area: badge;
    justify-self: center;
    align-self: center;
    font-size: .38rem;
  }

  .sound-toggle {
    grid-area: sound;
    justify-self: end;
  }

  .rocker-stack {
    grid-area: rockers;
    flex-direction: column;
    gap: .3rem;
    padding-top: .55rem;
    border-top: 1px solid rgba(255, 255, 255, .075);
  }

  .rocker {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: .3rem .5rem;
  }

  .rocker__label {
    grid-column: 1;
    font-size: .5rem;
  }

  .rocker .readout {
    grid-column: 2;
    min-width: 2rem;
    font-size: .7rem;
  }

  .rocker__buttons {
    grid-column: 3;
    width: 100%;
  }

  .rocker-button {
    height: 2.75rem;
    border-radius: .36rem;
    font-size: 1.25rem;
  }

  .power-button {
    width: 2.8rem;
    min-width: 2.8rem;
  }

  .power-unit .control-caption {
    font-size: .38rem;
  }

  .sound-toggle {
    width: 2.8rem;
    min-width: 2.8rem;
    min-height: 2.9rem;
  }

  .effect-grid {
    grid-template-columns: 1fr;
    gap: .05rem;
  }

  .switch-row {
    min-height: 2.8rem;
  }
}

/* --------------------------------------------------------------------------
   Até 430px: refinamento para celulares estreitos
   -------------------------------------------------------------------------- */

@media (max-width: 430px) {
  :root {
    --page-padding: .8rem;
  }

  .brand {
    gap: .55rem;
  }

  .brand__tagline {
    font-size: .42rem;
    letter-spacing: .21em;
  }

  .brand__badge {
    display: none;
  }

  .header-plate {
    padding: .35rem .45rem;
  }

  .header-plate__block:first-of-type small,
  .header-plate__block:last-of-type small {
    display: none;
  }

  .header-plate__block strong {
    font-size: .53rem;
  }

  .stage-kicker {
    font-size: .42rem;
    letter-spacing: .13em;
  }

  .stage-kicker span {
    width: .8rem;
  }

  .stage-wall-copy {
    top: 3.2rem;
    font-size: 3.1rem;
  }

  .cabinet-crown {
    display: none;
  }

  .screen-bezel {
    padding: .35rem;
    border-radius: 1.05rem;
  }

  .screen-meta {
    font-size: .33rem;
  }

  .screen-meta__brand {
    font-size: .38rem;
  }

  .sound-deck {
    gap: .5rem;
    padding-inline: .55rem;
  }

  .sound-deck__brand {
    gap: .35rem;
  }

  .sound-deck__brand small {
    display: none;
  }

  .sound-deck__brand strong {
    font-size: .58rem;
  }

  .speaker-grille {
    height: 1.5rem;
  }

  .control-panel {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "power . sound"
      "rockers rockers rockers";
    padding: .6rem;
  }

  .control-panel__footer {
    display: none;
  }

  .rocker {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .rocker__buttons {
    grid-column: 3;
  }

  .tv-status {
    padding-right: .5rem;
    font-size: .5rem;
    letter-spacing: .03em;
  }

  .settings-trigger {
    width: 100%;
    justify-content: center;
  }

  .settings-panel {
    padding: .7rem;
  }

  .settings-group {
    padding: .65rem;
  }

  .range-row {
    margin-top: .8rem;
  }

  .site-footer {
    font-size: .44rem;
  }
}

/* --------------------------------------------------------------------------
   Telas muito estreitas
   -------------------------------------------------------------------------- */

@media (max-width: 350px) {
  .rocker {
    grid-template-columns: auto auto minmax(0, 1fr);
    column-gap: .35rem;
  }

  .rocker__label {
    font-size: .45rem;
  }

  .rocker .readout {
    min-width: 1.8rem;
    font-size: .64rem;
  }

  .rocker-button {
    height: 2.7rem;
  }

  .power-button {
    width: 2.65rem;
    min-width: 2.65rem;
  }

  .sound-toggle {
    width: 2.6rem;
    min-width: 2.6rem;
  }

  .screen-meta {
    display: none;
  }

  .sound-deck__brand strong {
    font-size: .52rem;
  }
}

@media (max-width: 300px) {
  :root {
    --page-padding: .55rem;
  }

  .header-plate {
    display: none;
  }

  .rocker__label {
    font-size: .4rem;
  }

  .rocker-button {
    height: 2.55rem;
  }
}

/* --------------------------------------------------------------------------
   Ajustes de paisagem
   -------------------------------------------------------------------------- */

@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .site-header {
    padding-top: .6rem;
  }

  .stage-kicker,
  .stage-wall-copy,
  .tv-status,
  .site-footer {
    display: none;
  }

  .tv-stage {
    margin-top: .4rem;
  }

  .under-tv {
    margin-top: .45rem;
  }

  .tv-set {
    width: min(100%, 40rem);
  }

  .screen-bezel {
    max-width: 35rem;
    margin-inline: auto;
  }

  .control-panel {
    max-width: 35rem;
    margin-inline: auto;
  }

  .sound-deck {
    max-width: 35rem;
    margin-inline: auto;
  }
}