/* ============================================================================
   Player — design system da tela (v8)
   Painel claro premium com UM card escuro de contraste (bolsa). Mídia com
   backdrop desfocado. Tipografia forte, números tabulares, ícones em SVG.
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --yellow: #0064FE;
  --bg: #08080a;

  /* Painel claro */
  --panel: #f5f6f8;
  --card: #ffffff;
  --line: #e7e8ec;
  --ink: #14151a;
  --muted: #63656f;
  --faint: #9a9ca6;

  /* Card escuro (bolsa) */
  --fin-bg: #0e0f14;
  --fin-line: rgba(255, 255, 255, 0.08);
  --fin-text: #ffffff;
  --fin-muted: #b7b9c4;

  --up: #10b981;
  --down: #ef4444;
  --radius: clamp(14px, 1.9vmin, 22px);
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.screen {
  height: 100vh;
  width: 100vw;
}

/* ── Boot / Pareamento ─────────────────────────────────────────────────── */
#boot,
#pairing {
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 800px at 50% -10%, #17181d, var(--bg));
  color: #fff;
}

.pair-box {
  text-align: center;
  max-width: 90vw;
}

.logo {
  font-size: clamp(44px, 7vmin, 72px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
}
.logo span {
  color: var(--yellow);
}

.pair-label {
  margin-top: 28px;
  color: #b9b9c0;
  font-size: clamp(18px, 2.8vmin, 28px);
}

.pair-code {
  margin-top: 24px;
  font-size: clamp(64px, 11vmin, 120px);
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--yellow);
  font-variant-numeric: tabular-nums;
}

.pair-hint {
  margin-top: 12px;
  color: #74757c;
  font-size: clamp(14px, 2.1vmin, 21px);
}

.pair-status {
  margin-top: 28px;
  color: #74757c;
  font-size: clamp(13px, 1.9vmin, 19px);
}

/* ── Estrutura da exibição ─────────────────────────────────────────────── */
#screen {
  display: flex;
  flex-direction: column;
}

#main {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

/* ── Zona da mídia ─────────────────────────────────────────────────────── */
#stage {
  flex: 1 1 auto;
  position: relative;
  background: #000;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

#stage-media {
  position: absolute;
  inset: 0;
}

/* Camada de mídia com CROSSFADE. Cada anúncio entra numa camada própria,
   sobreposta à anterior; só quando está 100% carregado fazemos o fade (opacity
   0 → 1). Assim a tela NUNCA pisca preto entre um anúncio e outro. */
.stage-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  will-change: opacity;
}

.stage-layer.is-visible {
  opacity: 1;
}

/* Fundo: a PRÓPRIA arte esticada (cover) e desfocada, preenchendo a zona sem
   faixas pretas. O scale evita as bordas transparentes que o blur criaria. */
.stage-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.12);
  filter: blur(30px) brightness(0.5);
}

/* Frente: a arte INTEIRA (contain), sem corte, centralizada sobre o fundo. */
.stage-fg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Painel de informações (claro) ─────────────────────────────────────── */
#sidebar {
  background: var(--panel);
  color: var(--ink);
  display: grid;
  gap: clamp(10px, 1.5vmin, 16px);
  padding: clamp(14px, 2.2vmin, 26px);
  overflow: hidden;
}

@media (orientation: landscape) {
  #sidebar {
    width: clamp(300px, 28vw, 480px);
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "clock"
      "finance"
      "news";
  }
}

@media (orientation: portrait) {
  #main {
    flex-direction: column;
  }
  #sidebar {
    width: 100%;
    height: clamp(280px, 37vh, 560px);
    grid-template-columns: 1fr 1.05fr;
    grid-template-rows: 1fr auto;
    grid-template-areas:
      "news    news"
      "clock   finance";
  }
}

.sb-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(14px, 2vmin, 24px);
  box-shadow: 0 1px 2px rgba(16, 17, 26, 0.04), 0 8px 24px rgba(16, 17, 26, 0.04);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.sb-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(10px, 1.35vmin, 14px);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
}

.sb-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--yellow);
  flex-shrink: 0;
}

/* Relógio + data + clima */
#sb-clock {
  grid-area: clock;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 1.8vmin, 22px);
}

.clock-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#clock {
  font-size: clamp(46px, 7.2vmin, 108px);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

#datebar {
  margin-top: clamp(8px, 1.3vmin, 16px);
  font-size: clamp(13px, 2vmin, 24px);
  font-weight: 500;
  color: var(--muted);
  line-height: 1.25;
}

.weather-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

#weather-desc {
  margin-top: clamp(3px, 0.6vmin, 7px);
  font-size: clamp(11px, 1.5vmin, 18px);
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--faint);
  white-space: nowrap;
}

.clock-weather {
  display: flex;
  align-items: center;
  align-self: center;
  gap: clamp(6px, 1vmin, 12px);
  flex-shrink: 0;
  padding-left: clamp(10px, 1.6vmin, 20px);
  border-left: 1px solid var(--line);
}

#weather-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(34px, 4.8vmin, 60px);
  height: clamp(34px, 4.8vmin, 60px);
}

#weather-icon svg {
  width: 100%;
  height: 100%;
}

#weather-temp {
  font-size: clamp(26px, 4vmin, 54px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* Mercado — o único card escuro (contraste tipo bolsa) */
.sb-finance {
  grid-area: finance;
  background: var(--fin-bg);
  border-color: transparent;
  color: var(--fin-text);
  box-shadow: 0 10px 30px rgba(8, 9, 14, 0.28);
}

.sb-finance .sb-label {
  color: #8a8c98;
}

#finance-rows {
  margin-top: clamp(8px, 1.3vmin, 16px);
}

.fin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: clamp(6px, 1vmin, 12px) 0;
}

.fin-row + .fin-row {
  border-top: 1px solid var(--fin-line);
}

.fin-name {
  font-size: clamp(13px, 1.9vmin, 21px);
  font-weight: 500;
  color: var(--fin-muted);
}

.fin-val {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vmin, 14px);
  font-size: clamp(14px, 2.1vmin, 23px);
  font-weight: 700;
  color: var(--fin-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fin-pct {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, 0.5vmin, 6px);
  font-size: clamp(10px, 1.5vmin, 16px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: clamp(3px, 0.5vmin, 6px) clamp(8px, 1.1vmin, 12px);
  border-radius: 999px;
  min-width: clamp(64px, 8vmin, 92px);
}
.fin-arrow {
  font-size: 0.82em;
  line-height: 1;
}
.fin-pct.up {
  color: #34d399;
  background: rgba(52, 211, 153, 0.16);
}
.fin-pct.down {
  color: #fb7185;
  background: rgba(251, 113, 133, 0.16);
}
.fin-pct.flat {
  color: #9aa0ad;
  background: rgba(255, 255, 255, 0.06);
}

/* Notícias */
.sb-news {
  grid-area: news;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.5vmin, 18px);
}

.news-head {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vmin, 14px);
}

.news-tag {
  color: var(--faint);
}

.news-source {
  font-size: clamp(9px, 1.2vmin, 13px);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 2px clamp(6px, 0.9vmin, 10px);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}
.news-source:empty {
  display: none;
}

#news-photo {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: clamp(120px, 24vmin, 260px);
  object-fit: cover;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid var(--line);
  background: #eef0f3;
  flex-shrink: 0;
}

/* Paisagem: a foto cresce para preencher o card (sem vazio) */
@media (orientation: landscape) {
  #news-photo {
    flex: 1 1 auto;
    aspect-ratio: auto;
    max-height: none;
    min-height: 0;
  }
}

#news-headline {
  font-size: clamp(17px, 2.5vmin, 30px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-shrink: 0;
}

@media (orientation: portrait) {
  .sb-news {
    display: grid;
    grid-template-columns: clamp(190px, 31%, 360px) 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "tag  tag"
      "photo headline";
    column-gap: clamp(14px, 2.2vmin, 26px);
    row-gap: clamp(8px, 1.3vmin, 14px);
    align-items: center;
  }
  .news-head {
    grid-area: tag;
  }
  #news-photo {
    grid-area: photo;
    height: 100%;
    width: 100%;
    aspect-ratio: auto;
  }
  #news-headline {
    grid-area: headline;
    align-self: center;
    -webkit-line-clamp: 3;
  }
  .sb-news.no-photo {
    grid-template-columns: 1fr;
    grid-template-areas:
      "tag"
      "headline";
  }
}

#news-photo.news-in,
#news-headline.news-in {
  animation: news-fade 0.55s ease-out;
}

@keyframes news-fade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Slide de comunicado ───────────────────────────────────────────────── */
.notice-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8%;
  background: radial-gradient(1100px 700px at 50% -8%, #1b1c22, var(--bg));
  color: #fff;
}

.notice-badge {
  background: var(--yellow);
  color: #0b0b0c;
  font-weight: 700;
  font-size: clamp(13px, 1.9vmin, 20px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: clamp(6px, 1vmin, 10px) clamp(16px, 2.4vmin, 26px);
  border-radius: 999px;
  margin-bottom: clamp(20px, 3.4vmin, 40px);
}

.notice-slide[data-priority="urgent"] .notice-badge {
  background: #f43f5e;
  color: #fff;
}

.notice-slide h2 {
  font-size: clamp(34px, 5.6vmin, 64px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin-bottom: clamp(14px, 2.4vmin, 28px);
}

.notice-slide p {
  font-size: clamp(18px, 2.9vmin, 32px);
  color: #c2c3ca;
  line-height: 1.45;
  max-width: 82%;
}

/* Comunicado fixo urgente (faixa acima do ticker) */
#notice {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(10px, 1.6vmin, 18px) 28px;
  background: #15161b;
  border-top: 2px solid var(--yellow);
  color: #fff;
  font-size: clamp(15px, 2.2vmin, 24px);
  font-weight: 600;
}

/* ── Ticker inferior ───────────────────────────────────────────────────── */
#ticker {
  flex: 0 0 clamp(46px, 5.6vmin, 66px);
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #ff5e3a 0%, #ff2a68 55%, #e5308f 100%);
  color: #fff;
  font-weight: 600;
  font-size: clamp(15px, 2.1vmin, 22px);
  letter-spacing: -0.005em;
  overflow: hidden;
  white-space: nowrap;
}

#ticker-track {
  display: inline-block;
  white-space: nowrap;
  animation: scroll 80s linear infinite;
  padding-left: 100%;
}

@keyframes scroll {
  to {
    transform: translateX(-100%);
  }
}
