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

:root {
    --bg: #0a111a;
    --surface: #050a12;
    --card: rgba(10, 15, 25, 0.8);
    --brand: #ffae00;
    --brand-glow: rgba(255, 174, 0, 0.3);
    --brand-dim: rgba(255, 174, 0, 0.1);
    --accent: #2196f3;
    --text: #ffffff;
    --muted: #6b7d8e;
    --border: rgba(255, 255, 255, 0.05);
    --glass: blur(20px);
}

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

body {
    background: var(--bg);
    background-image:
        radial-gradient(circle at 0% 0%, rgba(255, 174, 0, 0.06) 0%, transparent 45%),
        radial-gradient(circle at 100% 100%, rgba(33, 150, 243, 0.04) 0%, transparent 45%);
    color: var(--text);
    font-family: 'Montserrat', system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 40px;
}

.header {
    width: 100%;
    padding: 32px 24px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
}

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

.btn-install {
    background: transparent;
    border: 1px solid var(--brand);
    color: var(--brand);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 0 10px var(--brand-glow);
    transition: all 0.3s;
    text-transform: uppercase;
}

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

.scanner-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 9/12;
    background: #000;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

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

.ergo-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.ergo-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 174, 0, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 174, 0, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}

.ergo-target {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 240px;
    height: 320px;
    border: 1px dashed rgba(255, 174, 0, 0.2);
}

.target-corner {
    width: 15px;
    height: 15px;
    border: 2px solid var(--brand);
    position: absolute;
}

.tl {
    top: -2px;
    left: -2px;
    border-right: 0;
    border-bottom: 0;
}

.tr {
    top: -2px;
    right: -2px;
    border-left: 0;
    border-bottom: 0;
}

.bl {
    bottom: -2px;
    left: -2px;
    border-right: 0;
    border-top: 0;
}

.br {
    bottom: -2px;
    right: -2px;
    border-left: 0;
    border-top: 0;
}

.ergo-center-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: rgba(255, 174, 0, 0.4);
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--brand);
    box-shadow: 0 0 15px var(--brand);
    display: none;
    z-index: 10;
}

.scan-line.active {
    display: block;
    animation: scanLoop 2s infinite ease-in-out;
}

@keyframes scanLoop {
    0% {
        top: 10%;
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

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

.status-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

.p-card {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: 20px;
    text-align: center;
}

.p-label {
    font-size: 9px;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 4px;
    display: block;
    letter-spacing: 1px;
}

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

.controls {
    margin-top: 32px;
    text-align: center;
}

.btn-scan {
    width: 100%;
    padding: 22px;
    border-radius: 24px;
    border: none;
    background: linear-gradient(135deg, var(--brand) 0%, #ff8c00 100%);
    color: #000;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(255, 174, 0, 0.4);
}

.hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 16px;
    line-height: 1.5;
}

/* RESULT MODAL */
.result-panel {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 85vh;
    background: linear-gradient(180deg, #101825 0%, #050a12 100%);
    border-top: 3px solid var(--brand);
    border-radius: 32px 32px 0 0;
    z-index: 1000;
    transition: bottom 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    display: flex;
    flex-direction: column;
}

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

.panel-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nu-chip {
    padding: 6px 14px;
    background: var(--brand-dim);
    color: var(--brand);
    font-size: 11px;
    font-weight: 700;
    border-radius: 30px;
    border: 1px solid var(--brand-glow);
}

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

.res-text {
    color: var(--text);
    line-height: 1.6;
}

.res-text h3 {
    color: var(--brand);
    margin-bottom: 15px;
    font-size: 18px;
}

.res-text p {
    margin-bottom: 12px;
    font-size: 14px;
}

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

.btn-main {
    width: 100%;
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--brand);
    background: var(--brand-dim);
    color: var(--brand);
    font-weight: 800;
    cursor: pointer;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
}