/* ===========================
   CSS Reset & Base Styles
   =========================== */

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: #0F0F0F;
    color: #ffffff;
    position: relative;
}

/* Background effects */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% 35%, rgba(40, 40, 40, 0.4) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

#root {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* ===========================
   Utility Classes
   =========================== */

.absolute {
    position: absolute;
}

.relative {
    position: relative;
}

.inset-0 {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.space-x-2 > * + * {
    margin-left: 0.5rem;
}

.space-x-3 > * + * {
    margin-left: 0.75rem;
}

.space-y-2 > * + * {
    margin-top: 0.5rem;
}

.space-y-3 > * + * {
    margin-top: 0.75rem;
}

.space-y-4 > * + * {
    margin-top: 1rem;
}

.space-y-8 > * + * {
    margin-top: 2rem;
}

.text-center {
    text-align: center;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.h-screen {
    height: 100vh;
}

.overflow-hidden {
    overflow: hidden;
}

.pointer-events-none {
    pointer-events: none;
}

/* ===========================
   Background & Overlays
   =========================== */

.bg-gray-900 {
    background-color: #0F0F0F;
}

.bg-overlay {
    background-color: rgba(15, 15, 15, 0.85);
    /* Removed backdrop-filter to reduce GPU load - dark bg is sufficient */
}

/* ===========================
   Typography
   =========================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
}

.text-5xl {
    font-size: 3rem;
    line-height: 1;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

.text-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

.text-gray-100 {
    color: #f3f4f6;
}

.text-gray-200 {
    color: #e5e7eb;
}

.text-gray-300 {
    color: #d1d5db;
}

.text-gray-400 {
    color: #9ca3af;
}

.text-gray-500 {
    color: #6b7280;
}

.text-blue-400 {
    color: rgba(255, 255, 255, 0.7);
}

.text-blue-300 {
    color: rgba(255, 255, 255, 0.65);
}

.text-green-400 {
    color: rgba(255, 255, 255, 0.75);
}

.text-red-400 {
    color: rgba(255, 255, 255, 0.7);
}

a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: underline;
    transition: color 0.2s;
}

a:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* ===========================
   Animations
   =========================== */

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.fade-out {
    animation: fadeOut 0.3s ease-out;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

/* ===========================
   Transitions
   =========================== */

.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 300ms;
}

.transition-transform {
    transition-property: transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}

.transition-opacity {
    transition-property: opacity;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}

.transition-colors {
    transition-property: color, background-color, border-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}

/* ===========================
   Video Element
   =========================== */

.video-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Remove mirror effect (flip horizontally) */
    transform: scaleX(-1);
    /* Optimize: only transition properties that change */
    transition: filter 1000ms ease-out, opacity 1000ms ease-out;
}

/* ===========================
   Spacing
   =========================== */

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }

.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }

.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

/* ===========================
   Sizing
   =========================== */

.max-w-md {
    max-width: 28rem;
}

.max-w-2xl {
    max-width: 42rem;
}

.w-3 { width: 0.75rem; }
.h-3 { height: 0.75rem; }

.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }

.w-7 { width: 1.75rem; }
.h-7 { height: 1.75rem; }

.w-8 { width: 2rem; }
.h-8 { height: 2rem; }

.w-16 { width: 4rem; }
.h-16 { height: 4rem; }

/* ===========================
   Borders & Radius
   =========================== */

.rounded-full {
    border-radius: 9999px;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.rounded-2xl {
    border-radius: 1rem;
}

.rounded-3xl {
    border-radius: 1.5rem;
}

.border {
    border-width: 1px;
}

/* ===========================
   Shadows
   =========================== */

.shadow-2xl {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ===========================
   Flexbox Utilities
   =========================== */

.flex-shrink-0 {
    flex-shrink: 0;
}

.items-start {
    align-items: flex-start;
}

/* ===========================
   Opacity
   =========================== */

.opacity-80 {
    opacity: 0.8;
}

/* ===========================
   Welcome Screen (Apple/WWDC Style)
   =========================== */

.welcome-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

/* Navbar */
.welcome-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 2rem;
    z-index: 100;
    animation: fadeInDown 0.6s ease-out;
}

.welcome-nav-content {
    max-width: 1400px;
    margin: 0 auto;
}

.welcome-logo {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.9);
}

/* Main Content */
.welcome-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 2rem;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

/* Hero Card (Liquid Glass) */
.welcome-hero-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    padding: 4rem 3.5rem;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
    text-align: center;
    animation: fadeInScale 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
}

.welcome-hero-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 35px 70px rgba(0, 0, 0, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Typography */
.welcome-title {
    font-size: 3.75rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.05;
    color: rgba(255, 255, 255, 0.98);
    margin-bottom: 1.5rem;
}

.welcome-subtitle {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 3rem;
}

.welcome-description {
    font-size: 1rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 3rem;
    letter-spacing: 0.02em;
}

/* Status Chips */
.welcome-status-chips {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 3.5rem;
}

.status-chip {
    padding: 0.5rem 1.125rem;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.04em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.status-chip-animate {
    opacity: 0;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Start Button */
.welcome-start-button {
    padding: 1rem 3rem;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    border: none;
    border-radius: 14px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0F0F0F;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    letter-spacing: 0.01em;
}

.welcome-start-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.welcome-start-button:active:not(:disabled) {
    transform: scale(0.98);
}

.welcome-start-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Status Line (Technical) */
.welcome-status-line {
    margin-top: 2rem;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.6875rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.25);
    opacity: 0;
    animation: fadeIn 1s ease-out 1.2s forwards;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===========================
   Responsive Design
   Mobile-first approach with progressive enhancement
   =========================== */

/* Mobile viewport height fix (iOS Safari address bar) */
@supports (-webkit-touch-callout: none) {
    .fixed, .absolute {
        height: -webkit-fill-available;
    }
}

/* Tablet and smaller (landscape tablets, large phones) */
@media (max-width: 1024px) {
    .ascii-background {
        font-size: 8px;
        line-height: 8px;
        padding: 16px;
    }
    
    .welcome-hero-card {
        padding: 4rem 2.5rem;
    }
}

/* Tablet portrait and smaller */
@media (max-width: 768px) {
    body {
        /* Prevent text size adjustment on mobile */
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    .welcome-title {
        font-size: 2.25rem;
        line-height: 1.2;
    }
    
    .welcome-hero-card {
        padding: 3.5rem 2rem;
        backdrop-filter: blur(40px);
    }
    
    .welcome-main {
        padding: 0 1.5rem;
    }
    
    .welcome-start-button {
        padding: 1rem 3rem;
        font-size: 0.9375rem;
        /* Larger touch target */
        min-height: 48px;
    }
    
    /* Reduce ASCII blur for performance on mobile */
    .ascii-background {
        filter: blur(8px);
        font-size: 7px;
        line-height: 7px;
        padding: 12px;
    }
}

/* Mobile devices */
@media (max-width: 640px) {
    .welcome-title {
        font-size: 1.875rem;
    }
    
    .welcome-subtitle {
        font-size: 0.8125rem;
    }
    
    .welcome-hero-card {
        padding: 2.5rem 1.5rem;
    }
    
    .welcome-start-button {
        padding: 0.875rem 2.5rem;
        font-size: 0.875rem;
        width: 100%;
        max-width: 280px;
    }
    
    .welcome-status {
        font-size: 0.6875rem;
    }
    
    /* Further optimize ASCII for small screens */
    .ascii-background {
        filter: blur(6px);
        opacity: 0.7;
        font-size: 6px;
        line-height: 6px;
    }
    
    .ascii-background.active {
        opacity: 0.7;
    }
}

/* Small mobile devices (iPhone SE, etc) */
@media (max-width: 375px) {
    .welcome-title {
        font-size: 1.625rem;
    }
    
    .welcome-hero-card {
        padding: 2rem 1.25rem;
    }
    
    .welcome-start-button {
        font-size: 0.8125rem;
        padding: 0.75rem 2rem;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .welcome-hero-card {
        padding: 2rem 2rem;
    }
    
    .welcome-title {
        font-size: 1.75rem;
    }
    
    .welcome-subtitle {
        font-size: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .welcome-start-button {
        padding: 0.625rem 2rem;
        min-height: 40px;
    }
    
    .welcome-status {
        margin-top: 1rem;
    }
}

/* ===========================
   Display
   =========================== */

.inline-flex {
    display: inline-flex;
}

/* ===========================
   Hover Effects
   =========================== */

.hover-scale-105:hover {
    transform: scale(1.05);
}

/* ===========================
   ASCII Background (Ultra-Subtle)
   =========================== */

.ascii-background {
    position: fixed;
    inset: 0;
    margin: 0;
    padding: 24px;
    font-family: ui-monospace, 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 9px;
    line-height: 9px;
    letter-spacing: 0;
    color: rgba(255, 255, 255, 0.06);
    filter: blur(12px);
    /* Match video orientation (no mirror effect) */
    transform: scaleX(-1);
    user-select: none;
    pointer-events: none;
    white-space: pre;
    overflow: hidden;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.ascii-background.active {
    opacity: 1;
}

/* Optional: dark overlay to soften ASCII further */
.ascii-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 0;
}
