:root {
  color-scheme: dark;
  --bg: #0b0b0f;
  --sidebar-bg: #0f0f14;
  --card: #1c1c24;
  --text: #f2f2f2;
  --muted: #9a9aa5;
  --accent: #e50914;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

/* Icones Famicons (SVG como mascara, herdam a cor do texto) */
.fi {
  display: inline-block;
  width: 1em;
  height: 1em;
  background-color: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
  vertical-align: -0.14em;
}
.fi-home { --i: url(img/icons/home.svg); }
.fi-list { --i: url(img/icons/list.svg); }
.fi-settings { --i: url(img/icons/settings.svg); }
.fi-person { --i: url(img/icons/person.svg); }
.fi-play { --i: url(img/icons/play.svg); }
.fi-pause { --i: url(img/icons/pause.svg); }
.fi-close { --i: url(img/icons/close.svg); }
.fi-volume-high { --i: url(img/icons/volume-high.svg); }
.fi-volume-mute { --i: url(img/icons/volume-mute.svg); }
.fi-expand { --i: url(img/icons/expand.svg); }
.fi-arrow-undo-circle { --i: url(img/icons/arrow-undo-circle.svg); }
.fi-arrow-redo-circle { --i: url(img/icons/arrow-redo-circle.svg); }
.fi-download { --i: url(img/icons/download.svg); }
.fi-checkmark { --i: url(img/icons/checkmark.svg); }
.fi-add { --i: url(img/icons/add.svg); }
.fi-share-outline { --i: url(img/icons/share-outline.svg); }

/* Botao instalar (so aparece no celular) */
.install-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  margin-right: 10px;
}
.install-btn.hidden { display: none; }
.topbar-icons { display: flex; align-items: center; }

/* Intro estilo Netflix */

#intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: introFadeOut 0.7s ease forwards;
  animation-delay: 7.3s;
}

#intro-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: introBrandUp 0.5s ease forwards;
  animation-delay: 1.45s;
}

#intro-logo {
  width: clamp(140px, 20vw, 520px);
  opacity: 0;
  transform: scale(0.55);
  animation: introLogoIn 1.3s cubic-bezier(0.22, 0.9, 0.3, 1.2) forwards;
  animation-delay: 0.15s;
}

#intro-name {
  margin-top: clamp(16px, 2.5vw, 56px);
  font-size: clamp(22px, 4.6vw, 120px);
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  animation: introNameIn 0.5s ease forwards;
  animation-delay: 1.5s;
}

#intro-spinner {
  margin-top: clamp(28px, 4vw, 90px);
  width: clamp(40px, 4.2vw, 96px);
  height: clamp(40px, 4.2vw, 96px);
  border-radius: 50%;
  border: clamp(4px, 0.5vw, 11px) solid rgba(229, 9, 20, 0.18);
  border-top-color: #e50914;
  border-right-color: #e50914;
  opacity: 0;
  animation: introSpinnerIn 0.5s ease forwards 1.9s, introSpin 0.9s linear infinite 1.9s;
}

@keyframes introSpin {
  to { transform: rotate(360deg); }
}

@keyframes introSpinnerIn {
  to { opacity: 1; }
}

#intro-skip {
  position: absolute;
  right: 24px;
  bottom: 24px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 8px 18px;
  border-radius: 4px;
  font-size: clamp(13px, 1.5vw, 32px);
  cursor: pointer;
  opacity: 0;
  animation: introSkipIn 0.4s ease forwards;
  animation-delay: 1s;
}

#intro-skip:hover {
  background: rgba(255, 255, 255, 0.2);
}

@keyframes introLogoIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
    filter: drop-shadow(0 0 0 rgba(229, 9, 20, 0));
  }
  55% {
    opacity: 1;
    transform: scale(1.1);
    filter: drop-shadow(0 0 46px rgba(229, 9, 20, 0.65));
  }
  78% {
    transform: scale(0.96);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: drop-shadow(0 0 26px rgba(229, 9, 20, 0.4));
  }
}

@keyframes introSkipIn {
  to { opacity: 1; }
}

@keyframes introBrandUp {
  to { transform: translateY(-20px); }
}

@keyframes introNameIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes introFadeOut {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  #intro, #intro-brand, #intro-logo, #intro-name, #intro-skip, #intro-spinner {
    animation: none !important;
  }
  #intro {
    opacity: 0;
    pointer-events: none;
  }
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  font-size: 18px;
  letter-spacing: 1px;
  margin-bottom: 32px;
  padding: 0 8px;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  flex-shrink: 0;
}

.logo-badge img {
  width: 100%;
  height: auto;
  display: block;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
}

.nav-item .icon {
  width: 18px;
  text-align: center;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: var(--text);
  background: rgba(229, 9, 20, 0.15);
  border-left: 3px solid var(--accent);
}

/* Content */

.content {
  flex: 1;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
}

.search-box input {
  background: var(--card);
  border: 1px solid #2a2a34;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  width: 260px;
  font-size: 14px;
}

.topbar-icons .icon {
  font-size: 18px;
  color: var(--muted);
}

main#app {
  padding: 0 32px 48px;
}

#status {
  color: var(--muted);
}

.demo-banner {
  background: rgba(229, 9, 20, 0.12);
  border: 1px solid rgba(229, 9, 20, 0.4);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 20px;
}

.demo-banner a {
  color: var(--accent);
  font-weight: 600;
  margin-left: 6px;
}

/* Hero */

.hero {
  position: relative;
  height: 46vh;
  min-height: 320px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 40px;
}

.hero.hidden {
  display: none;
}

.hero-bg {
  position: absolute;
  inset: -6% -4%;
  width: 108%;
  height: 112%;
  object-fit: cover;
  will-change: transform, opacity;
}

.hero-bg-a { z-index: 1; }
.hero-bg-b { z-index: 2; opacity: 0; }

.hero-dots {
  position: absolute;
  right: 32px;
  bottom: 32px;
  display: flex;
  gap: 8px;
  z-index: 3;
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.hero-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(11,11,15,0.95) 10%, rgba(11,11,15,0.3) 60%, transparent 100%),
              linear-gradient(0deg, rgba(11,11,15,0.9) 0%, transparent 40%);
}

.hero-info {
  position: absolute;
  left: 40px;
  bottom: 40px;
  max-width: 500px;
  z-index: 3;
}

.hero-title {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 20px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.hero-actions {
  display: flex;
  gap: 12px;
}

.btn {
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.btn-secondary:hover { background: rgba(255,255,255,0.25); }
.btn-primary:hover { background: #f6121d; }

/* Rows */

.row {
  margin-bottom: 36px;
}

.row-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.row-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.card {
  background: var(--card);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  flex: 0 0 220px;
}

.card:hover, .card:focus {
  outline: 2px solid var(--accent);
  z-index: 2;
}

.card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
  display: block;
}

.card .title {
  padding: 8px 10px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Player overlay */

.player-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.player-overlay.hidden {
  display: none;
}

.player-overlay video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.player-spinner {
  position: absolute;
  width: 56px;
  height: 56px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  z-index: 50;
  pointer-events: none;
}

.player-spinner.hidden { display: none; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Player custom UI */

.player-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 101;
  opacity: 1;
  transition: opacity 0.3s ease;
  background: linear-gradient(0deg, rgba(0,0,0,0.75) 0%, transparent 25%, transparent 75%, rgba(0,0,0,0.55) 100%);
}

.player-ui.controls-hidden {
  opacity: 0;
  cursor: none;
}

.player-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
}

.player-video-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.player-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
}

.icon-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.15s ease;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.15);
}

.icon-btn.big { font-size: 22px; }
.icon-btn.huge { font-size: 36px; width: 64px; height: 64px; }

.skip-btn {
  flex-direction: column;
  gap: 1px;
  width: 52px;
  height: 52px;
}

.skip-num {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.skip-icon {
  font-size: 24px;
  line-height: 1;
}

.player-bottom {
  padding: 0 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar {
  position: relative;
  height: 5px;
  background: rgba(255,255,255,0.25);
  border-radius: 3px;
  cursor: pointer;
}

.progress-bar:hover { height: 7px; }

.progress-buffered {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: rgba(255,255,255,0.35);
  border-radius: 3px;
}

.progress-played {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
}

.progress-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 13px;
  height: 13px;
  background: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.player-controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.time {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: #ddd;
}

.time-sep { color: #888; }

.controls-spacer { flex: 1; }

.volume-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.volume-slider {
  width: 80px;
  accent-color: var(--accent);
}

.speed-select {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 13px;
  cursor: pointer;
}

.speed-select option { color: #000; }

.auth-box {
  padding: 24px;
  background: var(--card);
  border-radius: 8px;
  max-width: 420px;
}

.auth-box a {
  color: var(--accent);
  font-weight: bold;
}

/* ===== Adaptativo: PC / Tablet / Celular / TV ===== */

/* Foco bem visível pra navegação por teclado/controle remoto (TV) */
.card:focus-visible,
.nav-item:focus-visible,
.icon-btn:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Tablet / janela média: sidebar vira só ícones */
@media (max-width: 800px) {
  .sidebar { width: 72px; }
  .logo-text { display: none; }
  .nav-item span:last-child { display: none; }
  .nav-item { justify-content: center; }
  .search-box input { width: 160px; }
}

/* Celular: sidebar vira barra inferior fixa, layout em coluna única */
@media (max-width: 640px) {
  .layout { flex-direction: column; }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    z-index: 50;
    border-top: 1px solid #222;
  }

  .logo { display: none; }

  .sidebar nav {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
  }

  .nav-item {
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    padding: 6px 4px;
    border-left: none;
  }

  .nav-item.active {
    border-left: none;
    border-top: 3px solid var(--accent);
  }

  .content { padding-bottom: 64px; }

  .topbar { padding: 14px 16px; }
  .search-box { flex: 1; min-width: 0; margin-right: 10px; }
  .search-box input { width: 100%; }

  main#app { padding: 0 16px 32px; }

  .hero { height: 34vh; min-height: 220px; border-radius: 8px; }
  .hero-info { left: 16px; bottom: 20px; max-width: calc(100% - 32px); }
  .hero-title { font-size: 22px; margin-bottom: 12px; }
  .btn { padding: 8px 14px; font-size: 13px; }

  .card { flex: 0 0 150px; }

  .row-title { font-size: 15px; }

  .player-top { padding: 14px; }
  .player-center { gap: 24px; }
  .icon-btn.huge { font-size: 28px; width: 52px; height: 52px; }
  .skip-btn { width: 44px; height: 44px; }
  .skip-icon { font-size: 20px; }
  .player-bottom { padding: 0 14px 72px; }
  .speed-group { display: none; }
}

/* Dispositivos de toque (celular/tablet): alvos maiores, sem slider fino de volume */
@media (hover: none) and (pointer: coarse) {
  .icon-btn { padding: 12px; }
  .volume-slider { display: none; }
  .card { cursor: pointer; }
  .progress-bar { height: 7px; }
  .progress-handle { width: 16px; height: 16px; }
}

/* TV / tela grande (10-foot UI, ~52 pol): tudo bem maior */
@media (min-width: 1600px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60;
    width: 128px; padding: 48px 24px; overflow: hidden;
    transition: width 0.25s ease, box-shadow 0.25s ease;
  }
  .sidebar.open, .sidebar:hover {
    width: 380px;
    box-shadow: 12px 0 60px rgba(0, 0, 0, 0.85);
  }
  .content { margin-left: 128px; }
  .logo-text, .nav-label { white-space: nowrap; opacity: 0; transition: opacity 0.2s ease; }
  .sidebar.open .logo-text, .sidebar.open .nav-label,
  .sidebar:hover .logo-text, .sidebar:hover .nav-label { opacity: 1; }
  .logo { font-size: 38px; gap: 18px; margin-bottom: 56px; letter-spacing: 2px; }
  .logo-badge { width: 72px; }
  .nav-item { font-size: 26px; padding: 20px 22px; gap: 24px; border-radius: 10px; }
  .nav-item .icon { width: 32px; font-size: 26px; }

  main#app { padding: 0 56px 72px; }
  .search-box input { font-size: 22px; width: 380px; padding: 14px 20px; }
  .topbar-icons .icon { font-size: 30px; }

  .hero { height: 56vh; }
  .hero-title { font-size: 64px; }
  .btn { font-size: 26px; padding: 18px 40px; }

  .card { flex: 0 0 400px; }
  .card .title { font-size: 22px; padding: 14px 16px; }
  .row-title { font-size: 34px; }

  .row-track { padding: 16px 12px 24px; scroll-behavior: auto; }
  .card:focus { outline: 5px solid var(--accent); transform: scale(1.08); }
  .btn:focus, .nav-item:focus, .search-box input:focus {
    outline: 5px solid var(--accent); outline-offset: 4px;
  }
  .nav-item:focus { background: rgba(229, 9, 20, 0.25); color: var(--text); }
}
