:root {
  --bg0: #edf1f0;
  --bg1: #dfe8e5;
  --ink: #15241f;
  --muted: #5a6d66;
  --line: rgba(21, 36, 31, 0.12);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #f7faf8;
  --accent: #0d6e63;
  --accent-2: #0a544c;
  --accent-soft: rgba(13, 110, 99, 0.1);
  --danger: #b42318;
  --ok: #0d6e63;
  --shadow: 0 20px 48px rgba(21, 36, 31, 0.1);
  --radius: 20px;
  --font-display: "DM Serif Display", "Songti SC", Georgia, serif;
  --font-body: "Outfit", "PingFang SC", "Microsoft YaHei", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(13, 110, 99, 0.16), transparent 55%),
    radial-gradient(700px 380px at 92% 8%, rgba(21, 36, 31, 0.08), transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1));
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.page {
  width: min(1040px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.75rem 0 3.5rem;
  position: relative;
  z-index: 1;
}

.hero {
  margin-bottom: 1.75rem;
  animation: enter 0.55s var(--ease) both;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 8vw, 5.2rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.hero h1 {
  margin: 0.15rem 0 0.55rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.55rem);
  letter-spacing: -0.02em;
  color: var(--ink);
}

.lede {
  margin: 0;
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.02rem;
}

.lede code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  color: var(--accent-2);
}

.alert {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(180, 35, 24, 0.28);
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
  animation: enter 0.45s var(--ease) both;
}

.notice {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(13, 110, 99, 0.22);
  background: rgba(13, 110, 99, 0.08);
  color: var(--accent-2);
  font-size: 0.9rem;
  line-height: 1.55;
  animation: enter 0.45s var(--ease) both;
}

.notice p {
  margin: 0;
}

.notice-important {
  padding: 1rem 1.1rem 1.05rem;
  border: 1px solid rgba(13, 110, 99, 0.35);
  border-left: 4px solid var(--accent);
  background: linear-gradient(135deg, rgba(13, 110, 99, 0.14), rgba(13, 110, 99, 0.06));
  box-shadow: 0 10px 28px rgba(13, 110, 99, 0.12);
}

.notice-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.45rem !important;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  color: #f4fffc;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.notice-label::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.72rem;
  line-height: 1;
}

.notice-text {
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.65;
}

.notice-text strong {
  color: var(--accent-2);
  font-weight: 700;
}

.notice-compact {
  margin: 0.75rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px dashed rgba(13, 110, 99, 0.35);
  background: rgba(13, 110, 99, 0.06);
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.5;
}

.notice-compact .notice-label {
  margin: 0 0.45rem 0 0 !important;
  vertical-align: middle;
}

.notice-compact strong {
  color: var(--accent-2);
}

.workspace {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 1rem;
  animation: enter 0.65s var(--ease) 0.08s both;
}

.workspace.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

.stage,
.controls {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stage {
  padding: 1rem;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.drop {
  position: relative;
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  padding: 1.5rem;
  border-radius: calc(var(--radius) - 6px);
  border: 1.5px dashed rgba(21, 36, 31, 0.2);
  background:
    linear-gradient(180deg, rgba(13, 110, 99, 0.05), transparent 65%);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.25s var(--ease);
}

.drop:hover,
.drop:focus-within,
.drop.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.drop.is-drag {
  box-shadow: inset 0 0 0 1px rgba(13, 110, 99, 0.25);
}

.drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-icon {
  color: var(--accent);
  margin-bottom: 0.35rem;
  transition: transform 0.3s var(--ease);
}

.drop:hover .drop-icon,
.drop.is-drag .drop-icon {
  transform: translateY(-3px);
}

.drop-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.drop-sub {
  color: var(--muted);
  font-size: 0.92rem;
}

.stage.has-file .drop {
  display: none;
}

.preview[hidden] {
  display: none !important;
}

.preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: enter 0.4s var(--ease) both;
}

.preview-main {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1rem;
  align-items: center;
}

@media (max-width: 520px) {
  .preview-main {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

.checker {
  width: 140px;
  height: 140px;
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    linear-gradient(45deg, #cfd8d4 25%, transparent 25%) 0 0 / 14px 14px,
    linear-gradient(-45deg, #cfd8d4 25%, transparent 25%) 0 7px / 14px 14px,
    linear-gradient(45deg, transparent 75%, #cfd8d4 75%) 7px -7px / 14px 14px,
    linear-gradient(-45deg, transparent 75%, #cfd8d4 75%) -7px 0 / 14px 14px,
    #eef3f1;
}

.checker img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.preview-info {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.preview-info strong {
  font-size: 1.05rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-info span {
  color: var(--muted);
  font-size: 0.9rem;
}

.link-btn {
  justify-self: start;
  margin-top: 0.45rem;
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.preview-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--line);
}

.size-cell {
  display: grid;
  gap: 0.3rem;
  justify-items: center;
  min-width: 56px;
}

.size-cell .thumb {
  width: var(--s, 32px);
  height: var(--s, 32px);
  border-radius: 6px;
  border: 1px solid var(--line);
  object-fit: contain;
  background:
    linear-gradient(45deg, #cfd8d4 25%, transparent 25%) 0 0 / 8px 8px,
    linear-gradient(-45deg, #cfd8d4 25%, transparent 25%) 0 4px / 8px 8px,
    #eef3f1;
  image-rendering: auto;
}

.size-cell .label {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.controls {
  padding: 1.15rem 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.block h2,
.block-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.block > h2 {
  margin-bottom: 0.7rem;
}

.presets {
  display: flex;
  gap: 0.3rem;
}

.preset {
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--muted);
  border-radius: 8px;
  padding: 0.28rem 0.55rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.preset:hover,
.preset.is-active {
  border-color: rgba(13, 110, 99, 0.35);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.sizes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.size {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.size input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.size.is-on {
  border-color: rgba(13, 110, 99, 0.4);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.fits {
  display: grid;
  gap: 0.45rem;
}

.fit {
  position: relative;
  display: grid;
  gap: 0.1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.fit input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.fit.is-on {
  border-color: rgba(13, 110, 99, 0.4);
  background: var(--accent-soft);
}

.fit-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.fit-desc {
  color: var(--muted);
  font-size: 0.8rem;
}

.actions {
  display: grid;
  gap: 0.55rem;
  margin-top: auto;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s var(--ease), filter 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.btn-main {
  position: relative;
  background: linear-gradient(180deg, #128577, var(--accent-2));
  color: #f4fffc;
  box-shadow: 0 12px 28px rgba(13, 110, 99, 0.28);
}

.btn-main:not(:disabled):hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.btn-main.is-loading .btn-label {
  opacity: 0;
}

.btn-main.is-loading .btn-spinner {
  opacity: 1;
}

.btn-spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 2px solid rgba(244, 255, 252, 0.25);
  border-top-color: #f4fffc;
  opacity: 0;
  animation: spin 0.7s linear infinite;
}

.btn-soft {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-soft:hover {
  background: rgba(21, 36, 31, 0.04);
}

.status {
  min-height: 1.3rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.status.is-error {
  color: var(--danger);
}

.status.is-ok {
  color: var(--ok);
}

.foot {
  margin-top: 1.35rem;
  color: rgba(21, 36, 31, 0.45);
  font-size: 0.84rem;
  animation: enter 0.6s var(--ease) 0.15s both;
}

.foot p {
  margin: 0;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
