:root {
  color-scheme: light;
  --ink: #1f2924;
  --ink-strong: #111714;
  --muted: #6d7972;
  --soft: #8c9791;
  --paper: #fffdf8;
  --paper-warm: #f8f3ea;
  --surface: rgba(255, 253, 248, 0.82);
  --surface-solid: #fffdf8;
  --line: rgba(31, 41, 36, 0.12);
  --line-strong: rgba(31, 41, 36, 0.2);
  --accent: #b88a7a;
  --accent-dark: #825f55;
  --green: #246a57;
  --green-soft: #dfece4;
  --gold: #c7a35c;
  --danger: #a3483e;
  --shadow-sm: 0 12px 32px rgba(42, 36, 28, 0.08);
  --shadow-md: 0 24px 70px rgba(42, 36, 28, 0.12);
  --radius: 8px;
  --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(184, 138, 122, 0.17), transparent 28rem),
    radial-gradient(circle at 88% 18%, rgba(36, 106, 87, 0.12), transparent 30rem),
    linear-gradient(145deg, #fffdf8 0%, #f8f3ea 44%, #eef3eb 100%);
  color: var(--ink);
  font-family:
    "LXGW WenKai Lite",
    "LXGW WenKai",
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    sans-serif;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(31, 41, 36, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 41, 36, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 72%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
.dropzone:focus-within {
  outline: 3px solid rgba(184, 138, 122, 0.45);
  outline-offset: 3px;
}

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

h1,
h2,
strong,
b {
  color: var(--ink-strong);
}

h1 {
  max-width: 900px;
  margin-bottom: 18px;
  font-size: clamp(2.35rem, 4.6vw, 4.75rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 1.24rem;
  line-height: 1.25;
}

p,
small,
li {
  line-height: 1.72;
}

.skip-link {
  position: absolute;
  left: 20px;
  top: 12px;
  z-index: 20;
  transform: translateY(-150%);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--ink-strong);
  color: white;
  text-decoration: none;
  transition: transform 180ms var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0 48px;
}

.site-nav {
  position: sticky;
  top: 14px;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 66px;
  margin-bottom: 34px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.76);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-strong);
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  box-shadow: inset 0 -10px 20px rgba(17, 23, 20, 0.12);
}

.brand-text strong,
.brand-text small {
  display: block;
}

.brand-text strong {
  font-size: 1rem;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-links,
.status-row,
.topbar-actions,
.hero-actions,
.nav-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.nav-links {
  justify-content: center;
}

.nav-item,
.status-row span,
.service-pill,
.user-chip,
.mode-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.nav-item.is-active,
.service-pill,
.mode-status {
  color: var(--green);
  background: rgba(223, 236, 228, 0.78);
}

.service-pill {
  display: inline-flex;
  gap: 8px;
}

.service-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #30a46c;
  box-shadow: 0 0 0 5px rgba(48, 164, 108, 0.14);
}

.user-chip {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.75fr);
  gap: 24px;
  align-items: stretch;
  min-height: calc(100dvh - 132px);
}

.hero-copy,
.hero-preview,
.control-panel,
.result-panel,
.guide-panel,
.mode-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.hero-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: clamp(34px, 6.6vw, 84px);
}

.hero-copy::after {
  content: "";
  position: absolute;
  right: -11%;
  bottom: -22%;
  width: 42%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 138, 122, 0.22), transparent 68%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
}

.lead,
.page-heading p,
.mode-card p,
.mode-card small,
.mode-card b,
.empty-state p,
.history-empty {
  color: var(--muted);
}

.lead {
  max-width: 720px;
  margin-bottom: 24px;
  font-size: clamp(1rem, 1.6vw, 1.18rem);
}

.status-row {
  margin-bottom: 30px;
}

.primary-action,
.secondary-action,
.text-button {
  min-height: 46px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  transition:
    transform 160ms var(--ease-out),
    box-shadow 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
  touch-action: manipulation;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 19px;
  background: var(--ink-strong);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(17, 23, 20, 0.15);
}

.secondary-action,
.text-button {
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
}

.primary-action:hover:not(:disabled),
.secondary-action:hover:not(:disabled),
.text-button:hover:not(:disabled),
.mode-card:hover:not(:disabled),
.history-item:hover {
  transform: translateY(-2px);
}

.primary-action:active:not(:disabled),
.secondary-action:active:not(:disabled),
.text-button:active:not(:disabled),
.mode-card:active:not(:disabled),
.history-item:active {
  transform: translateY(0) scale(0.99);
}

.secondary-action:hover:not(:disabled),
.text-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.92);
}

.hero-actions .primary-action,
.hero-actions .secondary-action {
  width: auto;
  min-width: 136px;
}

.hero-preview {
  display: grid;
  gap: 14px;
  padding: 18px;
  background:
    linear-gradient(160deg, rgba(255, 253, 248, 0.9), rgba(242, 234, 221, 0.76)),
    var(--surface);
}

.preview-window,
.flow-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
}

.preview-window {
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
}

.preview-toolbar span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
}

.preview-toolbar strong {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.preview-canvas {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  background: #f3eadc;
}

.preview-photo {
  position: absolute;
  inset: 36px;
  border-radius: 10px;
  border: 1px solid rgba(17, 23, 20, 0.1);
}

.before-photo {
  background:
    radial-gradient(circle at 40% 46%, #c7905c 0 12%, transparent 12%),
    radial-gradient(circle at 56% 54%, #90b98f 0 18%, transparent 18%),
    linear-gradient(135deg, #d8c6b1, #f1e5d5);
  filter: saturate(0.8);
  transform: translate(-18px, 20px) rotate(-2deg);
}

.after-photo {
  inset: 70px 50px 50px 86px;
  background:
    radial-gradient(circle at 43% 44%, #d79a58 0 13%, transparent 13%),
    radial-gradient(circle at 58% 54%, #8bbf95 0 18%, transparent 18%),
    linear-gradient(135deg, #fffdf8, #dfece4);
  box-shadow: 0 24px 50px rgba(31, 41, 36, 0.16);
}

.preview-divider {
  position: absolute;
  top: 58px;
  bottom: 42px;
  left: 50%;
  width: 2px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 0 0 1px rgba(17, 23, 20, 0.1);
}

.preview-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.preview-caption span,
.flow-panel span {
  color: var(--muted);
  font-size: 0.9rem;
}

.flow-panel {
  padding: 18px;
}

.step-list,
.quality-list {
  margin: 12px 0 0;
  padding-left: 19px;
  color: var(--muted);
}

.step-list li::marker {
  color: var(--accent-dark);
}

.quality-list {
  list-style: none;
  padding-left: 0;
}

.quality-list li {
  position: relative;
  padding-left: 20px;
}

.quality-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.page-heading h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 3.6vw, 3.8rem);
}

.page-heading p {
  max-width: 680px;
  margin-bottom: 0;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 16px;
}

.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  overflow: hidden;
  padding: 22px;
  text-align: left;
  transition:
    transform 220ms var(--ease-out),
    box-shadow 220ms ease,
    border-color 220ms ease,
    background-color 220ms ease;
}

.mode-card:disabled {
  filter: grayscale(0.35);
}

.mode-card::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -28px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(184, 138, 122, 0.12);
  transition: transform 260ms var(--ease-out);
}

.mode-card:hover:not(:disabled) {
  border-color: rgba(184, 138, 122, 0.34);
  box-shadow: var(--shadow-md);
}

.mode-card:hover:not(:disabled)::after {
  transform: scale(1.14);
}

.mode-card.is-recommended {
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.94), rgba(249, 241, 231, 0.84));
  border-color: rgba(184, 138, 122, 0.34);
}

.mode-card h2 {
  margin: 24px 0 10px;
}

.mode-card p {
  margin-bottom: 16px;
}

.mode-card small {
  display: block;
}

.mode-card b {
  display: block;
  margin-top: auto;
  padding-top: 18px;
  font-size: 0.95rem;
}

.mode-index {
  color: var(--soft);
  font-size: 0.88rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(270px, 320px) minmax(0, 1fr) minmax(270px, 310px);
  gap: 16px;
  align-items: start;
}

.control-panel,
.guide-panel {
  position: sticky;
  top: 98px;
}

.control-panel,
.result-panel,
.guide-panel {
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
}

.panel-title strong,
.result-header strong {
  font-size: 1rem;
}

.panel-title span,
.result-header span {
  color: var(--muted);
  font-size: 0.86rem;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 220px;
  margin-bottom: 18px;
  padding: 20px;
  border: 1.5px dashed rgba(36, 106, 87, 0.32);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(223, 236, 228, 0.35)),
    rgba(255, 255, 255, 0.66);
  color: var(--ink);
  text-align: center;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms var(--ease-out);
}

.dropzone:hover {
  border-color: rgba(36, 106, 87, 0.55);
  transform: translateY(-1px);
}

.dropzone.has-file {
  border-style: solid;
  border-color: rgba(36, 106, 87, 0.38);
  background: rgba(223, 236, 228, 0.48);
}

.dropzone span {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.dropzone small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

select {
  width: 100%;
  height: 46px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 0 12px;
}

.control-panel .secondary-action {
  width: 100%;
  margin-top: 10px;
}

.result-panel {
  min-height: 640px;
  background: rgba(255, 253, 248, 0.7);
}

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

.result-header span {
  color: var(--green);
  font-weight: 700;
}

.compare {
  --split: 50%;
  position: relative;
  min-height: 540px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, rgba(31, 41, 36, 0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(31, 41, 36, 0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(31, 41, 36, 0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(31, 41, 36, 0.035) 75%),
    #f2f0ea;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.compare img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 540px;
  object-fit: contain;
  padding: 26px;
}

.before-strip {
  position: absolute;
  inset: 0;
  width: 100%;
  overflow: hidden;
  clip-path: inset(0 calc(100% - var(--split)) 0 0);
  box-shadow: 14px 0 30px rgba(31, 41, 36, 0.16);
}

.before-strip img {
  width: 100%;
  max-width: none;
}

.compare-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
}

.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split);
  width: 2px;
  background: rgba(255, 253, 248, 0.95);
  box-shadow: 0 0 0 1px rgba(17, 23, 20, 0.1);
  transform: translateX(-50%);
  pointer-events: none;
}

.compare-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 18px, rgba(255, 255, 255, 0.82) 18px 20px, transparent 20px),
    rgba(17, 23, 20, 0.82);
  box-shadow: 0 14px 30px rgba(17, 23, 20, 0.24);
  transform: translate(-50%, -50%);
}

.compare-handle::after {
  content: "< >";
  position: absolute;
  top: 50%;
  left: 50%;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  transform: translate(-50%, -50%);
}

.compare-label {
  position: absolute;
  top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 253, 248, 0.9);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(31, 41, 36, 0.08);
}

.before-label {
  left: 14px;
}

.after-label {
  right: 14px;
}

.download-link {
  margin-top: 14px;
}

.empty-state {
  display: grid;
  min-height: 590px;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
}

.empty-state h2 {
  margin-bottom: 0;
}

.empty-state p {
  max-width: 320px;
  margin-bottom: 0;
}

.empty-illustration {
  width: min(240px, 64vw);
  aspect-ratio: 1.22;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(circle at 38% 48%, #d79a58 0 13%, transparent 13%),
    radial-gradient(circle at 56% 56%, #8bbf95 0 19%, transparent 19%),
    linear-gradient(135deg, #fffdf8, #dfece4);
  box-shadow: var(--shadow-sm);
}

.loading-mark {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(36, 106, 87, 0.18);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

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

.history-title {
  margin-top: 24px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  text-align: left;
  transition: transform 160ms var(--ease-out), border-color 160ms ease, background-color 160ms ease;
}

.history-item:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.84);
}

.history-item span,
.history-item small {
  color: var(--muted);
}

.history-item strong {
  overflow-wrap: anywhere;
}

.error {
  margin: 12px 0 0;
  color: var(--danger);
}

.hero-copy,
.hero-preview,
.page-heading,
.mode-card,
.control-panel,
.result-panel,
.guide-panel {
  animation: enter 360ms var(--ease-soft) both;
}

.hero-preview,
.result-panel {
  animation-delay: 60ms;
}

.guide-panel {
  animation-delay: 110ms;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .hero-grid,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .control-panel,
  .guide-panel {
    position: static;
  }

  .mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 1380px);
    padding-top: 12px;
  }

  .site-nav,
  .page-heading,
  .workbench-heading {
    display: grid;
    grid-template-columns: 1fr;
  }

  .site-nav {
    position: static;
    gap: 12px;
  }

  .nav-links,
  .nav-side {
    justify-content: flex-start;
  }

  .nav-links {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .brand-lockup {
    width: 100%;
  }

  .hero-grid {
    min-height: auto;
  }

  .hero-copy,
  .hero-preview,
  .control-panel,
  .result-panel,
  .guide-panel {
    padding: 16px;
  }

  h1,
  .page-heading h1 {
    font-size: 2.08rem;
    line-height: 1.12;
  }

  .hero-actions .primary-action,
  .hero-actions .secondary-action,
  .topbar-actions,
  .text-button {
    width: 100%;
  }

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

  .mode-card {
    min-height: 260px;
  }

  .preview-canvas {
    min-height: 310px;
  }

  .compare,
  .compare img {
    min-height: 410px;
  }

  .empty-state {
    min-height: 410px;
  }
}

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