@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: #050510;
    --surface: #0a0a20;
    --card: rgba(20, 20, 45, 0.9);
    --brand: #00f5d4;
    --brand-glow: rgba(0, 245, 212, 0.4);
    --brand-dim: rgba(0, 245, 212, 0.1);
    --accent: #00bbf9;
    --text: #ffffff;
    --muted: #a0a0c8;
    --border: rgba(255, 255, 255, 0.1);
}

* {
    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, 245, 212, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 0% 100%, rgba(0, 187, 249, 0.05) 0%, transparent 40%);
    color: var(--text);
    font-family: 'Inter', 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;
}

.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;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 50%, var(--brand) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.torch-btn {
    background: var(--brand-dim);
    border: 1px solid var(--brand-glow);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.torch-btn.active {
    background: var(--brand);
    box-shadow: 0 0 15px var(--brand);
}

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

.tab-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 4px;
    margin-bottom: 24px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 12px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--brand);
    color: #000;
}

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

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

.eye-guide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 20;
}

.guide-circle {
    width: 100px;
    height: 100px;
    border: 2px solid var(--brand);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--brand-glow), inset 0 0 15px var(--brand-glow);
    position: absolute;
}

.guide-circle.left {
    left: 15%;
    top: 35%;
}

.guide-circle.right {
    right: 15%;
    top: 35%;
}

.center-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    border-left: 1px dashed rgba(255, 255, 255, 0.1);
}

.opti-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: 30;
}

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

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

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

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

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

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

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

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

.btn-scan {
    width: 100%;
    margin-top: 24px;
    padding: 22px;
    border-radius: 24px;
    border: none;
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
    color: #000;
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
}

/* EYE TEST SECTION */
.test-viewport {
    background: #fff;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.optotype-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.optotype-letter {
    color: #000;
    font-weight: 900;
    font-family: 'Space Mono', monospace;
    transition: font-size 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.test-controls {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.ctrl-btn {
    width: 44px;
    height: 44px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
}

.current-level {
    font-weight: 900;
    color: #000;
    font-size: 14px;
}

.test-info {
    font-size: 12px;
    color: var(--muted);
    margin-top: 16px;
    text-align: center;
    line-height: 1.5;
}

/* RESULT MODAL */
.result-panel {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 85vh;
    background: linear-gradient(180deg, #101030 0%, #050510 100%);
    border-top: 2px 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;
    text-transform: uppercase;
    border-radius: 30px;
}

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

.panel-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
}

.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;
    cursor: pointer;
}

.instructions {
    margin-top: 32px;
}

.instructions h3 {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--brand);
    margin-bottom: 12px;
}

.instructions p {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
}