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

:root {
    --bg: #0a0a14;
    --surface: #10101f;
    --card: rgba(22, 22, 34, 0.95);
    --brand: #00ff88;
    --brand-glow: rgba(0, 255, 136, 0.4);
    --brand-dim: rgba(0, 255, 136, 0.15);
    --accent: #ff9500;
    --text: #ffffff;
    --muted: #a0a0b8;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 15px 50px rgba(0, 0, 0, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg);
    background-image:
        radial-gradient(circle at 50% 0%, rgba(0, 255, 136, 0.06) 0%, transparent 60%),
        radial-gradient(circle at 100% 100%, rgba(0, 255, 136, 0.03) 0%, transparent 50%);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    padding-bottom: 40px;
}

header {
    width: 100%;
    padding: 32px 24px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-area {
    display: flex;
    flex-direction: column;
}

.logo-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 24px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 60%, var(--brand) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 5px rgba(0, 255, 136, 0.3));
}

.logo-name span {
    color: var(--brand);
}

.logo-sub {
    font-size: 9px;
    letter-spacing: 2, 5px;
    color: var(--muted);
    text-transform: uppercase;
    margin-top: 4px;
}

.btn-install {
    background: var(--brand-dim);
    border: 1px solid var(--brand);
    color: var(--brand);
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 0 15px var(--brand-glow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
}

.btn-install:active {
    transform: scale(0.95);
    box-shadow: 0 0 5px var(--brand-glow);
}

.geo-status {
    font-size: 11px;
    font-weight: 700;
    color: var(--brand);
    background: var(--brand-dim);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--brand-glow);
}

.app-container {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 0 20px;
}

.scanner-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    background: #000;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-top: 10px;
}

@keyframes rotate-border {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

#videoEl {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ar-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

.ar-tag {
    position: absolute;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid var(--brand);
    color: #fff;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    animation: tagAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    z-index: 200;
    /* Extremely high z-index */
}

@keyframes tagAppear {
    from {
        opacity: 0;
        transform: scale(0.5) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.nutri-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--brand), transparent);
    box-shadow: 0 0 25px var(--brand);
    display: none;
    z-index: 50;
}

.nutri-line.animating {
    display: block;
    animation: scanNutri 1.5s infinite ease-in-out;
}

@keyframes scanNutri {
    0% {
        top: 0%;
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    85% {
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

.quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 24px;
}

.q-card {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.q-label {
    font-size: 10px;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}

.q-val {
    font-family: 'Space Mono', monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--brand);
}

.btn-scan {
    width: 100%;
    margin-top: 20px;
    padding: 22px;
    border-radius: 24px;
    border: none;
    background: linear-gradient(135deg, var(--brand) 0%, #00d28d 100%);
    color: #000;
    font-family: 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 255, 136, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-scan:active {
    transform: scale(0.96);
    box-shadow: 0 5px 15px rgba(0, 255, 136, 0.2);
}

/* RESULT PANEL - DRAWER */
.result-panel {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 85vh;
    background: linear-gradient(180deg, #121224 0%, #0a0a14 100%);
    border-top: 2px solid var(--brand-glow);
    border-radius: 32px 32px 0 0;
    z-index: 2000;
    transition: bottom 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.9);
}

.result-panel.visible {
    bottom: 0;
}

.panel-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(20, 20, 36, 0.6);
    backdrop-filter: blur(15px);
    border-top-left-radius: 32px;
    border-top-right-radius: 32px;
}

.close-btn {
    background: var(--brand-dim);
    border: 1px solid var(--brand-glow);
    color: var(--brand);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    /* Larger X */
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.close-btn:hover {
    background: var(--brand);
    color: #000;
}

.close-btn:active {
    transform: scale(0.85);
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    -webkit-overflow-scrolling: touch;
}

.res-text h3 {
    color: var(--brand);
    margin: 20px 0 10px;
    font-family: 'Outfit', sans-serif;
}

.res-text ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.res-text li {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 14px;
}

.panel-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
    background: rgba(10, 10, 20, 0.8);
}

.btn-main {
    width: 100%;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--brand);
    background: var(--brand-dim);
    color: var(--brand);
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
}