/* ===== 자가진단 페이지 ===== */
.sd-wrap {
    --sd-text: #222;
    --sd-sub: #8a8f98;
    --sd-line: #d9dce3;
    --sd-point: #222;
    --sd-red: #e5231b;
    --sd-chip: #eef1f8;
    --sd-card: #f1f4fb;
    --sd-bg: #fafbfe;
    --sd-frame: #ffd7ba;

    box-sizing: border-box;
    max-width: 1300px;
    margin: 0 auto;
    padding: 16px 16px 60px;
    color: var(--sd-text);
    font-size: 16px;
    line-height: 1.5;
}
.sd-wrap *, .sd-wrap *::before, .sd-wrap *::after { box-sizing: border-box; }

.sd-wrap ul { list-style: none; margin: 0; padding: 0; }
.sd-wrap input[type=radio] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.sd-star { color: var(--sd-red); margin-right: 2px; }
.sd-required-note {
    margin: 0 0 8px;
    text-align: right;
    font-size: 13px;
    color: var(--sd-red);
}

/* 기본 정보 박스 */
.sd-box {
    padding: 36px 36px 28px;
    background: #fff;
    border: 7px solid var(--sd-frame);
    border-radius: 18px;
}
.sd-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 60px;
}
.sd-field {
    display: grid;
    grid-template-columns: 130px 1fr;
    align-items: center;
    gap: 8px;
    min-height: 56px;
}
.sd-label {
    font-weight: 700;
    font-size: 17px;
}
.sd-control {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

/* 토글 버튼 (성별 / 본인여부) */
.sd-toggle-group { display: flex; flex-wrap: wrap; gap: 10px; }
.sd-toggle { cursor: pointer; }
.sd-toggle span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    min-width: 88px;
    padding: 0 26px;
    background: var(--sd-chip);
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 18px;
    color: #6d7280;
    transition: background .15s, border-color .15s, color .15s;
}
.sd-toggle input:checked + span {
    background: #fff;
    border-color: var(--sd-point);
    color: var(--sd-text);
    font-weight: 700;
}
.sd-toggle input:focus-visible + span,
.sd-radio input:focus-visible + span,
.sd-test input:focus-visible + .sd-test-inner {
    outline: 2px solid #3b6cff;
    outline-offset: 2px;
}

/* 입력 / 셀렉트 */
.sd-input,
.sd-select {
    width: 100%;
    height: 56px;
    padding: 0 14px;
    background: #fff;
    border: 1px solid var(--sd-line);
    border-radius: 4px;
    font-size: 17px;
    font-family: inherit;
    color: var(--sd-text);
}
.sd-input::placeholder { color: #aab0bb; }
.sd-input:focus,
.sd-select:focus {
    outline: none;
    border-color: var(--sd-point);
}
.sd-input-age { width: 150px; }
.sd-unit { font-size: 17px; color: #6d7280; }
.sd-control-select .sd-select { flex: 1 1 0; min-width: 0; }
.sd-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23333' stroke-width='1.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

/* 개인정보 동의 */
.sd-privacy {
    margin-top: 24px;
    padding: 24px 28px;
    background: #fff;
    border: 1px solid var(--sd-line);
    border-radius: 12px;
}
.sd-privacy-title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
}
.sd-privacy-text {
    max-height: 150px;
    overflow-y: auto;
    padding: 16px 18px;
    background: var(--sd-bg);
    border: 1px solid #e8ebf2;
    border-radius: 6px;
    font-size: 14px;
    color: #555;
    line-height: 1.7;
}
.sd-privacy-text p { margin: 0 0 8px; }
.sd-privacy-text p:last-child { margin-bottom: 0; }
.sd-agree {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 28px;
    margin-top: 16px;
    justify-content: flex-end;
}
.sd-radio { cursor: pointer; }
.sd-radio span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}
.sd-radio span::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #b8bdc8;
    border-radius: 50%;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.sd-radio input:checked + span { font-weight: 700; }
.sd-radio input:checked + span::before {
    border-color: var(--sd-point);
    box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 10px var(--sd-point);
}

/* 자가검진 선택 */
.sd-select-area {
    margin-top: 48px;
    padding: 48px 40px 44px;
    background: var(--sd-bg);
    border-radius: 16px;
}
.sd-title {
    margin: 0;
    text-align: center;
    font-size: 26px;
    font-weight: 700;
}
.sd-hint {
    margin: 36px 0 12px;
    text-align: right;
    font-size: 14px;
    color: #555;
}
.sd-test-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px 22px;
}
.sd-test { display: block; cursor: pointer; height: 100%; }
.sd-test-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 100%;
    min-height: 178px;
    padding: 22px 10px;
    background: var(--sd-card);
    border: 2px solid transparent;
    border-radius: 8px;
    text-align: center;
    transition: border-color .15s, background .15s;
}
.sd-test:hover .sd-test-inner { border-color: #cfd6e8; }
.sd-test input:checked + .sd-test-inner {
    background: #fff;
    border-color: var(--sd-point);
}
.sd-test-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
    object-fit: contain;
}
.sd-test-name { font-size: 19px; font-weight: 500; }
.sd-test-sub {
    font-style: normal;
    font-size: 15px;
    color: var(--sd-sub);
}

/* 제출 버튼 */
.sd-submit-wrap { margin-top: 40px; text-align: center; }
.sd-submit {
    min-width: 240px;
    height: 58px;
    padding: 0 40px;
    background: var(--sd-point);
    border: 0;
    border-radius: 6px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}
.sd-submit:hover { background: #000; }
.sd-submit:focus-visible { outline: 2px solid #3b6cff; outline-offset: 3px; }

/* ===== 반응형 ===== */
@media (max-width: 1100px) {
    .sd-grid { gap: 20px 32px; }
    .sd-field { grid-template-columns: 110px 1fr; }
    .sd-test-list { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
    .sd-grid { grid-template-columns: 1fr; gap: 16px; }
    .sd-field { grid-template-columns: 120px 1fr; }
    .sd-test-list { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
    .sd-wrap { padding: 12px 12px 40px; }
    .sd-box { padding: 22px 16px; border-width: 5px; border-radius: 14px; }
    .sd-field {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .sd-label { font-size: 16px; }
    .sd-toggle span { height: 48px; font-size: 16px; padding: 0 20px; }
    .sd-input, .sd-select { height: 50px; font-size: 16px; }
    .sd-input-age { width: 120px; }
    .sd-control-select { flex-direction: column; align-items: stretch; }

    .sd-privacy { padding: 18px 16px; }
    .sd-agree { justify-content: flex-start; flex-direction: column; gap: 12px; }

    .sd-select-area { margin-top: 32px; padding: 32px 14px 28px; }
    .sd-title { font-size: 22px; }
    .sd-hint { margin-top: 24px; }
    .sd-test-list { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .sd-test-inner { min-height: 150px; padding: 16px 8px; }
    .sd-test-icon { width: 40px; height: 40px; }
    .sd-test-name { font-size: 16px; }
    .sd-test-sub { font-size: 13px; }
    .sd-submit { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .sd-wrap * { transition: none !important; }
}
