/* ---- khung chung phòng thực hành ---- */
.lab-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.lab-bar h1 { margin: .3em 0; font-size: 1.5rem; }
.lab-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }
.console { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--paper); }
.console-head { display: flex; justify-content: space-between; padding: 5px 12px; background: var(--soft); font-size: .88rem; }
.console pre { margin: 0; border-radius: 0; min-height: 90px; max-height: 360px; overflow: auto; white-space: pre-wrap; }
.console .explain { margin: 8px; }
.console pre.has-error { color: #fca5a5 !important; }
.roadmap { list-style: none; padding: 0; display: grid; gap: 12px; }
.roadmap li { display: flex; gap: 16px; background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--brand); border-radius: 12px; padding: 12px 18px; }
.roadmap li > span { font-size: 2.2rem; }
.roadmap p { margin: 4px 0 8px; color: var(--dim); }

/* ---- thử thách ---- */
.sample { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.verdict .pass, .pass { color: var(--ok); font-weight: 600; }
.verdict .fail, .fail { color: var(--bad); font-weight: 600; }
.win { font-size: 1.15rem; }
.tests { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; }
.tests li { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: var(--soft); }
.tests li.pass { background: var(--ok); color: var(--bg); }
.tests li.fail { background: var(--bad); color: var(--bg); }
.diff { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.diff pre { max-height: 200px; }

/* ---- rô-bốt ---- */
.level-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.level-strip button { width: 52px; border: 2px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; padding: 2px; }
.level-strip button.on { border-color: var(--brand); background: var(--soft); }
.level-strip small { display: block; color: var(--accent); font-size: .66rem; }
.rb-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .rb-grid { grid-template-columns: minmax(0, 1fr); } }
.rb-map { display: grid; gap: 3px; background: #1e293b; padding: 6px; border-radius: 14px; max-width: 460px; margin: 0 auto; }
.rb-map.cols-4 { grid-template-columns: repeat(4, 1fr); } .rb-map.cols-5 { grid-template-columns: repeat(5, 1fr); } .rb-map.cols-6 { grid-template-columns: repeat(6, 1fr); } .rb-map.cols-7 { grid-template-columns: repeat(7, 1fr); }
.rb-map.cols-9 { grid-template-columns: repeat(9, 1fr); } .rb-map.cols-10 { grid-template-columns: repeat(10, 1fr); }
.cell { position: relative; aspect-ratio: 1; display: grid; place-items: center; background: #e2e8f0; border-radius: 6px; font-size: clamp(.9rem, 3.4vw, 1.7rem); }
.cell.wall { background: #334155; }
.cell.crash { background: #fca5a5; }
.bot { position: absolute; inset: 0; display: grid; place-items: center; }
.bot i { position: absolute; font-style: normal; font-size: .55em; color: #1d4ed8; right: 1px; bottom: 0; }
.rb-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tool, .blk { border: 0; border-radius: 9px; padding: 7px 12px; color: #fff; font-weight: 600; background: #2563eb; }
.tool { cursor: pointer; }
.tool.ghost { background: transparent; border: 2px dashed var(--line); color: var(--ink); }
.b-L, .b-R { background: #7c3aed; } .b-P { background: #15803d; } .b-C { background: #be185d; } .b-rep, .b-until { background: #b45309; } .b-if { background: #0f766e; }
.slot { display: grid; gap: 5px; padding: 6px; border: 2px dashed var(--line); border-radius: 10px; min-height: 40px; cursor: pointer; }
.slot.active { border-color: var(--brand); background: var(--soft); }
.blk { display: flex; justify-content: space-between; align-items: center; gap: 8px; cursor: default; }
.blk.compound { display: block; padding: 6px; background: #b45309; }
.blk.compound.cond { background: #0f766e; }
.blk.compound .slot { background: var(--paper); color: var(--ink); }
.blk-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 4px 5px; }
.blk-head select { color: var(--ink); padding: 2px 6px; }
.blk-else { padding: 4px; }
.del { margin-left: auto; background: rgb(255 255 255 / .22); border: 0; border-radius: 6px; color: #fff; cursor: pointer; padding: 1px 8px; }
.placeholder { background: none; border: 0; color: var(--dim); cursor: pointer; padding: 4px; }

/* ---- bảng tính ---- */
.fx-bar { display: flex; align-items: center; gap: 8px; }
.fx-bar output { min-width: 52px; font-weight: 700; text-align: center; background: var(--soft); border-radius: 6px; padding: 6px; }
.fx-bar span { font-style: italic; color: var(--dim); }
.fx-bar input { flex: 1; font-family: var(--mono); min-width: 0; }
.sheet-wrap { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 8px; margin-top: 8px; }
.sheet { width: max-content; min-width: 100%; font-size: .92rem; }
.sheet th { background: var(--soft); text-align: center; font-weight: 600; position: sticky; top: 0; }
.sheet tbody th { position: static; min-width: 38px; }
.sheet td { min-width: 96px; max-width: 220px; height: 32px; padding: 3px 8px; cursor: cell; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet td.num { text-align: right; }
.sheet td.err { color: var(--bad); font-weight: 700; }
.sheet td.goal { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.sheet td.solved { background: color-mix(in srgb, var(--ok) 18%, transparent); }
.sheet td.sel { outline: 3px solid var(--brand); outline-offset: -3px; }
.fx-tasks li { margin-bottom: 10px; }
.fx-tasks li.done span { color: var(--ok); }
.cell-chip { font-family: var(--mono); font-weight: 700; border: 1px solid var(--line); background: var(--soft); border-radius: 6px; cursor: pointer; padding: 1px 8px; }

/* ---- gõ phím ---- */
.group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-right: 14px; }
.group small { color: var(--dim); font-weight: 700; }
.chip { border: 1px solid var(--line); border-radius: 99px; background: var(--paper); padding: 4px 12px; cursor: pointer; font-size: .9rem; }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.ty-stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: .95rem; }
.ty-target { font-size: 1.6rem; line-height: 1.7; white-space: pre-wrap; }
.ty-target.mono, .ty-target.mono + .ty-input { font-family: var(--mono); }
.ty-target span.ok { color: var(--ok); }
.ty-target span.bad { background: color-mix(in srgb, var(--bad) 30%, transparent); }
.ty-target span.cur { border-bottom: 3px solid var(--brand); background: var(--soft); }
.ty-input { width: 100%; font-size: 1.3rem; }
.keyboard { margin-top: 16px; display: grid; gap: 5px; justify-content: center; }
.kb-row { display: flex; gap: 5px; justify-content: center; }
.kb-row.r1 { padding-left: 14px; } .kb-row.r2 { padding-left: 28px; } .kb-row.r3 { padding-left: 52px; }
.key { width: clamp(24px, 7vw, 46px); height: clamp(28px, 7vw, 44px); display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--line); color: #0f172a; text-transform: uppercase; font-weight: 600; font-size: .9rem; }
.key.wide { width: 96px; font-size: .75rem; }
.key.space { width: min(300px, 55vw); background: #e2e8f0; font-size: .72rem; }
.f0, .f7 { background: #fecdd3; } .f1, .f6 { background: #fde68a; } .f2, .f5 { background: #bbf7d0; } .f3 { background: #bfdbfe; } .f4 { background: #ddd6fe; }
.key.bump { text-decoration: underline; text-underline-offset: 5px; }
.key.next { outline: 4px solid var(--brand); transform: scale(1.12); }

/* ---- thuật toán, nhị phân ---- */
.bars { display: flex; align-items: stretch; gap: 5px; height: 250px; margin-top: 12px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar-track i { width: 100%; background: #64748b; border-radius: 6px 6px 0 0; }
.bar-col small { color: var(--dim); font-size: .7rem; }
.bar-col.cmp i { background: #f59e0b; } .bar-col.swap i { background: #ef4444; } .bar-col.done i { background: #16a34a; } .bar-col.found i { background: #2563eb; }
.bar-col.out { opacity: .28; }
.algo-code { max-width: 640px; }
.bulbs { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.bulb { width: 74px; padding: 10px 4px; border: 2px solid var(--line); border-radius: 14px; background: var(--paper); cursor: pointer; display: grid; gap: 2px; }
.bulb span { font-size: 2rem; filter: grayscale(1); opacity: .35; }
.bulb.on { border-color: #f59e0b; background: color-mix(in srgb, #fbbf24 22%, transparent); }
.bulb.on span { filter: none; opacity: 1; }
.bulb b { font: 700 1.5rem var(--mono); }
.bulb small { color: var(--dim); }
.bn-value { font: 700 1.15rem var(--mono); overflow-wrap: anywhere; }

/* ---- web, SQL ---- */
.preview { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 8px; }
.preview iframe { width: 100%; height: 560px; border: 0; background: #fff; display: block; }
.sq-tasks button { background: none; border: 0; padding: 3px 0; cursor: pointer; text-align: left; }
.sq-tasks li.on button { font-weight: 700; color: var(--brand); }
.sq-tasks li.done button::after { content: " ✓"; color: var(--ok); }
