@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

:root {
    --bg-dark: #07090f;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.2);
    
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.5);
    --success: #10b981;
    --danger: #f43f5e;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }

html, body { height: 100dvh; width: 100vw; overflow: hidden; background-color: var(--bg-dark); color: var(--text-main); touch-action: pan-x pan-y; display: flex; justify-content: center; align-items: center; }

.bg-orb { position: absolute; border-radius: 50%; filter: blur(80px); z-index: -1; opacity: 0.6; animation: float 20s infinite ease-in-out alternate; }
.orb-1 { width: 400px; height: 400px; background: radial-gradient(circle, rgba(56,189,248,0.4) 0%, rgba(0,0,0,0) 70%); top: -10%; left: -10%; }
.orb-2 { width: 500px; height: 500px; background: radial-gradient(circle, rgba(139,92,246,0.3) 0%, rgba(0,0,0,0) 70%); bottom: -20%; right: -10%; animation-delay: -5s; }
.orb-3 { width: 300px; height: 300px; background: radial-gradient(circle, rgba(16,185,129,0.2) 0%, rgba(0,0,0,0) 70%); top: 40%; left: 50%; animation-delay: -10s; }

@keyframes float { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(10vw, -10vh) scale(1.2); } }

.glass-panel { background: var(--glass-bg); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border: 1px solid var(--glass-border); border-top: 1px solid var(--glass-highlight); border-left: 1px solid var(--glass-highlight); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.1); border-radius: 24px; }
.glass-pill { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); padding: 6px 16px; border-radius: 20px; font-size: 0.85rem; color: var(--text-muted); box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); white-space: nowrap; }
.accent-border { border-color: rgba(56, 189, 248, 0.4); color: var(--accent); }

.glow-text { background: linear-gradient(to right, #fff, var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-shadow: 0 0 20px var(--accent-glow); }
.glow-success { color: var(--success); text-shadow: 0 0 15px rgba(16, 185, 129, 0.5); font-weight: 800; text-align: center; }

.app-container, .boot-container { width: 100%; max-width: 500px; max-height: 100dvh; display: flex; flex-direction: column; gap: 1.25rem; padding: 1.5rem; }
#boot-screen { position: fixed; inset: 0; display: flex; justify-content: center; align-items: center; z-index: 1000; flex-direction: column; transition: opacity 0.5s ease, transform 0.5s ease; }

header { text-align: center; margin-bottom: 0.5rem; }
header h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -1px; }
.subtitle { color: var(--text-muted); font-size: 0.95rem; font-weight: 600; margin-top: 4px; }

.tabs { display: flex; padding: 6px; border-radius: 18px; gap: 6px; }
.tab-btn { flex: 1; text-align: center; padding: 10px; font-weight: 600; font-size: 0.95rem; color: var(--text-muted); border-radius: 14px; cursor: pointer; transition: all 0.3s; position: relative; z-index: 1; }
.tab-btn.active { color: #fff; background: rgba(255, 255, 255, 0.1); box-shadow: 0 4px 12px rgba(0,0,0,0.2), inset 0 1px 1px rgba(255,255,255,0.2); }

.view { display: none; }
.view.active { display: flex; flex-direction: column; animation: fadeScale 0.4s forwards; }

.card { padding: 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 1.25rem; overflow: hidden; }
.file-picker, .qr-container, .scanner-container { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1.25rem; }

.btn { position: relative; width: 100%; padding: 14px; border-radius: 16px; font-weight: 600; font-size: 1rem; text-align: center; cursor: pointer; overflow: hidden; user-select: none; transition: transform 0.15s, box-shadow 0.3s ease; text-decoration: none; display: flex; justify-content: center; align-items: center; }
.btn:active { transform: scale(0.96); }
.btn.disabled { pointer-events: none; opacity: 0.5; filter: grayscale(1); }
.btn-text { position: relative; z-index: 2; }

.primary-btn { background: linear-gradient(135deg, rgba(56,189,248,0.4), rgba(2,132,199,0.4)); border: 1px solid rgba(56,189,248,0.5); color: #fff; box-shadow: 0 8px 20px rgba(2, 132, 199, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.4); }
.danger-btn { background: linear-gradient(135deg, rgba(244,63,94,0.3), rgba(159,18,57,0.3)); border: 1px solid rgba(244,63,94,0.4); color: #fff; }
.success-btn { background: linear-gradient(135deg, rgba(16,185,129,0.4), rgba(4,120,87,0.4)); border: 1px solid rgba(16,185,129,0.5); color: #fff; }
.secondary-btn { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); color: var(--text-main); }
.btn-glow { position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 60%); opacity: 0; transition: opacity 0.3s; z-index: 1; }
.btn:hover .btn-glow { opacity: 1; }

.qr-frame, .video-frame { width: 100%; max-width: 320px; aspect-ratio: 1/1; background: rgba(255, 255, 255, 0.02); border-radius: 20px; padding: 12px; border: 1px solid var(--glass-border); box-shadow: inset 0 10px 20px rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; overflow: hidden; }
img#qr-image { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; background: #fff; }
video { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }

/* ---------------------------------
   NEW: ARRAY TRACKER STYLES
----------------------------------- */
.array-tracker-container { width: 100%; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.tracker-header { display: flex; justify-content: space-between; width: 100%; }
.chunk-map-wrapper { width: 100%; height: 16px; background: rgba(0, 0, 0, 0.5); border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); overflow: hidden; box-shadow: inset 0 2px 5px rgba(0,0,0,0.5); display: flex; }
canvas#chunk-map-canvas { width: 100%; height: 100%; }

.stats-row { display: flex; justify-content: space-between; width: 100%; margin-bottom: 8px; }
.progress-bar { width: 100%; height: 8px; background: rgba(0, 0, 0, 0.4); border-radius: 4px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.05); }
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.1s linear; box-shadow: 0 0 10px var(--accent-glow); border-radius: 4px; }
.download-actions { width: 100%; display: flex; flex-direction: column; gap: 10px; }

#toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; z-index: 9999; pointer-events: none; width: 90%; max-width: 400px; }
.custom-toast { background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.1); color: #fff; padding: 12px 20px; border-radius: 16px; font-size: 0.9rem; font-weight: 600; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5); opacity: 0; transform: translateY(-20px) scale(0.95); transition: all 0.3s; }
.custom-toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast-error { border-bottom: 2px solid var(--danger); }
.toast-success { border-bottom: 2px solid var(--success); }
.toast-info { border-bottom: 2px solid var(--accent); }

.hidden { display: none !important; }
.pulse-text { animation: textPulse 1.5s infinite alternate; text-align: center; font-size: 0.85rem;}

@keyframes fadeScale { 0% { opacity: 0; transform: scale(0.97) translateY(10px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes textPulse { 0% { opacity: 0.5; text-shadow: none; } 100% { opacity: 1; text-shadow: 0 0 10px rgba(255,255,255,0.3); } }

