/* counting-change: SICP 1.2.2 trace explorer. Reuses the site's :root
   tokens (--bg, --text, --accent, --border, --code-bg) from style.css. */

#tool-root { font-size: 15px; }
#tool-root button, #tool-root input, #tool-root select { font: inherit; }

.cc-controls {
    display: grid;
    grid-template-columns: 1.1fr 1.4fr auto;
    gap: 24px;
    align-items: start;
    margin: 1rem 0;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.cc-ctl label { display: block; font-weight: 600; margin-bottom: 6px; }
#cc-coins { width: 100%; font-family: monospace; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; }
.cc-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cc-preset { border: 1px solid var(--border); background: transparent; border-radius: 14px; padding: 2px 10px; font-size: 13px; cursor: pointer; }
.cc-preset:hover { border-color: var(--accent); }
.cc-err { color: #c2413b; font-size: 13px; margin-top: 6px; }
.cc-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

.cc-result { padding: 0.5rem 0; }
.cc-answer { font-size: 20px; }
.cc-compare { color: var(--text-secondary); margin-top: 4px; }

.cc-transport { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--border); }
.cc-tbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cc-tbar button { min-width: 34px; height: 30px; border: 1px solid var(--border); background: var(--bg-content); border-radius: 4px; cursor: pointer; padding: 0 8px; }
.cc-tbar button:hover { border-color: var(--accent); }
.cc-tbar .cc-play { min-width: 60px; background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
#cc-step-range { accent-color: var(--accent); }
.cc-steplabel { font: 13px monospace; color: var(--text-secondary); min-width: 12ch; text-align: right; }
.cc-speed { font-size: 13px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; }
.cc-strip { display: block; width: 100%; height: 48px; margin-top: 8px; cursor: crosshair; border-radius: 3px; }
.cc-now { color: var(--text-secondary); font-size: 13px; margin: 4px 0 0; }

.cc-work { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; margin-top: 16px; }
.cc-panel { background: var(--bg-content); border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px; min-width: 0; }
.cc-panel h2 { font-size: 14px; margin: 0 0 10px; }
.cc-side { display: grid; gap: 16px; align-content: start; min-width: 0; }
.cc-treewrap { height: 420px; overflow: auto; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.cc-empty-tree { color: var(--text-secondary); max-width: 60ch; }

.cc-tree .cc-e { stroke: var(--border); stroke-width: 1; }
.cc-tree .cc-e.cc-r { stroke: var(--text-secondary); }
.cc-tree .n circle { fill: var(--bg-content); stroke: var(--border); stroke-width: 1.5; }
.cc-tree .n.u { opacity: .4; }
.cc-tree .n.a circle { fill: var(--accent-light); stroke: var(--accent); }
.cc-tree .n.d.split circle { fill: #1d2b36; stroke: #1d2b36; }
.cc-tree .n.d.one circle { fill: #c27d0e; stroke: #c27d0e; }
.cc-tree .n.d.zero circle { fill: #9aa5ae; stroke: #9aa5ae; }
.cc-tree .n.h circle { fill: #178577; stroke: #178577; }
.cc-tree .n.cur circle { stroke: var(--accent); stroke-width: 4; }
.cc-tree .cc-v { font: 500 10px monospace; fill: #fff; text-anchor: middle; pointer-events: none; }
.cc-tree .cc-lb { font: 10px monospace; fill: var(--text-secondary); text-anchor: middle; pointer-events: none; }

.cc-code { font: 12.5px/1.65 monospace; margin: 0; background: var(--code-bg); padding: 8px; border-radius: 4px; overflow-x: auto; }
.cc-code .cc-ln { display: block; padding: 0 6px; border-left: 3px solid transparent; white-space: pre; }
.cc-code .cc-ln.cc-off { color: #9aa5ae; }
.cc-code .cc-ln.cc-hl { background: var(--accent-light); border-left-color: var(--accent); }
.cc-event { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); min-height: 3em; font-size: 13.5px; }

.cc-stack { list-style: none; margin: 0; padding: 0; font: 12.5px/1.6 monospace; }
.cc-stack li { padding: 2px 6px; border-left: 3px solid transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-stack li.cc-top { border-left-color: var(--accent); background: var(--accent-light); }
.cc-stack li.cc-more, .cc-stack li.cc-empty { color: var(--text-secondary); font-family: inherit; }

.cc-gridpanel { margin-top: 16px; }
.cc-caption { color: var(--text-secondary); font-size: 13px; margin: 0 0 8px; }
.cc-gridwrap { overflow-x: auto; }
#cc-grid { display: block; cursor: pointer; }
.cc-grid-hover { font-size: 13px; margin-top: 6px; min-height: 1.5em; color: var(--text-secondary); }

@media (max-width: 900px) {
    .cc-controls { grid-template-columns: 1fr; gap: 16px; }
    .cc-work { grid-template-columns: 1fr; }
    .cc-treewrap { height: 320px; }
}
