:root{
    --bg: #0A0A0F;
    --panel: #15151C;
    --panel-raised: #1B1B24;
    --line: #26262F;
    --text: #F1F0F5;
    --muted: #94939F;
    --accent: #7C5CFC;
    --accent-hover: #8F72FF;
    --accent-soft: rgba(124,92,252,0.14);
    --accent-glow: rgba(124,92,252,0.4);

    --font-display: "Space Grotesk", sans-serif;
    --font-body: "Inter", sans-serif;
    --font-mono: "JetBrains Mono", monospace;

    --maxw: 1160px;
  }

  *{ box-sizing: border-box; }
  html{ scroll-behavior: smooth; }
  @media (prefers-reduced-motion: reduce){ html{ scroll-behavior: auto; } }

  body{
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
  }
  a{ color: inherit; }
  ::selection{ background: var(--accent); color: #0A0A0F; }
  :focus-visible{ outline: 2px solid var(--accent); outline-offset: 3px; }

  .wrap{ max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
  .icon{ width: 16px; height: 16px; flex-shrink: 0; }

  /* ---------- NAV ---------- */
  .site-nav{
    position: fixed;
    top: 18px;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    justify-content: center;
    padding: 0 20px;
    pointer-events: none;
  }
  .nav-pill{
    pointer-events: all;
    position: relative;
    margin: 0 auto;
    background: rgba(15,15,20,0.6);
    backdrop-filter: blur(24px) saturate(180%) brightness(0.96);
    -webkit-backdrop-filter: blur(24px) saturate(180%) brightness(0.96);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
    padding: 7px 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.07);
    animation: navDropIn 0.55s cubic-bezier(0.34,1.3,0.64,1) both;
  }
  @keyframes navDropIn{ from{ opacity:0; transform:translateY(-60px); } to{ opacity:1; transform:translateY(0); } }
  @media (prefers-reduced-motion: reduce){ .nav-pill{ animation:none; } }
  #nav-hl{
    position: absolute;
    background: var(--accent);
    border-radius: 999px;
    box-shadow: 0 0 18px var(--accent-glow);
    transition: left 0.3s cubic-bezier(0.34,1.56,0.64,1), width 0.3s cubic-bezier(0.34,1.56,0.64,1);
    z-index: 0;
    pointer-events: none;
    display: none;
  }
  .logo{
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: var(--font-body);
    font-size: 15.2px;
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    letter-spacing: -0.01em;
    padding: 4px 10px 4px 8px;
  }
  .logo .accent-word{ color: var(--accent); }

  nav.links{
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
  }
  .nav-item{
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 13.6px;
    font-weight: 500;
    padding: 9px 16px;
    border-radius: 999px;
    transition: color 0.15s ease;
  }
  .nav-item:hover{ color: var(--text); }
  .nav-item.active{ color: #fff; }

  .nav-cta{
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-body);
    font-size: 13.6px;
    font-weight: 700;
    padding: 9px 18px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
    box-shadow: 0 0 16px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.22);
    transition: background 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
    margin-left: 10px;
  }
  .nav-cta:hover{ background: var(--accent-hover); transform: translateY(-1px); }

  /* ---------- MOBILE NAV ---------- */
  #mob-top-header{
    display: none;
    position: fixed;
    top: 14px;
    left: 0;
    right: 0;
    z-index: 60;
    justify-content: center;
    pointer-events: none;
  }
  #mob-top-header .mh-pill{
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px 8px 10px;
    background: rgba(15,15,20,0.6);
    backdrop-filter: blur(24px) saturate(180%) brightness(0.96);
    -webkit-backdrop-filter: blur(24px) saturate(180%) brightness(0.96);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.07);
    text-decoration: none;
    animation: navDropIn 0.55s cubic-bezier(0.34,1.3,0.64,1) both;
  }
  #mob-top-header .mh-icon{ width: 22px; height: 22px; flex-shrink: 0; color: var(--accent); }
  #mob-top-header .mh-txt{
    font-family: var(--font-body);
    font-size: 13.6px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    white-space: nowrap;
  }
  #mob-top-header .mh-txt .accent-word{ color: var(--accent); }

  #mob-bottom-nav{
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    align-items: center;
    gap: 0;
    background: rgba(15,15,20,0.6);
    backdrop-filter: blur(24px) saturate(180%) brightness(0.96);
    -webkit-backdrop-filter: blur(24px) saturate(180%) brightness(0.96);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
    padding: 6px 6px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.07);
    animation: navBotIn 0.55s cubic-bezier(0.34,1.3,0.64,1) both;
  }
  @keyframes navBotIn{ from{ opacity:0; transform:translateX(-50%) translateY(60px); } to{ opacity:1; transform:translateX(-50%) translateY(0); } }
  @media (prefers-reduced-motion: reduce){
    #mob-top-header .mh-pill{ animation:none; }
    #mob-bottom-nav{ animation:none; }
  }
  #mnb-hl{
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 0;
    width: 0;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
    transition: left 0.3s cubic-bezier(0.34,1.56,0.64,1), width 0.3s cubic-bezier(0.34,1.56,0.64,1);
    pointer-events: none;
    z-index: 0;
  }
  .mnb{
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 9px 16px;
    border-radius: 999px;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease;
    min-width: 52px;
  }
  .mnb.act{ color: var(--accent); }
  .mnb .icon{ width: 19px; height: 19px; }
  .mnb-wide{
    flex-direction: row;
    gap: 6px;
    padding: 9px 14px;
    min-width: unset;
  }
  .mnb-wide .icon{ width: 17px; height: 17px; }
  .mnb-label{
    font-family: var(--font-body);
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
  }
  .mnb-tip{
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15,15,20,0.92);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 5px 10px;
    font-family: var(--font-body);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease;
  }
  .mnb.tip-show .mnb-tip{ opacity: 1; }

  @media (max-width: 760px){
    .site-nav{ display: none; }
    #mob-top-header{ display: flex; }
    #mob-bottom-nav{ display: flex; }
    body{ padding-bottom: 92px; }
  }

  @media (min-width: 761px){
    #mob-top-header{ display: none !important; }
    #mob-bottom-nav{ display: none !important; }
  }

  /* ---------- HERO / CAROUSEL ---------- */
.hero{
    position: relative;
    min-height: 0;
    display: flex;
    align-items: center;
    padding-top: 132px;
    padding-bottom: 36px;
    overflow: hidden;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><path d="M48 0H0V48" fill="none" stroke="%23161620" stroke-width="1"/></svg>');
    background-repeat: repeat;
  }

  .hero-content{ max-width: 680px; }

  /* Scripts section fills the remaining viewport, so the catalog reads as the whole page —
     everything above the YouTube section. */
  #scripts{
    min-height: calc(100vh - 260px);
    padding-top: 0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><path d="M48 0H0V48" fill="none" stroke="%23161620" stroke-width="1"/></svg>');
    background-repeat: repeat;
  }
  @media (max-width: 760px){ #scripts{ min-height: calc(100vh - 300px); } }

  @keyframes heroReveal{ from{ opacity:0; transform:translateY(16px); } to{ opacity:1; transform:translateY(0); } }
  .hero-content .meta-row{ animation: heroReveal 0.6s cubic-bezier(0.2,1,0.4,1) both; animation-delay: 0.05s; }
  .hero-content h1{ animation: heroReveal 0.6s cubic-bezier(0.2,1,0.4,1) both; animation-delay: 0.12s; }
  .hero-content p.lede{ animation: heroReveal 0.6s cubic-bezier(0.2,1,0.4,1) both; animation-delay: 0.2s; }
  .hero-content .btn-row{ animation: heroReveal 0.6s cubic-bezier(0.2,1,0.4,1) both; animation-delay: 0.28s; }
  @media (prefers-reduced-motion: reduce){
    .hero-content .meta-row, .hero-content h1, .hero-content p.lede, .hero-content .btn-row{ animation:none; }
  }

  .meta-row{
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--accent);
    letter-spacing: 0.03em;
    margin: 0 0 18px;
  }
  .meta-row .sep{ color: var(--muted); margin: 0 8px; }

  .hero-content h1{
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(34px, 5vw, 54px);
    line-height: 1.05;
    margin: 0 0 16px;
    letter-spacing: -0.01em;
  }

  .hero-content p.lede{
    font-size: 16px;
    color: var(--muted);
    max-width: 56ch;
    margin: 0 0 8px;
  }

  .btn-row{ display:flex; gap: 12px; flex-wrap: wrap; }

  .btn{
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 600;
    text-decoration: none;
    padding: 13px 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items:center;
    gap: 9px;
    transition: background 0.15s ease, border-color 0.15s ease;
    border: 1px solid transparent;
  }
  .btn-primary{ background: var(--accent); color: #fff; box-shadow: 0 4px 18px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.18); }
  .btn-primary:hover{ background: var(--accent-hover); transform: translateY(-1px); }
  .btn-primary svg{ width: 13px; height: 13px; }
  .btn-ghost{ background: var(--panel-raised); border-color: var(--line); color: var(--text); }
  .btn-ghost:hover{ border-color: var(--muted); }

  /* ---------- SECTION SHARED ---------- */
  section.content-section{ padding: 90px 0; border-top: 1px solid var(--line); }
  #scripts{ border-top: none; }

  .section-head{
    display:flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 48px;
    flex-wrap: wrap;
  }
  .section-head h2{
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 38px);
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.01em;
    max-width: 20ch;
  }
  .section-head p{ color: var(--muted); max-width: 38ch; margin: 0; font-size: 14.5px; }

  /* ---------- SCRIPTS GRID ---------- */
  .script-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
  @media (max-width: 900px){ .script-grid{ grid-template-columns: 1fr; } }

  .card{
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.34,1.3,0.64,1), box-shadow 0.25s ease, border-color 0.25s ease;
    display:flex;
    flex-direction: column;
    scroll-margin-top: 120px;
  }
  .card:hover{
    transform: scale(1.025);
    border-color: #3a3a46;
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
    z-index: 2;
  }
  @media (prefers-reduced-motion: reduce){ .card:hover{ transform:none; } }

  .card-head{
    display:flex;
    justify-content: space-between;
    align-items:center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--panel-raised);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
  }

  .card-actions{ display: flex; align-items: center; gap: 10px; }
  .card-actions .btn-primary{ flex: 1; }

  .video-btn{
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-raised);
    border: 1px solid var(--line);
    color: var(--muted);
    transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s cubic-bezier(0.34,1.3,0.64,1);
  }
  .video-btn svg{ width: 19px; height: 19px; }
  .video-btn:hover{ color: var(--text); border-color: var(--muted); transform: translateY(-1px); }

  .card-thumb{
    position: relative;
    aspect-ratio: 16 / 9;
    background-color: var(--panel-raised);
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid var(--line);
  }
  .card-thumb-empty{
    background-image: linear-gradient(135deg, var(--panel-raised), var(--panel));
  }
  .card-badge{
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    background: rgba(15,15,20,0.75);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.12);
  }
  .card-game{
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    letter-spacing: 0.03em;
    margin: 0 0 8px;
  }
  .chip-key{ color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }

  .card-body{ padding: 22px; flex:1; display:flex; flex-direction:column; }
  .card-body h3{ font-family: var(--font-display); font-size: 20px; margin: 0 0 10px; font-weight: 600; }
  .card-body p:not(.card-game){ font-size: 14px; color: var(--muted); margin: 0 0 20px; flex: 1; }

  .tag-row{ display:flex; flex-wrap:wrap; gap: 8px; margin-bottom: 18px; }
  .chip{
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 4px 9px;
    border-radius: 999px;
  }

  .card-link{
    font-family: var(--font-mono);
    font-size: 12.5px;
    text-decoration: none;
    color: var(--text);
    border-top: 1px solid var(--line);
    padding-top: 14px;
    display:inline-flex;
    align-items:center;
    gap: 6px;
    transition: color 0.15s ease, transform 0.15s cubic-bezier(0.34,1.3,0.64,1);
  }
  .card-link:hover{ color: var(--accent); transform: translateX(3px); }

  /* ---------- YOUTUBE ---------- */
  .yt-layout{ display:grid; grid-template-columns: 0.85fr 1.15fr; gap: 56px; }
  @media (max-width: 860px){ .yt-layout{ grid-template-columns: 1fr; } }
  .yt-copy p{ color: var(--muted); font-size: 15px; max-width: 44ch; }

  .yt-embed-wrap{
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--panel);
  }
  .yt-embed-frame{ position: relative; aspect-ratio: 16 / 9; }
  .yt-embed-frame iframe{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
  }
  .yt-embed-fallback{
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    color: var(--muted);
    font-size: 13.5px;
    background: var(--panel-raised);
  }

  /* ---------- SEARCH + FILTERS ---------- */
  .script-toolbar{
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
  }
  .search-pill{
    flex: 1 1 320px;
    max-width: 560px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 12px 18px;
    color: var(--muted);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s cubic-bezier(0.34,1.3,0.64,1);
  }
  .search-pill:focus-within{
    border-color: var(--accent);
    color: var(--text);
    box-shadow: 0 0 0 4px var(--accent-soft);
    transform: scale(1.01);
  }
  .search-pill svg{ width: 17px; height: 17px; flex-shrink: 0; transition: color 0.2s ease; }
  .search-pill:focus-within svg{ color: var(--accent); }
  .search-pill input{
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font-body);
    font-size: 14.5px;
    color: var(--text);
  }
  .search-pill input::placeholder{ color: var(--muted); }

  .filter-wrap{ position: relative; flex-shrink: 0; }
  .filter-btn{
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.15s cubic-bezier(0.34,1.3,0.64,1);
  }
  .filter-btn svg{ width: 18px; height: 18px; transition: transform 0.25s cubic-bezier(0.34,1.3,0.64,1); }
  .filter-btn:hover{ border-color: var(--muted); transform: translateY(-1px); }
  .filter-btn.active{ background: var(--accent); border-color: var(--accent); color: #fff; }
  .filter-btn.active svg{ transform: rotate(180deg); }

  .filter-panel{
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 240px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
    z-index: 10;
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.2,1,0.4,1), transform 0.2s cubic-bezier(0.2,1,0.4,1);
  }
  .filter-panel.open{ opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
  .filter-group{ display: flex; flex-direction: column; gap: 6px; }
  .filter-group label{
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.03em;
  }
  .filter-group select{
    background: var(--panel-raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 10px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 13.5px;
  }

  @media (max-width: 600px){
    .script-toolbar{ flex-wrap: nowrap; }
    .search-pill{ flex: 1 1 auto; max-width: none; }
    .filter-panel{ right: 0; left: auto; width: min(240px, calc(100vw - 48px)); }
  }

  /* ---------- SCRIPT GRID EMPTY STATE ---------- */
  .empty-state{
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 80px 24px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    color: var(--muted);
    text-align: center;
  }
  .empty-state svg{ width: 34px; height: 34px; opacity: 0.6; }
  .empty-state p{ margin: 0; font-size: 14.5px; }

  /* ---------- SCROLL REVEAL ---------- */
  .reveal{
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s cubic-bezier(0.2,1,0.4,1), transform 0.7s cubic-bezier(0.2,1,0.4,1);
  }
  .reveal.in{ opacity: 1; transform: none; }
  .script-grid .card:nth-child(1){ transition-delay: 0s; }
  .script-grid .card:nth-child(2){ transition-delay: 0.08s; }
  .script-grid .card:nth-child(3){ transition-delay: 0.16s; }
  @media (prefers-reduced-motion: reduce){
    .reveal{ opacity:1; transform:none; transition:none; }
  }