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

:root {
    --bg: #0d0415;
    --surface: #1a0b2e;
    --card: #251341;
    --brand: #ff00ff;
    /* Magenta Glucosa */
    --brand-glow: rgba(255, 0, 255, 0.4);
    --brand-dim: rgba(255, 0, 255, 0.08);
    --accent: #8e1cff;
    /* Violeta Eléctrico */
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: rgba(255, 0, 255, 0.2);
    --glass: blur(15px);
}

* {
    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, 0, 255, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(142, 28, 255, 0.1) 0%, transparent 40%);
    color: var(--text);
    font-family: 'Montserrat', system-ui, sans-serif;
    min-height: 100vh;
    padding-bottom: 40px;
}

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

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -1px;
}

.logo span {
    color: var(--brand);
    text-shadow: 0 0 15px var(--brand-glow);
}

.logo small {
    font-size: 11px;
    vertical-align: middle;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 30px;
    margin-left: 4px;
}

.btn-install {
    background: var(--brand-dim);
    color: var(--brand);
    border: 1px solid var(--brand);
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 800;
}

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

.scanner-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #000;
    border-radius: 40px;
    overflow: hidden;
    border: 4px solid var(--surface);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}

#videoEl {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(1.2);
}

.scan-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, transparent 40%, rgba(13, 4, 21, 0.7) 100%);
}

.finger-guide {
    width: 60px;
    height: 80px;
    border: 2.5px solid var(--brand);
    border-radius: 30px;
    box-shadow: 0 0 15px var(--brand-glow);
    transition: all 0.5s;
}

.scan-status {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand);
    margin-top: 16px;
    letter-spacing: 2px;
}

.wave-container {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60px;
    overflow: hidden;
    opacity: 0.8;
}

#ppgWave {
    width: 100%;
    height: 100%;
    display: block;
}

.progress-ring-container {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring__circle {
    transition: stroke-dashoffset 0.35s;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    stroke-dasharray: 326.7;
    stroke-dashoffset: 326.7;
    /* 2*PI*52 */
}

.progress-text {
    position: absolute;
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
}

.m-card {
    background: var(--card);
    padding: 20px;
    border-radius: 28px;
    border: 1px solid var(--border);
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.m-label {
    font-size: 10px;
    color: var(--muted);
    font-weight: 800;
    letter-spacing: 1.5px;
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.m-val {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: var(--brand);
}

.m-unit {
    font-size: 11px;
    color: var(--muted);
    font-weight: 700;
    margin-left: 4px;
}

.user-context {
    margin-bottom: 32px;
}

.context-label {
    font-size: 12px;
    color: var(--text);
    font-weight: 800;
    margin-bottom: 12px;
}

.context-chips {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.chip {
    flex-shrink: 0;
    padding: 12px 20px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.chip.active {
    background: var(--brand);
    color: #000;
    border-color: var(--brand);
    box-shadow: 0 10px 20px var(--brand-glow);
    transform: scale(1.05);
}

.btn-main {
    width: 100%;
    padding: 24px;
    border-radius: 30px;
    border: none;
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 20px 40px var(--brand-glow);
    transition: all 0.3s;
}

.btn-main:active {
    transform: scale(0.96);
    opacity: 0.8;
}

.instructions {
    margin-top: 32px;
    padding: 24px;
    background: var(--brand-dim);
    border-radius: 24px;
    border: 1px solid var(--border);
}

.instructions h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    color: var(--brand);
    margin-bottom: 12px;
}

.instructions p {
    font-size: 12px;
    line-height: 1.7;
    color: var(--muted);
    font-weight: 500;
}

/* MODAL */
.result-panel {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 88vh;
    background: #11081a;
    border-top: 6px solid var(--brand);
    border-radius: 44px 44px 0 0;
    z-index: 1000;
    transition: bottom 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.8);
}

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

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

.nu-chip {
    padding: 8px 18px;
    background: var(--brand-dim);
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    border-radius: 30px;
    border: 1.5px solid var(--border);
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 30px 40px;
}

.panel-footer {
    padding: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-primary {
    width: 100%;
    padding: 20px;
    border-radius: 24px;
    border: none;
    background: var(--brand);
    color: #000;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
}

.close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.disclaimer {
    font-size: 9px;
    color: var(--muted);
    margin-top: 16px;
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.5;
}

.res-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.res-card h3 {
    color: var(--brand);
    font-family: 'Outfit', sans-serif;
    margin-bottom: 12px;
}

.res-card p {
    line-height: 1.7;
    font-size: 14px;
    color: #cbd5e1;
    margin-bottom: 15px;
}

.res-card ul {
    padding-left: 18px;
    color: #94a3b8;
}