:root {
  color-scheme: dark;
  --background: #07100e;
  --background-raised: #0b1714;
  --panel: #10231e;
  --panel-light: #173128;
  --text: #eef6f1;
  --muted: #9fb5ac;
  --accent: #efa850;
  --accent-bright: #ffc875;
  --green: #75caa3;
  --red: #e78478;
  --line: #29473c;
  --shadow: 0 24px 70px rgb(0 0 0 / 35%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% -10%, rgb(43 105 83 / 42%) 0, transparent 34rem),
    radial-gradient(circle at 92% 24%, rgb(130 76 35 / 18%) 0, transparent 28rem),
    var(--background);
  color: var(--text);
  font: 17px/1.65 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .13;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.28'/%3E%3C/svg%3E");
}
a { color: var(--accent-bright); text-underline-offset: .2em; }
a:hover { color: #ffe0ad; }
button, textarea { font: inherit; }

.site-header,
.site-footer,
main {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}
.site-header {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -.02em;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: var(--background);
  background: var(--accent);
  border-radius: 8px 8px 12px 8px;
  font: 900 1rem/1 Georgia, serif;
  transform: rotate(-4deg);
}
.site-nav,
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
}
.site-nav a,
.site-footer a {
  color: var(--muted);
  font-size: .92rem;
  font-weight: 700;
  text-decoration: none;
}
.site-nav a:hover,
.site-footer a:hover { color: var(--text); }

.hero {
  max-width: 920px;
  padding: clamp(5rem, 10vw, 9rem) 0 clamp(4rem, 8vw, 7rem);
}
.eyebrow {
  margin: 0 0 .6rem;
  color: var(--accent);
  font-size: .76rem;
  font-weight: 850;
  letter-spacing: .16em;
  text-transform: uppercase;
}
h1, h2, h3 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: -.045em;
}
h1 {
  max-width: 12ch;
  font: 800 clamp(3.2rem, 9vw, 7.4rem)/.94 Georgia, "Times New Roman", serif;
}
h1 span { color: var(--accent); }
h2 { font: 750 clamp(2rem, 5vw, 3.6rem)/1 Georgia, serif; }
h3 { font: 750 clamp(1.7rem, 3vw, 2.4rem)/1 Georgia, serif; }
p { margin: .8rem 0; }
.lead {
  max-width: 62ch;
  margin-top: 1.8rem;
  color: var(--muted);
  font-size: clamp(1.08rem, 2vw, 1.3rem);
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin-top: 2rem;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: .75rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { color: #171006; background: var(--accent); }
.button-primary:hover { color: #171006; background: var(--accent-bright); }
.button-secondary { color: var(--text); border-color: var(--line); background: rgb(16 35 30 / 70%); }
.button-secondary:hover { color: var(--text); border-color: var(--green); }
.button[disabled] { opacity: .55; cursor: not-allowed; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
  padding-bottom: 7rem;
}
.section-heading {
  grid-column: 1 / -1;
  max-width: 700px;
  margin-bottom: 1.3rem;
}
.project-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(16 35 30 / 82%);
  box-shadow: var(--shadow);
}
.project-art {
  position: relative;
  display: grid;
  place-items: center;
  height: 230px;
  overflow: hidden;
  background:
    linear-gradient(rgb(0 0 0 / 15%), rgb(0 0 0 / 46%)),
    repeating-linear-gradient(0deg, transparent 0 35px, rgb(255 255 255 / 3%) 36px 37px),
    repeating-linear-gradient(90deg, #18221f 0 70px, #101b18 71px 73px);
}
.project-copy { padding: 1.7rem; }
.project-copy p:not(.tag) { color: var(--muted); }
.tag {
  color: var(--green);
  font-size: .74rem;
  font-weight: 850;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.text-link { font-weight: 800; }
.project-links {
  display: grid;
  justify-items: start;
  gap: .45rem;
  margin-top: 1rem;
}
.pixel-door {
  position: absolute;
  bottom: 0;
  width: 112px;
  height: 156px;
  border: 10px solid #35443e;
  border-bottom: 0;
  border-radius: 60px 60px 0 0;
  background: radial-gradient(circle at 38% 52%, #d8a049 0 4px, transparent 5px), #050908;
  box-shadow: 0 0 60px rgb(239 168 80 / 13%);
}
.torch {
  position: absolute;
  top: 94px;
  width: 6px;
  height: 38px;
  background: #625041;
}
.torch::before {
  content: "";
  position: absolute;
  left: -9px;
  top: -25px;
  width: 24px;
  height: 31px;
  border-radius: 70% 30% 65% 35%;
  background: var(--accent);
  box-shadow: 0 0 32px 9px rgb(239 168 80 / 33%);
  transform: rotate(14deg);
}
.torch-left { left: 22%; }
.torch-right { right: 22%; }
.rule-runes {
  background:
    radial-gradient(circle at center, rgb(74 154 120 / 24%), transparent 38%),
    linear-gradient(135deg, #101d22, #0b1714);
}
.rule-runes span {
  display: grid;
  place-items: center;
  width: 114px;
  height: 114px;
  color: var(--accent-bright);
  border: 2px solid var(--green);
  clip-path: polygon(50% 0, 92% 25%, 100% 70%, 70% 100%, 25% 92%, 0 55%, 10% 17%);
  background: rgb(7 16 14 / 80%);
  font: 800 1.8rem Georgia, serif;
  transform: rotate(7deg);
}
.rule-runes i {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 20px 5px rgb(117 202 163 / 35%);
}
.rule-runes i:nth-of-type(1) { translate: -100px -65px; }
.rule-runes i:nth-of-type(2) { translate: 112px 26px; }
.rule-runes i:nth-of-type(3) { translate: -75px 83px; }

.private-tool {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 3rem;
  margin-bottom: 5rem;
  padding: 2rem 0;
  border-block: 1px solid var(--line);
}
.private-tool p:last-child { color: var(--muted); }
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem 0 3rem;
  color: var(--muted);
  font-size: .86rem;
}

/* Interior pages */
.page-main { padding: clamp(3.5rem, 8vw, 7rem) 0; }
.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  align-items: center;
  gap: clamp(2rem, 7vw, 6rem);
  padding-bottom: 4rem;
}
.page-hero h1 { font-size: clamp(3.2rem, 8vw, 6.5rem); }
.page-hero .lead { margin-bottom: 1.7rem; }
.status-line {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--muted);
  font-size: .9rem;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgb(117 202 163 / 12%);
}
.status-dot.offline { background: var(--accent); box-shadow: 0 0 0 4px rgb(239 168 80 / 12%); }
.feature-panel {
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(16 35 30 / 84%);
  box-shadow: var(--shadow);
}
.feature-panel h2 { font-size: 1.45rem; }
.feature-list {
  display: grid;
  gap: .8rem;
  padding: 0;
  list-style: none;
}
.feature-list li {
  display: flex;
  gap: .7rem;
  color: var(--muted);
}
.feature-list li::before { content: "◆"; color: var(--accent); font-size: .65rem; translate: 0 .35rem; }
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 2.5rem 0 4rem;
}
.info-card {
  padding: 1.4rem;
  border-top: 2px solid var(--line);
  background: linear-gradient(180deg, rgb(16 35 30 / 55%), transparent);
}
.info-card h3 { font: 800 1rem/1.3 system-ui, sans-serif; letter-spacing: 0; }
.info-card p { color: var(--muted); font-size: .92rem; }
.install-note {
  padding: 1.2rem 1.4rem;
  border-left: 3px solid var(--accent);
  background: rgb(239 168 80 / 8%);
  color: var(--muted);
}
.install-note strong { color: var(--text); }

/* Rules Bot */
.bot-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  align-items: start;
  gap: 1.2rem;
}
.bot-panel {
  padding: clamp(1.2rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(16 35 30 / 86%);
  box-shadow: var(--shadow);
}
.bot-form label { display: block; margin-bottom: .65rem; font-weight: 800; }
.question-wrap { position: relative; }
textarea {
  width: 100%;
  min-height: 148px;
  resize: vertical;
  padding: 1rem 1rem 2.1rem;
  color: var(--text);
  border: 1px solid #3a5b4f;
  border-radius: 12px;
  outline: none;
  background: #081411;
}
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(239 168 80 / 12%); }
.character-count {
  position: absolute;
  right: .75rem;
  bottom: .55rem;
  color: var(--muted);
  font-size: .75rem;
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .85rem;
}
.form-hint { color: var(--muted); font-size: .8rem; }
.example-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.example-button {
  padding: .45rem .65rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-size: .78rem;
  cursor: pointer;
}
.example-button:hover { color: var(--text); border-color: var(--green); }
.answer-panel {
  margin-top: 1rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}
.answer-panel[hidden] { display: none; }
.answer-kicker { color: var(--green); font-size: .75rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.answer-text { font-size: 1.08rem; white-space: pre-wrap; }
.answer-text.rule-results { display: grid; gap: 1rem; white-space: normal; }
.rule-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(7 16 14 / 55%);
}
.rule-card h2 {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
  background: rgb(23 49 40 / 58%);
  font: 750 1.35rem/1.2 Georgia, serif;
  letter-spacing: -.02em;
}
.rule-body { padding: .35rem 1.15rem .9rem; line-height: 1.62; }
.rule-body h3 { margin: 1.15rem 0 .45rem; font: 800 1.02rem/1.3 system-ui, sans-serif; letter-spacing: 0; }
.rule-body h4 { margin: 1rem 0 .35rem; color: var(--green); font: 750 .88rem/1.3 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; }
.rule-body > :first-child { margin-top: .6rem; }
.rule-body > :last-child { margin-bottom: 0; }
.rule-body p { margin: .75rem 0; }
.rule-body ul, .rule-body ol { margin: .65rem 0 .9rem; padding-left: 1.4rem; }
.rule-body ul ul, .rule-body ol ol, .rule-body ul ol, .rule-body ol ul { margin: .3rem 0 .15rem; }
.rule-body li + li { margin-top: .3rem; }
.rule-body li { padding-left: .15rem; }
.rule-body li::marker { color: var(--green); }
.rule-body code { padding: .08em .3em; border-radius: 4px; background: var(--panel-light); font-size: .92em; }
.rule-body hr { margin: 1.1rem 0; border: 0; border-top: 1px solid var(--line); }
.rule-body blockquote {
  margin: .8rem 0;
  padding: .15rem 0 .15rem .85rem;
  color: var(--muted);
  border-left: 2px solid var(--green);
}
.rule-table { width: 100%; margin: .85rem 0; border-collapse: collapse; font-size: .92em; }
.rule-table th, .rule-table td { padding: .45rem .6rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.rule-table th { background: rgb(23 49 40 / 45%); font-weight: 800; }
.rule-source {
  margin: 0;
  padding: .7rem 1.15rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: .78rem;
}
.rule-footer { display: grid; gap: .5rem; }
.rule-provenance, .rule-raw {
  padding: .6rem .9rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: .78rem;
}
.rule-provenance {
  padding: .45rem .7rem;
  background: rgb(7 16 14 / 38%);
  font-size: .7rem;
  line-height: 1.45;
}
.rule-provenance summary, .rule-raw summary {
  color: var(--muted);
  font-weight: 700;
  list-style-position: outside;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.rule-provenance summary {
  color: #87a096;
  font-size: .7rem;
  font-weight: 650;
  letter-spacing: .015em;
}
.rule-provenance summary:hover, .rule-raw summary:hover { color: var(--text); }
.rule-provenance > div, .rule-raw > div { margin-top: .65rem; overflow-wrap: anywhere; }
.rule-provenance > div {
  margin-top: .45rem;
  padding-top: .45rem;
  border-top: 1px solid rgb(41 71 60 / 65%);
}
.provenance-list { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .75rem; margin: 0; }
.provenance-list dt { color: var(--green); font-weight: 750; }
.provenance-list dd { margin: 0; }
.provenance-list a { color: var(--green); overflow-wrap: anywhere; }
.rule-raw pre {
  max-height: 24rem;
  margin: 0;
  padding: .75rem .85rem;
  overflow: auto;
  border-radius: 8px;
  background: rgb(4 10 9 / 72%);
  font: .76rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.answer-choices {
  margin-top: 1rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(7 16 14 / 42%);
}
.answer-choices[hidden] { display: none; }
.answer-choices p { margin: 0 0 .55rem; color: var(--muted); font-size: .82rem; font-weight: 700; }
.answer-choice-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.answer-choice-list button:disabled { opacity: .55; cursor: wait; }
.citation-list { display: grid; gap: .7rem; padding: 0; list-style: none; }
.citation-list li {
  padding: .8rem 1rem;
  border-left: 2px solid var(--green);
  background: rgb(7 16 14 / 55%);
}
.citation-list cite { display: block; color: var(--muted); font-size: .78rem; font-style: normal; }
.bot-sidebar { display: grid; gap: 1rem; }
.sidebar-card {
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(11 23 20 / 78%);
}
.sidebar-card h2 { font: 800 1rem/1.3 system-ui, sans-serif; letter-spacing: 0; }
.sidebar-card p, .sidebar-card li { color: var(--muted); font-size: .83rem; }
.sidebar-card ul { padding-left: 1.15rem; }
.bot-form .telemetry-choice { display: flex; gap: .55rem; align-items: flex-start; margin-top: 1rem; color: var(--muted); font-size: .8rem; font-weight: 400; }
.telemetry-choice input { margin-top: .15rem; }
.turnstile-wrap { display: grid; gap: .45rem; justify-items: start; margin-top: 1rem; }
.turnstile-wrap[hidden] { display: none; }
.feedback-wrap { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; color: var(--muted); font-size: .78rem; }
.feedback-wrap[hidden] { display: none; }
.notice-error { color: #ffd1ca; }

.policy {
  width: min(760px, 100%);
  margin-inline: auto;
  padding: clamp(1.5rem, 5vw, 4rem);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(16 35 30 / 88%);
  box-shadow: var(--shadow);
}
.policy h1 { font-size: clamp(2.6rem, 7vw, 4.8rem); }
.policy h2 { margin-top: 2rem; font: 750 1.3rem/1.2 system-ui, sans-serif; letter-spacing: -.02em; }
.policy p { color: var(--muted); }
.updated { color: var(--muted); }

@media (max-width: 760px) {
  .site-header { align-items: flex-start; padding: 1.2rem 0; }
  .site-nav { justify-content: flex-end; gap: .75rem 1rem; }
  .project-grid, .page-hero, .bot-layout, .private-tool { grid-template-columns: 1fr; }
  .page-hero { gap: 2.5rem; }
  .info-grid { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; }
  .rule-card h2 { padding: .85rem .95rem; font-size: 1.2rem; }
  .rule-body { padding: .25rem .95rem .8rem; }
  .rule-source { padding: .6rem .95rem; }
  .rule-table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 480px) {
  .site-header { display: block; }
  .site-nav { justify-content: flex-start; margin-top: 1rem; }
  .hero { padding-top: 4rem; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .answer-text { font-size: 1rem; }
  .rule-body ul, .rule-body ol { padding-left: 1.15rem; }
  .provenance-list { grid-template-columns: 1fr; gap: 0 0; }
  .provenance-list dd { margin-bottom: .5rem; }
  .rule-raw pre { max-height: 18rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .project-card, .text-link { transition: transform .18s ease, border-color .18s ease, background .18s ease; }
  .project-card:hover { transform: translateY(-3px); border-color: #3b6555; }
  .button:hover { transform: translateY(-1px); }
}
