/* Self-hosted variable fonts (latin subset) — keeps CSP strict, works offline */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/fonts/inter-latin.woff2') format('woff2');
}
@font-face {
    font-family: 'Space Grotesk';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('/fonts/space-grotesk-latin.woff2') format('woff2');
}
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url('/fonts/jetbrains-mono-latin.woff2') format('woff2');
}

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

:root {
    --bg: #050510;
    --glass-bg: rgba(255, 255, 255, 0.045);
    --glass-bg-hover: rgba(255, 255, 255, 0.09);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-hover: rgba(255, 255, 255, 0.26);
    --text: #f0f0ff;
    --muted: rgba(200, 200, 230, 0.6);
    --radius: 20px;

    --font-display: 'Space Grotesk', 'Inter', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

    /* Section-specific accent colors */
    --accent-media: #3b82f6;
    --accent-automation: #8b5cf6;
    --accent-ai: #06b6d4;
    --accent-gaming: #ec4899;
    --accent-dev: #10b981;
    --accent-now: #f59e0b;
    --accent-cloud: #14b8a6;
    --accent-system: #f43f5e;
    --accent-network: #0ea5e9;

    /* Default accent (overridden per section) */
    --accent: #a78bfa;

    /* Mouse-parallax offsets (updated via JS) */
    --mx: 0px;
    --my: 0px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* Starfield canvas (drawn via JS) */
#starfield {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* Animated aurora gradient mesh */
body::before {
    content: '';
    position: fixed;
    inset: -8%;
    background:
        radial-gradient(ellipse 700px 500px at 5% 15%,  rgba(111, 63, 220, 0.38) 0%, transparent 65%),
        radial-gradient(ellipse 600px 600px at 90% 10%,  rgba(37, 99, 235, 0.3) 0%, transparent 65%),
        radial-gradient(ellipse 800px 500px at 55% 90%,  rgba(6, 148, 162, 0.24) 0%, transparent 65%),
        radial-gradient(ellipse 500px 400px at 20% 75%,  rgba(168, 85, 247, 0.2) 0%, transparent 60%),
        radial-gradient(ellipse 400px 300px at 75% 55%,  rgba(59, 130, 246, 0.14) 0%, transparent 55%);
    pointer-events: none;
    z-index: 0;
    animation: auroraShift 24s ease-in-out infinite;
    transform: translate3d(var(--mx), var(--my), 0);
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform, filter;
}

@keyframes auroraShift {
    0%, 100% { filter: hue-rotate(0deg) brightness(1) saturate(1); }
    33%      { filter: hue-rotate(-14deg) brightness(1.12) saturate(1.15); }
    66%      { filter: hue-rotate(10deg) brightness(1.05) saturate(1.08); }
}

/* Perspective grid floor — subtle sci-fi horizon */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(139, 92, 246, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 92, 246, 0.05) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, rgba(0,0,0,0.9), transparent 75%);
    mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, rgba(0,0,0,0.9), transparent 75%);
    pointer-events: none;
    z-index: 0;
}

@media (prefers-reduced-motion: reduce) {
    body::before { transition: none; animation: none; }
    #starfield { display: none; }
}

/* Quiet mode keeps the dashboard readable during long monitoring sessions. */
body.quiet-mode::before,
body.quiet-mode::after,
body.quiet-mode #starfield {
    display: none;
}

body.quiet-mode h1,
body.quiet-mode .header-label::before,
body.quiet-mode .np-badge-dot,
body.quiet-mode .np-progress-fill::after {
    animation: none;
}

.page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Keep content clear of the notch / Dynamic Island / home indicator
       when installed with a black-translucent status bar */
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Installed-app polish: content is the chrome, so tighten the top and
   make UI text behave like a native surface, not a document */
@media (display-mode: standalone) {
    .container {
        padding-top: 36px;
    }

    .card, .section-header, header, .cmdk-trigger {
        -webkit-user-select: none;
        user-select: none;
    }
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 48px 24px 60px;
    flex: 1;
    width: 100%;
}

@media (min-width: 768px) {
    .container {
        padding: 72px 48px 60px;
    }
}

/* Header */
header {
    text-align: center;
    margin-bottom: 64px;
    animation: slideDown 0.8s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(167, 139, 250, 0.95);
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 7px 18px;
    border-radius: 50px;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 24px rgba(139, 92, 246, 0.15), inset 0 0 12px rgba(139, 92, 246, 0.06);
}

.header-label::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 10px #34d399;
    animation: pulse 2.4s ease-in-out infinite;
}

/* Connectivity-aware: pill turns red when the browser goes offline */
.header-label.offline {
    color: rgba(252, 165, 165, 0.95);
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 24px rgba(239, 68, 68, 0.15), inset 0 0 12px rgba(239, 68, 68, 0.06);
}

.header-label.offline::before {
    background: #f87171;
    box-shadow: 0 0 10px #f87171;
}

/* Degraded: at least one service is down (amber) */
.header-label.degraded {
    color: rgba(253, 224, 143, 0.95);
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.32);
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.15), inset 0 0 12px rgba(245, 158, 11, 0.06);
}

.header-label.degraded::before {
    background: #fbbf24;
    box-shadow: 0 0 10px #fbbf24;
}

h1 {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5.5vw, 3.9rem);
    font-weight: 700;
    letter-spacing: -1.5px;
    line-height: 1.08;
    background: linear-gradient(110deg,
        #ffffff 0%,
        #c4b5fd 22%,
        #7dd3fc 42%,
        #ffffff 58%,
        #a78bfa 78%,
        #ffffff 100%);
    background-size: 220% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 14px;
    animation: titleShimmer 7s linear infinite;
}

@keyframes titleShimmer {
    to { background-position: 220% center; }
}

@media (prefers-reduced-motion: reduce) {
    h1 { animation: none; }
}

/* Kinetic title — h1 split into per-character spans; each span carries
   the gradient offset by its position (--kx) so it reads as one
   continuous gradient. --shim is advanced by the shared rAF loop. */
h1.kinetic {
    background: none;
    -webkit-text-fill-color: currentColor;
    animation: none;
}

.kchar {
    display: inline-block;
    background-image: linear-gradient(110deg,
        #ffffff 0%,
        #c4b5fd 22%,
        #7dd3fc 42%,
        #ffffff 58%,
        #a78bfa 78%,
        #ffffff 100%);
    background-size: var(--kw, 200%) 100%;
    background-repeat: repeat-x;
    background-position: calc(-1 * var(--kx, 0px) - var(--shim, 0px)) 0;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: kcharIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    animation-delay: calc(var(--ki, 0) * 35ms);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.kchar.in {
    animation: none;
    opacity: 1;
}

.kchar.wave {
    transform: translateY(calc(var(--amp, 1) * -0.18em));
}

.kspace {
    display: inline-block;
}

@keyframes kcharIn {
    from { opacity: 0; transform: translateY(0.6em); }
    to   { opacity: 1; transform: translateY(0); }
}

.subtitle {
    font-size: 0.95rem;
    color: var(--muted);
    font-weight: 400;
    letter-spacing: 0.5px;
}

.telemetry-updated {
    margin-top: 10px;
    min-height: 1em;
    color: rgba(200, 200, 230, 0.42);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.7px;
}

/* Section */
.section {
    margin-bottom: 60px;
}

/* Scroll-triggered reveals: cards unfold with a diagonal clip-path
   (ikjunim-style fold) once their section enters the viewport.
   JS removes the clip after the animation so hover shadows aren't
   clipped (.revealed). */
.reveal {
    opacity: 0;
}

.in-view .reveal {
    animation: foldIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: var(--reveal-delay, 0s);
}

.reveal.revealed {
    animation: none;
    opacity: 1;
    clip-path: none;
}

@keyframes foldIn {
    from {
        opacity: 0;
        clip-path: polygon(0 0, 0 0, 0 0);
    }
    to {
        opacity: 1;
        clip-path: polygon(-20% -20%, -20% 420%, 420% -20%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .reveal, .in-view .reveal {
        animation: none;
        opacity: 1;
        clip-path: none;
    }
}

/* Per-section accent — drives card glows, borders, section rule */
.section--media      { --accent: var(--accent-media); }
.section--automation { --accent: var(--accent-automation); }
.section--ai         { --accent: var(--accent-ai); }
.section--gaming     { --accent: var(--accent-gaming); }
.section--dev        { --accent: var(--accent-dev); }
.section--now        { --accent: var(--accent-now); }
.section--cloud      { --accent: var(--accent-cloud); }
.section--system     { --accent: var(--accent-system); }
.section--network    { --accent: var(--accent-network); }

/* Attention is a compact operations feed rather than another launcher grid. */
.attention-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
}

.attention-item,
.attention-clear {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 64px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
}

.attention-item.warning { border-color: rgba(245, 158, 11, 0.36); }
.attention-item.critical { border-color: rgba(239, 68, 68, 0.42); }

.attention-dot {
    width: 8px;
    height: 8px;
    margin-top: 5px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.6);
}

.attention-item.warning .attention-dot {
    background: #fbbf24;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
}

.attention-item.critical .attention-dot {
    background: #f87171;
    box-shadow: 0 0 10px rgba(248, 113, 113, 0.65);
}

.attention-title,
.pipeline-name {
    color: var(--text);
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
}

.attention-detail,
.pipeline-summary {
    margin-top: 3px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    line-height: 1.4;
}

.attention-clear {
    grid-column: 1 / -1;
    align-items: center;
    min-height: 54px;
    color: var(--muted);
    font-size: 0.8rem;
}

.pipeline-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.pipeline-item {
    min-height: 76px;
    padding: 15px 16px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
}

.pipeline-item.healthy { border-color: rgba(52, 211, 153, 0.28); }
.pipeline-item.warning { border-color: rgba(245, 158, 11, 0.4); }
.pipeline-item.critical { border-color: rgba(239, 68, 68, 0.46); }
.pipeline-item.muted { opacity: 0.66; }

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    padding-bottom: 16px;
    position: relative;
}

/* Accent rule: glowing gradient line that draws itself in from the
   left, pen-stroke style, when the section scrolls into view */
.section-header::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--accent) 75%, transparent) 0%,
        color-mix(in srgb, var(--accent) 25%, transparent) 30%,
        rgba(255, 255, 255, 0.06) 70%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.1s;
}

.section.in-view .section-header::after {
    transform: scaleX(1);
}

@media (prefers-reduced-motion: reduce) {
    .section-header::after {
        transform: none;
        transition: none;
    }
}

.section-icon {
    font-size: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 18%, transparent);
}

.section-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: color-mix(in srgb, var(--accent) 85%, white);
    text-shadow: 0 0 16px color-mix(in srgb, var(--accent) 55%, transparent);
}

/* Services Grid - Responsive */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    perspective: 1200px;
}

/* Mobile: 2 columns */
@media (min-width: 480px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
}

/* Tablet: 3 columns */
@media (min-width: 900px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
}

/* Desktop: 4 columns */
@media (min-width: 1400px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

/* Large screens: 5 columns */
@media (min-width: 1900px) {
    .grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 20px;
    }
}

/* Service Card - 3D tilt + accent cursor glow + shine sweep */
.card {
    --rx: 0deg;
    --ry: 0deg;
    --glow-x: 50%;
    --glow-y: 50%;
    /* Per-card brand tint for the hover glow; falls back to the
       section accent when a card has no brand colour of its own. */
    --glow: var(--accent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 28px 20px 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    text-align: center;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease, border-color 0.3s ease, box-shadow 0.4s ease;
    transform: perspective(1000px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(0) scale(1);
    transform-style: preserve-3d;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    min-height: 240px;
}

/* Top edge highlight — glassy bevel */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    opacity: 0.5;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.card:hover::before {
    opacity: 1;
}

/* Cursor-tracking accent glow */
.card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--glow-x) var(--glow-y),
        color-mix(in srgb, var(--glow) 34%, transparent) 0%, transparent 55%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover {
    background: var(--glass-bg-hover);
    border-color: color-mix(in srgb, var(--glow) 55%, var(--glass-border-hover));
    transform: perspective(1000px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(-12px) scale(1.03);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5),
                0 0 42px color-mix(in srgb, var(--glow) 30%, transparent);
}

.card:hover::after {
    opacity: 1;
}

/* Shine sweep across the card face on hover */
.card .shine {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(105deg,
        transparent 40%,
        rgba(255, 255, 255, 0.07) 48%,
        rgba(255, 255, 255, 0.14) 50%,
        rgba(255, 255, 255, 0.07) 52%,
        transparent 60%);
    transform: translateX(-120%);
    z-index: 3;
}

.card:hover .shine {
    animation: shineSweep 0.9s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes shineSweep {
    to { transform: translateX(120%); }
}

@media (prefers-reduced-motion: reduce) {
    .card { transition: background 0.3s ease, border-color 0.3s ease; transform: none !important; }
    .card:hover { transform: none !important; }
    .card .shine { display: none; }
}

/* Click sparkle particles */
.sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff 0%, rgba(167, 139, 250, 0.8) 60%, transparent 100%);
    pointer-events: none;
    z-index: 5;
    animation: sparkleBurst 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes sparkleBurst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) translate(0, 0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3) translate(var(--sx), var(--sy));
    }
}

/* Ping badge - online/offline + response time, top-right of card */
.ping-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 4px 9px 4px 7px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--muted);
    backdrop-filter: blur(10px);
    transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

/* Shimmer while waiting for the first ping result */
.ping-badge:not(.ready) {
    animation: shimmer 1.6s ease-in-out infinite;
}

.ping-badge.ready {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.28);
    color: rgba(110, 231, 183, 0.95);
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.14);
}

.ping-badge.ready.offline {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.28);
    color: rgba(252, 165, 165, 0.95);
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.14);
}

/* Brief ring pulse in the status colour when a fresh ping lands */
.ping-badge.pinged {
    animation: pingPulse 0.7s ease-out;
}

@keyframes pingPulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); }
    100% { box-shadow: 0 0 0 9px transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .ping-badge.pinged { animation: none; }
}

.ping-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.6; transform: scale(0.8); }
}

/* Tiny latency-history sparkline inside the ping badge */
.ping-spark {
    width: 26px;
    height: 10px;
    display: block;
    flex-shrink: 0;
}

/* Narrow cards: collapse the badge to a status dot so it never
   overlaps the icon — the color still says online/offline */
@media (max-width: 600px) {
    .ping-badge {
        padding: 5px;
        top: 12px;
        right: 12px;
    }

    .ping-badge .ping-text,
    .ping-badge .ping-spark {
        display: none;
    }
}

/* Card Icon */
.card-icon {
    width: 54px;
    height: 54px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
}

.card:hover .card-icon {
    transform: scale(1.18) rotateY(12deg) translateY(-2px);
    filter: drop-shadow(0 8px 18px color-mix(in srgb, var(--accent) 50%, transparent));
}

/* Card Info */
.card-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    width: 100%;
}

.card-title {
    display: block;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    line-height: 1.3;
}

.card-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.4;
    font-weight: 400;
}

/* Tags */
.tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 4px 10px;
    border-radius: 12px;
    margin-top: 4px;
    width: fit-content;
    align-self: center;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    color: color-mix(in srgb, var(--accent) 85%, white);
    transition: all 0.3s ease;
}

.card:hover .tag {
    transform: scale(1.05);
    box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* Now Playing Section */
.np-empty {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 28px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 0.82rem;
}

.np-empty svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.5;
}

.np-error {
    border-color: rgba(248, 113, 113, 0.36);
    color: rgba(252, 165, 165, 0.92);
}

.np-sessions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.np-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 22px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border: 1px solid var(--glass-border);
    border-left: 3px solid color-mix(in srgb, var(--accent) 65%, transparent);
    border-radius: var(--radius);
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.np-card:hover {
    background: var(--glass-bg-hover);
    transform: translateX(4px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35),
                0 0 24px color-mix(in srgb, var(--accent) 12%, transparent);
}

/* Ambient backdrop: the poster, blurred and faded, filling the card
   behind the content — fades to the left so text stays legible. */
.np-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.25);
    filter: blur(30px) saturate(1.5);
    opacity: 0.34;
    z-index: 0;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, rgba(0,0,0,0.5) 40%, #000 100%);
    mask-image: linear-gradient(90deg, transparent, rgba(0,0,0,0.5) 40%, #000 100%);
}

.np-card > .np-thumb,
.np-card > .np-thumb-placeholder,
.np-card > .np-info,
.np-card > .np-badge {
    position: relative;
    z-index: 1;
}

.np-thumb {
    width: 50px;
    height: 74px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.np-thumb-placeholder {
    width: 50px;
    height: 74px;
    border-radius: 8px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.np-thumb-placeholder svg {
    width: 22px;
    height: 22px;
    color: var(--muted);
}

.np-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.np-title {
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.np-subtitle {
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.np-meta {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    color: rgba(200, 200, 230, 0.45);
    margin-top: 2px;
    letter-spacing: 0.3px;
}

.np-progress-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
    position: relative;
}

.np-progress-fill {
    height: 100%;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--accent) 90%, transparent),
        color-mix(in srgb, var(--accent) 55%, #ffffff));
    border-radius: 2px;
    transition: width 1s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent);
}

/* Animated light streak along the playing progress bar */
.np-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: translateX(-100%);
    animation: progressStreak 2.4s ease-in-out infinite;
}

@keyframes progressStreak {
    0%   { transform: translateX(-100%); }
    60%, 100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
    .np-progress-fill::after { animation: none; display: none; }
}

.np-badge {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    color: color-mix(in srgb, var(--accent) 85%, white);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    padding: 4px 10px;
    border-radius: 50px;
}

.np-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 90%, white);
    box-shadow: 0 0 8px var(--accent);
    animation: pulse 2s ease-in-out infinite;
}

/* Recently Added — poster grid */
.ra-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 16px;
}

.ra-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.ra-card:hover {
    transform: translateY(-5px);
}

.ra-poster {
    aspect-ratio: 2 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.ra-card:hover .ra-poster {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--glass-border));
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5),
                0 0 24px color-mix(in srgb, var(--accent) 22%, transparent);
}

.ra-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ra-poster svg {
    width: 28px;
    height: 28px;
    color: var(--muted);
}

.ra-title {
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ra-meta {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: rgba(200, 200, 230, 0.45);
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (prefers-reduced-motion: reduce) {
    .ra-card, .ra-card:hover { transform: none; }
}

/* Ambient system telemetry strip (in header, not a card) */
.telemetry {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 16px;
    margin-top: 20px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.4px;
    color: var(--muted);
}

.telemetry-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.telemetry-label {
    text-transform: uppercase;
    letter-spacing: 1.8px;
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(200, 200, 230, 0.45);
}

.telemetry-value {
    color: var(--text);
    font-weight: 700;
}

.telemetry-meter {
    width: 46px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.09);
    overflow: hidden;
}

.telemetry-meter-fill {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: linear-gradient(90deg, #10b981, #f59e0b 60%, #f43f5e 95%);
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.3);
    transition: width 1s ease;
}

.telemetry-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
}

.telemetry-disk-list {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.telemetry-disk {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    color: var(--text);
    font-weight: 700;
}

.telemetry-disk .dname {
    color: rgba(200, 200, 230, 0.45);
    font-weight: 600;
}

.telemetry-disk.warn { color: rgba(245, 158, 11, 0.95); }
.telemetry-disk.hot  { color: rgba(239, 68, 68, 0.95); text-shadow: 0 0 12px rgba(239, 68, 68, 0.5); }

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 40px 16px 40px;
    }

    header {
        margin-bottom: 48px;
    }

    h1 {
        font-size: clamp(1.75rem, 4vw, 2.5rem);
    }

    .section {
        margin-bottom: 48px;
    }

    .card {
        padding: 24px 16px 20px;
        min-height: auto;
    }

    .card-icon {
        width: 48px;
        height: 48px;
    }

    .card-title {
        font-size: 0.85rem;
    }

    .card-desc {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 32px 12px 32px;
    }

    h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .section-label {
        font-size: 0.65rem;
        letter-spacing: 2px;
    }

    .card {
        padding: 20px 12px 16px;
    }

    .card-icon {
        width: 44px;
        height: 44px;
    }

    .card-title {
        font-size: 0.8rem;
    }

    .card-desc {
        font-size: 0.65rem;
    }
}

/* Loading state shimmer */
@keyframes shimmer {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.5), rgba(59, 130, 246, 0.4));
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.7), rgba(59, 130, 246, 0.6));
}

/* Command palette trigger (floating button) */
.cmdk-trigger {
    position: fixed;
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    right: calc(28px + env(safe-area-inset-right, 0px));
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px 18px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border: 1.5px solid var(--glass-border);
    border-radius: 50px;
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.quiet-toggle {
    position: fixed;
    top: calc(24px + env(safe-area-inset-top, 0px));
    right: calc(24px + env(safe-area-inset-right, 0px));
    z-index: 50;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    padding: 0;
    color: var(--muted);
    background: rgba(5, 5, 16, 0.36);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.quiet-toggle:hover,
.quiet-toggle[aria-pressed="true"] {
    color: var(--text);
    background: var(--glass-bg-hover);
    border-color: rgba(125, 211, 252, 0.5);
}

.quiet-toggle svg {
    width: 17px;
    height: 17px;
}

.cmdk-trigger:hover {
    background: var(--glass-bg-hover);
    border-color: rgba(167, 139, 250, 0.5);
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(167, 139, 250, 0.28);
}

.cmdk-trigger svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.cmdk-trigger kbd {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--muted);
    border: 1px solid var(--glass-border);
    border-radius: 5px;
    padding: 2px 6px;
    font-family: var(--font-mono);
}

@media (max-width: 600px) {
    .cmdk-trigger { padding: 13px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); right: calc(20px + env(safe-area-inset-right, 0px)); }
    .cmdk-trigger kbd,
    .cmdk-trigger-label { display: none; }
    .quiet-toggle { top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); }
}

@media (max-width: 720px) {
    .pipeline-grid { grid-template-columns: 1fr; }
}

/* Command palette overlay + modal */
.cmdk-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 12vh 20px 20px;
    background: rgba(5, 5, 16, 0.65);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cmdk-overlay.open {
    opacity: 1;
    visibility: visible;
}

.cmdk-modal {
    width: min(560px, 100%);
    max-height: 64vh;
    display: flex;
    flex-direction: column;
    background: rgba(18, 18, 40, 0.88);
    backdrop-filter: blur(28px) saturate(1.6);
    -webkit-backdrop-filter: blur(28px) saturate(1.6);
    border: 1.5px solid var(--glass-border-hover);
    border-radius: var(--radius);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(139, 92, 246, 0.22);
    overflow: hidden;
    transform: translateY(-18px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.cmdk-overlay.open .cmdk-modal {
    transform: translateY(0) scale(1);
}

.cmdk-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.cmdk-search-icon {
    width: 18px;
    height: 18px;
    color: var(--muted);
    flex-shrink: 0;
}

.cmdk-input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
}

.cmdk-input::placeholder {
    color: var(--muted);
}

.cmdk-esc {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--muted);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 3px 7px;
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.cmdk-results {
    overflow-y: auto;
    padding: 8px;
}

.cmdk-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s ease;
}

.cmdk-item.active,
.cmdk-item:hover {
    background: rgba(139, 92, 246, 0.14);
}

.cmdk-item img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    flex-shrink: 0;
}

.cmdk-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cmdk-item-title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
}

.cmdk-item-desc {
    font-size: 0.72rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmdk-item-arrow {
    margin-left: auto;
    color: var(--muted);
    opacity: 0;
    flex-shrink: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.cmdk-item.active .cmdk-item-arrow,
.cmdk-item:hover .cmdk-item-arrow {
    opacity: 1;
    transform: translateX(2px);
}

.cmdk-empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 0.82rem;
}

@media (prefers-reduced-motion: reduce) {
    .cmdk-overlay, .cmdk-modal, .cmdk-trigger { transition: opacity 0.2s ease, visibility 0.2s ease; transform: none !important; }
}

/* ── Custom cursor (desktop / fine pointers only) ────────────────── */
@media (pointer: fine) {
    body.custom-cursor,
    body.custom-cursor a,
    body.custom-cursor button,
    body.custom-cursor .card {
        cursor: none;
    }

    body.custom-cursor input,
    body.custom-cursor textarea {
        cursor: text;
    }
}

.cursor-dot,
.cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 200;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.cursor-dot {
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    background: #ece9ff;
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.9);
}

.cursor-ring {
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 1.5px solid rgba(167, 139, 250, 0.7);
    box-shadow: 0 0 18px rgba(139, 92, 246, 0.18);
    transition: width 0.25s ease, height 0.25s ease, margin 0.25s ease,
                border-color 0.25s ease, opacity 0.25s ease;
}

.cursor-ring.hovering {
    width: 54px;
    height: 54px;
    margin: -27px 0 0 -27px;
    border-color: rgba(125, 211, 252, 0.85);
}

body.cursor-visible .cursor-dot,
body.cursor-visible .cursor-ring {
    opacity: 1;
}

/* ── Gravity playground (hidden easter egg) ──────────────────────── */
body.gravity-on {
    overflow: hidden;
}

.gravity-overlay {
    position: fixed;
    inset: 0;
    z-index: 95;
    cursor: grab;
}

.gravity-overlay:active {
    cursor: grabbing;
}

.gravity-restore {
    position: fixed;
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 96;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 20px;
    background: rgba(18, 18, 40, 0.85);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border: 1.5px solid var(--glass-border-hover);
    border-radius: 50px;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 30px rgba(167, 139, 250, 0.25);
    animation: slideDown 0.4s ease-out;
}

/* ── Ambient / screensaver mode (fades in after idle) ────────────── */
.ambient {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6vh 24px;
    text-align: center;
    background: radial-gradient(ellipse 120% 100% at 50% 0%, rgba(20, 20, 46, 0.7), rgba(5, 5, 16, 0.92));
    backdrop-filter: blur(22px) saturate(1.3);
    -webkit-backdrop-filter: blur(22px) saturate(1.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.7s ease, visibility 0.7s ease;
}

.ambient.show {
    opacity: 1;
    visibility: visible;
}

.ambient-clock {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(4rem, 15vw, 11rem);
    line-height: 1;
    letter-spacing: -2px;
    background: linear-gradient(110deg, #ffffff 0%, #c4b5fd 30%, #7dd3fc 50%, #ffffff 70%, #a78bfa 100%);
    background-size: 220% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleShimmer 7s linear infinite;
}

.ambient-date {
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 2.4vw, 1.2rem);
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--muted);
}

.ambient-np {
    margin-top: 44px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px 22px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    max-width: min(90vw, 460px);
}

.ambient-poster {
    width: 58px;
    height: 87px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.ambient-np-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    min-width: 0;
}

.ambient-np-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: color-mix(in srgb, var(--accent-now) 85%, white);
}

.ambient-np-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ambient-np-sub {
    font-size: 0.82rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ambient-hint {
    position: absolute;
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(200, 200, 230, 0.28);
}

@media (prefers-reduced-motion: reduce) {
    .ambient { transition: opacity 0.2s ease, visibility 0.2s ease; }
    .ambient-clock { animation: none; }
}
