:root {
  /* Dark + amber (default) — warm night terminal */
  --bg: #0a0806;
  --fg: #d4cfc4;
  --muted: #8a8070;
  --green: #33ff66;
  --amber: #ffb000;
  --blue: #7ec8e3;
  --warn: #ffcc33;
  --error: #ff5555;
  --bar-bg: #120e0a;
  --border: #2a2218;
  --border-strong: #3a3228;
  --surface: #16120e;
  --surface-2: #1c1812;
  --code-bg: rgba(255, 176, 0, 0.06);
  --hover-wash: rgba(255, 176, 0, 0.07);
  --lightbox-bg: rgba(10, 8, 6, 0.9);
  --lightbox-shadow: 0 0 40px rgba(0, 0, 0, 0.55);
  --menu-dim: rgba(10, 8, 6, 0.4);
  --stripe-a: #100c08;
  --stripe-b: #16120e;
  --link-underline: #5a5040;
  --font: "Courier New", Courier, ui-monospace, monospace;
  --line: 1.55;
  --pad: 0.85rem 1.15rem;
  --space-1: 0.35rem;
  --space-2: 0.55rem;
  --space-3: 0.85rem;
  --fs-root: 16px;
  --fs-lg: 17px;
  --fs-md: 15px;
  --fs-sm: 13px;
  --fs-xs: 12px;
  color-scheme: dark;
}

/* Dark + green — cool phosphor terminal */
html[data-theme="green"],
body.theme-green {
  --bg: #050a07;
  --fg: #c8d8cc;
  --muted: #6e8576;
  --green: #66ff99;
  --amber: #33ff66;
  --blue: #7ec8e3;
  --warn: #ffcc33;
  --error: #ff5555;
  --bar-bg: #08120c;
  --border: #1a2a20;
  --border-strong: #2a3a30;
  --surface: #0e1612;
  --surface-2: #121a16;
  --code-bg: rgba(51, 255, 102, 0.06);
  --hover-wash: rgba(51, 255, 102, 0.07);
  --lightbox-bg: rgba(5, 10, 7, 0.9);
  --lightbox-shadow: 0 0 40px rgba(0, 0, 0, 0.55);
  --menu-dim: rgba(5, 10, 7, 0.4);
  --stripe-a: #080e0a;
  --stripe-b: #0e1612;
  --link-underline: #3a4a40;
  color-scheme: dark;
}

/* Light + amber — warm paper terminal */
html[data-scheme="light"],
html[data-scheme="light"][data-theme="amber"],
html[data-scheme="light"] body.theme-amber {
  --bg: #f4efe6;
  --fg: #2a241c;
  --muted: #6e6458;
  --green: #1a8a3e;
  --amber: #b07700;
  --blue: #2a6f8a;
  --warn: #9a7a00;
  --error: #c43434;
  --bar-bg: #ebe4d8;
  --border: #d4c8b4;
  --border-strong: #c0b09a;
  --surface: #fffaf3;
  --surface-2: #f0e8dc;
  --code-bg: rgba(176, 119, 0, 0.08);
  --hover-wash: rgba(176, 119, 0, 0.1);
  --lightbox-bg: rgba(244, 239, 230, 0.94);
  --lightbox-shadow: 0 0 40px rgba(42, 36, 28, 0.2);
  --menu-dim: rgba(42, 36, 28, 0.25);
  --stripe-a: #ebe4d8;
  --stripe-b: #e2d8c8;
  --link-underline: #b0a090;
  color-scheme: light;
}

/* Light + green — cool mint paper */
html[data-scheme="light"][data-theme="green"],
html[data-scheme="light"] body.theme-green {
  --bg: #eef4f0;
  --fg: #1c2a22;
  --muted: #5a6e62;
  --green: #1a8a4a;
  --amber: #1a8a4a;
  --blue: #2a6f8a;
  --warn: #9a7a00;
  --error: #c43434;
  --bar-bg: #e2ebe5;
  --border: #c4d4c8;
  --border-strong: #a8c0b0;
  --surface: #f7fbf8;
  --surface-2: #e8f0eb;
  --code-bg: rgba(26, 138, 74, 0.08);
  --hover-wash: rgba(26, 138, 74, 0.1);
  --lightbox-bg: rgba(238, 244, 240, 0.94);
  --lightbox-shadow: 0 0 40px rgba(28, 42, 34, 0.18);
  --menu-dim: rgba(28, 42, 34, 0.25);
  --stripe-a: #e2ebe5;
  --stripe-b: #d6e2da;
  --link-underline: #90a898;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Soft scrollbars: thin gutter, visible on hover/focus for a11y — never on html/body */
*,
*::before,
*::after {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

*:hover,
*:focus,
*:focus-within {
  scrollbar-color: color-mix(in srgb, var(--fg) 35%, transparent) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}

*:hover::-webkit-scrollbar-thumb,
*:focus::-webkit-scrollbar-thumb,
*:focus-within::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--fg) 35%, transparent);
}

*::-webkit-scrollbar-track {
  background: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs-root);
  line-height: var(--line);
  /* Outermost: never show scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
  background: transparent;
}

html:hover,
body:hover,
html:focus-within,
body:focus-within {
  scrollbar-color: transparent transparent;
}

.terminal {
  display: flex;
  flex-direction: column;
  width: 100%;
  /* Full-bleed so side margins are still inside .output and scroll natively */
  max-width: none;
  height: 100%;
  min-height: 100svh;
  max-height: 100dvh;
  position: relative;
  z-index: 1;
}

/* Keep ~1100px reading measure; side padding remains part of the scroll surface */
.status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  padding: 0.55rem max(0.95rem, calc((100% - 1100px) / 2 + 0.95rem));
  background: var(--bar-bg);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  flex-shrink: 0;
}

/* Non-blocking playback / status flash */
.rt-flash {
  position: fixed;
  left: 50%;
  bottom: 4.5rem;
  transform: translateX(-50%) translateY(8px);
  z-index: 40;
  max-width: min(90vw, 28rem);
  padding: 0.45rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--amber);
  font: var(--fs-md)/1.4 var(--font);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.rt-flash.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.status-left,
.status-center {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

/* Mobile-only hamburger host; desktop actions live in .status-menu-panel */
.status-right {
  display: none;
}

.status-menu-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

/* Desktop: panel lives in the flow as the right actions cluster */
.status-bar > .status-menu-panel {
  order: 3;
}

.status-menu-toggle,
.status-menu-backdrop {
  display: none;
}

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

/* SEO article body: off-screen for sighted users, readable by crawlers */
.seo-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;
}

.status-btn {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.status-btn:hover .amber,
.status-btn:hover .green,
.status-btn:hover .muted,
.status-btn.brand:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

a.status-btn {
  text-decoration: none;
  color: inherit;
}

.status-path {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.path-crumbs {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  max-width: 100%;
}

.path-sep {
  user-select: none;
  flex-shrink: 0;
}

.path-crumb:hover,
.path-crumb-current {
  color: var(--amber);
}

.path-crumb-current {
  display: inline-block;
  max-width: 18em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

a.path-crumb:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.brand {
  color: var(--amber);
  font-weight: 500;
}

.output {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem max(1.15rem, calc((100% - 1100px) / 2 + 1.15rem));
  scroll-behavior: smooth;
  outline: none;
}

.output .line {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.output .line + .line {
  margin-top: 0.1rem;
}

/* Single-line rows (boot / list): flex + ellipsis — reliable on mobile */
.output .line.boot-line {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  word-break: normal;
  overflow-wrap: normal;
}

.output .line.boot-line .boot-main {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.output .line.boot-line .boot-main-track {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
  transition: transform 0.12s linear;
}

.output .line.boot-line .boot-date {
  flex: 0 0 auto;
  white-space: nowrap;
}

.output .line.boot-line .boot-date[hidden] {
  display: none !important;
}

.output .line.boot-line .boot-cat {
  display: inline;
}

.output .line.boot-line .boot-cat-link {
  position: relative;
  display: inline;
  text-decoration: none;
}

.output .line.boot-line .boot-cat-link .green {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.output .line.boot-line .boot-cat-count {
  margin-left: 0;
}

.output .line.boot-line .boot-cat-unit {
  margin-right: 0.15em;
}

.output .line.boot-line .boot-ok-mobile {
  display: none;
}

.output .line.list-row {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  white-space: nowrap;
  overflow: hidden;
  word-break: normal;
  overflow-wrap: normal;
}

.output .line.list-row .list-cat {
  flex: 0 0 auto;
}

.output .line.list-row .title-link {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.output .line.list-row .list-summary {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.output .line.list-row .list-meta {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Help: command + desc on one row (desc ellipsizes when narrow) */
.output .line.help-row {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  white-space: nowrap;
  overflow: hidden;
  word-break: normal;
  overflow-wrap: normal;
}

.output .line.help-row .help-cmd {
  flex: 0 0 auto;
  white-space: nowrap;
}

.output .line.help-row .help-desc {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.output .line.help-tip {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
  overflow-wrap: normal;
}

.output .boot-gap {
  margin-top: 0.85rem;
}

.ascii-box {
  margin: 0.85rem 0;
  color: var(--fg);
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  white-space: normal;
  word-break: normal;
  overflow: hidden;
}

.ascii-frame {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-variant-ligatures: none;
}

.ascii-frame .ascii-border {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  line-height: 1.2;
}

.ascii-frame .ascii-corner {
  flex: 0 0 auto;
}

.ascii-frame .ascii-rule {
  flex: 1 1 auto;
  min-width: 0;
  height: 1em;
  overflow: hidden;
  background: repeating-linear-gradient(
    to right,
    currentColor 0,
    currentColor 0.5ch,
    transparent 0.5ch,
    transparent 1ch
  );
  background-position: 0 50%;
  background-size: 1ch 1px;
  background-repeat: repeat-x;
}

.ascii-frame .ascii-row {
  display: flex;
  align-items: baseline;
  width: 100%;
  min-width: 0;
  white-space: nowrap;
}

.ascii-frame .ascii-edge {
  flex: 0 0 auto;
  color: var(--muted);
  user-select: none;
}

.ascii-frame .ascii-content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 0.35em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
}

.ascii-box .box-title {
  color: var(--amber);
}

.article-link {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.boot-gap .article-link {
  text-decoration: none;
}

.article-link.link-plain,
.article-link.link-plain:hover {
  text-decoration: none;
}

.article-link:hover {
  color: var(--amber);
}

.article-link.title-link {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
}

.article-link.title-link:hover {
  color: var(--amber);
  text-decoration-color: var(--amber);
}


.cmd-echo {
  color: var(--fg);
}

.cmd-echo .prompt-echo {
  color: var(--green);
}

.ok {
  color: var(--green);
}

.warn {
  color: var(--warn);
}

.error {
  color: var(--error);
}

.green {
  color: var(--green);
}

.amber {
  color: var(--amber);
}

.blue {
  color: var(--blue);
}

.muted {
  color: var(--muted);
}

.article-title {
  color: var(--amber);
  margin: 0.5rem 0 0.35rem;
  font-weight: 600;
  font-size: 1.35em;
  line-height: 1.35;
}

.article-meta {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin-bottom: 0.5rem;
}

.article-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0.15rem 0 0.65rem;
}

.article-actions-end {
  margin: 0.85rem 0 0.5rem;
}

.article-ad {
  margin: 0.75rem 0;
  max-width: 100%;
  padding: 0.55rem 0.7rem 0.65rem;
  border: 1px dashed color-mix(in srgb, var(--amber) 40%, transparent);
  background: color-mix(in srgb, var(--amber) 6%, transparent);
  line-height: 1.45;
}

.article-ad-body {
  color: var(--fg);
  overflow: auto;
}

.article-ad-body a {
  color: var(--blue);
}

.article-ad img,
.article-ad-body img {
  max-width: 100%;
  height: auto;
  display: block;
}

.article-footer-block {
  margin: 0.85rem 0 0.45rem;
  padding: 0.65rem 0.75rem;
  border-left: 2px solid color-mix(in srgb, var(--amber) 55%, transparent);
  background: color-mix(in srgb, var(--fg) 4%, transparent);
}

.article-footer-heading {
  color: var(--amber);
  font-weight: 600;
  font-size: var(--fs-md);
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.article-footer-body {
  color: var(--fg);
  line-height: 1.55;
  font-size: var(--fs-md);
}

.article-footer-body p {
  margin: 0 0 0.45rem;
}

.article-footer-body p:last-child {
  margin-bottom: 0;
}

.article-footer-body a {
  color: var(--blue);
}

.article-footer-body img {
  max-width: min(180px, 100%);
  height: auto;
  margin-top: 0.35rem;
}

.article-tip .article-footer-heading {
  color: var(--green);
}

.article-tip {
  border-left-color: color-mix(in srgb, var(--green) 55%, transparent);
}

.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin: 1rem 0 0.5rem;
  padding: 0;
  border: none;
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.article-nav-cell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid color-mix(in srgb, var(--muted) 40%, transparent);
  background: color-mix(in srgb, var(--fg) 3.5%, transparent);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.article-nav-cell:hover {
  border-color: color-mix(in srgb, var(--amber) 55%, transparent);
  background: color-mix(in srgb, var(--amber) 8%, transparent);
}

.article-nav-cell:hover .article-nav-title {
  color: var(--amber);
}

.article-nav-cell:hover .article-nav-slug {
  color: var(--blue);
}

.article-nav-prev {
  align-items: flex-start;
  text-align: left;
}

.article-nav-next {
  align-items: flex-end;
  text-align: right;
}

.article-nav-cell.is-empty {
  visibility: hidden;
  pointer-events: none;
  border: none;
  background: transparent;
}

.article-nav-dir {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.article-nav-arrow {
  color: var(--amber);
  font-size: var(--fs-sm);
  letter-spacing: 0;
  line-height: 1;
}

.article-nav-label {
  color: inherit;
}

.article-nav-title {
  color: var(--fg);
  font-size: var(--fs-md);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.article-nav-slug {
  color: var(--muted);
  font-size: var(--fs-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

@media (max-width: 520px) {
  .article-nav {
    grid-template-columns: 1fr;
  }

  .article-nav-next {
    align-items: flex-start;
    text-align: left;
  }

  .article-nav-next .article-nav-dir {
    flex-direction: row-reverse;
    justify-content: flex-end;
    width: 100%;
  }
}

.article-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.article-action-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  flex: 1 1 100%;
  width: 100%;
}

.article-action-stack .article-action-row {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Passcode box + CTA button share the same width */
.article-action-stack .article-copy-passcode,
.article-action-stack .article-action {
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
}

.article-action-stack .article-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.6rem;
  font-size: 1.05em;
  border-radius: 8px;
}

.article-action {
  display: inline-block;
  color: var(--bg);
  background: var(--amber);
  border: 1px solid var(--amber);
  padding: 0.15rem 0.7rem;
  text-decoration: none;
  font: inherit;
  font-weight: 500;
  line-height: 1.4;
}

.article-action:hover {
  background: transparent;
  color: var(--amber);
}

.article-copy {
  background: none;
  border: 1px dashed var(--muted);
  color: inherit;
  font: inherit;
  padding: 0.1rem 0.55rem;
  cursor: pointer;
  line-height: 1.4;
}

.article-copy-passcode {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  height: 96px;
  min-height: 96px;
  max-height: 96px;
  width: 100%;
  max-width: 420px;
  border: 1px dashed var(--muted);
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  box-sizing: border-box;
  text-align: center;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  vertical-align: middle;
}

.article-copy-passcode .article-passcode-hint,
.article-copy-passcode .article-passcode-reveal {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  height: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  box-sizing: border-box;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.45;
  transition: opacity 0.12s ease;
}

.article-copy-passcode .article-passcode-hint {
  opacity: 1;
  pointer-events: none;
}

.article-copy-passcode .article-passcode-reveal {
  opacity: 0;
  pointer-events: none;
  flex-wrap: wrap;
  gap: 0 0.15em;
}

.article-copy-passcode:hover .article-passcode-hint,
.article-copy-passcode:focus-visible .article-passcode-hint,
.article-copy-passcode:active .article-passcode-hint {
  opacity: 0;
}

.article-copy-passcode:hover .article-passcode-reveal,
.article-copy-passcode:focus-visible .article-passcode-reveal,
.article-copy-passcode:active .article-passcode-reveal {
  opacity: 1;
}

.article-copy-passcode.is-copied .article-passcode-hint,
.article-copy-passcode.is-copied .article-passcode-reveal {
  opacity: 0;
}

.article-copy-passcode.is-copied::after {
  content: attr(data-copied-label);
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  text-align: center;
  color: var(--green);
  font: inherit;
  line-height: 1.45;
  pointer-events: none;
}

.article-copy:hover {
  border-color: var(--amber);
  /* keep dashed to avoid 1px layout shift vs solid */
  border-style: dashed;
}

.article-copy-passcode:hover,
.article-copy-passcode:focus-visible,
.article-copy-passcode:active,
.article-copy-passcode.is-copied {
  border-color: var(--amber);
  border-style: dashed;
}

.article-copy.is-copied {
  border-color: var(--green, #33ff66);
}

.article-copy-passcode.is-copied {
  border-color: var(--green, #33ff66);
}

.article-passcode {
  filter: none;
  user-select: text;
}

.article-copy:not(.article-copy-passcode) .article-passcode {
  filter: blur(4px);
  transition: filter 0.15s ease;
  user-select: none;
}

.article-copy:not(.article-copy-passcode):hover .article-passcode,
.article-copy:not(.article-copy-passcode):focus-visible .article-passcode,
.article-copy:not(.article-copy-passcode):active .article-passcode {
  filter: none;
  user-select: text;
}

.article-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.article-text .md-h {
  color: var(--amber);
  font-weight: 600;
}

.article-text .md-h1 { font-size: 1.15em; }
.article-text .md-h2 { font-size: 1.08em; }
.article-text .md-h3,
.article-text .md-h4,
.article-text .md-h5,
.article-text .md-h6 { font-size: 1em; }

.article-text .md-code {
  color: var(--blue);
  background: var(--code-bg);
  padding: 0 0.25em;
}

.article-text .md-codeblock {
  position: relative;
  display: block;
  width: 100%;
  max-width: min(100%, 720px);
  min-height: 5.5rem;
  margin: 0.65rem auto;
  box-sizing: border-box;
}

.article-text .md-lang {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  z-index: 1;
  margin: 0;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--amber);
  font: inherit;
  font-size: var(--fs-xs);
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  pointer-events: none;
  user-select: none;
}

.article-text .md-codeblock.has-lang .md-pre {
  padding-top: 2.15rem;
}

.article-text .md-copy {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 1;
  margin: 0;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-xs);
  line-height: 1.4;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.article-text .md-copy:hover,
.article-text .md-copy:focus-visible {
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 50%, var(--border-strong));
  outline: none;
}

.article-text .md-copy.is-copied {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 45%, var(--border-strong));
}

.article-text .md-pre {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0.85rem 3.5rem 0.85rem 0.85rem;
  min-height: 5.5rem;
  max-width: 100%;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  white-space: pre;
  word-break: normal;
  box-sizing: border-box;
}

.article-text .md-pre .md-code {
  display: block;
  flex: 0 1 auto;
  width: 100%;
  padding: 0;
  background: none;
  white-space: pre;
  color: var(--green);
}

.article-text .md-link {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-text .md-em {
  font-style: italic;
  color: var(--fg);
}

.article-text .md-bullet,
.article-text .md-num {
  color: var(--amber);
}

.article-text .md-quote {
  color: var(--muted);
  border-left: 2px solid var(--border-strong);
  padding-left: 0.5em;
  display: inline-block;
}

.article-image {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 720px);
  max-height: min(70vh, 560px);
  object-fit: contain;
  object-position: center;
  margin: 0.75rem auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.45s ease, transform 0.45s ease, border-color 0.2s ease;
}

.article-image.visible {
  opacity: 1;
  transform: none;
}

/* Whole-group boxes: intro frame, ads, author, tip, nav, actions.
   Initial state has no transition — otherwise adding .rt-rise after paint
   animates downward first. Only .is-in enables the upward transition. */
.rt-rise {
  opacity: 0;
  transform: translateY(28px);
  transition: none;
  will-change: opacity, transform;
}

.rt-rise.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.58s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.58s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: auto;
}

.article-image.visible.broken {
  opacity: 0.45;
  filter: grayscale(0.4);
}

.article-image:hover,
.article-image:focus-visible {
  border-color: var(--amber);
  outline: none;
}

.image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 720px);
  height: min(40vh, 320px);
  margin: 0.75rem auto;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background:
    repeating-linear-gradient(
      -45deg,
      var(--stripe-a),
      var(--stripe-a) 8px,
      var(--stripe-b) 8px,
      var(--stripe-b) 16px
    );
  color: var(--blue);
  font-size: var(--fs-md);
  letter-spacing: 0.02em;
  user-select: none;
  animation: placeholder-pulse 1.4s ease-in-out infinite;
}

.image-placeholder-label {
  color: var(--blue);
}

@keyframes placeholder-pulse {
  0%,
  100% {
    opacity: 0.55;
    border-color: var(--border);
  }
  50% {
    opacity: 1;
    border-color: var(--border-strong);
  }
}

/* Image lightbox */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--lightbox-bg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.img-lightbox.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  cursor: pointer;
}

.img-lightbox img {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  height: auto;
  max-width: min(92vw, 1200px);
  max-height: min(82vh, 900px);
  object-fit: contain;
  border: 1px solid var(--border-strong);
  box-shadow: var(--lightbox-shadow);
  cursor: default;
}

.img-lightbox-hint {
  position: absolute;
  z-index: 2;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: var(--fs-sm);
  pointer-events: none;
  white-space: nowrap;
}

.img-lightbox-close {
  position: fixed;
  top: max(0.65rem, env(safe-area-inset-top, 0px));
  right: max(0.65rem, env(safe-area-inset-right, 0px));
  z-index: 120;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--amber);
  border-radius: 2px;
  background: color-mix(in srgb, var(--bg, #0a0806) 88%, transparent);
  color: var(--amber);
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.img-lightbox:not(.open) .img-lightbox-close {
  pointer-events: none;
}

.img-lightbox-close:hover,
.img-lightbox-close:focus-visible {
  color: var(--fg);
  background: var(--bar-bg, var(--bg));
  border-color: var(--amber);
  outline: none;
}

.img-lightbox-close:active {
  opacity: 0.85;
}

.input-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem max(1rem, calc((100% - 1100px) / 2 + 1rem)) 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--bar-bg);
  flex-shrink: 0;
}

.prompt {
  flex-shrink: 0;
  cursor: text;
}

.input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

#cmdline {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font: inherit;
  caret-color: transparent;
  padding: 0;
}

.block-cursor {
  position: absolute;
  left: 0;
  top: 50%;
  width: 0.6em;
  height: 1.15em;
  transform: translateY(-50%);
  background: var(--amber);
  pointer-events: none;
  animation: blink 1s step-end infinite;
}

.block-cursor.hidden {
  display: none;
}

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

@media (max-width: 720px) {
  :root {
    --pad: 0.55rem 0.7rem;
    --line: 1.5;
  }

  .output .line.boot-line .boot-ok-desktop {
    display: none;
  }

  .output .line.boot-line .boot-ok-mobile {
    display: inline;
  }

  .output .line.boot-line .boot-cat-unit {
    display: none;
  }

  /* Keep corner counts inside overflow:hidden (was clipped when top went negative) */
  .output .line.boot-line .boot-main {
    padding-top: 0.45em;
    box-sizing: border-box;
  }

  .output .line.boot-line .boot-cat-link {
    display: inline-block;
    padding: 0 0.45em 0 0;
    margin-right: 0.1em;
    vertical-align: baseline;
  }

  .output .line.boot-line .boot-cat-count {
    position: absolute;
    top: -0.28em;
    right: 0;
    margin: 0;
    font-size: 0.7em;
    line-height: 1;
    font-weight: 600;
    pointer-events: none;
  }

  html,
  body {
    font-size: var(--fs-md);
  }

  .terminal {
    max-width: none;
  }

  /* One horizontal row — do not stack brand / path / actions */
  .status-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem 0.55rem;
    padding: 0.35rem 0.55rem;
    padding-top: max(0.35rem, env(safe-area-inset-top, 0px));
    font-size: var(--fs-sm);
    overflow: hidden;
    position: relative;
    z-index: 40;
  }

  .status-left,
  .status-right {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    width: auto;
    max-width: none;
    min-width: 0;
    white-space: nowrap;
    overflow: visible;
    gap: 0.35rem;
  }

  .status-center {
    display: none;
  }

  .status-left {
    flex: 1 1 auto;
    order: 1;
    overflow: hidden;
    min-width: 0;
  }

  .status-right {
    flex: 0 0 auto;
    order: 2;
    margin-left: auto;
    gap: 0;
    position: relative;
    /* Must sit above .status-menu-panel so the × stays visible */
    z-index: 46;
  }

  .status-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 47;
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    background: var(--bar-bg, #000);
    border: none;
    color: var(--amber);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
  }

  .menu-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 18px;
    height: 14px;
    position: relative;
  }

  .menu-icon-close {
    display: none;
    font-size: 1.55rem;
    line-height: 1;
    font-weight: 400;
    color: var(--amber);
  }

  body.menu-open .menu-icon {
    display: none;
  }

  body.menu-open .menu-icon-close {
    display: block;
  }

  .menu-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background: currentColor;
    border-radius: 1px;
  }

  /* Dim page below the top bar while menu is open */
  .status-menu-backdrop {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    z-index: 38;
    background: var(--menu-dim);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.menu-open .status-menu-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* Top-row strip: slides in from the right, full bar width */
  .status-menu-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 43;
    width: auto;
    max-width: none;
    height: auto;
    margin: 0;
    /* Leave clear space under the hamburger / × on the right */
    padding: 0 2.75rem 0 0.55rem;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.1rem;
    background: var(--bar-bg, #000);
    border: none;
    box-shadow: -8px 0 16px var(--menu-dim);
    transform: translateX(100%);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
    pointer-events: none;
  }

  .status-menu-panel::-webkit-scrollbar {
    display: none;
  }

  body.menu-open .status-menu-panel {
    transform: translateX(0);
    pointer-events: auto;
  }

  .status-label,
  .status-sep {
    display: none;
  }

  .status-menu-panel .status-label,
  .status-menu-panel .status-sep {
    display: inline;
  }

  .status-menu-item {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0.35rem 0.55rem !important;
    width: auto;
    font-size: var(--fs-sm);
    white-space: nowrap;
    justify-content: center;
    border: none;
    border-radius: 0;
    background: transparent;
  }

  .status-menu-item:active {
    opacity: 0.75;
    background: transparent;
  }

  .status-menu-clock {
    display: none !important;
  }

  #btn-views {
    display: none !important;
  }

  .status-btn {
    min-height: 36px;
    padding: 0.35rem 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #btn-help {
    letter-spacing: 0.02em;
  }

  .status-path {
    font-size: var(--fs-xs);
    min-width: 0;
    gap: var(--space-1);
    overflow: hidden;
  }

  .path-crumbs {
    min-width: 0;
    flex-wrap: nowrap;
  }

  .path-crumb,
  .path-crumb-current {
    max-width: 10em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .path-crumb-current {
    max-width: 12em;
  }

  .brand {
    font-size: var(--fs-md);
  }

  .ascii-box {
    margin: 0.55rem 0;
  }

  .output {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0.65rem 0.75rem;
  }

  /* Mobile help: drop English aliases so rows fit without wrapping */
  .output .line.help-row .help-en {
    display: none;
  }

  .output .line.help-row {
    gap: 0.45rem;
  }

  .output .line.help-row .help-cmd {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 52%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* List rows: prefer title; hide summary on narrow screens */
  .output .line.list-row .list-summary {
    display: none;
  }

  .output .line.list-row .title-link {
    max-width: none;
    flex: 1 1 auto;
  }

  .output .line.boot-gap {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .article-title {
    font-size: 1.25em;
    line-height: 1.4;
  }

  .article-meta {
    font-size: var(--fs-xs);
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    scrollbar-width: thin;
  }

  .article-link,
  .article-link.title-link {
    text-underline-offset: 2px;
  }

  .article-actions {
    gap: 0.4rem 0.5rem;
  }

  .article-action,
  .article-copy:not(.article-copy-passcode) {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    touch-action: manipulation;
  }

  .article-action-stack .article-copy-passcode,
  .article-action-stack .article-action {
    width: 100%;
    max-width: none;
  }

  .article-copy-passcode {
    height: 120px;
    min-height: 120px;
    max-height: 120px;
    padding: 0.7rem 1rem;
    touch-action: manipulation;
  }

  .article-copy-passcode .article-passcode-hint,
  .article-copy-passcode .article-passcode-reveal {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .article-action-stack .article-action {
    width: 100%;
    justify-content: center;
    padding: 0.65rem 1rem;
    box-sizing: border-box;
  }

  .article-footer-block {
    padding: 0.55rem 0.6rem;
  }

  .article-image {
    max-width: 100%;
    max-height: min(52vh, 380px);
    margin: 0.55rem auto;
    border-radius: 6px;
  }

  .image-placeholder {
    width: 100%;
    height: min(28vh, 200px);
    margin: 0.55rem auto;
  }

  .img-lightbox {
    padding: 0;
    align-items: center;
    justify-content: center;
  }

  .img-lightbox img {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 100dvh;
    max-height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
    object-fit: contain;
  }

  .img-lightbox-close {
    position: fixed;
    top: max(0.45rem, env(safe-area-inset-top, 0px));
    right: max(0.45rem, env(safe-area-inset-right, 0px));
    z-index: 120;
    width: 3rem;
    height: 3rem;
    font-size: 1.85rem;
    background: rgba(0, 0, 0, 0.55);
    border-color: var(--amber);
    color: var(--amber);
    opacity: 1;
  }

  html[data-scheme="light"] .img-lightbox-close {
    background: rgba(255, 255, 255, 0.75);
  }

  .img-lightbox-hint {
    z-index: 120;
    font-size: var(--fs-xs);
    white-space: normal;
    text-align: center;
    width: min(90%, 20rem);
    bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  }

  .input-bar {
    gap: 0.35rem;
    padding: 0.55rem 0.7rem;
    padding-bottom: max(0.55rem, env(safe-area-inset-bottom, 0px));
  }

  .prompt {
    font-size: var(--fs-sm);
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 16px prevents iOS Safari zoom-on-focus */
  #cmdline {
    font-size: var(--fs-root);
    line-height: 1.4;
  }

  .block-cursor {
    height: 1.2em;
  }
}

@media (max-width: 480px) {
  .status-btn {
    min-height: 34px;
    padding: 0.3rem 0.45rem;
  }

  .prompt {
    max-width: 36%;
    font-size: var(--fs-xs);
  }

  .article-nav-cell {
    padding: 0.55rem 0.35rem;
  }

  .article-passcode-reveal {
    max-width: 100%;
  }
}

@media (max-width: 720px) and (hover: none) {
  /* Prefer tap feedback over hover underline on touch devices */
  .status-btn:active .amber,
  .status-btn:active .green,
  .article-link:active {
    opacity: 0.75;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .output {
    scroll-behavior: auto;
  }

  /* Keep terminal caret blink — it's the affordance for “you can type here” */
  .block-cursor {
    animation: blink 1s step-end infinite !important;
    animation-duration: 1s !important;
    animation-iteration-count: infinite !important;
  }
}

