.faf-wrap,
.faf-wrap * {
    box-sizing: border-box;
}

.faf-wrap {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    color: #242424;
    font-family: Arial, Helvetica, sans-serif;
}

.faf-intro {
    margin: 0 0 20px;
    padding: 16px 18px;
    border-left: 4px solid #2f6f89;
    border-radius: 8px;
    background: #f4f8fa;
    color: #2f4658;
    font-size: 17px;
    line-height: 1.55;
}

.faf-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
    counter-reset: faf-step;
}

.faf-stepper {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 2px;
}

.faf-stepper-button {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    border: 1px solid #dbe1e6;
    border-radius: 8px;
    padding: 10px 12px;
    background: #ffffff;
    color: #53626f;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
}

.faf-stepper-button span:first-child {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #edf1f4;
    color: #2f4658;
    font-size: 13px;
}

.faf-stepper-button span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.faf-stepper-button.is-active {
    border-color: #2f6f89;
    color: #1f2933;
    box-shadow: 0 0 0 3px rgba(47, 111, 137, 0.12);
}

.faf-stepper-button.is-active span:first-child,
.faf-stepper-button.is-complete span:first-child {
    background: #2f6f89;
    color: #ffffff;
}

.faf-js .faf-section {
    display: none;
}

.faf-js .faf-section.is-active {
    display: block;
}

.faf-wrap [hidden] {
    display: none !important;
}

.faf-section {
    counter-increment: faf-step;
    max-width: 100%;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2e5e8;
    border-radius: 8px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(30, 39, 46, 0.06);
}

.faf-section h2 {
    margin: 0 0 18px;
    color: #1f2933;
    font-size: 24px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.faf-section h2::before {
    content: counter(faf-step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-right: 12px;
    border-radius: 50%;
    background: #2f6f89;
    color: #ffffff;
    font-size: 17px;
    font-weight: 800;
    vertical-align: middle;
}

.faf-js .faf-section h2::before {
    content: attr(data-faf-step-number);
}

.faf-section-note {
    margin: -8px 0 18px;
    color: #53626f;
    font-size: 16px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

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

.faf-full {
    display: block;
    margin-top: 16px;
}

.faf-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-weight: 700;
    color: #28323b;
}

.faf-form label span,
.faf-form small {
    font-size: 15px;
}

.faf-form input[type="text"],
.faf-form input[type="tel"],
.faf-form input[type="number"],
.faf-form input[type="date"],
.faf-form input[type="time"],
.faf-form input[type="file"],
.faf-form select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 48px;
    border: 1px solid #cfd6dc;
    border-radius: 7px;
    padding: 10px 12px;
    background: #ffffff;
    color: #1f2933;
    font-size: 17px;
    line-height: 1.25;
}

.faf-form input[type="file"] {
    min-height: auto;
    overflow: hidden;
}

.faf-form input:focus,
.faf-form select:focus {
    border-color: #2f6f89;
    box-shadow: 0 0 0 3px rgba(47, 111, 137, 0.14);
    outline: none;
}

.faf-form input::placeholder {
    color: #7c8a96;
}

.faf-file small {
    color: #61717f;
    font-weight: 400;
}

.faf-photo-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    margin-top: 16px;
    border: 1px dashed #b9c3cc;
    border-radius: 8px;
    background: #f7f9fa;
    color: #61717f;
    overflow: hidden;
}

.faf-photo-preview img {
    width: 100%;
    max-height: 340px;
    object-fit: contain;
}

.faf-photo-adjustments {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
    padding: 14px;
    border: 1px solid #dbe1e6;
    border-radius: 8px;
    background: #f8fafb;
}

.faf-photo-adjustments[hidden] {
    display: none !important;
}

.faf-photo-adjustments label {
    gap: 10px;
}

.faf-photo-adjustments input[type="range"] {
    width: 100%;
}

.faf-mentions,
.faf-radio-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.faf-mentions label,
.faf-radio-group label,
.faf-text-card,
.faf-condolence-card {
    cursor: pointer;
}

.faf-mentions label,
.faf-radio-group label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #dbe1e6;
    border-radius: 7px;
    background: #f8fafb;
    font-weight: 600;
    min-width: 0;
    overflow-wrap: anywhere;
}

.faf-mentions input,
.faf-radio-group input,
.faf-text-card input,
.faf-condolence-card input {
    flex: 0 0 auto;
    accent-color: #2f6f89;
}

.faf-generated-line {
    margin: 14px 0 0;
    color: #53626f;
    font-size: 16px;
    overflow-wrap: anywhere;
}

.faf-text-options {
    display: grid;
    gap: 14px;
}

.faf-text-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 12px;
    padding: 16px;
    border: 1px solid #dbe1e6;
    border-radius: 8px;
    background: #fbfcfd;
    min-width: 0;
}

.faf-text-card:has(input:checked) {
    border-color: #2f6f89;
    box-shadow: 0 0 0 3px rgba(47, 111, 137, 0.14);
}

.faf-text-card strong {
    font-size: 18px;
}

.faf-text-card span {
    grid-column: 1 / -1;
    max-height: 230px;
    overflow: auto;
    padding-right: 6px;
    white-space: pre-line;
    color: #35424d;
    font-size: 16px;
    line-height: 1.6;
}

.faf-card-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.faf-condolence-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 2px solid #dbe1e6;
    border-radius: 8px;
    background: #ffffff;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    min-width: 0;
}

.faf-condolence-card input {
    position: absolute;
    top: 12px;
    left: 12px;
}

.faf-condolence-card img,
.faf-mix-visual {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 6px;
    object-fit: cover;
    background: #edf1f4;
}

.faf-mix-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2f4658;
    font-size: 42px;
    font-weight: 800;
}

.faf-condolence-card span:last-child {
    color: #26323d;
    font-size: 16px;
    font-weight: 800;
    text-align: center;
}

.faf-condolence-card:has(input:checked) {
    border-color: #2f6f89;
    box-shadow: 0 0 0 3px rgba(47, 111, 137, 0.16);
}

.faf-card-preview {
    margin-top: 18px;
}

.faf-card-preview h3 {
    margin: 0 0 12px;
    color: #1f2933;
    font-size: 20px;
}

.faf-card-preview p {
    margin: 10px 0 0;
    color: #53626f;
    font-size: 15px;
}

.faf-card-canvas-wrap {
    border: 1px solid #d7dde2;
    border-radius: 8px;
    overflow: hidden;
    background: #eef3f6;
}

.faf-card-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: auto;
}

.faf-canvas-wrap {
    max-width: 560px;
    margin: 0 auto 16px;
    border: 1px solid #d7dde2;
    border-radius: 8px;
    overflow: hidden;
    background: #eef3f6;
}

.faf-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: auto;
}

.faf-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-top: -4px;
    padding-bottom: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), #ffffff 34%);
}

.faf-button {
    min-height: 52px;
    border: 0;
    border-radius: 7px;
    padding: 13px 24px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 800;
}

.faf-button-primary {
    background: #2f6f89;
    color: #ffffff;
}

.faf-button-secondary {
    background: #e7edf1;
    color: #233442;
}

.faf-button[hidden] {
    display: none !important;
}

.faf-notice {
    margin: 0 0 18px;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 700;
}

.faf-notice-success {
    background: #e8f6ee;
    color: #1f6a3d;
}

.faf-notice-error {
    background: #fdecec;
    color: #8d2525;
}

@media (max-width: 720px) {
    .faf-wrap {
        width: calc(100vw - 60px);
        max-width: 100%;
    }

    .faf-intro {
        margin-bottom: 16px;
        padding: 14px 16px;
        font-size: 16px;
    }

    .faf-section {
        padding: 16px;
    }

    .faf-stepper {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .faf-stepper-button {
        display: none;
    }

    .faf-stepper-button.is-active {
        display: flex;
    }

    .faf-stepper-button {
        padding: 9px 10px;
    }

    .faf-grid,
    .faf-mentions,
    .faf-radio-group,
    .faf-photo-adjustments,
    .faf-card-gallery {
        grid-template-columns: 1fr;
    }

    .faf-section h2 {
        font-size: 21px;
    }

    .faf-section h2::before {
        width: 30px;
        height: 30px;
        font-size: 15px;
    }

    .faf-form input[type="text"],
    .faf-form input[type="tel"],
    .faf-form input[type="number"],
    .faf-form input[type="date"],
    .faf-form input[type="time"],
    .faf-form input[type="file"],
    .faf-form select {
        min-height: 56px;
        font-size: 16px;
    }

    .faf-mentions label,
    .faf-radio-group label {
        min-height: 58px;
        padding: 13px 14px;
        font-size: 18px;
    }

    .faf-text-card {
        padding: 14px;
    }

    .faf-text-card span {
        max-height: 300px;
        font-size: 15px;
        line-height: 1.55;
    }

    .faf-card-gallery {
        gap: 12px;
    }

    .faf-condolence-card {
        padding: 10px;
    }

    .faf-condolence-card img,
    .faf-mix-visual {
        aspect-ratio: 16 / 10;
    }

    .faf-actions {
        flex-direction: column-reverse;
        justify-content: stretch;
        padding: 14px 0 0;
    }

    .faf-button {
        width: 100%;
    }
}
