/* ==============================================================
   1. GOD-TIER VARIABLES & KEYFRAME ENGINE (300+ LINES CSS)
   ============================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
    --bg-base: #010409; 
    --bg-surface: #0D1117;
    --bg-elevated: #161B22;
    --glass-solid: rgba(13, 17, 23, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-glare: linear-gradient(125deg, rgba(255,255,255,0.05) 0%, transparent 50%);
    --shadow-float: 0 24px 48px -12px rgba(0,0,0,0.8);
    --shadow-glow: 0 0 30px rgba(0, 229, 255, 0.2);
    --shadow-gold: 0 0 30px rgba(251, 191, 36, 0.3);
    
    --brand-cyan: #00E5FF;
    --brand-copper: #F97316;
    --accent-purple: #A855F7;
    --coin-gold: #FBBF24;
    --status-red: #F43F5E;
    --status-green: #10B981;
    
    --text-main: #F8FAFC;
    --text-muted: #8B949E;
    --text-dark: #000000;
    
    --font-ui: 'Inter', sans-serif;
    --font-code: 'JetBrains Mono', monospace;
    
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

.light-mode {
    --bg-base: #F8FAFC; --bg-surface: #FFFFFF; --bg-elevated: #F1F5F9;
    --glass-solid: rgba(255, 255, 255, 0.85); --glass-border: rgba(0, 0, 0, 0.06);
    --glass-glare: linear-gradient(125deg, rgba(255,255,255,1) 0%, transparent 40%);
    --shadow-float: 0 20px 40px -10px rgba(0,0,0,0.08); --shadow-glow: 0 0 24px rgba(0, 229, 255, 0.15);
    --text-main: #0F172A; --text-muted: #475569;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }
body { background: var(--bg-base); color: var(--text-main); font-family: var(--font-ui); overflow: hidden; width: 100vw; height: 100dvh; display: flex; flex-direction: column; transition: background 0.5s ease; }
body.modal-open { pointer-events: none; }

/* --- MASTER KEYFRAMES --- */
@keyframes float { 0% { transform: translate3d(0,0,0) scale(1); } 100% { transform: translate3d(10%, 10%, 0) scale(1.1); } }
@keyframes viewEnter { 0% { opacity: 0; transform: translateY(30px) scale(0.98); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes borderSpin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulseGlow { 0% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.3); } 70% { box-shadow: 0 0 0 20px rgba(0, 229, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0); } }
@keyframes shimmer { 0% { background-position: 200% 50%; } 100% { background-position: -200% 50%; } }
@keyframes slideDown { 0% { opacity: 0; transform: translate(-50%, -50px); } 100% { opacity: 1; transform: translate(-50%, 0); } }
@keyframes typeLine { to { opacity: 1; } }

/* Cinematic Ambient Background */
.cinematic-bg { position: fixed; inset: 0; z-index: -1; background: radial-gradient(circle at 50% 0%, rgba(0, 229, 255, 0.05), transparent 50%), radial-gradient(circle at 100% 100%, rgba(249, 115, 22, 0.05), transparent 50%); }
.grid-lines { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px); background-size: 40px 40px; mask-image: radial-gradient(circle at center, black 30%, transparent 80%); -webkit-mask-image: radial-gradient(circle at center, black 30%, transparent 80%); }
.orb { position: absolute; border-radius: 50%; filter: blur(140px); opacity: 0.25; will-change: transform; animation: float 20s infinite alternate ease-in-out; }
.orb-1 { width: 50vw; height: 50vw; background: var(--brand-cyan); top: -20%; left: -10%; }
.orb-2 { width: 60vw; height: 60vw; background: var(--accent-purple); bottom: -20%; right: -10%; animation-delay: -5s; }
/* ==============================================================
   2. SPATIAL ARCHITECTURE & OMNI-GRID
   ============================================================== */
.app-layout { display: flex; width: 100%; height: 100%; flex-direction: column; position: relative; }
.main-canvas { flex: 1; position: relative; overflow-y: auto; padding: 24px 20px 160px; scroll-behavior: smooth; z-index: 1; }
.main-canvas::-webkit-scrollbar { display: none; }

.view-layer { display: none; opacity: 0; }
.view-layer.active { display: block; animation: viewEnter 0.6s var(--ease-spring) forwards; }

.bento-container { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 24px; }
.col-span-2 { grid-column: span 2; }
.horizontal-scroll { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
.horizontal-scroll::-webkit-scrollbar { display: none; }
.scroll-item { scroll-snap-align: center; flex-shrink: 0; }

@media (min-width: 1024px) {
    .app-layout { flex-direction: row; }
    .main-canvas { padding: 48px 64px 64px; max-width: 1600px; margin: 0 auto; }
    .bento-container { grid-template-columns: repeat(4, 1fr); gap: 24px; }
    .col-span-2 { grid-column: span 2; } .col-span-3 { grid-column: span 3; } .col-span-4 { grid-column: span 4; }
    .horizontal-scroll { margin: 0; padding-left: 0; padding-right: 0; }
}

/* ==============================================================
   3. TYPOGRAPHY & ELITE COMPONENTS
   ============================================================== */
h1, h2, h3, h4, h5 { letter-spacing: -0.04em; color: var(--text-main); }
h2 { font-size: clamp(28px, 5vw, 42px); font-weight: 900; margin-bottom: 8px; line-height: 1.1; }
h3 { font-size: clamp(18px, 3vw, 24px); font-weight: 800; margin-bottom: 6px; }
h4 { font-size: clamp(15px, 2vw, 18px); font-weight: 700; margin-bottom: 4px; }
p { font-size: clamp(13px, 2vw, 15px); color: var(--text-muted); line-height: 1.6; }

/* The Deep Glass Card */
.glass-panel { background: var(--glass-solid); border: 1px solid var(--glass-border); border-radius: 28px; padding: 24px; position: relative; overflow: hidden; backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px); box-shadow: var(--shadow-float); transition: var(--ease-out) 0.4s; z-index: 1; display: flex; flex-direction: column; }
.glass-panel::before { content: ''; position: absolute; inset: 0; background: var(--glass-glare); z-index: -1; pointer-events: none; border-radius: 28px; }
.glass-panel.interactive { cursor: pointer; }
.glass-panel.interactive:hover { transform: translateY(-6px) scale(1.01); border-color: rgba(255,255,255,0.25); box-shadow: 0 30px 60px rgba(0,0,0,0.9), var(--shadow-glow); }
.glass-panel.interactive:active { transform: scale(0.97); }

/* The Animated Paywall/Purchase Border */
.premium-border { position: relative; z-index: 1; }
.premium-border::after { content: ''; position: absolute; inset: -3px; background: linear-gradient(90deg, var(--coin-gold), var(--brand-copper), var(--accent-purple), var(--coin-gold)); background-size: 300% 100%; border-radius: 32px; z-index: -2; animation: shimmer 3s linear infinite; }

/* Inputs & Forms */
.cmd-input { display: flex; align-items: center; background: rgba(0,0,0,0.4); border: 1px solid var(--glass-border); border-radius: 20px; padding: 18px 24px; margin-bottom: 16px; transition: 0.3s; box-shadow: inset 0 4px 10px rgba(0,0,0,0.5); }
.cmd-input i { color: var(--text-muted); margin-right: 16px; font-size: 20px; }
.cmd-input input { flex: 1; background: transparent; border: none; color: var(--text-main); font-size: 16px; font-weight: 600; width: 100%; }
.cmd-input:focus-within { border-color: var(--brand-cyan); background: rgba(0,0,0,0.7); box-shadow: inset 0 4px 10px rgba(0,0,0,0.8), 0 0 0 4px rgba(0, 229, 255, 0.1); }
/* Buttons */
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 12px; width: 100%; padding: 20px 28px; border-radius: 20px; font-weight: 800; font-size: 16px; cursor: pointer; border: none; transition: var(--ease-spring) 0.4s; text-transform: uppercase; letter-spacing: 0.5px; position: relative; overflow: hidden; }
.btn::after { content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent); transition: 0.5s; }
.btn:hover::after { left: 100%; }
.btn:active { transform: scale(0.95); }

.btn-cyan { background: linear-gradient(135deg, var(--brand-cyan), #0099FF); color: var(--text-dark); box-shadow: 0 8px 30px rgba(0, 229, 255, 0.3); }
.btn-copper { background: linear-gradient(135deg, var(--brand-copper), #CC5500); color: var(--text-dark); box-shadow: 0 8px 30px rgba(249, 115, 22, 0.3); }
.btn-gold { background: linear-gradient(135deg, var(--coin-gold), #D97706); color: var(--text-dark); box-shadow: var(--shadow-gold); }
.btn-ai { background: linear-gradient(135deg, var(--accent-purple), #7E22CE); color: #fff; box-shadow: 0 8px 30px rgba(168, 85, 247, 0.3); }
.btn-glass { background: rgba(255,255,255,0.05); color: var(--text-main); border: 1px solid var(--glass-border); backdrop-filter: blur(12px); }
.btn-glass:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.3); }

/* Tags & Badges */
.tag { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 100px; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; border: 1px solid var(--glass-border); }
.tag-cyan { background: rgba(0, 229, 255, 0.15); color: var(--brand-cyan); border-color: rgba(0, 229, 255, 0.3); }
.tag-red { background: rgba(244, 63, 94, 0.15); color: var(--status-red); border-color: rgba(244, 63, 94, 0.3); }
.tag-gold { background: rgba(251, 191, 36, 0.15); color: var(--coin-gold); border-color: rgba(251, 191, 36, 0.3); }
.tag-pro { background: linear-gradient(135deg, rgba(168,85,247,0.2), rgba(249,115,22,0.2)); color: var(--text-main); border-color: var(--accent-purple); }

/* Avatars & Lists */
.flex-row { display: flex; justify-content: space-between; align-items: center; }
.list-tile { display: flex; align-items: center; gap: 18px; padding: 18px; border-radius: 20px; cursor: pointer; transition: 0.3s; border: 1px solid transparent; background: rgba(255,255,255,0.01); margin-bottom: 8px; }
.list-tile:hover { background: rgba(255,255,255,0.04); border-color: var(--glass-border); transform: translateX(6px); }

.avatar { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, var(--bg-surface), #1F2937); display: flex; justify-content: center; align-items: center; font-weight: 900; font-size: 22px; border: 1px solid var(--glass-border); flex-shrink: 0; position: relative; color: var(--text-main); }
.avatar.grad { background: linear-gradient(135deg, var(--brand-cyan), var(--accent-purple)); color: var(--text-dark); }
.status-pip { position: absolute; bottom: -4px; right: -4px; width: 16px; height: 16px; background: var(--status-green); border-radius: 50%; border: 3px solid var(--bg-surface); }

/* ==============================================================
   4. NAVIGATION & HEADER SYSTEM
   ============================================================== */
.top-header { display: flex; justify-content: space-between; align-items: center; padding: max(20px, env(safe-area-inset-top)) 24px 20px; z-index: 50; }
.brand-lockup { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.logo-img { width: 48px; height: 48px; border-radius: 14px; border: 2px solid var(--brand-cyan); object-fit: cover; animation: pulseGlow 4s infinite; }
.wallet-hud { display: flex; align-items: center; gap: 14px; background: var(--glass-solid); padding: 12px 20px; border-radius: 100px; border: 1px solid var(--glass-border); font-weight: 800; font-size: 15px; cursor: pointer; backdrop-filter: blur(12px); transition: 0.2s; box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.wallet-hud:active { transform: scale(0.95); }

.floating-nav { position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%); width: calc(100% - 40px); max-width: 480px; background: rgba(13, 17, 23, 0.95); backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px); border: 1px solid var(--glass-border); border-top: 1px solid rgba(255,255,255,0.15); border-radius: 100px; display: flex; justify-content: space-around; padding: 10px; z-index: 100; box-shadow: 0 30px 60px rgba(0,0,0,0.9); }
.nav-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-muted); font-size: 11px; font-weight: 800; text-transform: uppercase; cursor: pointer; padding: 12px 0; border-radius: 100px; transition: var(--ease-spring) 0.4s; width: 72px; }
.nav-btn i { font-size: 24px; transition: 0.3s; }
.nav-btn.active { color: var(--text-dark); background: var(--brand-cyan); box-shadow: 0 4px 25px rgba(0, 229, 255, 0.5); }

@media (min-width: 1024px) {
    .top-header { display: none; }
    .floating-nav { left: 0; transform: none; bottom: 0; width: 320px; max-width: none; height: 100vh; flex-direction: column; justify-content: flex-start; align-items: flex-start; padding: 56px 32px; border-radius: 0; border: none; border-right: 1px solid var(--glass-border); background: var(--glass-solid); }
    .nav-btn { flex-direction: row; gap: 20px; font-size: 16px; width: 100%; padding: 20px 24px; border-radius: 20px; margin-bottom: 12px; justify-content: flex-start; }
}
/* ==============================================================
   5. GOD-LEVEL MODALS, TERMINALS & TOASTS
   ============================================================== */
#toast-container { position: fixed; top: max(40px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 999999; display: flex; flex-direction: column; gap: 16px; pointer-events: none; width: 90%; max-width: 500px; align-items: center; }
.toast { background: rgba(255,255,255,0.98); color: var(--text-dark); padding: 20px 32px; border-radius: 100px; font-weight: 800; font-size: 15px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); display: flex; align-items: center; gap: 16px; animation: slideDown 0.5s var(--ease-spring) forwards; }

.modal-backdrop { position: fixed; inset: 0; z-index: 99999; display: none !important; background: rgba(1, 4, 9, 0.92); backdrop-filter: blur(30px); opacity: 0; transition: opacity 0.4s; pointer-events: all; flex-direction: column; justify-content: flex-end; }
.modal-backdrop.active { display: flex !important; opacity: 1; }

.modal-surface { background: var(--bg-surface); border-top: 1px solid var(--glass-border); border-radius: 48px 48px 0 0; padding: 56px 32px calc(56px + env(safe-area-inset-bottom)); width: 100%; position: relative; animation: slideUp 0.5s var(--ease-out) forwards; max-height: 92vh; overflow-y: auto; box-shadow: 0 -30px 100px rgba(0,0,0,0.9); }

/* THE FIX: MASSIVE CLOSE BUTTON */
.modal-close-lg { position: absolute; top: 24px; right: 24px; width: 56px; height: 56px; background: rgba(255,255,255,0.08); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-main); transition: var(--ease-spring) 0.4s; border: 1px solid var(--glass-border); font-size: 24px; z-index: 100; box-shadow: 0 8px 20px rgba(0,0,0,0.4); }
.modal-close-lg:hover { background: var(--status-red); color: #fff; transform: rotate(90deg) scale(1.1); border-color: transparent; box-shadow: 0 10px 30px rgba(244, 63, 94, 0.6); }
.modal-close-lg:active { transform: scale(0.9); }

@media (min-width: 1024px) { .modal-backdrop { justify-content: center; align-items: center; padding: 32px; } .modal-surface { border-radius: 32px; max-width: 720px; border: 1px solid var(--glass-border); } }

/* The Terminal Execution Overlay */
.terminal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.95); z-index: 999999; display: none !important; flex-direction: column; justify-content: center; align-items: center; padding: 32px; opacity: 0; transition: 0.4s; }
.terminal-overlay.active { display: flex !important; opacity: 1; }
.terminal-window { width: 100%; max-width: 600px; background: #0D1117; border: 1px solid #30363D; border-radius: 16px; padding: 24px; font-family: var(--font-code); color: #00FF41; box-shadow: 0 0 60px rgba(0, 229, 255, 0.15); text-align: left; }
.term-header { display: flex; gap: 12px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #30363D; }
.term-dot { width: 14px; height: 14px; border-radius: 50%; }
.term-log { font-size: 15px; line-height: 1.8; margin-bottom: 10px; opacity: 0; animation: typeLine 0.1s forwards; text-shadow: 0 0 5px rgba(0,255,65,0.4); }
.term-success { color: var(--status-green); font-weight: 800; font-size: 20px; text-align: center; margin-top: 32px; display: none; }

/* Call Interface */
.call-surface { background: #000; justify-content: space-between; padding: max(56px, env(safe-area-inset-top)) 32px max(56px, env(safe-area-inset-bottom)); }
.call-hub { display: flex; justify-content: center; gap: 32px; background: rgba(255,255,255,0.08); padding: 32px; border-radius: 100px; margin-top: auto; backdrop-filter: blur(20px); border: 1px solid var(--glass-border); }
