:root {
    --app-ink: #18312a;
    --app-muted: #64756f;
    --app-brand: #267a56;
    --app-brand-dark: #19563d;
    --app-surface: #ffffff;
    --app-line: #dce9e2;
    --app-bg: #f4f8f6;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--app-ink);
    background: var(--app-bg);
    font-family: "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.65;
    overflow-x: hidden;
}

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

img, svg, canvas, video {
    max-width: 100%;
    height: auto;
}

h1, h2, h3, h4, h5, h6, p, label, td, th, .form-check-label,
.shiny-options-group span, .health-content, .health-status {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

p, li {
    white-space: normal;
}

.container-fluid {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.row {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: .75rem;
}

.shiny-input-container,
.form-group,
.form-check,
.radio,
.checkbox {
    min-width: 0;
    max-width: 100%;
}

#main_page {
    min-height: 72vh;
}

.app-branding {
    max-width: 920px;
    margin: 18px auto 22px !important;
    padding: 18px 16px 8px;
}

.app-branding h1 {
    margin: 0;
    color: var(--app-brand-dark) !important;
    font-size: clamp(28px, 4vw, 40px);
    letter-spacing: 0;
}

.app-branding h5 {
    margin-top: 5px;
    color: var(--app-muted) !important;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .08em;
}

.mode-card {
    max-width: 620px;
    margin: 0 auto 22px;
    padding: 18px 22px !important;
}

.mode-card .shiny-input-container {
    margin: 0;
}

.mode-card .shiny-input-container > label {
    display: block;
    margin-bottom: 8px;
    color: var(--app-muted);
    font-size: 13px;
    letter-spacing: .04em;
}

.mode-card .shiny-options-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.mode-card .radio {
    margin: 0;
}

.mode-card .radio label {
    display: flex;
    align-items: center;
    min-height: 48px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #fbfdfc;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

.mode-card .radio label:has(input:checked) {
    border-color: #6eaf8d;
    background: #edf8f1;
    color: var(--app-brand-dark);
    font-weight: 650;
}

#main_page > .card, #consent_notice {
    max-width: 920px;
    margin: 0 auto;
}

#consent_notice {
    padding: clamp(20px, 4vw, 42px) !important;
}

#consent_notice h3 {
    margin: 0 0 8px;
    color: var(--app-brand-dark);
    font-size: clamp(24px, 3vw, 32px);
    letter-spacing: 0;
}

#consent_notice h4 {
    margin: 26px 0 8px;
    padding-left: 12px;
    border-left: 3px solid #75a98f;
    color: var(--app-brand-dark);
    font-size: 18px;
}

#consent_notice p {
    max-width: 78ch;
    margin: 0 0 12px;
    color: #41534c;
    line-height: 1.9;
}

#consent_notice hr {
    margin: 28px 0;
    border-top: 1px solid var(--app-line);
}

#consent_confirmation {
    margin: 24px 0 14px;
    padding: 14px 16px;
    border: 1px solid #c7ddd0;
    border-radius: 10px;
    background: #f4faf6;
}

#consent_confirmation .checkbox {
    margin: 0;
}

#consent_confirmation label {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: #244437;
    line-height: 1.7;
}

#consent_confirmation input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 4px;
}

.consent-required {
    padding: 12px 14px;
    border-radius: 8px;
    color: #66766f !important;
    background: #fafcfb;
    font-size: 14px;
}

#consent_notice #consent_continue {
    width: 100%;
    min-height: 48px;
    margin-top: 8px;
    font-size: 16px !important;
}

#questionnaire_page > .card, #questionnaire_page > .container-fluid {
    max-width: 920px;
    margin-left: auto;
    margin-right: auto;
}

#questionnaire_page h3 {
    margin-top: 0;
    color: var(--app-brand-dark);
    font-size: clamp(21px, 2.5vw, 28px);
}

#questionnaire_page h5 {
    color: var(--app-brand-dark);
    font-size: 16px;
}

.question-tip {
    border: 1px solid #d8e7f1;
    border-left: 4px solid #6c9fbe;
    border-radius: 8px;
    background: #f5f9fc;
    color: #50616b;
}

.shiny-options-group .radio label,
.shiny-options-group .checkbox label,
.shiny-input-container .form-check {
    min-height: 48px;
    height: auto;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    border: 1px solid transparent;
    transition: border-color .15s ease, background-color .15s ease;
}

.shiny-options-group label.selected {
    border-color: #6eaf8d;
    background: #edf8f1;
}

.shiny-options-group input[type="radio"],
.shiny-options-group input[type="checkbox"],
.shiny-input-container .form-check-input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    accent-color: var(--app-brand);
}

.card, .well {
    border: 1px solid var(--app-line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(24, 49, 42, 0.06);
    background: var(--app-surface);
}

.btn {
    min-height: 42px;
    border-radius: 8px !important;
    border: 1px solid transparent;
    font-weight: 600;
    transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}

.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid rgba(38, 122, 86, .25);
    outline-offset: 2px;
}

.btn-success {
    background: var(--app-brand);
    border-color: var(--app-brand);
}

.btn-success:hover {
    background: var(--app-brand-dark);
    border-color: var(--app-brand-dark);
    transform: translateY(-1px);
}

.shiny-input-container {
    margin-bottom: 18px;
}

.shiny-input-container > label, .form-label {
    color: var(--app-ink);
    font-weight: 650;
}

input.form-control, select.form-control, textarea.form-control {
    min-height: 42px;
    border: 1px solid #c8d9d0;
    border-radius: 8px;
    box-shadow: none;
    max-width: 100%;
    width: 100%;
    height: auto;
    overflow-wrap: anywhere;
}

textarea.form-control {
    min-height: 92px;
    resize: vertical;
}

.btn {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.table-responsive, .table {
    max-width: 100%;
    overflow-x: auto;
}

input.form-control:focus, select.form-control:focus, textarea.form-control:focus {
    border-color: var(--app-brand);
    box-shadow: 0 0 0 3px rgba(38, 122, 86, .12);
}

@media (max-width: 640px) {
    .container-fluid {
        width: min(100% - 20px, 1180px);
        padding-top: 14px;
    }

    .mode-card .shiny-options-group {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 16px !important;
    }

    #consent_notice {
        padding: 20px 16px !important;
    }

    #consent_notice h4 {
        margin-top: 22px;
        font-size: 17px;
    }

    #consent_notice p {
        line-height: 1.8;
        text-align: left;
    }

    .btn {
        width: 100%;
        margin-bottom: 8px;
    }

    .shiny-options-group .radio label,
    .shiny-options-group .checkbox label,
    .shiny-input-container .form-check {
        align-items: flex-start;
        padding: 10px 12px;
        line-height: 1.55;
    }

    .shiny-options-group input[type="radio"],
    .shiny-options-group input[type="checkbox"],
    .shiny-input-container .form-check-input {
        margin-top: 3px;
    }
}
