/* basics page extras — also copied into style.css */

.ch pre, .demo pre {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 16px 18px;
  overflow-x: auto;
  color: var(--text);
  margin: 18px 0 28px;
}
.ch p code, .lead code, .note code, .cmp-col code, .card code,
.demo-head code, .ch li code, .tip code, .tree-detail code, .sp-p code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent-ink);
}
.ch pre code, .demo pre code { background: none; padding: 0; color: inherit; font-size: inherit; }

.compare-3 { grid-template-columns: 1fr 1fr 1fr; }

.tree {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 18px;
  align-items: start;
}
.tree-list { display: flex; flex-direction: column; gap: 4px; }
.tree-item {
  appearance: none; cursor: pointer; text-align: left;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--dim);
  border-radius: var(--r-sm); padding: 8px 12px;
  font-family: var(--mono); font-size: 13px;
  transition: all .15s;
}
.tree-item:hover { color: var(--text); border-color: var(--faint); }
.tree-item.is-on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.tree-detail {
  background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 18px 20px; min-height: 180px;
}
.tree-detail h4 { margin: 0 0 8px; font-size: 16px; font-family: var(--font-head); }
.tree-detail p { margin: 0 0 8px; font-size: 14px; color: var(--dim); line-height: 1.75; }
.tree-detail p:last-child { margin-bottom: 0; }

.perm {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.perm-g {
  background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 14px;
}
.perm-g h4 {
  margin: 0 0 10px; font-size: 12px; color: var(--faint);
  font-family: var(--mono); letter-spacing: .08em; font-weight: 600;
}
.perm-bits { display: flex; gap: 6px; }
.perm-bit {
  flex: 1; appearance: none; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--faint);
  border-radius: var(--r-sm); padding: 10px 0;
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  transition: all .15s;
}
.perm-bit.is-on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }

.join-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; font-family: var(--mono); }
.mini-table th {
  text-align: left; font-size: 11px; color: var(--faint); font-weight: 500;
  padding: 6px 8px; border-bottom: 1px solid var(--line);
  letter-spacing: .06em; text-transform: uppercase;
}
.mini-table td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); color: var(--dim); }
.mini-table tr.is-hit td { background: var(--accent-soft); color: var(--accent-ink); }
.mini-table tr.is-miss td { opacity: .38; }
.mini-table caption {
  caption-side: top; text-align: left; font-size: 12.5px; color: var(--faint);
  padding-bottom: 8px; font-family: var(--sans);
}

.loop-track { display: flex; flex-direction: column; gap: 12px; }
.loop-task {
  display: grid; grid-template-columns: 78px 1fr 72px; gap: 10px; align-items: center;
  font-size: 13px; color: var(--dim);
}
.loop-bar { height: 10px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.loop-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: var(--r-pill); }

.dock-stack { display: flex; flex-direction: column; gap: 8px; }
.dock-layer {
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px;
  background: var(--surface); cursor: pointer; transition: all .18s;
}
.dock-layer:hover { border-color: var(--faint); }
.dock-layer.is-on { border-color: var(--accent-line); background: var(--accent-soft); }
.dock-layer h4 { margin: 0 0 4px; font-size: 14px; }
.dock-layer p { margin: 0; font-size: 13px; color: var(--dim); line-height: 1.65; }

.term {
  font-family: var(--mono); font-size: 13px; line-height: 1.75;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 14px 16px; color: var(--text);
  min-height: 84px; white-space: pre-wrap;
}
.term b { color: var(--accent-ink); font-weight: 500; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chip {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--dim);
  border-radius: var(--r-pill); padding: 6px 12px; font-size: 12.5px; font-family: inherit;
  transition: all .15s;
}
.chip:hover { color: var(--text); }
.chip.is-on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

.cells { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; }
.cell {
  font-family: var(--mono); font-size: 13px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 6px; padding: 6px 10px; color: var(--text);
}
.cell kbd { font-size: 10px; color: var(--faint); margin-left: 6px; font-family: var(--mono); }

.bc-row { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 10px; align-items: center; }
.bc-op { color: var(--faint); font-family: var(--mono); font-size: 18px; text-align: center; }
.bc-grid {
  display: grid; gap: 4px; justify-content: center;
  background: var(--bg-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 12px; min-height: 120px; align-content: center;
}
.bc-cell {
  width: 36px; height: 28px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; border-radius: 4px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
}
.bc-cell.ghost { opacity: .35; }
.bc-err { color: var(--accent-ink); font-size: 13px; text-align: center; }

.symtable.wide th:first-child, .symtable.wide td:first-child { width: auto; }
.symtable.wide th:nth-child(2), .symtable.wide td:nth-child(2) { width: auto; }
.symtable.wide td:first-child { font-family: var(--mono); font-size: 13.5px; color: var(--accent-ink); }

@media (max-width: 900px) {
  .tree, .join-wrap, .grid2, .compare-3, .bc-row { grid-template-columns: 1fr; }
  .perm { grid-template-columns: 1fr; }
  .loop-task { grid-template-columns: 64px 1fr 64px; }
}

.cell.is-done { opacity: .42; text-decoration: line-through; }
.cell.is-now { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.cell.is-wait { opacity: .45; }

.close-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
}
.close-box {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  background: var(--bg-2);
}
.close-box.is-gone { opacity: .55; }
.close-box.is-live { border-color: var(--accent-line); background: var(--accent-soft); }
.close-box code {
  display: block;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
}
.close-box p { margin: 10px 0 0; font-size: 13px; color: var(--dim); line-height: 1.65; }
.close-k {
  display: block;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
  font-family: var(--mono);
}
.close-arrow {
  align-self: center;
  font-size: 12px;
  color: var(--accent-ink);
  font-family: var(--mono);
  text-align: center;
  max-width: 72px;
}

.deco-stack { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.deco-layer, .deco-core {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg-2);
  color: var(--dim);
}
.deco-core {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-ink);
  text-align: center;
}
.deco-layer.is-out { opacity: .7; }

.conc-board {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: stretch;
}
.conc-lane {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  background: var(--surface);
}
.conc-lane h4 { margin: 0 0 10px; font-size: 13px; font-family: var(--font-head); }
.conc-wall {
  writing-mode: vertical-rl;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: var(--faint);
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  padding: 10px 8px;
  min-width: 52px;
}
.conc-wall.is-soft { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-soft); }

.btn-row { display: flex; gap: 8px; margin-top: 12px; }

@media (max-width: 900px) {
  .close-flow, .conc-board { grid-template-columns: 1fr; }
  .close-arrow, .conc-wall { writing-mode: horizontal-tb; max-width: none; min-width: 0; }
}

.btn-row[hidden] { display: none !important; }
