/*
 * nnviz.css - alle Styles sind mit .nnviz-container als Scope isoliert,
 * damit sie nicht mit Host-Seiten (z.B. Hugo-Themes) kollidieren.
 *
 * Die CSS-Variablen werden auf .nnviz-container statt :root gesetzt,
 * damit sie lokal überschrieben werden können und nicht global lecken.
 */

.nnviz-container {
  /* Design-Tokens lokal definieren */
  --nnviz-bg: #fafaf7;
  --nnviz-ink: #1a1a1a;
  --nnviz-muted: #666;
  --nnviz-accent: #c73e1d;
  --nnviz-neuron: #2b6cb0;
  --nnviz-sum: #2f855a;
  --nnviz-activation: #6b46c1;
  --nnviz-border: #d4d4d0;

  max-width: 1100px;
  width: 100%;
  color: var(--nnviz-ink);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}

.nnviz-container *,
.nnviz-container *::before,
.nnviz-container *::after {
  box-sizing: border-box;
}

.nnviz-container h1 {
  font-size: 1.4rem;
  font-weight: 500;
  margin: 0 0 0.25rem 0;
}

.nnviz-container .nnviz-subtitle {
  color: var(--nnviz-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.nnviz-container .nnviz-stage {
  background: #fff;
  border: 1px solid var(--nnviz-border);
  border-radius: 8px;
  padding: 1rem;
  position: relative;
}

.nnviz-container .nnviz-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

.nnviz-container .nnviz-overlay {
  position: absolute;
  pointer-events: none;
}

.nnviz-container .nnviz-overlay input,
.nnviz-container .nnviz-overlay select {
  position: absolute;
  pointer-events: auto;
  padding: 0.4rem 0.5rem;
  font-size: 1rem;
  font-family: "SF Mono", Consolas, monospace;
  border: 1px solid var(--nnviz-border);
  border-radius: 4px;
  background: #fff;
  text-align: center;
  transform: translate(-50%, -50%);
  color: var(--nnviz-ink);
}

.nnviz-container .nnviz-overlay input {
  width: 80px;
}

.nnviz-container .nnviz-overlay select {
  font-family: -apple-system, sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
}

.nnviz-container .nnviz-overlay input:focus,
.nnviz-container .nnviz-overlay select:focus {
  outline: 2px solid var(--nnviz-neuron);
  outline-offset: -1px;
}

.nnviz-container .nnviz-overlay .nnviz-output,
.nnviz-container .nnviz-overlay .nnviz-intermediate {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: "SF Mono", Consolas, monospace;
  font-size: 1rem;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  min-width: 70px;
  text-align: center;
  border: 1px solid var(--nnviz-border);
  color: var(--nnviz-ink);
}

.nnviz-container .nnviz-overlay .nnviz-intermediate {
  background: #f0fdf4;
  color: #166534;
  font-size: 0.85rem;
}

.nnviz-container .nnviz-overlay .nnviz-output {
  background: #f0f4f8;
  font-weight: 600;
  font-size: 1.1rem;
  min-width: 80px;
}

.nnviz-container .nnviz-hint {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--nnviz-muted);
  text-align: center;
}

.nnviz-container .nnviz-hint kbd {
  font-family: "SF Mono", monospace;
  background: #eee;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid #ccc;
  font-size: 0.8rem;
  color: var(--nnviz-ink);
}

.nnviz-container .nnviz-breakdown {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  background: #f8f8f5;
  border: 1px solid var(--nnviz-border);
  border-radius: 6px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 0.88rem;
  color: #333;
  line-height: 1.7;
}

.nnviz-container .nnviz-breakdown .nnviz-step { display: block; }
.nnviz-container .nnviz-breakdown .nnviz-label {
  display: inline-block;
  min-width: 100px;
  color: var(--nnviz-muted);
}
.nnviz-container .nnviz-breakdown .nnviz-op {
  color: var(--nnviz-muted);
  margin: 0 0.3rem;
}
.nnviz-container .nnviz-breakdown .nnviz-result {
  font-weight: 600;
  color: var(--nnviz-activation);
}

.nnviz-container .nnviz-preset-bar {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.nnviz-container .nnviz-preset-bar button {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-family: inherit;
  background: #fff;
  border: 1px solid var(--nnviz-border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--nnviz-ink);
}

.nnviz-container .nnviz-preset-bar button:hover {
  background: #f0f0ec;
}

.nnviz-container .nnviz-preset-bar .nnviz-label {
  font-size: 0.85rem;
  color: var(--nnviz-muted);
  align-self: center;
  margin-right: 0.3rem;
}

/* Matrix-Zellen als Zahlenfelder */
.nnviz-container .nnviz-overlay .nnviz-matrix-cell {
  position: absolute;
  pointer-events: auto;
  width: 52px;
  padding: 0.25rem 0.3rem;
  font-size: 0.85rem;
  font-family: "SF Mono", Consolas, monospace;
  border: none;
  background: transparent;
  text-align: center;
  transform: translate(-50%, -50%);
  color: var(--nnviz-ink);
}

.nnviz-container .nnviz-overlay .nnviz-matrix-cell:focus {
  outline: 2px solid var(--nnviz-neuron);
  outline-offset: -2px;
  background: #fff;
  border-radius: 2px;
}

/* Vector-Zellen (editierbare Input-Zellen in Spaltenform) */
.nnviz-container .nnviz-overlay .nnviz-vector-cell {
  position: absolute;
  pointer-events: auto;
  width: 56px;
  padding: 0.3rem 0.4rem;
  font-size: 0.9rem;
  font-family: "SF Mono", Consolas, monospace;
  border: 1px solid var(--nnviz-border);
  border-radius: 3px;
  background: #fff;
  text-align: center;
  transform: translate(-50%, -50%);
  color: var(--nnviz-ink);
}

.nnviz-container .nnviz-overlay .nnviz-vector-cell:focus {
  outline: 2px solid var(--nnviz-neuron);
  outline-offset: -1px;
}

/* Ergebnis-Anzeige: read-only Zellen */
.nnviz-container .nnviz-overlay .nnviz-result-cell {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 60px;
  padding: 0.3rem 0.4rem;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 0.9rem;
  background: #f0fdf4;
  border: 1px solid var(--nnviz-border);
  border-radius: 3px;
  text-align: center;
  color: #166534;
  font-weight: 600;
}

.nnviz-container .nnviz-overlay .nnviz-result-cell.nnviz-animating {
  background: #fef3c7;
  color: #92400e;
}
