/* ── Reset & Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #0a1520;
    --bg-card:     #111e30;
    --bg-card-2:   #162540;
    --accent:      #60cdf8;
    --accent-dark: #0288d1;
    --success:     #43a047;
    --danger:      #e53935;
    --text:        #ddeaf8;
    --text-muted:  #6a99bf;
    --border:      #1e3350;
    --radius:      14px;
    --shadow:      0 6px 32px rgba(0,0,0,.55);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ── Parallax Scene ────────────────────────────────────────────────── */
.parallax-scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.parallax-sky {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 50% 0%,
        #0d2a50 0%, #061425 55%, #040d18 100%);
}

.parallax-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
}

.parallax-mountains-far,
.parallax-mountains-mid,
.parallax-mountains-near { height: 55vh; bottom: 0; top: auto; }

/* ── Snowflakes ────────────────────────────────────────────────────── */
.snowflakes {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.snowflake {
    position: absolute;
    top: -10%;
    color: #a8d8f0;
    font-size: 14px;
    opacity: 0;
    animation: snowfall linear infinite;
    animation-duration: calc(8s + var(--dur, 0s));
    animation-delay: var(--delay, 0s);
}

.snowflake:nth-child(1)  { left:  8%; --dur:  0s; --delay:  0s;  font-size: 10px; }
.snowflake:nth-child(2)  { left: 18%; --dur:  2s; --delay:  1s;  font-size: 16px; }
.snowflake:nth-child(3)  { left: 32%; --dur:  4s; --delay:  2s;  font-size: 12px; }
.snowflake:nth-child(4)  { left: 48%; --dur:  1s; --delay:  4s;  font-size: 18px; }
.snowflake:nth-child(5)  { left: 62%; --dur:  3s; --delay:  0.5s; font-size: 10px; }
.snowflake:nth-child(6)  { left: 76%; --dur:  5s; --delay:  3s;  font-size: 14px; }
.snowflake:nth-child(7)  { left: 90%; --dur:  2s; --delay:  1.5s; font-size: 16px; }

@keyframes snowfall {
    0%   { transform: translateY(0) rotate(0deg);   opacity: 0; }
    10%  { opacity: 0.6; }
    90%  { opacity: 0.4; }
    100% { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}

/* ensure all content sits above parallax */
.site-header, main, .modal-overlay, .site-footer { position: relative; z-index: 1; }

/* ── Header ────────────────────────────────────────────────────────── */
.site-header {
    background: rgba(10, 18, 28, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(96, 205, 248, 0.12);
    padding: 0 24px;
}
.header-inner {
    max-width: 820px;
    margin: 0 auto;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-img { border-radius: 6px; }
.logo-text  { font-size: 18px; font-weight: 700; letter-spacing: .5px; }

/* ── Main ──────────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 24px 60px;
    width: 100%;
}

/* ── Hero ──────────────────────────────────────────────────────────── */
.hero { text-align: center; margin-bottom: 36px; padding-top: 24px; }
.hero-title {
    font-size: clamp(28px, 5vw, 46px);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 12px;
    text-shadow: 0 2px 24px rgba(0,0,0,.8);
}
.accent { color: var(--accent); }
.hero-sub {
    color: var(--text-muted);
    font-size: 16px;
    text-shadow: 0 1px 8px rgba(0,0,0,.7);
}

/* ── Card ──────────────────────────────────────────────────────────── */
.card {
    background: rgba(17, 30, 48, 0.80);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(96, 205, 248, 0.10);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--accent);
}

/* ── Drop Zone ─────────────────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed rgba(96, 205, 248, 0.25);
    border-radius: 10px;
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .25s, background .25s, box-shadow .25s;
    position: relative;
    overflow: hidden;
}
.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(96,205,248,0.03) 0%, transparent 60%);
    pointer-events: none;
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(96, 205, 248, 0.06);
    box-shadow: 0 0 24px rgba(96, 205, 248, 0.10) inset;
}
.drop-icon { font-size: 40px; margin-bottom: 8px; }
.drop-text  { font-size: 16px; font-weight: 600; }
.drop-hint  { color: var(--text-muted); font-size: 13px; margin: 6px 0; }

/* ── Options ───────────────────────────────────────────────────────── */
.upload-options {
    margin: 20px 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.option-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-muted);
}
input[type=range] {
    accent-color: var(--accent);
    width: 160px;
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s, opacity .15s;
    text-decoration: none;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.97); }

.btn-primary {
    background: var(--accent-dark);
    color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent); color: var(--bg); }

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover:not(:disabled) { filter: brightness(1.12); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

.btn-wide { width: 100%; margin-top: 4px; }

/* ── Progress ──────────────────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    background: var(--bg-card-2);
    color: var(--text-muted);
    margin-bottom: 16px;
}
.status-badge.status-uploading  { background:#2a2050; color:#ce93d8; }
.status-badge.status-queued     { background:#253a54; color:#7ca4c8; }
.status-badge.status-extracting { background:#1a3050; color:#4fc3f7; }
.status-badge.status-processing { background:#0d3350; color:#29b6f6; }
.status-badge.status-packaging  { background:#0d3a2e; color:#4caf50; }
.status-badge.status-done       { background:#1b3a22; color:#66bb6a; }
.status-badge.status-failed     { background:#3a1a1a; color:#ef9a9a; }

.progress-bar-track {
    background: var(--bg-card-2);
    border-radius: 100px;
    height: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-dark), var(--accent));
    border-radius: 100px;
    transition: width .5s ease;
    width: 0%;
}
.progress-bar-fill.pulsing {
    animation: pulse-brightness 1.6s ease-in-out infinite;
}
@keyframes pulse-brightness {
    0%, 100% { filter: brightness(1); }
    50%       { filter: brightness(1.35); }
}
.progress-label { color: var(--text-muted); font-size: 13px; }
.progress-hint  { color: var(--text-muted); font-size: 12px; margin-top: 6px; opacity: .7; }

/* ── Stats Grid ────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 20px;
}
.stat-box {
    background: var(--bg-card-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    text-align: center;
}
.stat-number {
    display: block;
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
}
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px; }
.stat-leopard    .stat-number { color: #81d4fa; }
.stat-other      .stat-number { color: var(--text-muted); }
.stat-total      .stat-number { color: var(--accent); }
.stat-confidence .stat-number { color: #a5d6a7; }
.stat-time       .stat-number { color: #ffcc80; font-size: 22px; }

/* ── No leos / Download ────────────────────────────────────────────── */
.no-leos-msg {
    text-align: center;
    padding: 24px;
    background: var(--bg-card-2);
    border-radius: 10px;
    margin-bottom: 16px;
}
.no-leos-icon { font-size: 36px; display: block; margin-bottom: 8px; }
.hint { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.download-row { margin-bottom: 8px; }

/* ── Error ─────────────────────────────────────────────────────────── */
.error-card { border-color: #4a1f1f; }
.error-card .card-title { color: var(--danger); }
.error-text {
    background: #1c0f0f;
    border: 1px solid #5a2222;
    border-radius: 8px;
    padding: 14px;
    font-size: 13px;
    color: #ef9a9a;
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 16px;
}

/* ── Modal ─────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 480px;
    position: relative;
    box-shadow: var(--shadow);
}
.modal-close {
    position: absolute;
    top: 14px; right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; color: var(--accent); }

.info-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.info-table tr { border-bottom: 1px solid var(--border); }
.info-table tr:last-child { border-bottom: none; }
.info-table td { padding: 10px 8px; }
.info-table td:first-child { color: var(--text-muted); width: 50%; }
.info-table td:last-child { font-weight: 600; }

.loading-text { color: var(--text-muted); text-align: center; padding: 20px; }

/* ── Footer ────────────────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid rgba(96, 205, 248, 0.10);
    background: rgba(10, 18, 28, 0.70);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ── Utilities ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 680px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
    .stats-grid { grid-template-columns: 1fr; }
    .header-inner { flex-direction: column; height: auto; padding: 12px 0; gap: 8px; }
}
