:root {
  color-scheme: light dark;
  --ink: #17212b;
  --muted: #536474;
  --line: #d9e0e4;
  --surface: #ffffff;
  --page: #fbfcfb;
  --canvas: #f3f6f5;
  --control: #ffffff;
  --choice-text: #43515c;
  --choice-selected: #eef9f3;
  --upload-hover: #f2faf6;
  --empty-one: #ebf0ed;
  --empty-two: #e6ece8;
  --empty-text: #60726b;
  --disabled: #e4e9e7;
  --disabled-text: #6c7a83;
  --shadow: rgba(21, 38, 46, .055);
  --accent: #047857;
  --accent-dark: #065f46;
  --focus: #f59e0b;
}

:root[data-theme="dark"] {
  --ink: #edf5f1;
  --muted: #b4c5bd;
  --line: #34433e;
  --surface: #16211e;
  --page: #0d1513;
  --canvas: #101916;
  --control: #1b2925;
  --choice-text: #d5e0db;
  --choice-selected: #153e31;
  --upload-hover: #19362d;
  --empty-one: #1a2823;
  --empty-two: #16231f;
  --empty-text: #b4c5bd;
  --disabled: #2b3935;
  --disabled-text: #9bacA5;
  --shadow: rgba(0, 0, 0, .24);
  --accent: #34d399;
  --accent-dark: #6ee7b7;
  --focus: #fbbf24;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --ink: #edf5f1;
    --muted: #b4c5bd;
    --line: #34433e;
    --surface: #16211e;
    --page: #0d1513;
    --canvas: #101916;
    --control: #1b2925;
    --choice-text: #d5e0db;
    --choice-selected: #153e31;
    --upload-hover: #19362d;
    --empty-one: #1a2823;
    --empty-two: #16231f;
    --empty-text: #b4c5bd;
    --disabled: #2b3935;
    --disabled-text: #9bacA5;
    --shadow: rgba(0, 0, 0, .24);
    --accent: #34d399;
    --accent-dark: #6ee7b7;
    --focus: #fbbf24;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--page);
  font-family: Montserrat, Helvetica, sans-serif;
}

a {
  color: inherit;
}

.site-header {
  width: min(1180px, calc(100% - 48px));
  min-height: 80px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wordmark {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.075em;
}

.wordmark span {
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.privacy-link,
footer a {
  color: var(--muted);
  font-size: .9rem;
  text-underline-offset: 3px;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}

.theme-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon--sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon--moon {
  display: none;
}

:root[data-theme="dark"] .theme-icon--sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-icon--moon {
    display: none;
  }

  :root:not([data-theme]) .theme-icon--sun {
    display: block;
  }
}

main {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto 72px;
}

.product-description {
  max-width: 650px;
  padding: 38px 0 32px;
}

.product-description p {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1rem, 2.2vw, 1.16rem);
  font-weight: 500;
  line-height: 1.55;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(390px, 1.05fr);
  align-items: start;
  gap: 32px;
}

.control-column {
  display: grid;
  gap: 18px;
}

.panel,
.preview-column {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 24px var(--shadow);
}

.panel {
  padding: 22px;
}

.panel+.panel {
  margin-top: 18px;
}

.panel-heading,
.preview-heading {
  display: flex;
  justify-content: flex-end;
  align-items: start;
  min-height: 4px;
}

.ratio-badge,
.device-note {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--choice-selected);
  color: var(--accent-dark);
  font-size: .75rem;
  font-weight: 750;
  white-space: nowrap;
}

.upload-dropzone {
  min-height: 205px;
  padding: 24px;
  border: 1.5px dashed #a9bbb6;
  border-radius: 13px;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  transition: border-color .18s, background .18s;
}

.upload-dropzone:hover,
.upload-dropzone:focus-within {
  border-color: var(--accent);
  background: var(--upload-hover);
}

.upload-dropzone.is-loading {
  pointer-events: none;
  opacity: .65;
}

.upload-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--choice-selected);
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 700;
}

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

.upload-copy {
  margin-top: 4px;
  font-size: .8rem;
}

.upload-action {
  margin-top: 14px;
  color: var(--accent);
  font-size: .85rem;
  font-weight: 750;
}

#image-upload {
  width: 1px;
  height: 1px;
  opacity: 0;
  position: absolute;
}

.file-name {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

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

.choice-button {
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--choice-text);
  background: var(--control);
  font: inherit;
  font-size: .82rem;
  font-weight: 650;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, color .15s, background .15s;
}

.choice-button:hover {
  border-color: #7aa998;
}

.choice-button[aria-pressed="true"] {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
  color: var(--accent-dark);
  background: var(--choice-selected);
}

.background-options {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.background-options .choice-button {
  flex: 1 1 110px;
  text-align: center;
}

.preview-column {
  min-height: 100%;
  padding: 24px;
  position: sticky;
  top: 18px;
}

.preview-stage {
  min-height: 455px;
  margin: 18px 0;
  padding: 24px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--canvas);
}

.preview-frame {
  width: min(100%, 360px);
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--canvas);
  box-shadow: 0 16px 28px var(--shadow);
}

#preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  z-index: 1;
}

.empty-preview {
  position: absolute;
  inset: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  color: var(--empty-text);
  background: repeating-linear-gradient(45deg, var(--empty-one), var(--empty-one) 8px, var(--empty-two) 8px, var(--empty-two) 16px);
  font-size: .85rem;
  text-align: center;
}

.empty-preview span {
  max-width: 160px;
  line-height: 1.5;
}

body:has(#editor:not([hidden])) .empty-preview {
  display: none;
}

.download-button {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-size: .93rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s, background .15s;
}

.download-button:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.download-button:disabled {
  color: var(--disabled-text);
  background: var(--disabled);
  cursor: not-allowed;
}

.message {
  margin: 12px 0 0;
  font-size: .82rem;
  line-height: 1.5;
}

.error {
  color: #b42318;
}

.status {
  min-height: 1.25em;
  color: var(--muted);
  text-align: center;
}

button:focus-visible,
a:focus-visible,
.upload-dropzone:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

footer {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
}

.policy-page {
  max-width: 760px;
  padding: 64px 0;
}

.policy-page h1 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
}

.policy-page>p {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.policy-page section {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.policy-page h2 {
  margin-bottom: 9px;
  font-size: 1.08rem;
}

.policy-page section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.back-link {
  display: inline-block;
  margin-top: 40px;
  color: var(--accent-dark);
  font-weight: 750;
  text-underline-offset: 4px;
}

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

  .preview-column {
    position: static;
  }

  .preview-stage {
    min-height: 400px;
  }
}

@media (max-width: 540px) {

  .site-header,
  main,
  footer {
    width: min(100% - 32px, 1180px);
  }

  .site-header {
    min-height: 68px;
  }

  .product-description {
    padding: 26px 0 24px;
  }

  .workspace {
    gap: 18px;
  }

  .panel,
  .preview-column {
    padding: 16px;
    border-radius: 14px;
  }

  .preview-stage {
    min-height: 330px;
    padding: 16px;
  }

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

  .background-options .choice-button {
    flex-basis: 90px;
  }

  .policy-page {
    padding: 40px 0;
  }
}