:root {
  color-scheme: light;
  --ink: #141923;
  --muted: #5f6b78;
  --line: #d9e2ec;
  --paper: #f7f9fc;
  --surface: #ffffff;
  --accent: #ba1c21;
  --accent-dark: #841519;
  --blue: #0077c8;
  --navy: #002855;
  --navy-soft: #edf4fb;
  --red-soft: #fff0f1;
  --error: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
  gap: 28px;
  min-height: 100vh;
  padding: 28px;
  background:
    radial-gradient(circle at 86% 12%, rgba(0, 119, 200, 0.16), transparent 28%),
    radial-gradient(circle at 18% 92%, rgba(186, 28, 33, 0.14), transparent 30%);
}

.workspace {
  align-self: center;
}

.intro {
  margin-bottom: 22px;
}

.brand-logo {
  display: block;
  width: min(220px, 58vw);
  height: auto;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 560px;
  font-size: clamp(2.2rem, 4.2vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.steps {
  display: grid;
  gap: 10px;
  max-width: 440px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  color: var(--muted);
  font-weight: 700;
}

.steps span {
  display: inline-grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  color: #fff;
  background: var(--navy);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 900;
}

.panel {
  display: grid;
  gap: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(0, 40, 85, 0.13);
  backdrop-filter: blur(12px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

label,
summary {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.upload-card {
  display: grid;
  align-content: center;
  min-height: 112px;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(237, 246, 253, 0.92)) padding-box,
    linear-gradient(135deg, rgba(186, 28, 33, 0.6), rgba(0, 119, 200, 0.6)) border-box;
  border: 2px dashed transparent;
  border-radius: 8px;
  cursor: pointer;
}

.upload-card:hover,
.file-input:focus-visible + .upload-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(232, 243, 252, 1)) padding-box,
    linear-gradient(135deg, var(--accent), var(--blue)) border-box;
}

.upload-card.drag-active {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(229, 241, 252, 1)) padding-box,
    linear-gradient(135deg, var(--accent), var(--blue)) border-box;
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0, 40, 85, 0.14);
}

.upload-title {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 900;
}

.upload-copy {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 650;
}

.file-summary {
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

button,
.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--navy));
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.download {
  gap: 7px;
}

.download-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button:hover,
.download:hover {
  background: linear-gradient(135deg, var(--accent-dark), #001b3a);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.status.error {
  color: var(--error);
}

.result-panel {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  min-height: calc(100vh - 72px);
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(237, 246, 253, 0.94) 52%, rgba(255, 241, 242, 0.94) 100%),
    linear-gradient(120deg, var(--navy), var(--accent));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.56), 0 24px 80px rgba(0, 40, 85, 0.12);
}

.placeholder,
#result-image {
  width: min(100%, 720px);
  aspect-ratio: 1;
  border-radius: 8px;
}

.placeholder {
  display: grid;
  align-content: center;
  gap: 10px;
  place-items: center;
  padding: 24px;
  border: 2px dashed rgba(186, 28, 33, 0.38);
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.55);
}

.placeholder strong {
  color: var(--ink);
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  line-height: 1.05;
  max-width: 14ch;
}

#result-image {
  display: block;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 24px 90px rgba(23, 32, 42, 0.18);
}

#result-image[hidden],
.download[hidden],
.placeholder[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .result-panel {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  html,
  body {
    height: 100svh;
    overflow: hidden;
  }

  .shell {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    height: 100svh;
    min-height: 100svh;
    padding: 16px 13px 10px;
    overflow: hidden;
  }

  .workspace {
    align-self: start;
  }

  .intro {
    margin-bottom: 12px;
  }

  .brand-logo {
    width: 112px;
    margin: 0 auto 18px;
  }

  h1 {
    max-width: 330px;
    font-size: 1.58rem;
    line-height: 1.04;
    text-align: left;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 12px;
  }

  .steps li {
    display: flex;
    justify-items: initial;
    align-content: initial;
    gap: 10px;
    min-height: 23px;
    text-align: left;
    font-size: 0.72rem;
    line-height: 1.15;
  }

  .steps span {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
    font-size: 0.74rem;
  }

  .panel,
  .result-panel {
    padding: 13px;
  }

  .panel {
    gap: 10px;
  }

  .upload-card {
    min-height: 78px;
    padding: 18px;
  }

  .upload-title {
    font-size: 1.05rem;
  }

  .upload-copy,
  .file-summary,
  .status {
    font-size: 0.72rem;
  }

  button,
  .download {
    min-height: 32px;
    padding: 0 12px;
    font-size: 0.72rem;
  }

  .download {
    position: absolute;
    right: 12px;
    bottom: 12px;
    box-shadow: 0 10px 28px rgba(0, 40, 85, 0.22);
  }

  .result-panel {
    align-content: start;
    min-height: 0;
    overflow: hidden;
    gap: 8px;
    padding-top: 14px;
  }

  .placeholder,
  #result-image {
    width: min(100%, 360px, 52svh);
    max-height: 360px;
    border-radius: 8px;
  }

  .placeholder {
    padding: 14px;
    margin-inline: auto;
  }

  .placeholder strong {
    font-size: 1rem;
    max-width: 13ch;
  }
}

@media (max-width: 620px) and (max-height: 700px) {
  .shell {
    gap: 8px;
    padding: 10px 10px 8px;
  }

  .intro {
    margin-bottom: 8px;
  }

  .brand-logo {
    width: 96px;
    margin: 0 auto 10px;
  }

  h1 {
    max-width: 100%;
    font-size: 1.12rem;
    line-height: 1.03;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 9px;
  }

  .steps li {
    display: flex;
    justify-items: initial;
    gap: 8px;
    min-height: 21px;
    text-align: left;
    font-size: 0.56rem;
  }

  .steps span {
    width: 20px;
    height: 20px;
    font-size: 0.64rem;
  }

  .panel,
  .result-panel {
    padding: 9px;
  }

  .upload-card {
    min-height: 54px;
    padding: 10px 12px;
  }

  .upload-title {
    font-size: 0.92rem;
  }

  .upload-copy,
  .file-summary,
  .status {
    font-size: 0.66rem;
  }

  button,
  .download {
    min-height: 30px;
    padding: 0 10px;
    font-size: 0.56rem;
  }

  .download {
    right: 8px;
    bottom: 8px;
  }

  .placeholder,
  #result-image {
    width: min(100%, 280px, 42svh);
    max-height: 280px;
  }

  .placeholder strong {
    font-size: 0.78rem;
  }
}

@media (max-width: 340px) and (max-height: 700px) {
  h1 {
    font-size: 1rem;
  }

  button,
  .download {
    font-size: 0.56rem;
  }

  .upload-title {
    font-size: 0.86rem;
  }

  .upload-copy,
  .file-summary,
  .status {
    font-size: 0.6rem;
  }
}
