.ew-diagnostic-page {
    padding-top: 72px;
    padding-bottom: 80px;
}

.ew-diagnostic-page section {
    padding: 0;
}

.ew-diagnostic-hero {
    padding: 100px 0 0;
}

.ew-diagnostic-hero__inner {
    max-width: 620px;
    text-align: center;
}

.ew-diagnostic-hero__eyebrow,
.ew-question-step__eyebrow,
.ew-report-eyebrow {
    margin: 0 0 20px;
    color: var(--ew-accent);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.ew-diagnostic-hero__title {
    margin: 0 0 12px;
    font-size: 28px;
    font-weight: 300;
    line-height: 1.25;
}

.ew-diagnostic-hero__subtitle {
    margin: 0 auto;
    max-width: 620px;
    color: var(--ew-text-secondary);
    font-size: 16px;
    font-style: italic;
    line-height: 1.8;
}

.ew-diagnostic-app {
    width: min(calc(100% - 64px), 620px);
    margin: 0 auto;
}

.ew-diagnostic-app:has(.ew-report-shell--physics) {
    width: min(calc(100% - 64px), 960px);
}

.ew-diagnostic-stack {
    margin: 28px auto 0;
}

.ew-diagnostic-stack--intro {
    max-width: 440px;
    padding: 0 24px;
}

.ew-diagnostic-stack--gate {
    max-width: 440px;
    padding: 0 24px;
    margin-bottom: 64px;
}

.ew-diagnostic-card {
    position: relative;
    overflow: hidden;
    padding: 32px;
    border: 1px solid var(--ew-border-light);
    border-radius: 6px;
    background: var(--ew-bg-card);
}

.ew-diagnostic-card::before {
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, var(--ew-accent), transparent);
    content: "";
}

.ew-diagnostic-card--muted {
    background: var(--ew-bg-elevated);
    border-color: var(--ew-border);
}

.ew-diagnostic-card--centered {
    text-align: center;
}

.ew-diagnostic-card h2,
.ew-diagnostic-card h3 {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 300;
    line-height: 1.25;
}

.ew-diagnostic-card p,
.ew-question-step__description,
.ew-report-body p,
.ew-report-cta p {
    margin: 0 0 14px;
    color: var(--ew-text-secondary);
    font-size: 15px;
    line-height: 1.8;
}

.ew-diagnostic-stack--gate .ew-diagnostic-card h2 {
    font-size: 20px;
    font-weight: 400;
}

.ew-diagnostic-stack--intro .ew-diagnostic-card h2 {
    font-size: 22px;
    font-weight: 300;
}

.ew-question-step .ew-diagnostic-card h2,
.ew-report-title {
    font-size: 22px;
}

.ew-diagnostic-form {
    display: grid;
    gap: 16px;
}

.ew-field {
    display: grid;
    gap: 8px;
}

.ew-field label {
    color: var(--ew-text);
    font-size: 14px;
    font-weight: 400;
}

.ew-field__hint {
    color: var(--ew-text-muted);
    font-size: 12px;
    line-height: 1.6;
}

.ew-field__control {
    width: 100%;
    border: 1px solid var(--ew-border-light);
    border-radius: 4px;
    background: var(--ew-bg);
    color: var(--ew-text);
    font: 300 14px/1.6 var(--ew-font);
    padding: 13px 15px;
    outline: none;
    transition: border-color var(--ew-transition), box-shadow var(--ew-transition), background var(--ew-transition);
}

.ew-field textarea.ew-field__control {
    min-height: 110px;
    resize: vertical;
}

.ew-field select.ew-field__control {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #666666 50%), linear-gradient(135deg, #666666 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 42px;
}

.ew-field__control::placeholder {
    color: var(--ew-text-muted);
}

.ew-field__control:focus {
    border-color: var(--ew-accent);
    box-shadow: 0 0 0 3px rgba(119, 165, 213, 0.1);
}

.ew-field.is-invalid .ew-field__control {
    border-color: var(--ew-danger);
}

.ew-field__error {
    display: none;
    color: var(--ew-danger);
    font-size: 12px;
}

.ew-field.is-invalid .ew-field__error {
    display: block;
}

.ew-feedback {
    padding: 14px 18px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 14px;
}

.ew-feedback--success {
    border-color: rgba(74, 158, 106, 0.3);
    background: rgba(74, 158, 106, 0.1);
    color: var(--ew-success);
}

.ew-feedback--error {
    border-color: rgba(200, 80, 80, 0.25);
    background: rgba(200, 80, 80, 0.1);
    color: var(--ew-danger);
}

.ew-diagnostic-note {
    margin: 0;
    color: var(--ew-text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.ew-problem-followups {
    display: grid;
    gap: 16px;
}

.ew-physics-transition {
    margin: 0 0 10px;
    color: var(--ew-text-muted);
    font-size: 12px;
    font-style: italic;
    line-height: 1.6;
}

.ew-diagnostic-notice {
    padding: 18px 22px;
    border: 1px solid rgba(200, 80, 80, 0.22);
    border-radius: 6px;
    background: rgba(200, 80, 80, 0.09);
}

.ew-diagnostic-notice p {
    margin: 0;
    color: var(--ew-danger);
    font-size: 14px;
}

.ew-diagnostic-progress {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 8px 0 32px;
}

.ew-diagnostic-progress__dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--ew-border-light);
    transition: transform 0.25s ease, background var(--ew-transition);
}

.ew-diagnostic-progress__dot.is-done {
    background: rgba(119, 165, 213, 0.4);
}

.ew-diagnostic-progress__dot.is-active {
    background: var(--ew-accent);
    transform: scale(1.25);
}

.ew-question-step {
    display: none;
}

.ew-question-step.is-active {
    display: block;
}

.ew-question-step__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 28px;
    padding-top: 28px;
    border-top: 1px solid var(--ew-border);
}

.ew-diagnostic-stack--questionnaire {
    margin-top: 40px;
}

.ew-question-step__actions--single {
    justify-content: flex-end;
}

.ew-required {
    color: var(--ew-accent);
}

.ew-range-display {
    margin: 6px 0 2px;
    color: var(--ew-accent);
    font-size: 38px;
    font-weight: 300;
    text-align: center;
}

.ew-range-caption {
    min-height: 1.6em;
    margin-bottom: 12px;
    color: var(--ew-text-muted);
    font-size: 12px;
    text-align: center;
}

.ew-range {
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: var(--ew-border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.ew-range::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 999px;
    background: var(--ew-accent);
    cursor: pointer;
    -webkit-appearance: none;
}

.ew-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 999px;
    background: var(--ew-accent);
    cursor: pointer;
}

.ew-range-labels {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 8px;
    color: var(--ew-text-muted);
    font-size: 11px;
}

.ew-loading-spinner {
    width: 32px;
    height: 32px;
    margin: 0 auto 24px;
    border: 2px solid var(--ew-border-light);
    border-top-color: var(--ew-accent);
    border-radius: 999px;
    animation: ew-spin 0.8s linear infinite;
}

.ew-loading-stage {
    margin-top: 18px;
    color: var(--ew-text-muted);
    font-size: 13px;
}

.ew-loading-elapsed {
    font-variant-numeric: tabular-nums;
    font-size: 28px;
    font-weight: 300;
    letter-spacing: 0.04em;
    color: var(--ew-text-muted);
    margin: 24px 0 8px;
}

.ew-loading-phase {
    color: var(--ew-text-muted);
    font-size: 13px;
    min-height: 1.4em;
    transition: opacity 0.3s ease;
}

.ew-report-title {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--ew-border);
    text-align: center;
}

.ew-report-body h3 {
    margin: 28px 0 10px;
    color: var(--ew-accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.ew-report-body ul {
    margin: 0 0 16px;
    padding-left: 20px;
    color: var(--ew-text-secondary);
}

.ew-report-body li {
    margin-bottom: 8px;
}

.ew-report-cta {
    margin-top: 32px;
    padding: 28px 32px;
    border-left: 3px solid var(--ew-accent);
    border-radius: 0 4px 4px 0;
    background: var(--ew-bg-elevated);
}

.ew-report-cta h3 {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 400;
}

.ew-report-actions {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--ew-border);
}

.ew-diagnostic-progress--physics {
    justify-content: flex-start;
    padding: 0 0 18px;
}

.ew-diagnostic-progress__label {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid var(--ew-border-light);
    border-radius: 999px;
    color: var(--ew-text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ew-diagnostic-questionnaire--physics {
    display: grid;
    gap: 20px;
}

.ew-diagnostic-card--physics-intro {
    padding-bottom: 24px;
}

.ew-physics-context-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.ew-physics-context-grid--required {
    grid-template-columns: 1fr;
    margin: 14px 0 4px;
}

.ew-physics-context-details {
    margin-top: 10px;
    border-top: 1px solid var(--ew-border);
    padding-top: 14px;
}

.ew-physics-context-details summary {
    cursor: pointer;
    color: var(--ew-text-secondary);
    font-size: 14px;
    line-height: 1.6;
    list-style: none;
}

.ew-physics-context-details summary::-webkit-details-marker {
    display: none;
}

.ew-physics-context-details summary::after {
    content: " +";
    color: var(--ew-accent);
}

.ew-physics-context-details[open] summary::after {
    content: " -";
}

.ew-physics-context-details .ew-physics-context-grid {
    margin-top: 16px;
}

.ew-physics-questions {
    display: grid;
    gap: 20px;
}

.ew-physics-question {
    display: block;
}

.ew-physics-question[hidden] {
    display: none;
}

.ew-physics-question .ew-diagnostic-card {
    padding: 38px;
    border-color: var(--ew-border);
    background:
        linear-gradient(180deg, rgba(119, 165, 213, 0.06), transparent 32%),
        var(--ew-bg-card);
}

.ew-physics-question h2 {
    max-width: 32ch;
    margin-bottom: 18px;
    font-size: 30px;
    font-weight: 300;
    line-height: 1.2;
    text-wrap: balance;
}

.ew-physics-question .ew-field label {
    font-size: 15px;
    line-height: 1.5;
}

.ew-physics-question .ew-field__control {
    font-size: 15px;
    line-height: 1.7;
}

.ew-option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ew-option-card {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 16px;
    border: 1px solid var(--ew-border-light);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--ew-text);
    cursor: pointer;
    transition: border-color var(--ew-transition), background var(--ew-transition), transform var(--ew-transition);
}

.ew-option-card:hover {
    border-color: rgba(119, 165, 213, 0.5);
    background: rgba(119, 165, 213, 0.06);
    transform: translateY(-1px);
}

.ew-option-card input {
    margin-top: 3px;
}

.ew-range {
    margin-top: 10px;
}

.ew-artifact-card {
    display: grid;
    gap: 14px;
    padding: 20px;
    margin-top: 16px;
    border: 1px solid var(--ew-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.ew-artifact-card h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.35;
}

.ew-artifact-details {
    margin-top: 16px;
    border-top: 1px solid var(--ew-border);
    padding-top: 14px;
}

.ew-artifact-details summary {
    color: var(--ew-text-secondary);
    font-size: 13px;
    cursor: pointer;
    list-style: none;
}

.ew-artifact-details summary::-webkit-details-marker {
    display: none;
}

.ew-report-shell--physics {
    display: grid;
    gap: 28px;
    max-width: 960px;
    margin: 0 auto;
    color: var(--ew-text);
}

.ew-report-shell--physics .ew-report-section {
    display: grid;
    gap: 14px;
}

.ew-report-shell--physics .ew-report-section h2 {
    margin: 0;
    color: var(--ew-text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.ew-report-shell--physics p {
    margin: 0;
    color: var(--ew-text-secondary);
    font-size: 17px;
    font-weight: 300;
    line-height: 1.9;
}

.ew-report-banner--indicative {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: none;
    border-left: 3px solid var(--ew-border);
    border-radius: 0 6px 6px 0;
    background: rgba(255, 255, 255, 0.03);
    color: var(--ew-text-muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0.01em;
}

.ew-report-banner--indicative::before {
    content: "\25C9";
    flex-shrink: 0;
    color: var(--ew-border);
    font-size: 14px;
}

.ew-knife-sentence--physics {
    margin: 0;
    padding: 28px 30px;
    border: 1px solid rgba(119, 165, 213, 0.26);
    border-radius: 12px;
    background:
        radial-gradient(circle at top left, rgba(119, 165, 213, 0.15), transparent 45%),
        rgba(255, 255, 255, 0.02);
    color: var(--ew-text);
    font-size: clamp(26px, 3.1vw, 34px);
    font-weight: 300;
    line-height: 1.34;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

.ew-evidence-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ew-evidence-list li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: var(--ew-text-secondary);
    font-size: 15px;
    line-height: 1.8;
}

.ew-evidence-tag {
    flex: 0 0 auto;
    min-width: 84px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
}

.ew-evidence-tag--evidenced {
    background: rgba(74, 158, 106, 0.14);
    color: #9fe1b4;
}

.ew-evidence-tag--inferred {
    background: rgba(119, 165, 213, 0.14);
    color: #aacdf0;
}

.ew-evidence-tag--unknown {
    background: rgba(214, 178, 102, 0.14);
    color: #e4ca8e;
}

.ew-move-grid {
    display: grid;
    gap: 14px;
}

.ew-move-block--physics {
    display: grid;
    gap: 10px;
    padding: 20px 22px;
    border: 1px solid var(--ew-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.ew-move-block--physics h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 300;
    line-height: 1.35;
}

.ew-move-kicker {
    color: var(--ew-accent);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.ew-first-deliverable--physics {
    padding: 24px 26px;
    border: 1px solid var(--ew-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.ew-first-deliverable__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    color: var(--ew-text-muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ew-deliverable-content {
    margin: 0;
    padding: 18px;
    border: 1px solid var(--ew-border-light);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
    color: #f2f4f7;
    font: 400 13px/1.75 "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    white-space: pre-wrap;
    overflow-x: auto;
}

.ew-confidence-panel {
    display: grid;
    gap: 10px;
    padding: 20px 22px;
    border: 1px solid var(--ew-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.ew-confidence-panel p {
    font-size: 14px;
    line-height: 1.8;
}

.ew-confidence-panel strong {
    color: var(--ew-text);
    font-weight: 500;
}

.ew-deliverable-table {
    overflow-x: auto;
    margin: 8px 0;
}

.ew-deliverable-table table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    font-size: 14px;
    line-height: 1.7;
}

.ew-deliverable-table th {
    padding: 10px 14px;
    border-bottom: 2px solid var(--ew-border);
    color: var(--ew-text);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
}

.ew-deliverable-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--ew-border-light);
    color: var(--ew-text-secondary);
    vertical-align: top;
}

.ew-deliverable-table tbody tr:last-child td {
    border-bottom: 0;
}

.ew-mermaid-diagram {
    margin: 8px 0;
    padding: 20px;
    border: 1px solid var(--ew-border-light);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.12);
    overflow-x: auto;
    text-align: center;
}

.ew-mermaid-diagram .mermaid {
    margin: 0 auto;
}

/* Hide the ugly mermaid error bomb icon when parsing fails */
.ew-mermaid-diagram .mermaid[data-processed="true"] .error-icon,
.ew-mermaid-diagram .mermaid .error-text {
    display: none !important;
}
.ew-mermaid-diagram--error {
    display: none;
}

.ew-deliverable-formatted {
    color: var(--ew-text-secondary);
    font-size: 15px;
    line-height: 1.8;
}

.ew-deliverable-formatted h3 {
    margin: 18px 0 8px;
    color: var(--ew-text);
    font-size: 15px;
    font-weight: 500;
}

.ew-deliverable-formatted ul {
    margin: 0 0 14px;
    padding-left: 20px;
}

.ew-deliverable-formatted li {
    margin-bottom: 6px;
}

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

@media (max-width: 820px) {
    .ew-diagnostic-app {
        width: min(calc(100% - 40px), 620px);
    }

    .ew-diagnostic-card {
        padding: 28px;
    }

    .ew-physics-question .ew-diagnostic-card {
        padding: 32px;
    }
}

@media (max-width: 600px) {
    .ew-diagnostic-hero {
        padding-top: 100px;
    }

    .ew-diagnostic-hero__subtitle {
        font-size: 15px;
    }

    .ew-diagnostic-stack--intro,
    .ew-diagnostic-stack--gate {
        padding: 0 20px;
    }

    .ew-question-step__actions,
    .ew-report-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .ew-question-step__actions--single {
        align-items: stretch;
    }

    .ew-physics-context-grid,
    .ew-option-grid {
        grid-template-columns: 1fr;
    }

    .ew-physics-question h2 {
        font-size: 24px;
    }

    .ew-knife-sentence--physics {
        padding: 22px 20px;
        font-size: 24px;
    }

    .ew-evidence-list li {
        flex-direction: column;
    }
}
