/* ===== Tokens ===== */
:root {
    --bg: #07070d;
    --bg-elev: rgba(255, 255, 255, 0.025);
    --border: rgba(0, 255, 136, 0.18);
    --border-dim: rgba(255, 255, 255, 0.06);
    --text: #e5e7f0;
    --text-dim: #7a8094;
    --text-faint: #4a4f63;

    --neon-green: #00ff88;
    --neon-blue: #00d4ff;
    --neon-pink: #ff3d8a;
    --neon-yellow: #ffe066;

    --glow-green-s: 0 0 12px rgba(0, 255, 136, 0.6);
    --glow-green-l: 0 0 30px rgba(0, 255, 136, 0.4);
    --glow-blue-s: 0 0 12px rgba(0, 212, 255, 0.6);
    --glow-blue-l: 0 0 30px rgba(0, 212, 255, 0.4);

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
    --font-mono: "SF Mono", ui-monospace, "Cascadia Code", monospace;
}

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

html, body {
    height: 100%;
    overscroll-behavior: none;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* ===== Background ===== */
.bg-grid {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0, 212, 255, 0.12), transparent 60%),
        radial-gradient(ellipse 60% 40% at 50% 110%, rgba(0, 255, 136, 0.10), transparent 60%),
        linear-gradient(rgba(0, 255, 136, 0.03) 1px, transparent 1px) 0 0 / 32px 32px,
        linear-gradient(90deg, rgba(0, 255, 136, 0.03) 1px, transparent 1px) 0 0 / 32px 32px;
    pointer-events: none;
    z-index: 0;
}

/* ===== Layout ===== */
.app {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 4px 18px;
    border-bottom: 1px solid var(--border-dim);
    margin-bottom: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.3px;
}

.logo-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--neon-green);
    box-shadow:
        0 0 8px rgba(0, 255, 136, 0.8),
        0 0 16px rgba(0, 255, 136, 0.4);
    animation: pulse 1.8s ease-in-out infinite;
    flex-shrink: 0;
}

.accent-green { color: var(--neon-green); text-shadow: var(--glow-green-s); }
.accent-blue { color: var(--neon-blue); text-shadow: var(--glow-blue-s); }

.status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 1.5px;
    font-family: var(--font-mono);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--neon-green);
    box-shadow: var(--glow-green-s);
    animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ===== Screens ===== */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    animation: fadeUp 0.4s ease;
}
.screen.active { display: flex; }

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

/* ===== Upload screen ===== */
.hero {
    position: relative;
    padding: 24px 0 36px;
    width: 100%;
}

.hero-glow {
    position: absolute;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(0, 255, 136, 0.35), transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: blur(50px);
    z-index: -1;
}

.hero-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--neon-green);
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 100px;
    margin-bottom: 18px;
    text-shadow: var(--glow-green-s);
    background: rgba(0, 255, 136, 0.04);
}

.hero-title {
    font-size: 38px;
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1.05;
    margin-bottom: 14px;
}

.hero-sub {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.5;
}

.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 360px;
    padding: 19px 24px;
    background: linear-gradient(135deg, var(--neon-green) 0%, var(--neon-blue) 100%);
    color: #000;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.3px;
    border: none;
    border-radius: 18px;
    cursor: pointer;
    box-shadow:
        0 0 0 1px rgba(0, 255, 136, 0.4),
        0 0 40px rgba(0, 255, 136, 0.35),
        0 0 80px rgba(0, 212, 255, 0.2);
    transition: transform 0.12s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.upload-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.5) 50%, transparent 70%);
    transform: translateX(-100%);
    animation: shine 3s ease-in-out infinite;
}

@keyframes shine {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.upload-btn:active { transform: scale(0.97); }

.upload-icon { font-size: 22px; }

.stats-row {
    display: flex;
    gap: 10px;
    margin-top: 32px;
    width: 100%;
}

.stat {
    flex: 1;
    background: var(--bg-elev);
    border: 1px solid var(--border-dim);
    border-radius: 14px;
    padding: 14px 6px;
    backdrop-filter: blur(10px);
    transition: border-color 0.2s;
}
.stat:hover { border-color: var(--border); }

.stat-value {
    font-size: 22px;
    font-weight: 900;
    color: var(--neon-green);
    text-shadow: var(--glow-green-s);
    font-family: var(--font-mono);
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 4px;
}

.trust {
    margin-top: 24px;
    font-size: 11px;
    color: var(--text-faint);
    letter-spacing: 0.3px;
}
.trust-dot { color: var(--neon-green); }

/* ===== Loading screen ===== */
.preview-wrap {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-top: 12px;
    margin-bottom: 28px;
    background: var(--bg-elev);
    box-shadow: var(--glow-green-l);
}

.preview-img { width: 100%; height: 100%; object-fit: cover; }

.preview-scan {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-green), transparent);
    box-shadow: var(--glow-green-s);
    animation: scan 1.6s linear infinite;
    z-index: 2;
}

@keyframes scan {
    0% { top: -2px; }
    100% { top: 100%; }
}

.loader-wrap {
    position: relative;
    width: 72px;
    height: 72px;
    margin-bottom: 22px;
}

.loader-ring {
    position: absolute;
    inset: 0;
    border: 2.5px solid rgba(0, 255, 136, 0.1);
    border-top-color: var(--neon-green);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
    box-shadow: var(--glow-green-s);
}

.loader-ring--alt {
    inset: 8px;
    border-color: rgba(0, 212, 255, 0.1);
    border-top-color: var(--neon-blue);
    animation: spin 0.9s linear reverse infinite;
    box-shadow: var(--glow-blue-s);
}

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

.loading-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: -0.3px;
}

.progress-bar {
    width: 100%;
    max-width: 360px;
    height: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 14px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-green), var(--neon-blue));
    box-shadow: var(--glow-green-s);
    width: 0;
    transition: width 0.3s ease;
}

.loading-stage {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--neon-green);
    min-height: 18px;
    letter-spacing: 0.5px;
    text-shadow: var(--glow-green-s);
}

.log {
    margin-top: 20px;
    width: 100%;
    max-width: 360px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-faint);
    text-align: left;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-dim);
    border-radius: 10px;
    padding: 10px 12px;
    min-height: 60px;
    max-height: 100px;
    overflow: hidden;
    line-height: 1.6;
}
.log-line { opacity: 0; animation: logIn 0.3s ease forwards; }
.log-line .ts { color: var(--neon-blue); }
.log-line .ok { color: var(--neon-green); }

@keyframes logIn { to { opacity: 1; } }

/* ===== Result screen ===== */
.result-card {
    width: 100%;
    background:
        linear-gradient(180deg, rgba(0, 255, 136, 0.04), rgba(0, 212, 255, 0.02)),
        var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px 22px;
    margin: 16px 0 24px;
    backdrop-filter: blur(10px);
    box-shadow:
        0 0 60px rgba(0, 255, 136, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
}

.result-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    background: var(--bg);
    color: var(--neon-green);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 100px;
    text-shadow: var(--glow-green-s);
}

.result-section {
    padding: 16px 0;
    border-bottom: 1px dashed var(--border-dim);
}
.result-section:last-child { border-bottom: none; padding-bottom: 0; }
.result-section:first-child { padding-top: 8px; }

.result-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.result-outcome {
    font-size: 32px;
    font-weight: 900;
    color: var(--neon-green);
    text-shadow: var(--glow-green-l);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.result-meta {
    font-size: 12px;
    color: var(--text-dim);
}
.result-meta .dot { margin: 0 6px; color: var(--text-faint); }

.confidence-value {
    font-size: 42px;
    font-weight: 900;
    color: var(--neon-blue);
    text-shadow: var(--glow-blue-l);
    margin-bottom: 12px;
    font-family: var(--font-mono);
    letter-spacing: -1px;
}

.confidence-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 100px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-blue), var(--neon-green));
    box-shadow: var(--glow-blue-s);
    width: 0;
    transition: width 1s cubic-bezier(0.4, 0.2, 0.1, 1);
}

.reasoning-text {
    text-align: left;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
}

.primary-btn {
    width: 100%;
    max-width: 360px;
    padding: 16px;
    background: transparent;
    color: var(--neon-green);
    font-weight: 700;
    border: 1.5px solid var(--neon-green);
    border-radius: 14px;
    cursor: pointer;
    font-size: 15px;
    letter-spacing: 0.3px;
    text-shadow: var(--glow-green-s);
    transition: all 0.2s ease;
    font-family: var(--font);
}
.primary-btn:hover, .primary-btn:active {
    background: rgba(0, 255, 136, 0.08);
    box-shadow: var(--glow-green-s);
}

.disclaimer {
    margin-top: 20px;
    font-size: 11px;
    color: var(--text-faint);
    line-height: 1.5;
    padding: 0 12px;
}

/* ===== Error screen ===== */
.error-icon {
    font-size: 56px;
    margin: 60px 0 18px;
    color: var(--neon-pink);
    text-shadow: 0 0 20px rgba(255, 61, 138, 0.5);
}
.error-icon--suggest {
    color: var(--neon-yellow);
    text-shadow: 0 0 20px rgba(255, 224, 102, 0.55);
}

.error-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 12px;
}

.error-msg {
    color: var(--text-dim);
    margin-bottom: 32px;
    padding: 0 12px;
    font-size: 14px;
    line-height: 1.5;
}

/* ===== Matches screen ===== */
.matches-header {
    width: 100%;
    text-align: left;
    margin-bottom: 18px;
    padding: 8px 4px 0;
}

.matches-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.matches-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.matches-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--neon-green);
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 100px;
    text-shadow: var(--glow-green-s);
}

.matches-sub {
    font-size: 13px;
    color: var(--text-dim);
}

.matches-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-card {
    background: var(--bg-elev);
    border: 1px solid var(--border-dim);
    border-radius: 16px;
    padding: 14px 16px;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.match-card:hover, .match-card:active {
    border-color: var(--border);
    background: rgba(0, 255, 136, 0.04);
    box-shadow: var(--glow-green-s);
    transform: translateY(-1px);
}

.match-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.match-stage {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.match-time {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--neon-blue);
    font-weight: 700;
    text-shadow: var(--glow-blue-s);
}

.match-time--live {
    color: var(--neon-pink);
    text-shadow: 0 0 10px rgba(255, 61, 138, 0.6);
}

.match-time--live::before {
    content: '● ';
    animation: pulse 1.4s infinite;
}

.match-teams {
    display: flex;
    align-items: center;
    gap: 12px;
}

.match-team {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.match-team--away {
    justify-content: flex-end;
    text-align: right;
}

.match-flag {
    font-size: 24px;
    line-height: 1;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.match-team-name {
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-vs {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-faint);
    letter-spacing: 1.5px;
    padding: 0 4px;
}

.match-card-cta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--neon-green);
    text-shadow: var(--glow-green-s);
    opacity: 0.85;
}

/* CTA below the matches list */
.matches-cta {
    margin-top: 20px;
}

/* Section divider between match days */
.matches-day-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 1.8px;
    text-transform: uppercase;
    margin: 18px 0 8px;
}
.matches-day-header--first { margin-top: 4px; }
.matches-day-header::before,
.matches-day-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-dim);
}

/* Empty state */
.empty-state {
    width: 100%;
    text-align: center;
    padding: 30px 0 0;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    filter: drop-shadow(var(--glow-green-s));
}

.empty-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
}

.empty-sub {
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.next-match-card {
    margin-bottom: 24px;
}

/* Picked match strip */
.picked-match {
    width: 100%;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
    box-shadow: var(--glow-green-s);
}

/* "Analyze any match" banner shown on upload screen */
.demo-banner {
    width: 100%;
    background:
        linear-gradient(180deg, rgba(0, 255, 136, 0.05), rgba(0, 212, 255, 0.02)),
        var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 40px rgba(0, 255, 136, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.demo-glow {
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(0, 255, 136, 0.18), transparent 70%);
    filter: blur(40px);
    pointer-events: none;
}

.demo-icon {
    position: relative;
    font-size: 38px;
    margin-bottom: 14px;
    filter: drop-shadow(0 0 16px rgba(0, 255, 136, 0.6));
}

.demo-title {
    position: relative;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.4px;
    margin-bottom: 10px;
}

.demo-sub {
    position: relative;
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.6;
    max-width: 340px;
    margin: 0 auto;
}

/* Ghost button */
.ghost-btn {
    margin-top: 16px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font);
    padding: 8px 16px;
}
.ghost-btn:hover { color: var(--text); }

