:root {
  --bg: #0f172a;
  --bg-soft: #121c36;
  --panel: #1a2542;
  --panel-2: #1f2c50;
  --border: #2a3a60;
  --text: #e5eaf5;
  --muted: #9aa7c7;
  --accent: #0b84f3;
  --added-bg: #d1fae5;
  --added-fg: #065f46;
  --removed-bg: #fee2e2;
  --removed-fg: #991b1b;
  --reworded-bg: #fef3c7;
  --reworded-fg: #92400e;
  --risk-bg: #fed7aa;
  --risk-fg: #9a3412;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, #0f172a 0%, #121c36 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(18, 28, 54, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-text strong { font-size: 18px; display: block; }
.brand-text small { color: var(--muted); font-size: 12px; }

.topnav { display: flex; gap: 16px; flex-wrap: wrap; }
.topnav a { color: var(--muted); font-size: 14px; }
.topnav a:hover { color: var(--text); text-decoration: none; }

main { max-width: 1200px; margin: 0 auto; padding: 24px; }

.app-shell {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.app-header h1 { margin: 0 0 4px; font-size: 24px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.app-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
}
.btn:hover { background: #0a6bc8; }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn.ghost:hover { background: var(--panel-2); }

.preset-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  padding: 10px;
  background: var(--bg-soft);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.preset-label { color: var(--muted); font-size: 13px; margin-right: 4px; }

.chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}
.chip:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; }

textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  font-family: "SF Mono", Menlo, Monaco, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px;
  background: var(--bg-soft);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

.result-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.result-panel {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.result-header h2 { margin: 0; font-size: 18px; }

.legend { display: flex; gap: 12px; font-size: 12px; }
.sample { padding: 2px 8px; border-radius: 4px; }
.sample.added { background: var(--added-bg); color: var(--added-fg); }
.sample.removed { background: var(--removed-bg); color: var(--removed-fg); }
.sample.reworded { background: var(--reworded-bg); color: var(--reworded-fg); }
.sample.risk { background: var(--risk-bg); color: var(--risk-fg); }

.diff-output {
  font-family: "SF Mono", Menlo, Monaco, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 200px;
  max-height: 500px;
  overflow-y: auto;
  padding: 12px;
  background: var(--panel-2);
  border-radius: 6px;
}

.diff-output .added { background: var(--added-bg); color: var(--added-fg); border-radius: 3px; padding: 1px 2px; }
.diff-output .removed { background: var(--removed-bg); color: var(--removed-fg); text-decoration: line-through; border-radius: 3px; padding: 1px 2px; }
.diff-output .reworded { background: var(--reworded-bg); color: var(--reworded-fg); border-radius: 3px; padding: 1px 2px; }
.diff-output .risk { background: var(--risk-bg); color: var(--risk-fg); border: 1px solid var(--risk-fg); border-radius: 3px; padding: 1px 2px; font-weight: 600; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }

.side-panel { display: flex; flex-direction: column; gap: 16px; }
.side-panel > div {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.side-panel h2 { margin: 0 0 12px; font-size: 16px; }

.stats dl { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.stats dl > div { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.stats dl > div:last-child { border-bottom: none; }
.stats dt { color: var(--muted); font-size: 14px; }
.stats dd { margin: 0; font-weight: 600; font-size: 18px; }

.intent-list, .history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.intent-list li, .history-list li {
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
}
.intent-list li:hover, .history-list li:hover { border-color: var(--accent); }

.content-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.content-block h2 { margin-top: 0; font-size: 20px; }

.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.steps li { line-height: 1.6; }

.scenario-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.scenario {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.scenario h3 { margin: 0 0 8px; font-size: 16px; }
.scenario p { margin: 0 0 8px; font-size: 14px; }

.ref-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.ref-table th, .ref-table td { padding: 10px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.ref-table th { background: var(--panel-2); font-weight: 600; }
.ref-table td:first-child { width: 120px; font-weight: 600; }

.list { display: flex; flex-direction: column; gap: 10px; padding-left: 20px; }
.list li { line-height: 1.6; }

.faq { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.faq dt { font-weight: 600; margin-bottom: 4px; }
.faq dd { margin: 0 0 8px; color: var(--muted); line-height: 1.6; }

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding: 20px 24px;
  background: var(--bg-soft);
}
.footer-inner { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

@media (max-width: 900px) {
  .inputs-grid, .result-grid, .scenario-grid { grid-template-columns: 1fr; }
  .topnav { display: none; }
  .app-header { flex-direction: column; }
}

@media (max-width: 600px) {
  main { padding: 16px; }
  .app-shell { padding: 16px; }
  .controls { flex-direction: column; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
