:root {
    --accent: #eb6f95;
    --accent-dark: #d6547d;
    --accent-soft: #fff0f4;
    --accent-pale: #fff8fa;
    --cream: #fff8df;
    --mint: #eaf7f1;
    --blue-soft: #eef5ff;
    --ink: #29262a;
    --muted: #746d72;
    --line: #ebe5e7;
    --surface: #ffffff;
    --page: #f7f7f5;
    --shadow: 0 16px 42px rgba(67, 47, 55, .09);
    --shadow-soft: 0 8px 24px rgba(67, 47, 55, .07);
    --radius: 8px;
}

* {
    box-sizing: border-box;
    letter-spacing: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--page);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.65;
}

a {
    color: var(--accent-dark);
    text-decoration: none;
}

a:hover {
    color: #bb3f68;
}

.btn {
    min-height: 42px;
    padding: .62rem 1rem;
    border-radius: 7px !important;
    border-width: 1px;
    font-weight: 700;
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #f18eaa, var(--accent));
    border-color: var(--accent);
    box-shadow: 0 8px 20px rgba(235, 111, 149, .2);
}

.btn-primary:hover,
.btn-primary:focus {
    color: #fff;
    background: linear-gradient(135deg, #e97899, var(--accent-dark));
    border-color: var(--accent-dark);
    box-shadow: 0 10px 24px rgba(214, 84, 125, .25);
}

.btn-outline-primary {
    color: var(--accent-dark);
    background: #fff;
    border-color: #efb0c3;
}

.btn-outline-primary:hover {
    color: #a9365a;
    background: var(--accent-soft);
    border-color: var(--accent);
}

.btn-light {
    color: #4d474b;
    background: #fff;
    border-color: var(--line);
}

.btn-light:hover {
    background: #fbf9fa;
    border-color: #ddd3d7;
}

.form-label {
    margin-bottom: .45rem;
    color: #474146;
    font-size: .92rem;
    font-weight: 700;
}

.form-control,
.form-select {
    min-height: 46px;
    padding: .68rem .85rem;
    color: var(--ink);
    background-color: #fff;
    border: 1px solid var(--line);
    border-radius: 7px !important;
    box-shadow: none;
}

textarea.form-control {
    min-height: auto;
}

.form-control:hover,
.form-select:hover {
    border-color: #dcd2d6;
}

.form-control:focus,
.form-select:focus {
    border-color: #ee9eb6;
    box-shadow: 0 0 0 .2rem rgba(235, 111, 149, .12);
}

.alert,
.accordion-item {
    border-radius: var(--radius) !important;
}

.sky-decor {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.cloud {
    position: absolute;
    width: 110px;
    height: 28px;
    border: 1px solid rgba(235, 111, 149, .08);
    border-radius: 50px;
    background: rgba(255, 255, 255, .46);
}

.cloud::before,
.cloud::after {
    position: absolute;
    content: "";
    border: 1px solid rgba(235, 111, 149, .08);
    border-bottom: 0;
    border-radius: 50% 50% 0 0;
    background: rgba(255, 255, 255, .46);
}

.cloud::before {
    width: 43px;
    height: 31px;
    left: 18px;
    top: -18px;
}

.cloud::after {
    width: 34px;
    height: 23px;
    right: 17px;
    top: -11px;
}

.cloud-a {
    top: 150px;
    left: 3%;
}

.cloud-b {
    top: 420px;
    right: 5%;
    transform: scale(.75);
}

.star {
    position: absolute;
    color: #e4bd4c;
    font-size: 14px;
    opacity: .35;
}

.star-a {
    top: 125px;
    right: 13%;
}

.star-b {
    top: 470px;
    left: 9%;
}

.app-navbar {
    min-height: 66px;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
}

.navbar-brand strong {
    font-size: 1.15rem;
    font-weight: 850;
}

.brand-mark,
.brand-badge {
    display: none !important;
}

.site-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 6px;
}

.nav-link {
    color: #625b60;
    font-size: .94rem;
    font-weight: 650;
}

.nav-link:hover {
    color: var(--accent-dark);
}

.user-link {
    display: flex;
    align-items: center;
    gap: 7px;
}

.user-link img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.main-shell {
    max-width: 1180px;
}

.intro-band {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    padding: 30px 0 20px;
}

.eyebrow,
.page-title > span {
    display: inline-block;
    color: var(--accent-dark);
    font-size: .84rem;
    font-weight: 800;
}

.intro-band h1,
.page-title h1 {
    margin: 8px 0 10px;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 900;
    line-height: 1.18;
}

.intro-band p,
.page-title p {
    max-width: 720px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1rem;
}

.trust-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.trust-list span {
    padding: 7px 11px;
    color: #5f585d;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: .8rem;
    white-space: nowrap;
}

.generator-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.58fr) minmax(320px, .82fr);
    gap: 20px;
    align-items: start;
    margin-top: 16px;
}

.workbench,
.settings-panel,
.result-section,
.login-panel,
.form-panel,
.pay-panel,
.feedback-box,
.install-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.workbench,
.settings-panel,
.result-section {
    padding: 22px;
}

.settings-panel {
    position: sticky;
    top: 82px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.section-heading > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-heading h1,
.section-heading h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 850;
}

.section-heading p {
    margin: 4px 0 0;
    color: var(--muted);
}

.section-heading small {
    color: var(--muted);
}

.section-heading.compact {
    margin-bottom: 12px;
}

.step-no {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: var(--accent-dark);
    background: var(--accent-soft);
    border-radius: 6px;
    font-size: .84rem;
    font-weight: 900;
}

.upload-zone {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 480px;
    height: min(61vh, 610px);
    overflow: hidden;
    cursor: pointer;
    background: #fafaf9;
    border: 1px dashed #d8cdd1;
    border-radius: 7px;
    transition: border-color .2s ease, background .2s ease;
}

.upload-zone:hover {
    background: var(--accent-pale);
    border-color: #e89ab2;
}

.upload-zone input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.upload-zone > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    max-width: 300px;
    padding: 28px;
    text-align: center;
    color: var(--muted);
}

.upload-zone strong {
    color: var(--ink);
    font-size: 1.05rem;
}

.upload-zone small {
    font-size: .84rem;
}

.upload-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    color: var(--accent-dark);
    background: var(--accent-soft);
    border: 1px solid #f5d2dc;
    border-radius: 50%;
    font-size: 27px;
    line-height: 1;
}

.upload-zone img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.upload-zone #changePhoto {
    position: absolute;
    right: 14px;
    bottom: 14px;
}

.setting-group {
    padding-bottom: 17px;
    margin-bottom: 17px;
    border-bottom: 1px solid #f0ebed;
}

.color-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.color-choice {
    padding: 8px 4px;
    cursor: pointer;
    text-align: center;
    border: 1px solid transparent;
    border-radius: 7px;
}

.color-choice:hover {
    background: #faf7f8;
}

.color-choice input {
    position: absolute;
    opacity: 0;
}

.swatch {
    display: block;
    width: 34px;
    height: 34px;
    margin: 0 auto 5px;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #ddd4d8;
}

.color-choice input:checked + .swatch {
    box-shadow: 0 0 0 3px var(--accent);
}

.bg-white { background: #fff; }
.bg-red { background: #d94b52; }
.bg-blue { background: #4a84cf; }
.bg-gray { background: #9aa0a6; }

.switch-row {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.switch-row > div {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.switch-row small {
    margin-top: 2px;
    color: var(--muted);
    font-size: .8rem;
}

.switch-row input {
    position: absolute;
    opacity: 0;
}

.switch {
    position: relative;
    width: 44px;
    height: 25px;
    background: #d8d2d5;
    border-radius: 30px;
    transition: background .2s ease;
}

.switch::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 19px;
    height: 19px;
    content: "";
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .16);
    transition: transform .2s ease;
}

.switch-row input:checked + .switch {
    background: var(--accent);
}

.switch-row input:checked + .switch::after {
    transform: translateX(19px);
}

.permission-tip {
    display: flex;
    flex-direction: column;
    padding: 12px 13px;
    margin-bottom: 16px;
    background: var(--cream);
    border: 1px solid #f3e6ad;
    border-radius: 7px;
}

.permission-tip span {
    margin-top: 2px;
    color: #766b47;
    font-size: .8rem;
}

.generate-btn {
    min-height: 50px;
}

.result-section {
    margin-top: 22px;
}

.result-grid {
    display: grid;
    grid-template-columns: minmax(220px, 360px) 1fr;
    gap: 30px;
    align-items: center;
}

.result-preview {
    padding: 14px;
    text-align: center;
    background: #f7f7f5;
    border-radius: 7px;
}

.result-preview img {
    max-width: 100%;
    max-height: 520px;
}

.result-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
}

.result-actions h3 {
    font-weight: 850;
}

.result-actions .btn {
    min-width: 200px;
}

.narrow-page {
    max-width: 760px;
}

.login-panel,
.form-panel,
.pay-panel {
    padding: clamp(26px, 5vw, 48px);
}

.email-mark {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #ffa8c0, #df648b);
    box-shadow: 0 12px 28px rgba(216, 95, 134, 0.24);
    font-size: 30px;
    font-weight: 800;
}

.email-login-panel {
    max-width: 560px;
    margin-inline: auto;
    text-align: left;
}

.email-code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px;
    gap: 10px;
}

.email-code-row .btn {
    min-height: 48px;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .email-code-row {
        grid-template-columns: minmax(0, 1fr) 116px;
    }
}

.qr-box {
    display: grid;
    place-items: center;
    width: 220px;
    height: 220px;
    padding: 12px;
    margin: 20px auto;
    background: #fff;
    border: 1px solid var(--line);
}

.qr-box img,
.qr-box canvas {
    max-width: 100%;
    max-height: 100%;
}

.page-title {
    padding: 28px 0 34px;
    text-align: center;
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.plan-card {
    padding: 24px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.plan-card:nth-child(2) {
    border-color: #edb1c3;
    box-shadow: 0 14px 34px rgba(235, 111, 149, .13);
}

.plan-name {
    font-weight: 850;
}

.price {
    margin: 14px 0;
    font-size: 2.25rem;
    font-weight: 900;
}

.price small {
    font-size: 1rem;
}

.benefits {
    min-height: 160px;
    color: var(--muted);
}

.profile-band {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px;
    background: #fff;
    border: 1px solid var(--line);
    border-top: 3px solid #f2afc2;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.profile-band > img {
    width: 68px;
    height: 68px;
    object-fit: cover;
    border: 3px solid var(--accent-soft);
    border-radius: 50%;
}

.profile-band h1 {
    margin: 0 0 3px;
    font-size: 1.45rem;
}

.profile-band p {
    margin: 0;
    color: var(--muted);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.photo-card {
    padding: 11px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 7px 20px rgba(67, 47, 55, .05);
}

.photo-thumb {
    display: grid;
    place-items: center;
    aspect-ratio: 3 / 4;
    margin-bottom: 10px;
    overflow: hidden;
    background: #f5f5f3;
    border-radius: 6px;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-card strong,
.photo-card small {
    display: block;
}

.photo-card small {
    color: var(--muted);
    font-size: .76rem;
}

.empty-state {
    padding: 52px 20px;
    color: var(--muted);
    text-align: center;
    background: #fff;
    border: 1px dashed #dcd3d7;
    border-radius: var(--radius);
}

.order-list,
.feedback-history {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 17px 19px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.order-row > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.order-row > div:last-child {
    align-items: flex-end;
}

.order-row span,
.order-row small {
    color: var(--muted);
    font-size: .82rem;
}

.status {
    padding: 2px 8px;
    border-radius: 999px;
}

.status-pending { color: #826400; background: #fff2c6; }
.status-paid { color: #157347; background: #dcf6e6; }
.status-cancelled,
.status-refunded { color: #666; background: #eee; }

.faq-list .accordion-item {
    margin-bottom: 9px;
    overflow: hidden;
    border: 1px solid var(--line);
}

.accordion-button:not(.collapsed) {
    color: #b64267;
    background: var(--accent-pale);
    box-shadow: none;
}

.feedback-box {
    padding: 23px;
}

.feedback-history article {
    padding: 15px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.feedback-history article p {
    margin: 6px 0;
    color: var(--muted);
}

.feedback-history article div {
    padding: 9px 10px;
    background: var(--accent-pale);
    border-radius: 6px;
}

.feedback-history article small {
    color: var(--muted);
}

.pay-amount {
    color: var(--accent-dark);
    font-size: 2.4rem;
    font-weight: 900;
}

.success-check {
    color: #33a861;
    font-size: 56px;
}

.site-footer {
    padding: 26px 0;
    color: var(--muted);
    background: #fff;
    border-top: 1px solid var(--line);
    font-size: .86rem;
}

/* Installation page */
.install-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    background:
        linear-gradient(180deg, rgba(255, 240, 244, .82) 0, rgba(255, 240, 244, .82) 150px, transparent 150px),
        var(--page);
}

.install-page::before {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: 5px;
    content: "";
    background: linear-gradient(90deg, #f3b3c6, var(--accent), #f1c76e);
}

.install-page > .container {
    width: 100%;
    max-width: 820px;
}

.install-card {
    width: 100%;
    max-width: 720px;
    padding: 34px 38px 30px;
    border-top: 3px solid #f0a5ba;
    box-shadow: var(--shadow);
}

.install-card h1 {
    margin: 0 0 5px;
    text-align: left;
    font-size: 1.85rem;
    font-weight: 900;
}

.install-kicker {
    margin-bottom: 7px;
    color: var(--accent-dark);
    font-size: .7rem;
    font-weight: 850;
}

.install-card > p {
    margin: 0 0 24px;
}

.install-card .row {
    --bs-gutter-x: 18px;
    --bs-gutter-y: 16px;
}

.install-card .btn-lg {
    min-height: 50px;
    margin-top: 4px;
    font-size: 1rem;
}

.install-note {
    margin-top: 16px;
    color: var(--muted);
    text-align: center;
    font-size: .84rem;
}

.install-note span {
    display: inline-block;
    width: 1px;
    height: 13px;
    margin: 0 10px -2px;
    background: #d8d0d4;
}

/* AI butler */
.ai-butler-toggle {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: 7px;
    width: auto;
    min-width: 92px;
    height: 48px;
    padding: 0 13px 0 8px;
    color: #fff;
    background: linear-gradient(135deg, #f3a2b9, var(--accent));
    border: 0;
    border-radius: 999px;
    box-shadow: 0 12px 30px rgba(214, 84, 125, .26);
    font-weight: 900;
}

.butler-face {
    display: grid;
    width: 33px;
    height: 31px;
    place-items: center;
    color: var(--accent-dark);
    background: #fff;
    border-radius: 50%;
    font-size: .82rem;
}

.butler-label {
    font-size: .88rem;
    white-space: nowrap;
}

.ai-butler {
    position: fixed;
    right: 22px;
    bottom: 92px;
    z-index: 1050;
    width: 360px;
    height: 500px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 24px 60px rgba(67, 47, 55, .2);
}

.ai-butler header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 14px;
    cursor: move;
    background: var(--accent-soft);
    border-bottom: 1px solid #f2dce3;
}

.ai-butler header button {
    width: 28px;
    height: 28px;
    margin-left: 4px;
    background: #fff;
    border: 1px solid #efd6df;
    border-radius: 50%;
}

.ai-messages {
    display: flex;
    flex-direction: column;
    gap: 9px;
    height: 382px;
    padding: 14px;
    overflow: auto;
    background: #faf9f9;
}

.message {
    max-width: 86%;
    padding: 9px 11px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    border-radius: 7px;
}

.message.user {
    align-self: flex-end;
    background: #fff;
    border: 1px solid var(--line);
}

.message.ai {
    align-self: flex-start;
    background: var(--accent-soft);
}

.message.loading::after {
    content: "...";
    animation: pulse 1s infinite;
}

@keyframes pulse {
    50% { opacity: .3; }
}

.ai-input {
    display: flex;
    gap: 8px;
    height: 66px;
    padding: 10px;
    border-top: 1px solid var(--line);
}

.ai-input textarea {
    flex: 1;
    padding: 8px;
    resize: none;
    border: 1px solid var(--line);
    border-radius: 6px;
    outline: none;
}

.ai-butler.minimized {
    height: 52px;
}

.ai-butler.minimized .ai-messages,
.ai-butler.minimized .ai-input {
    display: none;
}

@media (max-width: 991px) {
    .generator-layout {
        grid-template-columns: 1fr;
    }

    .settings-panel {
        position: static;
    }

    .plan-grid {
        grid-template-columns: 1fr 1fr;
    }

    .photo-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .intro-band {
        align-items: flex-start;
        flex-direction: column;
    }

    .upload-zone {
        height: 500px;
    }
}

@media (max-width: 767px) {
    .app-navbar {
        min-height: 58px;
    }

    .intro-band {
        padding-top: 20px;
    }

    .intro-band h1,
    .page-title h1 {
        font-size: 2rem;
    }

    .trust-list {
        display: none;
    }

    .workbench,
    .settings-panel,
    .result-section {
        padding: 15px;
    }

    .upload-zone {
        min-height: 360px;
        height: 58vh;
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    .plan-grid,
    .photo-grid {
        grid-template-columns: 1fr 1fr;
    }

    .profile-band {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .order-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .order-row > div:last-child {
        align-items: flex-start;
    }

    .install-page {
        place-items: start center;
        background:
            linear-gradient(180deg, rgba(255, 240, 244, .8) 0, rgba(255, 240, 244, .8) 110px, transparent 110px),
            var(--page);
    }

    .install-card {
        padding: 26px 20px 24px;
    }

    .install-card h1 {
        font-size: 1.55rem;
    }

    .ai-butler-toggle {
        right: 14px;
        bottom: max(18px, env(safe-area-inset-bottom));
        min-width: 84px;
        height: 44px;
        padding-right: 11px;
    }

    .butler-face {
        width: 29px;
        height: 28px;
    }

    .ai-butler {
        right: 10px;
        bottom: calc(72px + env(safe-area-inset-bottom));
        width: calc(100vw - 20px);
        height: min(500px, 72vh);
    }

    .ai-messages {
        height: calc(100% - 118px);
    }
}

@media (max-width: 480px) {
    .navbar-brand strong {
        font-size: 1.02rem;
    }

    .photo-grid,
    .plan-grid {
        grid-template-columns: 1fr;
    }

    .color-options {
        grid-template-columns: repeat(4, 1fr);
    }

    .section-heading {
        align-items: flex-start;
    }

    .profile-band .ms-md-auto {
        width: 100%;
    }

    .install-page > .container {
        padding-right: 12px;
        padding-left: 12px;
    }
}
