:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #626a73;
  --line: #d8dee4;
  --surface: #ffffff;
  --canvas: #f3f6f8;
  --accent: #116a7b;
  --accent-dark: #0a4653;
  --accent-soft: #d7eef2;
  --warn: #9a3412;
  --ok: #0f766e;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(243, 246, 248, 0.96)),
    url("https://images.unsplash.com/photo-1601933470096-0e34634ffcde?auto=format&fit=crop&w=1800&q=80");
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
  color: var(--ink);
}

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

.app-shell {
  min-height: 100vh;
  padding: 32px;
}

.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 0 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
}

.status {
  min-width: 96px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.status.is-ok {
  color: var(--ok);
}

.status.is-warn {
  color: var(--warn);
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
}

.panel {
  border: 1px solid rgba(216, 222, 228, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 50px rgba(20, 33, 45, 0.12);
}

.input-panel {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.drop-zone {
  position: relative;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  cursor: pointer;
}

.preview {
  display: grid;
  min-height: 210px;
  place-items: center;
  overflow: hidden;
  border: 1.5px dashed #9aa7b1;
  border-radius: 8px;
  background: #f8fafb;
  color: var(--muted);
  font-weight: 700;
}

.preview img {
  width: 100%;
  height: 100%;
  max-height: 300px;
  object-fit: contain;
  background: #eef2f4;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.preset {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.preset span {
  color: var(--muted);
  font-size: 13px;
}

.preset.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 100px;
  resize: vertical;
  padding: 12px;
}

.primary-button,
.download-link {
  display: inline-grid;
  min-height: 46px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.primary-button:hover,
.download-link:hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--warn);
  font-size: 13px;
}

.result-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
  min-height: 680px;
  padding: 20px;
}

.result-frame {
  display: grid;
  min-height: 560px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, #f8fafb 25%, transparent 25%),
    linear-gradient(-45deg, #f8fafb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f8fafb 75%),
    linear-gradient(-45deg, transparent 75%, #f8fafb 75%);
  background-color: #ffffff;
  background-position:
    0 0,
    0 12px,
    12px -12px,
    -12px 0;
  background-size: 24px 24px;
}

.result-frame img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}

.empty-result {
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 18px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

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

  .result-panel {
    min-height: 520px;
  }

  .result-frame {
    min-height: 420px;
  }
}

@media (max-width: 520px) {
  .control-row {
    grid-template-columns: 1fr;
  }

  .input-panel,
  .result-panel {
    padding: 14px;
  }
}
