/* HTB Write-ups — shared theme (night ops / briefing) */
:root,
html[data-theme="night"] {
  color-scheme: dark;
  --bg: #0b0e14;
  --bg-card: #11151c;
  --bg-locked: rgba(17, 21, 28, 0.6);
  --border: #1e2430;
  --border-strong: #2a323f;
  --text: #c9d1d9;
  --text-dim: #8b949e;
  --heading: #ffffff;
  --heading-muted: #e6edf3;
  --green: #3fb950;
  --green-bright: #56d364;
  --green-rgb: 63, 185, 80;
  --cyan: #58a6ff;
  --cyan-rgb: 88, 166, 255;
  --purple: #bc8cff;
  --purple-rgb: 188, 140, 255;
  --red: #f85149;
  --red-rgb: 248, 81, 73;
  --yellow: #d29922;
  --yellow-rgb: 210, 153, 34;
  --grid-line: rgba(63, 185, 80, 0.03);
  --glass: rgba(11, 14, 20, 0.86);
  --overlay: rgba(5, 7, 10, 0.66);
  --overlay-heavy: rgba(5, 7, 10, 0.92);
  --row-hover: rgba(255, 255, 255, 0.04);
  --card-sheen: rgba(255, 255, 255, 0.055);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.55);
  --code-bg: #0d1117;
  --code-head: #161b22;
  --selection-fg: #fff;
  --surface: #11151c;
  --surface-hover: #161b22;
  --accent: #3fb950;
  --green-glow: rgba(63, 185, 80, 0.45);
  --theme-color: #0b0e14;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  --font-sans: 'Inter', system-ui, sans-serif;
  --radius: 8px;
}

html[data-theme="briefing"] {
  color-scheme: light;
  --bg: #f4f6f8;
  --bg-card: #ffffff;
  --bg-locked: #e8ecf0;
  --border: #d0d7de;
  --border-strong: #afb8c1;
  --text: #3d444d;
  --text-dim: #656d76;
  --heading: #1f2328;
  --heading-muted: #32383f;
  --green: #1a7f3c;
  --green-bright: #147338;
  --green-rgb: 26, 127, 60;
  --cyan: #0969da;
  --cyan-rgb: 9, 105, 218;
  --purple: #8250df;
  --purple-rgb: 130, 80, 223;
  --red: #cf222e;
  --red-rgb: 207, 34, 46;
  --yellow: #9a6700;
  --yellow-rgb: 154, 103, 0;
  --grid-line: rgba(31, 35, 40, 0.06);
  --glass: rgba(244, 246, 248, 0.9);
  --overlay: rgba(31, 35, 40, 0.38);
  --overlay-heavy: rgba(15, 18, 22, 0.72);
  --row-hover: rgba(31, 35, 40, 0.05);
  --card-sheen: rgba(255, 255, 255, 0.65);
  --shadow: 0 10px 28px rgba(31, 35, 40, 0.08);
  --shadow-lg: 0 24px 60px rgba(31, 35, 40, 0.12);
  --code-bg: #0d1117;
  --code-head: #161b22;
  --selection-fg: #1f2328;
  --surface: #ffffff;
  --surface-hover: #eef1f4;
  --accent: #1a7f3c;
  --green-glow: rgba(26, 127, 60, 0.22);
  --theme-color: #f4f6f8;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  background: var(--bg);
}
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  position: relative;
}
html[data-theme="arena"] {
  color-scheme: dark;
  --bg: #05080b;
  --bg-card: #0c1210;
  --bg-locked: rgba(12, 18, 16, 0.72);
  --border: #1b2a1e;
  --border-strong: #2d4532;
  --text: #d4e0d6;
  --text-dim: #8aa090;
  --heading: #f4fff5;
  --heading-muted: #d7ead9;
  --green: #9fef00;
  --green-bright: #c8ff3d;
  --green-rgb: 159, 239, 0;
  --cyan: #5ce1ff;
  --cyan-rgb: 92, 225, 255;
  --purple: #c084fc;
  --purple-rgb: 192, 132, 252;
  --red: #ff5c57;
  --red-rgb: 255, 92, 87;
  --yellow: #f0c14b;
  --yellow-rgb: 240, 193, 75;
  --grid-line: rgba(159, 239, 0, 0.055);
  --glass: rgba(5, 8, 11, 0.88);
  --overlay: rgba(2, 6, 4, 0.7);
  --overlay-heavy: rgba(2, 4, 3, 0.92);
  --row-hover: rgba(159, 239, 0, 0.06);
  --card-sheen: rgba(159, 239, 0, 0.07);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.7);
  --code-bg: #070b08;
  --code-head: #0d140f;
  --selection-fg: #05080b;
  --surface: #0c1210;
  --surface-hover: #121a14;
  --accent: #9fef00;
  --green-glow: rgba(159, 239, 0, 0.55);
  --theme-color: #05080b;
}

html[data-theme="briefing"] body {
  background-image: radial-gradient(1100px 480px at 50% -8%, rgba(var(--green-rgb), 0.045), transparent 62%);
}
html[data-theme="chess"] {
  color-scheme: dark;
  --bg: #1a1410;
  --bg-card: #241c16;
  --bg-locked: rgba(36, 28, 22, 0.78);
  --border: #4a3b2e;
  --border-strong: #6b5644;
  --text: #e8dcc8;
  --text-dim: #b09a80;
  --heading: #f4ead8;
  --heading-muted: #ddd0bc;
  --green: #d4af37;
  --green-bright: #f0d060;
  --green-rgb: 212, 175, 55;
  --cyan: #c4b5a0;
  --cyan-rgb: 196, 181, 160;
  --purple: #c9a0dc;
  --purple-rgb: 201, 160, 220;
  --red: #c45c4a;
  --red-rgb: 196, 92, 74;
  --yellow: #d4af37;
  --yellow-rgb: 212, 175, 55;
  --grid-line: transparent;
  --glass: rgba(26, 20, 16, 0.9);
  --overlay: rgba(12, 8, 6, 0.72);
  --overlay-heavy: rgba(8, 6, 4, 0.94);
  --row-hover: rgba(212, 175, 55, 0.1);
  --card-sheen: rgba(244, 234, 216, 0.05);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.7);
  --code-bg: #120e0b;
  --code-head: #1c1612;
  --selection-fg: #1a1410;
  --surface: #241c16;
  --surface-hover: #2e241c;
  --accent: #d4af37;
  --green-glow: rgba(212, 175, 55, 0.45);
  --theme-color: #1a1410;
  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --square-light: #3f3329;
  --square-dark: #1e1814;
  --ivory: #f0e6d2;
  --walnut: #5c4033;
  --radius: 4px;
}

html[data-theme="arena"] body {
  background-image: radial-gradient(900px 460px at 82% -6%, rgba(159, 239, 0, 0.09), transparent 58%);
}
html[data-theme="chess"] body {
  background-color: #1a1410;
  background-image: none;
}
html[data-theme="chess"] body::before {
  background-image:
    linear-gradient(rgba(26, 20, 16, 0.22), rgba(26, 20, 16, 0.38)),
    repeating-conic-gradient(#4a3c30 0% 25%, #16110e 0% 50%);
  background-size: auto, 64px 64px;
  background-position: 0 0, 0 0;
  opacity: 1;
}
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: -1;
}
a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

/* selection & scrollbar theming, to match the terminal aesthetic */
::selection {
  background: rgba(var(--green-rgb), 0.25);
  color: var(--selection-fg);
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ---------- print ---------- */
@media print {
  body { background: #fff !important; color: #111 !important; }
  body::before { display: none !important; }
  .reader-topbar, .toc, .toc-mobile, .pager, .back-top-btn, .connect-section,
  .progress-bar, .lightbox, .site-footer, .hero, .controls, .stats-row,
  .spotlight-grid, .share-btn, .search-kbd, .palette, .track-rail, .avatar-rail { display: none !important; }
  .reader-layout, .reader-footer { max-width: none !important; display: block !important; padding: 0 !important; margin: 0 !important; }
  .article-head h1, .title-row h1, .article h2, .article h3, .article h4,
  .article strong { color: #000 !important; }
  .article { font-size: 12pt !important; color: #111 !important; }
  .article a { color: #000 !important; text-decoration: underline; }
  .article code { color: #111 !important; background: #f0f0f0 !important; border-color: #ddd !important; }
  .code-block { border: 1px solid #999 !important; background: #fff !important; }
  .code-head { background: #eee !important; border-bottom: 1px solid #ccc !important; }
  .code-block pre { color: #111 !important; white-space: pre-wrap; word-break: break-word; }
  .hljs { color: #111 !important; }
  .meta-pill { border-color: #bbb !important; color: #333 !important; }
  .code-block, pre, blockquote, table { break-inside: avoid; page-break-inside: avoid; }
  .article img { border-color: #bbb !important; }
}

/* ---------- page back link (tracks pages) ---------- */
.page-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--green-bright);
  margin-bottom: 22px;
}
.page-back:hover { text-decoration: underline; }

/* ---------- homepage tracks ribbon ---------- */
.tracks-ribbon {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin: 0 0 28px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}
.tracks-ribbon:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}
.tracks-ribbon-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green-bright);
  margin-bottom: 4px;
}
.tracks-ribbon strong {
  display: block;
  font-size: 17px;
  color: var(--heading);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.tracks-ribbon p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}
.tracks-ribbon-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.tracks-ribbon .avatars {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  max-width: 380px;
}
.tracks-ribbon .avatars img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: cover;
  border: 2px solid var(--bg-card);
  margin-left: -7px;
  background: var(--bg);
}
.tracks-ribbon .avatars img:first-child { margin-left: 0; }
.complete-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--bg);
  background: var(--green);
  padding: 6px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.tracks-ribbon-cta {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--green-bright);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* mermaid diagrams in the reader */
.mermaid-block {
  margin: 22px 0;
  padding: 16px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--code-bg);
  overflow-x: auto;
}
.mermaid-block .mermaid { display: flex; justify-content: center; }

/* connect + footer (shared by tracks pages) */
.connect-section {
  max-width: 700px;
  margin: 50px auto 0;
  padding: 38px 32px 32px;
  text-align: center;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.connect-heading {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
}
.connect-buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.connect-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 180px;
  padding: 18px 14px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none !important;
  color: var(--text) !important;
  background: var(--bg);
  transition: all 0.2s;
  font-family: var(--font-mono);
}
.connect-btn:hover {
  background: var(--bg-card);
  border-color: var(--green);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.connect-btn svg { opacity: 0.7; transition: opacity 0.2s; }
.connect-btn:hover svg { opacity: 1; }
.connect-btn span { font-size: 14px; font-weight: 500; }
.connect-btn small { font-size: 11px; color: var(--text-dim); }
.site-footer {
  max-width: 1180px;
  margin: 40px auto 0;
  padding: 22px 24px 36px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.site-footer a { color: var(--green-bright); }

@media (max-width: 720px) {
  .tracks-ribbon { grid-template-columns: 1fr; padding: 14px; }
  .tracks-ribbon-right { justify-content: space-between; flex-wrap: wrap; }
  .tracks-ribbon .avatars { max-width: none; }
}

@media print {
  .tracks-ribbon, .page-back, .track-rail, .theme-chip, .theme-switch, .hero-follow.chesscom { display: none !important; }
}

/* ---------- theme switcher + circular wipe ---------- */
.theme-switch {
  position: relative;
  display: inline-flex;
  z-index: 70;
}
.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 8px 12px;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.theme-chip:hover,
.theme-switch.is-open .theme-chip {
  border-color: var(--green);
  color: var(--heading);
}
.theme-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
  flex-shrink: 0;
}
html[data-theme="briefing"] .theme-chip-dot {
  background: transparent;
  box-shadow: none;
  border: 1.5px solid var(--heading);
}
html[data-theme="chess"] .theme-chip-dot {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  box-shadow: none;
  background: conic-gradient(#f0e6d2 0 90deg, #5c4033 0 180deg, #f0e6d2 0 270deg, #5c4033 0);
  border: 1px solid #6b5644;
}
.theme-chip-text { display: inline-flex; align-items: baseline; }
.theme-chip-k { color: var(--text-dim); }
.theme-chip-k::after { content: ':'; margin-right: 0.4em; }
.theme-chip-mode {
  display: none;
  color: var(--green-bright);
  font-weight: 600;
}
html[data-theme="night"] .theme-chip-mode[data-for="night"] { display: inline; }
html[data-theme="arena"] .theme-chip-mode[data-for="arena"] { display: inline; }
html[data-theme="briefing"] .theme-chip-mode[data-for="briefing"] { display: inline; }
html[data-theme="chess"] .theme-chip-mode[data-for="chess"] { display: inline; }
.theme-chip-auto {
  display: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 6px;
}
html[data-theme-pref="auto"] .theme-chip-auto { display: inline-flex; }
.theme-chip-caret {
  width: 0;
  height: 0;
  margin-left: 2px;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4.5px solid var(--text-dim);
  transition: transform 0.16s ease;
}
.theme-switch.is-open .theme-chip-caret { transform: rotate(180deg); }

.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 228px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 80;
  transform-origin: top right;
}
.theme-switch.is-open .theme-menu {
  display: flex;
  animation: theme-menu-in 0.16s ease both;
}
@keyframes theme-menu-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .theme-switch.is-open .theme-menu { animation: none; }
}

.theme-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
  cursor: pointer;
}
.theme-opt:hover { background: var(--row-hover); }
.theme-opt:focus-visible {
  outline: 1px solid var(--green);
  outline-offset: -1px;
  background: var(--row-hover);
}
.theme-opt[aria-selected="true"] { color: var(--heading); }
.theme-opt[aria-selected="true"] .theme-opt-name { color: var(--green-bright); }
.theme-opt-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.theme-opt-name { font-weight: 600; line-height: 1.2; }
.theme-opt-hint {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.theme-opt-check {
  margin-left: auto;
  color: var(--green-bright);
  opacity: 0;
  font-size: 12px;
  font-weight: 700;
}
.theme-opt[aria-selected="true"] .theme-opt-check { opacity: 1; }

.theme-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-sizing: border-box;
}
.theme-swatch[data-swatch="night"] {
  background: #3fb950;
  box-shadow: 0 0 8px rgba(63, 185, 80, 0.45);
}
.theme-swatch[data-swatch="arena"] {
  background: #9fef00;
  box-shadow: 0 0 8px rgba(159, 239, 0, 0.55);
}
.theme-swatch[data-swatch="briefing"] {
  background: #f4f6f8;
  border: 1.5px solid #1a7f3c;
}
.theme-swatch[data-swatch="chess"] {
  border-radius: 2px;
  background: conic-gradient(#f0e6d2 0 90deg, #5c4033 0 180deg, #f0e6d2 0 270deg, #5c4033 0);
  box-shadow: none;
  border: 1px solid #6b5644;
}
.theme-swatch[data-swatch="auto"] {
  background: linear-gradient(90deg, #0b0e14 50%, #f4f6f8 50%);
  border: 1px solid var(--border);
}

.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}
.page-toolbar .page-back { margin-bottom: 0; }
.toolbar-end {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}
.toolbar-end .hero-follow {
  padding: 8px 12px;
  font-size: 12px;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none !important;
  color: var(--text-dim) !important;
  font-family: var(--font-mono);
  background: var(--surface);
  white-space: nowrap;
}
.toolbar-end .hero-follow svg { opacity: 0.7; }
.crumb .theme-chip,
.crumb .theme-switch,
.crumb .toolbar-end { margin-left: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
  isolation: isolate;
}
::view-transition-new(root) { z-index: 1; }
::view-transition-old(root) { z-index: 0; }

html[data-theme="briefing"] .tracks-ribbon strong,
html[data-theme="briefing"] .page h1,
html[data-theme="briefing"] .hero h1 {
  color: var(--heading);
}
html[data-theme="briefing"] .hero-mascot .mascot-glow { opacity: 0.38; }
html[data-theme="briefing"] .hero-caret { box-shadow: none; }
html[data-theme="briefing"] .machine-card.is-locked {
  background: var(--bg-locked);
}
html[data-theme="briefing"] .machine-card.revealed .card-art { opacity: 0.14; }
html[data-theme="briefing"] .machine-card.revealed:hover .card-art { opacity: 0.22; }
html[data-theme="briefing"] .card-banner { opacity: 0.95; }
html[data-theme="briefing"] .hero-follow.github:hover {
  background: #1f2328;
  border-color: #1f2328;
  color: #fff !important;
}
html[data-theme="arena"] .hero-mascot .mascot-glow { opacity: 0.95; }
html[data-theme="arena"] #mascot-glow stop { stop-color: #9fef00; }
html[data-theme="arena"] .hero-caret {
  box-shadow: 0 0 12px rgba(159, 239, 0, 0.7);
}
html[data-theme="chess"] .hero-mascot { display: none; }
html[data-theme="chess"] .hero-caret {
  box-shadow: none;
  background: var(--green-bright);
}
html[data-theme="chess"] .hero h1,
html[data-theme="chess"] .page h1,
html[data-theme="chess"] .article-head h1,
html[data-theme="chess"] .article h2,
html[data-theme="chess"] .featured-name,
html[data-theme="chess"] .tracks-ribbon strong {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}
html[data-theme="chess"] .kicker::before {
  width: 10px;
  height: 10px;
  background: conic-gradient(#f0e6d2 0 90deg, #5c4033 0 180deg, #f0e6d2 0 270deg, #5c4033 0);
  border-radius: 1px;
}
.kicker-chess { display: none; }
html[data-theme="chess"] .kicker-ops { display: none; }
html[data-theme="chess"] .kicker-chess { display: flex; }
html[data-theme="chess"] .theme-chip,
html[data-theme="chess"] .machine-card,
html[data-theme="chess"] .featured-card,
html[data-theme="chess"] .chart-card {
  border-radius: 4px;
}
html[data-theme="chess"] .machine-card:not(.is-locked):hover {
  box-shadow: 0 0 0 2px #d4af37;
}
.hero-follow.chesscom { display: none !important; }
html[data-theme="chess"] .hero-follow.chesscom { display: inline-flex !important; }
html[data-theme="chess"] .hero-follow.chesscom:hover {
  background: #d4af37;
  border-color: #d4af37;
  color: #1a1410 !important;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.3);
  transform: translateY(-1px);
}

html[data-theme="chess"] .writeups-container,
html[data-theme="chess"] .page,
html[data-theme="chess"] .reader-layout {
  position: relative;
  z-index: 2;
}
.chess-chrome {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  color: var(--ivory, #f0e6d2);
}
.chess-ranks {
  position: absolute;
  top: 52px;
  bottom: 28px;
  left: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  width: 16px;
  font-family: var(--font-display, Georgia, serif);
  font-size: 12px;
  font-weight: 600;
  color: rgba(240, 230, 210, 0.32);
  user-select: none;
}
.chess-board-deco {
  position: absolute;
  right: -70px;
  bottom: -80px;
  width: min(420px, 50vw);
  height: min(420px, 50vw);
  background-image: repeating-conic-gradient(#d7c4a3 0% 25%, #6b4e3a 0% 50%);
  background-size: 25% 25%;
  border: 16px solid #3d2c22;
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 3px #c9a227,
    0 28px 70px rgba(0, 0, 0, 0.55);
  transform: rotate(-9deg);
  opacity: 0.42;
}
.chess-watermark {
  position: absolute;
  right: 18px;
  bottom: 8px;
  width: min(30vw, 250px);
  height: min(30vw, 250px);
  opacity: 0.2;
  fill: #f0e6d2;
  transform: rotate(-9deg);
}
@media (max-width: 720px) {
  .chess-ranks { display: none; }
  .chess-board-deco { width: 240px; height: 240px; right: -80px; bottom: -90px; opacity: 0.32; }
  .chess-watermark { width: 140px; height: 140px; right: -10px; bottom: -8px; }
}
@media print {
  .chess-chrome { display: none !important; }
}
.mascot-eye, .mascot-eye-glow { fill: var(--green); }
.code-block, .mermaid-block, .term { color-scheme: dark; }

@media (max-width: 720px) {
  .theme-chip { min-height: 36px; padding: 6px 10px; font-size: 12px; }
  .theme-chip-k { display: none; }
  .theme-chip-k::after { content: none; }
  .theme-menu { min-width: 200px; }
  .hero-follow.chesscom span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .hero-follow.chesscom { padding: 8px 10px; }
}


/* ---------- attack path (reader) ---------- */
.attack-chain {
  margin: 0 0 28px;
  padding: 16px 16px 12px;
  border: 1px solid rgba(var(--green-rgb), 0.28);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(var(--green-rgb), 0.08), transparent 46%),
    var(--bg-card);
}
.attack-chain[hidden] { display: none !important; }
.chain-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green-bright);
  margin-bottom: 8px;
}
.chain-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 14px;
}
.chain-step {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.45;
  color: var(--heading);
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--green-rgb), 0.4);
}
.chain-step:hover { color: var(--green-bright); }
.chain-arrow {
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 13px;
}
.chain-nodes {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
}
.chain-node {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 74px;
  padding: 10px 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}
a.chain-node:hover { border-color: var(--green); }
.chain-node-k {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.chain-node.recon .chain-node-k { color: var(--cyan); }
.chain-node.foothold .chain-node-k { color: var(--green-bright); }
.chain-node.privesc .chain-node-k { color: var(--yellow); }
.chain-node.impact .chain-node-k { color: var(--purple); }
.chain-node-t {
  font-size: 13px;
  line-height: 1.4;
  color: var(--heading);
}
.chain-atlas {
  display: inline-flex;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
}
.chain-atlas:hover { color: var(--green-bright); }
@media (max-width: 860px) {
  .chain-nodes { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .chain-nodes { grid-template-columns: 1fr; }
  .chain-node { min-height: 0; }
}

/* ---------- technique atlas ---------- */
.atlas-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 22px;
}
.atlas-stat {
  min-width: 108px;
  padding: 12px 14px 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}
.atlas-stat b {
  display: block;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}
.atlas-stat span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.atlas-controls { margin-bottom: 22px; }
.atlas-search {
  width: 100%;
  max-width: 520px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--heading);
  font: 14px/1.4 var(--font-mono);
  outline: none;
}
.atlas-search:focus { border-color: var(--green); }
.atlas-facets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.atlas-facet {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}
.atlas-facet:hover { border-color: var(--green); color: var(--heading); }
.atlas-facet.active {
  border-color: var(--green);
  color: var(--bg);
  background: var(--green);
}
.atlas-group { margin: 0 0 28px; }
.atlas-group h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--heading);
  margin: 0 0 12px;
}
.atlas-group h2 span {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
}
.atlas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.atlas-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  padding: 12px 12px 8px;
  scroll-margin-top: 18px;
}
.atlas-card:target,
.atlas-card.atlas-hit {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(var(--green-rgb), 0.45);
}
.atlas-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.atlas-card-head a {
  color: var(--heading);
  text-decoration: none;
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.35;
}
.atlas-card-head a:hover { color: var(--green-bright); }
.atlas-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--green-bright);
  white-space: nowrap;
}
.atlas-machines { list-style: none; margin: 0; padding: 0; }
.atlas-machines a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 13.5px;
}
.atlas-machines a:hover { background: var(--row-hover); }
.atlas-machines img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--surface);
  flex-shrink: 0;
}
.atlas-m-copy { display: flex; flex-direction: column; min-width: 0; }
.atlas-m-name { color: var(--heading); }
.atlas-m-meta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: nowrap;
}
.atlas-diff.easy { color: var(--green); }
.atlas-diff.medium { color: var(--yellow); }
.atlas-diff.hard { color: var(--red); }
.atlas-diff.insane { color: var(--purple); }
.atlas-src {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.atlas-empty {
  font-family: var(--font-mono);
  color: var(--text-dim);
  padding: 12px 0 28px;
}
@media (max-width: 560px) {
  .atlas-m-meta { display: none; }
}
