  :root {
    --tv-width: clamp(560px, 58vw, 980px);
    --screen-x: 12.6%;
    --screen-y: 8%;
    --screen-w: 74.8%;
    --screen-h: 61.5%;
    --primary: #00e6cc;
    --primary-glow: #00ffdd;
    --secondary: #ff4757;
    --accent: #7b68ee;
    --gold: #ffd700;
    --sidebar-w: 340px;
    --bg-dark: #0a0d14;
    --bg-card: rgba(15, 20, 28, 0.9);
    --border-primary: rgba(0, 230, 204, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
  }

  * {
    box-sizing: border-box;
  }

  html,
  body {
    height: 100%;
    margin: 0;
    color: var(--text-primary);
    background:
      radial-gradient(circle at 20% 80%, rgba(123, 104, 238, 0.15) 0%, transparent 50%),
      radial-gradient(circle at 80% 20%, rgba(255, 71, 87, 0.15) 0%, transparent 50%),
      radial-gradient(circle at 40% 40%, rgba(0, 230, 204, 0.1) 0%, transparent 50%),
      linear-gradient(135deg, #0a0d14 0%, #1a1d29 100%);
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    overflow-x: hidden;
  }

  /* Animated background particles */
  body::before,
  body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
      radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, .15) 0 70%, transparent 71%),
      radial-gradient(2px 2px at 80% 60%, rgba(0, 230, 204, .12) 0 70%, transparent 71%),
      radial-gradient(2px 2px at 60% 20%, rgba(255, 71, 87, .1) 0 70%, transparent 71%),
      radial-gradient(1px 1px at 90% 70%, rgba(123, 104, 238, .18) 0 70%, transparent 71%);
    background-repeat: no-repeat;
    filter: blur(.3px);
    z-index: 0;
  }

  body::after {
    animation: starDrift 45s linear infinite;
    opacity: .4;
  }

  @keyframes starDrift {
    0% {
      transform: translateY(0) rotate(0deg);
    }

    100% {
      transform: translateY(-20px) rotate(1deg);
    }
  }

  /* Header simplifié et compact */
  header {
    position: relative;
    z-index: 10;
    padding: 15px 20px 10px;
    text-align: center;
    overflow: hidden;
    background: linear-gradient(135deg,
        rgba(0, 230, 204, 0.06) 0%,
        rgba(123, 104, 238, 0.06) 50%,
        rgba(255, 71, 87, 0.06) 100%);
    border-bottom: 1px solid var(--border-primary);
    backdrop-filter: blur(25px);
    display: flex;
    justify-content: center;
    align-items: center;
  }

  /* Admin Link */
  .admin-link {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 16px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .04));
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .admin-link:hover {
    background: linear-gradient(145deg, rgba(0, 230, 204, .15), rgba(123, 104, 238, .1));
    border-color: var(--primary);
    transform: translateY(-50%) translateX(-2px);
    box-shadow: 0 4px 12px rgba(0, 230, 204, .3);
  }


  /* Container pour le logo - plus compact */
  .logo-container {
    position: relative;
    display: inline-block;
    margin: 0;
  }

  /* Logo PNG avec animations - plus petit */
  .logo {
    height: clamp(50px, 8vw, 120px);
    width: auto;
    filter: drop-shadow(0 0 15px rgba(0, 230, 204, 0.4));
    animation: logoFloat 6s ease-in-out infinite, logoGlow 4s ease-in-out infinite alternate;
    transition: all 0.3s ease;
  }

  .logo:hover {
    transform: scale(1.1) rotate(3deg);
    filter: drop-shadow(0 0 25px rgba(0, 230, 204, 0.8));
  }

  @keyframes logoFloat {

    0%,
    100% {
      transform: translateY(0px) rotate(0deg);
    }

    25% {
      transform: translateY(-5px) rotate(1deg);
    }

    50% {
      transform: translateY(-8px) rotate(0deg);
    }

    75% {
      transform: translateY(-3px) rotate(-1deg);
    }
  }

  @keyframes logoGlow {
    0% {
      filter: drop-shadow(0 0 15px rgba(0, 230, 204, 0.4));
    }

    100% {
      filter: drop-shadow(0 0 25px rgba(0, 230, 204, 0.7));
    }
  }

  /* Effet de particules autour du logo - plus petit */
  .logo-container::before,
  .logo-container::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--primary);
    border-radius: 50%;
    animation: particles 8s linear infinite;
  }

  .logo-container::before {
    top: 15%;
    left: 8%;
    animation-delay: 0s;
  }

  .logo-container::after {
    top: 75%;
    right: 12%;
    animation-delay: 4s;
    background: var(--accent);
  }

  @keyframes particles {

    0%,
    100% {
      opacity: 0;
      transform: scale(0) rotate(0deg);
    }

    25% {
      opacity: 1;
      transform: scale(1) rotate(90deg);
    }

    50% {
      opacity: 0.7;
      transform: scale(1.2) rotate(180deg);
    }

    75% {
      opacity: 1;
      transform: scale(0.8) rotate(270deg);
    }
  }

  @keyframes gradientShift {

    0%,
    100% {
      background-position: 0% 50%;
    }

    50% {
      background-position: 100% 50%;
    }
  }

  @keyframes gradientShift {

    0%,
    100% {
      background-position: 0% 50%;
    }

    50% {
      background-position: 100% 50%;
    }
  }

  /* Layout principal optimisé */
  .main {
    position: relative;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(280px, var(--sidebar-w)) 1fr;
    gap: 20px;
    align-items: start;
    padding: 20px;
    max-width: 1800px;
    margin: 0 auto;
  }

  /* Sidebar compacte avec glassmorphism avancé */
  .sidebar {
    position: sticky;
    top: 15px;
    width: 100%;
    background: linear-gradient(145deg,
        rgba(15, 20, 28, 0.95),
        rgba(25, 30, 40, 0.90),
        rgba(35, 40, 50, 0.85));
    border: 1px solid var(--border-primary);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    backdrop-filter: blur(25px);
    box-shadow:
      0 20px 40px rgba(0, 0, 0, .7),
      inset 0 1px 0 rgba(255, 255, 255, .15),
      0 0 0 1px rgba(0, 230, 204, .15),
      0 0 50px rgba(0, 230, 204, .08);
    animation: slideInLeft .8s ease both;
    overflow: auto;
    max-height: calc(100vh - 140px);
    position: relative;
  }

  /* Effet de brillance sur la sidebar */
  .sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%);
    animation: sidebarShine 8s ease-in-out infinite;
    border-radius: 24px;
    pointer-events: none;
  }

  @keyframes sidebarShine {
    0% {
      left: -100%;
    }

    50% {
      left: 100%;
    }

    100% {
      left: -100%;
    }
  }

  /* Amélioration des catégories avec micro-interactions */
  .category {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: .95rem;
    cursor: pointer;
    padding: 16px 18px;
    border-radius: 16px;
    background: linear-gradient(145deg,
        rgba(255, 255, 255, .08),
        rgba(255, 255, 255, .03));
    border: 1px solid rgba(255, 255, 255, .12);
    transition: all .4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
  }

  .category::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(0, 230, 204, .15),
        transparent);
    transform: translateX(-100%);
    transition: transform .6s ease;
    pointer-events: none;
  }

  .category:hover {
    transform: translateY(-2px);
    box-shadow:
      0 12px 30px rgba(0, 230, 204, .2),
      0 0 0 1px rgba(0, 230, 204, .3);
    border-color: var(--primary);
    background: linear-gradient(145deg,
        rgba(0, 230, 204, .12),
        rgba(123, 104, 238, .08));
  }

  .category:hover::before {
    transform: translateX(100%);
  }

  .category:active {
    transform: translateY(-1px);
  }

  /* Layout principal amélioré */
  .main {
    position: relative;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(280px, var(--sidebar-w)) 1fr;
    gap: 24px;
    align-items: start;
    padding: 24px;
    max-width: 1800px;
    margin: 0 auto;
  }

  /* Sidebar avec glassmorphism */
  .sidebar {
    position: sticky;
    top: 20px;
    width: 100%;
    background: linear-gradient(145deg,
        rgba(15, 20, 28, 0.95),
        rgba(25, 30, 40, 0.85));
    border: 1px solid var(--border-primary);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    backdrop-filter: blur(20px);
    box-shadow:
      0 20px 40px rgba(0, 0, 0, .6),
      inset 0 1px 0 rgba(255, 255, 255, .1),
      0 0 0 1px rgba(0, 230, 204, .1);
    /* animation: slideInLeft .8s ease both; disabled per user request */
    overflow: auto;
    max-height: calc(100vh - 120px);
  }

  @keyframes slideInLeft {
    from {
      opacity: 0;
      transform: translateX(-30px);
    }

    to {
      opacity: 1;
      transform: none;
    }
  }

  .sidebar h2 {
    font-family: "Orbitron", sans-serif;
    font-weight: 700;
    letter-spacing: .06em;
    font-size: 1.1rem;
    margin: 0;
    text-align: center;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    padding-bottom: 12px;
  }

  .sidebar h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
  }

  /* Filtres améliorés */
  .filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: .95rem;
  }

  .field label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: .9rem;
  }

  .field select {
    background: linear-gradient(145deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .04));
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
    font-family: inherit;
    font-size: .9rem;
    transition: all .3s ease;
    cursor: pointer;
    appearance: none;
    /* Supprimer la flèche par défaut pour custom (optionnel) */
  }

  .field select option {
    background-color: #1a1d29;
    color: #fff;
    padding: 10px;
  }

  .field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 230, 204, .2);
    background: rgba(0, 0, 0, .2);
  }

  /* Catégories avec hover effects */
  .category {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .95rem;
    cursor: pointer;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(145deg,
        rgba(255, 255, 255, .06),
        rgba(255, 255, 255, .02));
    border: 1px solid rgba(255, 255, 255, .1);
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
  }

  .category::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 230, 204, .1), transparent);
    transition: left .5s ease;
  }

  .category:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 230, 204, .15);
    border-color: var(--primary);
    background: linear-gradient(145deg, rgba(0, 230, 204, .1), rgba(123, 104, 238, .05));
  }

  .category:hover::before {
    left: 100%;
  }

  .category input {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    cursor: pointer;
    filter: drop-shadow(0 0 5px rgba(0, 230, 204, .3));
  }

  .category label {
    flex: 1;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
  }

  /* TV avec effets améliorés et reflets réalistes - Design CRT Ultra Réaliste */
  .tv {
    position: relative;
    width: min(var(--tv-width), calc(100vw - 380px));
    max-width: 100%;
    margin-inline: auto;
    aspect-ratio: 1000/700;
    background: url("../img/enie_tv.png") center/cover no-repeat;
    user-select: none;
    border-radius: 25px;
    /* Ombres réalistes pour TV CRT */
    box-shadow: 
      0 25px 80px rgba(0, 0, 0, 0.9),
      0 10px 40px rgba(0, 0, 0, 0.7),
      inset 0 2px 10px rgba(255, 255, 255, 0.1),
      inset 0 -2px 10px rgba(0, 0, 0, 0.3);
    filter: brightness(0.7) contrast(0.9);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    /* Effet de profondeur CRT */
    transform: perspective(1000px) rotateX(2deg);
    transform-origin: center bottom;
  }

  /* TV allumée - Effet CRT réaliste */
  .tv.tv-on {
    filter: brightness(1.1) contrast(1.15) saturate(1.1);
    box-shadow: 
      0 30px 100px rgba(0, 0, 0, 0.8),
      0 15px 50px rgba(0, 230, 204, 0.15),
      0 0 60px rgba(0, 230, 204, 0.1),
      inset 0 2px 15px rgba(255, 255, 255, 0.15),
      inset 0 -2px 15px rgba(0, 0, 0, 0.2);
    animation: tvGlowRealistic 4s ease-in-out infinite alternate;
  }

  @keyframes tvGlowRealistic {
    0% {
      box-shadow: 
        0 30px 100px rgba(0, 0, 0, 0.8),
        0 15px 50px rgba(0, 230, 204, 0.1),
        0 0 50px rgba(0, 230, 204, 0.08),
        inset 0 2px 15px rgba(255, 255, 255, 0.15),
        inset 0 -2px 15px rgba(0, 0, 0, 0.2);
    }
    100% {
      box-shadow: 
        0 30px 100px rgba(0, 0, 0, 0.8),
        0 15px 50px rgba(0, 230, 204, 0.2),
        0 0 80px rgba(0, 230, 204, 0.15),
        inset 0 2px 15px rgba(255, 255, 255, 0.2),
        inset 0 -2px 15px rgba(0, 0, 0, 0.15);
    }
  }

  /* Amélioration des effets de l'écran CRT ultra-réaliste */
  .phosphor-glow {
    background: radial-gradient(ellipse at center,
        rgba(0, 255, 100, 0.08) 0%,
        rgba(0, 230, 204, 0.06) 30%,
        rgba(123, 104, 238, 0.04) 60%,
        transparent 100%);
    mix-blend-mode: screen;
    animation: phosphorRealistic 6s ease-in-out infinite alternate;
    z-index: 38;
    /* Effet de courbure phosphore */
    border-radius: 12px;
  }

  @keyframes phosphorRealistic {
    0% {
      opacity: 0.7;
      transform: scale(1) rotate(0.1deg);
    }
    33% {
      opacity: 0.9;
      transform: scale(1.01) rotate(-0.1deg);
    }
    66% {
      opacity: 0.5;
      transform: scale(1.02) rotate(0.05deg);
    }
    100% {
      opacity: 0.8;
      transform: scale(1) rotate(-0.05deg);
    }
  }

  /* OSD amélioré - Style Réaliste (Sans boite) */
  .osd {
    position: absolute;
    bottom: 8%;
    /* Moved to bottom as per previous request/practice for OSD */
    left: 8%;
    /* transform: translateX(-50%); Removed centering to be like classic TV OSD */
    transform: none;
    z-index: 70;
    min-width: 200px;
    padding: 0;
    background: transparent;
    color: #0f0;
    font-weight: 700;
    font-size: 24px;
    font-family: 'Orbitron', monospace;
    /* Monospace helpful for bars */
    letter-spacing: .1em;
    pointer-events: none;
    opacity: 0;
    transition: opacity .4s ease;
    border: none;
    box-shadow: none;
    text-shadow: 0 0 5px #0f0, 0 0 10px rgba(0, 255, 0, 0.5);
    backdrop-filter: none;
    animation: none;
    /* No pulse on container */
  }

  /* .. skipping to VCD .. */

  /* VCD Frame Full Cover */
  #vcdFrame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    /* Scale up slightly to remove black borders if emulator adds them */
    transform: scale(1.02);
    transform-origin: center;
  }

  .vcd-feature.expanded {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Removed scale to rely on w/h */
    z-index: 2000;
    bottom: auto;
    right: auto;
    animation: none;
    width: 75vh;
    /* Responsive large size */
    height: 75vh;
    max-width: 90vw;
  }

  .stencil {
    position: absolute;
    inset: 0;
    background: url("../img/tvback.png") center/cover no-repeat;
    pointer-events: none;
    z-index: 50;
    border-radius: 20px;
  }

  .screen-wrap {
    position: absolute;
    left: var(--screen-x);
    top: var(--screen-y);
    width: var(--screen-w);
    height: var(--screen-h);
    overflow: hidden;
    z-index: 10;
    border-radius: 12px;
    /* Écran CRT incurvé réaliste */
    box-shadow: 
      inset 0 0 40px rgba(0, 0, 0, 0.8),
      inset 0 0 80px rgba(0, 0, 0, 0.4),
      inset 2px 2px 10px rgba(0, 0, 0, 0.6),
      inset -2px -2px 10px rgba(0, 0, 0, 0.6);
    /* Courbure CRT subtile */
    transform: perspective(800px) rotateX(1deg);
    background: radial-gradient(ellipse at center, 
      rgba(0, 20, 40, 0.1) 0%, 
      rgba(0, 0, 0, 0.9) 100%);
  }

  #player,
  #player iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    /* Zoom amélioré pour masquer complètement l'interface YouTube */
    transform: scale(1.45);
    transform-origin: center;
    pointer-events: none;
    transition: opacity 0.5s ease;
    /* Filtre pour effet CRT */
    filter: contrast(1.1) brightness(1.05) saturate(1.2);
  }

  /* Masques pour logos YouTube - Améliorés pour masquage complet */
  .logo-mask-tr,
  .logo-mask-br {
    position: absolute;
    z-index: 46;
    pointer-events: none;
    border-radius: 8px;
    background: 
      radial-gradient(140px 90px at 60% 50%,
        rgba(0, 0, 0, 0.95) 0%,
        rgba(0, 0, 0, 0.8) 40%,
        rgba(0, 0, 0, 0.6) 70%,
        rgba(0, 0, 0, 0) 100%);
    filter: blur(0.8px);
  }

  .logo-mask-tr {
    right: calc(100% - (var(--screen-x) + var(--screen-w)));
    top: var(--screen-y);
    width: 28%;
    height: 25%;
  }

  .logo-mask-br {
    right: calc(100% - (var(--screen-x) + var(--screen-w)));
    top: calc(var(--screen-y) + var(--screen-h) - 25%);
    width: 30%;
    height: 25%;
  }

  /* Masque central pour logos YouTube persistants */
  .logo-mask-center {
    position: absolute;
    left: var(--screen-x);
    top: var(--screen-y);
    width: var(--screen-w);
    height: var(--screen-h);
    z-index: 45;
    pointer-events: none;
    background: 
      radial-gradient(circle at 85% 15%, rgba(0, 0, 0, 0.9) 0%, transparent 15%),
      radial-gradient(circle at 85% 85%, rgba(0, 0, 0, 0.9) 0%, transparent 15%),
      radial-gradient(circle at 50% 50%, transparent 0%, transparent 100%);
  }

  .mouse-blocker {
    position: absolute;
    left: var(--screen-x);
    top: var(--screen-y);
    width: var(--screen-w);
    height: var(--screen-h);
    z-index: 20;
    cursor: default;
  }

  /* Couches d'effets CRT améliorées et ultra-réalistes */
  .layer {
    position: absolute;
    left: var(--screen-x);
    top: var(--screen-y);
    width: var(--screen-w);
    height: var(--screen-h);
    border-radius: 12px;
    pointer-events: none;
  }

  .crt-effect {
    overflow: hidden;
    z-index: 40;
    /* Effet de courbure CRT */
    background: radial-gradient(ellipse at center, 
      transparent 0%, 
      rgba(0, 0, 0, 0.05) 85%, 
      rgba(0, 0, 0, 0.2) 100%);
  }

  .crt-effect::before {
    content: "";
    position: absolute;
    inset: 0;
    /* Scanlines plus réalistes */
    background: repeating-linear-gradient(0deg,
        rgba(0, 0, 0, 0) 0 1px,
        rgba(0, 0, 0, 0.3) 1px 2px,
        rgba(0, 0, 0, 0) 2px 3px);
    animation: scanlinesRealistic 0.1s linear infinite;
    mix-blend-mode: multiply;
  }

  @keyframes scanlinesRealistic {
    0% { transform: translateY(0px); }
    100% { transform: translateY(3px); }
  }

  .screen-glare {
    background: 
      radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.25) 0%, transparent 50%),
      linear-gradient(135deg,
        rgba(255, 255, 255, 0.15) 0%,
        transparent 25%,
        transparent 75%,
        rgba(255, 255, 255, 0.08) 100%);
    mix-blend-mode: soft-light;
    z-index: 41;
    /* Animation de reflet réaliste */
    animation: glareShift 8s ease-in-out infinite;
  }

  @keyframes glareShift {
    0%, 100% { 
      background-position: 30% 20%, 0% 0%; 
      opacity: 0.8;
    }
    50% { 
      background-position: 70% 80%, 100% 100%; 
      opacity: 0.6;
    }
  }

  .vhs-glitch {
    background-image: url("../img/vhs-glitch.gif");
    background-size: cover;
    opacity: 0;
    transition: opacity .2s linear;
    mix-blend-mode: screen;
    z-index: 39;
  }

  .off-overlay {
    /* Écran éteint ultra-réaliste avec reflet subtil */
    background: 
      radial-gradient(ellipse at 40% 30%, rgba(255, 255, 255, 0.03) 0%, transparent 40%),
      radial-gradient(ellipse at center, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.9) 100%);
    opacity: 1;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 35;
    /* Texture d'écran éteint */
    background-image: 
      repeating-linear-gradient(0deg, 
        rgba(255, 255, 255, 0.01) 0px, 
        transparent 1px, 
        transparent 2px, 
        rgba(255, 255, 255, 0.01) 3px);
    border-radius: 12px;
  }

  .static {
    background: url("../img/tvstatic.gif") center/cover no-repeat;
    opacity: 0;
    transition: opacity .2s linear;
    mix-blend-mode: screen;
    z-index: 36;
  }

  .scanlines {
    background-image: 
      repeating-linear-gradient(0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px,
        rgba(255, 255, 255, 0.02) 2px,
        rgba(255, 255, 255, 0.02) 3px,
        transparent 3px,
        transparent 4px);
    background-size: 100% 4px;
    opacity: 0.6;
    mix-blend-mode: overlay;
    z-index: 37;
    /* Animation subtile des scanlines */
    animation: scanlinesMove 0.15s linear infinite;
  }

  @keyframes scanlinesMove {
    0% { background-position: 0 0; }
    100% { background-position: 0 4px; }
  }

  /* Boutons avec feedback amélioré */
  .btnzone {
    position: absolute;
    z-index: 60;
    cursor: pointer;
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
  }

  .btnzone:hover {
    transform: scale(1.15);
    box-shadow: 0 0 25px rgba(0, 230, 204, .5);
  }

  .btnzone:active {
    transform: scale(.85);
  }

  #powerBtn {
    left: 58.5%;
    top: 78.5%;
    width: 4%;
    height: 5%;
  }

  #chUpBtn {
    left: 50.2%;
    top: 79.5%;
    width: 1.2%;
    height: 3%;
  }

  #chDownBtn {
    left: 47.8%;
    top: 79.5%;
    width: 1.4%;
    height: 3%;
  }

  #volUpBtn {
    left: 45%;
    top: 79.5%;
    width: 1.2%;
    height: 3%;
  }

  #volDownBtn {
    left: 42.8%;
    top: 79.5%;
    width: 1.4%;
    height: 3%;
  }

  /* LED de statut ultra-réaliste avec synchronisation parfaite */
  .status-led {
    position: absolute;
    right: 44.9%;
    top: 80%;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    /* LED éteinte - Rouge réaliste */
    background: 
      radial-gradient(circle at 30% 30%, #ff6b6b 0%, #ff4757 40%, #c44569 100%);
    box-shadow:
      0 0 8px rgba(255, 71, 87, 0.3),
      inset 2px 2px 4px rgba(255, 255, 255, 0.2),
      inset -2px -2px 6px rgba(0, 0, 0, 0.4),
      0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 60;
    /* Effet de profondeur LED */
    border: 1px solid rgba(0, 0, 0, 0.2);
  }

  .status-led.on {
    /* LED allumée - Vert réaliste */
    background: 
      radial-gradient(circle at 30% 30%, #7bed9f 0%, #00e6cc 40%, #00a085 100%);
    box-shadow:
      0 0 25px rgba(0, 230, 204, 0.8),
      0 0 50px rgba(0, 230, 204, 0.4),
      0 0 80px rgba(0, 230, 204, 0.2),
      inset 2px 2px 6px rgba(255, 255, 255, 0.4),
      inset -2px -2px 4px rgba(0, 0, 0, 0.2),
      0 2px 6px rgba(0, 0, 0, 0.2);
    animation: ledPulseRealistic 2.5s ease-in-out infinite;
    border: 1px solid rgba(0, 230, 204, 0.3);
  }

  @keyframes ledPulseRealistic {
    0%, 100% {
      opacity: 1;
      transform: scale(1);
      box-shadow:
        0 0 25px rgba(0, 230, 204, 0.8),
        0 0 50px rgba(0, 230, 204, 0.4),
        0 0 80px rgba(0, 230, 204, 0.2),
        inset 2px 2px 6px rgba(255, 255, 255, 0.4),
        inset -2px -2px 4px rgba(0, 0, 0, 0.2);
    }
    50% {
      opacity: 0.7;
      transform: scale(1.05);
      box-shadow:
        0 0 35px rgba(0, 230, 204, 1),
        0 0 70px rgba(0, 230, 204, 0.6),
        0 0 100px rgba(0, 230, 204, 0.3),
        inset 2px 2px 8px rgba(255, 255, 255, 0.5),
        inset -2px -2px 3px rgba(0, 0, 0, 0.15);
    }
  }

  /* Footer */
  footer {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    position: relative;
    z-index: 10;
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, .1);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  footer p {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
  }

  footer a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
  }

  footer a:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 230, 204, 0.2);
    border-color: var(--primary);
  }



  /* Responsive ultra-amélioré pour tous les appareils */
  @media (max-width: 1200px) {
    .main {
      grid-template-columns: minmax(260px, 32%) 1fr;
      gap: 18px;
    }

    .tv {
      width: min(var(--tv-width), calc(100vw - 320px));
    }
  }

  @media (max-width: 900px) {
    .main {
      grid-template-columns: 1fr;
      gap: 16px;
      padding: 16px;
    }

    .sidebar {
      order: -1;
      position: relative;
      top: auto;
      max-height: none;
      padding: 20px;
    }

    .tv {
      width: 100%;
      max-width: 90vw;
      /* Ajustement pour mobile */
      transform: perspective(800px) rotateX(1deg);
    }

    .filters {
      grid-template-columns: 1fr;
    }

    header {
      padding: 12px 20px 8px;
      flex-direction: column;
      gap: 15px;
    }

    .admin-link {
      position: static;
      transform: none;
      align-self: flex-end;
    }

    .logo {
      height: clamp(40px, 10vw, 60px);
    }
  }

  /* Optimisations spécifiques pour tablettes */
  @media (max-width: 768px) and (orientation: landscape) {
    .main {
      grid-template-columns: minmax(240px, 30%) 1fr;
      gap: 12px;
    }
    
    .sidebar {
      order: 0;
      position: sticky;
      top: 10px;
      max-height: calc(100vh - 100px);
    }
    
    .tv {
      width: 100%;
      max-width: 65vw;
    }
  }

  /* Optimisations pour smartphones */
  @media (max-width: 600px) {
    :root {
      --sidebar-w: 100%;
      --tv-width: 95vw;
    }

    .main {
      padding: 12px;
      gap: 12px;
    }

    .sidebar {
      padding: 16px;
      gap: 16px;
      border-radius: 16px;
    }

    .filters {
      gap: 12px;
      grid-template-columns: 1fr;
    }

    .category {
      padding: 12px 14px;
      font-size: 0.9rem;
    }

    header {
      padding: 10px 16px 6px;
      gap: 12px;
    }

    .mode-switcher {
      margin-left: 0;
      padding: 6px 10px;
    }

    .mode-label {
      font-size: 0.7rem;
    }

    .switch {
      width: 50px;
      height: 28px;
    }

    .switch .slider:before {
      height: 20px;
      width: 20px;
      left: 3px;
      bottom: 3px;
    }

    input:checked + .slider:before {
      transform: translateX(22px);
    }

    /* TV responsive pour mobile */
    .tv {
      width: 100%;
      max-width: 95vw;
      /* Réduction de la perspective sur mobile */
      transform: perspective(600px) rotateX(1deg);
    }

    /* Ajustement des boutons pour mobile */
    .btnzone {
      /* Zones de clic plus grandes sur mobile */
      transform: scale(1.2);
    }

    .btnzone:hover {
      transform: scale(1.3);
    }

    /* LED plus visible sur mobile */
    .status-led {
      width: 22px;
      height: 22px;
    }

    /* OSD adapté mobile */
    .osd {
      font-size: 18px;
      left: 5%;
      bottom: 5%;
      min-width: 150px;
    }
  }

  /* Optimisations pour très petits écrans */
  @media (max-width: 480px) {
    .tv {
      /* Perspective réduite pour très petits écrans */
      transform: perspective(400px) rotateX(0.5deg);
    }

    .sidebar h2 {
      font-size: 1rem;
    }

    .category {
      padding: 10px 12px;
      font-size: 0.85rem;
    }

    .field select {
      padding: 10px 12px;
      font-size: 0.85rem;
    }

    .osd {
      font-size: 16px;
      left: 3%;
      bottom: 3%;
    }
  }

  /* Mode paysage pour smartphones */
  @media (max-width: 900px) and (orientation: landscape) {
    .main {
      grid-template-columns: minmax(200px, 25%) 1fr;
      gap: 10px;
      padding: 10px;
    }

    .sidebar {
      order: 0;
      position: sticky;
      top: 5px;
      max-height: calc(100vh - 80px);
      padding: 12px;
    }

    .tv {
      width: 100%;
      max-width: 70vw;
    }

    header {
      padding: 8px 16px 4px;
    }
  }

  /* Animations d'entrée - REMOVED per user request
  .tv {
    animation: tvSlideIn 1s ease-out both;
  }
  @keyframes tvSlideIn { ... }
  */

  /* État de mise sous tension ultra-réaliste */
  .tv.powering-on {
    /* Animation CRT réaliste sans mouvement */
    animation: powerOnRealistic 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  @keyframes powerOnRealistic {
    0% {
      filter: brightness(0) contrast(0) saturate(0);
    }
    15% {
      filter: brightness(0.1) contrast(0.2) saturate(0.3);
    }
    30% {
      filter: brightness(0.4) contrast(0.6) saturate(0.7);
    }
    60% {
      filter: brightness(0.8) contrast(0.9) saturate(1);
    }
    85% {
      filter: brightness(1.1) contrast(1.1) saturate(1.1);
    }
    100% {
      filter: brightness(1.1) contrast(1.15) saturate(1.1);
    }
  }


  /* Modern Mode Switcher */
  .mode-switcher {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(16, 18, 27, 0.6);
    padding: 8px 12px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-left: 20px;
    backdrop-filter: blur(12px);
    box-shadow:
      0 4px 20px rgba(0, 0, 0, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mode-switcher:hover {
    background: rgba(16, 18, 27, 0.8);
    border-color: rgba(0, 230, 204, 0.3);
    box-shadow: 0 4px 25px rgba(0, 230, 204, 0.15);
  }

  .mode-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.3);
    transition: all 0.4s ease;
    text-transform: uppercase;
  }

  .mode-label.active {
    color: #fff;
    text-shadow:
      0 0 10px rgba(0, 230, 204, 0.6),
      0 0 20px rgba(0, 230, 204, 0.3);
  }

  /* Custom Toggle Switch */
  .switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 32px;
  }

  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, #111, #222);
    transition: .4s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
  }

  .slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 3px;
    background: linear-gradient(135deg, #ddd, #fff);
    transition: .4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  }

  input:checked+.slider {
    background: linear-gradient(145deg, #004d40, #00695c);
    border-color: rgba(0, 230, 204, 0.4);
  }

  input:checked+.slider:before {
    transform: translateX(28px);
    background: #00e6cc;
    box-shadow: 0 0 15px #00e6cc;
  }

  .slider.round {
    border-radius: 34px;
  }

  /* TV VCD Mode */
  .tv.mode-vcd {
    background: url("../img/enie_vcd.png") center/cover no-repeat;
    filter: contrast(1.1) brightness(1.05);
  }

  /* VCD Logic for Hiding Sidebar */
  body.mode-vcd-active .sidebar {
    display: none !important;
  }

  body.mode-vcd-active .main {
    grid-template-columns: 1fr;
    /* Full width for TV */
    max-width: 100vw;
    padding: 0;
  }

  body.mode-vcd-active .tv {
    width: clamp(700px, 85vw, 1200px);
    /* Make TV bigger in VCD mode if desired, or keep standard */
    margin-top: 20px;
  }

  /* Hide OSD/Effects in VCD mode if desired, or keep them */
  .mode-vcd .osd {
    display: none;
  }

  /* Allow interaction with VCD iframe */
  .mode-vcd .mouse-blocker {
    display: none;
  }

  /* Volume OSD - Bottom Left CRT Style */
  .osd-volume {
    position: absolute;
    bottom: 8%;
    left: 8%;
    /* Override standard OSD center positioning if this class is used separately, 
       but currently showOSD uses #osd which is centered. 
       We need to override #osd styles when it has volume content. */
    display: flex;
    flex-direction: row;
    /* Horizontal bars + text */
    align-items: center;
    gap: 15px;
    font-family: 'Orbitron', monospace;
    z-index: 100;
  }

  /* When volume is active, we might need a specific class on #osd or simple override.
     Since showOSD sets innerHTML, we can style based on children using :has or just style the children.
     Ideally #osd should be moved. 
     Hack: attributes in style tag injected by JS or just style .osd-volume container distinct from parent?
     Actually, standard #osd is centered. To move it, we can change #osd properties depending on content? No.
     Let's style .osd-volume to force position fixed relative to screen-wrap? 
     No, #osd is absolute. We can't easily move #osd with just child CSS.
     
     Simpler: Add a specialized #osdVolume element in HTML? 
     Or just let the user know I'm hacking it:
     We will make .osd-volume take control. 
     BUT #osd has specific positioning.
     
     I will add `id="osd-volume-container"` in JS or modify `#osd` style inline in JS.
     Let's modify JS to set class on #osd.
     
     For now, let's define the look.
  */

  .vol-bars {
    display: flex;
    gap: 3px;
  }

  .vol-bar {
    width: 6px;
    height: 18px;
    background-color: rgba(0, 50, 0, 0.5);
    border: 1px solid rgba(0, 255, 0, 0.3);
  }

  .vol-bar.active {
    background-color: #00ff00;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.6);
  }

  .vol-text {
    color: #00ff00;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    min-width: 60px;
  }

  .vol-text {
    color: #00ff00;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    min-width: 60px;
  }

  /* VCD 300 Disc Feature */
  .vcd-feature {
    position: absolute;
    bottom: -40px;
    right: -50px;
    width: 170px;
    /* Increased again as requested */
    height: 170px;
    z-index: 80;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: floatDisc 4s ease-in-out infinite;
    display: none;
    /* Hidden by default */
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.7));
  }

  .mode-vcd .vcd-feature {
    display: block;
  }

  .vcd-feature img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    transition: transform 0.3s ease;
  }

  .vcd-feature:hover {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 15px 30px rgba(0, 230, 204, 0.5));
  }

  /* VCD Frame Full Cover */
  #vcdFrame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    /* Scale up slightly to remove black borders if emulator adds them */
    transform: scale(1.02);
    transform-origin: center;
    transition: opacity 0.5s ease;
  }

  .vcd-feature.expanded {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    bottom: auto;
    right: auto;
    animation: none;
    width: 75vh;
    height: 75vh;
    max-width: 90vw;
    max-height: 90vw;
  }

  /* Backdrop for expanded state */
  .vcd-feature.expanded::before {
    content: '';
    position: fixed;
    top: -500%;
    left: -500%;
    width: 1000%;
    height: 1000%;
    background: rgba(0, 0, 0, 0.8);
    z-index: -1;
    backdrop-filter: blur(5px);
  }

  @keyframes floatDisc {

    0%,
    100% {
      transform: translateY(0) rotate(0deg);
    }

    50% {
      transform: translateY(-10px) rotate(2deg);
    }
  }