:root {
    color-scheme: light;
    --bg: #fff7ef;
    --bg-2: #f8efff;
    --ink: #1d1722;
    --muted: #766b7d;
    --card: rgba(255, 255, 255, 0.78);
    --card-strong: #ffffff;
    --line: rgba(72, 48, 88, 0.14);
    --primary: #ff7a45;
    --primary-dark: #d95522;
    --accent: #8d5cf6;
    --shadow: 0 24px 70px rgba(52, 28, 68, 0.14);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --max: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(255, 176, 100, 0.35), transparent 34rem),
        radial-gradient(circle at 80% 10%, rgba(172, 112, 255, 0.28), transparent 32rem),
        linear-gradient(135deg, var(--bg), var(--bg-2));
    min-height: 100vh;
}

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

img { max-width: 100%; display: block; }

button, input, select, textarea {
    font: inherit;
}

code {
    padding: 0.1rem 0.35rem;
    border-radius: 0.45rem;
    background: rgba(141, 92, 246, 0.10);
    color: #5b34b2;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: min(var(--max), calc(100% - 32px));
    margin: 16px auto 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(18px);
    box-shadow: 0 14px 42px rgba(52, 28, 68, 0.10);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-weight: 900;
    box-shadow: 0 10px 26px rgba(255, 122, 69, 0.34);
}

.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 0.78rem; margin-top: 0.1rem; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-left: auto;
    flex-shrink: 0;
}

.main-nav {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.main-nav a {
    padding: 0.7rem 0.95rem;
    border-radius: 999px;
    color: #4e4558;
    white-space: nowrap;
    transition: 0.2s ease;
}

.main-nav a:hover {
    background: rgba(141, 92, 246, 0.11);
    color: #3a236d;
}

.language-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.22rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.58);
}

.lang-button {
    min-width: 46px;
    padding: 0.52rem 0.7rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #5b5164;
    cursor: pointer;
    font-weight: 900;
    transition: 0.2s ease;
}

.lang-button.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 8px 20px rgba(141, 92, 246, 0.22);
}

.lang-button:not(.active):hover {
    background: rgba(141, 92, 246, 0.10);
    color: #3a236d;
}

.section-shell {
    width: min(var(--max), calc(100% - 32px));
    margin: 0 auto;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(420px, 1.05fr);
    gap: 2rem;
    align-items: center;
    padding: 76px 0 58px;
}

.eyebrow {
    margin: 0 0 0.8rem;
    color: var(--primary-dark);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
    font-size: clamp(2.25rem, 4.6vw, 4.35rem);
    line-height: 1.05;
    letter-spacing: -0.055em;
    margin-bottom: 1.2rem;
}

.hero-text {
    max-width: 680px;
    color: var(--muted);
    font-size: 1.12rem;
    line-height: 1.85;
}

.hero-actions, .result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
    margin-top: 1.6rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 46px;
    padding: 0.85rem 1.15rem;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

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

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 18px 42px rgba(141, 92, 246, 0.28);
}

.btn-primary:hover { box-shadow: 0 22px 50px rgba(141, 92, 246, 0.34); }

.btn-ghost {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.66);
    color: #4d4257;
}

.btn-wide { width: 100%; }

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.8rem;
}

.hero-stats span {
    padding: 0.72rem 0.92rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.52);
    color: #5b5164;
}

.hero-stats strong { color: var(--ink); }

.hero-panel {
    position: relative;
    overflow: hidden;
    padding: 1rem;
    min-height: 620px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--line);
    background:
        linear-gradient(145deg, rgba(255,255,255,0.84), rgba(255,255,255,0.48)),
        radial-gradient(circle at 20% 15%, rgba(255, 122, 69, 0.26), transparent 18rem),
        radial-gradient(circle at 80% 80%, rgba(141, 92, 246, 0.22), transparent 20rem);
    box-shadow: var(--shadow);
}

.hero-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(255,247,239,0.96), transparent 10%, transparent 90%, rgba(248,239,255,0.96));
}

.marquee {
    position: absolute;
    left: 0;
    right: 0;
    overflow: hidden;
}

.marquee-top { top: 36px; }
.marquee-bottom { bottom: 38px; transform: rotate(-2deg); }

.marquee-track {
    display: flex;
    gap: 1rem;
    width: max-content;
    animation: scroll-left 48s linear infinite;
}

.marquee-track.reverse { animation: scroll-right 58s linear infinite; }
.hero-panel:hover .marquee-track { animation-play-state: paused; }

@keyframes scroll-left {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@keyframes scroll-right {
    from { transform: translateX(-50%); }
    to { transform: translateX(0); }
}

.mini-card {
    width: 230px;
    padding: 0.55rem;
    border-radius: 24px;
    background: rgba(255,255,255,0.76);
    border: 1px solid rgba(255,255,255,0.78);
    box-shadow: 0 20px 50px rgba(52, 28, 68, 0.16);
}

.mini-card.small { width: 190px; }

.mini-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 18px;
}

.mini-card span {
    display: block;
    padding: 0.55rem 0.25rem 0.2rem;
    font-weight: 800;
    color: #4b4055;
}

.section-heading {
    max-width: 820px;
    margin-bottom: 1.5rem;
}

.section-heading h2 {
    font-size: clamp(2rem, 4vw, 3.35rem);
    line-height: 1.05;
    letter-spacing: -0.045em;
    margin-bottom: 0.75rem;
}

.section-heading p:not(.eyebrow) {
    color: var(--muted);
    line-height: 1.8;
}

.section-heading.split {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    max-width: none;
}

.retouch, .gallery {
    padding: 58px 0;
}

.retouch-layout {
    display: grid;
    grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.1fr);
    gap: 1.2rem;
}

.upload-card, .result-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--card);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.upload-card {
    padding: 1rem;
}

.dropzone {
    display: grid;
    place-items: center;
    min-height: 230px;
    padding: 1.5rem;
    text-align: center;
    border: 2px dashed rgba(141, 92, 246, 0.35);
    border-radius: 26px;
    background: rgba(255,255,255,0.58);
    cursor: pointer;
    transition: 0.2s ease;
}

.dropzone:hover, .dropzone.is-dragover {
    border-color: var(--primary);
    background: rgba(255, 122, 69, 0.08);
    transform: translateY(-1px);
}

.dropzone input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.drop-icon { font-size: 2.4rem; margin-bottom: 0.6rem; }
.dropzone strong { font-size: 1.08rem; }
.dropzone small { color: var(--muted); margin-top: 0.35rem; }

.preview-wrap {
    margin-top: 1rem;
    padding: 0.7rem;
    border-radius: 22px;
    background: rgba(255,255,255,0.64);
    border: 1px solid var(--line);
}

.preview-wrap img {
    width: 100%;
    max-height: 330px;
    object-fit: cover;
    border-radius: 17px;
}

.form-grid {
    display: grid;
    gap: 0.9rem;
    margin-top: 1rem;
}

label span {
    display: block;
    margin-bottom: 0.45rem;
    color: #4e4258;
    font-weight: 800;
}

select, textarea, input[type="search"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select { min-height: 48px; padding: 0 0.85rem; }
textarea { padding: 0.9rem; resize: vertical; line-height: 1.65; }
input[type="search"] { min-height: 46px; padding: 0 0.9rem; }

select:focus, textarea:focus, input[type="search"]:focus {
    border-color: rgba(141, 92, 246, 0.72);
    box-shadow: 0 0 0 4px rgba(141, 92, 246, 0.10);
}

.full-label { display: block; margin: 1rem 0; }
.spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-card {
    min-height: 620px;
    padding: 1rem;
    display: flex;
    align-items: stretch;
}

.result-empty {
    width: 100%;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    padding: 2rem;
    border-radius: 26px;
    background: linear-gradient(135deg, rgba(255,255,255,0.72), rgba(255,255,255,0.38));
}

.result-empty span { font-size: 3rem; margin-bottom: 1rem; }
.result-empty p { color: var(--muted); max-width: 420px; line-height: 1.75; }

.result-content { width: 100%; }

.compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.compare-grid figure {
    margin: 0;
    overflow: hidden;
    border-radius: 24px;
    background: rgba(255,255,255,0.76);
    border: 1px solid var(--line);
}

.compare-grid figcaption {
    padding: 0.8rem 0.9rem;
    font-weight: 900;
    color: #4e4258;
}

.compare-grid img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin: 1rem 0;
}

.result-meta span {
    padding: 0.55rem 0.72rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.76);
    border: 1px solid var(--line);
    color: #5d5268;
    font-weight: 700;
}

.result-meta .warn { color: #a85b00; background: rgba(255, 176, 83, 0.18); }

.link-button {
    border: none;
    background: transparent;
    color: var(--accent);
    font-weight: 900;
    cursor: pointer;
    padding: 0.5rem 0.25rem;
}

.link-button:hover { color: var(--primary-dark); }

.gallery-tools {
    width: min(520px, 100%);
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.65rem;
}

.pill {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,0.66);
    color: #554a5e;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    font-weight: 800;
}

.pill.active, .pill:hover {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.cat-card {
    overflow: hidden;
    border-radius: 26px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.72);
    box-shadow: 0 18px 50px rgba(52, 28, 68, 0.10);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 62px rgba(52, 28, 68, 0.16);
}

.cat-card[hidden] { display: none; }

.cat-card > img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.cat-card-body {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 0.7rem;
    padding: 0.9rem 0.9rem 0.3rem;
}

.cat-card h3 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.cat-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.35rem 0.9rem 0.95rem;
}

.tag-row span {
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: rgba(141, 92, 246, 0.10);
    color: #6142a7;
    font-size: 0.78rem;
    font-weight: 800;
}


.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 50;
    max-width: min(420px, calc(100vw - 36px));
    padding: 0.85rem 1rem;
    border-radius: 18px;
    background: #201827;
    color: #fff;
    box-shadow: 0 18px 50px rgba(0,0,0,0.22);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast.success { background: #176b48; }
.toast.error { background: #a73737; }
.toast.warn { background: #9a5a14; }

.site-footer {
    width: min(var(--max), calc(100% - 32px));
    margin: 0 auto 36px;
    padding: 1.4rem;
    text-align: center;
    color: var(--muted);
}

@media (max-width: 980px) {
    .hero, .retouch-layout { grid-template-columns: 1fr; }
    .hero-panel { min-height: 500px; }
    .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .section-heading.split { display: block; }
    .gallery-tools { width: 100%; }
}

@media (max-width: 760px) {
    .main-nav { display: none; }
}

@media (max-width: 680px) {
    .site-header {
        position: static;
        align-items: flex-start;
        border-radius: 24px;
    }
    .main-nav { display: none; }
    .header-actions { margin-left: auto; }
    .language-switch { transform: scale(0.94); transform-origin: right center; }
    h1 { font-size: clamp(2rem, 10vw, 3.25rem); }
    .hero { padding-top: 44px; }
    .hero-panel { min-height: 380px; }
    .mini-card { width: 170px; }
    .mini-card.small { width: 145px; }
    .compare-grid, .gallery-grid { grid-template-columns: 1fr; }
    .retouch, .gallery { padding: 40px 0; }
}
