:root {
    --bg: #000;
    --fg: #fff;
    --muted: rgba(255, 255, 255, 0.48);
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.3);
    --panel: #0a0a0a;
    --max: 1080px;
}

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

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--fg);
    font-family: "Josefin Sans", "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

::selection {
    background: #fff;
    color: #000;
}

/* ---------- top bar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px max(24px, calc((100vw - var(--max)) / 2 + 24px));
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
}

.brand {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: lowercase;
}

.brand span {
    font-weight: 300;
    color: var(--muted);
}

.tag {
    font-size: 0.68rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- layout ---------- */

.wrap {
    flex: 1;
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 8px 24px 80px;
}

/* ---------- carousel ---------- */

.carousel {
    animation: fade-up 0.9s 0.05s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.viewport {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    background: #070707;
    touch-action: pan-y;
}

.track {
    display: flex;
    will-change: transform;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide {
    flex: 0 0 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #070707;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

.empty {
    aspect-ratio: 16 / 9;
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--muted);
    user-select: none;
}

.nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.2s, border-color 0.2s;
}

.nav:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: var(--line-strong);
}

.nav svg {
    width: 20px;
    height: 20px;
}

.nav.prev {
    left: 14px;
}

.nav.next {
    right: 14px;
}

.carousel-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 14px;
    min-height: 18px;
}

.dots {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 6px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    cursor: pointer;
    transition: background 0.25s, transform 0.25s;
}

.dot:hover {
    background: rgba(255, 255, 255, 0.5);
}

.dot.active {
    background: #fff;
    transform: scale(1.4);
}

.counter {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* ---------- script ---------- */

.script {
    margin-top: 40px;
    animation: fade-up 0.9s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.script h2 {
    margin-bottom: 12px;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--muted);
}

.code-row {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    overflow: hidden;
    transition: border-color 0.25s;
}

.code-row:hover {
    border-color: var(--line-strong);
}

.code {
    flex: 1;
    min-width: 0;
    padding: 18px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    color: #eaeaea;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.code::-webkit-scrollbar {
    height: 6px;
}

.code::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 3px;
}

.copy {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 22px;
    border: 0;
    border-left: 1px solid var(--line);
    background: transparent;
    color: var(--fg);
    font-family: inherit;
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.copy:hover {
    background: rgba(255, 255, 255, 0.07);
}

.copy.done {
    background: #fff;
    color: #000;
}

/* ---------- links ---------- */

.links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 28px;
    animation: fade-up 0.9s 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.link-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    transition: background 0.25s, border-color 0.25s, transform 0.25s;
}

.link-card:hover {
    background: #101010;
    border-color: var(--line-strong);
    transform: translateY(-2px);
}

.link-card svg {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    opacity: 0.85;
}

.link-text {
    min-width: 0;
}

.link-text strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.link-text small {
    display: block;
    margin-top: 3px;
    font-size: 0.72rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- footer ---------- */

.foot {
    padding: 26px 24px 34px;
    text-align: center;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
}

/* ---------- lightbox ---------- */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 4vmin;
    background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(8px);
    animation: fade-in 0.2s ease both;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    cursor: zoom-out;
}

.lightbox .nav {
    position: fixed;
    top: 50%;
}

.lb-close {
    position: fixed;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.lb-close:hover {
    background: rgba(255, 255, 255, 0.14);
}

.lb-close svg {
    width: 18px;
    height: 18px;
}

/* ---------- animation ---------- */

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.001ms !important;
    }
}

/* ---------- responsive ---------- */

@media (max-width: 760px) {
    .topbar {
        padding: 18px 20px;
    }

    .wrap {
        padding: 4px 20px 64px;
    }

    .links {
        grid-template-columns: 1fr;
    }

    .slide,
    .empty {
        aspect-ratio: 4 / 3;
    }

    .nav {
        width: 36px;
        height: 36px;
    }

    .nav.prev {
        left: 10px;
    }

    .nav.next {
        right: 10px;
    }

    .code-row {
        flex-direction: column;
    }

    .code {
        padding: 16px;
        font-size: 0.76rem;
    }

    .copy {
        border-left: 0;
        border-top: 1px solid var(--line);
        padding: 14px;
    }
}
