:root {
    --primary: #0B4F8A;
    --primary-dark: #073661;
    --accent: #1D70B8;
    --accent-bright: #2563EB;
    --accent-soft: #EFF6FF;
    --accent-border: #BFDBFE;
    --bg: #F4F7FB;
    --card-bg: #FFFFFF;
    --surface-subtle: #F8FAFC;
    --text: #0F172A;
    --text-secondary: #334155;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --border-strong: #CBD5E1;
    --danger: #DC2626;
    --danger-dark: #B91C1C;
    --success: #0F766E;
    --success-soft: #F0FDFA;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(11, 79, 138, 0.04);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.07), 0 10px 28px rgba(11, 79, 138, 0.06);
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

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

html {
    font-size: 17px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Plus Jakarta Sans", "Google Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.012em;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 0 18px;
}

/* Compact VIP Seamless White-to-Royal-Blue Linear Header */
.app-header {
    --hdr-max: 1320px;
    --hdr-edge: max(20px, calc((100% - var(--hdr-max)) / 2 + 20px));
    position: relative;
    background: linear-gradient(
        98deg,
        #FFFFFF 0px,
        #FFFFFF calc(var(--hdr-edge) + 250px),
        #EEF6FF calc(var(--hdr-edge) + 295px),
        #8EC0EE calc(var(--hdr-edge) + 340px),
        #1560A8 calc(var(--hdr-edge) + 400px),
        #0B4F8A 66%,
        #07315A 100%
    );
    border-bottom: 3px solid #1D70B8;
    box-shadow: 0 4px 18px rgba(7, 49, 90, 0.10);
}

.vip-header-inner {
    width: 100%;
    max-width: var(--hdr-max);
    margin: 0 auto;
    padding: 0 20px;
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
}

.header-logo-zone {
    width: 250px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 10px 0;
}

.header-logo {
    height: 58px;
    width: auto;
    max-width: 240px;
    display: block;
    object-fit: contain;
}

.header-content-zone {
    flex: 1;
    min-width: 0;
    padding: 12px 0 12px 165px;
    color: #FFFFFF;
}

.app-title {
    margin: 0 0 3px;
    font-size: clamp(1.12rem, 1.8vw, 1.38rem);
    font-weight: 800;
    color: #FFFFFF;
    line-height: 1.22;
    letter-spacing: -0.015em;
    overflow-wrap: break-word;
}

.app-subtitle {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(240, 249, 255, 0.92);
    line-height: 1.38;
    font-weight: 500;
    overflow-wrap: break-word;
}

@media (max-width: 860px) {
    .app-header {
        background: #07315A;
        border-bottom: 2px solid #1D70B8;
    }
    .vip-header-inner {
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        min-height: 0;
    }
    .header-logo-zone {
        width: 100%;
        padding: 10px 18px;
        background: linear-gradient(90deg, #FFFFFF 0%, #FFFFFF 64%, #DCEBFA 84%, #0B4F8A 100%);
        border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    }
    .header-logo {
        height: 44px;
        max-width: 190px;
    }
    .header-content-zone {
        padding: 11px 18px 13px;
        background: linear-gradient(90deg, #0B4F8A 0%, #07315A 100%);
    }
    .app-title {
        font-size: 1.06rem;
        margin-bottom: 2px;
    }
    .app-subtitle {
        font-size: 0.79rem;
        line-height: 1.35;
    }
}

/* Sticky Progress & Participant Bar */
.progress-wrapper {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.participant-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #F1F5F9;
    flex-wrap: wrap;
}

.participant-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.participant-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #FFFFFF;
    font-weight: 800;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.participant-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.participant-text strong {
    font-size: 0.88rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.participant-text span {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.edit-participant-btn {
    background: var(--surface-subtle);
    color: var(--primary);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.edit-participant-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.step-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 0;
}

.autosave-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--success);
    background: var(--success-soft);
    border: 1px solid #99F6E4;
    padding: 3px 10px;
    border-radius: 999px;
    flex-shrink: 0;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: #E2E8F0;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent-bright) 100%);
    border-radius: 999px;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main Content */
.main-content {
    flex: 1;
    padding-top: 24px;
    padding-bottom: 44px;
}

.step-section {
    display: none;
    animation: stepFade 0.22s ease-out;
}

.step-section.active {
    display: block;
}

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

/* Section Banner */
.section-header {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-left: 5px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-xs);
}

.section-tag {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--primary);
    border: 1px solid var(--accent-border);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 3px 10px;
    border-radius: 6px;
    margin-bottom: 6px;
}

.section-header h2 {
    margin: 0 0 4px;
    font-size: clamp(1.15rem, 2.2vw, 1.35rem);
    color: var(--text);
    font-weight: 800;
    line-height: 1.3;
    overflow-wrap: break-word;
}

.section-desc {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    overflow-wrap: break-word;
}

/* Login Screen */
.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.login-header h2 {
    margin: 4px 0 8px;
    font-size: 1.35rem;
    color: var(--text);
    font-weight: 800;
}

.login-header p {
    margin: 0 0 22px;
    font-size: 0.92rem;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 16px;
}

.field-label {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.req {
    color: var(--danger);
}

.opt {
    font-weight: 500;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.login-error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.login-submit-btn {
    width: 100%;
    margin-top: 8px;
}

/* Question Card — Zero Overflow Architecture */
.question-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease;
}

.question-card:focus-within {
    border-color: #93C5FD;
}

.question-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 4px;
}

.question-header-row .question-title {
    flex: 1;
    min-width: 0;
    margin-bottom: 2px;
}

.question-title {
    display: block;
    font-size: 1.04rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.42;
    margin-bottom: 6px;
    overflow-wrap: break-word;
    word-break: normal;
}

.selection-counter {
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--primary);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.selection-counter.limit-reached {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

@media (max-width: 520px) {
    .question-header-row {
        flex-direction: column;
        gap: 6px;
    }
}

.question-hint {
    margin: 0 0 14px;
    font-size: 0.84rem;
    color: var(--text-muted);
    font-weight: 500;
}

.question-quote {
    margin: 0 0 16px;
    padding: 14px 16px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 0 12px 12px 0;
    font-size: 0.94rem;
    color: var(--text-secondary);
    line-height: 1.5;
    overflow-wrap: break-word;
}

/* Option Cards */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    min-width: 0;
    padding: 14px 16px;
    background: var(--surface-subtle);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.option-card:hover {
    border-color: #93C5FD;
    background: #FFFFFF;
}

.option-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-card.selected {
    border-color: var(--accent-bright);
    background-color: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent-bright);
}

.option-card.disabled-option {
    opacity: 0.48;
}

.option-indicator {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-top: 2px;
    border: 2px solid #94A3B8;
    background: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.16s ease;
}

.radio-dot {
    border-radius: 50%;
}

.check-box {
    border-radius: 6px;
}

.option-card.selected .option-indicator {
    border-color: var(--accent-bright);
    background: var(--accent-bright);
}

.option-card.selected .radio-dot::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #FFFFFF;
}

.option-card.selected .check-box::after {
    content: "✓";
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
}

.option-text {
    flex: 1;
    min-width: 0;
    font-size: 0.96rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.45;
    overflow-wrap: break-word;
    word-break: normal;
}

.option-card.selected .option-text {
    font-weight: 700;
    color: var(--primary-dark);
}

/* Inputs & Textareas */
.text-input,
.textarea-input {
    width: 100%;
    font-family: inherit;
    font-size: 0.98rem;
    color: var(--text);
    background: var(--surface-subtle);
    border: 1.5px solid var(--border-strong);
    border-radius: 12px;
    padding: 13px 16px;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.text-input:focus,
.textarea-input:focus {
    outline: none;
    background: #FFFFFF;
    border-color: var(--accent-bright);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.textarea-input {
    min-height: 128px;
    resize: vertical;
    line-height: 1.55;
}

/* Dictation Button */
.dictate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 18px;
    margin-bottom: 10px;
    background: var(--accent-soft);
    color: var(--primary);
    border: 1.5px solid var(--accent-border);
    border-radius: 11px;
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.dictate-btn:hover {
    background: #DBEAFE;
    border-color: var(--accent);
}

.dictate-btn.listening {
    background: var(--danger);
    border-color: var(--danger-dark);
    color: #FFFFFF;
    animation: pulseRed 1.5s infinite;
}

@keyframes pulseRed {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
    70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.mic-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.dictate-status {
    font-size: 0.84rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.dictate-status.active {
    color: var(--danger);
    font-weight: 700;
}

.dictate-status.info {
    color: var(--primary);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    padding: 9px 12px;
    border-radius: 9px;
    margin-bottom: 10px;
}

/* Bottom Navigation Bar */
.nav-bar {
    display: flex;
    gap: 12px;
    margin-top: 26px;
    padding: 14px 16px;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 12px 20px;
    border-radius: 11px;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.16s ease;
    -webkit-tap-highlight-color: transparent;
}

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

.btn-primary {
    background: var(--primary);
    color: #FFFFFF;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #FFFFFF;
    color: var(--text-secondary);
    border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-subtle);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-submit {
    background: var(--success);
    color: #FFFFFF;
}

.btn-submit:hover:not(:disabled) {
    background: #115E59;
}

.hidden {
    display: none !important;
}

/* Success Screen */
.success-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 26px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.success-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success);
    border: 2px solid #99F6E4;
    font-size: 2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-card h2 {
    margin: 0 0 10px;
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 800;
}

.success-card p {
    margin: 0 0 14px;
    color: var(--text-secondary);
}

.success-meta {
    display: inline-block;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.84rem;
    color: var(--text-muted);
    margin-bottom: 24px !important;
}

/* Toast */
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(20px);
    background: #0F172A;
    color: #FFFFFF;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 100;
    max-width: calc(100% - 32px);
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Footer */
.app-footer {
    background: #FFFFFF;
    border-top: 1px solid var(--border);
    padding: 16px 0;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.app-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.admin-link:hover {
    text-decoration: underline;
}

@media (min-width: 640px) {
    .login-card {
        padding: 36px 36px;
    }
    .question-card {
        padding: 26px 26px;
    }
    .dictate-btn {
        width: auto;
        min-width: 230px;
    }
}
