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

:root {
    --bg: #050a12;
    --surface: #0a141f;
    --card: #111e2b;
    --brand: #0088ff;
    /* Azul Gastro / Clínico */
    --brand-glow: rgba(0, 136, 255, 0.4);
    --brand-dim: rgba(0, 136, 255, 0.08);
    --accent: #0052d4;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: rgba(0, 136, 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(0, 136, 255, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(0, 82, 212, 0.05) 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;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--surface);
    padding: 6px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border-radius: 14px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: 0.3s;
}

.tab-btn.active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 5px 15px var(--brand-glow);
}

.mic-stage {
    background: var(--surface);
    border-radius: 32px;
    border: 1px solid var(--border);
    height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.sound-wave {
    display: flex;
    gap: 4px;
    height: 100px;
    align-items: center;
    z-index: 5;
}

.sound-wave i {
    width: 6px;
    height: 20px;
    background: var(--brand);
    border-radius: 3px;
    animation: pulseWave 1s infinite ease-in-out;
    opacity: 0.2;
}

@keyframes pulseWave {

    0%,
    100% {
        height: 20px;
        opacity: 0.2;
    }

    50% {
        height: 80px;
        opacity: 1;
        box-shadow: 0 0 15px var(--brand-glow);
    }
}

.sound-wave i:nth-child(even) {
    animation-delay: 0.2s;
}

.sound-wave i:nth-child(3n) {
    animation-delay: 0.4s;
}

.mic-status {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 800;
    color: var(--brand);
    margin-top: 24px;
    letter-spacing: 2px;
}

.mic-icon {
    font-size: 40px;
    position: absolute;
    opacity: 0.05;
    font-weight: 100;
    pointer-events: none;
}

.countdown {
    position: absolute;
    top: 20px;
    right: 24px;
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: var(--muted);
}

.camera-viewport {
    width: 100%;
    aspect-ratio: 1;
    background: #000;
    border-radius: 32px;
    overflow: hidden;
    position: relative;
    border: 4px solid var(--surface);
}

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

.tongue-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 240px;
    border: 2.5px dashed rgba(0, 136, 255, 0.4);
    border-radius: 90px;
}

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

.scan-line.active {
    display: block;
    animation: scanLoop 1.5s infinite;
}

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

    100% {
        top: 100%;
    }
}

.btn-main {
    width: 100%;
    padding: 22px;
    border-radius: 28px;
    border: none;
    background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 15px 35px var(--brand-glow);
    margin-top: 24px;
}

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

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

/* BRISTOL SCALE */
.bristol-container {
    padding: 30px 0;
}

.bristol-label {
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 24px;
    letter-spacing: 1px;
    text-align: center;
}

.bristol-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bristol-item {
    background: var(--card);
    padding: 18px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: 0.3s;
    cursor: pointer;
    text-align: left;
    border: none;
    width: 100%;
}

.bristol-item.active {
    border: 1.5px solid var(--brand);
    background: var(--brand-dim);
    box-shadow: 0 10px 30px var(--brand-glow);
}

.b-type {
    background: var(--brand);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    padding: 4px 10px;
    border-radius: 8px;
    flex-shrink: 0;
}

.bristol-item p {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    padding-top: 2px;
}

/* RESULTS */
.result-panel {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 85vh;
    background: #050a12;
    border-top: 6px solid var(--brand);
    border-radius: 40px 40px 0 0;
    z-index: 1000;
    transition: bottom 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

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

.btn-primary {
    width: 100%;
    padding: 20px;
    border-radius: 20px;
    border: none;
    background: var(--brand);
    color: #fff;
    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;
}

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

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

.res-card p {
    line-height: 1.6;
    font-size: 14px;
    color: #cbd5e1;
}

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