/* ==========================================================================
   HEALDEAL THEME SYSTEM
   Supports: dark-lime (default), dark-crimson, and white (light)
   ========================================================================== */

/* 1. Dark Lime (Default Theme) */
:root,
[data-theme="dark-lime"] {
    --bg-body: #111111;
    --bg-panel: #1a1a1a;
    --bg-hover: #242424;
    --bg-glass: rgba(26, 26, 26, 0.95);
    --border: #2a2a2a;
    --border-light: #3a3a3a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #c2f13c;
    --accent-hover: #b9f11d;
    --accent-text: #1a2300;
    --danger: #ef4444;
    --foil-glow: linear-gradient(135deg, rgba(245, 158, 11, 0.4), rgba(236, 72, 153, 0.4), rgba(139, 92, 246, 0.4), rgba(59, 130, 246, 0.4));
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --set-icon-filter: invert(1);
    --logo-filter: none;
    --rarity-c: #ffffff;
    --rarity-u: #8fa1af;
    --rarity-r: #d4af37;
    --rarity-m: #ff5e00;
    --rarity-b: #a8a8a8;
    --wave-1: rgba(194, 241, 60, 0.12);
    --wave-2: rgba(194, 241, 60, 0.25);
    --wave-3: rgba(194, 241, 60, 0.40);
    --wave-4: rgba(194, 241, 60, 0.70);
}

/* 2. Dark Crimson Theme */
[data-theme="dark-crimson"] {
    --bg-body: #111111;
    --bg-panel: #1a1a1a;
    --bg-hover: #242424;
    --bg-glass: rgba(26, 26, 26, 0.95);
    --border: #2a2a2a;
    --border-light: #3a3a3a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: rgb(239, 68, 68);
    --accent-hover: #dc2626;
    --accent-text: #ffffff;
    --danger: #ef4444;
    --foil-glow: linear-gradient(135deg, rgba(239, 68, 68, 0.4), rgba(245, 158, 11, 0.4), rgba(236, 72, 153, 0.4));
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --set-icon-filter: invert(1);
    --logo-filter: none;
    --rarity-c: #ffffff;
    --rarity-u: #8fa1af;
    --rarity-r: #d4af37;
    --rarity-m: #ff5e00;
    --rarity-b: #a8a8a8;
    --wave-1: rgba(239, 68, 68, 0.12);
    --wave-2: rgba(239, 68, 68, 0.25);
    --wave-3: rgba(239, 68, 68, 0.40);
    --wave-4: rgba(239, 68, 68, 0.70);
}

/* 3. White / Light Theme */
[data-theme="white"],
[data-theme="light-white"] {
    --bg-body: #f8fafc;
    --bg-panel: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.95);
    --border: #e2e8f0;
    --border-light: #cbd5e1;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-text: #ffffff;
    --danger: #ef4444;
    --foil-glow: linear-gradient(135deg, rgba(37, 99, 235, 0.4), rgba(168, 85, 247, 0.4), rgba(236, 72, 153, 0.4));
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --set-icon-filter: none;
    --logo-filter: invert(1);
    --rarity-c: #334155;
    --rarity-u: #475569;
    --rarity-r: #b45309;
    --rarity-m: #ea580c;
    --rarity-b: #64748b;
    --wave-1: rgba(37, 99, 235, 0.10);
    --wave-2: rgba(37, 99, 235, 0.22);
    --wave-3: rgba(37, 99, 235, 0.38);
    --wave-4: rgba(37, 99, 235, 0.65);
}

/* Common Global Theme Integration */
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Top Nav Corner Actions: Auth & Theme Switcher */
.top-nav-actions {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#authContainer,
.top-auth-container {
    display: inline-flex;
    align-items: center;
    position: relative;
    z-index: 1;
}

.top-auth-btn {
    height: 38px;
    padding: 0 16px;
    border-radius: 20px;
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    transition: all 0.25s ease;
    outline: none;
    text-decoration: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.top-auth-btn i {
    font-size: 1rem;
    color: var(--accent);
    transition: transform 0.2s ease, color 0.2s ease;
}

.top-auth-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.top-auth-btn:hover i {
    transform: translateX(2px);
}

/* Logged-In Pill State in Top Corner */
.top-auth-pill {
    height: 38px;
    padding: 0 10px 0 14px;
    border-radius: 20px;
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.25s ease;
}

.top-auth-pill .auth-user-icon {
    font-size: 1.15rem;
    color: var(--accent);
}

.top-auth-pill .auth-username {
    letter-spacing: 0.03em;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-auth-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.06);
    margin-left: 2px;
}

.top-auth-logout:hover {
    color: #ffffff;
    background: var(--danger);
    transform: scale(1.15);
}

.theme-switcher-wrapper {
    position: relative;
}

.theme-switcher-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    transition: all 0.25s ease;
    outline: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.theme-switcher-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.08);
}

.theme-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 175px;
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: none;
    flex-direction: column;
    gap: 4px;
    transform-origin: top right;
    animation: themeMenuFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-menu.active {
    display: flex;
}

@keyframes themeMenuFade {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(-6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.theme-opt-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.82rem;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.theme-opt-btn:hover {
    background: var(--bg-hover);
}

.theme-opt-btn.active {
    background: var(--bg-hover);
    color: var(--accent);
    font-weight: 600;
}

.theme-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.theme-dot.lime {
    background-color: #c2f13c;
    box-shadow: 0 0 6px rgba(194, 241, 60, 0.7);
}

.theme-dot.crimson {
    background-color: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.7);
}

.theme-dot.white {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
}

.theme-opt-check {
    margin-left: auto;
    font-size: 0.8rem;
    opacity: 0;
}

.theme-opt-btn.active .theme-opt-check {
    opacity: 1;
}

/* ==========================================================================
   POST-LOAD "LIVING" ANIMATIONS & GLITCH FX
   Triggers seamlessly after intro (~5.2s)
   ========================================================================== */

/* 1. Subtle Static Grain / Noise Overlay */
.static-noise {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2;
    opacity: 0.032;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    animation: noiseJitter 0.35s steps(4) infinite;
}

[data-theme="white"] .static-noise,
[data-theme="light-white"] .static-noise {
    opacity: 0.015;
}

@keyframes noiseJitter {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-2px, 2px); }
    50% { transform: translate(2px, -1px); }
    75% { transform: translate(-1px, -2px); }
    100% { transform: translate(1px, 1px); }
}

/* 2. Center Card 3D Setup & Glitching Cyber Slices (No Glow) */
#root {
    perspective: 800px;
    position: relative;
    z-index: 10 !important;
}

.card {
    width: 12.5rem !important;
    height: 12.5rem !important;
    border-radius: 20px !important;
    transform-style: preserve-3d;
    will-change: transform;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
    position: absolute;
    z-index: 25 !important;
    top: 0 !important;
    bottom: 12vh !important;
    left: 0 !important;
    right: 0 !important;
    margin: auto !important;
}

body.alive .card {
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
    transform-style: preserve-3d;
    will-change: transform;
}

/* Card Glitch Slices and Borders */
.card::before,
.card::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 22px;
    pointer-events: none;
    opacity: 0;
    z-index: 10;
}

body.alive .card::before {
    border: 2px solid var(--accent);
    animation: cardGlitchA 7.2s infinite ease-in-out;
}

body.alive .card::after {
    border: 2px solid var(--danger);
    animation: cardGlitchB 7.2s infinite ease-in-out;
}

@keyframes cardGlitchA {
    0%, 90% {
        opacity: 0;
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
    }
    90.8% {
        opacity: 0.95;
        clip-path: inset(16% 0 54% 0);
        transform: translate(-4px, -1px);
    }
    92% {
        opacity: 0.9;
        clip-path: inset(60% 0 12% 0);
        transform: translate(5px, 2px);
    }
    93.2% {
        opacity: 0.95;
        clip-path: inset(8% 0 74% 0);
        transform: translate(-3px, 1px);
    }
    94.5% {
        opacity: 0;
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
    }
    96% {
        opacity: 0.9;
        clip-path: inset(42% 0 35% 0);
        transform: translate(4px, -2px);
    }
    97.2% {
        opacity: 0.95;
        clip-path: inset(76% 0 8% 0);
        transform: translate(-3px, 0);
    }
    98.5%, 100% {
        opacity: 0;
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
    }
}

@keyframes cardGlitchB {
    0%, 91.2% {
        opacity: 0;
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
    }
    92% {
        opacity: 0.95;
        clip-path: inset(36% 0 44% 0);
        transform: translate(4px, -2px);
    }
    93% {
        opacity: 0.9;
        clip-path: inset(68% 0 16% 0);
        transform: translate(-4px, 2px);
    }
    94.2% {
        opacity: 0.85;
        clip-path: inset(10% 0 68% 0);
        transform: translate(3px, 0);
    }
    95.2% {
        opacity: 0;
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
    }
    96.8% {
        opacity: 0.95;
        clip-path: inset(24% 0 52% 0);
        transform: translate(-4px, 1px);
    }
    98%, 100% {
        opacity: 0;
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
    }
}

/* Hover glitch burst on card */
.card:hover::before {
    opacity: 0.9 !important;
    animation: cardHoverGlitchA 0.3s infinite ease-in-out !important;
}

.card:hover::after {
    opacity: 0.9 !important;
    animation: cardHoverGlitchB 0.3s infinite ease-in-out !important;
}

@keyframes cardHoverGlitchA {
    0% { clip-path: inset(12% 0 58% 0); transform: translate(-4px, -1px); }
    50% { clip-path: inset(62% 0 14% 0); transform: translate(4px, 2px); }
    100% { clip-path: inset(28% 0 42% 0); transform: translate(-2px, 0); }
}

@keyframes cardHoverGlitchB {
    0% { clip-path: inset(48% 0 26% 0); transform: translate(4px, -2px); }
    50% { clip-path: inset(14% 0 68% 0); transform: translate(-4px, 1px); }
    100% { clip-path: inset(72% 0 8% 0); transform: translate(3px, 0); }
}

/* 3. Photo Clean Look (No Glow) with 3D Depth */
.card img,
body.alive .card img,
body.alive .card:hover img {
    filter: none !important;
    box-shadow: none !important;
    width: 160px !important;
    height: 160px !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    transform: translateZ(35px);
    transition: transform 0.2s ease;
}

/* 4. HEALDEAL Cyberpunk Glitch Typography */
.card h1.name,
.name.glitch-text {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    width: 100% !important;
    text-align: center !important;
    white-space: nowrap !important;
    margin: 0.75rem 0 0 0 !important;
    display: block !important;
    cursor: default;
    transform: translateZ(45px);
    z-index: 26 !important;
}

/* Subline "ネットワーク" (Network) Cyber Glitch Typography */
.card .subline,
#networkSubline {
    position: absolute !important;
    top: calc(100% + 2.45rem) !important;
    left: 0 !important;
    width: 100% !important;
    text-align: center !important;
    white-space: nowrap !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.3em !important;
    font-size: 0.84rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.32em !important;
    color: var(--text-muted);
    font-family: 'Hiragino Kaku Gothic ProN', 'Meiryo', 'MS PGothic', 'Yu Gothic', sans-serif;
    transform: translateZ(42px);
    cursor: default;
    user-select: none;
    z-index: 26 !important;
    transition: color 0.3s ease;
}

.subline-char {
    display: inline-block;
    transition: color 0.15s ease, text-shadow 0.15s ease, transform 0.15s ease;
    font-variant-numeric: tabular-nums;
    min-width: 0.95em;
}

/* Actively tweaking/scrambling digit */
.subline-char.tweaking {
    color: var(--accent) !important;
    text-shadow: 0 0 10px var(--accent), -1px 0 var(--danger);
    transform: scale(1.18) translateY(-1px);
    font-family: 'Courier New', Courier, monospace, sans-serif !important;
    font-weight: 700 !important;
}

[data-theme="white"] .subline-char.tweaking,
[data-theme="light-white"] .subline-char.tweaking {
    color: var(--accent) !important;
    text-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
}

body.alive .name.glitch-text {
    animation: glitchIdleCycle 8.5s infinite ease-in-out;
}

body.alive .name.glitch-text::before,
body.alive .name.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    letter-spacing: 0.07em;
}

body.alive .name.glitch-text::before {
    color: var(--accent);
    z-index: -1;
}

body.alive .name.glitch-text::after {
    color: var(--danger);
    z-index: -2;
}

/* Periodic Glitch Sequence: Calm for 7.8s, then 0.7s digital glitch burst */
@keyframes glitchIdleCycle {
    0%, 91% {
        transform: translate(0, 0);
        text-shadow: none;
    }
    91.5% {
        transform: translate(-2px, 1px);
        text-shadow: -2px 0 var(--accent), 2px 0 var(--danger);
    }
    92.5% {
        transform: translate(2px, -1px);
        text-shadow: 2px 0 var(--accent), -2px 0 var(--danger);
    }
    93.5% {
        transform: translate(-1px, 2px);
        text-shadow: -3px 0 var(--danger), 3px 0 var(--accent);
    }
    94.5% {
        transform: translate(0, 0);
        text-shadow: none;
    }
    96% {
        transform: translate(3px, 0);
        text-shadow: 2px 0 var(--accent), -2px 0 var(--danger);
    }
    97% {
        transform: translate(-2px, -1px);
        text-shadow: -2px 0 var(--danger), 2px 0 var(--accent);
    }
    98.5% {
        transform: translate(1px, 1px);
        text-shadow: 1px 0 var(--accent), -1px 0 var(--danger);
    }
    100% {
        transform: translate(0, 0);
        text-shadow: none;
    }
}

/* Pseudo slices on periodic glitch */
body.alive .name.glitch-text::before {
    animation: glitchSliceA 8.5s infinite ease-in-out;
}

body.alive .name.glitch-text::after {
    animation: glitchSliceB 8.5s infinite ease-in-out;
}

@keyframes glitchSliceA {
    0%, 91% {
        opacity: 0;
        clip-path: inset(0 0 0 0);
    }
    91.5% {
        opacity: 0.85;
        clip-path: inset(18% 0 52% 0);
        transform: translate(-3px, -1px);
    }
    92.5% {
        opacity: 0.85;
        clip-path: inset(58% 0 14% 0);
        transform: translate(3px, 1px);
    }
    93.5% {
        opacity: 0.85;
        clip-path: inset(8% 0 78% 0);
        transform: translate(-2px, 0);
    }
    95%, 100% {
        opacity: 0;
        clip-path: inset(0 0 0 0);
    }
}

@keyframes glitchSliceB {
    0%, 92% {
        opacity: 0;
        clip-path: inset(0 0 0 0);
    }
    92.5% {
        opacity: 0.85;
        clip-path: inset(42% 0 38% 0);
        transform: translate(3px, -2px);
    }
    93.5% {
        opacity: 0.85;
        clip-path: inset(72% 0 12% 0);
        transform: translate(-3px, 1px);
    }
    95% {
        opacity: 0.85;
        clip-path: inset(12% 0 68% 0);
        transform: translate(2px, 0);
    }
    96.5%, 100% {
        opacity: 0;
        clip-path: inset(0 0 0 0);
    }
}

/* Interactive Hover Glitch Burst */
.name.glitch-text:hover {
    animation: glitchHoverJitter 0.3s infinite ease-in-out !important;
}

.name.glitch-text:hover::before {
    opacity: 0.9 !important;
    animation: glitchHoverSliceA 0.3s infinite ease-in-out !important;
}

.name.glitch-text:hover::after {
    opacity: 0.9 !important;
    animation: glitchHoverSliceB 0.3s infinite ease-in-out !important;
}

@keyframes glitchHoverJitter {
    0% { transform: translate(0, 0); text-shadow: -2px 0 var(--accent), 2px 0 var(--danger); }
    25% { transform: translate(-2px, 1px); text-shadow: 2px 0 var(--accent), -2px 0 var(--danger); }
    50% { transform: translate(2px, -1px); text-shadow: -3px 0 var(--danger), 3px 0 var(--accent); }
    75% { transform: translate(-1px, 2px); text-shadow: 2px 0 var(--danger), -2px 0 var(--accent); }
    100% { transform: translate(0, 0); text-shadow: -2px 0 var(--accent), 2px 0 var(--danger); }
}

@keyframes glitchHoverSliceA {
    0% { clip-path: inset(10% 0 60% 0); transform: translate(-3px, -1px); }
    50% { clip-path: inset(65% 0 10% 0); transform: translate(3px, 1px); }
    100% { clip-path: inset(30% 0 45% 0); transform: translate(-2px, 0); }
}

@keyframes glitchHoverSliceB {
    0% { clip-path: inset(50% 0 25% 0); transform: translate(3px, -1px); }
    50% { clip-path: inset(15% 0 70% 0); transform: translate(-3px, 2px); }
    100% { clip-path: inset(70% 0 10% 0); transform: translate(2px, 0); }
}

/* 5. Background Signal Micro-Twitch */
body.alive .wrapper {
    animation: bgSignalTwitch 11s infinite ease-in-out;
}

@keyframes bgSignalTwitch {
    0%, 97.4% {
        transform: translate(0, 0) skewX(0deg);
        filter: none;
    }
    97.5% {
        transform: translate(-3px, 1px) skewX(-0.4deg);
        filter: brightness(1.18) contrast(1.08);
    }
    97.9% {
        transform: translate(3px, -1px) skewX(0.5deg);
        filter: brightness(0.88);
    }
    98.3% {
        transform: translate(-1px, 0px) skewX(-0.2deg);
        filter: brightness(1.12);
    }
    98.8%, 100% {
        transform: translate(0, 0) skewX(0deg);
        filter: none;
    }
}

/* 6. Bottom Waves Accent Theme Colors */
.wavecontainer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 2 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

.waves {
    position: relative !important;
    width: 100% !important;
    height: 38vh !important;
    min-height: 250px !important;
    max-height: 42vh !important;
    display: block !important;
    margin-bottom: -1px !important;
}

.wavecontainer .parallax > use:nth-child(1) {
    fill: var(--wave-1) !important;
    transition: fill 0.4s ease;
}
.wavecontainer .parallax > use:nth-child(2) {
    fill: var(--wave-2) !important;
    transition: fill 0.4s ease;
}
.wavecontainer .parallax > use:nth-child(3) {
    fill: var(--wave-3) !important;
    transition: fill 0.4s ease;
}
.wavecontainer .parallax > use:nth-child(4) {
    fill: var(--wave-4) !important;
    transition: fill 0.4s ease;
}

/* 7. Broken TV / CRT Monitor Atmosphere FX */

/* CRT Horizontal Scanlines */
.crt-scanlines {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99990;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 0) 1px,
        rgba(0, 0, 0, 0.32) 2px,
        rgba(0, 0, 0, 0.32) 3px
    );
    opacity: 0.65;
}

[data-theme="white"] .crt-scanlines,
[data-theme="light-white"] .crt-scanlines {
    opacity: 0.15;
}

/* Broken TV V-Hold Distortion Roll Bar */
.tv-roll-bar {
    position: fixed;
    left: 0;
    width: 100vw;
    height: 130px;
    pointer-events: none;
    z-index: 99991;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.05) 45%,
        rgba(0, 0, 0, 0.35) 75%,
        rgba(255, 255, 255, 0) 100%
    );
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.45);
    opacity: 0;
    animation: tvRollSequence 9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

[data-theme="white"] .tv-roll-bar,
[data-theme="light-white"] .tv-roll-bar {
    opacity: 0 !important;
}

@keyframes tvRollSequence {
    0%, 78% {
        top: -150px;
        opacity: 0;
    }
    79% {
        top: -140px;
        opacity: 0.75;
    }
    89% {
        top: 105vh;
        opacity: 0.75;
    }
    90%, 100% {
        top: 105vh;
        opacity: 0;
    }
}

/* TV Static Flash / V-Sync Twitch */
.tv-flicker {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99992;
    background: rgba(255, 255, 255, 0.015);
    opacity: 0;
    animation: tvFlickerCycle 11s infinite ease-in-out;
}

@keyframes tvFlickerCycle {
    0%, 88% {
        opacity: 0;
        transform: scaleY(1);
    }
    88.5% {
        opacity: 0.12;
        transform: scaleY(1.006) translateY(-2px);
    }
    89% {
        opacity: 0.02;
        transform: scaleY(0.998) translateY(1px);
    }
    89.8% {
        opacity: 0.18;
        transform: scaleY(1.01) translateY(-3px);
    }
    90.5% {
        opacity: 0;
        transform: scaleY(1);
    }
    94.5% {
        opacity: 0.08;
        transform: scaleY(1.004) translateY(2px);
    }
    95% {
        opacity: 0;
        transform: scaleY(1);
    }
    100% {
        opacity: 0;
        transform: scaleY(1);
    }
}

/* CRT Curved Tube Peripheral Vignette */
.crt-vignette {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99989;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.65), inset 0 0 35px rgba(0, 0, 0, 0.85);
    opacity: 0.75;
}

[data-theme="white"] .crt-vignette,
[data-theme="light-white"] .crt-vignette {
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.08);
    opacity: 0.4;
}

/* ==========================================================================
   8. MOBILE RESPONSIVENESS: BACKGROUND PATTERN ADJUSTMENT
   Fixes ". - . - ." being too large/chunky on mobile devices
   ========================================================================== */
@media (max-width: 768px) {
    .bg-line {
        width: 14px !important;
        opacity: 0.75;
    }
    .wrapper {
        opacity: 0.7;
    }
    .card {
        width: 11.5rem !important;
        height: 11.5rem !important;
        bottom: 13vh !important;
    }
    .card img,
    body.alive .card img,
    body.alive .card:hover img {
        width: 145px !important;
        height: 145px !important;
    }
    /* Smooth, wide wave curves on tablets */
    .waves {
        width: 200% !important;
        min-width: 850px !important;
        margin-left: -50% !important;
        height: 32vh !important;
        min-height: 220px !important;
        max-height: 38vh !important;
    }
}

@media (max-width: 480px) {
    .bg-line {
        width: 8px !important;
        opacity: 0.65;
    }
    .dot {
        width: 1px !important;
        height: 1px !important;
    }
    .wrapper {
        opacity: 0.55;
    }
    .card {
        width: 10.5rem !important;
        height: 10.5rem !important;
        bottom: 15vh !important;
    }
    .card img,
    body.alive .card img,
    body.alive .card:hover img {
        width: 130px !important;
        height: 130px !important;
    }
    .login-brand-logo {
        width: 48px;
        height: 48px;
    }
    #networkSubline {
        font-size: 0.78rem !important;
        gap: 0.22em !important;
        letter-spacing: 0.22em !important;
    }
    /* Relaxed, broad, gentle rolling waves on mobile (seamless bottom with no dark shelf) */
    .waves {
        width: 300% !important;
        min-width: 1050px !important;
        margin-left: -100% !important;
        height: 28vh !important;
        min-height: 190px !important;
        max-height: 34vh !important;
    }
}

