/* Shared styles for Computational Physics Lab pages (code tabs, console output, Gauss matrix UI). */
.code-card .code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.code-pre {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-x: auto;
  color: var(--text);
  tab-size: 4;
}

.code-pre.is-output {
  background: color-mix(in srgb, var(--text) 6%, var(--paper));
  border-left: 3px solid var(--shu);
}

.copy-btn {
  padding: 6px 13px;
  font-size: 0.78rem;
}

.matrix-grid {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.matrix-row {
  display: grid;
  gap: 6px;
  align-items: center;
}

.matrix-row input {
  width: 100%;
  min-width: 0;
  padding: 6px 6px;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.82rem;
  border-radius: 8px;
}

.matrix-sep {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  font-family: var(--mono);
}

.gauss-steps {
  display: grid;
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.gauss-step {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
}

.gauss-step.active {
  border-color: var(--shu);
  background: var(--accent-soft);
}

.gauss-step-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--shu);
  margin-bottom: 8px;
  font-family: var(--mono);
}

.gauss-mat {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.82rem;
}

.gauss-mat td {
  padding: 4px 8px;
  text-align: right;
  border-bottom: 1px dashed var(--line-soft);
}

.gauss-mat td.rhs {
  border-left: 2px solid var(--shu);
  font-weight: 700;
  color: var(--text);
}

.gauss-mat tr:last-child td {
  border-bottom: 0;
}

/* Interactive Code Runner Console (Python + Scilab) */
.code-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.code-status {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
}

.code-status.is-loading {
  color: var(--shu);
  border-color: var(--shu);
}

.code-status.is-error {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.4);
}

.code-editor {
  width: 100%;
  min-height: 220px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text);
  tab-size: 4;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease;
}

.code-editor:focus {
  border-color: var(--shu);
}

.code-results {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}

.code-results.has-plot {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
}

@media (max-width: 820px) {
  .code-results.has-plot {
    grid-template-columns: 1fr;
  }
}

.code-out-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.code-out-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}

.code-out-panel .code-pre.is-output {
  flex: 1;
  min-height: 160px;
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-plot-panel {
  display: none;
  flex-direction: column;
  min-width: 0;
}

.code-results.has-plot .code-plot-panel {
  display: flex;
}

.code-plot-wrap {
  height: 260px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}
