/* Shared tokens, nav, hero, tabs and the code viewer are in shared/site.css. */

.tab-content { display: none; animation: fadeUp 0.35s ease both; }
.tab-content.active { display: block; }
.hero-uni { font-size: 13px; color: var(--muted); margin-bottom: 6px; }

/* ── Labs table (same as the other course pages) ── */
.labs-table { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.lab-row { display: grid; grid-template-columns: 80px 1fr; border-bottom: 1px solid var(--border); }
.lab-row:last-child { border-bottom: none; }
.lab-num { padding: 18px 20px; display: flex; align-items: center; font-weight: 800; font-size: 1.1rem; letter-spacing: -0.02em; color: var(--accent-text); border-right: 1px solid var(--border); }
.lab-info { padding: 18px 24px; }
.lab-title { font-weight: 700; font-size: 0.95rem; color: var(--text); margin-bottom: 4px; }
.lab-desc { font-size: 0.875rem; color: var(--muted); line-height: 1.55; }
.lab-try {
    margin-top: 10px; padding: 0; border: 0; background: none; cursor: pointer;
    font: inherit; font-size: 0.875rem; font-weight: 600; color: var(--accent-text);
}
.lab-try:hover { text-decoration: underline; }

/* ── Demo panels ── */
.al-panel { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--panel); margin-bottom: 20px; }
.al-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.02); }
.al-bar-right { display: flex; gap: 8px; margin-left: auto; }
.al-seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.al-seg button, .al-btn {
    font: 500 13px var(--font-body); color: var(--muted); background: transparent;
    border: 0; padding: 7px 12px; cursor: pointer; transition: color .15s, background .15s;
}
.al-seg button + button { border-left: 1px solid var(--border); }
.al-seg button[aria-pressed="true"] { color: var(--accent-text); background: var(--accent-dim); }
.al-btn { border: 1px solid var(--border); border-radius: 8px; color: var(--text); }
.al-btn:hover, .al-seg button:hover { color: var(--text); background: var(--surface-2); }
.al-go { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.al-go:hover { background: var(--accent); filter: brightness(1.06); color: var(--on-accent); }
.al-btn:disabled { opacity: .45; cursor: default; }
.al-input { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex: 1 1 240px; }
.al-input input:not([type="range"]) { flex: 1; min-width: 0; font: 14px var(--font-mono); color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; }
.al-c { flex: 0 1 220px; }
.al-c b { font-family: var(--font-mono); color: var(--text); }
.al-panel input[type="range"] { accent-color: var(--accent); flex: 1; min-width: 80px; }
.al-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; margin: 0; align-content: start; }
.al-stats div { display: flex; flex-direction: column; }
.al-stats dt { order: 2; font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.al-stats dd { margin: 0; font: 700 22px var(--font-mono); color: var(--text); font-variant-numeric: tabular-nums; }
.al-stats-row { grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 16px 18px; border-top: 1px solid var(--border); }
.al-msg { min-height: 1.5em; margin: 0; padding: 0 18px 16px; font-size: 14px; color: var(--muted); }

/* ── Lab 1: stacks ── */
.st-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 280px); gap: 28px; padding: 20px 18px; }
.st-stacks { display: flex; gap: 24px; align-items: flex-end; }
.st-col { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 64px; }
.st-col > b { font: 700 14px var(--font-mono); color: var(--muted); }
.st-stack { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; width: 100%; height: 300px; border: 1px dashed var(--border); border-top: 0; border-radius: 0 0 10px 10px; padding: 4px; }
.st-item { height: 30px; border-radius: 6px; display: grid; place-items: center; font: 600 14px var(--font-mono); color: #0e0f12; background: color-mix(in oklab, var(--accent) calc(var(--v) * 1%), #e6e6ea); }
.st-regs { display: flex; flex-direction: column; gap: 12px; margin-left: 12px; }
.st-regs div { display: flex; align-items: center; gap: 10px; font: 13px var(--font-mono); color: var(--muted); }
.st-regs b { width: 46px; height: 34px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 15px; }

/* ── Lab 2 ── */
.tr-body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px; }
.tr-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: var(--surface); }
.tr-card b { font: 700 14px var(--font-mono); color: var(--accent-text); }
.tr-card p { margin: 8px 0 0; font-size: 14px; color: var(--text); line-height: 1.5; }
.tr-grow { padding: 4px 16px 18px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 20px; align-items: center; font-size: 14px; color: var(--text); }
.tr-bars { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }
.tr-bar { display: grid; grid-template-columns: 70px minmax(0, 1fr) 100px; gap: 10px; align-items: center; font: 13px var(--font-mono); color: var(--muted); }
.tr-bar i { height: 14px; border-radius: 4px; background: var(--accent); min-width: 2px; }
.tr-bar span:last-child { text-align: right; color: var(--text); }

/* ── Lab 3: tree ── */
.t-svg { display: block; width: 100%; height: 320px; }
.t-edge { stroke: #4a4c57; stroke-width: 1.2; }
.t-node circle { fill: #2a2b33; stroke: #5b5e6b; stroke-width: 1; }
.t-node text { font: 600 10px var(--font-mono); fill: #e6e6ea; text-anchor: middle; dominant-baseline: central; }
.t-node.new circle { fill: var(--accent); stroke: var(--accent); }
.t-node.new text { fill: #1a0d06; }
.t-node.rebuilt circle { stroke: #4ade80; stroke-width: 2; animation: flash .9s ease; }
@keyframes flash { from { fill: #14532d; } }

.al-table-wrap { margin-bottom: 8px; overflow-x: auto; }
.al-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.al-table caption { text-align: left; font-weight: 600; color: var(--text); padding-bottom: 10px; }
.al-table th, .al-table td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; white-space: nowrap; }
.al-table th:first-child { text-align: left; }
.al-table thead th { color: var(--muted); font-weight: 500; }
.al-table tbody th { font-weight: 500; color: var(--text); }
.al-table td { color: var(--text); font-family: var(--font-mono); font-size: 13px; }
.al-foot { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}
@media (max-width: 760px) {
    .lab-row { grid-template-columns: 56px 1fr; }
    .lab-num { padding: 16px 12px; font-size: 0.95rem; }
    .lab-info { padding: 16px; }
    .st-body { grid-template-columns: 1fr; }
    .st-stack { height: 280px; }
    .tr-body { grid-template-columns: 1fr; }
    .tr-grow { grid-template-columns: 1fr; }
    .al-stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .al-bar-right { margin-left: 0; }
    .t-svg { height: 240px; }
}
@media (prefers-reduced-motion: reduce) {
    .t-node.rebuilt circle { animation: none; }
}
