.editor-mat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 540px;
  margin: 0 auto;
  padding: 1rem;
  font-family: system-ui, sans-serif;
  outline: none;
}

.editor-mat:focus-within .editor-caderno-wrap {
  border-color: #60a5fa;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.13);
}

.editor-enunciado {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #E6F1FB;
  border-radius: 12px;
  padding: 12px 18px 14px;
  border: 0.5px solid #B5D4F4;
}

.editor-enunciado-label {
  font-size: 10px;
  color: #185FA5;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.editor-enunciado-svg {
  display: block;
  overflow: visible;
}

/* ── separador de fase no caderno (entre ramos) ── */
.linha-separador-bg {
  fill: #b5d4f4;
}

.linha-separador-txt {
  font-size: 12px;
  fill: #0d3f75;
  font-family: system-ui, sans-serif;
  font-weight: 600;
}

/* ── instrução de fase (lim:ramos): indica o ramo a calcular a seguir ── */
.editor-instrucao-fase {
  font-size: 13px;
  font-weight: 500;
  font-family: system-ui, sans-serif;
  color: #185FA5;
  background: #deeefa;
  border: 0.5px solid #99c8f0;
  border-radius: 8px;
  padding: 8px 14px;
  text-align: center;
}

/* ── enunciado de sistema (duas equações com { à esquerda) ── */
.sis-enunciado-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sis-enunciado-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sis-caderno-hint {
  font-size: 0.72rem;
  color: #6b7280;
  padding: 2px 8px 2px 28px;
  letter-spacing: 0.01em;
}

.editor-caderno-wrap {
  border: 1.5px solid #bfdbfe;
  border-radius: 14px;
  background: #f0f6ff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.07);
  overflow: hidden;
  display: flex;
  align-items: flex-start;
}

.caderno-botoes-copiar {
  position: relative;
  flex-shrink: 0;
  width: 32px;
  background: #f0f6ff;
}

.btn-copiar-passo {
  position: absolute;
  left: 3px;
  width: 26px;
  height: 24px;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  background: #fff;
  color: #185FA5;
  opacity: 0.55;
  transition: opacity 0.15s, background 0.15s;
}

.btn-copiar-passo:hover {
  opacity: 1;
  background: #dbeafe;
}

.editor-caderno {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.linha-activa {
  fill: #e0eeff;
}

.linha-correcta {
  fill: #EBF4DF;
}

.linha-incorrecta {
  fill: #FCECEA;
}

.linha-neutra {
  fill: #f0f6ff;
}

.linha-sep {
  stroke: #DEDAD4;
  stroke-width: 0.5;
}

.linha-num {
  font-size: 10px;
  fill: #C8C6BE;
  font-family: system-ui, sans-serif;
  font-weight: 400;
}

.linha-texto-raw {
  font-size: 20px;
  font-weight: 500;
  fill: #A8A6A0;
  font-family: system-ui, sans-serif;
}

.icone-ok {
  font-size: 14px;
  fill: #3B6D11;
  font-family: system-ui, sans-serif;
  font-weight: 500;
}

.icone-erro {
  font-size: 14px;
  fill: #993C1D;
  font-family: system-ui, sans-serif;
  font-weight: 500;
}

.cursor-svg {
  stroke: #185FA5;
  stroke-width: 3px;
  stroke-linecap: round;
  animation: pisca 1.05s step-end infinite;
}

@keyframes pisca {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

.slot-activo {
  fill: none;
  stroke: #185FA5;
  stroke-width: 1.5px;
  stroke-dasharray: 3, 2;
  opacity: 0.75;
}

.editor-btn-verificar {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: #2563eb;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s, transform 0.07s;
  font-family: system-ui, sans-serif;
  letter-spacing: 0.03em;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.30);
}

.editor-btn-verificar:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.38);
}

.editor-btn-verificar:active {
  background: #1e40af;
  transform: scale(0.98);
}

.editor-btn-verificar:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@keyframes feedback-entrar {
  from { opacity: 0; transform: translateY(-5px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

@keyframes feedback-shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}

.editor-feedback {
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 9px;
  font-family: system-ui, sans-serif;
  animation: feedback-entrar 0.18s ease-out;
}

.editor-feedback-ok {
  background: #EBF4DF;
  color: #27500A;
  border: 0.5px solid #B8D890;
}

.editor-feedback-erro {
  background: #FCECEA;
  color: #7A1A1A;
  border: 0.5px solid #E8B8B0;
  animation: feedback-shake 0.35s ease-out;
}

.editor-concluido {
  border: 1.5px solid #a7f3d0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(6, 95, 70, 0.10);
}

.editor-concluido-cabecalho {
  background: #6ee7b7;
  color: #064e3b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 18px;
  font-family: system-ui, sans-serif;
}

.concluido-texto {
  font-family: system-ui, sans-serif;
}

.concluido-txt-enun {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 18px;
  background: #f1f5f9;
}

.concluido-txt-res {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: #EBF4DF;
  border-top: 1px solid #a7f3d0;
}

.concluido-txt-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  min-width: 48px;
  padding-top: 2px;
  flex-shrink: 0;
}

.concluido-txt-lines {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 15px;
  color: #1e293b;
}

.concluido-txt-lines span:first-child {
  font-weight: 600;
}

.concluido-txt-valor {
  font-size: 16px;
  font-weight: 700;
  color: #27500A;
}

.editor-concluido-svg {
  display: block;
  width: 100%;
  overflow: visible;
}

@media (max-width: 480px) {
  .editor-mat {
    padding: 0.75rem;
    gap: 8px;
  }

  .editor-enunciado-expr {
    font-size: 17px;
  }
}

.slot-placeholder {
  fill: none;
  stroke: #9BA8B0;
  stroke-width: 1px;
  stroke-dasharray: 3, 2;
  rx: 3px;
}

.slot-placeholder-activo {
  fill: rgba(24, 95, 165, 0.08);
  stroke: #185FA5;
  stroke-width: 1.5px;
  stroke-dasharray: 3, 2;
  rx: 3px;
}

.slot-base {
  fill: none;
  stroke: #B0B8C4;
  stroke-width: 1px;
  rx: 3px;
}

/* ---------------------------------------------------------- */
/* EditorExpr — editor de composição do enunciado             */
/* ---------------------------------------------------------- */

.editor-expr {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-expr-caderno-wrap {
  border: 1.5px solid #bfdbfe;
  border-radius: 12px;
  overflow: hidden;
  background: #f0f6ff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.08);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.editor-expr-activo {
  border-color: #60a5fa;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.16);
}

.editor-expr-caderno {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.editor-expr-btn-definir {
  width: 100%;
  padding: 13px;
  font-size: 15px;
}

/* ── EditorSistema ── */
.editor-sistema {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-sistema-body {
  display: flex;
  align-items: stretch;
  gap: 4px;
  border: 1.5px solid #bfdbfe;
  border-radius: 12px;
  overflow: hidden;
  background: #f0f6ff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.08);
}

.editor-sistema-brace {
  padding: 4px 6px 4px 10px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.editor-sistema-linhas {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.editor-sistema-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* ── combobox de tipo de solução (sistemas) ── */
.sis-tipo-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #bfdbfe;
  border-radius: 10px;
  background: #f0f6ff;
  color: #185FA5;
  font-size: 14px;
  font-weight: 500;
  font-family: system-ui, sans-serif;
  cursor: pointer;
}

.sis-tipo-select:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.zona-resposta input {
  cursor: text;
  /* garante que não herda cursor errado */
}