:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f0eee7;
  --ink: #1c1d20;
  --ink-2: #4a4b50;
  --muted: #7b7c80;
  --line: #d9d7cf;
  --accent: #c04b2a;
  --accent-ink: #ffffff;
  --claim: #1f4f8b;
  --claim-bg: #e3ecf6;
  --evidence: #1f6b3f;
  --evidence-bg: #e1efe6;
  --assumption: #8a5a00;
  --assumption-bg: #f6ecd2;
  --weak: #9c2b1e;
  --weak-bg: #f6e3df;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(28, 29, 32, 0.04), 0 8px 24px rgba(28, 29, 32, 0.06);
  --maxw: 1200px;
  --pad: clamp(16px, 3vw, 32px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--claim); }
a:hover { color: var(--accent); }

.visually-hidden, .skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  display: inline-block;
  padding: 8px 12px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  margin: 8px;
  z-index: 100;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.3rem, 2vw, 1.7rem); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75em; color: var(--ink-2); }
.muted { color: var(--muted); font-size: 0.9rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px var(--pad);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { color: var(--ink); display: inline-flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.05rem; }
.brand-sub { font-size: 0.8rem; color: var(--muted); }

.site-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-nav a {
  text-decoration: none;
  color: var(--ink-2);
  font-size: 0.95rem;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }

main { max-width: var(--maxw); margin: 0 auto; padding: var(--pad); }

section { margin-bottom: 48px; }
.section-head { margin-bottom: 24px; max-width: 720px; }
.section-head p { color: var(--ink-2); }

.hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: end;
  padding: 32px 0 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}
.hero-text p { max-width: 560px; font-size: 1.05rem; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat-num { display: block; font-size: 1.4rem; font-weight: 700; color: var(--ink); }
.stat-label { font-size: 0.8rem; color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--line); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: #a53e21; border-color: #a53e21; color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 10px; font-size: 0.85rem; }

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 24px;
  align-items: start;
}
.app-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.side-panel { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 80px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 1.15rem; }

.strictness { display: flex; align-items: center; gap: 10px; }
.strictness span { font-size: 0.85rem; color: var(--muted); }
.seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.seg-btn {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--ink-2);
  font-weight: 600;
}
.seg-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.5;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  resize: vertical;
  min-height: 140px;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.presets-label { font-size: 0.85rem; color: var(--muted); }
.chip {
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--ink-2);
}
.chip:hover { background: var(--line); color: var(--ink); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.85rem; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-claim { background: var(--claim); }
.dot-evidence { background: var(--evidence); }
.dot-assumption { background: var(--assumption); }
.dot-weak { background: var(--weak); }

.results {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  min-height: 180px;
  background: var(--surface-2);
  font-size: 0.95rem;
  line-height: 1.6;
}
.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty-state svg { color: var(--line); }

.sentence {
  display: inline;
  padding: 2px 4px;
  border-radius: 4px;
  margin: 0 2px;
  cursor: help;
  border: 1px solid transparent;
}
.sentence.claim { background: var(--claim-bg); color: var(--claim); border-color: #c2d1e6; }
.sentence.evidence { background: var(--evidence-bg); color: var(--evidence); border-color: #c2dfd0; }
.sentence.assumption { background: var(--assumption-bg); color: var(--assumption); border-color: #e6d7b0; }
.sentence.weak { background: var(--weak-bg); color: var(--weak); border-color: #e6c4bd; }
.sentence:hover { outline: 2px solid var(--accent); outline-offset: 1px; }

.summary { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.summary-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.summary-num { display: block; font-size: 1.6rem; font-weight: 700; color: var(--ink); }
.summary-label { font-size: 0.8rem; color: var(--muted); }
.summary-text-wrap { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; border: 1px solid var(--line); }
.summary-text { margin: 0; color: var(--ink-2); font-size: 0.95rem; }

.history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.9rem;
}
.history-item .hi-meta { color: var(--muted); font-size: 0.8rem; }
.history-item .hi-actions { display: flex; gap: 6px; }
.history-empty { color: var(--muted); font-size: 0.9rem; padding: 8px 2px; border: 0; background: transparent; }

.defs { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.defs dt { font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; font-size: 0.95rem; }
.defs dd { margin: 2px 0 0 18px; color: var(--ink-2); font-size: 0.9rem; }
.tips { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 0.95rem; display: flex; flex-direction: column; gap: 6px; }

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.guide-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.guide-card h3 { font-size: 1rem; color: var(--ink); }
.guide-card p { color: var(--ink-2); font-size: 0.95rem; margin: 0; }

.walkthrough, .mistakes, .troubleshoot {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.walkthrough h3, .mistakes h3, .troubleshoot h3 { color: var(--ink); }
.mistakes ul, .troubleshoot ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; color: var(--ink-2); }
.mistakes li, .troubleshoot li { line-height: 1.5; }

.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.example-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.example-snippet { display: flex; flex-direction: column; gap: 6px; font-size: 0.95rem; line-height: 1.5; }
.tag { padding: 4px 8px; border-radius: 4px; font-size: 0.9rem; display: inline-block; }
.tag-claim { background: var(--claim-bg); color: var(--claim); }
.tag-evidence { background: var(--evidence-bg); color: var(--evidence); }
.tag-assumption { background: var(--assumption-bg); color: var(--assumption); }
.tag-weak { background: var(--weak-bg); color: var(--weak); }

.about {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 24px var(--pad);
  margin-top: 32px;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.footer-inner nav { display: flex; gap: 16px; }
.footer-inner a { color: var(--ink-2); text-decoration: none; font-size: 0.9rem; }
.footer-inner a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .app-shell { grid-template-columns: 1fr; }
  .side-panel { position: static; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .site-nav { gap: 12px; }
  .hero-stats { grid-template-columns: 1fr 1fr 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .actions { gap: 8px; }
  .btn { padding: 8px 12px; font-size: 0.9rem; }
  .panel { padding: 16px; }
}



/* 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;
}
