:root,
[data-theme="paper"] {
  --bg: #f5f5f1;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #5a5a54;
  --border: #111111;
  --hairline: #d6d6cd;
  --accent: #7c3aed;
  --accent-soft: #ede9fe;
  --accent-fg: #ffffff;
  --link: #6d28d9;
  --shadow: 4px 4px 0 #111111;
  --btn-bg: #111111;
  --btn-fg: #ffffff;
  --kbd-bg: #fafaf7;
  --kbd-border: #cfcfc6;
}

[data-theme="dark"] {
  --bg: #121418;
  --surface: #1a1d23;
  --ink: #f3f3ee;
  --muted: #a3a8b3;
  --border: #3b404c;
  --hairline: #2a2e37;
  --accent: #8b5cf6;
  --accent-soft: #2e1065;
  --accent-fg: #ffffff;
  --link: #c4b5fd;
  --shadow: 4px 4px 0 #000000;
  --btn-bg: #8b5cf6;
  --btn-fg: #ffffff;
  --kbd-bg: #22262e;
  --kbd-border: #3b404c;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 ui-monospace, "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.col { width: min(72rem, 100%); margin: 0 auto; padding: 0 1.25rem; }

/* Top Banner */
.banner {
  background: var(--accent-soft);
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  padding: .42rem 1rem;
  text-align: center;
  font-size: 12px;
}
.banner-badge {
  display: inline-block;
  margin-left: .4rem;
  padding: 1px 7px;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
  border: 1px solid #111111;
}

/* Site Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header .col {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.4rem;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--ink);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -.03em;
  text-decoration: none;
}
.brand-link:hover { text-decoration: none; }
.brand-sub { font-weight: 400; color: var(--muted); font-size: 12px; }

.nav { display: flex; align-items: center; gap: 1.1rem; font-size: 13px; }
.nav a, .nav button {
  background: none;
  border: 0;
  padding: .35rem .25rem;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.nav a:hover, .nav button:hover { color: var(--link); text-decoration: none; }
.caret { font-size: 9px; opacity: .65; }

.menu { position: relative; }
.dropdown {
  position: absolute;
  top: calc(100% + .45rem);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1rem;
  z-index: 50;
  min-width: 16rem;
}
.dropdown.mega { min-width: min(52rem, 90vw); }
.mega-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.dropdown h3 { margin: 0 0 .5rem; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.dropdown ul { list-style: none; margin: 0; padding: 0; }
.dropdown li { margin: .25rem 0; font-size: 12.5px; }
.dropdown .foot-row { margin-top: .85rem; padding-top: .65rem; border-top: 1px dashed var(--hairline); font-size: 12.5px; }

.header-right { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.nav-search { position: relative; }
.nav-search input {
  width: 14rem;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--hairline);
  padding: .38rem 1.8rem .38rem .65rem;
  font: 12.5px/1.2 inherit;
}
.nav-search input:focus { outline: none; border-color: var(--border); }
.nav-search kbd {
  position: absolute;
  right: .45rem;
  top: 50%;
  transform: translateY(-50%);
  font: 11px/1 inherit;
  color: var(--muted);
  pointer-events: none;
}
.sr-list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: min(24rem, 85vw);
  max-height: 22rem;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: .35rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 60;
}
.sr-list li a {
  display: block;
  padding: .45rem .8rem;
  color: var(--ink);
  font-size: 12.5px;
}
.sr-list li a:hover { background: var(--accent); color: var(--accent-fg); text-decoration: none; }
.sr-cat { float: right; font-size: 11px; color: var(--muted); }

.tbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline);
  cursor: pointer;
  font: inherit;
}
.tbtn:hover { border-color: var(--border); }

/* Main Content */
main { padding: 2.25rem 0 4rem; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: .75rem; }
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 .45rem; }

h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3.8vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.15;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.cursor {
  display: inline-block;
  width: .52em;
  height: .95em;
  background: var(--ink);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.lede { max-width: 44rem; margin: .65rem 0 1.5rem; color: var(--muted); font-size: 13.5px; }

/* Card & Terminal */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.card.dragover { outline: 2px dashed var(--link); outline-offset: -6px; }

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .55rem;
  font-size: 12.5px;
}
.field-head label { font-weight: 700; }
.toolbar-links { display: flex; flex-wrap: wrap; gap: .8rem; }
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--link);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

textarea.editor, input.text-input {
  width: 100%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline);
  padding: .7rem .8rem;
  font: 13px/1.55 inherit;
}
textarea.editor { min-height: 13rem; resize: vertical; }
textarea.editor:focus, input.text-input:focus { outline: none; border-color: var(--border); }

.buffer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .6rem;
  padding: .5rem .75rem;
  background: var(--accent-soft);
  color: var(--ink);
  border: 1px solid var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.buffer-bar[hidden] { display: none; }

.opt-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .9rem 0;
  font-size: 13px;
  cursor: pointer;
}
.opt-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--ink); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: .75rem 0 1rem; }
.input-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: .35rem; }

.submit-row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--border);
  padding: .62rem 1.15rem;
  font: 13px/1.2 inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary:hover:not(:disabled) { opacity: .9; }
.btn-primary:disabled { opacity: .55; cursor: wait; }

.kbd-chip {
  border: 1px solid var(--kbd-border);
  background: var(--kbd-bg);
  color: var(--muted);
  padding: 2px 7px;
  font-size: 11.5px;
}
.status-msg { font-size: 12px; color: var(--muted); }
.error-banner {
  margin: 0 0 1rem;
  padding: .65rem .9rem;
  border: 1px solid #b42318;
  background: #fef3f2;
  color: #b42318;
  font-size: 12.5px;
}
.error-banner[hidden] { display: none; }

/* Dark Terminal $ Result */
.terminal-card {
  margin-top: 1.5rem;
  background: #161616;
  color: #f3f3ee;
  border: 1px solid #111111;
  box-shadow: var(--shadow);
}
.terminal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem 1rem;
  border-bottom: 1px solid #2b2b2b;
  font-size: 12.5px;
}
.terminal-title { color: #c4b5fd; font-weight: 700; }
.terminal-meta { color: #9ea4b0; font-size: 12px; margin-left: .6rem; font-weight: 400; }
.terminal-actions { display: flex; align-items: center; gap: .85rem; }
.term-btn {
  background: none;
  border: 0;
  padding: 0;
  color: #c5cbd6;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.term-btn:hover { color: #ffffff; text-decoration: underline; }
.terminal-body {
  margin: 0;
  padding: 1rem;
  max-height: 26rem;
  overflow: auto;
  font: 13px/1.6 inherit;
  white-space: pre;
  tab-size: 4;
}
.terminal-body.wrapped { white-space: pre-wrap; word-break: break-word; }
.terminal-note {
  padding: .5rem 1rem;
  border-top: 1px solid #2b2b2b;
  color: #c4b5fd;
  font-size: 12px;
}
.terminal-note[hidden] { display: none; }

/* Sections Below Fold */
.dotted-rule { border: 0; border-top: 1px dashed var(--hairline); margin: 2.5rem 0; }
.sec-title {
  display: inline-block;
  margin: 0 0 1rem;
  font-size: 15px;
  font-weight: 700;
  border-bottom: 1px solid var(--ink);
  padding-bottom: .15rem;
}

.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1.25rem; align-items: start; }
.about-card p { margin: 0 0 .9rem; color: var(--muted); font-size: 13px; }
.about-card p:last-child { margin-bottom: 0; }

.combo-list { list-style: none; margin: .75rem 0 0; padding: 0; }
.combo-list li { border-top: 1px dashed var(--hairline); }
.combo-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 0;
  color: var(--ink);
  font-size: 12.5px;
}
.combo-list li a:hover { color: var(--link); text-decoration: none; }

.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.step-cell { padding: 1.15rem; border-right: 1px dashed var(--hairline); }
.step-cell:last-child { border-right: 0; }
.step-num {
  display: inline-block;
  border: 1px solid var(--hairline);
  padding: .25rem .75rem;
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: .75rem;
}
.step-cell h3 { margin: 0 0 .4rem; font-size: 13.5px; }
.step-cell p { margin: 0; font-size: 12.5px; color: var(--muted); }

.feat-list { list-style: none; margin: 0; padding: 0; }
.feat-item { display: flex; gap: .85rem; padding: .95rem 0; border-bottom: 1px dashed var(--hairline); }
.feat-item:first-child { padding-top: 0; }
.feat-item:last-child { border-bottom: 0; padding-bottom: 0; }
.feat-check {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 800;
  font-size: 12px;
}
.feat-item h3 { margin: 0 0 .2rem; font-size: 13.5px; }
.feat-item p { margin: 0; font-size: 12.5px; color: var(--muted); }

.faq-list { display: grid; gap: .65rem; }
.faq-item { background: var(--surface); border: 1px solid var(--border); }
.faq-item summary {
  padding: .85rem 1rem;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.faq-item summary::after {
  content: "⌄";
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  display: grid;
  place-items: center;
  font-size: 12px;
}
.faq-item[open] summary::after { content: "⌃"; }
.faq-body { padding: .85rem 1rem; border-top: 1px solid var(--hairline); font-size: 12.5px; color: var(--muted); }

/* Directory /tools/ */
.big-search {
  position: relative;
  max-width: 48rem;
  margin-bottom: 1rem;
}
.big-search input {
  width: 100%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: .8rem 2.5rem .8rem 1rem;
  font: 14px/1.2 inherit;
}
.big-search input:focus { outline: none; }
.big-search kbd {
  position: absolute;
  right: .85rem;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--kbd-border);
  padding: 2px 6px;
  font-size: 11px;
  color: var(--muted);
}

.cat-nav { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.cat-nav button {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline);
  padding: .35rem .7rem;
  font: 12px/1.2 inherit;
  cursor: pointer;
}
.cat-nav button[aria-pressed="true"],
.cat-nav button:hover {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.cat-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .35rem; }
.cat-head h2 { margin: 0; font-size: 16px; }
.lite { color: var(--muted); font-size: 12.5px; }

.tool-grid {
  list-style: none;
  margin: .9rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: var(--surface);
}
.tool-grid li {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.tool-grid li a {
  display: flex;
  gap: .75rem;
  padding: 1rem;
  color: var(--ink);
  height: 100%;
}
.tool-grid li a:hover { background: var(--bg); text-decoration: none; }
.tool-badge {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid #111111;
  font-weight: 800;
  font-size: 12px;
}
.tool-grid h3 { margin: 0 0 .25rem; font-size: 13.5px; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.tool-grid p { margin: 0; font-size: 12px; color: var(--muted); }
.tag {
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--hairline);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
}
.tag.live { background: var(--accent); color: var(--accent-fg); border-color: #111111; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--hairline);
  background: var(--surface);
  padding: 2rem 0;
  font-size: 12px;
  color: var(--muted);
}
.foot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }

/* Support the Dev */
.support-card { background: var(--surface); }
.support-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.support-presets { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.preset-btn {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--hairline);
  padding: .5rem .75rem;
  font: 12.5px/1.2 inherit;
  font-weight: 700;
  cursor: pointer;
}
.preset-btn.active, .preset-btn:hover {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: #111111;
}

/* Landing, Portal & Admin Components */
.hero-box { padding: 2rem 0 1.25rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  padding: .62rem 1.15rem;
  font: 13px/1.2 inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
}
.btn-secondary:hover { background: var(--accent-soft); text-decoration: none; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr)); gap: .9rem; margin: 1rem 0 1.5rem; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 1rem; }
.kpi-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-val { font-size: 1.6rem; font-weight: 800; margin-top: .25rem; color: var(--ink); }
.kpi-val.purple { color: var(--accent); }
.prog-track { height: 10px; background: var(--bg); border: 1px solid var(--hairline); margin-top: .5rem; }
.prog-fill { height: 100%; background: var(--accent); }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th, .data-table td { text-align: left; padding: .55rem .65rem; border-bottom: 1px dashed var(--hairline); }
.data-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 7rem; padding-top: 1rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar-fill { width: 100%; background: var(--accent); min-height: 3px; }
.bar-lbl { font-size: 10px; color: var(--muted); }

@media (max-width: 56rem) {
  .about-grid, .steps-grid, .tool-grid, .mega-cols, .two-col { grid-template-columns: 1fr; }
  .step-cell { border-right: 0; border-bottom: 1px dashed var(--hairline); }
  .step-cell:last-child { border-bottom: 0; }
  .nav-search { display: none; }
}
