:root {
    --bg: #050505;
    --glass: rgba(25, 25, 28, 0.45);
    --border: rgba(255, 255, 255, 0.12);
    --border-hi: rgba(255, 255, 255, 0.25);
    --text: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.65);
    --text-faint: rgba(255, 255, 255, 0.4);
    --danger: #ff453a;
    --radius: 24px;
    --radius-sm: 14px;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; min-height: 100dvh; }

/* ================= GLOBAL HEADER ================= */
.landing-nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px; position: sticky; top: 0; z-index: 100;
    background: rgba(5, 5, 5, 0.85); backdrop-filter: blur(20px); 
    border-bottom: 1px solid #222; flex-wrap: nowrap;
}
.nav-brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-size: 16px; font-weight: 700; white-space: nowrap; }
.nav-brand svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-links { display: flex; gap: 16px; align-items: center; }
.nav-links a { color: #888; text-decoration: none; font-size: 14px; font-weight: 600; transition: color 0.2s; white-space: nowrap; }
.nav-links a:hover, .nav-links a.active { color: #fff; }

/* ================= GLOBAL FOOTER ================= */
.site-footer { border-top: 1px solid #222; padding: 24px; margin-top: auto; }
.footer-content { max-width: 850px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #666; flex-wrap: wrap; gap: 12px; }
.footer-content a { color: #888; text-decoration: none; transition: color 0.2s; }
.footer-content a:hover { color: #fff; }

/* Glassmorphism */
.glass { background: var(--glass); backdrop-filter: blur(32px); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.hidden { display: none !important; }

/* App Layout (Playground) */
.app-view { max-width: 780px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.card { padding: 24px; }
.card-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px; color: var(--text-dim); }

/* Gate (Login Form) */
.gate-card { width: 100%; max-width: 400px; padding: 32px; }
.brand { text-align: center; }
.brand h1 { font-size: 24px; font-weight: 700; color: #fff; }
.brand .sub { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-faint); margin-bottom: 8px; }
.field input {
    width: 100%; padding: 14px 16px; font-family: var(--font); font-size: 15px; color: var(--text);
    background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border); border-radius: var(--radius-sm);
    outline: none; transition: all 0.2s ease;
}
.field input:focus { border-color: rgba(255, 255, 255, 0.4); background: rgba(0, 0, 0, 0.6); }
.msg { font-size: 13px; text-align: center; color: var(--danger); opacity: 0; transition: opacity 0.2s; margin-top: 12px; }
.msg.show { opacity: 1; }

/* Buttons */
.btn { font-family: var(--font); font-size: 14.5px; font-weight: 600; border: none; border-radius: var(--radius-sm); padding: 14px 20px; cursor: pointer; transition: all 0.2s ease; }
.btn:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 20px; font-size: 15.5px; }
.btn-sm { padding: 8px 14px; font-size: 12.5px; border-radius: 10px; }
.btn-primary { color: #000; background: #ffffff; box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15); }
.btn-primary:hover:not(:disabled) { background: #e4e4e7; transform: translateY(-1px); }
.btn-ghost { color: var(--text-dim); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, 0.1); }

/* Dropzone */
.dropzone { border: 1.5px dashed rgba(255, 255, 255, 0.25); border-radius: 20px; padding: 48px 20px; text-align: center; cursor: pointer; transition: all 0.25s ease; background: rgba(0, 0, 0, 0.2); }
.dropzone:hover, .dropzone.drag { border-color: rgba(255, 255, 255, 0.8); background: rgba(255, 255, 255, 0.05); }
.dz-icon { width: 56px; height: 56px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 16px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); color: #fff; }
.dz-icon svg { width: 28px; height: 28px; }
.dz-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.dz-sub { font-size: 12.5px; color: var(--text-faint); }

.preview-wrap { position: relative; border-radius: 20px; overflow: hidden; border: 1px solid var(--border); }
.preview-wrap img { display: block; width: 100%; max-height: 420px; object-fit: contain; background: #000; }
.preview-overlay { position: absolute; inset: auto 0 0 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent); }
.preview-info { font-size: 12px; color: var(--text-dim); font-weight: 500; }

/* Modes */
.modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.mode { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); color: var(--text); cursor: pointer; font-family: var(--font); text-align: left; transition: all 0.2s ease; }
.mode:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--border-hi); }
.mode.active { background: #ffffff; border-color: #ffffff; box-shadow: 0 8px 30px rgba(255, 255, 255, 0.15); }
.mode.active .mode-name { color: #000; }
.mode.active .mode-badge { background: #000; color: #fff; }
.mode-badge { font-size: 10px; font-weight: 800; padding: 4px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); color: var(--text); }
.mode-name { font-size: 14px; font-weight: 700; white-space: nowrap; }

/* Loading */
.loading-card { text-align: center; padding: 42px 24px; }
.spinner { width: 50px; height: 50px; margin: 0 auto 20px; border-radius: 50%; background: conic-gradient(from 0deg, transparent, #ffffff); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-size: 16px; font-weight: 600; }
.loading-sub { font-size: 13px; color: var(--text-faint); margin-top: 8px; }

/* Result / Compare */
.result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.pill { font-size: 11px; font-weight: 700; padding: 6px 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--border); color: #fff; text-transform: uppercase; }
.compare { position: relative; border-radius: 16px; overflow: hidden; background: #000; user-select: none; touch-action: none; cursor: ew-resize; border: 1px solid var(--border); }
.img-before, .img-after { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; background: #000; }
.compare-after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); will-change: clip-path; }
.img-after { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.handle { position: absolute; top: 0; bottom: 0; left: var(--pos); transform: translateX(-50%); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.handle-line { position: absolute; top: 0; bottom: 0; width: 2px; background: #ffffff; box-shadow: 0 0 20px rgba(255, 255, 255, 0.8); }
.handle-grip { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.2); backdrop-filter: blur(16px); border: 2px solid #ffffff; color: #fff; }
.handle-grip svg { width: 18px; height: 18px; }
.tag { position: absolute; top: 12px; font-size: 10px; font-weight: 800; padding: 4px 10px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 255, 255, 0.2); color: #fff; text-transform: uppercase; }
.tag-before { left: 12px; }
.tag-after { right: 12px; background: #ffffff; color: #000; border-color: #ffffff; }
.result-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; font-size: 12px; color: var(--text-dim); }
.result-meta span { padding: 4px 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.result-actions .btn { flex: 1; min-width: 140px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 12px 20px; border-radius: 12px; background: rgba(255, 255, 255, 0.95); color: #000; font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: all 0.3s ease; z-index: 1000; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #ff453a; color: #fff; }

@media (max-width: 520px) {
    .app-view { padding: 14px; }
    .card { padding: 18px; }
    .modes { grid-template-columns: repeat(2, 1fr); }
    .footer-content { flex-direction: column; gap: 12px; text-align: center; }
}