:root {
  color-scheme: light;
  --bg: #f5f1e7;
  --bg-strong: #efe4d1;
  --panel: rgba(255, 251, 245, 0.94);
  --ink: #1d1c18;
  --muted: #645d52;
  --line: rgba(72, 54, 23, 0.12);
  --accent: #0b8f61;
  --accent-deep: #086346;
  --accent-soft: rgba(11, 143, 97, 0.12);
  --warn: #95660d;
  --error: #ab3e28;
  --shadow: 0 26px 70px rgba(71, 53, 22, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(11, 143, 97, 0.16), transparent 28%),
    radial-gradient(circle at left center, rgba(236, 138, 27, 0.12), transparent 24%),
    linear-gradient(180deg, #fbf8f2 0%, var(--bg) 100%);
}

.page-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

h1,
h2,
p,
ul {
  margin: 0;
}

.hero {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  align-items: stretch;
  margin-bottom: 22px;
}

.hero-copy,
.hero-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-copy {
  padding: 32px;
}

.hero-card {
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(11, 143, 97, 0.08), rgba(255, 255, 255, 0.92)),
    var(--panel);
}

.hero-card ul {
  padding-left: 18px;
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.65;
}

.eyebrow {
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  color: var(--accent-deep);
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 4vw, 4.8rem);
  line-height: 0.97;
  max-width: 12ch;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 1.75rem);
}

.lede {
  margin-top: 18px;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.65;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-badges span,
.pill {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.9rem;
  font-weight: 700;
}

.panel {
  padding: 24px;
}

.upload-panel,
.output-panel {
  margin-bottom: 22px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.text-link {
  color: var(--accent-deep);
  text-decoration: none;
  font-weight: 700;
}

.dropzone {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 28px;
  border-radius: 24px;
  border: 1px dashed rgba(11, 143, 97, 0.34);
  background:
    linear-gradient(135deg, rgba(11, 143, 97, 0.12), rgba(255, 255, 255, 0.82));
  cursor: pointer;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.dropzone-copy {
  color: var(--muted);
}

.workspace {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.92fr);
  margin-bottom: 22px;
}

.video-frame,
.result-frame {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(8, 99, 70, 0.08), rgba(255, 255, 255, 0.88)),
    var(--bg-strong);
  min-height: 280px;
}

#source-preview,
#result-preview,
#sheet-preview {
  display: block;
  width: 100%;
  max-height: 520px;
  margin: 0 auto;
  background: #111;
}

#result-preview,
#sheet-preview {
  object-fit: contain;
}

#sheet-preview {
  background: transparent;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  text-align: center;
  color: var(--muted);
}

.control-grid,
.result-grid {
  display: grid;
  gap: 16px;
}

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

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

.two-column-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 0.9fr) minmax(260px, 1.1fr);
  align-items: start;
}

.image-preview-shell {
  min-width: 0;
}

.image-preview-frame {
  min-height: 240px;
}

.image-controls-grid {
  margin-bottom: 0;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.94rem;
  font-weight: 700;
}

input,
select,
button {
  font: inherit;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 2px solid rgba(11, 143, 97, 0.22);
  border-color: var(--accent);
}

.tip-block,
.result-card,
.sticker-result-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.tip-title,
.result-label {
  font-weight: 800;
  margin-bottom: 6px;
}

.step-four-card {
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(11, 143, 97, 0.08), rgba(255, 255, 255, 0.92));
}

.step-four-lede {
  font-weight: 800;
  margin-bottom: 8px;
}

.step-four-copy {
  color: var(--muted);
  line-height: 1.6;
}

.step-four-progress {
  margin-top: 14px;
  color: var(--accent-deep);
  font-weight: 700;
}

.tip-block p:last-child,
.support-copy {
  color: var(--muted);
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.primary-button,
.ghost-button,
.download-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 13px 18px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #1eae7c 100%);
}

.ghost-button,
.download-link {
  color: var(--ink);
  background: rgba(29, 28, 24, 0.06);
}

.download-list {
  display: grid;
  gap: 12px;
}

.sticker-results {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.sticker-results.empty {
  color: var(--muted);
}

.sticker-result-card {
  margin-top: 0;
}

.sticker-result-preview {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(8, 99, 70, 0.08), rgba(255, 255, 255, 0.88)),
    var(--bg-strong);
}

.sticker-result-preview img {
  display: block;
  max-width: 100%;
  max-height: 260px;
}

.sticker-result-meta {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.download-link.disabled {
  pointer-events: none;
  opacity: 0.48;
}

.status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  line-height: 1.55;
}

.status.pending {
  color: var(--warn);
  background: rgba(212, 170, 61, 0.14);
}

.status.success {
  color: var(--accent-deep);
  background: rgba(11, 143, 97, 0.12);
}

.status.error {
  color: var(--error);
  background: rgba(171, 62, 40, 0.12);
}

code {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.progress-log {
  margin: 0;
  min-height: 180px;
  max-height: 320px;
  overflow: auto;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #181a17;
  color: #e8f0e8;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.87rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 920px) {
  .hero,
  .workspace,
  .result-grid,
  .control-grid,
  .two-column-layout {
    grid-template-columns: minmax(0, 1fr);
  }

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

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    border-radius: 24px;
  }

  .video-frame,
  .result-frame {
    min-height: 220px;
  }
}
