/* Leaderboard */
.lb-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.lb-tabs a {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  background: #fff;
}
.lb-tabs a.active, .lb-tabs a:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.lb-me {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7faf8;
}
.lb-me small { display: block; color: #66756f; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.lb-me strong { display: block; font-size: 1.05rem; }
.lb-me span { font-size: 0.8rem; color: #4d5d57; }
.lb-table tr.lb-self td { background: #e9f6f0; }
.lb-pos {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 50%;
  font-weight: 700; font-size: 0.85rem; background: #eef2f0; color: var(--ink-soft);
}
.lb-pos.top1 { background: #f5c542; color: #4a3500; }
.lb-pos.top2 { background: #cfd8dc; color: #2f3b40; }
.lb-pos.top3 { background: #e0a370; color: #4b2a10; }
.lb-tiers { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.lb-tier {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.6rem; border-radius: 999px; background: #eef4f1; font-size: 0.8rem;
}
.lb-tier small { color: #66756f; }

/* Code Arena list */
.code-problem-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.8rem; }
.code-problem {
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
a.code-problem { color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
a.code-problem:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.code-problem.solved { border-color: #9fd3b4; background: #f2faf5; }
.code-problem .tag.diff { background: #eef2f0; }
.code-problem.diff-easy .tag.diff { color: #1f7a45; background: #e3f4ea; }
.code-problem.diff-medium .tag.diff { color: #8a5600; background: #fbf0d9; }
.code-problem.diff-hard .tag.diff { color: #a3261b; background: #fbe4e1; }
.code-prompt p { margin-bottom: 0.35rem; }
.code-prompt ul { margin: 0.2rem 0 0.6rem; padding-left: 1.2rem; }
.code-prompt code { background: #eef2f0; padding: 0.05rem 0.3rem; border-radius: 4px; }
.code-gap { height: 0.4rem; }

/* Code Lab (editor + output) */
.code-lab { display: grid; grid-template-columns: minmax(280px, 0.9fr) 1.6fr; gap: 1rem; align-items: start; }
.code-lab.no-problem { grid-template-columns: 1fr; }
@media (max-width: 991px) { .code-lab { grid-template-columns: 1fr; } }
.code-prompt { max-height: calc(100vh - 140px); overflow: auto; }
.code-prompt pre {
  background: #f3f6f4; border: 1px solid var(--line); border-radius: 10px;
  padding: 0.5rem 0.7rem; font-family: var(--mono); font-size: 0.82rem; white-space: pre-wrap; margin: 0.2rem 0 0.6rem;
}
.code-ide { border-radius: 14px; overflow: hidden; background: #1e1f22; box-shadow: var(--shadow); color-scheme: dark; }
.code-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  padding: 0.55rem 0.75rem; background: #2b2d31; border-bottom: 1px solid #3a3c42;
}
.code-toolbar .btn-run, .code-toolbar .btn-submit, .code-toolbar .btn-tool {
  border: 0; border-radius: 8px; padding: 0.35rem 0.85rem; font-size: 0.84rem; font-weight: 600; cursor: pointer;
}
.code-toolbar .btn-run { background: #2ea043; color: #fff; }
.code-toolbar .btn-run:hover { background: #3fb950; }
.code-toolbar .btn-submit { background: #1f6feb; color: #fff; }
.code-toolbar .btn-submit:hover { background: #388bfd; }
.code-toolbar .btn-tool { background: #3a3c42; color: #d7dae0; }
.code-toolbar .btn-tool:hover { background: #4a4d55; }
.code-toolbar button:disabled { opacity: 0.55; cursor: not-allowed; }
.code-toolbar select {
  background: #1e1f22; color: #d7dae0; border: 1px solid #4a4d55; border-radius: 8px; padding: 0.3rem 0.5rem; font-size: 0.84rem;
}
.code-toolbar .code-file { color: #9aa0aa; font-family: var(--mono); font-size: 0.8rem; margin-left: auto; }
.code-ide .CodeMirror { height: 420px; font-family: var(--mono); font-size: var(--code-font, 14px); line-height: 1.5; }
.code-ide .code-output, .code-ide .code-io textarea { font-size: calc(var(--code-font, 14px) - 1px); }
.code-toolbar .code-zoom { display: inline-flex; gap: 2px; }
.code-toolbar .code-zoom .btn-tool { padding: 0.35rem 0.6rem; }
.code-toolbar .code-zoom .btn-tool:first-child { border-radius: 8px 0 0 8px; }
.code-toolbar .code-zoom .btn-tool:last-child { border-radius: 0 8px 8px 0; }
.code-toolbar .code-zoom .code-zoom-level { border-radius: 0; min-width: 3.4rem; font-family: var(--mono); font-size: 0.78rem; }
.code-ide .CodeMirror-gutters { background: #1e1f22; border-right: 1px solid #333; }
.code-io { display: grid; grid-template-columns: 1fr 2fr; border-top: 1px solid #3a3c42; }
@media (max-width: 767px) { .code-io { grid-template-columns: 1fr; } }
.code-io label {
  display: block; padding: 0.35rem 0.75rem; margin: 0;
  background: #2b2d31; color: #9aa0aa; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
}
.code-io textarea {
  width: 100%; height: 170px; border: 0; resize: vertical; padding: 0.6rem 0.75rem;
  background: #16171a; color: #e6e6e6; font-family: var(--mono); font-size: 13px; outline: none;
}
.code-io .code-stdin { border-right: 1px solid #3a3c42; }
.code-output {
  height: 170px; overflow: auto; margin: 0; padding: 0.6rem 0.75rem;
  background: #0d0e10; color: #e6e6e6; font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-word;
}
.code-output .out-err { color: #ff7b72; }
.code-output .out-info { color: #8b949e; }
.code-output .out-ok { color: #3fb950; }
.code-output .out-in { color: #79c0ff; }
.code-io.interactive { grid-template-columns: 1fr; }
.code-io.interactive .code-stdin { display: none; }
.code-io.interactive .code-output { height: 240px; cursor: text; }
.code-output .console-input {
  background: transparent; border: 0; outline: 0; padding: 0; margin: 0; width: 70%; min-width: 6ch;
  color: #79c0ff; caret-color: #fff; font: inherit;
}
.code-output .out-wait { color: #8b949e; animation: code-blink 1s steps(2) infinite; }
@keyframes code-blink { 50% { opacity: 0.2; } }
.code-toolbar .code-toggle { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; color: #d7dae0; font-size: 0.8rem; cursor: pointer; user-select: none; }
.code-toolbar .code-toggle input { accent-color: #2ea043; }
.code-tests { margin-top: 1rem; }
.code-test {
  display: flex; gap: 0.6rem; align-items: flex-start;
  padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 0.4rem; background: #fff; font-size: 0.85rem;
}
.code-test.pass { border-color: #9fd3b4; background: #f2faf5; }
.code-test.fail { border-color: #efb3a8; background: #fdf3f1; }
.code-test pre { margin: 0.2rem 0 0; font-family: var(--mono); font-size: 0.78rem; white-space: pre-wrap; }
.code-runner-note { font-size: 0.78rem; color: #9aa0aa; padding: 0.35rem 0.75rem; background: #2b2d31; border-top: 1px solid #3a3c42; }

/* Wide page + side-by-side editor/console (Playground, and any page in full screen) */
.arena-main .arena-wide { padding: 0.95rem 1.25rem; }
.code-splitter { display: none; }
.code-ide.split .code-body, .code-ide.fullscreen .code-body {
  display: grid; grid-template-columns: minmax(280px, var(--code-left, 60%)) 6px minmax(240px, 1fr);
  height: clamp(440px, calc(100vh - 230px), 1400px);
}
.code-ide.split .code-splitter, .code-ide.fullscreen .code-splitter {
  display: block; background: #2b2d31; cursor: col-resize; border-left: 1px solid #3a3c42; border-right: 1px solid #3a3c42;
}
.code-splitter:hover, .code-splitter.dragging { background: #2ea043; }
.code-ide.split .code-editor-pane, .code-ide.fullscreen .code-editor-pane { min-width: 0; min-height: 0; }
.code-ide.split .CodeMirror, .code-ide.fullscreen .CodeMirror { height: 100%; }
.code-ide.split .code-io, .code-ide.fullscreen .code-io { display: flex; flex-direction: column; border-top: 0; min-width: 0; min-height: 0; }
.code-ide.split .code-io .code-stdin, .code-ide.fullscreen .code-io .code-stdin { border-right: 0; border-bottom: 1px solid #3a3c42; }
.code-ide.split .code-io .code-stdin textarea, .code-ide.fullscreen .code-io .code-stdin textarea { height: 120px; }
.code-ide.split .code-io > div:last-child, .code-ide.fullscreen .code-io > div:last-child { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.code-ide.split .code-io .code-output, .code-ide.fullscreen .code-io .code-output { flex: 1; height: auto; }
.code-body.dragging { user-select: none; cursor: col-resize; }
.code-editor-pane { display: flex; flex-direction: column; }
.code-editor-pane .CodeMirror { flex: 1 1 auto; min-height: 0; }
.code-ide.split .code-editor-pane .CodeMirror, .code-ide.fullscreen .code-editor-pane .CodeMirror { height: 0; flex: 1 1 0; }
.code-tabs {
  display: flex; align-items: stretch; gap: 2px; overflow-x: auto; flex: none;
  background: #18191c; border-bottom: 1px solid #3a3c42; padding: 4px 6px 0;
}
.code-tabs[hidden] { display: none; }
.code-tab {
  display: inline-flex; align-items: center; border-radius: 7px 7px 0 0; background: #26282c;
  border: 1px solid #3a3c42; border-bottom: 0; white-space: nowrap;
}
.code-tab.active { background: #1e1f22; box-shadow: inset 0 2px 0 #2ea043; }
.code-tab button { background: none; border: 0; color: #9aa0aa; font-family: var(--mono); font-size: 0.8rem; cursor: pointer; }
.code-tab .code-tab-name { padding: 0.35rem 0.7rem; }
.code-tab.active .code-tab-name { color: #e6e6e6; }
.code-tab .code-tab-close { padding: 0.2rem 0.5rem 0.2rem 0; font-size: 1rem; line-height: 1; }
.code-tab .code-tab-close:hover { color: #ff7b72; }
.code-tab-add {
  margin: 0 0 3px 6px; padding: 0.2rem 0.7rem; border-radius: 7px; border: 1px dashed #4a4d55;
  background: none; color: #3fb950; font-size: 0.78rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.code-tab-add:hover:not(:disabled) { background: #23262b; border-color: #2ea043; }
.code-tab-add:disabled { opacity: 0.45; cursor: not-allowed; }
.code-ide.fullscreen { position: fixed; inset: 0; z-index: 1070; border-radius: 0; display: flex; flex-direction: column; }
.code-ide.fullscreen .code-body { flex: 1; height: auto; min-height: 0; }
body.code-fs { overflow: hidden; }
@media (max-width: 991px) {
  .code-ide.split .code-body, .code-ide.fullscreen .code-body { grid-template-columns: 1fr; grid-template-rows: minmax(320px, 1fr) auto; height: auto; }
  .code-ide.fullscreen .code-body { height: auto; }
  .code-ide.split .code-splitter, .code-ide.fullscreen .code-splitter { display: none; }
  .code-ide.split .code-io .code-output, .code-ide.fullscreen .code-io .code-output { height: 240px; flex: none; }
  .code-ide.split .code-io, .code-ide.fullscreen .code-io { border-top: 1px solid #3a3c42; }
}

/* Code suggestions (CodeMirror show-hint) */
.CodeMirror-hints {
  z-index: 1080; background: #252629; border: 1px solid #44464d; border-radius: 6px; padding: 3px;
  font-family: var(--mono); font-size: 13px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); min-width: 220px;
}
.CodeMirror-hint { color: #d7dae0; padding: 2px 8px; border-radius: 4px; display: flex; gap: 1.2rem; justify-content: space-between; }
.CodeMirror-hint .hint-kind { color: #7d828c; font-size: 11px; }
.CodeMirror-hint.kind-snippet .hint-name { color: #e5c07b; }
.CodeMirror-hint.kind-keyword .hint-name { color: #c792ea; }
.CodeMirror-hint.kind-method .hint-name, .CodeMirror-hint.kind-fn .hint-name { color: #82aaff; }
.CodeMirror-hint.kind-class .hint-name, .CodeMirror-hint.kind-name .hint-name { color: #ffcb6b; }
li.CodeMirror-hint-active { background: #1f6feb; }
li.CodeMirror-hint-active .hint-name, li.CodeMirror-hint-active .hint-kind { color: #fff; }

/* Web Lab Playground */
.web-tracks { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.web-tracks a {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.35rem 0.8rem; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: #334155; font-size: 0.85rem; font-weight: 600; text-decoration: none;
}
.web-tracks a:hover { border-color: var(--accent); color: var(--accent); }
.web-tracks a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.web-tracks a small { font-size: 0.65rem; font-weight: 500; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.05em; }
.web-output { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #16171a; }
.web-pane-label {
  padding: 0.3rem 0.75rem; background: #2b2d31; color: #9aa0aa; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; flex: none;
}
.web-output iframe { flex: 1 1 60%; min-height: 200px; width: 100%; border: 0; background: #fff; }
.web-output .web-console { flex: 0 0 auto; height: 150px; }
.web-console .out-warn { color: #e3b341; }
.web-clear { background: none; border: 0; color: #9aa0aa; font-size: 0.7rem; text-transform: uppercase; cursor: pointer; }
.web-clear:hover { color: #fff; }
.code-ide:not(.split):not(.fullscreen) .web-output iframe { height: 380px; }
.web-results { flex: 1; overflow: auto; background: #fff; color: #0f172a; padding: 0.25rem 0.5rem; min-height: 240px; }
.web-stmt { padding: 0.5rem 0.25rem; border-bottom: 1px solid #e2e8f0; }
.web-stmt > code { display: block; color: #64748b; font-size: 0.75rem; margin-bottom: 0.35rem; white-space: pre-wrap; }
.web-table { border-collapse: collapse; font-size: 0.82rem; font-family: var(--mono); margin-bottom: 0.25rem; }
.web-table th, .web-table td { border: 1px solid #cbd5e1; padding: 0.2rem 0.55rem; text-align: left; }
.web-table th { background: #f1f5f9; }
.web-table .web-null { color: #94a3b8; font-style: italic; }
.web-ok { color: #15803d; font-size: 0.8rem; }
.web-err { color: #b91c1c; font-size: 0.85rem; font-family: var(--mono); white-space: pre-wrap; }
.web-embed { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 1rem; }
.web-embed-frame iframe { width: 100%; height: clamp(520px, calc(100vh - 230px), 1200px); border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.web-tasks { padding-left: 1.1rem; font-size: 0.88rem; }
.web-tasks li { margin-bottom: 0.45rem; }
@media (max-width: 991px) { .web-embed { grid-template-columns: 1fr; } }
.web-guide { max-width: 900px; }
.web-code { position: relative; background: #0f1a15; color: #d7f5e3; border-radius: 10px; padding: 1.2rem 1rem 0.8rem; font: 0.82rem/1.5 var(--mono); overflow-x: auto; }
.web-code-lang { position: absolute; top: 0.3rem; right: 0.6rem; font-size: 0.65rem; color: #6ee7b7; text-transform: uppercase; letter-spacing: 0.08em; }
.web-check { border: 1px dashed var(--line); border-radius: 10px; padding: 0.7rem 0.9rem; background: #f8fafc; }

/* Data Lab Playground */
.data-status { margin-left: auto; color: #9aa0aa; font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.data-stdin {
  flex: none; height: 64px; width: 100%; border: 0; resize: vertical; padding: 0.4rem 0.75rem;
  background: #16171a; color: #e6e6e6; font-family: var(--mono); font-size: 13px; outline: none;
}
.data-output {
  flex: 1; min-height: 240px; overflow: auto; padding: 0.5rem 0.75rem; background: #0d0e10; color: #e6e6e6;
  font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-word;
}
.data-text { color: inherit; }
.data-text.out-err { color: #ff7b72; }
.data-text.out-info { color: #8b949e; }
.data-text.out-ok { color: #3fb950; }
.data-text.out-in { color: #79c0ff; }
.data-img { display: block; max-width: 100%; height: auto; margin: 0.4rem 0; border-radius: 6px; background: #fff; }
.data-table { white-space: normal; margin: 0.4rem 0; overflow-x: auto; background: #fff; color: #0f172a; border-radius: 6px; padding: 0.3rem; }
.data-table .web-table { margin: 0; }
.data-table .web-table td { text-align: right; }
.data-files { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; padding: 0.35rem 0.6rem; background: #2b2d31; border-top: 1px solid #3a3c42; font-size: 0.75rem; color: #9aa0aa; }
.data-file { background: #1e1f22; border: 1px solid #3a3c42; color: #d7dae0; border-radius: 6px; padding: 0.1rem 0.45rem; font-family: var(--mono); font-size: 0.72rem; cursor: pointer; margin: 0; }
.data-file:hover { border-color: #2ea043; color: #fff; }
.data-upload { color: #3fb950; border-style: dashed; }
@media (max-width: 991px) { .data-output { min-height: 280px; } }

/* Practice Lab home and activities (lab identity color via --lab-accent) */
.lab-scope { --lab-accent: #2563eb; }
.lab-hero { border-top: 4px solid var(--lab-accent); background: linear-gradient(135deg, color-mix(in srgb, var(--lab-accent) 9%, #fff), #fff 60%); }
.lab-hero-icon { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--lab-accent); }
.lab-hero-icon svg { stroke: #fff; color: #fff; }
.lab-scope .code-problem .kicker { display: block; }
.lab-scope .code-problem > .d-flex > svg { stroke: var(--lab-accent); color: var(--lab-accent); }
.lab-scope .btn-arena { background: var(--lab-accent); border-color: var(--lab-accent); }
.assess-set { border-top: 3px dashed #d4a017; }
.assess-card { display: flex; flex-direction: column; border-style: dashed; }
.assess-card.assess-off { opacity: 0.7; background: #f6f6f4; }
.assess-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: auto; padding-top: 0.6rem; }
.assess-assign { display: flex; gap: 0.3rem; align-items: center; }
.assess-assign select { max-width: 150px; }
.lab-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
.lab-act-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1.25rem; align-items: start; }
.lab-act-layout.is-sim { grid-template-columns: 1fr; }
@media (max-width: 991px) { .lab-layout, .lab-act-layout { grid-template-columns: 1fr; } }
.lab-activity { border-left: 3px solid var(--lab-accent); }
.lab-activity.locked { opacity: 0.55; pointer-events: none; filter: grayscale(0.6); }
.tag.lab-mode { font-weight: 600; }
.tag.mode-guided { color: #1d4ed8; background: #e0eaff; }
.tag.mode-practice { color: #475569; background: #eef1f5; }
.tag.mode-challenge { color: #b45309; background: #fdf0d5; }
.lab-board { list-style: none; padding: 0; margin: 0; }
.lab-board li { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.3rem; border-radius: 8px; font-size: 0.88rem; }
.lab-board li.lb-self { background: color-mix(in srgb, var(--lab-accent) 12%, #fff); }
.badge-chip.lab-badge-off { opacity: 0.45; filter: grayscale(1); }
.lab-recent li { padding: 0.35rem 0; border-bottom: 1px solid #eef0f2; }
.lab-recent li:last-child { border-bottom: 0; }
.lab-prompt p { margin-bottom: 0.4rem; }
.lab-prompt .web-code { white-space: pre; }
.lab-hints { border: 1px dashed color-mix(in srgb, var(--lab-accent) 45%, #ccc); border-radius: 10px; padding: 0.6rem 0.75rem; }
.lab-sample { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.5rem; margin-bottom: 0.5rem; }
.lab-sample small { color: #6b7280; }
.lab-sample pre, .lab-pre { margin: 0.15rem 0 0; background: #f4f6f8; border-radius: 6px; padding: 0.4rem 0.55rem; font-family: var(--mono); font-size: 0.78rem; white-space: pre-wrap; max-height: 200px; overflow: auto; }
.lab-act-layout .CodeMirror { height: 380px; font-family: var(--mono); font-size: 14px; }
.lab-q { border: 1px solid #e5e7eb; border-radius: 10px; padding: 0.6rem 0.8rem; margin-bottom: 0.7rem; }
.lab-q legend { float: none; width: auto; font-size: 0.9rem; margin-bottom: 0.35rem; }
.lab-q.is-ok { border-color: #9fd3b4; background: #f2faf5; }
.lab-q.is-wrong { border-color: #f0b8b0; background: #fdf4f2; }
.lab-q-fb:not(:empty) { margin-top: 0.35rem; }
.lab-score { font-weight: 700; font-size: 1.3rem; padding: 0.1rem 0.6rem; border-radius: 8px; }
.lab-score.ok { color: #1f7a45; background: #e3f4ea; }
.lab-score.bad { color: #a3261b; background: #fbe4e1; }
.lab-note { padding: 0.35rem 0.6rem; margin-bottom: 0.4rem; border-radius: 8px; background: color-mix(in srgb, var(--lab-accent) 10%, #fff); font-size: 0.88rem; }
.lab-test { padding: 0.4rem 0; border-bottom: 1px solid #eef0f2; font-size: 0.88rem; }
.lab-test:last-child { border-bottom: 0; }

/* Cyber Lab workspace (terminal or documents + objectives) */
.cy-labs { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.cy-labs a { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.75rem; border: 1px solid #d6dde3; border-radius: 999px; background: #fff; color: inherit; text-decoration: none; font-size: 0.85rem; }
.cy-labs a small { color: #6b7280; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }
.cy-labs a:hover { border-color: var(--lab-accent); }
.cy-labs a.active { background: var(--lab-accent); border-color: var(--lab-accent); color: #fff; }
.cy-labs a.active small { color: #e0f2f7; }
.cy-lab-num { display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: rgba(0,0,0,0.08); font-size: 0.72rem; font-weight: 700; }
.cy-brief { border-left: 4px solid var(--lab-accent); }
.cy-ws { --cy-h: 520px; }
.cy-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; align-items: stretch; }
@media (max-width: 991px) { .cy-main { grid-template-columns: 1fr; } }
.cy-term-wrap { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: #0b1117; box-shadow: var(--shadow); min-height: var(--cy-h); }
.cy-bar { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.75rem; background: #161f29; color: #9fb3c8; font-size: 0.78rem; }
.cy-dots i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; background: #ff5f56; }
.cy-dots i:nth-child(2) { background: #ffbd2e; }
.cy-dots i:nth-child(3) { background: #27c93f; }
.cy-title { flex: 1; font-family: var(--mono); }
.cy-btn { background: transparent; border: 1px solid #2c3a48; color: #9fb3c8; border-radius: 6px; padding: 0 0.45rem; line-height: 1.6; }
.cy-btn:hover { color: #fff; border-color: #4b6075; }
.cy-term { flex: 1; overflow-y: auto; padding: 0.6rem 0.8rem; font-family: var(--mono); font-size: 13px; line-height: 1.45; color: #d6e2ee; cursor: text; max-height: 70vh; }
.cy-o { white-space: pre-wrap; word-break: break-word; }
.cy-o.cy-cmd { color: #7ee787; }
.cy-o.cy-err { color: #ff7b72; }
.cy-o.cy-info { color: #8b949e; }
.cy-line { display: flex; align-items: center; }
.cy-prompt { color: #7ee787; white-space: pre; }
.cy-line input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: #fff; font: inherit; caret-color: #7ee787; padding: 0; }
.cy-ws.cy-fullscreen { position: fixed; inset: 0; z-index: 1070; background: #0b1117; padding: 0.75rem; overflow: auto; }
.cy-ws.cy-fullscreen .cy-main { height: 100%; }
.cy-ws.cy-fullscreen .cy-term { max-height: none; }
.cy-ws.cy-fullscreen .cy-side { background: #fff; }
.cy-docs { border-radius: 14px; background: #fff; box-shadow: var(--shadow); overflow: hidden; min-height: var(--cy-h); }
.cy-doc-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.5rem 0.6rem 0; background: #f1f5f8; border-bottom: 1px solid #e3e8ee; }
.cy-doc-tabs button { border: 1px solid transparent; border-bottom: 0; background: transparent; padding: 0.4rem 0.8rem; border-radius: 8px 8px 0 0; font-size: 0.85rem; color: #475569; }
.cy-doc-tabs button.active { background: #fff; border-color: #e3e8ee; color: var(--lab-accent); font-weight: 600; }
.cy-doc { padding: 1rem 1.1rem; font-size: 0.92rem; }
.cy-doc pre { margin: 0; white-space: pre-wrap; font-family: var(--mono); font-size: 0.82rem; line-height: 1.5; background: #f8fafc; border: 1px solid #e5e9ef; border-radius: 8px; padding: 0.8rem; }
.cy-side { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 0.9rem; display: flex; flex-direction: column; gap: 0.5rem; max-height: calc(var(--cy-h) + 200px); overflow-y: auto; }
.cy-progress { height: 6px; border-radius: 999px; background: #e8edf2; overflow: hidden; }
.cy-progress div { height: 100%; width: 0; background: var(--lab-accent); transition: width 0.3s; }
.cy-objs { margin: 0; padding-left: 1.2rem; }
.cy-obj { margin-bottom: 0.7rem; padding: 0.45rem 0.55rem; border: 1px solid #e5e7eb; border-radius: 10px; }
.cy-obj::marker { font-weight: 700; color: #64748b; }
.cy-obj.is-ok { border-color: #9fd3b4; background: #f2faf5; }
.cy-obj.is-wrong { border-color: #f0b8b0; background: #fdf4f2; }
.cy-obj.cy-run.is-ok .cy-run-note { display: none; }
.cy-obj.cy-run.is-ok .cy-task::after { content: '  \2713 done'; color: #1f7a45; font-weight: 600; font-size: 0.8rem; }
.cy-task { font-size: 0.88rem; font-weight: 500; margin-bottom: 0.3rem; }
.cy-obj-actions { display: flex; gap: 0.4rem; margin-top: 0.35rem; }
.cy-obj-actions:empty { display: none; }
.cy-fb:not(:empty) { margin-top: 0.35rem; }
.cy-outcome { margin-top: 0.3rem; padding: 0.35rem 0.5rem; border-left: 3px solid var(--lab-accent); background: #f1f7f9; border-radius: 4px; }
.cy-tips { border-top: 1px dashed #d6dde3; padding-top: 0.5rem; color: #475569; }
.cy-prompt.lx-root { color: #ff7b72; }
.lx-explain { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0 0.4rem 0 0; font-size: 0.75rem; color: #c5d4e0; cursor: pointer; }
.lx-explain input { margin: 0; }
.lx-term-wrap { position: relative; }
.lx-editor { display: none; position: absolute; left: 0; right: 0; top: 2.15rem; bottom: 0; z-index: 2; flex-direction: column; background: #0b1117; }
.lx-editor.lx-open { display: flex; }
.lx-ed-head, .lx-ed-keys { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0.7rem; background: #161f29; color: #9fb3c8; font-size: 0.78rem; }
.lx-ed-head strong { color: #d6e2ee; font-weight: 600; }
.lx-editor textarea { flex: 1; width: 100%; min-height: 0; border: 0; resize: none; background: #0b1117; color: #d6e2ee; font-family: var(--mono); font-size: 13px; line-height: 1.45; padding: 0.6rem 0.8rem; outline: none; }
.lx-ed-keys button { background: transparent; border: 1px solid #2c3a48; color: #d6e2ee; border-radius: 6px; padding: 0.15rem 0.5rem; font-size: 0.78rem; }
.lx-ed-keys button b { color: #7ee787; }
.lx-ed-help { margin-left: auto; }

/* ------------------------------------------------------------------ Network Lab (Phase C) */
.ns-dev.hub { fill: #64748b; stroke: #334155; stroke-width: 2; }
.ns-hub-t { font: 700 13px system-ui, sans-serif; fill: #fff; text-anchor: middle; letter-spacing: 0.08em; }
.ns-node.pick .ns-dev { stroke: #16a34a; stroke-width: 4; }
.ns-link-hit { stroke: transparent; stroke-width: 18; cursor: pointer; }
.ns-link-hit:hover { stroke: rgba(220, 38, 38, 0.22); }
.ns-empty { font: 500 18px system-ui, sans-serif; fill: #64748b; text-anchor: middle; }
.ns-anim { pointer-events: none; }
.ns-pkt rect { stroke-width: 2.2; }
.ns-pkt path { fill: none; stroke-width: 2; }
.ns-pkt.icmp rect { fill: #dbeafe; stroke: #1d4ed8; }
.ns-pkt.icmp path { stroke: #1d4ed8; }
.ns-pkt.reply rect { fill: #dcfce7; stroke: #15803d; }
.ns-pkt.reply path { stroke: #15803d; }
.ns-pkt.arp rect { fill: #fef3c7; stroke: #b45309; }
.ns-pkt.arp path { stroke: #b45309; }
.ns-pkt.copy { opacity: 0.6; }
.ns-pkt-mark circle { stroke: #fff; stroke-width: 2; }
.ns-pkt-mark.ok circle { fill: #16a34a; }
.ns-pkt-mark.drop circle { fill: #dc2626; }
.ns-pkt-mark text { font: 700 15px system-ui, sans-serif; fill: #fff; text-anchor: middle; }
.ns-simbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-top: 0.6rem; padding: 0.5rem 0.65rem; background: #fff; border: 1px solid #d5dee8; border-radius: 10px; }
.ns-simbar select, .ns-simbar input { border: 1px solid #c9d3de; border-radius: 6px; padding: 0.15rem 0.4rem; font-size: 0.82rem; }
.ns-simbar input { width: 9.5rem; font-family: ui-monospace, Consolas, monospace; }
.ns-send { border: 0; border-radius: 6px; background: var(--lab-accent, #ea580c); color: #fff; font-size: 0.82rem; font-weight: 600; padding: 0.2rem 0.75rem; }
.ns-events { flex-basis: 100%; margin: 0; padding-left: 1.4rem; max-height: 9.5rem; overflow: auto; font-size: 0.8rem; color: #334155; }
.ns-events:empty { display: none; }
.ns-ev { padding: 0.1rem 0; }
.ns-ev.head { list-style: none; margin-left: -1.4rem; font-weight: 700; color: #0f172a; }
.ns-ev.arp::marker { color: #b45309; }
.ns-ev.reply::marker { color: #15803d; }
.ns-ev.fail { color: #b91c1c; font-weight: 600; }
.ns-ev.done { color: #15803d; font-weight: 600; }
.ns-palette { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-bottom: 0.45rem; }
.ns-palette button { border: 1px solid #c9d3de; background: #fff; border-radius: 7px; font-size: 0.8rem; padding: 0.2rem 0.6rem; }
.ns-palette button:hover { border-color: var(--lab-accent, #ea580c); }
.ns-palette button.active { background: #16a34a; border-color: #16a34a; color: #fff; }
.ns-pal-label { font-size: 0.78rem; font-weight: 700; color: #475569; }
.ns-pal-sep { width: 1px; height: 1.3rem; background: #d5dee8; margin: 0 0.25rem; }
.ns-pal-help { color: #64748b; margin-left: 0.25rem; }
.net-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.net-main.no-side { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1100px) { .net-main { grid-template-columns: minmax(0, 1fr); } }
.net-side { position: sticky; top: 1rem; }
.net-checks { list-style: none; margin: 0; padding: 0; font-size: 0.86rem; }
.net-checks li { position: relative; padding: 0.35rem 0.4rem 0.35rem 1.7rem; border-bottom: 1px dashed #e2e8f0; }
.net-checks li::before { content: ''; position: absolute; left: 0.35rem; top: 0.55rem; width: 0.85rem; height: 0.85rem; border-radius: 50%; border: 2px solid #cbd5e1; }
.net-checks li.is-ok::before { content: '\2713'; border-color: #16a34a; background: #16a34a; color: #fff; font-size: 0.6rem; line-height: 0.62rem; text-align: center; font-weight: 700; }
.net-checks li.is-wrong::before { border-color: #dc2626; }
.net-checks li.is-ok { color: #166534; }
.net-done { color: #166534; }
.net-sim .netsim-top { grid-template-columns: minmax(0, 1fr); }
.net-sim .netsim-top > div:first-child { min-width: 0; }
.net-sim .netsim-topo svg { max-height: 460px; }
.net-sim .netsim-tasks ol { columns: 2 260px; column-gap: 1.5rem; }
.ns-port.side { text-anchor: start; }
.ns-port.side-l { text-anchor: end; }
.ns-name, .ns-port { paint-order: stroke; stroke: #eef3f8; stroke-width: 4px; stroke-linejoin: round; }
.net-drill-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .net-drill-wrap { grid-template-columns: 1fr; } }
.nd-levels { display: inline-flex; border: 1px solid #c9d3de; border-radius: 8px; overflow: hidden; }
.nd-levels button { border: 0; background: #fff; padding: 0.3rem 0.8rem; font-size: 0.85rem; }
.nd-levels button + button { border-left: 1px solid #c9d3de; }
.nd-levels button.active { background: var(--lab-accent, #ea580c); color: #fff; }
.nd-question { font-size: 1.15rem; margin-bottom: 0.9rem; }
.nd-grid { display: grid; grid-template-columns: max-content minmax(0, 220px) 1.5rem; gap: 0.5rem 0.75rem; align-items: center; }
.nd-grid label { font-size: 0.9rem; }
.nd-grid input { border: 1px solid #c9d3de; border-radius: 6px; padding: 0.3rem 0.5rem; font-family: ui-monospace, Consolas, monospace; }
.nd-mark { font-weight: 700; }
.nd-mark.ok { color: #16a34a; }
.nd-mark.bad { color: #dc2626; }

/* ---------- Media Lab (Phase D) */
.ml-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.ml-side { position: sticky; top: 1rem; }
.ml-tasks { padding-left: 1.2rem; font-size: 0.88rem; margin-bottom: 0.75rem; }
.ml-tasks li { margin-bottom: 0.3rem; }
.ml-studio { min-width: 0; }
.ml-toolbar { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; padding: 0.4rem; background: #f4f6f9; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 0.6rem; }
.ml-toolbar button, .ml-btnrow button { border: 1px solid #cbd5e1; background: #fff; border-radius: 6px; padding: 0.22rem 0.55rem; font-size: 0.82rem; line-height: 1.3; color: #1f2937; }
.ml-toolbar button:hover, .ml-btnrow button:hover { border-color: var(--lab-accent, #db2777); }
.ml-toolbar button.active, .ml-btnrow button.active { background: var(--lab-accent, #db2777); border-color: var(--lab-accent, #db2777); color: #fff; }
.ml-sep { width: 1px; align-self: stretch; background: #cbd5e1; margin: 0 0.15rem; }
.ml-grow { flex: 1 1 auto; }
.ml-tlabel { font-size: 0.78rem; color: #64748b; }
.ml-chk { display: inline-flex; gap: 0.35rem; align-items: center; font-size: 0.84rem; margin: 0.15rem 0.6rem 0.15rem 0; }
.ml-btnrow { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.4rem; }
.ml-vec { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 0.75rem; align-items: start; }
.ml-canvas-wrap { max-width: calc(72vh * 1.5); border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; background: repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50% / 16px 16px; }
.ml-canvas { display: block; width: 100%; height: auto; touch-action: none; user-select: none; outline: none; }
.ml-canvas.drawing { cursor: crosshair; }
.ml-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--lab-accent, #db2777); }
.ml-grid line { stroke: rgba(100, 116, 139, 0.18); stroke-width: 1; pointer-events: none; }
.ml-selbox { fill: none; stroke: #2563eb; stroke-width: 1.5; stroke-dasharray: 5 4; pointer-events: none; }
.ml-handle { fill: #fff; stroke: #2563eb; stroke-width: 2; cursor: nwse-resize; }
.ml-panel { background: #fafbfc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 0.6rem 0.7rem; font-size: 0.86rem; min-width: 0; }
.ml-h { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: #475569; margin: 0.6rem 0 0.35rem; font-weight: 700; }
.ml-h:first-child { margin-top: 0; }
.ml-h small { text-transform: none; letter-spacing: 0; font-weight: 400; color: #94a3b8; }
.ml-field { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 0.4rem; align-items: center; margin-bottom: 0.35rem; font-size: 0.84rem; }
.ml-field > span { color: #475569; }
.ml-field input[type=number], .ml-field input[type=text], .ml-field select { width: 100%; min-width: 0; border: 1px solid #cbd5e1; border-radius: 5px; padding: 0.15rem 0.35rem; font-size: 0.84rem; background: #fff; }
.ml-field input[type=color] { width: 44px; height: 26px; padding: 0; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; }
.ml-field input[type=range] { width: 100%; accent-color: var(--lab-accent, #db2777); }
.ml-field output { font-size: 0.78rem; color: #64748b; min-width: 2.6rem; text-align: right; }
.ml-field .ml-chk { margin: 0; font-size: 0.78rem; }
.ml-field.wide { grid-template-columns: 92px minmax(0, 1fr); }
.ml-layers { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; }
.ml-layers li { display: flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.35rem; border-bottom: 1px solid #f1f5f9; cursor: pointer; font-size: 0.82rem; }
.ml-layers li:last-child { border-bottom: 0; }
.ml-layers li.sel { background: #fdf2f8; box-shadow: inset 3px 0 0 var(--lab-accent, #db2777); }
.ml-layers li.hid .ml-lname { opacity: 0.45; text-decoration: line-through; }
.ml-layers li button { border: 0; background: transparent; padding: 0 0.2rem; font-size: 0.8rem; color: #64748b; }
.ml-layers li button:hover { color: #0f172a; }
.ml-layers li.ml-empty { color: #94a3b8; cursor: default; font-style: italic; }
.ml-swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid #cbd5e1; flex: none; }
.ml-lname { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ml-score { font-weight: 700; margin: 0.4rem 0; }

/* color studio */
.mlc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 1rem; }
.mlc-swatch { height: 90px; border-radius: 8px; border: 1px solid #cbd5e1; margin-bottom: 0.5rem; }
.mlc-hex { font-family: ui-monospace, Consolas, monospace; text-transform: uppercase; }
.mlc-slider input[data-hsl=h] { accent-color: auto; }
.mlc-rgb { display: flex; gap: 0.4rem; font-size: 0.82rem; margin-bottom: 0.3rem; }
.mlc-rgb input { width: 58px; border: 1px solid #cbd5e1; border-radius: 5px; padding: 0.1rem 0.3rem; }
.mlc-read { color: #475569; font-family: ui-monospace, Consolas, monospace; }
.mlc-harm-btns { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.4rem; }
.mlc-harm-btns button { border: 1px solid #cbd5e1; background: #fff; border-radius: 999px; padding: 0.15rem 0.6rem; font-size: 0.8rem; }
.mlc-harm-btns button.active { background: var(--lab-accent, #db2777); border-color: var(--lab-accent, #db2777); color: #fff; }
.mlc-harm { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.mlc-harm > button[data-load] { width: 40px; height: 40px; border-radius: 8px; border: 1px solid rgba(0, 0, 0, 0.15); }
.mlc-palette { display: flex; flex-wrap: wrap; gap: 0.4rem; min-height: 56px; }
.mlc-pal { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.1rem; }
.mlc-pal > button[data-load] { width: 46px; height: 46px; border-radius: 8px; border: 1px solid rgba(0, 0, 0, 0.15); }
.mlc-pal code { font-size: 0.68rem; color: #475569; }
.mlc-x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; line-height: 16px; border-radius: 50%; border: 1px solid #cbd5e1; background: #fff; font-size: 0.6rem; padding: 0; color: #64748b; }
.mlc-wheel { position: relative; width: 150px; height: 150px; margin: 0.75rem auto 0.25rem; }
.mlc-ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); -webkit-mask: radial-gradient(circle, transparent 52%, #000 53%); mask: radial-gradient(circle, transparent 52%, #000 53%); }
.mlc-dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #334155; }
.mlc-dot.ghost { border-style: dashed; opacity: 0.6; }
.mlc-pair { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 0.5rem; }
.mlc-chip { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid #cbd5e1; background: #fff; border-radius: 999px; padding: 0.15rem 0.6rem 0.15rem 0.2rem; font-size: 0.8rem; font-family: ui-monospace, Consolas, monospace; }
.mlc-chip span { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.2); }
.mlc-poster { border-radius: 10px; padding: 1.1rem 1.2rem; border: 1px solid #e2e8f0; margin-bottom: 0.5rem; }
.mlc-head { font-size: 1.6rem; font-weight: 800; line-height: 1.2; margin-bottom: 0.4rem; }
.mlc-body { margin: 0; line-height: 1.45; }
.mlc-ratio .tag { margin: 0.15rem 0.1rem 0 0; display: inline-block; }
.mlc-big { font-size: 1.8rem; font-weight: 800; line-height: 1.1; margin: 0.4rem 0 0.2rem; }

/* color match game */
.mlm { max-width: 520px; }
.mlm-sw { display: flex; gap: 1rem; text-align: center; margin-bottom: 0.75rem; }
.mlm-sw > div { flex: 1; }
.mlm-box { height: 120px; border-radius: 10px; border: 1px solid #cbd5e1; margin-bottom: 0.2rem; }
.mlm-fb { font-weight: 600; min-height: 1.4em; }

/* image studio */
.mli { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 0.75rem; align-items: start; }
.mli-canvas { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid #cbd5e1; background: repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50% / 16px 16px; touch-action: none; cursor: move; }
.mli-panel { max-height: 78vh; overflow: auto; }
.mli-panel .ml-field { grid-template-columns: 80px minmax(0, 1fr) auto; }
.mli-panel .btn-link { border: 0; background: none; color: var(--lab-accent, #db2777); font-size: 0.8rem; text-decoration: underline; }
.mli-hist { display: block; width: 100%; height: 64px; background: #0f172a; border-radius: 6px; }
.mli-size { color: #475569; margin: 0.2rem 0; }

/* animation studio */
.mla-tabs { display: inline-flex; border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; margin-bottom: 0.6rem; }
.mla-tabs button { border: 0; background: #fff; padding: 0.3rem 0.9rem; font-size: 0.86rem; }
.mla-tabs button + button { border-left: 1px solid #cbd5e1; }
.mla-tabs button.active, .mla-tabs button[aria-selected=true] { background: var(--lab-accent, #db2777); color: #fff; }
.mla-grid { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 0.75rem; align-items: start; }
.mla-stage { position: relative; height: 300px; border-radius: 8px; border: 1px solid #cbd5e1; overflow: hidden; background: linear-gradient(#f8fafc 0 78%, #e2e8f0 78% 100%); }
.mla-obj, .mla-ghost { position: absolute; left: 50%; top: 66%; width: 70px; height: 70px; margin: -35px 0 0 -35px; display: flex; align-items: center; justify-content: center; }
.mla-ghosts { position: absolute; inset: 0; pointer-events: none; }
.mla-ghost { filter: grayscale(0.4); }
.mla-ball { width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f9a8d4, #db2777 60%, #9d174d); }
.mla-card { width: 70px; height: 46px; border-radius: 8px; background: #2563eb; color: #fff; font-weight: 700; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35); }
.mla-square { width: 56px; height: 56px; border-radius: 6px; background: #16a34a; }
.mla-controls { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.5rem; }
.mla-timeline { position: relative; flex: 1 1 auto; height: 28px; border-radius: 6px; background: #eef2f7; border: 1px solid #cbd5e1; cursor: pointer; }
.mla-track { position: absolute; inset: 0 8px; }
.mla-key { position: absolute; top: 50%; width: 13px; height: 13px; margin: -7px 0 0 -7px; transform: rotate(45deg); border: 2px solid #475569; background: #fff; padding: 0; border-radius: 2px; z-index: 2; }
.mla-key.sel { background: var(--lab-accent, #db2777); border-color: var(--lab-accent, #db2777); }
.mla-head { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #dc2626; left: 8px; pointer-events: none; z-index: 1; }
.mla-time { min-width: 4.5rem; color: #475569; font-variant-numeric: tabular-nums; }
.mla-css { background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 0.6rem 0.75rem; font-size: 0.78rem; max-height: 220px; overflow: auto; margin-bottom: 0.4rem; white-space: pre; }
.mlp-tools { margin-bottom: 0.4rem; }
.mlp-pal { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }
.mlp-pal button { width: 22px; height: 22px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.2); padding: 0; }
.mlp-pal button.active { outline: 2px solid #0f172a; outline-offset: 1px; }
.mlp-custom { width: 30px; height: 24px; padding: 0; border: 1px solid #cbd5e1; border-radius: 4px; }
.mlp-canvas { display: block; width: 320px; max-width: 100%; height: auto; image-rendering: pixelated; border: 1px solid #94a3b8; border-radius: 4px; cursor: crosshair; touch-action: none; background: repeating-conic-gradient(#e2e8f0 0% 25%, #fff 0% 50%) 0 0 / 40px 40px; }
.mlp-strip { display: flex; gap: 0.35rem; overflow-x: auto; padding: 0.4rem 0; }
.mlp-thumb { flex: none; display: flex; flex-direction: column; align-items: center; border: 2px solid #e2e8f0; border-radius: 6px; background: #fff; padding: 2px; }
.mlp-thumb canvas { width: 48px; height: 48px; image-rendering: pixelated; }
.mlp-thumb small { font-size: 0.68rem; color: #64748b; }
.mlp-thumb.sel { border-color: var(--lab-accent, #db2777); }
.mlp-preview { display: block; width: 128px; height: 128px; image-rendering: pixelated; border: 1px solid #cbd5e1; border-radius: 6px; margin: 0 auto 0.5rem; background: #fff; }

/* UI/UX studio */
.mlu { display: grid; grid-template-columns: 210px minmax(260px, 1fr) 250px; gap: 0.75rem; align-items: start; }
.mlu-left, .mlu-right { background: #fafbfc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 0.6rem 0.7rem; font-size: 0.86rem; min-width: 0; }
.mlu-center { display: flex; justify-content: center; }
.mlu-phone { width: 300px; max-width: 100%; border: 10px solid #1f2937; border-radius: 30px; background: #1f2937; box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25); }
.mlu-notch { width: 90px; height: 14px; margin: 0 auto 6px; background: #111827; border-radius: 0 0 10px 10px; }
.mlu-screen { min-height: 500px; border-radius: 18px; padding: 1rem 0.9rem; overflow: hidden; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.mlu-el { position: relative; margin-bottom: 0.6rem; border-radius: 6px; cursor: pointer; outline: 1px dashed transparent; outline-offset: 3px; }
.mlu-el:hover { outline-color: #94a3b8; }
.mlu-el.sel { outline: 2px solid #2563eb; }
.mlu-label { margin-bottom: 0.2rem; }
.mlu-input { display: flex; align-items: center; padding: 0 0.7rem; border: 1px solid #9ca3af; border-radius: 8px; background: #fff; color: #9ca3af; }
.mlu-check { display: flex; gap: 0.5rem; align-items: center; }
.mlu-box { width: 20px; height: 20px; border: 2px solid #6b7280; border-radius: 4px; flex: none; background: #fff; }
.mlu-btn { display: flex; align-items: center; justify-content: center; border-radius: 10px; padding: 0 1rem; }
.mlu-link { text-decoration: underline; }
.mlu-img { display: flex; align-items: center; justify-content: center; border-radius: 10px; background: linear-gradient(135deg, #e0e7ff, #fce7f3); color: #475569; font-size: 0.78rem; text-align: center; padding: 0.3rem; }
.mlu-empty { color: #94a3b8; text-align: center; margin-top: 40%; }
.mlu-add button { flex: 1 1 45%; }
.mlu-audit { list-style: none; margin: 0; padding: 0; font-size: 0.82rem; }
.mlu-audit li { position: relative; padding: 0.35rem 0.3rem 0.35rem 1.6rem; border-bottom: 1px dashed #e2e8f0; }
.mlu-audit li::before { position: absolute; left: 0.3rem; top: 0.35rem; font-weight: 700; }
.mlu-audit li.is-ok::before { content: '\2713'; color: #16a34a; }
.mlu-audit li.is-wrong::before { content: '\2715'; color: #dc2626; }
.mlu-find { border: 1px solid #fecaca; background: #fff5f5; color: #b91c1c; border-radius: 999px; padding: 0 0.45rem; font-size: 0.72rem; margin: 0.15rem 0.15rem 0 0; }

@media (max-width: 1199.98px) {
  .ml-main { grid-template-columns: minmax(0, 1fr); }
  .ml-side { position: static; }
  .mlu { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .mlu-center { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 767.98px) {
  .ml-vec, .mlc, .mli, .mla-grid, .mlu { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Web activities (Phase E) */
.wa-main { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 1rem; align-items: start; }
.wa-side { position: sticky; top: 1rem; }
.wa-tabs { display: flex; gap: 0.3rem; align-items: center; margin-bottom: 0.5rem; }
.wa-tabs [data-wa-tab] { border: 1px solid #cbd5e1; background: #fff; border-radius: 6px; padding: 0.22rem 0.8rem; font-size: 0.85rem; }
.wa-tabs [data-wa-tab].active { background: var(--lab-accent, #16a34a); border-color: var(--lab-accent, #16a34a); color: #fff; }
.wa-grow { flex: 1 1 auto; }
.wa-editors .CodeMirror { height: 300px; font-family: var(--mono); font-size: 14px; border-radius: 8px; }
.wa-editors textarea { width: 100%; height: 300px; font-family: var(--mono); font-size: 14px; }
.wa-preview-head { margin: 0.75rem 0 0.3rem; }
.wa-preview { display: block; width: 100%; height: 360px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; }
@media (max-width: 991.98px) {
  .wa-main { grid-template-columns: minmax(0, 1fr); }
  .wa-side { position: static; }
}

/* ---------- Instructor reviews and the activity builder (Phase F) ---------- */
.lab-review { margin-top: 0.4rem; padding: 0.45rem 0.6rem; border-left: 3px solid var(--lab-accent, var(--accent, #2563eb)); background: rgba(37, 99, 235, 0.06); border-radius: 0 6px 6px 0; }
.lab-review-text { margin-top: 0.2rem; white-space: normal; }
.lb-pane { border-top: 1px dashed #d6dae0; padding-top: 1rem; }

/* ---------- Code Converter (source code / flowchart / pseudocode) ---------- */
.cv-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; padding: 0.7rem 1rem; margin-bottom: 0.9rem; }
.cv-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.cv-mode { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 0.3rem 0.9rem; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.cv-mode:hover { border-color: var(--accent); }
.cv-mode.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cv-field { display: flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; font-weight: 600; margin: 0; }
.cv-field select { width: auto; min-width: 9rem; }
.cv-msgs { margin-bottom: 0.9rem; }
.cv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr); gap: 0.9rem; align-items: stretch; }
@media (max-width: 1199.98px) { .cv-grid { grid-template-columns: minmax(0, 1fr); } }
.cv-panel { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; min-height: 560px; color: #1d2433; }
.cv-panel.is-input { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 122, 98, 0.15); }
.cv-head { display: flex; align-items: center; justify-content: center; position: relative; padding: 0.55rem 0.8rem; border-bottom: 1px solid rgba(0, 0, 0, 0.12); }
.cv-head h2 { margin: 0; font-size: 1.15rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: #111827; }
.cv-head-code { background: #fde9b0; }
.cv-head-flow { background: #d6f2d2; }
.cv-head-pseudo { background: #bfdcfb; }
.cv-role { position: absolute; right: 0.7rem; font-family: var(--mono); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; padding: 0.1rem 0.45rem; border-radius: 999px; background: rgba(255, 255, 255, 0.75); color: #4a5568; }
.cv-panel.is-input .cv-role { background: var(--accent); color: #fff; }
.cv-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.35rem; padding: 0.4rem 0.6rem; border-bottom: 1px solid #edf0f2; background: #fafbfc; }
.cv-actions .cv-file { margin-right: auto; font-family: var(--mono); font-size: 0.75rem; color: #6b7280; }
.cv-zoom { display: inline-flex; gap: 0.15rem; margin-right: auto; }
.cv-zoom .btn-sm { min-width: 2rem; }
.cv-panel .CodeMirror { flex: 1 1 auto; height: auto; min-height: 480px; font-family: var(--mono); font-size: 0.86rem; }
.cv-panel:not(.is-input) .CodeMirror { background: #fbfcfd; }
.cv-panel:not(.is-input) .CodeMirror-cursor { display: none !important; }
.cv-flow { flex: 1 1 auto; overflow: auto; max-height: 78vh; min-height: 480px; padding: 0.5rem; background: #fff; text-align: center; }
.cv-flow svg { display: inline-block; max-width: none; user-select: none; -webkit-user-select: none; }
.cv-flow { cursor: grab; }
.cv-flow.is-panning, .cv-flow.is-panning * { cursor: grabbing !important; }
.cv-flow [data-node] { touch-action: none; }
.cv-flow.is-dragging, .cv-flow.is-dragging * { cursor: grabbing !important; }
.cv-flow.is-dragging [data-slot] circle { stroke-width: 2.6; }
.cv-flow [data-slot].is-target circle { fill: #1f7a3f; r: 12; }
.cv-flow [data-slot].is-target path { stroke: #fff; }
.cv-ghost { position: fixed; z-index: 2000; pointer-events: none; max-width: 240px; padding: 0.35rem 0.6rem; font-size: 0.78rem; background: #fff; border: 1px solid var(--accent); border-radius: 8px; box-shadow: var(--shadow); color: #1d2433; opacity: 0.95; }
.cv-flow-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0.7rem; font-size: 0.8rem; background: #effaf2; border-bottom: 1px solid #cfe9d6; color: #1f5135; }
.cv-flow [data-slot]:hover circle { fill: #1f7a3f; }
.cv-flow [data-slot]:hover path { stroke: #fff; }
.cv-flow [data-node]:hover polygon, .cv-flow [data-node]:hover rect { filter: brightness(0.94); stroke-width: 2.4; }
.cv-guide summary { cursor: pointer; }
.cv-guide pre { background: #f6f8fa; border-radius: 10px; padding: 0.7rem 0.9rem; font-size: 0.8rem; }

/* Word Problems */
.wp-courses { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.wp-course { display: inline-flex; flex-direction: column; padding: 0.45rem 0.9rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: inherit; text-decoration: none; line-height: 1.2; }
.wp-course span { font-size: 0.72rem; color: #6b7280; }
.wp-course.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 122, 98, 0.15); }
.wp-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 991.98px) { .wp-layout { grid-template-columns: minmax(0, 1fr); } }
.wp-list { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
.wp-items { list-style: none; margin: 0; padding: 0; }
.wp-items a { display: flex; gap: 0.55rem; align-items: flex-start; padding: 0.45rem 0.5rem; border-radius: 10px; color: inherit; text-decoration: none; }
.wp-items a:hover { background: rgba(15, 122, 98, 0.06); }
.wp-items a.active { background: rgba(15, 122, 98, 0.12); }
.wp-items strong { display: block; font-size: 0.85rem; font-weight: 600; }
.wp-items small { display: block; font-size: 0.72rem; color: #6b7280; }
.wp-num { flex: 0 0 1.6rem; height: 1.6rem; border-radius: 50%; background: #eef2f4; display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; }
.wp-items a.active .wp-num { background: var(--accent); color: #fff; }
.wp-text { font-size: 1.05rem; line-height: 1.6; }
.wp-answer .cv-panel { min-height: 420px; }
.wp-answer.is-editor { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
@media (max-width: 1199.98px) { .wp-answer.is-editor { grid-template-columns: minmax(0, 1fr); } }
.wp-code { flex: 1 1 auto; display: flex; flex-direction: column; }
.wp-code .CodeMirror { flex: 1 1 auto; height: auto; min-height: 380px; font-family: var(--mono); font-size: 0.86rem; background: #fbfcfd; }
.wp-code .CodeMirror-cursor { display: none !important; }
.wp-answer .cv-flow { min-height: 380px; cursor: default; }
.wp-pseudo { flex: 1 1 auto; margin: 0; padding: 0.8rem 1rem; background: #fbfcfd; font-family: var(--mono); font-size: 0.86rem; line-height: 1.55; white-space: pre-wrap; color: #1d2433; }

/* Role Restrictions (admin settings) */
.rp-table .rp-select { width: auto; min-width: 9.5rem; }
.rp-table .rp-select.is-off { border-color: #e7a19b; background-color: #fdeceb; color: #b42318; }

