:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #1d2621;
  --muted: #617066;
  --line: #d8ded5;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --coffee: #ffdd00;
  --coffee-dark: #6f4e00;
  --warn: #9a3412;
}

* {
  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(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--accent);
  font-size: 13px;
}

.support-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(111, 78, 0, 0.22);
  border-radius: 8px;
  background: var(--coffee);
  color: var(--coffee-dark);
  box-shadow: 0 6px 16px rgba(111, 78, 0, 0.14);
  padding: 0 14px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 900;
}

.support-link:hover {
  border-color: rgba(111, 78, 0, 0.34);
  background: #ffe866;
  transform: translateY(-1px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 20px;
  align-items: start;
}

.composer,
.results {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 32px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 12px;
  font-size: 16px;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.field-note {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: white;
  line-height: 1.5;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.acknowledgement {
  display: flex;
  align-items: start;
  gap: 10px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  background: #f4fbf9;
  padding: 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

input.acknowledgement-checkbox {
  flex: 0 0 18px;
  width: 18px;
  min-width: 18px;
  max-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--accent);
  appearance: auto;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

button {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  background: var(--accent-dark);
}

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

.button-spinner,
.status-spinner {
  display: none;
  flex: 0 0 auto;
  border-radius: 999px;
  border-style: solid;
  animation: spin 0.8s linear infinite;
}

.button-spinner {
  width: 18px;
  height: 18px;
  border-width: 2px;
  border-color: rgba(255, 255, 255, 0.45);
  border-top-color: white;
}

button.loading .button-spinner,
.status.loading .status-spinner {
  display: inline-block;
}

.results {
  min-height: 620px;
}

.status {
  display: inline-flex;
  gap: 8px;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
  border-color: rgba(15, 118, 110, 0.25);
  border-top-color: var(--accent);
}

.status.error {
  border-color: rgba(154, 52, 18, 0.28);
  color: var(--warn);
}

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

.final {
  margin-top: 20px;
}

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

.result-header h2 {
  margin-bottom: 0;
}

.copy-button {
  width: auto;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--accent-dark);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.copy-button[hidden] {
  display: none;
}

.copy-button:hover {
  border-color: rgba(15, 118, 110, 0.36);
  background: #eef8f6;
}

.answer {
  min-height: 180px;
  margin: 0;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 16px;
  line-height: 1.55;
}

.answer.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.answer h1,
.answer h2,
.answer h3 {
  margin: 24px 0 10px;
}

.answer h1:first-child,
.answer h2:first-child,
.answer h3:first-child {
  margin-top: 0;
}

.answer h1 {
  font-size: 24px;
}

.answer h2 {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  font-size: 18px;
}

.answer h2:first-child {
  border-top: 0;
  padding-top: 0;
}

.answer p,
.answer li {
  color: var(--ink);
  line-height: 1.65;
}

.answer ul,
.answer ol {
  padding-left: 22px;
}

.answer blockquote {
  margin: 14px 0;
  border-left: 4px solid var(--accent);
  background: #eef8f6;
  padding: 12px 14px;
}

.answer hr {
  display: none;
}

.seo-section {
  margin-top: 24px;
  padding: 24px 0 8px;
}

.seo-section > div:first-child {
  max-width: 760px;
}

.seo-section h2 {
  font-size: 22px;
}

.seo-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.seo-grid article {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .results {
    min-height: 420px;
  }

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