@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: #0a0a20;
    --surface: #12122b;
    --card: rgba(25, 25, 45, 0.9);
    --brand: #4361ee;
    --brand-glow: rgba(67, 97, 238, 0.4);
    --brand-dim: rgba(67, 97, 238, 0.15);
    --accent: #4cc9f0;
    --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 0% 0%, rgba(67, 97, 238, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 100% 100%, rgba(76, 201, 240, 0.04) 0%, transparent 50%);
    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);
}

.stress-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    background: rgba(76, 201, 240, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(76, 201, 240, 0.3);
    text-transform: uppercase;
}

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

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

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

.resp-visualizer {
    position: absolute;
    bottom: 24px;
    left: 20px;
    right: 20px;
    height: 60px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    border-radius: 16px;
    border: 1px solid rgba(76, 201, 240, 0.2);
    overflow: hidden;
    z-index: 30;
}

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

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

.breath-circle {
    width: 120px;
    height: 120px;
    border: 3px solid var(--accent);
    border-radius: 50%;
    background: rgba(76, 201, 240, 0.05);
    box-shadow: 0 0 40px rgba(76, 201, 240, 0.4);
    transition: all 4s ease-in-out;
}

.breath-circle.inhale {
    transform: scale(1.6);
    background: rgba(76, 201, 240, 0.2);
    box-shadow: 0 0 60px rgba(76, 201, 240, 0.6);
}

.breath-circle.exhale {
    transform: scale(0.8);
    background: rgba(76, 201, 240, 0.05);
}

.breath-circle.hold {
    transform: scale(1.2);
    border-style: dotted;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
}

.breath-text {
    margin-top: 30px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
}

.metrics-grid {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    z-index: 30;
}

.m-card {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: 10px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.m-label {
    font-size: 9px;
    color: var(--muted);
    font-weight: 700;
}

.m-val {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

.controls {
    margin-top: 24px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--surface);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    transition: width 0.1s linear;
}

.btn-main {
    width: 100%;
    padding: 22px;
    border-radius: 24px;
    border: none;
    background: linear-gradient(135deg, var(--brand) 0%, #1c39bb 100%);
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(67, 97, 238, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s;
}

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

.btn-main.active {
    background: var(--surface);
    color: var(--muted);
    pointer-events: none;
}

.technique-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--brand);
    margin: 32px 0 16px;
    letter-spacing: 2px;
}

.technique-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 30px;
}

.tech-chip {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 16px 8px;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.tech-chip.active {
    border-color: var(--accent);
    background: var(--brand-dim);
    box-shadow: 0 0 15px var(--brand-glow);
    transform: translateY(-4px);
}

.t-emoji {
    font-size: 20px;
    display: block;
    margin-bottom: 8px;
}

.tech-chip h4 {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 2px;
}

.tech-chip p {
    font-size: 9px;
    color: var(--muted);
}

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

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

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

/* RESULT MODAL - DRAWER */
.result-panel {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 85vh;
    background: linear-gradient(180deg, #10102b 0%, #050514 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;
    letter-spacing: 1.5px;
    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;
}

.btn-primary {
    width: 100%;
    padding: 18px;
    border-radius: 20px;
    border: none;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.scan-line {
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    background: rgba(76, 201, 240, 0.3);
    z-index: 25;
}