:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --line: #d8dee9;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 280px),
    var(--bg);
  color: var(--text);
}

.app {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: grid;
  gap: 16px;
}

[hidden] {
  display: none !important;
}

.workspace {
  display: grid;
  gap: 16px;
}

.authPanel {
  width: min(420px, 100%);
  margin: 10vh auto 0;
}

.panel,
.result {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.08);
}

.heading {
  margin-bottom: 20px;
}

.headingRow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.intro {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 20px;
}

.form {
  display: grid;
  gap: 16px;
}

.uploadBox {
  min-height: 132px;
  border: 1.5px dashed #94a3b8;
  border-radius: 8px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
}

.uploadBox input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.uploadTitle {
  font-size: 18px;
  font-weight: 800;
}

.uploadHint,
.status,
.field span {
  color: var(--muted);
  font-size: 14px;
}

.uploadPreview {
  margin: 0;
  display: grid;
  gap: 8px;
}

.uploadPreview img {
  display: block;
  width: 100%;
  max-height: 360px;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.uploadPreview figcaption {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

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

textarea,
input[type="password"] {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  background: #ffffff;
}

textarea:focus,
input[type="password"]:focus,
button:focus-visible,
.download:focus-visible,
.uploadBox:focus-within {
  outline: 3px solid rgba(15, 118, 110, 0.25);
  outline-offset: 2px;
}

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

.secondaryButton {
  min-height: 36px;
  padding: 0 12px;
  background: #e2e8f0;
  color: var(--text);
  font-size: 13px;
}

.secondaryButton:hover {
  background: #cbd5e1;
}

button:hover,
.download:hover {
  background: var(--accent-strong);
}

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

.status {
  margin: 14px 0 0;
  min-height: 22px;
}

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

.resultHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.download {
  min-height: 40px;
  font-size: 14px;
  white-space: nowrap;
}

.result img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

@media (min-width: 760px) {
  .workspace {
    grid-template-columns: 420px 1fr;
    align-items: start;
  }

  .app {
    padding-top: 44px;
  }
}
