/* Editor: distribución de la página y piezas propias. Los colores, botones, menús, modales y campos están en
   base.css, que se carga antes. */
html, body { height: 100%; }
body {
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) 5px var(--bottom-h);
  overflow: hidden;
}

/* Barra superior */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; }
.brand-name { letter-spacing: 0.2px; }
.project-name { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 300px; }
.project-name input {
  min-width: 64px;
  flex: 1 1 140px;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 5px 8px;
  font-weight: 600;
}
.project-name input:hover { border-color: var(--line); }
.project-name input:focus { outline: none; border-color: var(--accent); background: var(--panel-2); }
.save-status { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.save-status.dirty { color: var(--warn); }
.save-status.ro { color: var(--muted); }
body.has-strip .project-name .save-status { display: none; }
.project-name input[readonly] { cursor: default; }
.project-name input[readonly]:hover { border-color: transparent; }
/* Proyecto propio privado: candado junto al nombre (abre «Compartir») y en el menú Archivo */
.vis-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 24px;
  padding: 0 9px 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.vis-badge:hover { border-color: var(--accent); color: var(--text); }
.vis-badge svg, .menu-hint svg, .vis-tag svg { width: 13px; height: 13px; flex: none; }
.menu-hint { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.menus { display: flex; gap: 2px; }
.sim-controls { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sim-status { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.sim-status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--run); margin-right: 6px; box-shadow: 0 0 8px var(--run); }
.sim-status .dot.paused { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.sim-status .dot.busy { background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse 0.9s infinite alternate; }
@keyframes pulse { from { opacity: 0.35; } to { opacity: 1; } }

/* Cuenta (Entrar o el menú con las iniciales) */
.account { display: flex; align-items: center; flex: none; }
.account-btn { padding: 0 4px; }

/* Franja de la tarea (trabajo, plantilla, revisión) o del proyecto ajeno, bajo la barra superior */
body.has-strip { grid-template-rows: var(--topbar-h) auto minmax(0, 1fr) 5px var(--bottom-h); }
.task-strip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 12px;
  background: #102028;
  border-bottom: 1px solid #1c4652;
  min-width: 0;
  font-size: 13px;
}
.task-strip.foreign { background: #1d1a10; border-bottom-color: #5a4a1c; }
.task-strip.review { background: #191628; border-bottom-color: #3d3466; }
.task-strip.error { background: #2a1517; border-bottom-color: #6e2b2b; }
.strip-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; min-width: 0; min-height: 30px; }
.strip-icon { display: grid; place-items: center; color: var(--accent); flex: none; }
.task-strip.foreign .strip-icon { color: var(--warn); }
.task-strip.review .strip-icon { color: #a99cf0; }
.strip-icon svg { width: 18px; height: 18px; }
.strip-title { font-weight: 700; min-width: 0; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-meta { color: var(--muted); white-space: nowrap; }
.strip-meta.overdue { color: var(--warn); }
.strip-warn { color: var(--warn); }
.strip-text { color: var(--muted); flex: 1 1 220px; min-width: 0; }
.strip-text.strip-warn { color: var(--warn); }
.strip-save { color: var(--faint); font-size: 12px; white-space: nowrap; }
.strip-save.dirty { color: var(--warn); }
.strip-save.ok { color: var(--muted); }
.strip-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.strip-nav { display: flex; align-items: center; gap: 6px; min-width: 0; }
.strip-nav .btn.icon { width: 26px; }
.strip-nav .btn svg { width: 16px; height: 16px; }
.strip-row.feedback { padding-left: 30px; gap: 10px; }
.strip-grade { color: var(--ok); white-space: nowrap; }
.task-strip .feedback .strip-comment { flex: 1 1 200px; min-width: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Panel de calificación (revisión): columna a la derecha; en celular, pestaña «Calificar» */
body.grading .workspace { grid-template-columns: var(--code-w) 5px minmax(0, 1fr) 330px; }
.grade-pane { border-left: 1px solid var(--line); overflow-y: auto; display: none; }
body.grading .grade-pane { display: block; }
.grade-inner { padding: 12px 14px 18px; }
.grade-inner header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.grade-inner h2 { margin: 0; font-size: 16px; }
.gp-who { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.gp-grade { display: flex; align-items: center; gap: 8px; }
.gp-grade .input { width: 110px; }
.gp-grade span { color: var(--muted); }
.gp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.grade-inner .notice { margin: 8px 0 12px; }
.grade-inner fieldset:disabled { opacity: 0.55; }
.grade-inner fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

/* Aula archivada: aviso bajo la franja */
.strip-row.archived .strip-icon { color: var(--warn); }
.strip-row.archived .strip-text { color: var(--text); }
/* Panel de una entrega de un aula archivada: la calificación y el comentario, sin formulario */
.gp-h { margin: 14px 0 4px; font-size: 13px; color: var(--muted); }
.gp-value { margin: 0; }

/* Instrucciones de la tarea (modal) */
.modal-note { margin: 0 0 10px; color: var(--muted); }
.modal-note.warn { color: var(--warn); }
.ins-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); margin-bottom: 14px; }
.ins-h { margin: 14px 0 6px; font-size: 15px; }
.ins-feedback { padding: 10px 12px; border: 1px solid #2a6b37; border-radius: 9px; background: rgba(46, 160, 67, 0.08); }
.ins-feedback.returned { border-color: #7a4520; background: rgba(240, 136, 62, 0.08); }
.ins-feedback h3 { margin: 0 0 6px; font-size: 15px; }
.ins-feedback p { margin: 0; }
.ins-how { margin-top: 16px; }

/* Solo lectura */
.editor.ro .cm-cursor { display: none !important; }
.stage-toolbar .btn:disabled { opacity: 0.45; }

/* Botón de simular */
.btn.run { background: var(--run-2); border-color: #2ea043; color: #fff; font-weight: 600; padding: 0 14px 0 10px; }
.btn.run:hover:not(:disabled) { background: var(--run); }
.btn.run.stop { background: #b62324; border-color: var(--stop); }
.btn.run.stop:hover { background: var(--stop); }

/* Áreas de trabajo */
.workspace {
  display: grid;
  grid-template-columns: var(--code-w) 5px minmax(0, 1fr);
  min-height: 0;
}
.pane { min-width: 0; min-height: 0; background: var(--panel); }
.code-pane { display: flex; flex-direction: column; }
.splitter { background: var(--line); cursor: col-resize; position: relative; z-index: 5; }
.splitter.h { cursor: row-resize; }
.splitter:hover, .splitter.dragging { background: var(--accent-2); }
.file-tabs {
  display: flex;
  align-items: stretch;
  gap: 1px;
  height: 34px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.file-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 12px;
  border: 0;
  background: var(--panel);
  color: var(--muted);
  font: 13px var(--mono);
  cursor: pointer;
  border-top: 2px solid transparent;
}
.file-tab.active { color: var(--text); background: #1e2329; border-top-color: var(--accent); }
.file-tab .x { opacity: 0.5; padding: 0 2px; border-radius: 3px; }
.file-tab .x:hover { opacity: 1; background: var(--panel-3); }
.file-tab.add { color: var(--faint); font-size: 18px; padding: 0 12px; }
.editor { flex: 1; min-height: 0; overflow: hidden; background: #1e2329; }
.editor .cm-editor { height: 100%; font-size: 13.5px; }
.editor .cm-scroller { font-family: var(--mono); line-height: 1.55; }
.editor .cm-editor.cm-focused { outline: none; }
.compile-info {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 4px 12px;
  min-height: 26px;
  font: 12px var(--mono);
  color: var(--faint);
  border-top: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
}
.compile-info .ok { color: #56d364; }
.compile-info .err { color: var(--danger); }
.compile-quota { padding: 3px 12px 4px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.compile-quota.low, .compile-quota.limit { color: var(--warn); }
.meter { display: inline-flex; align-items: center; gap: 6px; }
.meter i { display: inline-block; width: 60px; height: 5px; background: var(--panel-3); border-radius: 3px; overflow: hidden; }
.meter i b { display: block; height: 100%; background: var(--accent); }

/* Escena 3D */
.stage-pane { position: relative; overflow: hidden; }
.stage { position: absolute; inset: 0; }
.stage-canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.stage-toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.stage-toolbar > * { pointer-events: auto; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }
.stage-toolbar .select { background: rgba(27, 34, 43, 0.92); }
.seg { display: flex; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; background: rgba(27, 34, 43, 0.92); }
.seg button { height: 30px; min-width: 38px; padding: 0 10px; border: 0; background: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button:hover { background: var(--panel-3); }
.seg svg { width: 16px; height: 16px; }
.wire-color {
  display: flex;
  gap: 4px;
  padding: 5px 7px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: rgba(27, 34, 43, 0.92);
}
.wire-color button {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  padding: 0;
}
.wire-color button.active { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(14, 18, 23, 0.85);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(6px);
}
.hint:empty { display: none; }
.hint b { color: var(--text); font-weight: 600; }
.pin-tip {
  position: absolute;
  z-index: 6;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(10, 13, 17, 0.92);
  border: 1px solid var(--line-2);
  font-size: 12.5px;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(14px, -50%);
  display: none;
}
.pin-tip small { color: var(--muted); margin-left: 6px; font-family: var(--mono); }
.pin-tip .v { color: var(--accent); font-family: var(--mono); margin-left: 6px; }
.warnings {
  position: absolute;
  left: 10px;
  bottom: 54px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(420px, calc(100% - 20px));
  pointer-events: none;
}
.warning {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(58, 29, 31, 0.92);
  border: 1px solid #8e3a36;
  color: #ffd2cd;
  font-size: 13px;
  backdrop-filter: blur(6px);
}
.warning.soft { background: rgba(58, 48, 20, 0.92); border-color: #8a6d1f; color: #ffe8a8; }
.warning b { color: #fff; }

/* Inspector */
.inspector {
  position: absolute;
  top: 54px;
  right: 10px;
  width: 290px;
  max-height: calc(100% - 120px);
  overflow-y: auto;
  padding: 14px;
  border-radius: 12px;
  background: rgba(21, 26, 33, 0.96);
  border: 1px solid var(--line-2);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}
.inspector h3 { margin: 0 0 2px; font-size: 15px; }
.inspector .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.inspector .field { margin: 12px 0; }
.inspector label.lbl { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.inspector label.lbl b { color: var(--text); font-weight: 600; font-family: var(--mono); }
.inspector input[type=text], .inspector input[type=number], .inspector select {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
}
.inspector input[type=range] { width: 100%; accent-color: var(--accent); }
.inspector .row { display: flex; gap: 8px; flex-wrap: wrap; }
.inspector .row .btn { flex: 1; justify-content: center; }
.inspector .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.inspector .chip {
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  cursor: pointer;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.inspector .chip.active { border-color: var(--accent); background: var(--accent-soft); }
.inspector .chip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.inspector .note { font-size: 12.5px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); padding: 8px 10px; border-radius: 8px; }
.inspector .note.status { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.inspector .live { border-left: 3px solid var(--accent); padding-left: 10px; }
.inspector .pins { font: 12px var(--mono); color: var(--muted); columns: 2; column-gap: 12px; margin-top: 6px; }
.inspector details summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.inspector .term { height: 140px; margin: 0 0 6px; padding: 6px 8px; overflow: auto; background: #10151b; border: 1px solid var(--line); border-radius: 7px; font: 12px/1.45 var(--mono); white-space: pre-wrap; word-break: break-word; }
.inspector .term:empty::before { content: 'Aquí aparece lo que el Arduino manda por Bluetooth.'; color: var(--faint); }
.inspector .term-in { display: flex; gap: 6px; }
.inspector .term-in input { flex: 1; min-width: 0; height: 28px; font-family: var(--mono); font-size: 12.5px; }
.inspector .term-in select { width: auto; height: 28px; font-size: 12px; padding: 0 4px; }
.inspector .keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.inspector .keys button { height: 34px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; font-weight: 600; }
.inspector .keys button:active, .inspector .keys button.down { background: var(--accent-2); }

/* Panel inferior */
.bottom-pane { display: flex; flex-direction: column; border-top: 0; }
.bottom-tabs { display: flex; align-items: center; gap: 2px; height: 34px; padding: 0 8px; border-bottom: 1px solid var(--line); background: var(--panel); }
.tab {
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tab-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tab-body[hidden] { display: none; }
.serial-out, .compile-out {
  flex: 1;
  margin: 0;
  padding: 8px 12px;
  overflow: auto;
  font: 12.5px/1.5 var(--mono);
  color: #d5dde6;
  white-space: pre-wrap;
  word-break: break-word;
  background: #10151b;
}
.serial-out .sent { color: var(--accent); }
.serial-out:empty::before { content: 'Aquí aparece lo que la placa envía con Serial.print(). Presiona «Simular» para empezar.'; color: var(--faint); }
.serial-out.running:empty::before { content: 'Simulando: aquí aparece lo que la placa envía con Serial.print().'; }
.serial-out.running.nolink:empty::before { content: 'Sin conexión con la computadora (cable USB desconectado o placa sin energía): aquí no llega lo que envía la placa.'; }
.serial-in { display: flex; gap: 6px; padding: 6px 8px; border-top: 1px solid var(--line); }
.serial-in input { flex: 1; min-width: 0; height: 28px; padding: 0 9px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel-2); font-family: var(--mono); font-size: 13px; }
.serial-in input:focus { outline: none; border-color: var(--accent); }
.plotter { flex: 1; min-height: 0; width: 100%; background: #10151b; }
.plot-legend { padding: 5px 12px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); display: flex; gap: 14px; flex-wrap: wrap; }
.plot-legend span i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.diagnostics { display: flex; flex-direction: column; }
.diag {
  display: flex;
  gap: 10px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  font: 12.5px var(--mono);
  cursor: pointer;
  text-align: left;
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
}
.diag:hover { background: var(--panel-2); }
.diag .sev { font-weight: 700; }
.diag.error .sev { color: var(--danger); }
.diag.warning .sev { color: var(--warn); }
.diag .loc { color: var(--accent); white-space: nowrap; }

/* Catálogo y ejemplos (modales) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: border-color 0.12s, transform 0.12s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card .thumb { height: 110px; background: radial-gradient(circle at 50% 35%, #26313d, #161c23); display: grid; place-items: center; }
.card .thumb img { max-width: 100%; max-height: 100%; }
.card .body { padding: 8px 10px 10px; }
.card .name { font-weight: 600; font-size: 13.5px; }
.card .desc { color: var(--muted); font-size: 12px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.help-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center; }

/* Mis proyectos: el privado lleva candado */
.vis-tag { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; font-size: 12px; font-weight: 600; color: var(--muted); vertical-align: 1px; }

/* Compartir: quién puede abrir el proyecto y su enlace */
.vis-options { border: 0; margin: 0 0 10px; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.vis-options legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.vis-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel-2); cursor: pointer; }
.vis-option:hover { border-color: #45526a; }
.vis-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.vis-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.vis-option.off { cursor: default; border-style: dashed; }
.vis-option.off:hover { border-color: var(--line-2); }
.vis-option input { margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.vis-option input:focus-visible { outline: none; }
.vis-option b { display: block; font-weight: 600; }
.vis-option small { display: block; color: var(--muted); font-size: 12.5px; }
.vis-option .vis-why { color: var(--warn); }
.share-field { margin: 14px 0 0; }
.share-link { display: flex; gap: 8px; }
.share-link .input { flex: 1; min-width: 0; font-size: 13px; }
.share-field .notice { margin: 4px 0 0; }

/* Librerías: lo que deja hacer el plan */
.lib-usage { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.lib-usage .meter > b { color: var(--text); font-weight: 400; }
#lib-plan .notice { margin: 0 0 12px; }
.lib-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; border: 0; margin: -4px 0 12px; padding: 0; min-width: 0; font-size: 13px; }
.lib-scope legend { float: left; margin-right: 4px; padding: 0; color: var(--muted); }
.lib-scope label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.lib-scope input { margin: 0; accent-color: var(--accent); }
.lib-scope label:has(input:disabled) { cursor: default; color: var(--muted); }
#lib-msg { margin: 0 0 12px; }
.lib-empty { margin: 0 0 4px; }

.toast { bottom: calc(var(--bottom-h) + 24px); }

.mobile-tabs { display: none; }
.only-narrow { display: none !important; }

/* Laptops chicas y ventanas a media pantalla: el encabezado no alcanza para todo. */
@media (max-width: 1100px) {
  .brand-name { display: none; }
  .topbar { gap: 10px; }
  /* «Privado» queda en el candado (con su etiqueta para lectores de pantalla) y el nombre conserva su espacio. */
  .vis-badge span { display: none; }
  .vis-badge { padding: 0 6px; }
}

@media (max-width: 820px) {
  :root { --topbar-h: 50px; }
  body { grid-template-rows: var(--topbar-h) 40px minmax(0, 1fr); }
  body.has-strip { grid-template-rows: var(--topbar-h) auto 40px minmax(0, 1fr); }
  body.has-strip .workspace, body.has-strip .bottom-pane.active { grid-row: 4; }
  body.grading .workspace { grid-template-columns: 1fr; }
  .grade-pane, body.grading .grade-pane { display: none; }
  .grade-pane { border-left: 0; }
  .task-strip { padding: 6px 10px; }
  .strip-row { gap: 4px 8px; }
  .strip-title { max-width: 60vw; }
  .hide-narrow, .strip-row.feedback .strip-comment { display: none; }
  .strip-row.feedback { padding-left: 0; }
  .account-btn { padding: 0 2px; }
  .brand-name, .menus .btn[data-action=libraries], .sim-status, #sim-speed, .project-name, #btn-reload span { display: none; }
  .menus { margin-left: auto; }
  .sim-controls { margin-left: 0; gap: 6px; }
  .topbar { gap: 8px; padding: 0 8px; }
  .mobile-tabs { display: flex; background: var(--panel); border-bottom: 1px solid var(--line); }
  .mobile-tabs button { flex: 1; border: 0; background: none; color: var(--muted); border-bottom: 2px solid transparent; }
  .mobile-tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
  .workspace { grid-template-columns: 1fr; grid-row: 3; }
  .splitter { display: none; }
  .workspace > .pane, .bottom-pane { display: none; }
  .workspace > .pane.active { display: flex; }
  .stage-pane.active { display: block; }
  .bottom-pane.active { display: flex; grid-row: 3; }
  .inspector { top: auto; bottom: 10px; right: 10px; left: 10px; width: auto; max-height: 45%; }
  .btn.run span { display: none; }
  .btn.run { padding: 0 10px; }
  .workspace > .pane.grade-pane.active { display: block; }
}

/* Teléfonos: la barra no alcanza para todo. La ayuda pasa al menú Archivo, Entrar queda como ícono y
   «Reiniciar» se omite (detener y simular de nuevo hace lo mismo). */
@media (max-width: 480px) {
  .only-narrow { display: flex !important; }
  hr.only-narrow { display: block !important; }
  .menus .btn[data-action=help], #btn-restart, .login-btn span { display: none; }
  .login-btn { width: 32px; padding: 0; justify-content: center; }
  .menus .btn { padding: 0 9px; }
  .topbar { gap: 6px; }
}
