:root {
    --bg: #141414;
    --bg-deep: #0b0b0b;
    --surface: #181818;
    --ink: #ffffff;
    --muted: #b3b3b3;
    --line: rgba(255, 255, 255, 0.12);
    --red: #e50914;
    --red-hover: #f40612;
    --green: #46d369;
    --max: 100%;
    --pad: clamp(1rem, 3vw, 3.5rem);
    --sans: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --card-w: clamp(140px, 16vw, 240px);
    --card-h: calc(var(--card-w) * 0.56);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.nf-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; height: 100%; object-fit: cover; }

.nf-preview {
    background: var(--red);
    color: #fff;
    text-align: center;
    padding: .5rem 1rem;
    font-weight: 700;
    font-size: .85rem;
    position: relative;
    z-index: 60;
}
.nf-preview a { text-decoration: underline; }

/* —— Header —— */
.nf-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 50;
    background: linear-gradient(180deg, rgba(0,0,0,.85) 0%, rgba(0,0,0,.35) 60%, transparent 100%);
    transition: background .35s ease;
}
.nf-header.is-solid {
    background: rgba(20, 20, 20, 0.97);
    box-shadow: 0 1px 0 rgba(0,0,0,.4);
}
.nf-header-inner {
    width: 100%;
    padding: 0 var(--pad);
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.nf-brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    flex-shrink: 0;
}
.nf-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    display: grid;
    place-content: center;
    background: var(--red);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -.04em;
}
.nf-brand-name {
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -.03em;
    color: var(--red);
}
.nf-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .15rem 1.1rem;
    margin-right: auto;
}
.nf-nav a {
    font-size: .9rem;
    color: var(--muted);
    transition: color .2s ease;
}
.nf-nav a:hover,
.nf-nav a.is-active { color: var(--ink); font-weight: 600; }

.nf-tools {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-left: auto;
}
.nf-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    display: grid;
    place-content: center;
    border-radius: 4px;
}
.nf-icon-btn:hover { background: rgba(255,255,255,.08); }
.nf-dot {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 2px var(--bg);
}
.nf-search {
    width: 0;
    overflow: hidden;
    opacity: 0;
    transition: width .25s var(--ease), opacity .2s ease;
    border: 1px solid transparent;
    background: rgba(0,0,0,.75);
}
.nf-search.is-open {
    width: min(240px, 42vw);
    opacity: 1;
    border-color: var(--ink);
    padding: 0 .65rem;
}
.nf-search input {
    width: 100%;
    height: 34px;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: .85rem;
}
.nf-avatar {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    display: grid;
    place-content: center;
    background: linear-gradient(145deg, #e50914, #831010);
    font-weight: 800;
    font-size: .9rem;
}
.nf-burger {
    display: none;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 1.35rem;
    cursor: pointer;
}

.nf-main { padding-bottom: 3rem; }

/* —— Buttons —— */
.nf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem 1.45rem;
    border-radius: 4px;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    border: 0;
    cursor: pointer;
    transition: filter .2s ease, background .2s ease, transform .2s var(--ease);
}
.nf-btn:hover { transform: scale(1.03); }
.nf-btn-play {
    background: var(--red);
    color: #fff;
}
.nf-btn-play:hover { background: var(--red-hover); filter: brightness(1.05); }
.nf-btn-info {
    background: rgba(109, 109, 110, 0.7);
    color: var(--ink);
    backdrop-filter: blur(8px);
}
.nf-btn-info:hover { background: rgba(109, 109, 110, 0.5); }

.nf-series-badge {
    display: inline-block;
    color: var(--red);
    font-weight: 800;
    letter-spacing: .18em;
    text-transform: uppercase;
    font-size: .78rem;
    margin: 0 0 .6rem;
}
.nf-top-badge {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin: 0 0 .75rem;
    font-weight: 700;
    font-size: .95rem;
}
.nf-top-badge span {
    display: inline-grid;
    place-content: center;
    width: 28px;
    height: 28px;
    background: var(--red);
    border-radius: 3px;
    font-size: .55rem;
    font-weight: 800;
    letter-spacing: .02em;
    line-height: 1.05;
    text-align: center;
    padding: 2px;
}
.nf-match { color: var(--green); font-weight: 700; }
.nf-age {
    display: inline-flex;
    padding: .05rem .35rem;
    border: 1px solid var(--muted);
    font-size: .75rem;
    color: var(--muted);
}
.nf-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    background: var(--red);
    color: #fff;
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: .2rem .4rem;
    border-radius: 2px;
}

/* —— Hero —— */
.nf-hero {
    position: relative;
    min-height: clamp(520px, 88vh, 820px);
    display: flex;
    align-items: flex-end;
    margin-bottom: -4rem;
    overflow: hidden;
}
.nf-hero-bg {
    position: absolute;
    inset: 0;
    background: #1a1a1a;
}
.nf-hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
}
.nf-hero-veil {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(20,20,20,.92) 0%, rgba(20,20,20,.55) 42%, rgba(20,20,20,.15) 70%, transparent 100%),
        linear-gradient(0deg, var(--bg) 0%, rgba(20,20,20,.35) 35%, transparent 60%);
}
.nf-hero-content {
    position: relative;
    z-index: 2;
    width: min(640px, calc(100% - 2 * var(--pad)));
    margin: 0 0 12vh var(--pad);
    padding-bottom: 2rem;
}
.nf-hero-content h1 {
    margin: 0 0 .85rem;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.05;
    text-shadow: 0 2px 24px rgba(0,0,0,.55);
}
.nf-hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem .85rem;
    margin-bottom: .9rem;
    font-size: .95rem;
    color: var(--muted);
}
.nf-genre {
    border: 1px solid rgba(255,255,255,.25);
    padding: .1rem .45rem;
    border-radius: 2px;
    font-size: .8rem;
}
.nf-synopsis {
    margin: 0 0 1.35rem;
    max-width: 36rem;
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.45;
    color: #e5e5e5;
    text-shadow: 0 1px 8px rgba(0,0,0,.45);
}
.nf-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

/* —— Rails —— */
.nf-rail-section {
    position: relative;
    z-index: 3;
    padding: 0 0 1.25rem;
    margin-top: .35rem;
}
.nf-rail-section:first-of-type { margin-top: 0; }
.nf-search-page,
.nf-cat-page { padding-top: 6rem; }
.nf-rail-head {
    padding: 0 var(--pad);
    margin-bottom: .55rem;
}
.nf-rail-head h1,
.nf-rail-head h2 {
    margin: 0;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    font-weight: 700;
}
.nf-rail {
    position: relative;
}
.nf-track {
    display: flex;
    gap: .4rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: .85rem var(--pad) 2.5rem;
    scrollbar-width: none;
}
.nf-track::-webkit-scrollbar { display: none; }
.nf-track-rank { gap: .15rem; padding-top: 1.25rem; }
.nf-rail-btn {
    position: absolute;
    top: 0;
    bottom: 2.5rem;
    z-index: 4;
    width: 3rem;
    border: 0;
    background: rgba(20,20,20,.55);
    color: var(--ink);
    font-size: 2.5rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s ease, background .2s ease;
}
.nf-rail:hover .nf-rail-btn { opacity: 1; }
.nf-rail-btn:hover { background: rgba(20,20,20,.85); }
.nf-rail-btn { left: 0; }
.nf-rail-btn-next { left: auto; right: 0; }

/* —— Cards —— */
.nf-card {
    position: relative;
    flex: 0 0 var(--card-w);
    scroll-snap-align: start;
    z-index: 1;
    transition: z-index 0s .2s;
}
.nf-card:hover {
    z-index: 8;
    transition-delay: 0s;
}
.nf-card-media {
    position: relative;
    display: block;
    height: var(--card-h);
    border-radius: 4px;
    overflow: hidden;
    background: var(--surface);
    transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.nf-card:hover .nf-card-media {
    transform: scale(1.08);
    box-shadow: 0 8px 28px rgba(0,0,0,.55);
}
.nf-fallback {
    display: grid;
    place-content: center;
    height: 100%;
    color: var(--muted);
    font-weight: 800;
    letter-spacing: .08em;
}
.nf-rank {
    position: absolute;
    left: -6px;
    bottom: -8px;
    z-index: 2;
    font-size: clamp(4.5rem, 9vw, 7.5rem);
    font-weight: 900;
    line-height: .8;
    color: #000;
    -webkit-text-stroke: 3px #808080;
    text-shadow: 0 0 12px rgba(0,0,0,.5);
    pointer-events: none;
}
.nf-card-rank { padding-left: 1.6rem; }
.nf-card-rank .nf-card-media { margin-left: .4rem; }

.nf-card-pop {
    position: absolute;
    left: 50%;
    top: 0;
    width: min(320px, calc(var(--card-w) * 1.45));
    transform: translate(-50%, -12%) scale(.92);
    opacity: 0;
    pointer-events: none;
    background: #181818;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,.65);
    transition: opacity .2s ease, transform .25s var(--ease);
}
.nf-card:hover .nf-card-pop {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -18%) scale(1);
}
.nf-card-pop-media {
    height: calc(var(--card-h) * 1.15);
    background: #222;
}
.nf-card-pop-body { padding: .85rem 1rem 1.1rem; }
.nf-card-actions {
    display: flex;
    gap: .45rem;
    margin-bottom: .65rem;
}
.nf-mini {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.45);
    display: grid;
    place-content: center;
    font-size: .85rem;
    background: rgba(42,42,42,.9);
    transition: border-color .15s ease, background .15s ease;
}
.nf-mini:hover { border-color: #fff; }
.nf-mini-play {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}
.nf-card-pop h3 {
    margin: 0 0 .4rem;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.25;
}
.nf-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .55rem;
    margin: 0 0 .35rem;
    font-size: .78rem;
    color: var(--muted);
}
.nf-card-genre {
    margin: 0 0 .35rem;
    font-size: .78rem;
    color: #ddd;
}
.nf-card-excerpt {
    margin: 0;
    font-size: .75rem;
    color: var(--muted);
    line-height: 1.35;
}

.nf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .75rem;
    padding: 0 var(--pad) 2rem;
}
.nf-grid .nf-card { flex: none; width: 100%; }
.nf-grid .nf-card-pop { display: none; }
.nf-grid .nf-card:hover .nf-card-media { transform: scale(1.04); }

.nf-empty {
    padding: 2rem var(--pad);
    color: var(--muted);
}
.nf-empty-page {
    min-height: 70vh;
    display: grid;
    place-content: center;
    text-align: center;
    gap: .75rem;
    padding: 6rem var(--pad) 2rem;
}
.nf-empty-page h1 { margin: 0; font-size: 2rem; }
.nf-empty-page p { margin: 0 0 1rem; color: var(--muted); }

/* —— Article —— */
.nf-article-hero {
    position: relative;
    min-height: clamp(420px, 70vh, 640px);
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}
.nf-article-hero > img {
    position: absolute;
    inset: 0;
}
.nf-article-hero-copy {
    position: relative;
    z-index: 2;
    width: min(640px, calc(100% - 2 * var(--pad)));
    margin: 0 0 3rem var(--pad);
}
.nf-article-hero-copy h1 {
    margin: 0 0 .85rem;
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -.03em;
}
.nf-article-body {
    width: min(760px, calc(100% - 2 * var(--pad)));
    margin: 0 auto;
    padding: 2rem 0 1rem;
}
.nf-prose {
    color: #d2d2d2;
    line-height: 1.7;
    font-size: 1.05rem;
}
.nf-prose p { margin: 0 0 1.1rem; }
.nf-prose img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1rem 0;
}
.nf-source { margin-top: 1.75rem; }

/* —— Footer —— */
.nf-footer {
    border-top: 1px solid var(--line);
    margin-top: 2rem;
    padding: 2.5rem var(--pad) 3rem;
    color: #808080;
    font-size: .9rem;
}
.nf-footer-inner { max-width: 980px; }
.nf-footer-social { margin: 0 0 1.25rem; }
.nf-footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .65rem 1.5rem;
    margin-bottom: 1.5rem;
}
.nf-footer-grid a:hover { text-decoration: underline; }
.nf-footer-copy { margin: 0; font-size: .8rem; }

@media (max-width: 900px) {
    .nf-burger { display: grid; place-content: center; order: -1; }
    .nf-nav {
        display: none;
        position: absolute;
        top: 68px;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: rgba(20,20,20,.98);
        padding: .5rem var(--pad) 1rem;
        border-bottom: 1px solid var(--line);
    }
    .nf-nav.is-open { display: flex; }
    .nf-nav a { padding: .65rem 0; }
    .nf-brand-name { font-size: 1.1rem; }
    .nf-card-pop { display: none; }
    .nf-hero { min-height: 70vh; margin-bottom: -2rem; }
    .nf-hero-content { margin-bottom: 8vh; }
    .nf-rail-btn { opacity: .7; width: 2.25rem; font-size: 1.8rem; }
}

@media (hover: none) {
    .nf-card-pop { display: none; }
    .nf-card:hover .nf-card-media { transform: none; }
}
