@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,400;0,500;1,400&family=Inter:wght@400;500;600;700;800;900&family=Manrope:wght@300;400;500;600;700;800&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400;1,6..72,500&family=Patua+One&family=Playfair+Display:ital,wght@0,400;0,600;1,400&family=Plus+Jakarta+Sans:wght@500;600;700;800;900&display=swap');

@font-face {
    font-family: 'MenuFontCustom';
    src: url('/static/fonts/menu-custom.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'moret-variable';
    src: url('/static/fonts/moret-variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}


:root {
    /* ── JivaScope Clean Clinical Palette (from jivascope.com) ── */
    --bg-dark: #FAF8F5; /* Warm Ivory body background */
    --bg-body: #FAF8F5;
    --bg-card: #FFFFFF; /* Crisp Clinical White */
    --bg-elevated: #F5F3EF; /* Soft Ivory Surface */
    --bg-glass: rgba(255, 255, 255, 0.95);
    --bg-glass-hover: #FFFFFF;

    /* JivaScope Solid Charcoal & Clinical Teal */
    --brand-dark: #161719;
    --brand-teal: #208077;
    --brand-teal-soft: #2F8F86;

    --accent: #161719;
    --accent-teal: #208077;
    --accent-teal-dim: rgba(32, 128, 119, 0.1);
    --orange: #161719;
    --orange-dim: rgba(22, 23, 25, 0.05);
    --beige: #3F4147;
    --beige-light: #161719;

    /* Inks & Colors */
    --white: #161719;
    --white-dim: #6C6F76;
    --text-muted: #8C9097;
    --text-charcoal: #161719;

    /* Borders & Shadows */
    --border: #E2E2D9;
    --border-hover: #161719;
    --border-focus: #161719;
    --card-bd-hover: #161719;
    --shadow: rgba(22, 23, 25, 0.03);
    --shadow-lg: 0 10px 30px rgba(22, 23, 25, 0.06);

    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --radius-full: 999px;

    /* ── Exact Typography Hierarchy from jivascope.com ── */
    /* 1. Manrope: Whole site default (body), cards, descriptions, UI buttons */
    --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* 2. Plus Jakarta Sans (fallback Inter): Giant "JIVASCOPE" Hero wordmark, primary nav, tagline, CTAs */
    --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* 3. DM Mono: Data & Technical Elements (category badges, eyebrow labels, acoustic metrics, hardware specs, timestamps) */
    --font-mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* 4. Newsreader / Playfair Display: Headings base h1, h2, h3 and editorial accents */
    --font-serif: 'Newsreader', 'Playfair Display', Georgia, serif;

    /* 5. MenuFontCustom: Full-Screen Navigation overlay menu */
    --font-menu-custom: 'MenuFontCustom', 'Plus Jakarta Sans', sans-serif;

    /* 6. Patua One: Special Legacy Logo Wordmark branding */
    --font-patua: 'Patua One', serif;
    --font-moret: 'moret-variable', 'Playfair Display', Georgia, serif;

    --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-base: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--white);
    background-color: var(--bg-dark);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Fixed full-screen background image + dark scrim (matches landing page) */
.bg-image {
    display: none;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(circle at 50% -20%, rgba(185, 71, 79, 0.05) 0%, transparent 60%);
}

::selection {
    background: #161719;
    color: #FAF8F5;
}

#shader-canvas {
    display: none;
}

.blur-overlay {
    display: none;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.glass-card {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 2px 12px rgba(22, 23, 25, 0.03);
}


.logo,
.brand-capsule,
.q-logo {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    font-style: normal;
    color: #161719;
    letter-spacing: -0.035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.logo-accent { color: inherit; }


.logo-accent { color: inherit; }

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-serif);
    font-weight: 500;
    line-height: 1.2;
    color: var(--beige-light);
    letter-spacing: -0.015em;
}

h1 {
    font-size: 3rem;
}

h2 {
    font-size: 2.2rem;
}

h3 {
    font-size: 1.6rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    color: #74777E;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--white);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:hover {
    border-color: var(--border-hover);
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(22, 23, 25, 0.12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.6rem;
    font-family: var(--font-sans);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    letter-spacing: 0.01em;
    text-transform: none;
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-base),
        border-color var(--transition-fast),
        color var(--transition-fast),
        background-color var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    width: 100%;
    background: #161719;
    border: 1px solid #161719;
    color: #FFFFFF;
    font-family: var(--font-display);
    font-weight: 700;
    border-radius: var(--radius-full);
    box-shadow: 0 2px 10px rgba(22, 23, 25, 0.15);
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    background: #2D3036;
    border-color: #2D3036;
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(22, 23, 25, 0.22);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-ghost {
    background: transparent;
    color: var(--white-dim);
    padding: 0.55rem 1.1rem;
    font-family: var(--font-body);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--accent);
    border-color: var(--border-focus);
}

.error-message {
    background: var(--orange-dim);
    border: 1px solid rgba(22, 23, 25, 0.18);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--accent);
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    margin-bottom: 1.25rem;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    20%,
    60% {
        transform: translateX(-5px);
    }
    40%,
    80% {
        transform: translateX(5px);
    }
}

.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    animation: fadeInUp 0.6s var(--transition-slow);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header 
.logo,
.brand-capsule,
.q-logo {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    font-style: normal;
    color: #161719;
    letter-spacing: -0.035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.logo-accent { color: inherit; }


.login-subtitle {
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--white-dim);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 2;
    box-shadow: 0 2px 12px rgba(22, 23, 25, 0.03);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sign-out {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.sign-out__icon {
    display: none;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.user-greeting {
    font-size: 0.75rem;
    color: var(--white-dim);
    letter-spacing: 1px;
}

.user-name {
    font-weight: 600;
    color: var(--beige);
}

.dashboard-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.dashboard-card {
    width: 100%;
    max-width: 800px;
    padding: 3rem;
    text-align: center;
    animation: fadeInUp 0.6s var(--transition-slow);
}

.dashboard-title {
    margin-bottom: 1rem;
}

.dashboard-subtitle {
    font-size: 0.9rem;
    color: var(--white-dim);
    max-width: 500px;
    margin: 0 auto;
}

.screen {
    display: none;
    width: 100%;
}

.screen.active {
    display: flex;
    justify-content: center;
    animation: fadeInUp 0.5s ease;
}

.section-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 3vw, 2.55rem);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #161719;
    margin-bottom: 0.6rem;
    text-transform: none;
}

.section-subtitle {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 400;
    color: #74777E;
    line-height: 1.55;
    letter-spacing: normal;
    margin-bottom: 2rem;
}

.upload-card {
    max-width: 600px;
}

.upload-zone {
    border: 2px dashed #D2D2C8;
    border-radius: var(--radius-md);
    padding: 3rem 2rem;
    transition: all var(--transition-base);
    cursor: pointer;
    background: #FCFCFA;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: #161719;
    background: #F8F6F2;
}

.upload-zone.drag-over {
    transform: scale(1.02);
}

.upload-icon {
    color: #161719;
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 0.9rem;
    color: var(--white-dim);
    margin-bottom: 0.5rem;
}

.upload-or {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.upload-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    letter-spacing: 0.02em;
}

.btn-secondary:hover {
    background: rgba(185, 71, 79, 0.12);
    border-color: var(--border-focus);
}

.file-preview {
    display: none;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--orange-dim);
    border: 1px solid rgba(22, 23, 25, 0.18);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
}

.file-preview.visible {
    display: block;
    animation: fadeInUp 0.3s ease;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--orange);
}

.file-name {
    flex: 1;
    font-weight: 500;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--beige-light);
    font-size: 0.85rem;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    color: var(--orange);
}

.btn-analyze {
    margin-top: 1.5rem;
    width: 100%;
}

.btn-analyze:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none !important;
}

.processing-card {
    max-width: 600px;
    padding: 3rem;
}

.processing-animation {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
}

.pulse-ring {
    position: absolute;
    inset: 0;
    border: 2px solid #208077;
    border-radius: 50%;
    animation: pulse-ring 2s ease-out infinite;
}

.pulse-ring.delay-1 {
    animation-delay: 0.5s;
}

.pulse-ring.delay-2 {
    animation-delay: 1s;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.heart-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #208077;
    animation: heartbeat 1.2s ease-in-out infinite;
}

@keyframes heartbeat {
    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.processing-title {
    font-family: var(--font-serif);
    font-size: clamp(1.65rem, 2.4vw, 2.1rem);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: #161719;
    margin-bottom: 0.5rem;
    text-transform: none;
}

.processing-status {
    color: var(--white-dim);
    margin-bottom: 2rem;
    font-size: 0.82rem;
}

.progress-container {
    width: 100%;
    height: 4px;
    background: var(--bg-dark);
    overflow: hidden;
    margin-bottom: 2rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: #161719;
    transition: width 0.3s ease;
}

.spectrogram-preview,
.visualizations-preview {
    display: none;
    text-align: left;
}

.spectrogram-preview.visible,
.visualizations-preview.visible {
    display: block;
    animation: fadeInUp 0.5s ease;
}

.visualization-item {
    margin-bottom: 1.5rem;
}

.visualization-item:last-child {
    margin-bottom: 0;
}

.waveform-image {
    background: #F8F6F2;
    padding: 1rem;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.waveform-image img {
    max-width: 100%;
    border-radius: 8px;
}

.spectrogram-label {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: #161719;
    margin-bottom: 0.75rem;
    text-transform: none;
}

.spectrogram-image {
    background: #F8F6F2;
    padding: 1rem;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.spectrogram-image img {
    max-width: 100%;
    border-radius: 8px;
}

.spectrogram-placeholder {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.spectrogram-loading {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.report-card {
    max-width: 900px;
    text-align: left;
}

.report-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.report-title {
    font-family: var(--font-serif);
    font-size: clamp(1.85rem, 2.6vw, 2.35rem);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: #161719;
    margin-bottom: 0.5rem;
    text-transform: none;
}

.report-timestamp {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #8C9097;
    letter-spacing: 0.04em;
}

.report-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.report-section {
    padding: 1.5rem;
    background: #FFFFFF; box-shadow: 0 1px 3px rgba(22, 23, 25, 0.03);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
}

.report-section:nth-child(even) {
    border-left-color: var(--accent);
}

.report-section-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: #161719;
    margin-bottom: 1rem;
    text-transform: none;
}

.audio-player-wrapper {
    margin-bottom: 0.5rem;
}

.audio-player-wrapper audio {
    width: 100%;
}

.audio-filename {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.report-spectrogram {
    background: #F8F6F2;
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.report-spectrogram img {
    max-width: 100%;
    border-radius: 8px;
}

.report-waveform {
    background: #F8F6F2;
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.report-waveform img {
    max-width: 100%;
    border-radius: 8px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.result-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: #F8F6F2;
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.result-card.positive {
    border-left-color: var(--accent);
}

.result-card.negative {
    border-left-color: var(--accent);
}

.result-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--orange-dim);
    color: var(--accent);
    border-radius: var(--radius-sm);
}

.result-icon.warning {
    background: rgba(22, 23, 25, 0.06);
    color: var(--accent);
}

.result-icon.bpm {
    background: rgba(185, 71, 79, 0.12);
    color: var(--beige-light);
}

.result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.result-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    color: #74777E;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

    .result-value {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 500;
    color: #161719;
    letter-spacing: -0.02em;
}

.disease-suggestion {
    font-size: 0.7rem;
    color: var(--accent);
    font-style: italic;
    display: block;
    margin-top: 0.25rem;
}

.result-badge {
    padding: 0.375rem 0.85rem;
    font-family: var(--font-display);
    font-size: 0.82rem;
    letter-spacing: 0;
    text-transform: uppercase;
    background: var(--bg-elevated);
    color: var(--text-muted);
    border-radius: var(--radius-full);
}

.result-badge.detected {
    background: rgba(22, 23, 25, 0.08);
    color: var(--accent);
}

.result-badge.not-detected {
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.result-badge.warning {
    background: var(--orange-dim);
    color: var(--accent);
}

.report-actions {
    display: flex;
    gap: 2px;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.report-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.6rem;
    font-family: var(--font-sans);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    letter-spacing: 0.01em;
    text-transform: none;
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-base),
        border-color var(--transition-fast),
        color var(--transition-fast),
        background-color var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-tabs {
    display: flex;
    gap: 2px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.35rem;
    border: 1px solid transparent;
    background: transparent;
    color: #74777E;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
    text-transform: none;
}

.tab-btn:hover {
    color: #161719;
    background: rgba(0, 0, 0, 0.04);
}

.tab-btn.active {
    background: #161719;
    color: #FFFFFF;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(22, 23, 25, 0.15);
}

.tab-btn svg {
    width: 18px;
    height: 18px;
}

.tab-content {
    display: none;
    width: 100%;
}

.tab-content.active {
    display: flex;
    justify-content: center;
}

.diagnosis-banner {
    padding: 1rem 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
    font-family: var(--font-display);
    font-size: 1.3rem;
    letter-spacing: 0;
    border-radius: var(--radius-sm);
    font-style: normal; font-weight: 700; }

.diagnosis-banner.normal {
    background: #EBF7F5;
    border: 1px solid #A8DED8;
    border-left: 4px solid #2F8F86;
    color: #1A635B;
}

.diagnosis-banner.abnormal {
    background: #FDF2F2;
    border: 1px solid #F5C2C5;
    border-left: 4px solid #161719;
    color: #9B2C33;
}

.diagnosis-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.audio-warning-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    margin-bottom: 1rem;
    background: rgba(185, 71, 79, 0.10);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 0.82rem;
}

.audio-warning-banner svg {
    flex-shrink: 0;
    color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 640px) {
    .login-card,
    .dashboard-card {
        padding: 1.5rem 1.1rem;
    }

    .dashboard-content {
        padding: 1rem;
    }

    .navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: env(safe-area-inset-top, 0px) 0.85rem 0;
    height: calc(60px + env(safe-area-inset-top, 0px));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 2;
    box-shadow: 0 2px 12px rgba(22, 23, 25, 0.03);
}

    .nav-capsule {
        padding: 0.4rem 0.6rem;
        font-size: 0.62rem;
        white-space: nowrap;
    }

    .brand-capsule {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-style: normal;
    font-weight: 800;
    color: #161719;
    letter-spacing: -0.035em;
    text-transform: uppercase;
}

    .nav-user {
        gap: 0.35rem;
        min-width: 0;
        flex-shrink: 1;
    }

    .nav-tabs {
        flex-shrink: 0;
    }

    .tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.35rem;
    border: 1px solid transparent;
    background: transparent;
    color: #74777E;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
    text-transform: none;
}

    .tab-btn svg {
        width: 14px;
        height: 14px;
    }

    .nav-capsule.user-greeting {
        display: none;
    }

    .sign-out__label {
        display: none;
    }

    .sign-out__icon {
        display: block;
        width: 18px;
        height: 18px;
    }

    .nav-capsule.sign-out {
        padding: 0.45rem;
        border-radius: 999px;
        flex-shrink: 0;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .section-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 3vw, 2.55rem);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #161719;
    margin-bottom: 0.6rem;
    text-transform: none;
}

    .mode-switch {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: #EAE7E0;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px;
    margin: 0 auto 1.5rem;
    max-width: 360px;
}

    .mode-option {
    position: relative;
    z-index: 1;
    border: none;
    background: transparent;
    color: #74777E;
    font-family: var(--font-display);
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    transition: color var(--transition-fast, 0.2s) ease;
    text-transform: none;
}

    .upload-zone {
    border: 2px dashed #D2D2C8;
    border-radius: var(--radius-md);
    padding: 3rem 2rem;
    transition: all var(--transition-base);
    cursor: pointer;
    background: #FCFCFA;
}

    .results-grid {
        grid-template-columns: 1fr;
    }

    .report-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .report-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.6rem;
    font-family: var(--font-sans);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    letter-spacing: 0.01em;
    text-transform: none;
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-base),
        border-color var(--transition-fast),
        color var(--transition-fast),
        background-color var(--transition-fast);
    position: relative;
    overflow: hidden;
}

    .report-actions {
        flex-direction: column;
    }

    .report-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.6rem;
    font-family: var(--font-sans);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    letter-spacing: 0.01em;
    text-transform: none;
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-base),
        border-color var(--transition-fast),
        color var(--transition-fast),
        background-color var(--transition-fast);
    position: relative;
    overflow: hidden;
}

    .diagnosis-banner {
        padding: 0.75rem 1rem;
        font-size: 1.1rem;
    }

    .verdict-banner {
        flex-direction: column;
        gap: 0.75rem;
    }

    .verdict-risk {
        margin-left: 0;
        text-align: left;
    }

    .verdict-status-value {
        font-size: 1.5rem;
    }

    .points-detail-body {
        grid-template-columns: 1fr;
    }

    .rec-hud-top {
        padding: 8px 10px;
    }

    .rec-stat,
    .rec-badge {
        font-size: 0.58rem;
        padding: 3px 7px;
    }

    .rec-progress {
        top: 52px;
        gap: 7px;
    }

    .rec-dot {
        width: 28px;
        height: 28px;
    }

    .rec-dot em {
        font-size: 0.6rem;
    }

    .rec-target-code {
        font-size: 1.3rem;
    }

    .rec-target-name {
        font-size: 0.78rem;
    }

    .rec-instruction {
        font-size: 0.75rem;
    }

    .cam-btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }

    .rec-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .rec-hud-bottom {
        padding: 0 12px 18px;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 12, 15, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: 0 26px 70px var(--shadow-lg);
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-slow);
}

.modal-overlay.active .modal-card {
    transform: scale(1) translateY(0);
}

.modal-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon.warning {
    background: rgba(22, 23, 25, 0.08);
    color: var(--accent);
    border-radius: var(--radius-md);
}

.modal-icon.error {
    background: var(--orange-dim);
    color: var(--accent);
    border-radius: var(--radius-md);
}

.modal-icon.info {
    background: rgba(185, 71, 79, 0.12);
    color: var(--accent);
    border-radius: var(--radius-md);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--beige-light);
    margin-bottom: 0.75rem;
    letter-spacing: 0;
    font-style: italic;
}

.modal-message {
    font-size: 0.85rem;
    color: var(--white-dim);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.6rem;
    font-family: var(--font-sans);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    letter-spacing: 0.01em;
    text-transform: none;
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-base),
        border-color var(--transition-fast),
        color var(--transition-fast),
        background-color var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn-warning {
    background: var(--accent);
    color: #FFFFFF;
    font-family: var(--font-display);
    letter-spacing: 0.02em;
    border: 1px solid var(--accent);
}

.btn-warning:hover {
    background: #FAF8F5;
    border-color: #FAF8F5;
    transform: translateY(-2px);
}

.back-to-landing {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--white-dim);
    letter-spacing: 0.04em;
    transition: color 0.25s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-to-landing:hover {
    color: var(--accent);
}

.q-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(250, 248, 245, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.q-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.q-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 720px;
    margin: 0 auto;
}

.q-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.q-logo {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    font-style: normal;
    color: #161719;
    letter-spacing: -0.035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.q-progress-wrap {
    flex: 1;
    height: 4px;
    background: #E8E6E1;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.q-progress-bar {
    height: 100%;
    background: #161719;
    width: 0%;
    transition: width 0.4s ease;
}

.q-progress-text {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    color: #74777E;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.q-body {
    flex: 1;
    overflow-y: auto;
    padding: 32px 24px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.q-body::-webkit-scrollbar {
    display: none;
}

.q-body.q-fade-out {
    animation: qFadeOut 0.2s ease forwards;
}

.q-body.q-fade-in {
    animation: qFadeIn 0.3s ease forwards;
}

@keyframes qFadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-8px); }
}

@keyframes qFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.q-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.q-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 520px;
    padding-top: 40px;
}

.q-welcome-icon {
    color: var(--accent);
    margin-bottom: 24px;
    opacity: 0.9;
}

.q-complete-icon {
    color: #22c55e;
}

.q-welcome-title {
    font-family: var(--font-display);
    font-size: 1.9rem;
    letter-spacing: 0;
    color: var(--beige-light);
    margin-bottom: 16px;
    font-style: italic;
}

.q-welcome-text {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--white-dim);
    line-height: 1.7;
    margin-bottom: 32px;
}

.q-welcome-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 40px;
    width: 100%;
}

.q-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--white);
    letter-spacing: 0.5px;
}

.q-feature-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.q-btn {
    font-family: var(--font-display);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    padding: 12px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.q-btn:hover {
    border-color: var(--border-focus);
    background: rgba(22, 23, 25, 0.04);
}

.q-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.q-btn-start,
.q-btn-next {
    background: #161719;
    color: #FFFFFF;
    border: 1px solid #161719;
    font-weight: 700;
    border-radius: var(--radius-full);
    box-shadow: 0 2px 10px rgba(22, 23, 25, 0.15);
}

.q-btn-start:hover,
.q-btn-next:hover:not(:disabled) {
    background: #2D3036;
    border-color: #2D3036;
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(22, 23, 25, 0.22);
}

.q-btn-next:disabled {
    background: #E8E6E1;
    border-color: #E8E6E1;
    color: #9A9FA8;
    box-shadow: none;
    cursor: not-allowed;
}

.q-btn-skip {
    margin-left: auto;
    margin-right: 10px;
    background: transparent;
    border-color: var(--border);
    color: var(--white-dim);
    letter-spacing: 1px;
}

.q-btn-skip:hover {
    color: var(--accent);
    border-color: var(--border-focus);
}

.q-btn-back {
    background: transparent;
    border-color: var(--border);
    color: var(--white-dim);
}

.q-btn-back:hover {
    color: var(--accent);
    border-color: var(--border-focus);
}

.q-question-card {
    width: 100%;
    max-width: 600px;
}

.q-category {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #74777E;
    margin-bottom: 16px;
}

.q-category-icon {
    font-size: 0.85rem;
}

.q-question-text {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 2.8vw, 2.3rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.035em;
    color: #161719;
    margin-bottom: 8px;
}

.q-question-subtext {
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 400;
    color: #74777E;
    line-height: 1.5;
    margin-bottom: 8px;
}

.q-multi-hint {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.q-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 20px;
}

.q-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #161719;
    font-family: var(--font-body);
    font-size: 0.85rem;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    box-shadow: 0 1px 3px rgba(22, 23, 25, 0.02);
}

.q-option:hover {
    background: #FAF8F5;
    border-color: #161719;
}

.q-option.selected {
    background: #F5F3EF;
    border-color: #161719;
    color: #161719;
    font-weight: 600;
}

.q-option-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.q-option.selected .q-option-indicator {
    border-color: #161719;
    background: #161719;
    color: #FFFFFF;
}

.q-option-label {
    flex: 1;
}

.q-fields {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin-top: 24px;
}

.q-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.q-field-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.q-field-label {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: var(--beige-light);
}

.q-field-optional {
    font-family: var(--font-body);
    font-size: 0.6rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--white-dim);
    opacity: 0.7;
    flex-shrink: 0;
}

.q-field-hint {
    font-family: var(--font-body);
    font-size: 0.68rem;
    line-height: 1.45;
    color: var(--white-dim);
    margin-top: -2px;
}

.q-field-select {
    width: 100%;
    padding: 12px 14px;
    background-color: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #161719;
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23161719' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
    box-shadow: 0 1px 3px rgba(22, 23, 25, 0.02);
}

.q-field-select:hover {
    border-color: var(--border-hover);
}

.q-field-select:focus {
    outline: none;
    border-color: var(--accent);
}

.q-field-select option {
    background: #FFFFFF;
    color: #161719;
}

.q-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.q-chip {
    padding: 9px 16px;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: #161719;
    font-family: var(--font-body);
    font-size: 0.8rem;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    line-height: 1.3;
    box-shadow: 0 1px 3px rgba(22, 23, 25, 0.02);
}

.q-chip:hover {
    background: #FAF8F5;
    border-color: #161719;
}

.q-chip.selected {
    background: #161719;
    border-color: #161719;
    color: #FAF8F5;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(22, 23, 25, 0.15);
}

.q-risk-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 32px;
}

.q-risk-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.q-risk-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: #74777E;
    text-transform: uppercase;
}

.q-risk-badge {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}

.q-risk-low {
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.1);
}

.q-risk-moderate {
    color: #eab308;
    border-color: rgba(234, 179, 8, 0.3);
    background: rgba(234, 179, 8, 0.1);
}

.q-risk-high {
    color: #f97316;
    border-color: rgba(249, 115, 22, 0.3);
    background: rgba(249, 115, 22, 0.1);
}

.q-risk-very_high {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
}

.risk-assessment-section {
    margin-top: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.risk-assessment-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    letter-spacing: 3px;
    color: var(--beige-light);
    margin-bottom: 12px;
}

.risk-assessment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.risk-metric {
    padding: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.risk-metric-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: #74777E;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.risk-metric-value {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.risk-metric-value.low { color: #22c55e; }
.risk-metric-value.moderate { color: #eab308; }
.risk-metric-value.high { color: #f97316; }
.risk-metric-value.very_high { color: #ef4444; }

.risk-summary-text {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--white);
    line-height: 1.7;
    padding: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 3px solid var(--orange);
}

.risk-factors-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
}

.risk-factors-list li {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--white-dim);
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.risk-factors-list li::before {
    content: "▸";
    color: var(--orange);
    font-size: 0.7rem;
}

@media (max-width: 640px) {
    .q-header {
        padding: 12px 16px;
        gap: 10px;
    }

    .q-logo {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    font-style: normal;
    color: #161719;
    letter-spacing: -0.035em;
    text-transform: uppercase;
    white-space: nowrap;
}

    .q-body {
        padding: 20px 16px;
    }

    .q-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .q-btn-back { order: 1; }
    .q-btn-next { order: 2; }

    .q-btn-skip {
        order: 3;
        flex-basis: 100%;
        margin: 0;
        justify-content: center;
        font-size: 0.72rem;
        letter-spacing: 1px;
        padding: 9px 12px;
        white-space: nowrap;
    }

    .q-welcome-title {
        font-size: 1.4rem;
        letter-spacing: 3px;
    }

    .q-question-text {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 2.8vw, 2.3rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.035em;
    color: #161719;
    margin-bottom: 8px;
}

    .q-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #161719;
    font-family: var(--font-body);
    font-size: 0.85rem;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    box-shadow: 0 1px 3px rgba(22, 23, 25, 0.02);
}

    .q-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
        letter-spacing: 2px;
    }

    .risk-assessment-grid {
        grid-template-columns: 1fr;
    }
}
/* ===== Upload / Record mode slider ===== */
.mode-switch {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: #EAE7E0;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px;
    margin: 0 auto 1.5rem;
    max-width: 360px;
}

.mode-thumb {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: #161719;
    border-radius: 999px;
    transition: transform var(--transition-fast, 0.2s) ease;
    z-index: 0;
    box-shadow: 0 2px 8px rgba(22, 23, 25, 0.15);
}

.mode-switch.record-active .mode-thumb {
    transform: translateX(100%);
}

.mode-option {
    position: relative;
    z-index: 1;
    border: none;
    background: transparent;
    color: #74777E;
    font-family: var(--font-display);
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    transition: color var(--transition-fast, 0.2s) ease;
    text-transform: none;
}

.mode-option.active {
    color: #FFFFFF;
    font-weight: 700;
}

.mode-panel {
    display: none;
}

.mode-panel.active {
    display: block;
}

/* ===== Mic picker ===== */
.mic-select-wrap {
    margin-bottom: 1.25rem;
    text-align: left;
}

.mic-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: #74777E;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.mic-select-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    min-width: 0;
}

.mic-select {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    text-overflow: ellipsis;
    background: #FFFFFF;
    border: 1px solid var(--border);
    color: #161719;
    font-family: var(--font-body);
    font-size: 0.85rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
}

.mic-select:focus {
    outline: none;
    border-color: var(--border-focus);
}

.mic-refresh {
    flex-shrink: 0;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Bluetooth stethoscope ===== */
.steth-connect-btn {
    margin-top: 0.6rem;
    width: 100%;
    justify-content: center;
}

.steth-connect-btn.is-linked {
    border-color: var(--accent);
    color: var(--accent);
}

.steth-status {
    margin-top: 0.55rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: #74777E;
}

.steth-status.is-linked {
    color: var(--accent);
}

.steth-status.is-warn {
    color: #B45309;
}

.steth-modal[hidden] {
    display: none;
}

.steth-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.steth-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 19, 21, 0.55);
    backdrop-filter: blur(3px);
}

.steth-modal__card {
    position: relative;
    width: min(460px, 100%);
    max-height: calc(100vh - 2.5rem);
    overflow-y: auto;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.6rem 1.5rem 1.35rem;
    box-shadow: 0 24px 60px rgba(18, 19, 21, 0.22);
    text-align: left;
}

.steth-modal__close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #74777E;
    cursor: pointer;
}

.steth-modal__close:hover {
    background: var(--bg-elevated);
}

.steth-modal__eyebrow {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.steth-modal__title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin: 0.35rem 0 0.6rem;
    color: #161719;
}

.steth-modal__text {
    font-size: 0.85rem;
    line-height: 1.55;
    color: #4A4D53;
    margin-bottom: 1rem;
}

.steth-steps {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: grid;
    gap: 0.45rem;
}

.steth-step {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    color: #9A9DA3;
}

.steth-step__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    flex-shrink: 0;
}

.steth-step.is-active {
    color: var(--accent);
}

.steth-step.is-active .steth-step__dot {
    background: var(--accent);
    animation: steth-pulse 1.1s ease-in-out infinite;
}

.steth-step.is-done {
    color: #4A4D53;
}

.steth-step.is-done .steth-step__dot {
    background: #4A4D53;
}

@keyframes steth-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.steth-device {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 1rem;
}

.steth-device__name {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: #161719;
}

.steth-device__meta {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: #74777E;
    margin-top: 0.2rem;
    line-height: 1.5;
}

.steth-modal__error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 8px;
    padding: 0.7rem 0.85rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #B91C1C;
    margin-bottom: 1rem;
}

.steth-modal__actions {
    display: grid;
    gap: 0.5rem;
}

.steth-modal__actions .btn {
    width: 100%;
    justify-content: center;
}

/* .btn sets display:flex, which otherwise beats the hidden attribute. */
.steth-modal__actions .btn[hidden] {
    display: none;
}

.steth-modal__note {
    margin-top: 0.9rem;
    font-size: 0.72rem;
    line-height: 1.5;
    color: #9A9DA3;
}

.record-info {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.record-info-title {
    font-family: var(--font-display);
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: var(--accent);
    margin: 0 0 0.4rem;
}

.record-info-text {
    font-family: var(--font-body);
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--white-dim);
    margin: 0;
}

/* ===== Full-screen record overlay ===== */
.record-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #0a0a0a;
}

.record-overlay[hidden] {
    display: none;
}

.rec-body {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
}

#rec-webcam {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scaleX(-1);
}

#rec-overlay-canvas {
    position: absolute;
    pointer-events: none;
}

.rec-hud-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(to bottom, rgba(10, 15, 18, 0.85) 0%, transparent 100%);
    z-index: 10;
}

.rec-hud-left {
    display: flex;
    gap: 8px;
}

.rec-stat,
.rec-badge {
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 10px;
    background: rgba(13, 19, 24, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    color: var(--beige);
}

.rec-badge.ready {
    border-color: var(--border-focus);
    color: var(--accent);
}

.rec-close {
    background: rgba(13, 19, 24, 0.7);
    border: 1px solid var(--border);
    color: var(--beige);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
}

.rec-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.rec-progress {
    position: absolute;
    top: 58px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    z-index: 10;
    pointer-events: none;
}

.rec-dot {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: rgba(13, 19, 24, 0.7);
    backdrop-filter: blur(8px);
    transition: all 0.25s ease;
}

.rec-dot em {
    font-style: normal;
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--white-dim);
}

.rec-dot.active {
    border-color: var(--dot-color);
    box-shadow: 0 0 12px -2px var(--dot-color);
    transform: scale(1.12);
}

.rec-dot.active em {
    color: var(--dot-color);
}

.rec-dot.done {
    background: var(--dot-color);
    border-color: var(--dot-color);
}

.rec-dot.done em {
    color: #FFFFFF;
}

.rec-hud-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0 16px 24px;
    background: linear-gradient(to top, rgba(10, 15, 18, 0.92) 0%, transparent 100%);
    z-index: 10;
}

.rec-target {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.rec-target-code {
    font-family: var(--font-display);
    font-size: 1.8rem;
    letter-spacing: 3px;
    font-weight: 700;
}

.rec-target-name {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--beige-light);
    letter-spacing: 1px;
}

.rec-target-step {
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: var(--white-dim);
    letter-spacing: 1px;
}

.rec-instruction {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--beige-light);
    text-align: center;
    max-width: 460px;
}

.rec-timer {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.rec-controls {
    display: flex;
    gap: 10px;
}

.cam-btn {
    font-family: var(--font-display);
    font-size: 0.95rem;
    letter-spacing: 3px;
    padding: 10px 26px;
    border: 1px solid var(--border);
    background: rgba(13, 19, 24, 0.7);
    backdrop-filter: blur(8px);
    color: var(--beige);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.cam-btn.primary {
    background: var(--accent);
    color: #FFFFFF;
    border-color: var(--accent);
    font-weight: 700;
}

.cam-btn.primary:hover:not(:disabled) {
    background: var(--beige-light);
    border-color: var(--beige-light);
}

.cam-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.cam-btn.recording {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
    animation: recPulse 1s ease-in-out infinite;
}

@keyframes recPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.rec-loading {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 18, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 20;
}

.rec-spinner {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

#rec-loading-text {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--accent);
    font-style: normal; font-weight: 600; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Multi-point verdict ===== */
.verdict-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.verdict-banner.abnormal {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.08);
}

.verdict-banner.normal {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.08);
}

.verdict-status,
.verdict-risk {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.verdict-risk {
    margin-left: auto;
    text-align: right;
}

.verdict-status-label,
.verdict-risk-label {
    font-family: var(--font-body);
    font-size: 0.68rem;
    letter-spacing: 1.5px;
    color: var(--white-dim);
}

.verdict-status-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.verdict-status-value.abnormal { color: #ef4444; }
.verdict-status-value.normal { color: #22c55e; }

.verdict-risk-value {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.verdict-risk-value.low { color: #22c55e; }
.verdict-risk-value.moderate { color: #eab308; }
.verdict-risk-value.high { color: #f97316; }
.verdict-risk-value.very_high { color: #ef4444; }

.verdict-summary {
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--beige-light);
    margin: 0 0 1rem;
}

.verdict-findings {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.verdict-findings li {
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--white-dim);
    padding-left: 1.2rem;
    position: relative;
}

.verdict-findings li::before {
    content: "›";
    position: absolute;
    left: 0;
    color: var(--accent);
}

.points-detail {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-bottom: 1rem;
}

.points-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: transparent;
    border: none;
    color: var(--beige-light);
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    cursor: pointer;
    padding: 0.4rem 0;
}

.points-toggle-chevron {
    transition: transform 0.2s ease;
}

.points-toggle[aria-expanded="true"] .points-toggle-chevron {
    transform: rotate(90deg);
}

.points-detail-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1rem;
}

.points-detail-title {
    margin-bottom: 0.25rem;
}

.point-accordion {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.point-accordion.flagged {
    border-color: rgba(239, 68, 68, 0.5);
}

.point-acc-head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.85rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    color: var(--beige-light);
}

.point-acc-head .point-card-code {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    flex-shrink: 0;
}

.point-acc-head .point-card-name {
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: var(--white-dim);
    letter-spacing: 1px;
}

.point-acc-badge {
    margin-left: auto;
    font-family: var(--font-body);
    font-size: 0.68rem;
    letter-spacing: 1px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.point-acc-badge.ok { color: #22c55e; border-color: rgba(34, 197, 94, 0.4); }
.point-acc-badge.flag { color: #ef4444; border-color: rgba(239, 68, 68, 0.5); }
.point-acc-badge.warn { color: #eab308; border-color: rgba(234, 179, 8, 0.45); }

.point-acc-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: var(--white-dim);
}

.point-acc-head[aria-expanded="true"] .point-acc-chevron {
    transform: rotate(90deg);
}

.point-acc-body {
    padding: 0 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.point-audio {
    width: 100%;
    height: 40px;
}

.point-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.point-viz {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.point-viz-item h4 {
    font-family: var(--font-body);
    font-size: 0.65rem;
    letter-spacing: 1.5px;
    color: var(--white-dim);
    margin: 0 0 0.4rem;
}

.point-viz-item img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.point-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1rem;
}

.point-card.flagged {
    border-color: rgba(239, 68, 68, 0.5);
}

.point-card-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.7rem;
}

.point-card-code {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.point-card-name {
    font-family: var(--font-body);
    font-size: 0.72rem;
    color: var(--white-dim);
    letter-spacing: 1px;
}

.point-metric {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-body);
    font-size: 0.78rem;
    padding: 0.2rem 0;
    color: var(--white-dim);
}

.point-metric span:last-child {
    color: var(--beige-light);
    font-weight: 600;
}

.point-metric .flag { color: #ef4444; }
.point-metric .ok { color: #22c55e; }
/* ===== Capsule navbar ===== */
.nav-capsule {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 1px;
    color: var(--beige-light);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.brand-capsule {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-style: normal;
    font-weight: 800;
    color: #161719;
    letter-spacing: -0.035em;
    text-transform: uppercase;
}

.nav-capsule.user-greeting {
    color: var(--white-dim);
    font-family: var(--font-body);
}

.sign-out {
    cursor: pointer;
    transition: all var(--transition-fast, 0.2s) ease;
}

.sign-out:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.mic-request-btn {
    margin-top: 0.6rem;
    width: 100%;
    justify-content: center;
}

.mic-warning {
    margin-top: 0.7rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-left: 3px solid #ef4444;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.08);
    color: #fca5a5;
    font-family: var(--font-body);
    font-size: 0.76rem;
    line-height: 1.5;
    text-align: left;
}


/* ── JivaScope Typography Utility Classes ── */
.font-sans { font-family: var(--font-sans) !important; }
.font-display { font-family: var(--font-display) !important; }
.font-mono { font-family: var(--font-mono) !important; }
.font-serif { font-family: var(--font-serif) !important; }
.font-menu-custom { font-family: var(--font-menu-custom) !important; }
.font-patua { font-family: var(--font-patua) !important; }
.font-moret { font-family: var(--font-moret) !important; }

/* ── JivaScope Bento Grid Questionnaire ── */
.bento-container {
    width: 100%;
    max-width: 1140px;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    background: 
        radial-gradient(650px circle at 0% 0%, rgba(32, 128, 119, 0.08) 0%, transparent 60%),
        radial-gradient(700px circle at 100% 100%, rgba(220, 205, 185, 0.22) 0%, transparent 60%),
        radial-gradient(500px circle at 50% 30%, rgba(255, 255, 255, 0.8) 0%, transparent 80%),
        #FAF8F5;
    position: relative;
    overflow: hidden;
}

.bento-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem 1.4rem;
    background: rgba(250, 248, 245, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

/* ── 8-Segment Liquid Clinical Progress Bar ── */
.bento-progress-track {
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    background: rgba(226, 226, 217, 0.45);
    padding: 0 4px;
    z-index: 12;
}

.bento-progress-segment {
    height: 100%;
    background: rgba(22, 23, 25, 0.08);
    border-radius: 2px;
    transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.bento-progress-segment.filled {
    background: linear-gradient(90deg, #208077 0%, #2F8F86 100%);
    box-shadow: 0 0 8px rgba(32, 128, 119, 0.45);
}

.bento-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bento-brand {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    color: #161719;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}

.bento-header-divider {
    color: #C8C5BD;
    font-weight: 300;
}

.bento-header-badge {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #74777E;
}

.bento-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.bento-progress-pill {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 500;
    color: #208077;
    background: rgba(32, 128, 119, 0.08);
    padding: 5px 14px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(32, 128, 119, 0.15);
    letter-spacing: 0.04em;
}

.bento-close-btn {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    color: #74777E;
    cursor: pointer;
    padding: 2px 10px;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.bento-close-btn:hover {
    color: #161719;
    background: #EAE7E0;
}

.bento-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 2rem 2rem 3rem;
    scrollbar-width: thin;
    scrollbar-color: #D5D2CA transparent;
}

.bento-body::-webkit-scrollbar {
    width: 6px;
}

.bento-body::-webkit-scrollbar-thumb {
    background: #D5D2CA;
    border-radius: 4px;
}

/* ── Hero Title & Intro ── */

@keyframes bentoCascadeIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.bento-hero-intro {
    text-align: center;
    max-width: 720px;
    margin: 0 auto 2.25rem;
    animation: bentoCascadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.bento-hero-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 3.2vw, 2.75rem);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: #161719;
    margin-bottom: 0.6rem;
}

.bento-hero-title em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    color: #208077;
    padding-left: 0.05em;
}

.bento-hero-subtitle {
    font-family: var(--font-body);
    font-size: 0.96rem;
    color: #74777E;
    line-height: 1.6;
}

/* ── Bento Grid ── */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.35rem;
    width: 100%;
}

/* Translucent Frosted Bento Cards */
.bento-card {
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(20px) saturate(170%);
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    padding: 1.6rem 1.75rem;
    box-shadow: 
        0 10px 30px -4px rgba(22, 23, 25, 0.04),
        0 2px 8px rgba(22, 23, 25, 0.02),
        inset 0 1.5px 1px 0 rgba(255, 255, 255, 0.95);
    transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base), background-color var(--transition-base);
    display: flex;
    flex-direction: column;
    position: relative;
}

.bento-card:hover {
    border-color: rgba(22, 23, 25, 0.22);
    box-shadow: 
        0 16px 40px -6px rgba(22, 23, 25, 0.07),
        0 4px 12px rgba(22, 23, 25, 0.03),
        inset 0 1.5px 1.5px 0 #FFFFFF;
    transform: translateY(-2px);
}

.bento-col-12 { grid-column: span 12; }
.bento-col-7  { grid-column: span 7; }
.bento-col-6  { grid-column: span 6; }
.bento-col-5  { grid-column: span 5; }

/* Staggered entrance */
.bento-card[data-bento="demographics"] { animation: bentoCascadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.04s both; }
.bento-card[data-bento="lifestyle"]    { animation: bentoCascadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both; }
.bento-card[data-bento="conditions"]   { animation: bentoCascadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both; }
.bento-card[data-bento="cardio"]       { animation: bentoCascadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.16s both; }
.bento-card[data-bento="respiratory"]  { animation: bentoCascadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.20s both; }
.bento-card[data-bento="metabolic"]    { animation: bentoCascadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.24s both; }
.bento-card[data-bento="family"]       { animation: bentoCascadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.28s both; }

.bento-feature-card {
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(32, 128, 119, 0.22);
    box-shadow: 
        0 14px 38px -6px rgba(22, 23, 25, 0.05),
        inset 0 1.5px 1.5px 0 #FFFFFF,
        inset 0 -1px 0 0 rgba(32, 128, 119, 0.08);
}

/* Card Completed Status */
.bento-card.is-completed {
    border-color: rgba(32, 128, 119, 0.38);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 
        0 12px 32px -4px rgba(32, 128, 119, 0.07),
        inset 0 1.5px 1.5px 0 #FFFFFF;
}

.bento-card.is-completed .bento-card-num {
    color: #208077;
    font-weight: 700;
}

.bento-card.is-completed .bento-badge {
    background: rgba(32, 128, 119, 0.1);
    color: #208077;
}

.bento-feature-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.bento-hint {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: #8C9097;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bento-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.bento-badge {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #74777E;
    background: #F4F2EC;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.bento-badge-teal {
    color: #208077;
    background: rgba(32, 128, 119, 0.08);
}

.bento-card-num {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 600;
    color: #A0A3A9;
}

.bento-card-title {
    font-family: var(--font-serif);
    font-size: 1.32rem;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: #161719;
    margin-bottom: 0.35rem;
}

.bento-card-sub {
    font-family: var(--font-body);
    font-size: 0.83rem;
    color: #74777E;
    line-height: 1.45;
    margin-bottom: 1.25rem;
}

.bento-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.bento-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #74777E;
}

.bento-select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background: #FAF8F5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2374777E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #161719;
    font-family: var(--font-body);
    font-size: 16px; /* 16px minimum prevents iOS Safari auto-zoom */
    min-height: 46px;
    outline: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.bento-select:focus {
    border-color: #161719;
    background: #FFFFFF;
}

/* Bento Chips */
.bento-chips-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
}

.bento-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.bento-chips-wide {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.6rem;
}

.bento-chip {
    padding: 0.65rem 1rem;
    background: rgba(255, 255, 255, 0.68);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 226, 217, 0.9);
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 0.84rem;
    font-weight: 500;
    color: #2F3136;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 
        0 2px 6px rgba(22, 23, 25, 0.02),
        inset 0 1px 1px rgba(255, 255, 255, 0.9);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.bento-chip:hover {
    border-color: #161719;
    background: #FFFFFF;
    color: #161719;
    box-shadow: 0 4px 12px rgba(22, 23, 25, 0.06);
    transform: translateY(-1px);
}

.bento-chip:active {
    transform: scale(0.95) !important;
    transition: transform 0.06s ease;
}

.bento-chip.selected {
    background: #161719;
    border-color: #161719;
    color: #FFFFFF;
    font-weight: 600;
    box-shadow: 
        0 4px 14px rgba(22, 23, 25, 0.24),
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.25);
}

.bento-chip-none.selected {
    background: #208077;
    border-color: #208077;
    color: #FFFFFF;
    box-shadow: 
        0 4px 14px rgba(32, 128, 119, 0.3),
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.3);
}

/* Bento Sticky Footer */
.bento-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 2rem;
    background: rgba(250, 248, 245, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 10;
}

/* ── Liquid Glass Action Buttons ── */
.bento-btn-skip,
.btn.bento-btn-skip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 2rem;
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 600;
    color: #161719;
    letter-spacing: -0.01em;
    border-radius: 9999px;
    border: 1px solid rgba(22, 23, 25, 0.22);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(246, 244, 239, 0.62) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 
        0 8px 20px -2px rgba(22, 23, 25, 0.08),
        0 3px 8px rgba(22, 23, 25, 0.04),
        inset 0 1.5px 2px 0 #FFFFFF,
        inset 0 -2.5px 5px 0 rgba(22, 23, 25, 0.12),
        inset 0 -1px 2px 0 rgba(22, 23, 25, 0.18);
    cursor: pointer;
    overflow: hidden;
    outline: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Luminous crystal rim */
.bento-btn-skip::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    padding: 1.2px;
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(255, 255, 255, 0.35) 35%,
        rgba(22, 23, 25, 0.08) 65%,
        rgba(22, 23, 25, 0.25) 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 1;
}

/* Internal optical sheen reflection */
.bento-btn-skip::after {
    content: "";
    position: absolute;
    top: 1.5px;
    left: 8%;
    right: 8%;
    height: 46%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.05) 80%, transparent 100%);
    border-radius: 9999px 9999px 60px 60px;
    pointer-events: none;
    filter: blur(0.5px);
    z-index: 1;
}

.bento-btn-skip span {
    position: relative;
    z-index: 2;
}

.bento-btn-skip:hover,
.btn.bento-btn-skip:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 246, 242, 0.75) 100%);
    border-color: rgba(22, 23, 25, 0.35);
    color: #000000;
    box-shadow: 
        0 12px 28px -2px rgba(22, 23, 25, 0.12),
        0 4px 10px rgba(22, 23, 25, 0.06),
        inset 0 2px 2.5px 0 #FFFFFF,
        inset 0 -3px 6px 0 rgba(22, 23, 25, 0.14),
        inset 0 -1px 2px 0 rgba(22, 23, 25, 0.22);
    transform: translateY(-2px);
}

.bento-btn-skip:active,
.btn.bento-btn-skip:active {
    transform: translateY(0) scale(0.985);
    box-shadow: 
        0 4px 12px rgba(22, 23, 25, 0.06),
        inset 0 1px 1px 0 #FFFFFF,
        inset 0 -1.5px 3px 0 rgba(22, 23, 25, 0.18);
}

.bento-btn-submit {
    position: relative;
    width: auto !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0.85rem 2.2rem;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: #FFFFFF;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
    border-radius: 9999px;
    cursor: pointer;
    overflow: hidden;
    outline: none;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: radial-gradient(130% 130% at 50% -20%, rgba(255, 255, 255, 0.22) 0%, rgba(35, 38, 44, 0.72) 40%, rgba(12, 14, 18, 0.9) 100%);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    box-shadow: 
        0 12px 32px -4px rgba(0, 0, 0, 0.38),
        0 4px 12px rgba(0, 0, 0, 0.22),
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.45),
        inset 0 0 18px rgba(255, 255, 255, 0.06),
        inset -1px -1.5px 2px 0 rgba(255, 255, 255, 0.85);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Luminous refraction rim */
.bento-btn-submit::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    padding: 1.2px;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.65) 0%,
        rgba(255, 255, 255, 0.15) 30%,
        rgba(255, 255, 255, 0.05) 55%,
        rgba(255, 255, 255, 0.95) 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Internal optical lens reflection sheen */
.bento-btn-submit::after {
    content: "";
    position: absolute;
    top: 1.5px;
    left: 8%;
    right: 8%;
    height: 48%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.26) 0%, rgba(255, 255, 255, 0.03) 75%, transparent 100%);
    border-radius: 9999px 9999px 60px 60px;
    pointer-events: none;
    filter: blur(0.5px);
}

.bento-btn-submit span,
.bento-btn-submit svg {
    position: relative;
    z-index: 2;
}

.bento-btn-submit svg {
    transition: transform 0.2s ease;
}

.bento-btn-submit:hover {
    background: radial-gradient(130% 130% at 50% -20%, rgba(255, 255, 255, 0.28) 0%, rgba(45, 48, 56, 0.78) 40%, rgba(16, 18, 22, 0.94) 100%);
    box-shadow: 
        0 16px 40px -4px rgba(0, 0, 0, 0.44),
        0 6px 16px rgba(0, 0, 0, 0.28),
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 0 22px rgba(255, 255, 255, 0.09),
        inset -1px -1.5px 2.5px 0 #FFFFFF;
    transform: translateY(-2px);
}

.bento-btn-submit:hover svg {
    transform: translateX(3px);
}

.bento-btn-submit:active {
    transform: translateY(0) scale(0.985);
    box-shadow: 
        0 6px 18px rgba(0, 0, 0, 0.3),
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.4),
        inset -1px -1px 2px 0 rgba(255, 255, 255, 0.8);
}

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE & TABLET OPTIMIZATIONS (iOS SAFARI, ANDROID CHROME & WEBVIEWS)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Prevent iOS Auto-Zoom on form interaction ── */
@media (max-width: 768px) {
    input,
    select,
    textarea,
    .bento-select {
        font-size: 16px !important;
    }
}

/* ── Tablet & Medium Displays (<= 960px) ── */
@media (max-width: 960px) {
    .bento-col-12,
    .bento-col-7,
    .bento-col-6,
    .bento-col-5 {
        grid-column: span 12;
    }

    .bento-header {
        padding: calc(1rem + env(safe-area-inset-top, 0px)) 1.5rem 1rem;
    }

    .bento-body {
        padding: 1.5rem 1.5rem 2.5rem;
    }

    .bento-footer {
        padding: 1rem 1.5rem calc(1rem + env(safe-area-inset-bottom, 0px));
    }
}

/* ── Smartphones (Android & iPhones <= 640px) ── */
@media (max-width: 640px) {
    /* ── Viewport & Safe-Area Setup ── */
    .q-overlay {
        height: 100vh;
        height: 100dvh;
        padding: 0;
    }

    .bento-container {
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        overflow: hidden;
    }

    /* ── Header ── */
    .bento-header {
        padding: calc(0.75rem + env(safe-area-inset-top, 0px)) 1rem 0.75rem;
        gap: 8px;
    }

    .bento-brand {
        font-size: 1.05rem;
        letter-spacing: -0.025em;
    }

    .bento-header-divider,
    .bento-header-badge {
        display: none;
    }

    .bento-header-right {
        gap: 8px;
    }

    .bento-progress-pill {
        font-size: 0.68rem;
        padding: 4px 9px;
        letter-spacing: 0.02em;
        white-space: nowrap;
    }

    .bento-close-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1.6rem;
        padding: 0;
        border-radius: 9999px;
        background: #F0ECE4;
        color: #161719;
    }

    /* ── Body & Scrolling (Spacious Mobile Layout) ── */
    .bento-body {
        padding: 1.35rem 1.1rem calc(2rem + env(safe-area-inset-bottom, 0px));
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    .bento-hero-intro {
        text-align: left;
        margin-bottom: 1.5rem;
        padding: 0 0.15rem;
    }

    .bento-hero-title {
        font-size: 1.55rem;
        line-height: 1.22;
        letter-spacing: -0.025em;
        margin-bottom: 0.45rem;
    }

    .bento-hero-subtitle {
        font-size: 0.88rem;
        line-height: 1.55;
        color: #74777E;
    }

    /* ── Bento Grid & Cards (Airy Spacing) ── */
    .bento-grid {
        display: flex;
        flex-direction: column;
        gap: 1.15rem; /* Generous breathing room between cards */
    }

    .bento-card {
        padding: 1.35rem 1.15rem; /* Spacious interior padding */
        border-radius: 20px;
        box-shadow: 0 2px 14px rgba(22, 23, 25, 0.03);
    }

    .bento-card:hover {
        transform: none; /* Disable hover translation on touch */
    }

    .bento-card-top {
        margin-bottom: 0.5rem;
    }

    .bento-badge {
        font-size: 0.64rem;
        padding: 3px 8px;
    }

    .bento-card-num {
        font-size: 0.7rem;
    }

    .bento-card-title {
        font-size: 1.15rem;
        line-height: 1.25;
        margin-bottom: 0.25rem;
    }

    .bento-card-sub {
        font-size: 0.8rem;
        line-height: 1.4;
        margin-bottom: 0.85rem;
    }

    .bento-feature-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
        margin-bottom: 0.85rem;
    }

    .bento-hint {
        font-size: 0.65rem;
    }

    /* ── Touch-Friendly Chips ── */
    .bento-chip {
        min-height: 44px; /* iOS Human Interface & Android touch target */
        padding: 0.6rem 0.85rem;
        font-size: 0.82rem;
        white-space: normal; /* Multi-line wrap so symptom names never truncate */
        word-break: break-word;
        text-align: left;
        line-height: 1.25;
        display: inline-flex;
        align-items: center;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .bento-chip:hover {
        transform: none;
    }

    .bento-chip:active {
        transform: scale(0.97);
    }

    .bento-chips-wrap {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Row chips (Sex, etc.) */
    .bento-chips-row {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.45rem;
    }

    .bento-chips-row .bento-chip {
        justify-content: center;
        text-align: center;
        padding: 0.55rem 0.35rem;
        font-size: 0.78rem;
    }

    /* 4-option row in Lifestyle & Habits (Non-smoker, Occasional, Regular, Heavy) */
    .bento-card[data-bento="lifestyle"] .bento-chips-row {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Diagnosed Conditions (Wide Feature Card) */
    .bento-chips-wide {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .bento-chips-wide .bento-chip {
        width: 100%;
        padding: 0.75rem 1rem;
        justify-content: flex-start;
        text-align: left;
        font-size: 0.85rem;
        border-radius: 14px;
    }

    /* ── Sticky Liquid Glass Mobile Footer ── */
    .bento-footer {
        padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 12px));
        flex-direction: column-reverse; /* Primary Proceed CTA on top, Skip below */
        gap: 0.65rem;
        align-items: stretch;
        background: rgba(250, 248, 245, 0.98);
    }

    .bento-footer-actions {
        width: 100%;
    }

    .bento-btn-submit,
    .btn.bento-btn-submit {
        width: 100% !important;
        min-height: 50px;
        padding: 0.85rem 1.25rem;
        font-size: 0.92rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .bento-btn-skip,
    .btn.bento-btn-skip {
        width: 100% !important;
        min-height: 44px;
        padding: 0.75rem 1.25rem;
        font-size: 0.86rem;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .bento-btn-submit:hover,
    .bento-btn-skip:hover {
        transform: none; /* Avoid sticky hover on mobile */
    }

    .bento-btn-submit:active,
    .bento-btn-skip:active {
        transform: scale(0.98);
    }
}

/* ── Small Smartphones (iPhone SE, Galaxy A-series <= 380px) ── */
@media (max-width: 380px) {
    .bento-header {
        padding: calc(0.65rem + env(safe-area-inset-top, 0px)) 0.75rem 0.65rem;
    }

    .bento-brand {
        font-size: 0.98rem;
    }

    .bento-progress-pill {
        font-size: 0.64rem;
        padding: 3px 7px;
    }

    .bento-body {
        padding: 1rem 0.75rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    }

    .bento-hero-title {
        font-size: 1.32rem;
    }

    .bento-card {
        padding: 1rem 0.8rem;
        border-radius: 16px;
    }

    .bento-card-title {
        font-size: 1.08rem;
    }

    .bento-chips-row .bento-chip {
        font-size: 0.74rem;
        padding: 0.5rem 0.25rem;
    }

    .bento-btn-submit,
    .btn.bento-btn-submit {
        font-size: 0.88rem;
        padding: 0.8rem 1rem;
    }

    .bento-btn-skip,
    .btn.bento-btn-skip {
        font-size: 0.82rem;
        padding: 0.7rem 1rem;
    }
}

/* ════════════════════════════════════════════════════════════════════
   jivascope.com theme bridge — contour canvas, display statements,
   hairline bento cards. Overrides the legacy ivory/serif rules above.
   ════════════════════════════════════════════════════════════════════ */
:root {
    --jv-canvas: #FCFCFA;
    --jv-card: rgba(252, 252, 250, 0.84);
    --jv-card-solid: #fcfcfa;
    --jv-border: #e2e2d9;
    --jv-border-hover: #c4c4b8;
    --jv-ink: #161719;
    --jv-muted: #74777e;
    --jv-dim: rgba(22, 23, 25, 0.32);
    --jv-faint: #b4b5ad;
    --jv-accent: #2f8f86;
    --jv-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html, body { background-color: var(--jv-canvas); }
body::after { display: none; }
::selection { background: var(--jv-ink); color: var(--jv-canvas); }

.contour-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background: var(--jv-canvas);
    opacity: 0;
    transition: opacity 1.2s ease;
}
.contour-bg[data-ready="true"] { opacity: 1; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    letter-spacing: -0.035em;
}

/* Statement headings: sentence recedes, <em> stays full ink (site bento style) */
.section-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.9rem, 3vw, 2.6rem);
    line-height: 1.02;
    letter-spacing: -0.045em;
    color: var(--jv-ink);
}
.section-title em { font-style: normal; color: var(--jv-ink); }
.section-subtitle { color: var(--jv-muted); }

/* Nav: floating, translucent, tracked wordmark */
.navbar {
    background: rgba(252, 252, 250, 0.72);
    border-bottom: 1px solid transparent;
    box-shadow: none;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.brand-capsule,
.nav-capsule.brand-capsule {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.86rem;
    letter-spacing: 0.22em;
    background: transparent;
    border: none;
    box-shadow: none;
    padding-left: 0.4rem;
}
.nav-capsule {
    background: var(--jv-card-solid);
    border: 1px solid var(--jv-border);
    box-shadow: none;
}
.nav-capsule.user-greeting,
.sign-out__label {
    font-family: var(--font-mono);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.68rem;
}

/* Cards: hairline bento */
.glass-card,
.dashboard-card {
    background: var(--jv-card);
    border: 1px solid var(--jv-border);
    border-radius: 24px;
    box-shadow: none;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: border-color 0.4s ease;
}
.glass-card:hover { border-color: var(--jv-border-hover); }

.btn-primary:not(:disabled) {
    background: var(--jv-ink);
    border-color: var(--jv-ink);
    color: var(--jv-canvas);
}

/* ── Pre-screening overlay on the contour canvas ── */
body:has(.q-overlay.active) .page-wrapper { visibility: hidden; }

.q-overlay {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.bento-container {
    max-width: 1280px;
    background: transparent;
}
.bento-header,
.bento-footer {
    background: rgba(252, 252, 250, 0.78);
    border-color: var(--jv-border);
}
.bento-brand {
    font-size: 0.86rem;
    letter-spacing: 0.22em;
}
.bento-header-badge,
.bento-progress-pill {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.bento-progress-pill {
    color: var(--jv-ink);
    background: var(--jv-card-solid);
    border-color: var(--jv-border);
}
.bento-progress-segment.filled {
    background: var(--jv-ink);
    box-shadow: none;
}

.bento-hero-intro { text-align: left; max-width: none; margin: 0.5rem 0 1.75rem; }
.bento-hero-eyebrow {
    display: block;
    margin-bottom: 1rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #3F4147;
}
.bento-hero-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2rem, 4.2vw, 3.6rem);
    line-height: 0.98;
    letter-spacing: -0.045em;
    color: var(--jv-dim);
    max-width: 18ch;
    text-wrap: balance;
}
.bento-hero-title em {
    font-family: var(--font-display);
    font-style: normal;
    font-weight: 500;
    color: var(--jv-ink);
    padding: 0;
}
.bento-hero-subtitle { max-width: 56ch; color: var(--jv-muted); font-size: 0.9rem; }

.qb-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 12px;
}
.qb-span-12 { grid-column: span 12; }
.qb-span-7 { grid-column: span 7; }
.qb-span-6 { grid-column: span 6; }
.qb-span-5 { grid-column: span 5; }

.qb-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: clamp(18px, 2vw, 28px);
    background: var(--jv-card);
    border: 1px solid var(--jv-border);
    border-radius: 24px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: border-color 0.4s ease, transform 0.6s var(--jv-ease);
    animation: bentoCascadeIn 0.5s var(--jv-ease) both;
}
.qb-card:hover { border-color: var(--jv-border-hover); }
.qb-card__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.qb-card__eyebrow {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #3F4147;
}
.qb-card__num { color: var(--jv-faint); margin-right: 12px; }
.qb-card__status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid var(--jv-faint);
    transition: background 0.3s ease, border-color 0.3s ease;
}
.qb-card.is-complete .qb-card__status { background: var(--jv-accent); border-color: var(--jv-accent); }
.qb-card__title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.5rem, 2.2vw, 2.1rem);
    line-height: 1;
    letter-spacing: -0.045em;
    color: var(--jv-dim);
    margin: 0 0 8px;
}
.qb-card__title em { font-style: normal; color: var(--jv-ink); }
.qb-card__sub { font-size: 0.8rem; color: var(--jv-muted); margin: 0 0 20px; }
.qb-card__fields { display: flex; flex-direction: column; gap: 18px; margin-top: auto; }
.qb-field__label {
    display: block;
    margin-bottom: 10px;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--jv-muted);
}
.qb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qb-chip {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--jv-border);
    background: var(--jv-card-solid);
    color: var(--jv-ink);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--jv-ease);
}
.qb-chip:hover { border-color: var(--jv-border-hover); }
.qb-chip:active { transform: scale(0.97); }
.qb-chip.is-on { background: var(--jv-ink); border-color: var(--jv-ink); color: var(--jv-canvas); }
.qb-chip--none { color: var(--jv-muted); }
.qb-picked { display: flex; flex-wrap: wrap; gap: 6px; }
.qb-picked:empty { display: none; }
.qb-token {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 6px 6px 12px;
    border-radius: 999px;
    background: rgba(47, 143, 134, 0.1);
    color: #1f6b64;
    font-size: 0.78rem;
    font-weight: 500;
}
.qb-token--custom { background: rgba(22, 23, 25, 0.06); color: var(--jv-ink); }
.qb-token button {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(22, 23, 25, 0.08);
    color: inherit;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
}
.qb-field__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.qb-browse {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px dashed var(--jv-border-hover);
    background: transparent;
    color: var(--jv-ink);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.qb-browse svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.qb-browse:hover { border-style: solid; }
.qb-browse.has-count::after {
    content: attr(data-count);
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--jv-ink);
    color: var(--jv-canvas);
    font-size: 0.7rem;
    text-align: center;
}

.bento-btn-submit,
.btn.bento-btn-submit {
    background: var(--jv-ink) !important;
    border: 1px solid var(--jv-ink) !important;
    color: var(--jv-canvas) !important;
    box-shadow: none !important;
}
.bento-btn-submit::before,
.bento-btn-submit::after,
.bento-btn-skip::before,
.bento-btn-skip::after { display: none !important; }
.bento-btn-skip,
.btn.bento-btn-skip {
    background: var(--jv-card-solid) !important;
    border: 1px solid var(--jv-border) !important;
    box-shadow: none !important;
}

/* ── Searchable picker sheet ── */
.qb-picker {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.qb-picker.is-open { opacity: 1; }
.qb-picker__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(22, 23, 25, 0.28);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.qb-picker__panel {
    position: relative;
    width: min(560px, 100%);
    max-height: min(78vh, 720px);
    display: flex;
    flex-direction: column;
    background: var(--jv-card-solid);
    border: 1px solid var(--jv-border);
    border-radius: 24px;
    box-shadow: 0 30px 80px -30px rgba(22, 23, 25, 0.35);
    transform: translateY(14px) scale(0.985);
    transition: transform 0.35s var(--jv-ease);
    overflow: hidden;
}
.qb-picker.is-open .qb-picker__panel { transform: none; }
.qb-picker__head { display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 22px 14px; }
.qb-picker__eyebrow {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--jv-muted);
}
.qb-picker__title {
    margin: 6px 0 0;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.5rem;
    letter-spacing: -0.04em;
    color: var(--jv-ink);
}
.qb-picker__x {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--jv-border);
    background: transparent;
    color: var(--jv-ink);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}
.qb-picker__search {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 22px 10px;
    padding: 0 14px;
    border: 1px solid var(--jv-border);
    border-radius: 999px;
    background: #f6f6f1;
}
.qb-picker__search svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--jv-muted); stroke-width: 2; }
.qb-picker__search input {
    flex: 1;
    min-width: 0;
    height: 42px;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--jv-ink);
}
.qb-picker__list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 12px; }
.qb-picker__empty { margin: 8px 10px; font-size: 0.82rem; color: var(--jv-muted); }
.qb-group { margin-top: 10px; }
.qb-group__label {
    display: block;
    padding: 8px 10px 6px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--jv-faint);
}
.qb-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--jv-ink);
    font-family: var(--font-body);
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
}
.qb-row:hover { background: #f1f1ec; }
.qb-row__box {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border-radius: 6px;
    border: 1.5px solid var(--jv-border-hover);
    transition: background 0.15s ease, border-color 0.15s ease;
}
.qb-row.is-on .qb-row__box {
    background: var(--jv-ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FCFCFA' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 12px no-repeat;
    border-color: var(--jv-ink);
}
.qb-row--none .qb-row__label { color: var(--jv-muted); }
.qb-row--add { color: var(--jv-accent); font-weight: 600; }
.qb-row__plus {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: rgba(47, 143, 134, 0.12);
    font-size: 1rem;
    line-height: 1;
}
.qb-picker__foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 22px calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--jv-border);
}
.qb-picker__clear,
.qb-picker__done {
    padding: 11px 22px;
    border-radius: 999px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}
.qb-picker__clear { border: 1px solid var(--jv-border); background: transparent; color: var(--jv-ink); }
.qb-picker__done { flex: 1; border: 1px solid var(--jv-ink); background: var(--jv-ink); color: var(--jv-canvas); }

@media (max-width: 960px) {
    .qb-span-7, .qb-span-5, .qb-span-6 { grid-column: span 12; }
}
@media (max-width: 640px) {
    .navbar { background: rgba(252, 252, 250, 0.86); }
    .bento-brand { letter-spacing: 0.18em; font-size: 0.8rem; }
    .bento-hero-intro { margin-bottom: 1.25rem; }
    .qb-card { border-radius: 20px; }
    .qb-card__top { margin-bottom: 14px; }
    .qb-picker { align-items: flex-end; padding: 0; }
    .qb-picker__panel { width: 100%; max-height: 86vh; border-radius: 24px 24px 0 0; transform: translateY(40px); }
}
@media (prefers-reduced-motion: reduce) {
    .qb-card { animation: none; }
    .qb-picker, .qb-picker__panel { transition: none; }
}

/* ── Full-width shell: header, body and footer share one gutter ── */
.bento-container { max-width: none; }
.bento-header,
.bento-footer { padding-left: clamp(16px, 2.4vw, 40px); padding-right: clamp(16px, 2.4vw, 40px); }
.bento-body {
    padding: 14px clamp(16px, 2.4vw, 40px) 16px;
    scrollbar-gutter: auto;
}

/* Intro statement becomes the first bento tile */
.bento-hero-intro.qb-hero {
    margin: 0;
    max-width: none;
    text-align: left;
    justify-content: space-between;
    animation: bentoCascadeIn 0.45s var(--jv-ease) both;
}
.qb-hero .bento-hero-title { font-size: clamp(1.7rem, 2.5vw, 2.7rem); max-width: 14ch; margin-bottom: 12px; }
.qb-hero .bento-hero-subtitle { font-size: 0.8rem; max-width: 40ch; margin: 0; }
.qb-live {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 18px;
}
.qb-live__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 14px;
    background: #f1f1ec;
}
.qb-live__label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--jv-muted);
}
.qb-live__val {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
    text-transform: capitalize;
    color: var(--jv-faint);
}
.qb-live__val[data-band="low"] { color: var(--jv-accent); }
.qb-live__val[data-band="moderate"] { color: #a07a1f; }
.qb-live__val[data-band="high"],
.qb-live__val[data-band="very_high"] { color: #b9474f; }

/* Desktop: the whole questionnaire fits one screen as a 4 × 2 bento.
   Rows grow past 1fr only if content truly needs it, so the body scrolls only then. */
@media (min-width: 1100px) and (min-height: 680px) {
    .bento-body { display: flex; flex-direction: column; }
    .qb-grid {
        flex: 1;
        min-height: 0;
        grid-template-columns: repeat(12, minmax(0, 1fr));
        grid-template-rows: auto minmax(min-content, 1fr);
    }
    .qb-hero { grid-column: 1 / span 3; grid-row: 1; }
    [data-screen="demographics"] { grid-column: 4 / span 4; grid-row: 1; }
    [data-screen="lifestyle"] { grid-column: 8 / span 2; grid-row: 1; }
    [data-screen="conditions"] { grid-column: 10 / span 3; grid-row: 1; }
    [data-screen="cardio"] { grid-column: 1 / span 3; grid-row: 2; }
    [data-screen="respiratory"] { grid-column: 4 / span 3; grid-row: 2; }
    [data-screen="metabolic"] { grid-column: 7 / span 3; grid-row: 2; }
    [data-screen="family"] { grid-column: 10 / span 3; grid-row: 2; }

    .qb-card { padding: clamp(14px, 1.3vw, 22px); }
    .qb-card__top { margin-bottom: 12px; }
    .qb-card__title { font-size: clamp(1.25rem, 1.6vw, 1.8rem); margin-bottom: 4px; }
    .qb-card__sub { font-size: 0.74rem; margin-bottom: 12px; }
    .qb-card__fields { gap: 12px; }
    .qb-field__label { margin-bottom: 7px; }
    .qb-chips, .qb-picked, .qb-field__actions { gap: 5px; }
    .qb-chip, .qb-browse { padding: 6px 11px; font-size: 0.74rem; }
    .qb-token { font-size: 0.72rem; padding: 4px 4px 4px 10px; }
}
@media (min-width: 1100px) and (max-height: 820px) {
    .qb-card__sub, .qb-hero .bento-hero-subtitle { display: none; }
    .bento-header { padding-top: 0.8rem; padding-bottom: 0.9rem; }
    .bento-footer { padding-top: 0.7rem; padding-bottom: 0.7rem; }
}
/* Rows inside a field (quick picks / picked tokens / browse) need their own spacing */
.qb-field { display: flex; flex-direction: column; gap: 8px; }
.qb-field__label { margin-bottom: 0; }

.qb-chip--other {
    border-style: dashed;
    border-color: rgba(47, 143, 134, 0.55);
    color: var(--jv-accent);
    font-weight: 600;
}
.qb-chip--other:hover { border-style: solid; border-color: var(--jv-accent); }
.qb-other {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 3px 3px 12px;
    border: 1px solid var(--jv-accent);
    border-radius: 999px;
    background: var(--jv-card-solid);
    box-shadow: 0 0 0 3px rgba(47, 143, 134, 0.12);
    flex: 1 1 220px;
    max-width: 100%;
}
.qb-other input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--jv-ink);
    height: 26px;
}
.qb-other__add,
.qb-other__x {
    height: 26px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.74rem;
    font-weight: 600;
}
.qb-other__add { padding: 0 12px; background: var(--jv-ink); color: var(--jv-canvas); }
.qb-other__x { width: 26px; background: transparent; color: var(--jv-muted); font-size: 1rem; }
.qb-token__tag {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--jv-accent);
}
.qb-row__weight {
    margin-left: 8px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--jv-muted);
    font-weight: 400;
}

/* Short desktops: keep it to one screen by showing fewer quick picks (selected ones always stay) */
@media (min-width: 1100px) and (min-height: 680px) and (max-height: 780px) {
    .qb-hero .bento-hero-title { font-size: clamp(1.5rem, 2.1vw, 2.1rem); }
    .qb-card__title { font-size: clamp(1.15rem, 1.4vw, 1.5rem); }
    .qb-card__top { margin-bottom: 8px; }
    .qb-live { margin-top: 12px; }
}
/* Tablet / phone: natural flow, scroll only when the content is longer than the screen */
@media (max-width: 1099.98px), (max-height: 679.98px) {
    .qb-hero { grid-column: span 12; }
    .qb-live { max-width: 420px; }
}

/* ════ Cards fill their space: more options where there's room, tiles for single choice ════ */
.qb-card { min-height: 0; }
.qb-card__fields { flex: 1; min-height: 0; margin-top: 0; }

.qb-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 6px;
}
.qb-tile {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 12px;
    text-align: left;
    padding: 9px 12px;
}
.qb-tile__dot {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1.5px solid var(--jv-border-hover);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.qb-tile.is-on .qb-tile__dot { border-color: var(--jv-canvas); box-shadow: inset 0 0 0 2.5px var(--jv-ink), inset 0 0 0 6px var(--jv-canvas); }

@media (min-width: 1100px) and (min-height: 680px) {
    .qb-card__fields { display: flex; flex-direction: column; }
    /* Single-choice: fields share the card height by option count; tile rows stretch (capped) */
    .qb-field--single { flex: var(--opts) 1 0; min-height: 0; }
    .qb-field--single .qb-tiles {
        flex: 1;
        min-height: 0;
        grid-template-columns: repeat(auto-fill, minmax(min(136px, calc(50% - 3px)), 1fr));
        grid-auto-rows: minmax(28px, 1fr);
        align-content: stretch;
    }
    .qb-field--single .qb-tile { height: 100%; font-size: 0.78rem; }
    /* Multi-choice: the quick-pick area takes all remaining height; JS hides what won't fit */
    .qb-field--multi { flex: 1; min-height: 0; }
    .qb-chips--quick {
        position: relative;
        flex: 1 1 0;
        min-height: 30px;
        overflow: hidden;
        align-content: flex-start;
        /* Its content must not count toward the row's min-content, or the grid grows to fit all options */
        contain: size;
    }
}

/* Hero: live section checklist fills the intro tile */
.qb-hero { display: flex; flex-direction: column; }
.qb-steps {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    justify-content: center;
    border-top: 1px solid var(--jv-border);
}
.qb-steps__item {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--jv-border);
    font-size: 0.76rem;
    color: var(--jv-muted);
}
.qb-steps__num { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.1em; color: var(--jv-faint); }
.qb-steps__name { color: var(--jv-ink); font-weight: 500; }
.qb-steps__meta { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.06em; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16ch; }
.qb-steps__item.is-done .qb-steps__num { color: var(--jv-accent); }
.qb-steps__item.is-done .qb-steps__meta { color: var(--jv-accent); }
.qb-live { margin-top: 12px; }
@media (min-width: 1100px) and (min-height: 680px) {
    .qb-steps {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 14px;
        align-content: start;
        min-height: 0;
    }
    .qb-steps__item { padding: 5px 0; }
    .qb-steps__meta { max-width: 9ch; }
}
@media (min-width: 1100px) and (max-width: 1499.98px) {
    .bento-hero-eyebrow .qb-eyebrow-more { display: none; }
}
@media (min-width: 1100px) and (min-height: 680px) {
    .qb-hero .bento-hero-subtitle { display: none; }
    .qb-hero .bento-hero-title { font-size: clamp(1.35rem, 1.75vw, 2.3rem); max-width: 16ch; margin-bottom: 0; }
    .qb-steps[hidden] { display: none; }
}
@media (min-width: 1100px) and (max-height: 960px) {
    .qb-hero .bento-hero-subtitle { display: none; }
}

/* ════ Floating pill navbar + bottom dock (questionnaire) ════ */
.bento-header.qb-nav,
.bento-footer.qb-dock {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px clamp(16px, 2.4vw, 40px) 0;
    padding: 6px 6px 6px 18px;
    background: rgba(252, 252, 250, 0.78);
    border: 1px solid var(--jv-border);
    border-radius: 999px;
    box-shadow: 0 10px 30px -18px rgba(22, 23, 25, 0.25), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.bento-footer.qb-dock {
    margin: 0 clamp(16px, 2.4vw, 40px) calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 6px;
}
.qb-nav__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.qb-nav .bento-brand { font-size: 0.8rem; letter-spacing: 0.22em; }
.qb-nav__sep { width: 1px; height: 14px; background: var(--jv-border-hover); }
.qb-nav__label {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--jv-muted);
    white-space: nowrap;
}
.qb-nav__actions { display: flex; align-items: center; gap: 6px; }
.qb-nav__install,
.qb-nav__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.78rem;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s var(--jv-ease);
}
.qb-nav__install { padding: 0 16px 0 13px; border: 1px solid var(--jv-ink); background: var(--jv-ink); color: var(--jv-canvas); }
.qb-nav__install:hover { transform: translateY(-1px); }
.qb-nav__install[hidden] { display: none; }
.qb-nav__close { width: 36px; border: 1px solid var(--jv-border); background: var(--jv-card-solid); color: var(--jv-ink); }
.qb-nav__close:hover { border-color: var(--jv-border-hover); }
.qb-nav svg, .qb-dock svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pwa-cta[data-pwa-ready="true"]::after {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5fc4b8;
    margin-left: -2px;
}

.qb-dock__skip {
    height: 40px;
    padding: 0 18px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--jv-muted);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}
.qb-dock__skip:hover { color: var(--jv-ink); background: #f1f1ec; }
.qb-dock__progress { display: flex; align-items: center; gap: 14px; min-width: 0; }
.qb-dock__segs { display: grid; grid-template-columns: repeat(8, 22px); gap: 4px; }
.qb-dock .bento-progress-segment {
    display: block;
    height: 4px;
    border-radius: 2px;
    background: #e6e6dd;
    box-shadow: none;
}
.qb-dock .bento-progress-segment.filled { background: var(--jv-ink); }
.qb-dock__count {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--jv-muted);
    white-space: nowrap;
}
.qb-dock__submit {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 18px 0 22px;
    border: none;
    border-radius: 999px;
    background: var(--jv-ink);
    color: var(--jv-canvas);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.86rem;
    cursor: pointer;
    transition: transform 0.25s var(--jv-ease), background 0.2s ease;
}
.qb-dock__submit:hover { background: #2a2c2f; transform: translateY(-1px); }
.qb-dock__submit svg { transition: transform 0.25s var(--jv-ease); }
.qb-dock__submit:hover svg { transform: translateX(3px); }

@media (max-width: 640px) {
    .bento-header.qb-nav { margin: calc(8px + env(safe-area-inset-top, 0px)) 10px 0; padding: 5px 5px 5px 14px; }
    .bento-footer.qb-dock {
        margin: 0 10px calc(8px + env(safe-area-inset-bottom, 0px));
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        border-radius: 999px;
        width: auto;
    }
    .qb-dock > * { width: auto !important; margin: 0 !important; }
    .qb-dock__progress { order: 0; flex: 1; justify-content: center; }
    .qb-dock__skip { order: -1; }
    .qb-dock__submit { order: 1; }
    .qb-dock__count { font-size: 0.6rem; letter-spacing: 0.1em; }
    .qb-nav__label, .qb-nav__sep { display: none; }
    .qb-nav__install span { display: none; }
    .qb-nav__install { width: 36px; padding: 0; }
    .qb-dock__segs { display: none; }
    .qb-dock__skip { padding: 0 12px; }
    .qb-dock__submit { padding: 0 14px 0 16px; }
}

/* ════ Dashboard navbar: same floating pill ════ */
.navbar {
    position: sticky;
    top: 12px;
    margin: 12px clamp(12px, 2.4vw, 40px) 0;
    height: 56px;
    padding: 0 8px 0 18px;
    border: 1px solid var(--jv-border);
    border-radius: 999px;
    background: rgba(252, 252, 250, 0.78);
    box-shadow: 0 10px 30px -18px rgba(22, 23, 25, 0.25);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    z-index: 20;
}
.nav-user { gap: 6px; }
.nav-install {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    background: var(--jv-ink);
    border-color: var(--jv-ink);
    color: var(--jv-canvas);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.74rem;
}
.nav-install[hidden] { display: none; }
.nav-install .pwa-cta__icon { width: 15px; height: 15px; }
@media (max-width: 640px) {
    .navbar { margin: 8px 10px 0; padding: 0 6px 0 14px; height: 52px; }
    .nav-install__label { display: none; }
}

/* ════ Brand logo (from jivascope.com) ════ */
.brand-logo { display: block; height: 38px; width: auto; }
.qb-nav .brand-logo { height: 36px; }
.brand-capsule, .nav-capsule.brand-capsule { padding: 0 0.25rem; display: inline-flex; align-items: center; }
@media (max-width: 640px) { .brand-logo, .qb-nav .brand-logo { height: 30px; } }

/* ════ Per-card search ════ */
.qb-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--jv-border);
    border-radius: 999px;
    background: #f6f6f1;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}
.qb-search:focus-within { border-color: var(--jv-ink); background: var(--jv-card-solid); box-shadow: 0 0 0 3px rgba(22, 23, 25, 0.06); }
.qb-search svg { width: 14px; height: 14px; flex-shrink: 0; fill: none; stroke: var(--jv-muted); stroke-width: 2; }
.qb-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: var(--jv-ink);
}
.qb-search input::-webkit-search-cancel-button { cursor: pointer; }
.qb-empty { align-self: center; font-size: 0.74rem; color: var(--jv-muted); padding: 0 4px; }

/* ════ Single-choice options as vertical column lists ════ */
.qb-tile__name { flex: 1; min-width: 0; }
.qb-tile__meta { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.04em; color: var(--jv-muted); white-space: nowrap; }
.qb-tile.is-on .qb-tile__meta { color: rgba(252, 252, 250, 0.7); }

@media (min-width: 1100px) and (min-height: 680px) {
    /* 7 question cards: About | Smoking | Conditions on top, the four multi-selects below */
    [data-screen="demographics"] { grid-column: 1 / span 5; grid-row: 1; }
    [data-screen="lifestyle"] { grid-column: 6 / span 3; grid-row: 1; }
    [data-screen="conditions"] { grid-column: 9 / span 4; grid-row: 1; }
    [data-screen="cardio"] { grid-column: 1 / span 3; grid-row: 2; }
    [data-screen="respiratory"] { grid-column: 4 / span 3; grid-row: 2; }
    [data-screen="metabolic"] { grid-column: 7 / span 3; grid-row: 2; }
    [data-screen="family"] { grid-column: 10 / span 3; grid-row: 2; }

    [data-screen="demographics"] { --list-rows: 8; }
    [data-screen="lifestyle"] { --list-rows: 6; }
    [data-screen="demographics"] .qb-card__fields { flex-direction: row; gap: 12px; }
    [data-field-wrap="q_age"] { flex: 1.7 1 0; }
    [data-field-wrap="q_gender"] { flex: 1 1 0; }
    .qb-field--single { flex: 1 1 0; min-width: 0; min-height: 0; }
    .qb-field--single[data-field-wrap="q_age"] { flex: 2 1 0; }
    .qb-field--single[data-field-wrap="q_gender"] { flex: 1 1 0; }
    .qb-field--single .qb-tiles {
        grid-auto-flow: column;
        grid-template-columns: none;
        grid-auto-columns: minmax(0, 1fr);
        grid-template-rows: repeat(var(--list-rows), minmax(30px, 1fr));
        align-content: stretch;
    }
    .qb-field--single .qb-tile { height: 100%; padding: 6px 12px; }
    .qb-search { height: 32px; }
}
/* Shorter desktops: wrap the lists into two columns so they keep fitting one screen */
@media (min-width: 1100px) and (min-height: 680px) and (max-height: 860px) {
    [data-screen="demographics"] { --list-rows: 4; }
    [data-screen="lifestyle"] { --list-rows: 3; }
    [data-field-wrap="q_age"] { flex: 2.3 1 0; }
}

/* ════ Uniform option height across every card (JS sets --opt-h on #q-grid, --row-gap / --tile-gap per list) ════ */
@media (min-width: 1100px) and (min-height: 680px) {
    .qb-grid { grid-template-rows: minmax(min-content, 1fr) minmax(min-content, 1.15fr); }
    .qb-chips--quick {
        column-gap: 8px;
        row-gap: var(--row-gap, 8px);
    }
    .qb-chips--quick > .qb-chip {
        flex: 1 1 auto;
        display: block;
        height: var(--opt-h, 34px);
        line-height: calc(var(--opt-h, 34px) - 2px);
        padding: 0 14px;
        border-radius: 14px;
        font-size: 0.8rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }
    .qb-chips--quick > .qb-chip--other { flex: 0 0 auto; }
    .qb-field--single .qb-tiles {
        contain: size;
        grid-template-rows: repeat(var(--list-rows), var(--opt-h, 34px));
        row-gap: var(--tile-gap, 6px);
        align-content: start;
    }
    .qb-field--single .qb-tile {
        height: var(--opt-h, 34px);
        padding: 0 12px;
        border-radius: 14px;
        font-size: 0.8rem;
    }
    .qb-tile__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .qb-field--single .qb-tile { container-type: inline-size; }
    @container (max-width: 150px) {
        .qb-tile__meta { display: none; }
    }
}

/* ════ Dashboard: menu-style split — Heart / Lungs on the left, capture stage on the right ════ */
body:has(.dash-split) .page-wrapper { height: 100vh; height: 100dvh; min-height: 0; }
.dashboard-content.dash-split {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(300px, 0.82fr) 1.6fr;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    margin: 12px clamp(12px, 2.4vw, 40px) clamp(12px, 2vw, 24px);
    border-top: 1px solid var(--jv-border);
    border-bottom: 1px solid var(--jv-border);
    background: rgba(252, 252, 250, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Left: menu rows */
.dash-menu {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--jv-border);
}
.dash-menu .tab-btn.dash-menu__item {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    gap: 18px;
    margin: 0;
    padding: clamp(22px, 2.6vw, 44px);
    border: 0;
    border-bottom: 1px solid var(--jv-border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--jv-ink);
    font: inherit;
    text-align: left;
    overflow: hidden;
    cursor: pointer;
}
.dash-menu .tab-btn.dash-menu__item:last-child { border-bottom: 0; }
.dash-menu__fill {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: #efefe8;
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.4s var(--jv-ease), background 0.3s ease;
}
.dash-menu__item > :not(.dash-menu__fill) { position: relative; z-index: 1; }
.dash-menu__item:hover .dash-menu__fill { transform: scaleY(1); }
.dash-menu .tab-btn.dash-menu__item.active { color: var(--jv-canvas); }
.dash-menu__item.active .dash-menu__fill { transform: scaleY(1); background: var(--jv-ink); }
.dash-menu__top {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--jv-muted);
}
.dash-menu__item.active .dash-menu__top { color: rgba(252, 252, 250, 0.6); }
.dash-menu__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.dash-menu__label {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(3.2rem, 7vw, 8.5rem);
    line-height: 0.85;
    letter-spacing: -0.055em;
}
.dash-menu__arrow {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 2.6vw, 2.8rem);
    line-height: 1;
    color: var(--jv-faint);
    transition: transform 0.35s var(--jv-ease), color 0.3s ease;
}
.dash-menu__item:hover .dash-menu__arrow { transform: translateX(6px); color: var(--jv-ink); }
.dash-menu__item.active .dash-menu__arrow { color: var(--jv-canvas); }
.dash-menu__desc { max-width: 34ch; font-size: 0.86rem; line-height: 1.5; color: var(--jv-muted); }
.dash-menu__item.active .dash-menu__desc { color: rgba(252, 252, 250, 0.72); }

/* Right: capture stage, no card chrome */
.dash-stage {
    position: relative;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: clamp(22px, 2.6vw, 44px) clamp(22px, 3.2vw, 56px);
}
.dash-stage > .tab-content.active { display: flex; flex-direction: column; flex: 1; min-height: 0; justify-content: flex-start; }
.dash-stage .screen.active { display: flex; flex-direction: column; flex: 1; min-height: 0; align-items: stretch; }
.dash-stage .upload-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    text-align: left;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    animation: none;
}
.dash-stage .upload-card .section-title { text-align: left; font-size: clamp(2rem, 3.4vw, 3.6rem); margin-bottom: 0.35rem; }
.dash-stage .upload-card .section-subtitle { text-align: left; max-width: 56ch; margin: 0 0 1.5rem; }
.dash-stage .mode-switch { margin: 0 0 1.25rem; max-width: 340px; }
.dash-stage .mode-panel.active { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.dash-stage .upload-zone {
    flex: 1;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1.5px dashed #cfcfc4;
    border-radius: 20px;
    background: rgba(252, 252, 250, 0.6);
}
.dash-stage .upload-zone:hover { border-color: var(--jv-ink); background: var(--jv-canvas); }
.dash-stage .upload-zone.drag-over { transform: none; border-color: var(--jv-ink); background: #f3f3ee; }
.dash-stage .file-preview { margin-top: 1rem; }
.dash-stage .btn-analyze { margin-top: 1rem; height: 56px; border-radius: 999px; font-size: 0.95rem; flex-shrink: 0; }

/* Record mode: mic setup | guided-session info, start button along the bottom */
.dash-stage .mode-panel.active:is(#heart-record-mode, #lung-record-mode) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr auto;
    gap: 0 28px;
}
.dash-stage :is(#heart-record-mode, #lung-record-mode) .mic-select-wrap { grid-column: 1; margin: 0; padding-right: 28px; border-right: 1px solid var(--jv-border); }
.dash-stage :is(#heart-record-mode, #lung-record-mode) .record-info {
    grid-column: 2;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
}
.dash-stage :is(#heart-record-mode, #lung-record-mode) .record-info-title {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--jv-muted);
    margin-bottom: 0.8rem;
}
.dash-stage :is(#heart-record-mode, #lung-record-mode) .record-info-text { font-size: 0.95rem; line-height: 1.6; color: var(--jv-ink); max-width: 48ch; }
.dash-stage :is(#heart-record-mode, #lung-record-mode) .btn-analyze { grid-column: 1 / -1; }

/* Phones / short screens: Heart · Lungs become a two-up row above a scrolling stage */
@media (max-width: 1023.98px), (max-height: 600px) {
    body:has(.dash-split) .page-wrapper { height: auto; min-height: 100dvh; }
    .dashboard-content.dash-split { grid-template-columns: 1fr; margin: 8px 10px 12px; }
    .dash-menu { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--jv-border); }
    .dash-menu .tab-btn.dash-menu__item { padding: 16px 18px; gap: 10px; border-bottom: 0; border-right: 1px solid var(--jv-border); }
    .dash-menu .tab-btn.dash-menu__item:last-child { border-right: 0; }
    .dash-menu__label { font-size: clamp(2rem, 9vw, 3rem); }
    .dash-menu__desc { display: none; }
    .dash-stage { overflow: visible; padding: 22px 6px 8px; }
    .dash-stage .upload-zone { min-height: 260px; }
    .dash-stage .mode-panel.active:is(#heart-record-mode, #lung-record-mode) { grid-template-columns: 1fr; gap: 18px; }
    .dash-stage :is(#heart-record-mode, #lung-record-mode) .mic-select-wrap { padding: 0 0 18px; border-right: 0; border-bottom: 1px solid var(--jv-border); }
    .dash-stage :is(#heart-record-mode, #lung-record-mode) .record-info { grid-column: 1; }
}

/* Processing / report / verdict screens inside the stage: same card-free language */
.dash-stage .screen.active > .dashboard-card:not(.upload-card) {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    text-align: left;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    animation: none;
}
.dash-stage #heart-processing-screen.active,
.dash-stage #lung-processing-screen.active { justify-content: center; align-items: center; }
.dash-stage #heart-processing-screen .dashboard-card,
.dash-stage #lung-processing-screen .dashboard-card { max-width: 560px; text-align: center; }
.dash-stage .processing-title,
.dash-stage .report-title,
.dash-stage .report-section-title {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: -0.035em;
    color: var(--jv-ink);
}
.dash-stage .processing-title { font-size: clamp(1.8rem, 2.6vw, 2.6rem); }
.dash-stage .report-title { font-size: clamp(2rem, 3.2vw, 3.2rem); text-align: left; }
.dash-stage .report-section-title { font-size: clamp(1.1rem, 1.4vw, 1.4rem); margin-bottom: 0.9rem; }
.dash-stage .report-header { text-align: left; padding-bottom: 1rem; border-bottom: 1px solid var(--jv-border); margin-bottom: 0; }
.dash-stage .report-section {
    margin: 0;
    padding: 1.4rem 0;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--jv-border);
    border-radius: 0;
    box-shadow: none;
}
.dash-stage .report-section:last-child { border-bottom: 0; }
.dash-stage .result-card {
    background: rgba(252, 252, 250, 0.7);
    border: 1px solid var(--jv-border);
    border-radius: 16px;
    box-shadow: none;
}

/* Guided capture: tracker state chip + front→back interstitial for lung exams */
#rec-pose-status[data-state="TRACKING"],
#rec-pose-status[data-state="REACQUIRED"] { color: #5fc4b8; }
#rec-pose-status[data-state="SKIN"],
#rec-pose-status[data-state="LOCKED"] { color: #93c5fd; }
#rec-pose-status[data-state="HOLD"],
#rec-pose-status[data-state="NO_POSE"],
#rec-pose-status[data-state="CALIBRATING"] { color: #fbbf24; }

.rec-turn {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(14, 15, 16, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.rec-turn[hidden] { display: none; }
.rec-turn__card {
    max-width: 420px;
    padding: 28px;
    border-radius: 24px;
    background: #fcfcfa;
    border: 1px solid #e2e2d9;
    color: #161719;
    text-align: left;
}
.rec-turn__eyebrow {
    font-family: "DM Mono", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #2f8f86;
}
.rec-turn__title {
    margin: 10px 0 8px;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 500;
    font-size: 2rem;
    letter-spacing: -0.04em;
    line-height: 1;
}
.rec-turn__text { margin: 0 0 20px; font-size: 0.95rem; line-height: 1.55; color: #74777e; }
.rec-turn__go { width: 100%; justify-content: center; }

/* ===== Mobile pass ===== */

/* Stacked dashboard: menu row hugs its content, the stage takes the rest */
@media (max-width: 1023.98px), (max-height: 600px) {
    .dashboard-content.dash-split { grid-template-rows: auto 1fr; align-content: start; }
    .dash-menu .tab-btn.dash-menu__item { flex: 1 1 0; min-width: 0; }
}

/* Guided capture overlay: readable on camera, thumb-sized controls, notch-safe */
.record-overlay { background: #0e0f10; }
.rec-body { background: #0e0f10; }
.rec-hud-top {
    padding: calc(10px + env(safe-area-inset-top, 0px)) calc(14px + env(safe-area-inset-right, 0px)) 18px calc(14px + env(safe-area-inset-left, 0px));
    background: linear-gradient(to bottom, rgba(14, 15, 16, 0.82), rgba(14, 15, 16, 0));
}
.rec-stat,
.rec-badge {
    font-family: "DM Mono", monospace;
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(242, 242, 238, 0.18);
    background: rgba(14, 15, 16, 0.6);
    color: rgba(242, 242, 238, 0.82);
}
.rec-close {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(242, 242, 238, 0.2);
    background: rgba(14, 15, 16, 0.6);
    color: #f2f2ee;
}
.rec-progress { top: calc(66px + env(safe-area-inset-top, 0px)); gap: 8px; }
.rec-dot { border-color: rgba(242, 242, 238, 0.28); background: rgba(14, 15, 16, 0.6); }
.rec-dot em { font-family: "DM Mono", monospace; color: rgba(242, 242, 238, 0.7); letter-spacing: 0.04em; }

.rec-hint {
    position: absolute;
    z-index: 11;
    top: calc(116px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 10px 16px 12px;
    border-radius: 18px;
    background: rgba(14, 15, 16, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #f2f2ee;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.35;
    text-align: center;
    pointer-events: none;
    overflow: hidden;
}
.rec-hint[hidden] { display: none; }
.rec-hint__bar {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: calc(var(--calib, 0) * 100%);
    background: #5fc4b8;
    transition: width 0.15s linear;
}

.rec-hud-bottom {
    gap: 8px;
    padding: 40px calc(16px + env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
    background: linear-gradient(to top, rgba(14, 15, 16, 0.94) 55%, rgba(14, 15, 16, 0));
}
.rec-target { flex-wrap: wrap; justify-content: center; row-gap: 2px; }
.rec-target-code { font-family: "Plus Jakarta Sans", sans-serif; letter-spacing: 0.02em; }
.rec-target-name { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 600; font-size: 1rem; color: #f2f2ee; letter-spacing: 0; }
.rec-target-step { font-family: "DM Mono", monospace; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(242, 242, 238, 0.6); }
.rec-instruction { color: rgba(242, 242, 238, 0.82); font-size: 0.88rem; line-height: 1.45; max-width: 520px; }
.rec-timer { color: #5fc4b8; }
.rec-controls { width: 100%; max-width: 520px; justify-content: center; flex-wrap: wrap; }
.rec-controls .cam-btn {
    min-height: 48px;
    padding: 0 22px;
    justify-content: center;
    border-radius: 999px;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    border-color: rgba(242, 242, 238, 0.26);
    background: rgba(14, 15, 16, 0.6);
    color: #f2f2ee;
}
.rec-controls .cam-btn.primary { background: #f2f2ee; border-color: #f2f2ee; color: #161719; }
.rec-controls .cam-btn.primary:hover:not(:disabled) { background: #ffffff; border-color: #ffffff; }
.rec-controls .cam-btn.recording { background: #ef4444; border-color: #ef4444; color: #fff; }
.rec-loading { background: rgba(14, 15, 16, 0.96); }
#rec-loading-text { font-family: "DM Mono", monospace; font-size: 0.8rem; letter-spacing: 0.14em; color: rgba(242, 242, 238, 0.8); }

.rec-stat, .rec-badge { white-space: nowrap; }
.rec-controls .cam-btn[hidden] { display: none; }

@media (max-width: 640px) {
    #rec-fps, #rec-model-badge { display: none; }
    .rec-controls .cam-btn { flex: 1 1 0; min-width: 0; padding: 0 14px; }
    .rec-turn__card { padding: 22px; }
    .rec-turn__title { font-size: 1.7rem; }
}

/* Short landscape phones: one compact strip top and bottom so the camera stays visible */
@media (max-height: 500px) and (orientation: landscape) {
    #rec-fps, #rec-model-badge { display: none; }
    .rec-hud-top { padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 8px; }
    .rec-close { width: 38px; height: 38px; }
    .rec-progress { top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; right: auto; transform: translateX(-50%); }
    .rec-dot { width: 28px; height: 28px; }
    .rec-dot em { font-size: 0.58rem; }
    .rec-hint { top: calc(54px + env(safe-area-inset-top, 0px)); font-size: 0.8rem; padding: 7px 12px 9px; }
    .rec-hud-bottom {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        column-gap: 14px;
        row-gap: 4px;
        padding-top: 22px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }
    .rec-instruction { display: none; }
    .rec-target-code { font-size: 1.3rem; }
    .rec-controls { width: auto; flex-wrap: nowrap; }
    .rec-controls .cam-btn { min-height: 42px; flex: none; }
    .rec-timer { font-size: 1.4rem; }
    .rec-turn { padding: 12px; }
    .rec-turn__card { padding: 18px 20px; max-width: 520px; }
    .rec-turn__title { font-size: 1.5rem; margin: 6px 0; }
    .rec-turn__text { margin-bottom: 12px; font-size: 0.85rem; }
}

/* Questionnaire in short landscape: slimmer nav + dock leave room for the questions */
@media (max-height: 500px) and (orientation: landscape) {
    .bento-header.qb-nav { margin-top: calc(6px + env(safe-area-inset-top, 0px)); padding-top: 3px; padding-bottom: 3px; }
    .bento-footer.qb-dock { padding-top: 4px; padding-bottom: 4px; }
    .qb-dock__submit, .qb-nav__install, .qb-nav__close { height: 38px; }
    .brand-logo, .qb-nav .brand-logo { height: 28px; }
}

/* ===== Capture overlay v2: point chips + X on top, description on tap, flip / record / skip at the bottom ===== */
.rec-hud-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.rec-points {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px 2px;
}
.rec-points::-webkit-scrollbar { display: none; }
.rec-chip {
    position: relative;
    flex: 0 1 64px;
    min-width: 42px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: 999px;
    border: 1.5px solid rgba(242, 242, 238, 0.3);
    background: rgba(14, 15, 16, 0.62);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(242, 242, 238, 0.85);
    font-family: "DM Mono", monospace;
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.rec-chip--back:not(.done) { border-style: dashed; }
.rec-chip.active {
    border-color: var(--dot-color);
    color: #fff;
    background: rgba(14, 15, 16, 0.85);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot-color) 35%, transparent);
}
.rec-chip.done { background: var(--dot-color); border-color: var(--dot-color); color: #fff; }
.rec-chip.done::after {
    content: "";
    position: absolute;
    top: -3px;
    right: -3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #f2f2ee url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23161719' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 9px no-repeat;
}
.rec-chip.done.active { box-shadow: 0 0 0 3px rgba(242, 242, 238, 0.7); }
.rec-chip:disabled { opacity: 0.55; cursor: default; }
.rec-hud-top .rec-close { flex: none; }

.rec-status-row {
    position: absolute;
    z-index: 10;
    top: calc(66px + env(safe-area-inset-top, 0px));
    left: calc(14px + env(safe-area-inset-left, 0px));
    display: flex;
    gap: 6px;
    pointer-events: none;
}
.rec-hint { top: calc(104px + env(safe-area-inset-top, 0px)); }

.rec-point-info {
    position: absolute;
    z-index: 12;
    top: calc(66px + env(safe-area-inset-top, 0px));
    left: 12px;
    right: 12px;
    max-width: 460px;
    margin: 0 auto;
    padding: 14px 16px 15px;
    border-radius: 18px;
    border: 1px solid rgba(242, 242, 238, 0.16);
    background: rgba(14, 15, 16, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f2f2ee;
    cursor: pointer;
    animation: recInfoIn 0.18s ease-out;
}
.rec-point-info[hidden] { display: none; }
@keyframes recInfoIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.rec-point-info__head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rec-point-info .rec-target-code { font-size: 1.5rem; line-height: 1; }
.rec-point-info .rec-target-step { display: block; margin-top: 6px; }
.rec-point-info .rec-instruction { display: block; margin: 8px 0 0; text-align: left; max-width: none; font-size: 0.9rem; }

.rec-hud-bottom { padding-top: 28px; }
.rec-controls {
    width: 100%;
    max-width: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap;
}
.rec-controls .cam-btn.rec-icon-btn {
    flex: none;
    width: 52px;
    min-height: 52px;
    height: 52px;
    padding: 0;
    border-radius: 50%;
}
.rec-controls .cam-btn.rec-record { flex: 1 1 auto; min-width: 0; min-height: 52px; }
.rec-controls .cam-btn.rec-skip { flex: none; min-height: 52px; padding: 0 18px; gap: 6px; }
.rec-controls .cam-btn.rec-skip.is-finish:not(:disabled) { background: #2f8f86; border-color: #2f8f86; color: #fff; }
.rec-controls .cam-btn.recording:disabled { opacity: 1; cursor: default; }

@media (max-width: 640px) {
    .rec-hud-top { padding-left: calc(10px + env(safe-area-inset-left, 0px)); padding-right: calc(10px + env(safe-area-inset-right, 0px)); }
    .rec-points { gap: 5px; }
    .rec-chip { min-width: 40px; height: 42px; font-size: 0.7rem; }
    .rec-controls .cam-btn.rec-record { flex: 1 1 auto; padding: 0 14px; }
    .rec-controls .cam-btn.rec-skip { padding: 0 14px; }
}

@media (max-height: 500px) and (orientation: landscape) {
    .rec-chip { height: 36px; }
    .rec-close { width: 36px; height: 36px; }
    .rec-status-row { top: calc(50px + env(safe-area-inset-top, 0px)); }
    .rec-hint { top: calc(82px + env(safe-area-inset-top, 0px)); }
    .rec-point-info { top: calc(50px + env(safe-area-inset-top, 0px)); padding: 10px 14px; }
    .rec-point-info .rec-target-code { font-size: 1.2rem; }
    .rec-point-info .rec-instruction { display: block; font-size: 0.82rem; margin-top: 4px; }
    .rec-hud-bottom { padding-top: 16px; }
    .rec-controls .cam-btn.rec-icon-btn { width: 44px; height: 44px; min-height: 44px; }
    .rec-controls .cam-btn.rec-record,
    .rec-controls .cam-btn.rec-skip { min-height: 44px; }
    .rec-controls { max-width: 560px; }
}
