:root {
  --fundo: #0e0e0e;
  --laranja: #ff6a0d;
  --laranja-escuro: #a53e00;
  --amarelo: #ffc21a;
  --texto: #f4efe9;
  --texto-2: #cbbfb1;
  --texto-3: #9a8d80;
  --vermelho-led: #ff3b30;
  --verde-led: #39e36b;
  --fonte-painel: "Bahnschrift SemiCondensed", "Bahnschrift", "DIN Condensed", "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --seguro-topo: env(safe-area-inset-top, 0px);
  --seguro-base: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--fundo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* ===================== Aparelho ===================== */
.aparelho {
  position: relative;
  max-width: 460px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: #1a120c;
}

/* Computador: mostra como um celular no meio da tela */
@media (min-width: 600px) {
  body { padding: 28px 0; background: radial-gradient(70% 60% at 50% 40%, #1d1d1d, #0a0a0a); }
  .aparelho {
    /* altura fixa de "celular" pra moldura não encolher nas abas curtas */
    min-height: min(900px, calc(100dvh - 56px));
    border: 10px solid #050505;
    border-radius: 42px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px #2a2a2a;
  }
}

/* ===================== Barra de cima (metal) ===================== */
.barra-topo {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--seguro-topo)) 14px 10px;
  background: linear-gradient(180deg, #2d2d2d 0%, #1b1b1b 55%, #141414 100%);
  border-bottom: 3px solid #050505;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 10px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 2;
}
.logo {
  justify-self: center;
  width: min(100%, 160px);
  height: auto;
  filter: drop-shadow(0 3px 10px rgba(255, 106, 13, 0.25));
}

/* Tecla "física" */
.tecla {
  width: 48px; height: 48px;
  border-radius: 10px;
  border: 1px solid #000;
  background: linear-gradient(180deg, #333 0%, #1e1e1e 100%);
  color: var(--laranja);
  display: grid; place-items: center;
  box-shadow: 0 4px 0 #050505, inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 0.08s, box-shadow 0.08s, color 0.15s;
}
.tecla svg { width: 26px; height: 26px; }
.tecla:active { transform: translateY(3px); box-shadow: 0 1px 0 #050505, inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.tecla:focus-visible, .aba:focus-visible, .botao-play:focus-visible { outline: 2px solid var(--amarelo); outline-offset: 3px; }
.tecla.ativo { color: var(--amarelo); box-shadow: 0 4px 0 #050505, inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 14px rgba(255, 170, 0, 0.35); }

/* ===================== Madeira ===================== */
.madeira {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background-color: #2a1a10;
  background-image:
    radial-gradient(120% 70% at 50% 0%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.45) 100%),
    repeating-linear-gradient(90deg, rgba(255, 220, 180, 0.025) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 19px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 3px, transparent 3px 53px),
    linear-gradient(90deg, #24160d 0%, #3a2416 18%, #2c1b10 37%, #3d2617 58%, #28180e 79%, #352113 100%);
}

.painel { display: flex; flex-direction: column; gap: 10px; flex: 1; }

/* ===================== Toca-discos ===================== */
.toca-discos {
  position: relative;
  /* o que sobra da altura da tela depois do logo, visor, VU, controles e abas (~605px) */
  width: clamp(220px, calc((100dvh - 605px) * 1.12), 100%);
  aspect-ratio: 1.12;
  margin: 0 auto;
}
.prato {
  position: absolute;
  left: 0; top: 2%;
  width: 84%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #1b1b1b 0 60%, #262626 70%, #0f0f0f 72%, #2a2a2a 100%);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.65), 0 0 0 3px #0a0a0a;
}
.disco {
  position: absolute;
  inset: 3%;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 34.5%, #080808 34.5% 36%, transparent 36% 47%, rgba(0, 0, 0, 0.6) 47% 47.6%, transparent 47.6% 62%, rgba(0, 0, 0, 0.55) 62% 62.6%, transparent 62.6% 80%, rgba(0, 0, 0, 0.5) 80% 80.6%, transparent 80.6%),
    repeating-radial-gradient(circle, #161616 0 1px, #0d0d0d 1px 2.6px);
  box-shadow: inset 0 0 0 2px #050505;
  animation: girar 1.8s linear infinite; /* 33⅓ rpm */
  animation-play-state: paused;
}
body.tocando .disco { animation-play-state: running; }
@keyframes girar { to { transform: rotate(360deg); } }

.rotulo {
  position: absolute;
  inset: 32%;
  border-radius: 50%;
  overflow: hidden;
  background: #111;
  box-shadow: 0 0 0 2px #000, 0 0 0 4px rgba(255, 106, 13, 0.35);
}
.rotulo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.5s ease;
}
.rotulo img.trocando { opacity: 0; }

/* reflexo de luz fixo: com o disco girando por baixo, dá a sensação de vinil de verdade */
.brilho {
  position: absolute;
  inset: 3%;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(from 25deg, transparent 0 6%, rgba(255, 255, 255, 0.09) 12%, transparent 19% 50%, rgba(255, 255, 255, 0.07) 57%, transparent 64%);
  -webkit-mask: radial-gradient(circle, transparent 0 35%, #000 36%);
  mask: radial-gradient(circle, transparent 0 35%, #000 36%);
}
.pino {
  position: absolute;
  left: 50%; top: 50%;
  width: 3.4%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #8a8a8a 60%, #3a3a3a);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.braco {
  position: absolute;
  right: 0; top: 0;
  width: 24%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(4px 8px 6px rgba(0, 0, 0, 0.6));
}
.braco-giro {
  transform-box: view-box;
  transform-origin: 55px 50px;
  transition: transform 1.3s cubic-bezier(0.45, 0, 0.25, 1);
}
body.tocando .braco-giro,
body.conectando .braco-giro,
body.erro .braco-giro { transform: rotate(21deg); }
.agulha-luz { fill: #5a2a08; transition: fill 0.3s; }
body.tocando .agulha-luz { fill: var(--laranja); filter: drop-shadow(0 0 4px var(--laranja)); }

/* ===================== Visor (música atual) ===================== */
.visor {
  border-radius: 12px;
  padding: 10px 14px 12px;
  background: linear-gradient(180deg, #0b0b0b, #141210);
  border: 1px solid #000;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: center;
  min-height: 86px;
}
.visor-linha {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--fonte-painel);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--laranja);
  text-shadow: 0 0 8px rgba(255, 106, 13, 0.45);
}
.visor-timer {
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 194, 26, 0.5);
  color: var(--amarelo);
  text-shadow: none;
  letter-spacing: 0.04em;
}
.visor-titulo {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 750;
  line-height: 1.2;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.visor-artista {
  margin-top: 3px;
  font-size: 15.5px;
  color: var(--texto-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* LEDs */
.led {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: none;
  background: #3a2a22;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
}
body.tocando .led-vivo { background: var(--vermelho-led); box-shadow: 0 0 8px var(--vermelho-led); animation: pulso 1.6s ease-in-out infinite; }
body.conectando .led-vivo { background: var(--amarelo); box-shadow: 0 0 8px var(--amarelo); animation: pulso 0.8s ease-in-out infinite; }
body.erro .led-vivo { background: #ff7a66; box-shadow: 0 0 6px #ff7a66; }
body.tocando .led-sinal { background: var(--verde-led); box-shadow: 0 0 8px var(--verde-led); }
@keyframes pulso { 50% { opacity: 0.45; } }

/* ===================== VU ===================== */
.vu-painel {
  border-radius: 12px;
  padding: 8px 12px 9px;
  background: linear-gradient(180deg, #1d1814, #15110e);
  border: 2px solid #4a2f1c;
  box-shadow: inset 0 0 0 1px #000, 0 6px 16px rgba(0, 0, 0, 0.5);
}
.vu-topo, .vu-base {
  font-family: var(--fonte-painel);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--texto-3);
}
.vu-topo { text-align: right; margin-bottom: 6px; }
.vus { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vu {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  border: 2px solid #050505;
  background: #26221d;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.8);
  transition: background 0.6s;
}
body.tocando .vu { background: #3a2f22; } /* luz de fundo acende */
.vu .escala { fill: none; stroke-width: 2.4; }
.vu .marca { stroke: #cfc2b0; stroke-width: 1.4; }
.vu .num { fill: #cfc2b0; font: 600 8.5px var(--fonte-painel); text-anchor: middle; }
.vu .rot { fill: var(--laranja); font: 700 8.5px var(--fonte-painel); letter-spacing: 0.12em; text-anchor: middle; }
.vu .vu-txt { fill: #8d8172; font: 700 10px var(--fonte-painel); text-anchor: middle; }
.vu .ponteiro { stroke: #ff3b1f; stroke-width: 1.8; stroke-linecap: round; }
.vu .eixo { fill: #0d0d0d; stroke: #2e2e2e; stroke-width: 2; }
.vu-base { display: flex; align-items: center; gap: 7px; margin-top: 7px; }
.vu-info { margin-left: auto; letter-spacing: 0.06em; font-size: 10.5px; }

/* ===================== Controles ===================== */
.controle {
  display: flex;
  gap: 12px;
  align-items: stretch;
  padding: 9px;
  border-radius: 14px;
  background: rgba(10, 8, 6, 0.75);
  border: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  margin-top: auto;
}
.tecla-grande { width: 64px; height: 64px; border-radius: 12px; flex: none; }
.tecla-grande svg { width: 30px; height: 30px; }

.botao-play {
  flex: 1;
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  height: 64px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ff8126 0%, #f05f07 55%, #e25200 100%);
  color: #fff;
  box-shadow: 0 6px 0 var(--laranja-escuro), 0 10px 22px rgba(255, 100, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.08s, box-shadow 0.08s;
}
.botao-play:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--laranja-escuro), 0 4px 10px rgba(255, 100, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.play-texto {
  font-family: var(--fonte-painel);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(120, 40, 0, 0.55);
}
.botao-play .ic { width: 28px; height: 28px; fill: #fff; filter: drop-shadow(0 2px 0 rgba(120, 40, 0, 0.55)); }
.botao-play .ic-parar, .botao-play .girando { display: none; }
body.tocando .botao-play .ic-play, body.erro .botao-play .ic-play { display: none; }
body.tocando .botao-play .ic-parar, body.erro .botao-play .ic-parar { display: block; }
body.conectando .botao-play .ic-play { display: none; }
body.conectando .botao-play .girando { display: block; }
.girando {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: gira 0.8s linear infinite;
}
@keyframes gira { to { transform: rotate(360deg); } }

/* ===================== Abas ===================== */
.abas {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #2a2a2a 0%, #171717 100%);
  border-top: 3px solid #050505;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.aba {
  position: relative;
  min-height: 50px;
  padding: 6px 4px 10px;
  border-radius: 10px;
  border: 1px solid #000;
  background: linear-gradient(180deg, #262626, #191919);
  box-shadow: 0 3px 0 #050505, inset 0 1px 0 rgba(255, 255, 255, 0.07);
  font-family: var(--fonte-painel);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.15;
  text-transform: uppercase;
  color: var(--texto-3);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.aba::after {
  content: "";
  position: absolute;
  left: 30%; right: 30%; bottom: 6px;
  height: 2px;
  border-radius: 2px;
  background: transparent;
}
.aba.ativa {
  color: var(--laranja);
  border-color: var(--laranja);
  background: linear-gradient(180deg, #3a2414, #24170e);
  box-shadow: 0 3px 0 #050505, 0 0 16px rgba(255, 106, 13, 0.3), inset 0 0 12px rgba(255, 106, 13, 0.15);
}
.aba.ativa::after { background: var(--laranja); box-shadow: 0 0 6px var(--laranja); }
.aba:active { transform: translateY(2px); box-shadow: 0 1px 0 #050505; }

.rodape {
  padding: 8px 14px calc(10px + var(--seguro-base));
  background: #111;
  text-align: center;
  font-family: var(--fonte-painel);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8f7f6f;
}

/* ===================== Cartões (histórico / pedir) ===================== */
.cartao {
  flex: 1;
  border-radius: 14px;
  padding: 16px;
  background: rgba(12, 10, 8, 0.82);
  border: 2px solid #4a2f1c;
  box-shadow: inset 0 0 0 1px #000, 0 8px 20px rgba(0, 0, 0, 0.5);
}
.cartao h2 {
  margin: 0;
  font-family: var(--fonte-painel);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--laranja);
}
.lista-historico { list-style: none; margin: 0; padding: 0; }
.lista-historico li {
  display: flex; align-items: baseline; gap: 12px;
  padding: 11px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 16px;
}
.lista-historico li:first-child { border-top: 0; }
.lista-historico .hora {
  flex: none;
  width: 44px;
  font-family: var(--fonte-painel);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--amarelo);
}
.lista-historico .faixa { min-width: 0; }
.lista-historico .faixa-titulo { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista-historico .faixa-artista { display: block; font-size: 14px; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista-historico .vazio { color: var(--texto-3); font-size: 15px; }

.pedir-texto { margin: 0; font-size: 16.5px; line-height: 1.55; color: var(--texto-2); }
.pedir-texto strong { color: var(--texto); }
.botao-laranja {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ff8126, #e25200);
  color: #fff;
  font-family: var(--fonte-painel);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow: 0 5px 0 var(--laranja-escuro), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.botao-laranja svg { width: 24px; height: 24px; }
.botao-laranja:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--laranja-escuro); }
.pedir-email {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  font-size: 15.5px;
  color: var(--texto-2);
}
.link-botao {
  border: 1px solid rgba(255, 106, 13, 0.6);
  border-radius: 8px;
  background: none;
  padding: 6px 12px;
  color: var(--laranja);
  font-weight: 600;
}

/* ===================== Folhas (menu / timer) ===================== */
.folha { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.folha-fundo { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); animation: aparece 0.2s ease; }
.folha-caixa {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 20px 16px calc(16px + var(--seguro-base));
  border-radius: 22px 22px 0 0;
  background: linear-gradient(180deg, #2a2a2a, #181818);
  border-top: 2px solid #3a3a3a;
  animation: sobe 0.25s ease;
}
.folha-caixa h3 {
  margin: 0 0 14px;
  text-align: center;
  font-family: var(--fonte-painel);
  font-size: 17px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--laranja);
}
.folha-opcoes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.folha-opcoes button, .folha-cancelar, .folha-fechar {
  min-height: 52px;
  padding: 12px 6px;
  border-radius: 10px;
  border: 1px solid #000;
  background: linear-gradient(180deg, #333, #222);
  box-shadow: 0 3px 0 #050505;
  font-size: 16px;
  font-weight: 600;
}
.folha-opcoes button:active { background: #4a2a12; }
.folha-cancelar { width: 100%; margin-top: 10px; color: #ffb4a8; }
.folha-fechar { width: 100%; margin-top: 10px; color: var(--texto-2); background: transparent; box-shadow: none; border-color: #333; }

.menu-lista { display: flex; flex-direction: column; gap: 8px; }
.menu-item {
  display: flex; align-items: center; gap: 14px;
  min-height: 54px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #000;
  background: linear-gradient(180deg, #303030, #222);
  box-shadow: 0 3px 0 #050505;
  color: var(--texto);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  text-align: left;
}
.menu-item svg { width: 24px; height: 24px; flex: none; color: var(--laranja); }
.menu-volume input {
  flex: 1;
  -webkit-appearance: none; appearance: none;
  height: 5px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--laranja) var(--v, 100%), rgba(255, 255, 255, 0.15) var(--v, 100%));
}
.menu-volume input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(180deg, #eee, #aaa);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}
.menu-volume input::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #ddd; }

@keyframes aparece { from { opacity: 0; } }
@keyframes sobe { from { transform: translateY(40px); opacity: 0; } }

/* ===================== Dica iPhone / aviso ===================== */
.dica-ios {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(12px + var(--seguro-base));
  z-index: 20;
  max-width: 436px;
  margin: 0 auto;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 14px 14px 16px;
  border-radius: 14px;
  background: #222;
  border: 1px solid #444;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  font-size: 15px;
  line-height: 1.45;
}
.dica-ios p { margin: 0; flex: 1; }
.dica-ios svg { width: 18px; height: 18px; vertical-align: -3px; color: #4aa3ff; }
.dica-ios button { border: 0; background: none; color: var(--texto-3); font-size: 17px; padding: 2px 4px; }

.aviso {
  position: fixed;
  left: 50%;
  top: calc(16px + var(--seguro-topo));
  transform: translateX(-50%);
  z-index: 40;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 10px;
  background: #2b2b2b;
  border: 1px solid var(--laranja);
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  animation: aparece 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
