:root {
  color-scheme: light;
  --bg: #ece8de;
  --panel: rgba(255, 252, 245, 0.82);
  --line: rgba(35, 30, 25, 0.12);
  --ink: #1f1b18;
  --muted: #71685f;
  --accent: #c95c36;
  --accent-2: #315f72;
  --ok: #1d7a43;
  --error: #9f2f2f;
  --shadow: 0 30px 80px rgba(56, 39, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(201, 92, 54, 0.22), transparent 28%),
    radial-gradient(circle at bottom right, rgba(49, 95, 114, 0.18), transparent 26%),
    linear-gradient(180deg, #f6f2e8 0%, var(--bg) 100%);
}

.shell {
  width: min(1100px, calc(100vw - 32px));
  margin: 24px auto;
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(42px, 8vw, 92px);
  line-height: 0.92;
}

h2 {
  font-size: clamp(26px, 4vw, 40px);
}

.hero-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.upload-card,
.link-card,
.result-text,
.status,
.result-actions button,
.result-actions a {
  border-radius: 22px;
}

.upload-card {
  min-height: 260px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px dashed rgba(49, 95, 114, 0.34);
  background:
    linear-gradient(160deg, rgba(49, 95, 114, 0.11), rgba(255, 255, 255, 0.68)),
    #ffffff;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    transform 0.18s ease,
    background 0.18s ease;
}

.upload-card.dragover {
  border-color: var(--accent-2);
  background:
    linear-gradient(160deg, rgba(49, 95, 114, 0.18), rgba(255, 255, 255, 0.82)),
    #ffffff;
  transform: translateY(-2px);
}

.upload-card input {
  display: none;
}

.upload-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.upload-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.link-card {
  min-height: 260px;
  padding: 18px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
}

.link-card textarea {
  width: 100%;
  border: none;
  outline: none;
  background: #f3eee5;
  color: var(--ink);
  border-radius: 18px;
  padding: 18px 20px;
  font-size: 17px;
  line-height: 1.45;
  min-height: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  resize: none;
  font-family: inherit;
}

.link-card button,
.result-actions button,
.result-actions a {
  border: none;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  padding: 14px 18px;
  font-size: 15px;
  cursor: pointer;
}

.link-card button {
  background: linear-gradient(135deg, var(--accent), #d88b45);
  border-radius: 18px;
}

.link-card button:disabled,
.upload-card:has(input:disabled) {
  cursor: wait;
  opacity: 0.72;
}

.result-panel {
  padding: 24px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-actions {
  display: flex;
  gap: 10px;
}

.result-actions a {
  background: var(--accent-2);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 10px 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.status[hidden] {
  display: none !important;
}

.status.idle {
  background: rgba(49, 95, 114, 0.08);
  color: var(--accent-2);
}

.status.busy {
  background: rgba(201, 92, 54, 0.12);
  color: var(--accent);
}

.status.done {
  background: rgba(29, 122, 67, 0.12);
  color: var(--ok);
}

.status.error {
  background: rgba(159, 47, 47, 0.12);
  color: var(--error);
}

.job-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.job-meta[hidden] {
  display: none !important;
}

.status-spinner {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(201, 92, 54, 0.22);
  border-top-color: currentColor;
  animation: spin 0.8s linear infinite;
}

.status.done .status-spinner,
.status.error .status-spinner {
  display: none;
}

.result-text {
  margin: 18px 0 0;
  min-height: 420px;
  max-height: 65vh;
  overflow: auto;
  padding: 22px;
  background: #fffdf8;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 15px;
}

.fallback-card {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 24px;
  border: 1px solid rgba(201, 92, 54, 0.2);
  background: linear-gradient(180deg, rgba(201, 92, 54, 0.08), rgba(255, 255, 255, 0.95));
}

.fallback-label {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
}

.fallback-title {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.fallback-copy {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 640px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 18px, 1100px);
    margin: 9px auto 18px;
  }

  .hero,
  .result-panel {
    padding: 18px;
  }

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

  .upload-card,
  .link-card {
    min-height: 170px;
  }

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