:root {
  color-scheme: dark;
  --page: #090e0d;
  --surface: #101815;
  --surface-deep: #0c1411;
  --border: #294036;
  --line: #263d31;
  --text: #e2ebe4;
  --muted: #9bafa0;
  --dim: #708a79;
  --green: #a4eb9b;
  --green-deep: #183323;
  --amber: #f2cf83;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 3%, #193027 0, transparent 72%),
    var(--page);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  line-height: 1.6;
}

button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--green); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
::selection { background: #497f58; color: white; }

.page {
  width: min(100% - 48px, 1040px);
  margin: 0 auto;
  padding: clamp(22px, 5vh, 52px) 0 34px;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .15em;
  white-space: nowrap;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border: 1px solid #5fa06f;
  border-radius: 5px;
  background: #102119;
  color: var(--green);
  font-size: 14px;
  letter-spacing: -.07em;
  box-shadow: inset 0 0 0 1px #13291c;
}

.header-right { display: flex; align-items: center; gap: 16px; }

.header-label {
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.language-picker { position: relative; }

.language-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #15211b;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.language-button:hover, .language-button[aria-expanded="true"] {
  background: #1b3022;
  border-color: #5c8d61;
}

.language-button .flag, .language-link .flag { font-size: 18px; line-height: 1; }
.chevron { color: var(--dim); font-size: 12px; margin-left: 3px; }

.language-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: 245px;
  padding: 6px;
  border: 1px solid #436b4d;
  border-radius: 8px;
  background: #17231b;
  box-shadow: 0 18px 50px #0009;
}

.language-menu[hidden] { display: none; }

.language-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 37px;
  padding: 6px 9px;
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}

.language-link:hover, .language-link:focus-visible, .language-link[aria-current="page"] {
  background: #27402e;
  color: #f5fff5;
}

.language-link small { margin-left: auto; color: var(--dim); font-size: 10px; }

.terminal {
  overflow: hidden;
  border: 1px solid #3a5945;
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 18px 62px #0008, 0 0 0 1px #0a130d;
}

.terminal-top {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  min-height: 42px;
  border-bottom: 1px solid var(--border);
  background: #142019;
}

.file-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-right: 1px solid var(--border);
  border-bottom: 2px solid var(--green);
  background: #1d2e22;
  color: #dbeddb;
  font-size: 13px;
}

.file-tab::before { content: "●"; color: var(--green); font-size: 8px; }

.file-path {
  align-self: center;
  padding: 0 18px;
  color: var(--dim);
  font-size: 11px;
}

.editor {
  min-height: clamp(420px, 55vh, 640px);
  padding: 28px 0 36px;
  background: linear-gradient(90deg, var(--surface-deep) 0 62px, var(--surface) 62px);
}

.code-line {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  min-height: 27px;
  padding-right: 24px;
}

.code-line:hover { background: #20362855; }

.line-number {
  padding-right: 17px;
  border-right: 1px solid var(--line);
  color: var(--dim);
  text-align: right;
  font-size: 12px;
  line-height: 27px;
  user-select: none;
}

.line-content {
  padding-left: 22px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  line-height: 1.8;
}

.line-content[dir="rtl"] { direction: rtl; text-align: right; }
.code-line.blank { min-height: 19px; }
.code-line.blank .line-number { line-height: 19px; }
.syntax { color: #6c9e75; }
.heading { color: var(--green); font-weight: 700; font-size: clamp(16px, 2.3vw, 20px); }
.claim { color: #f6e6b8; font-weight: 700; }
.dare { color: #d1f4c7; font-weight: 700; }
.tagline { color: #9fb9a2; font-style: italic; }
.label { color: var(--amber); }
.value { color: #e0e9df; }
.pending { color: var(--dim); }
.content-link {
  color: var(--green);
  text-decoration: underline;
  text-decoration-color: #83b982;
  text-underline-offset: 4px;
}
.content-link:hover { color: #ddffd9; }
.page-nav { margin: -4px 0 18px; font-size: 13px; }
.plain-reply { margin: 40px; white-space: pre-wrap; }

.site-header { direction: ltr; }
.brand, .status-bar { direction: ltr; }
.editor[dir="rtl"] { background: linear-gradient(270deg, var(--surface-deep) 0 62px, var(--surface) 62px); }
.editor[dir="rtl"] .line-number { padding-right: 0; padding-left: 17px; border-right: 0; border-left: 1px solid var(--line); text-align: left; }
.editor[dir="rtl"] .line-content { padding-left: 0; padding-right: 22px; text-align: right; }
.build-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding: 4px 24px 12px; }
.build-gallery figure { min-width: 0; margin: 0; }
.build-gallery a { display: block; }
.build-gallery img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: contain; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-deep); }

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding-right: 16px;
  background: #9bdd93;
  color: #0b2011;
  font-size: 11px;
  font-weight: 700;
}

.status-left, .status-right { display: flex; align-items: center; gap: 13px; }
.mode { display: inline-grid; place-items: center; min-width: 73px; align-self: stretch; padding: 0 12px; background: #2e6040; color: white; }
.status-right { white-space: nowrap; }

.command-line {
  display: flex;
  align-items: center;
  min-height: 43px;
  padding: 0 14px;
  background: #101913;
  color: var(--text);
  font-size: 17px;
}

.cursor {
  display: inline-block;
  width: .62em;
  height: 1.06em;
  margin-left: 2px;
  background: var(--green);
  vertical-align: -.2em;
  animation: blink 1.1s steps(1, end) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.footnote {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 12px;
  margin: 17px 3px 0;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: start;
}
.site-updated { grid-column: 1; grid-row: 1; min-width: 0; }
.site-active-status { grid-column: 2; grid-row: 1; text-align: end; }
.site-status-dot { color: var(--dim); }
.footnote [data-running] .site-status-dot { color: var(--green); }

.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; }

@media (max-width: 700px) {
  body { display: flex; flex-direction: column; min-height: 100svh; }
  .page { display: flex; flex: 1; flex-direction: column; width: 100%; padding: 0; }
  .site-header { padding: 10px 16px; margin: 0; }
  .header-label { display: none; }
  .brand { justify-content: center; min-width: 44px; min-height: 44px; }
  .brand-text { display: none; }
  .language-button, .language-link { min-height: 44px; }
  .language-menu {
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 76px);
    max-height: calc(100svh - 76px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .page-nav { margin: 0 16px 8px; }
  .page-nav a { display: inline-flex; align-items: center; min-height: 44px; }
  .terminal {
    display: flex;
    flex: 1;
    flex-direction: column;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
  .file-path { display: none; }
  .editor {
    --gutter: 36px;
    --editor-inset: 12px;
    flex: 1;
    min-height: 0;
    padding: 20px 0 26px;
    background: linear-gradient(90deg, var(--surface-deep) 0 var(--gutter), var(--surface) var(--gutter));
  }
  .editor[dir="rtl"] { background: linear-gradient(270deg, var(--surface-deep) 0 var(--gutter), var(--surface) var(--gutter)); }
  .code-line { grid-template-columns: var(--gutter) minmax(0, 1fr); padding-right: 0; padding-inline-end: var(--editor-inset); }
  .line-number { padding-right: 0; padding-inline-end: 8px; }
  .editor[dir="rtl"] .line-number { padding-left: 8px; }
  .line-content { padding-left: var(--editor-inset); }
  .editor[dir="rtl"] .line-content { padding-right: var(--editor-inset); }
  .build-gallery { grid-template-columns: minmax(0, 1fr); padding: 0 16px 18px; gap: 22px; }
  .plain-reply { flex: 1; margin: 24px 16px; overflow-wrap: anywhere; }
  .footnote { margin: 12px 16px 18px; }
}

@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }
