/* ============================================================
   NoirPlay V34 — Ultimate Experience Layer
   Visual refresh only. No catalog/database migrations required.
   ============================================================ */

:root{
  --np-glass:color-mix(in srgb,var(--surface) 84%,transparent);
  --np-glass-strong:color-mix(in srgb,var(--surface) 94%,transparent);
  --np-elevated-shadow:0 22px 70px rgba(0,0,0,.28);
  --np-soft-shadow:0 12px 36px rgba(0,0,0,.14);
  --np-focus:0 0 0 3px color-mix(in srgb,var(--red) 18%,transparent);
}

/* Global polish */
body{
  background:
    radial-gradient(circle at 50% -160px,color-mix(in srgb,var(--red) 12%,transparent),transparent 420px),
    radial-gradient(circle at 10% 24%,color-mix(in srgb,var(--surface-3) 44%,transparent),transparent 360px),
    var(--bg);
}
.site-header{
  border-bottom:1px solid color-mix(in srgb,var(--line) 78%,transparent)!important;
  background:color-mix(in srgb,var(--header) 90%,transparent)!important;
  backdrop-filter:blur(20px) saturate(130%)!important;
  -webkit-backdrop-filter:blur(20px) saturate(130%)!important;
  box-shadow:0 8px 26px rgba(0,0,0,.08);
}
.header-row{min-height:66px}
.header-logo img{filter:drop-shadow(0 7px 17px rgba(0,0,0,.18))}
.search input{
  border-radius:12px!important;
  transition:border-color .18s ease,box-shadow .18s ease,background .18s ease;
}
.search:focus-within input{
  border-color:color-mix(in srgb,var(--red) 38%,var(--line))!important;
  box-shadow:var(--np-focus);
}
.theme-toggle,.language-toggle,.menu-toggle{
  border-radius:11px!important;
}

/* Home */
.home-main{padding-top:18px!important}
.home-hero{
  position:relative;
  overflow:hidden;
  border-radius:24px!important;
  border:1px solid color-mix(in srgb,var(--line) 86%,transparent)!important;
  background:
    radial-gradient(circle at 88% 20%,color-mix(in srgb,var(--red) 22%,transparent),transparent 34%),
    linear-gradient(135deg,color-mix(in srgb,var(--surface-2) 95%,transparent),var(--surface))!important;
  box-shadow:var(--np-elevated-shadow)!important;
}
.home-hero::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:.34;
  background-image:
    linear-gradient(color-mix(in srgb,var(--line) 25%,transparent) 1px,transparent 1px),
    linear-gradient(90deg,color-mix(in srgb,var(--line) 25%,transparent) 1px,transparent 1px);
  background-size:42px 42px;
  mask-image:linear-gradient(to right,#000,transparent 74%);
}
.home-hero::after{
  content:"";
  position:absolute;
  width:320px;height:320px;
  right:-90px;bottom:-150px;
  border-radius:50%;
  background:var(--red);
  opacity:.07;
  filter:blur(16px);
  pointer-events:none;
}
.home-hero-copy,.home-hero-side{position:relative;z-index:1}
.home-hero h1{
  max-width:700px;
  text-wrap:balance;
  letter-spacing:-.055em!important;
}
.home-hero p{max-width:650px;line-height:1.7!important}
.home-primary-action{
  box-shadow:0 12px 30px color-mix(in srgb,var(--red) 20%,transparent);
}
.home-overview-card{
  border:1px solid color-mix(in srgb,var(--line) 80%,#fff 20%)!important;
  background:color-mix(in srgb,var(--surface) 88%,transparent)!important;
  backdrop-filter:blur(16px);
  box-shadow:0 24px 54px rgba(0,0,0,.18);
}
.home-section{
  scroll-margin-top:92px;
}
.home-section-head{
  align-items:flex-end!important;
  padding-bottom:3px;
}
.home-section-head h2{
  letter-spacing:-.035em!important;
}
.home-featured-grid{
  margin-top:4px;
}
.home-catalog-panel{
  padding:0!important;
}

/* Video cards */
.video-grid{
  gap:22px 14px!important;
}
.video-card{
  position:relative;
  padding:6px;
  border:1px solid transparent;
  border-radius:15px!important;
  background:transparent;
  transition:transform .2s ease,border-color .2s ease,background .2s ease,box-shadow .2s ease!important;
}
@media(hover:hover) and (pointer:fine){
  .video-card:hover{
    transform:translateY(-4px)!important;
    border-color:color-mix(in srgb,var(--line) 86%,transparent);
    background:color-mix(in srgb,var(--surface) 72%,transparent);
    box-shadow:var(--np-soft-shadow);
  }
}
.video-thumb{
  border-radius:12px!important;
  border-color:color-mix(in srgb,var(--line) 88%,transparent)!important;
  box-shadow:0 8px 24px rgba(0,0,0,.11);
}
.video-thumb::after{
  background:linear-gradient(to top,rgba(0,0,0,.62),transparent 54%)!important;
}
.video-card h3{
  margin:10px 2px 5px!important;
  font-size:13px!important;
  line-height:1.42!important;
  letter-spacing:-.012em;
}
.video-meta{
  margin-inline:2px!important;
  font-size:9px!important;
  opacity:.9;
}
.badge{
  top:8px!important;left:8px!important;
  border:1px solid rgba(255,255,255,.18);
  border-radius:7px!important;
  box-shadow:0 5px 16px rgba(0,0,0,.22);
}
.duration{
  right:8px!important;bottom:8px!important;
  border:1px solid rgba(255,255,255,.10);
  border-radius:7px!important;
  backdrop-filter:blur(8px);
}
.play{
  width:50px!important;height:50px!important;
  border:1px solid rgba(255,255,255,.28)!important;
  background:rgba(6,6,6,.70)!important;
  backdrop-filter:blur(9px);
}

/* Pagination */
.catalog-pagination{
  width:max-content;
  max-width:100%;
  margin:30px auto 9px!important;
  padding:7px!important;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--np-glass);
  box-shadow:var(--np-soft-shadow);
  backdrop-filter:blur(14px);
}
.catalog-pagination button{
  border-radius:9px!important;
  background:transparent!important;
}
.catalog-pagination button.active{
  background:var(--red)!important;
  border-color:var(--red)!important;
}
.catalog-page-summary{
  margin-top:10px!important;
  font-size:9px!important;
  letter-spacing:.01em;
}

/* Long-press preview gets visible tactile feedback */
@media (hover:none),(pointer:coarse){
  .video-thumb.has-video-preview::before{
    content:"";
    position:absolute;
    inset:0;
    z-index:7;
    pointer-events:none;
    border:2px solid transparent;
    border-radius:inherit;
  }
  .video-thumb.preview-touch-armed::before{
    border-color:rgba(255,255,255,.42);
    animation:np-hold-preview .42s linear forwards;
  }
  .video-thumb.preview-touch-held::before,
  .video-thumb.preview-active::before{
    border-color:color-mix(in srgb,#63d98a 82%,#fff 18%);
    box-shadow:inset 0 0 0 1px rgba(0,0,0,.18);
  }
  .touch-preview-hint{
    left:9px!important;
    bottom:9px!important;
    min-height:24px!important;
    padding:5px 8px!important;
    background:rgba(4,4,4,.76)!important;
    box-shadow:0 7px 18px rgba(0,0,0,.24);
  }
}
@keyframes np-hold-preview{
  0%{box-shadow:inset 0 0 0 0 rgba(255,255,255,0)}
  100%{box-shadow:inset 0 0 0 999px rgba(255,255,255,.035)}
}

/* Watch / player */
.watch-page{
  position:relative;
  isolation:isolate;
  overflow:clip;
}
.watch-page::before{
  content:"";
  position:absolute;
  z-index:-2;
  top:-40px;
  left:0;
  right:0;
  height:620px;
  background:
    linear-gradient(to bottom,color-mix(in srgb,var(--bg) 8%,transparent),var(--bg) 96%),
    var(--np-watch-poster,none);
  background-position:center 24%;
  background-size:cover;
  filter:blur(44px) saturate(.82);
  opacity:.16;
  transform:scale(1.08);
  pointer-events:none;
}
.watch-page::after{
  content:"";
  position:absolute;
  z-index:-1;
  inset:0;
  background:linear-gradient(to bottom,transparent 0 280px,var(--bg) 620px);
  pointer-events:none;
}
.watch-page-head{
  display:flex!important;
  align-items:flex-end!important;
  justify-content:space-between!important;
  gap:24px!important;
  padding-top:24px!important;
  padding-bottom:14px!important;
}
.watch-page-head-copy{
  max-width:520px;
  text-align:right;
}
.watch-layout{
  grid-template-columns:minmax(0,1fr) minmax(310px,360px)!important;
  gap:20px!important;
}
.player-shell{
  position:relative;
  border-radius:18px!important;
  background:#050505!important;
  border-color:rgba(255,255,255,.10)!important;
  box-shadow:0 26px 88px rgba(0,0,0,.34)!important;
}
.player-topline{
  min-height:42px!important;
  background:linear-gradient(to bottom,rgba(21,21,23,.98),rgba(12,12,14,.96));
}
.player-stage{background:#000}
.source-dock{
  padding:12px 13px!important;
  background:linear-gradient(to bottom,rgba(12,12,14,.96),rgba(9,9,11,.98));
}
.source-button{
  min-height:36px!important;
  padding-inline:12px!important;
  border-radius:10px!important;
}
.source-button.active{
  box-shadow:0 8px 22px color-mix(in srgb,var(--red) 24%,transparent)!important;
}
.video-info-card{
  padding:18px!important;
  border-radius:16px!important;
  background:color-mix(in srgb,var(--surface) 94%,transparent)!important;
  box-shadow:0 16px 46px rgba(0,0,0,.10);
}
.watch-title{
  max-width:1020px;
  text-wrap:balance;
}
.watch-meta{
  gap:8px!important;
}
.watch-meta>span,.watch-views{
  min-height:28px;
  display:inline-flex;
  align-items:center;
  padding:5px 8px;
  border:1px solid var(--line-soft);
  border-radius:8px;
  background:var(--surface-2);
}
.quick-actions{
  display:flex!important;
  align-items:center;
  flex-wrap:wrap;
  gap:8px!important;
}
.action-button{
  min-height:38px!important;
  padding:7px 11px!important;
  border:1px solid var(--line)!important;
  background:var(--surface-2)!important;
}
.action-button:hover{
  border-color:color-mix(in srgb,var(--red) 34%,var(--line))!important;
  background:var(--surface-3)!important;
}
.watch-tags{
  display:flex!important;
  gap:7px!important;
  flex-wrap:wrap!important;
}
.watch-tags a,.watch-tags span{
  border-radius:999px!important;
}

.watch-related-panel{
  top:82px!important;
  padding:15px!important;
  border-radius:17px!important;
  background:var(--np-glass-strong)!important;
  backdrop-filter:blur(16px);
  box-shadow:0 20px 56px rgba(0,0,0,.16)!important;
}
.watch-related-head{
  align-items:center!important;
  padding-bottom:11px;
  border-bottom:1px solid var(--line-soft);
}
.watch-related-head-copy h2{margin:2px 0 0}
.watch-related-count{
  min-width:30px;
  height:30px;
  display:grid;
  place-items:center;
  border:1px solid var(--line);
  border-radius:9px;
  background:var(--surface-2);
  color:var(--muted);
  font-size:9px;
  font-weight:900;
}
.watch-related-list{
  gap:8px!important;
}
.watch-related-list .video-card{
  padding:5px!important;
  border-radius:11px!important;
}
.watch-related-list .video-card:hover{
  background:var(--surface-2)!important;
  box-shadow:none!important;
  transform:none!important;
}
.watch-related-list .video-thumb{
  width:120px!important;
  border-radius:8px!important;
  box-shadow:none;
}
.watch-related-list .touch-preview-hint{display:none!important}

.more-like-this,.comments-card{
  margin-top:18px!important;
}
.more-like-this{
  padding-top:2px;
}
.comments-card{
  overflow:hidden;
  box-shadow:0 16px 44px rgba(0,0,0,.08);
}
.comments-head{
  padding-bottom:14px!important;
  border-bottom:1px solid var(--line-soft);
}
.comment-form{
  padding:13px!important;
  border:1px solid var(--line)!important;
  border-radius:12px!important;
  background:var(--surface-2)!important;
}

/* Scrollbars where we use horizontal source lists on touch */
.source-buttons{
  scrollbar-width:thin;
  scrollbar-color:var(--line) transparent;
}

/* Footer */
.site-footer{
  border-top:1px solid color-mix(in srgb,var(--line) 82%,transparent)!important;
  background:color-mix(in srgb,var(--surface) 45%,var(--bg))!important;
}

/* Tablet/mobile */
@media(max-width:1049px){
  .watch-page::before{height:440px;opacity:.12}
  .watch-page-head-copy{display:none}
}
@media(max-width:760px){
  .container{width:min(var(--max),calc(100% - 24px))}
  .home-main{padding-top:10px!important}
  .home-hero{
    border-radius:18px!important;
    box-shadow:0 14px 42px rgba(0,0,0,.18)!important;
  }
  .home-hero::before{background-size:32px 32px}
  .video-card{padding:3px;border-radius:12px!important}
  .video-grid{gap:16px 8px!important}
  .video-card h3{margin-top:7px!important;font-size:11px!important}
  .video-meta{font-size:8px!important}
  .catalog-pagination{
    width:100%;
    justify-content:space-between!important;
    overflow-x:auto;
    border-radius:12px;
  }
  .watch-page>.container{width:100%!important}
  .watch-page-head{padding-inline:12px!important}
  .player-shell{
    border-radius:0!important;
    border-left:0!important;
    border-right:0!important;
  }
  .video-info-card,
  .more-like-this,
  .comments-card{
    margin-inline:12px!important;
  }
  .source-dock{
    display:block!important;
  }
  .source-dock-copy{margin-bottom:8px}
  .source-buttons{
    display:flex!important;
    flex-wrap:nowrap!important;
    overflow-x:auto;
    padding-bottom:3px;
    scroll-snap-type:x proximity;
  }
  .source-button{
    flex:0 0 auto;
    scroll-snap-align:start;
  }
  .video-info-card{padding:14px!important}
  .watch-meta{
    display:flex!important;
    overflow-x:auto;
    flex-wrap:nowrap!important;
    padding-bottom:3px;
  }
  .watch-meta>*{flex:0 0 auto}
  .quick-actions{
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr));
  }
  .action-button{
    min-width:0!important;
    padding:7px 5px!important;
    flex-direction:column;
    gap:4px!important;
    font-size:8px!important;
  }
  .action-icon{margin:0!important}
}
@media(max-width:430px){
  .quick-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
  .catalog-pagination .page-numbers{
    min-width:max-content;
  }
}

/* Focus/accessibility */
.video-thumb:focus-visible,
.action-button:focus-visible,
.source-button:focus-visible,
.catalog-pagination button:focus-visible{
  outline:0;
  box-shadow:var(--np-focus)!important;
  border-color:color-mix(in srgb,var(--red) 48%,var(--line))!important;
}

@media(prefers-reduced-motion:reduce){
  .video-card,.video-thumb img,.catalog-pagination button,.action-button,.source-button{
    transition:none!important;
  }
  .video-thumb.preview-touch-armed::before{animation:none!important}
}
