:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --ink: #1d2527;
  --muted: #667174;
  --line: #d8ded8;
  --panel: #ffffff;
  --accent: #0e7c66;
  --accent-strong: #075f50;
  --warn: #af5b16;
  --error: #b42318;
  --shadow: 0 20px 60px rgba(29, 37, 39, 0.12);
}

* {
  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;
  color: var(--ink);
  background:
    linear-gradient(rgba(247, 243, 234, 0.9), rgba(247, 243, 234, 0.9)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23d7c7a3' stroke-opacity='.38'%3E%3Cpath d='M18 38h144M18 90h144M18 142h144M38 18v144M90 18v144M142 18v144'/%3E%3Ccircle cx='38' cy='38' r='6'/%3E%3Ccircle cx='142' cy='142' r='6'/%3E%3C/g%3E%3C/svg%3E");
}

.app-shell {
  width: min(980px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 34px 0;
}

.tool {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(216, 222, 216, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 34px);
}

.title-row,
.meta,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  max-width: 700px;
  margin-top: 6px;
  font-size: 22px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.status {
  flex: 0 0 auto;
  min-width: 72px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.status.busy {
  color: var(--warn);
  border-color: rgba(175, 91, 22, 0.4);
}

.status.done {
  color: var(--accent);
  border-color: rgba(14, 124, 102, 0.35);
}

.status.error {
  color: var(--error);
  border-color: rgba(180, 35, 24, 0.35);
}

.input-panel {
  margin-top: 28px;
}

textarea {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background: #fbfcfa;
  font: inherit;
  line-height: 1.55;
  outline: none;
}

textarea:focus {
  border-color: rgba(14, 124, 102, 0.6);
  box-shadow: 0 0 0 4px rgba(14, 124, 102, 0.12);
}

.actions {
  justify-content: flex-end;
  margin-top: 14px;
}

button,
.download,
#sourceLink {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button,
.download {
  background: var(--accent);
  color: white;
}

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

button.secondary {
  background: #e9eee9;
  color: var(--ink);
}

.message {
  margin-top: 18px;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff6e8;
  color: var(--warn);
  line-height: 1.5;
}

.result {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.kind {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

#author {
  margin-top: 8px;
  color: var(--muted);
}

#sourceLink {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fbfcfa;
}

.downloads {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.download {
  width: 100%;
}

@media (max-width: 640px) {
  .title-row,
  .meta,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .status,
  button,
  #sourceLink {
    width: 100%;
  }
}
