/* ============================================
   KidFlix - Main Interface Styles
   ============================================ */

:root {
  --primary: #FF6B35;
  --secondary: #FFD60A;
  --accent: #2EC4B6;
  --purple: #7B2FBE;
  --green: #06D6A0;
  --bg: #0D0D2B;
  --bg2: #1A1A3E;
  --bg3: #12122a;
  --card-bg: rgba(255,255,255,0.06);
  --card-border: rgba(255,255,255,0.12);
  --text: #ffffff;
  --text-dim: rgba(255,255,255,0.6);
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,0.5);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ===== LAYOUT PRINCIPAL ===== */
#app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 1fr;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

/* ===== TOPBAR ===== */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.2rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.8), transparent);
  position: relative;
  z-index: 10;
  gap: 1rem;
}

.logo-brand {
  font-family: 'Baloo 2', cursive;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  animation: logoFloat 3.5s ease-in-out infinite;
  cursor: default;
  user-select: none;
}
.logo-brand .kid  { color: var(--secondary); text-shadow: 0 0 12px rgba(255,214,10,0.5); }
.logo-brand .flix { color: var(--primary);   text-shadow: 0 0 12px rgba(255,107,53,0.5); }
@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%       { transform: translateY(-3px) rotate(-1deg); }
}

.channel-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 40px;
  padding: 0.4rem 1rem;
  flex: 1;
  max-width: 320px;
}

.channel-num {
  font-family: 'Baloo 2', cursive;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--secondary);
  min-width: 28px;
}

.channel-icon { font-size: 1.2rem; }

.channel-name {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--card-border);
  background: var(--card-bg);
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-icon:hover {
  background: rgba(255,255,255,0.15);
  border-color: var(--primary);
  transform: scale(1.1);
}

/* ===== PLAYER AREA ===== */
#player-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

#yt-player-wrapper {
  position: absolute;
  /* Oversizing: expande além do container para cortar
     a barra superior (título/logo YouTube) e a barra
     inferior (barra de progresso/controles).
     Valor de ~12% cobre as barras em qualquer resolução. */
  top: -12%;
  left: -2%;
  width: 104%;
  height: 124%;
  pointer-events: none; /* bloqueia cliques no iframe */
}

#yt-player-wrapper iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
  pointer-events: none;
}

/* Camada bloqueadora transparente sobre o iframe:
   impede qualquer interação nativa com o player YouTube */
#player-blocker {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: transparent;
  cursor: default;
}

/* Overlay de efeitos TV */
#tv-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

/* Efeito Scanlines */
#tv-overlay.scanlines::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.1) 2px,
    rgba(0,0,0,0.1) 4px
  );
  pointer-events: none;
}

/* Efeito Noise */
#tv-overlay.noise::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  animation: noiseAnim 0.2s steps(2) infinite;
  mix-blend-mode: overlay;
}
@keyframes noiseAnim {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(-1px, 2px); }
  100% { transform: translate(1px, -2px); }
}

/* Efeito Glitch */
#tv-overlay.glitch {
  animation: glitchAnim 4s infinite;
}
@keyframes glitchAnim {
  0%, 90%, 100% { opacity: 1; transform: none; }
  91% { transform: skewX(1deg) scaleX(1.01); opacity: 0.95; }
  92% { transform: skewX(-1.5deg) translateX(3px); filter: hue-rotate(90deg); }
  93% { transform: none; opacity: 1; filter: none; }
  95% { transform: translateX(-2px) scaleY(1.005); }
  96% { transform: none; }
}

/* Efeito Distortion */
#tv-overlay.distortion {
  animation: distortAnim 6s ease-in-out infinite;
}
@keyframes distortAnim {
  0%, 100% { filter: none; }
  45% { filter: blur(0.4px) brightness(1.05); }
  50% { filter: blur(0.8px) contrast(1.1) saturate(1.2); }
  55% { filter: blur(0.4px) brightness(1.05); }
}

/* Efeito Interference */
#tv-overlay.interference::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,0.5);
  animation: interferenceAnim 3s linear infinite;
}
@keyframes interferenceAnim {
  0% { top: -4px; opacity: 0.7; }
  100% { top: calc(100% + 4px); opacity: 0.3; }
}

/* Tela de transição */
#transition-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

#transition-overlay.active {
  opacity: 1;
  pointer-events: all;
}

#transition-overlay img,
#transition-overlay video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

#transition-overlay video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

/* Feedback de canal */
#channel-feedback {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  background: linear-gradient(135deg, rgba(10,10,40,0.95), rgba(20,20,60,0.95));
  border: 3px solid var(--secondary);
  border-radius: 24px;
  padding: 1.2rem 2.4rem;
  text-align: center;
  z-index: 30;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
  box-shadow: 0 0 40px rgba(255,214,10,0.3), 0 8px 40px rgba(0,0,0,0.6);
}

#channel-feedback.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

#channel-feedback .cf-num {
  font-family: 'Baloo 2', cursive;
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--secondary);
  line-height: 1;
  text-shadow: 0 0 20px rgba(255,214,10,0.6);
}
#channel-feedback .cf-name {
  font-family: 'Baloo 2', cursive;
  font-size: 1.2rem;
  font-weight: 800;
  margin-top: 0.3rem;
  color: white;
}
#channel-feedback .cf-icon {
  font-size: 2.5rem;
  animation: iconBounce 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes iconBounce {
  0%   { transform: scale(0.3) rotate(-15deg); }
  60%  { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

/* Indicador de digitação de canal */
#channel-input-display {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0,0,0,0.8);
  border: 2px solid var(--secondary);
  border-radius: 12px;
  padding: 0.5rem 1rem;
  font-family: 'Baloo 2', cursive;
  font-size: 2rem;
  font-weight: 800;
  color: var(--secondary);
  z-index: 30;
  display: none;
  min-width: 60px;
  text-align: center;
}
#channel-input-display.active { display: block; }

/* ===== CONTROLE REMOTO ===== */
#remote-panel {
  background: linear-gradient(180deg, #1a1a48, #0e0e2a);
  border-top: 2px solid var(--card-border);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 10;
  position: relative;
  /* Padrão de bolinhas decorativo */
  background-image:
    linear-gradient(180deg, #1a1a48, #0e0e2a),
    radial-gradient(circle, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 100% 100%, 22px 22px;
}

/* Grade de botões numéricos */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  flex-shrink: 0;
}

.btn-num {
  --c: var(--primary);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 2px solid var(--c);
  background: rgba(255,255,255,0.04);
  color: var(--c);
  font-family: 'Baloo 2', cursive;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s cubic-bezier(0.34,1.56,0.64,1);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
/* Cores arco-íris */
.btn-num:nth-child(1)  { --c: #FF6B6B; }
.btn-num:nth-child(2)  { --c: #FFD93D; }
.btn-num:nth-child(3)  { --c: #6BCB77; }
.btn-num:nth-child(4)  { --c: #FF9F43; }
.btn-num:nth-child(5)  { --c: #2EC4B6; }
.btn-num:nth-child(6)  { --c: #B388FF; }
.btn-num:nth-child(7)  { --c: #FF6B6B; }
.btn-num:nth-child(8)  { --c: #FFD93D; }
.btn-num:nth-child(9)  { --c: #6BCB77; }
.btn-num:nth-child(10) { --c: #2EC4B6; }

.btn-num:hover {
  background: color-mix(in srgb, var(--c) 20%, transparent);
  transform: scale(1.08) rotate(-2deg);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--c) 40%, transparent);
}
.btn-num:active, .btn-num.pressed {
  background: var(--c);
  border-color: var(--c);
  color: #000;
  transform: scale(0.88);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--c) 60%, transparent);
}

/* Controles centrais */
.center-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.channel-nav {
  display: flex;
  gap: 0.5rem;
}

.btn-nav {
  padding: 0.5rem 1.2rem;
  border-radius: 40px;
  border: 2px solid var(--card-border);
  background: var(--card-bg);
  color: white;
  font-family: 'Baloo 2', cursive;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  white-space: nowrap;
}

.btn-nav.prev {
  background: linear-gradient(135deg, rgba(123,47,190,0.3), rgba(123,47,190,0.1));
  border-color: var(--purple);
  color: #c9a0ff;
}
.btn-nav.next {
  background: linear-gradient(135deg, rgba(255,107,53,0.3), rgba(255,107,53,0.1));
  border-color: var(--primary);
  color: #ffb09a;
}

.btn-nav:hover { transform: scale(1.06); filter: brightness(1.15); }
.btn-nav:active { transform: scale(0.9); filter: brightness(1.3); }

/* Controle de volume */
.volume-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 40px;
  padding: 0.3rem 0.8rem;
}

.btn-vol {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-vol:active { transform: scale(0.85); background: var(--accent); }

.volume-bar {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 20px;
}

.volume-bar-seg {
  width: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
  transition: background 0.2s, height 0.2s, transform 0.2s;
}
/* Arco-íris no volume */
.volume-bar-seg:nth-child(1).active  { background: #06D6A0; }
.volume-bar-seg:nth-child(2).active  { background: #2EC4B6; }
.volume-bar-seg:nth-child(3).active  { background: #3A86FF; }
.volume-bar-seg:nth-child(4).active  { background: #7B2FBE; }
.volume-bar-seg:nth-child(5).active  { background: #FF6B35; }
.volume-bar-seg:nth-child(6).active  { background: #FFD60A; }
.volume-bar-seg:nth-child(7).active  { background: #FF8E53; }
.volume-bar-seg:nth-child(8).active  { background: #FF6B6B; box-shadow: 0 0 6px #FF6B6B88; }

/* Botão lista canais + cast */
.side-controls {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-action {
  padding: 0.55rem 0.85rem;
  border-radius: 14px;
  border: 2px solid var(--card-border);
  background: var(--card-bg);
  color: white;
  font-family: 'Baloo 2', cursive;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn-action:hover  { transform: scale(1.05); }
.btn-action:active { transform: scale(0.91); }

.btn-action.channels-btn {
  border-color: var(--secondary);
  color: var(--secondary);
  background: rgba(255,214,10,0.08);
  box-shadow: 0 0 10px rgba(255,214,10,0.15);
}
.btn-action.channels-btn:hover {
  background: rgba(255,214,10,0.18);
  box-shadow: 0 0 16px rgba(255,214,10,0.3);
}
.btn-action.cast-btn {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(46,196,182,0.08);
  box-shadow: 0 0 10px rgba(46,196,182,0.15);
}
.btn-action.cast-btn:hover {
  background: rgba(46,196,182,0.18);
  box-shadow: 0 0 16px rgba(46,196,182,0.3);
}

/* ===== MODAL BASE (compartilhado) ===== */
.modal-base {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-base.open {
  opacity: 1;
  pointer-events: all;
}

.modal-handle {
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.25);
  margin: 0 auto 1.2rem;
}

/* ===== MODAL GRADE DE CANAIS ===== */
#channels-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
#channels-modal.open {
  opacity: 1;
  pointer-events: all;
}

.channels-panel {
  background: linear-gradient(160deg, #1e1e4a, #12122e);
  border: 2px solid var(--card-border);
  border-bottom: none;
  border-radius: 28px 28px 0 0;
  padding: 1rem 1.2rem 1.5rem;
  width: 100%;
  max-width: 700px;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#channels-modal.open .channels-panel {
  transform: translateY(0);
}

.channels-panel h3 {
  font-family: 'Baloo 2', cursive;
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--secondary);
}

/* ── Lista desktop (padrão) ── */
.channels-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 55vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--card-border) transparent;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--card-border);
  background: var(--card-bg);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.channel-item:hover {
  border-color: var(--secondary);
  background: rgba(255,214,10,0.1);
  transform: translateX(4px);
}
.channel-item.active {
  border-color: var(--secondary);
  background: rgba(255,214,10,0.12);
  box-shadow: 0 0 0 1px var(--secondary), 0 4px 20px rgba(255,214,10,0.15);
}

.ci-num {
  font-family: 'Baloo 2', cursive;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--secondary);
  min-width: 28px;
}
.ci-icon { font-size: 1.5rem; }
.ci-name { font-weight: 700; font-size: 1rem; flex: 1; }
.ci-playing {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.05em;
  background: rgba(46,196,182,0.15);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }

.btn-close-modal {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--card-border);
  background: transparent;
  color: var(--text-dim);
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-close-modal:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

/* ── Grid mobile para canal ── */
@media (max-width: 600px) {
  .channels-panel { padding: 0.8rem 0.9rem 1.2rem; }

  .channels-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
    max-height: 60vh;
  }

  .channel-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 0.6rem;
    gap: 0.4rem;
    border-radius: 18px;
  }
  .channel-item:hover { transform: scale(1.03); }

  .ci-num {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    min-width: unset;
  }
  .ci-icon { font-size: 2.4rem; }
  .ci-name { font-size: 0.85rem; font-weight: 800; }
  .ci-playing {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
  }
}

/* ===== MODAL TRANSMITIR ===== */
#cast-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
#cast-modal.open {
  opacity: 1;
  pointer-events: all;
}

.cast-panel {
  background: linear-gradient(160deg, #1e1e4a, #12122e);
  border: 2px solid var(--card-border);
  border-bottom: none;
  border-radius: 28px 28px 0 0;
  padding: 1rem 1.5rem 1.8rem;
  width: 100%;
  max-width: 540px;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#cast-modal.open .cast-panel {
  transform: translateY(0);
}

.cast-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.cast-big-icon { font-size: 2rem; }
.cast-header h3 {
  font-family: 'Baloo 2', cursive;
  font-size: 1.3rem;
  color: var(--accent);
}
.cast-subtitle {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 1.2rem;
}

.cast-options {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.cast-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--card-border);
  background: var(--card-bg);
  transition: all 0.2s;
}
.cast-option:hover {
  border-color: var(--accent);
  background: rgba(46,196,182,0.08);
}

.cast-opt-icon { font-size: 1.8rem; flex-shrink: 0; }
.cast-opt-info strong { display: block; font-size: 0.95rem; font-weight: 800; }
.cast-opt-info p { font-size: 0.78rem; color: var(--text-dim); margin-top: 0.1rem; }

/* ===== MODAL CONFIRMAR SAÍDA ===== */
#logout-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
#logout-modal.open {
  opacity: 1;
  pointer-events: all;
}

.confirm-panel {
  background: linear-gradient(160deg, #1e1e4a, #12122e);
  border: 2px solid var(--card-border);
  border-radius: 28px;
  padding: 2rem 2rem 1.5rem;
  width: 90%;
  max-width: 360px;
  text-align: center;
  transform: scale(0.85);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#logout-modal.open .confirm-panel {
  transform: scale(1);
}

.confirm-emoji {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  animation: wobble 0.5s ease;
}
@keyframes wobble {
  0%,100% { transform: rotate(0); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}
.confirm-panel h3 {
  font-family: 'Baloo 2', cursive;
  font-size: 1.4rem;
  margin-bottom: 0.3rem;
  color: var(--secondary);
}
.confirm-panel > p {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.confirm-actions {
  display: flex;
  gap: 0.75rem;
}
.btn-confirm-cancel, .btn-confirm-ok {
  flex: 1;
  padding: 0.8rem;
  border-radius: 14px;
  border: 2px solid;
  font-family: 'Baloo 2', cursive;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-confirm-cancel {
  border-color: var(--green);
  background: rgba(6,214,160,0.12);
  color: var(--green);
}
.btn-confirm-cancel:hover { background: rgba(6,214,160,0.22); transform: scale(1.03); }
.btn-confirm-ok {
  border-color: #ff6b6b;
  background: rgba(255,107,107,0.12);
  color: #ff6b6b;
}
.btn-confirm-ok:hover { background: rgba(255,107,107,0.22); transform: scale(1.03); }

/* ===== MODO TV ===== */
#tv-mode-btn { display: none; }

body.tv-mode #remote-panel {
  display: none;
}

body.tv-mode #topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.8s ease;
  background: linear-gradient(180deg, rgba(0,0,0,0.85), transparent);
}
body.tv-mode #topbar:hover,
body.tv-mode #app:hover #topbar {
  opacity: 1;
}

/* Em fullscreen o grid vira 1 coluna só com player */
body.tv-mode #app {
  grid-template-rows: 1fr;
  grid-template-columns: 1fr;
  position: relative;
}
body.tv-mode #player-container {
  grid-row: 1;
  grid-column: 1;
}

/* Ícone do botão muda para indicar estado */
.btn-icon[title="Modo TV"] {
  transition: all 0.2s;
}
body.tv-mode .btn-icon[title="Modo TV"] {
  background: rgba(255,214,10,0.2);
  border-color: var(--secondary);
  color: var(--secondary);
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 480px) {
  #topbar { padding: 0.5rem 0.8rem; }
  .logo-brand { font-size: 1.3rem; }
  .channel-info { max-width: 200px; }

  .btn-num { width: 34px; height: 34px; font-size: 1rem; }
  .numpad { gap: 3px; }

  .btn-nav { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
  .btn-action { font-size: 0.7rem; padding: 0.4rem 0.6rem; }

  #remote-panel { padding: 0.6rem 0.7rem; gap: 0.6rem; }
}

@media (min-width: 1024px) {
  #app {
    grid-template-columns: 1fr 280px;
    grid-template-rows: auto 1fr;
  }

  #topbar {
    grid-column: 1 / -1;
  }

  #player-container {
    grid-column: 1;
    grid-row: 2;
  }

  #remote-panel {
    grid-column: 2;
    grid-row: 2;
    flex-direction: column;
    justify-content: flex-start;
    padding: 1.5rem 1rem;
    border-top: none;
    border-left: 2px solid var(--card-border);
    gap: 1.5rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--card-border) transparent;
  }

  .center-controls { width: 100%; }
  .channel-nav { width: 100%; }
  .btn-nav { flex: 1; justify-content: center; }
  .numpad { width: 100%; }
  .btn-num { width: 100%; height: 48px; border-radius: 14px; }
  .side-controls { flex-direction: column; width: 100%; }
  .btn-action { width: 100%; justify-content: center; padding: 0.7rem; }
  .volume-control { width: 100%; justify-content: center; }
}

/* ===== EXTRAS VISUAIS INFANTIS ===== */

/* Topbar com gradiente mais rico */
#topbar {
  background: linear-gradient(180deg,
    rgba(5,5,25,0.92) 0%,
    rgba(13,13,43,0.6) 70%,
    transparent 100%);
}

/* Scrollbar colorida para o remote lateral */
#remote-panel::-webkit-scrollbar { width: 4px; }
#remote-panel::-webkit-scrollbar-track { background: transparent; }
#remote-panel::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 4px; }

/* Scrollbar colorida para lista de canais */
.channels-list::-webkit-scrollbar { width: 4px; }
.channels-list::-webkit-scrollbar-track { background: transparent; }
.channels-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--primary));
  border-radius: 4px;
}

/* Glow no canal info da topbar */
.channel-info {
  box-shadow: 0 0 14px rgba(255,255,255,0.04);
  transition: box-shadow 0.4s;
}
.channel-info:hover {
  box-shadow: 0 0 20px rgba(255,214,10,0.15);
}

/* Botões de ícone na topbar com hover colorido */
.btn-icon:nth-child(1):hover { border-color: var(--secondary); color: var(--secondary); }
.btn-icon:nth-child(2):hover { border-color: #ff6b6b;         color: #ff6b6b; }

/* Efeito shimmer no título do canal ativo no menu */
.channel-item.active .ci-name {
  background: linear-gradient(90deg, #fff 0%, var(--secondary) 50%, #fff 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmerText 2.5s linear infinite;
}
@keyframes shimmerText {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

/* Mobile: card de canal usa cor do canal no hover */
@media (max-width: 600px) {
  .channel-item:hover .ci-icon {
    animation: iconBounce 0.4s cubic-bezier(0.34,1.56,0.64,1);
  }
  .channels-panel h3 { font-size: 1.1rem; }
}

/* Transition overlay com fundo mais rico */
#transition-overlay {
  background: radial-gradient(ellipse at center, #0a0a2a 0%, #000 100%);
}