:root {
  color-scheme: light;
  --bg: #f3f1eb;
  --bg-soft: #ebe8df;
  --paper: rgba(251, 250, 246, .88);
  --paper-solid: #fbfaf6;
  --ink: #202724;
  --ink-soft: #69716d;
  --line: rgba(36, 52, 45, .13);
  --accent: #466257;
  --accent-strong: #2f4d42;
  --accent-soft: #dce6df;
  --red: #a84c43;
  --shadow: 0 24px 70px rgba(40, 50, 45, .10);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --header-h: 78px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151a18;
  --bg-soft: #1b211e;
  --paper: rgba(28, 35, 32, .9);
  --paper-solid: #1c2320;
  --ink: #edf0ec;
  --ink-soft: #9da8a2;
  --line: rgba(224, 235, 228, .12);
  --accent: #91ad9f;
  --accent-strong: #b2cabf;
  --accent-soft: #2a3933;
  --red: #df8177;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(70, 98, 87, .025) 50%, transparent 50.2%),
    var(--bg);
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "STSong", "SimSun", ui-serif, Georgia, serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid rgba(70, 98, 87, .24); outline-offset: 3px; }
[hidden] { display: none !important; }
svg { width: 1.2em; height: 1.2em; fill: currentColor; }

.ink { position: fixed; pointer-events: none; z-index: -1; filter: blur(2px); opacity: .22; }
.ink-a { width: 420px; height: 280px; left: -130px; top: 260px; background: radial-gradient(ellipse, rgba(65, 83, 76, .35), transparent 68%); transform: rotate(-20deg); }
.ink-b { width: 520px; height: 360px; right: -170px; top: 50px; background: radial-gradient(ellipse, rgba(65, 83, 76, .24), transparent 68%); transform: rotate(12deg); }

.site-header {
  height: var(--header-h);
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 4vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px; background: var(--accent-strong); color: var(--paper-solid);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  font-size: 22px; font-weight: 700;
}
.brand strong { display: block; font-size: 19px; letter-spacing: .12em; }
.brand small { display: block; margin-top: 3px; color: var(--ink-soft); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 9px; letter-spacing: .24em; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-button, .ghost-button, .secondary-button, .text-button, .primary-button {
  border: 0; cursor: pointer; transition: transform .2s ease, background .2s ease, border-color .2s ease, opacity .2s ease;
}
.icon-button:hover, .ghost-button:hover, .secondary-button:hover, .primary-button:hover { transform: translateY(-1px); }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: transparent; border: 1px solid var(--line); }
.ghost-button { min-height: 40px; padding: 0 16px; border-radius: 12px; background: transparent; border: 1px solid var(--line); }
.primary-button { min-height: 44px; padding: 0 22px; border-radius: 13px; background: var(--accent-strong); color: var(--paper-solid); font-weight: 700; box-shadow: 0 10px 28px rgba(47, 77, 66, .18); }
.secondary-button { min-height: 40px; padding: 0 16px; border-radius: 12px; background: var(--paper-solid); border: 1px solid var(--line); }
.text-button { padding: 7px 2px; background: transparent; color: var(--accent-strong); }
.wide { width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

.page-shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; }
.hero { min-height: 520px; display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: 7vw; padding: 64px 0 72px; }
.hero-copy { max-width: 650px; }
.eyebrow, .modal-kicker { color: var(--accent); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.hero h1 { margin: 19px 0 22px; font-size: clamp(45px, 5.6vw, 78px); line-height: 1.15; letter-spacing: -.055em; font-weight: 600; }
.hero h1 em { color: var(--accent); font-style: normal; font-weight: 500; }
.hero p { max-width: 600px; color: var(--ink-soft); font-size: 17px; line-height: 1.9; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero-badges span { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); background: rgba(255,255,255,.16); font-size: 13px; }

.mountain-card { position: relative; min-height: 360px; overflow: hidden; border-radius: 46% 54% 43% 57% / 51% 42% 58% 49%; background: linear-gradient(160deg, var(--accent-soft), transparent 72%); border: 1px solid var(--line); box-shadow: var(--shadow); }
.sun { position: absolute; width: 76px; height: 76px; border-radius: 50%; background: #c46a59; top: 65px; right: 24%; opacity: .84; box-shadow: 0 0 45px rgba(196, 106, 89, .2); }
.mountain { position: absolute; left: -12%; right: -12%; bottom: -5%; height: 75%; background: var(--accent); clip-path: polygon(0 83%, 10% 72%, 18% 78%, 32% 38%, 43% 69%, 58% 26%, 72% 67%, 82% 48%, 100% 77%, 100% 100%, 0 100%); }
.mountain-back { opacity: .25; transform: translateY(-34px) scale(1.08); filter: blur(1px); }
.mountain-front { opacity: .74; background: var(--accent-strong); }
.mist { position: absolute; height: 18px; border-radius: 50%; background: var(--paper-solid); filter: blur(10px); opacity: .68; }
.mist-one { width: 70%; left: -5%; top: 54%; }
.mist-two { width: 62%; right: -7%; top: 66%; }
.seal { position: absolute; right: 22px; bottom: 23px; width: 48px; height: 56px; display: grid; place-items: center; color: #f7e9df; background: #9c4038; border: 2px solid rgba(255,255,255,.5); outline: 1px solid #9c4038; font-size: 15px; line-height: 1.2; }

.upload-panel, .result-panel, .dashboard {
  margin-bottom: 28px; padding: 34px; border-radius: var(--radius-lg); background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(18px);
}
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.section-heading > div { display: flex; align-items: center; gap: 15px; }
.section-index { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--paper-solid); background: var(--accent-strong); font-size: 14px; }
.section-heading h2 { margin: 0; font-size: 24px; }
.section-heading p { margin: 5px 0 0; color: var(--ink-soft); font-size: 13px; }
.status-pill { padding: 8px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 12px; }
.status-pill.denied { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }

.drop-zone { min-height: 310px; display: grid; place-items: center; align-content: center; padding: 32px; text-align: center; border-radius: 23px; border: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 46%, transparent), transparent); transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 58%, transparent); transform: translateY(-2px); }
.drop-zone.disabled { opacity: .55; cursor: not-allowed; }
.drop-icon { width: 72px; height: 72px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 50%; color: var(--accent-strong); background: var(--paper-solid); border: 1px solid var(--line); box-shadow: 0 14px 35px rgba(46, 68, 59, .10); font-size: 31px; }
.drop-zone h3 { margin: 10px 0 8px; font-size: 24px; }
.drop-zone p { margin: 0 0 22px; color: var(--ink-soft); }

.queue { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.queue-head, .queue-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.queue-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin: 16px 0 20px; }
.queue-item { min-width: 0; display: grid; grid-template-columns: 58px minmax(0,1fr) 28px; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--paper-solid) 82%, transparent); }
.queue-thumb { width: 58px; height: 58px; object-fit: cover; border-radius: 10px; background: var(--bg-soft); }
.queue-meta { min-width: 0; }
.queue-meta strong, .queue-meta small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.queue-meta strong { font-size: 13px; }
.queue-meta small { margin-top: 5px; color: var(--ink-soft); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; }
.remove-file { border: 0; background: transparent; cursor: pointer; color: var(--ink-soft); font-size: 22px; }
.progress-wrap { flex: 1; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: var(--bg-soft); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent-strong); transition: width .2s ease; }
.progress-wrap small { display: block; margin-top: 7px; color: var(--ink-soft); }

.result-list { display: grid; gap: 16px; }
.result-card { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--paper-solid) 82%, transparent); }
.result-preview { width: 150px; height: 124px; object-fit: cover; border-radius: 13px; background: var(--bg-soft); cursor: zoom-in; }
.result-body { min-width: 0; }
.result-title { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.result-title strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.result-title small { flex: none; color: var(--ink-soft); }
.link-row { display: grid; grid-template-columns: 88px minmax(0,1fr) 72px; align-items: center; gap: 9px; margin-top: 8px; }
.link-row label { color: var(--ink-soft); font-size: 12px; }
.link-row input { width: 100%; height: 38px; padding: 0 11px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.copy-button { height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper-solid); cursor: pointer; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stats-grid article { padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: color-mix(in srgb, var(--paper-solid) 74%, transparent); }
.stats-grid small, .stats-grid span { display: block; color: var(--ink-soft); font-size: 12px; }
.stats-grid strong { display: block; margin: 8px 0 6px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 30px; }
.library-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 18px 0; }
.search-box { flex: 1; max-width: 520px; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper-solid); color: var(--ink-soft); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; }
.library-count { color: var(--ink-soft); font-size: 13px; }
.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.gallery-card { position: relative; overflow: hidden; min-width: 0; border: 1px solid var(--line); border-radius: 17px; background: var(--paper-solid); }
.gallery-image-wrap { position: relative; aspect-ratio: 1.28; overflow: hidden; background: var(--bg-soft); }
.gallery-image { width: 100%; height: 100%; display: block; object-fit: cover; cursor: zoom-in; transition: transform .35s ease; }
.gallery-card:hover .gallery-image { transform: scale(1.035); }
.gallery-badge { position: absolute; left: 10px; top: 10px; padding: 5px 8px; border-radius: 999px; color: white; background: rgba(20, 27, 24, .62); backdrop-filter: blur(8px); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 10px; }
.gallery-info { padding: 13px; }
.gallery-info strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.gallery-info small { display: block; margin-top: 6px; color: var(--ink-soft); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; }
.gallery-actions { display: grid; grid-template-columns: 1fr 1fr auto; gap: 7px; margin-top: 11px; }
.gallery-actions button { min-height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); cursor: pointer; font-size: 11px; }
.gallery-actions .danger { width: 36px; color: var(--red); }
.empty-state { padding: 70px 20px; text-align: center; color: var(--ink-soft); }
.empty-state span { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 50%; border: 1px solid var(--line); font-size: 22px; }
.empty-state h3 { margin: 0; color: var(--ink); }
.empty-state p { margin-bottom: 0; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 24px; }
.pagination span { color: var(--ink-soft); font-size: 13px; }

footer { width: min(1240px, calc(100% - 40px)); margin: 46px auto 0; padding: 28px 0 42px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(11, 16, 14, .58); backdrop-filter: blur(9px); }
.modal-card { position: relative; width: min(660px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 36px; border-radius: 24px; background: var(--paper-solid); border: 1px solid var(--line); box-shadow: 0 35px 100px rgba(0,0,0,.32); }
.modal-card.small { width: min(440px, 100%); }
.modal-card h2 { margin: 10px 0 10px; font-size: 28px; }
.modal-card p { color: var(--ink-soft); line-height: 1.7; }
.modal-card form { margin-top: 24px; }
.modal-card label { display: block; color: var(--ink-soft); font-size: 13px; }
.modal-card input { width: 100%; height: 48px; margin: 8px 0 16px; padding: 0 13px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.modal-close { position: absolute; right: 15px; top: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); cursor: pointer; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 28px; }
pre { overflow: auto; padding: 18px; border-radius: 14px; background: #111815; color: #dfe9e3; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; line-height: 1.75; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong) !important; font-size: 13px; }
.preview-card { position: relative; max-width: min(1200px, 96vw); max-height: 92vh; display: grid; place-items: center; }
.preview-card img { max-width: 100%; max-height: 88vh; object-fit: contain; border-radius: 14px; box-shadow: 0 30px 100px rgba(0,0,0,.4); }
.preview-close { right: -10px; top: -48px; color: white; background: rgba(0,0,0,.35); }
.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: grid; gap: 10px; width: min(360px, calc(100vw - 44px)); }
.toast { padding: 14px 16px; border-radius: 13px; color: var(--ink); background: var(--paper-solid); border: 1px solid var(--line); box-shadow: var(--shadow); animation: toast-in .25s ease both; }
.toast.error { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 980px) {
  .hero { min-height: auto; grid-template-columns: 1fr; padding-top: 58px; }
  .hero-copy { max-width: 760px; }
  .mountain-card { min-height: 300px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  :root { --header-h: 68px; --radius-lg: 22px; }
  .site-header { padding: 0 18px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand strong { font-size: 16px; }
  .brand small, .top-actions .ghost-button:first-of-type { display: none; }
  .ghost-button { padding: 0 12px; font-size: 13px; }
  .page-shell { width: min(100% - 24px, 1240px); }
  .hero { gap: 34px; padding: 46px 4px 48px; }
  .hero h1 { font-size: clamp(39px, 12vw, 57px); }
  .hero p { font-size: 15px; }
  .mountain-card { min-height: 255px; border-radius: 34px; }
  .upload-panel, .result-panel, .dashboard { padding: 20px; }
  .section-heading { align-items: flex-start; }
  .section-heading h2 { font-size: 20px; }
  .section-index { width: 36px; height: 36px; flex: none; }
  .status-pill { display: none; }
  .drop-zone { min-height: 270px; padding: 22px 16px; }
  .drop-zone h3 { font-size: 21px; }
  .drop-zone p { font-size: 13px; line-height: 1.7; }
  .queue-list { grid-template-columns: 1fr; }
  .queue-actions { align-items: stretch; flex-direction: column; }
  .result-card { grid-template-columns: 1fr; }
  .result-preview { width: 100%; height: auto; max-height: 280px; }
  .link-row { grid-template-columns: 68px minmax(0,1fr) 56px; }
  .stats-grid { gap: 10px; }
  .stats-grid article { padding: 17px; }
  .stats-grid strong { font-size: 25px; }
  .library-toolbar { align-items: stretch; flex-direction: column; }
  .search-box { max-width: none; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gallery-actions { grid-template-columns: 1fr auto; }
  .gallery-actions button:nth-child(2) { display: none; }
  footer { width: calc(100% - 24px); flex-direction: column; }
  .modal-card { padding: 30px 20px 22px; }
}

@media (max-width: 420px) {
  .brand span:last-child { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .gallery { grid-template-columns: 1fr; }
  .gallery-image-wrap { aspect-ratio: 1.5; }
}

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