:root {
  --bg: #ffffff;
  --bg-alt: #f4f6fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #5b6577;
  --line: #dde3ee;
  --accent: #1f4fd6;
  --accent-ink: #ffffff;
  --accent-soft: #e8eefc;
  --good: #137a4b;
  --bad: #b42318;
  --warn-bg: #fff6e5;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 4px 16px rgb(16 24 40 / 6%);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --bg-alt: #151c2b;
    --card: #182033;
    --text: #e8ecf5;
    --muted: #9aa6bd;
    --line: #2a3550;
    --accent: #6f95ff;
    --accent-ink: #0b1020;
    --accent-soft: #1e2a4a;
    --good: #4cc38a;
    --bad: #ff8a80;
    --warn-bg: #2d2516;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
/* Classes like .btn set display, which would otherwise override the hidden attribute. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.45rem; margin: 0 0 1rem; }
h3 { font-size: 1.08rem; margin: 0 0 .5rem; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--card); padding: 8px; z-index: 10; }

.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: .95rem; }
.site-nav { display: flex; gap: 4px 16px; flex-wrap: wrap; font-size: .95rem; }
.site-nav a { color: var(--text); text-decoration: none; padding: 6px 0; }
.site-nav a:hover { color: var(--accent); }
.nav-account { font-weight: 600; color: var(--accent) !important; }

.hero { padding: 40px 0 8px; }
.lead { font-size: 1.12rem; color: var(--muted); margin: 0 0 8px; }
.section { padding: 44px 0; }
.section.alt { background: var(--bg-alt); }

.tool-wrap { margin: 16px 0 8px; }
.tool { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin: 16px 0; }
.tool-title { font-size: 1.15rem; margin-bottom: 12px; }
label { display: block; font-weight: 600; margin: 12px 0 6px; }
label .muted { font-weight: 400; }
textarea, input, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
textarea { resize: vertical; line-height: 1.55; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tool-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.wc { color: var(--muted); font-size: .92rem; }
.tool-note { font-size: .9rem; color: var(--muted); margin: 10px 0 0; }
.disclaimer { font-size: .8rem; color: var(--muted); margin: 10px 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  border-radius: 8px; padding: 11px 18px; border: 1px solid transparent; min-height: 44px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.link { background: none; border: none; color: var(--accent); padding: 8px 0; min-height: 0; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 6px 12px; min-height: 0; font-size: .9rem; }
.btn:disabled { opacity: .6; cursor: progress; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.status { min-height: 1.2em; margin: 8px 0; }
.status.busy { color: var(--muted); }
.status.error { color: var(--bad); }
.status.ok { color: var(--good); }

.result { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin: 16px 0 32px; }
.overall { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 16px; }
.overall-band { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 120px; padding: 12px; border-radius: var(--radius); background: var(--accent-soft); }
.overall-band .label { font-size: .78rem; color: var(--muted); text-align: center; }
.overall-band .big { font-size: 2.6rem; font-weight: 800; color: var(--accent); line-height: 1.1; }
.overall-meta { flex: 1 1 260px; }
.overall-meta p { margin: 0 0 6px; }
.criteria { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.criterion { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.criterion p { margin: 6px 0; }
.criterion-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.criterion-head h3 { margin: 0; }
.pill { font-weight: 700; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 10px; }
.bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.bar span { display: block; height: 100%; background: var(--accent); }
.improve { padding-left: 1.1rem; margin: 6px 0 0; }
.issues, .fixes, .vocab, .paras, .rewrite { margin-top: 20px; }
.issues ol, .paras ol { padding-left: 1.3rem; }
.correction { border-left: 3px solid var(--accent); padding: 4px 12px; margin: 10px 0; }
.correction p { margin: 4px 0; }
.orig { text-decoration: line-through; color: var(--bad); }
.fix { color: var(--good); font-weight: 600; }
.tag { display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; color: var(--muted); }
.rewrite p { margin: 8px 0; }
.unlock { margin-top: 20px; border: 1px dashed var(--accent); border-radius: var(--radius); padding: 16px; background: var(--accent-soft); }
.unlock .sample { background: var(--card); border-radius: 8px; }
.warn { background: var(--warn-bg); border-radius: 8px; padding: 10px 12px; }
.ai-note { margin-top: 16px; }
.sample-report .tag { vertical-align: middle; }

.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.compare-col { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--card); }
.compare-col.paid { border-color: var(--accent); }
.ticks { list-style: none; padding: 0; margin: 0 0 12px; }
.ticks li { padding-left: 1.6rem; position: relative; margin: 6px 0; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 700; }
.list li { margin: 8px 0; }

.criteria-table, .history, .tables3 table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.criteria-table th, .criteria-table td, .history th, .history td, .tables3 th, .tables3 td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; vertical-align: top; }
.criteria-table th[scope="row"] { width: 32%; }
.tables3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.tables3 caption { font-weight: 700; text-align: left; padding: 6px 0; }
.history { margin: 8px 0 16px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.calc-out { font-size: 1.2rem; font-weight: 700; margin: 16px 0 4px; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 24px 0 12px; }
.plan { position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: var(--card); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.plan.best { border: 2px solid var(--accent); }
.plan .btn { margin-top: auto; }
.badge { position: absolute; top: -12px; left: 20px; margin: 0; background: var(--accent); color: var(--accent-ink); font-size: .78rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; }
.price { font-size: 2rem; font-weight: 800; margin: 6px 0; }
.price span { font-size: 1rem; font-weight: 500; color: var(--muted); }

.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq .answer { color: var(--muted); padding-top: 6px; }

.doc { padding: 32px 16px 48px; }
.doc h2 { font-size: 1.2rem; margin-top: 28px; }
.app-page { padding: 32px 16px 48px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 16px 0; background: var(--card); }
.login-form { max-width: 460px; }
.login-form .btn { margin-top: 12px; }
.essay-copy { margin-top: 24px; }
.essay-text p { margin: 8px 0; white-space: pre-wrap; }

.site-footer { border-top: 1px solid var(--line); background: var(--bg-alt); padding: 32px 0 24px; margin-top: 32px; font-size: .93rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.footer-brand { font-weight: 700; margin: 0 0 6px; }
.footer-h { font-weight: 700; margin: 0 0 6px; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin: 4px 0; }
.footer-fine { font-size: .8rem; margin-top: 20px; }

@media (max-width: 560px) {
  /* The logo already links home; this keeps the header to two lines on phones. */
  .nav-home { display: none; }
  .tool, .result { padding: 14px; }
  .tool-row .btn { width: 100%; }
  .criteria-table th[scope="row"] { width: auto; }
}
