:root {
    --ink: #1b2b23;
    --ink-soft: #34463c;
    --muted: #718078;
    --line: rgba(38, 65, 50, 0.12);
    --line-strong: rgba(38, 65, 50, 0.2);
    --green: #2f7256;
    --green-dark: #1f513c;
    --green-light: #dcece2;
    --paper: #f5f7f2;
    --card: rgba(255, 255, 252, 0.9);
    --white: #fff;
    --shadow: 0 28px 80px rgba(39, 64, 49, 0.1);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --ui-font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 3%, rgba(175, 211, 186, 0.52), transparent 30rem),
        radial-gradient(circle at 92% 4%, rgba(245, 215, 185, 0.45), transparent 28rem),
        linear-gradient(145deg, #f6f8f3 0%, #eef3ec 54%, #f7f3ed 100%);
    font-family: var(--ui-font);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(36, 66, 49, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(36, 66, 49, 0.018) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 72%);
    content: "";
    pointer-events: none;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

svg {
    display: block;
}

::selection {
    color: #fff;
    background: var(--green);
}

.ambient {
    position: fixed;
    z-index: -1;
    width: 38rem;
    height: 38rem;
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0.38;
    pointer-events: none;
}

.ambient-one {
    right: -19rem;
    bottom: -21rem;
    background: radial-gradient(circle, rgba(149, 197, 169, 0.74), rgba(149, 197, 169, 0) 67%);
}

.ambient-two {
    bottom: 7rem;
    left: -22rem;
    background: radial-gradient(circle, rgba(237, 191, 156, 0.55), rgba(237, 191, 156, 0) 68%);
}

.page {
    width: min(1220px, calc(100% - 48px));
    margin: 0 auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 100px;
    border-bottom: 1px solid rgba(42, 72, 54, 0.08);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    border-radius: 16px;
    outline: none;
}

.brand:focus-visible {
    box-shadow: 0 0 0 4px rgba(47, 114, 86, 0.16);
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 14px;
    color: #f7fbf8;
    background: linear-gradient(145deg, #356f58, #244e3d);
    box-shadow: 0 10px 25px rgba(35, 82, 61, 0.18);
}

.brand-mark svg {
    width: 28px;
    height: 28px;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.brand-copy strong {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.brand-copy small {
    margin-top: 7px;
    color: #7b887f;
    font-family: "Avenir Next", "Helvetica Neue", sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.2em;
}

.local-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 36px;
    padding: 0 15px;
    border: 1px solid rgba(55, 98, 72, 0.11);
    border-radius: 999px;
    color: #506258;
    background: rgba(255, 255, 252, 0.58);
    font-size: 12px;
    letter-spacing: 0.02em;
    backdrop-filter: blur(12px);
}

.pulse-dot {
    position: relative;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4eaa76;
}

.pulse-dot::after {
    position: absolute;
    inset: -4px;
    border: 1px solid rgba(78, 170, 118, 0.42);
    border-radius: inherit;
    animation: pulse 2.2s ease-out infinite;
    content: "";
}

@keyframes pulse {
    0% {
        opacity: 0.9;
        transform: scale(0.72);
    }
    75%,
    100% {
        opacity: 0;
        transform: scale(1.5);
    }
}

.intro {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.72fr);
    gap: 64px;
    align-items: end;
    padding: 67px 4px 49px;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 19px;
    color: #738279;
    font-family: "Avenir Next", "Helvetica Neue", sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.19em;
}

.eyebrow span {
    width: 29px;
    height: 2px;
    border-radius: 2px;
    background: #509275;
}

.intro h1 {
    max-width: 680px;
    margin: 0;
    color: var(--ink);
    font-size: clamp(43px, 5.2vw, 66px);
    font-weight: 600;
    letter-spacing: -0.055em;
    line-height: 1.1;
}

.intro h1 em {
    position: relative;
    color: var(--green-dark);
    font-style: normal;
}

.intro h1 em::after {
    position: absolute;
    right: 2%;
    bottom: 6%;
    left: 1%;
    z-index: -1;
    height: 13px;
    border-radius: 99px;
    background: rgba(169, 210, 181, 0.42);
    content: "";
    transform: rotate(-1deg);
}

.intro-copy {
    padding-bottom: 7px;
}

.intro-copy > p {
    max-width: 430px;
    margin: 0;
    color: #5f6e65;
    font-size: 15px;
    letter-spacing: 0.01em;
    line-height: 1.85;
}

.library-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 13px;
    margin-top: 23px;
    color: #65726a;
    font-size: 12px;
}

.library-stats span {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
}

.library-stats b {
    color: #2c4939;
    font-family: "Avenir Next", "Helvetica Neue", sans-serif;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.library-stats i {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #a4b1a8;
}

.workspace {
    display: grid;
    grid-template-columns: 372px minmax(0, 1fr);
    gap: 23px;
    align-items: stretch;
}

.control-card,
.preview-card {
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--radius-xl);
    background: var(--card);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.control-card {
    display: flex;
    flex-direction: column;
    padding: 29px 28px 24px;
}

.card-heading {
    display: flex;
    gap: 13px;
    align-items: flex-start;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.step-number {
    display: inline-grid;
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    place-items: center;
    border: 1px solid #cedeD3;
    border-radius: 10px;
    color: #4f705f;
    background: #f2f7f2;
    font-family: "Avenir Next", "Helvetica Neue", sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.card-heading h2,
.preview-heading h2 {
    margin: 0;
    color: var(--ink);
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.015em;
}

.card-heading p {
    margin: 7px 0 0;
    color: #849087;
    font-size: 11px;
    line-height: 1.55;
}

#cover-form {
    padding-top: 26px;
}

.field-label {
    display: block;
    margin-bottom: 10px;
    color: #3b4d42;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.04em;
}

.title-field {
    position: relative;
}

.title-field input {
    width: 100%;
    height: 57px;
    padding: 0 76px 0 17px;
    border: 1px solid #dce5dc;
    border-radius: var(--radius-md);
    outline: 0;
    color: var(--ink);
    background: rgba(250, 252, 249, 0.92);
    font-size: 15px;
    font-weight: 500;
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.title-field input::placeholder {
    color: #a2ada5;
    font-weight: 400;
}

.title-field input:hover {
    border-color: #cbd9ce;
    background: #fff;
}

.title-field input:focus {
    border-color: #5b9678;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(70, 135, 103, 0.11);
}

.title-field.is-invalid input {
    border-color: #c87563;
    box-shadow: 0 0 0 4px rgba(184, 91, 74, 0.09);
}

.char-count {
    position: absolute;
    top: 50%;
    right: 14px;
    color: #a0aaa3;
    font-family: "Avenir Next", "Helvetica Neue", sans-serif;
    font-size: 10px;
    letter-spacing: 0.03em;
    transform: translateY(-50%);
    pointer-events: none;
}

.field-help {
    margin: 8px 0 0;
    color: #919b94;
    font-size: 10px;
    line-height: 1.5;
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 21px;
    padding: 15px 16px;
    border: 1px solid #e7ece6;
    border-radius: var(--radius-md);
    background: #fafbf8;
    cursor: pointer;
    transition: border-color 180ms ease, background 180ms ease;
}

.switch-row:hover {
    border-color: #d9e5da;
    background: #fbfdfa;
}

.switch-row > span:first-child {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.switch-row strong {
    color: #405246;
    font-size: 12px;
    font-weight: 650;
}

.switch-row small {
    color: #909a92;
    font-size: 9px;
    line-height: 1.45;
}

.switch {
    position: relative;
    flex: 0 0 40px;
    width: 40px;
    height: 23px;
}

.switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.switch-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cfd8d1;
    transition: background 180ms ease, box-shadow 180ms ease;
}

.switch-track::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(25, 47, 34, 0.19);
    content: "";
    transition: transform 180ms ease;
}

.switch input:checked + .switch-track {
    background: var(--green);
}

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

.switch input:focus-visible + .switch-track {
    box-shadow: 0 0 0 4px rgba(47, 114, 86, 0.16);
}

.library-note {
    display: flex;
    gap: 11px;
    align-items: center;
    margin-top: 15px;
    padding: 12px 14px;
    border: 1px dashed #d7e3d8;
    border-radius: 12px;
    color: #738078;
    background: rgba(241, 247, 241, 0.55);
}

.library-note svg {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    color: #69927b;
}

.library-note p {
    margin: 0;
    font-size: 9px;
    line-height: 1.65;
}

.library-note code {
    color: #4f6e5b;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 9px;
}

.form-message {
    min-height: 18px;
    margin: 10px 2px 0;
    color: #b05f4f;
    font-size: 10px;
    line-height: 1.4;
}

.generate-button {
    display: flex;
    width: 100%;
    height: 56px;
    align-items: center;
    justify-content: space-between;
    margin-top: 5px;
    padding: 0 9px 0 21px;
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(135deg, #2d6d52 0%, #204d39 100%);
    box-shadow: 0 12px 28px rgba(32, 80, 56, 0.2);
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.generate-button:hover {
    box-shadow: 0 16px 34px rgba(32, 80, 56, 0.26);
    filter: saturate(1.05);
    transform: translateY(-2px);
}

.generate-button:active {
    transform: translateY(0);
}

.generate-button:focus-visible {
    outline: 3px solid rgba(47, 114, 86, 0.25);
    outline-offset: 3px;
}

.generate-button:disabled {
    cursor: wait;
    filter: saturate(0.7);
    opacity: 0.74;
    transform: none;
}

.button-label {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.button-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 11px;
    color: #224c39;
    background: #f3faf5;
    transition: transform 180ms ease;
}

.button-icon svg {
    width: 20px;
    height: 20px;
}

.generate-button:hover .button-icon {
    transform: translateX(2px);
}

.generate-button.is-loading .button-label {
    opacity: 0.8;
}

.generate-button.is-loading .button-icon svg {
    animation: spin 0.9s linear infinite;
}

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

.privacy-note {
    display: flex;
    gap: 7px;
    align-items: center;
    margin: auto 0 0;
    padding-top: 24px;
    color: #8a958d;
    font-size: 9px;
    line-height: 1.5;
}

.privacy-note svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    color: #6d8c78;
}

.preview-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 29px 29px 22px;
}

.preview-heading {
    display: flex;
    min-height: 34px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
}

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

.ratio-badge {
    padding: 7px 11px;
    border: 1px solid #e0e8df;
    border-radius: 999px;
    color: #7b897f;
    background: #f8faf7;
    font-family: "Avenir Next", "Helvetica Neue", sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.06em;
}

.cover-stage {
    padding: 12px;
    border: 1px solid rgba(57, 91, 68, 0.08);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(145deg, rgba(237, 242, 235, 0.9), rgba(247, 249, 245, 0.9));
    box-shadow: inset 0 1px 2px rgba(31, 56, 40, 0.04);
}

.cover-canvas {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 900 / 383;
    border-radius: 12px;
    outline: none;
    background: #e7ede6;
    box-shadow: 0 13px 35px rgba(37, 60, 45, 0.13);
    cursor: zoom-in;
    isolation: isolate;
}

.cover-canvas:focus-visible {
    box-shadow: 0 0 0 4px rgba(47, 114, 86, 0.22), 0 13px 35px rgba(37, 60, 45, 0.13);
}

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

.sample-background {
    position: absolute;
    inset: 0;
    filter: blur(0.4px) saturate(0.88) brightness(1.04);
}

.sample-shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(250, 252, 248, 0.87) 0%, rgba(250, 252, 248, 0.69) 38%, rgba(250, 252, 248, 0.15) 78%, rgba(250, 252, 248, 0.05) 100%);
}

.sample-copy {
    position: absolute;
    top: 50%;
    left: 7.1%;
    color: #1d2e24;
    transform: translateY(-53%);
}

.sample-copy strong {
    display: block;
    font-size: clamp(22px, 4.2vw, 49px);
    font-weight: 500;
    letter-spacing: -0.055em;
    line-height: 1.28;
}

.sample-accent {
    display: block;
    width: clamp(26px, 5vw, 51px);
    height: clamp(3px, 0.5vw, 5px);
    margin-bottom: clamp(9px, 1.8vw, 20px);
    border-radius: 5px;
    background: #4a9d7f;
}

.generated-cover {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.zoom-hint {
    position: absolute;
    right: 13px;
    bottom: 13px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 999px;
    color: #42594a;
    background: rgba(255, 255, 255, 0.74);
    font-size: 9px;
    font-weight: 600;
    backdrop-filter: blur(8px);
    box-shadow: 0 5px 15px rgba(30, 50, 38, 0.08);
    pointer-events: none;
}

.zoom-hint svg {
    width: 13px;
    height: 13px;
}

.result-meta {
    display: grid;
    grid-template-columns: 0.84fr 0.84fr 1.32fr;
    gap: 9px;
    margin-top: 13px;
}

.meta-item {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid #e8ede7;
    border-radius: 11px;
    background: #fafbf8;
}

.meta-item small {
    color: #98a199;
    font-size: 8px;
    letter-spacing: 0.05em;
}

.meta-item strong {
    overflow: hidden;
    color: #45594c;
    font-size: 10px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-actions {
    display: flex;
    gap: 10px;
    margin-top: 17px;
}

.download-button,
.reroll-button {
    display: inline-flex;
    height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 13px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.02em;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.download-button {
    flex: 1.15;
    color: #fff;
    background: #264f3c;
    box-shadow: 0 9px 22px rgba(32, 72, 51, 0.16);
    cursor: pointer;
}

.download-button:hover:not(.is-disabled) {
    box-shadow: 0 13px 27px rgba(32, 72, 51, 0.22);
    transform: translateY(-1px);
}

.download-button.is-disabled {
    color: #99a59d;
    background: #eef2ed;
    box-shadow: none;
    cursor: not-allowed;
}

.reroll-button {
    flex: 0.85;
    border: 1px solid #dce5dc;
    color: #526459;
    background: #fbfcfa;
    cursor: pointer;
}

.reroll-button:hover:not(:disabled) {
    border-color: #c7d9cb;
    background: #f6faf6;
    transform: translateY(-1px);
}

.reroll-button:disabled {
    cursor: not-allowed;
    opacity: 0.47;
}

.download-button svg,
.reroll-button svg {
    width: 17px;
    height: 17px;
}

.preview-caption {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: auto 0 0;
    padding-top: 17px;
    color: #919b94;
    font-size: 9px;
    line-height: 1.5;
}

.preview-caption span {
    width: 5px;
    height: 5px;
    flex: 0 0 5px;
    border-radius: 50%;
    background: #aac7b4;
}

.footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 33px 0 41px;
    color: #98a29b;
    font-size: 9px;
    letter-spacing: 0.04em;
}

.footer-separator {
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: #bcc5be;
}

/* layer 弹层与站点视觉保持一致 */
.layui-layer {
    border-radius: 17px !important;
    font-family: var(--ui-font) !important;
}

.layui-layer-dialog {
    border: 1px solid rgba(33, 68, 47, 0.12) !important;
    box-shadow: 0 24px 70px rgba(26, 49, 36, 0.2) !important;
}

.layui-layer-content {
    color: #3e5145 !important;
    font-size: 13px !important;
}

.layui-layer-btn .layui-layer-btn0 {
    border-color: #2d654d !important;
    background: #2d654d !important;
}

.layui-layer-msg {
    border-radius: 999px !important;
    border-color: rgba(29, 55, 40, 0.12) !important;
    color: #edf6ef !important;
    background: rgba(30, 55, 41, 0.93) !important;
    box-shadow: 0 12px 30px rgba(23, 40, 30, 0.18) !important;
    backdrop-filter: blur(8px);
}

.cover-viewer-layer {
    padding: 12px;
    background: #eef3ed;
}

.cover-viewer-layer img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 16px 42px rgba(31, 53, 39, 0.18);
}

@media (max-width: 1020px) {
    .page {
        width: min(900px, calc(100% - 40px));
    }

    .intro {
        grid-template-columns: 1fr;
        gap: 23px;
        padding-top: 53px;
    }

    .intro-copy > p {
        max-width: 600px;
    }

    .workspace {
        grid-template-columns: 340px minmax(0, 1fr);
    }

    .control-card {
        padding-right: 23px;
        padding-left: 23px;
    }

    .preview-card {
        padding-right: 23px;
        padding-left: 23px;
    }
}

@media (max-width: 790px) {
    .page {
        width: min(680px, calc(100% - 30px));
    }

    .topbar {
        min-height: 83px;
    }

    .intro {
        padding: 45px 1px 32px;
    }

    .intro h1 {
        font-size: clamp(39px, 10.5vw, 56px);
    }

    .workspace {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .control-card,
    .preview-card {
        padding: 23px 20px 19px;
        border-radius: 23px;
    }

    .privacy-note {
        padding-top: 19px;
    }

    .sample-copy strong {
        font-size: clamp(22px, 6.2vw, 38px);
    }

    .preview-caption {
        padding-top: 14px;
    }
}

@media (max-width: 520px) {
    .page {
        width: calc(100% - 22px);
    }

    .local-badge {
        padding: 0 11px;
        font-size: 9px;
    }

    .brand-copy small {
        display: none;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
    }

    .intro {
        gap: 17px;
        padding-top: 38px;
    }

    .eyebrow {
        margin-bottom: 14px;
        font-size: 9px;
    }

    .intro h1 {
        font-size: clamp(35px, 11.3vw, 47px);
    }

    .intro-copy > p {
        font-size: 13px;
        line-height: 1.75;
    }

    .library-stats {
        gap: 9px;
        margin-top: 17px;
    }

    .library-stats b {
        font-size: 16px;
    }

    .cover-stage {
        padding: 7px;
        border-radius: 16px;
    }

    .cover-canvas {
        border-radius: 10px;
    }

    .zoom-hint {
        right: 8px;
        bottom: 8px;
        padding: 5px 7px;
        font-size: 8px;
    }

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

    .meta-title {
        grid-column: 1 / -1;
    }

    .preview-actions {
        gap: 8px;
    }

    .download-button,
    .reroll-button {
        height: 45px;
        font-size: 10px;
    }

    .footer {
        flex-wrap: wrap;
        padding-top: 26px;
        padding-bottom: 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
