/* ── Notebook container ────────────────────────────────── */
.nb-notebook {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── Top toolbar ───────────────────────────────────────── */
.nb-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
  background: var(--surface, #ffffff);
}

.nb-run-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--border, #e2e8f0);
  background: transparent;
  color: var(--text, #0f172a);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.13s, border-color 0.13s, color 0.13s;
}
.nb-run-all-btn:hover    { background: #f0fdf4; border-color: #22c55e; color: #16a34a; }
.nb-run-all-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.nb-cell-count {
  font-size: 0.68rem;
  color: var(--text-muted, #94a3b8);
  font-family: inherit;
  margin-left: 4px;
  user-select: none;
}

/* ── Cells scroll area ─────────────────────────────────── */
.nb-cells {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 20px;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border, #cbd5e1) transparent;
}
.nb-cells::-webkit-scrollbar       { width: 4px; }
.nb-cells::-webkit-scrollbar-thumb { background: var(--border, #cbd5e1); border-radius: 4px; }

/* ── Single cell ───────────────────────────────────────── */
.nb-cell {
  display: flex;
  flex-direction: column;
  border: none;
  border-bottom: 1px solid var(--border, #e2e8f0);
  margin: 0;
  background: var(--surface, #ffffff);
  transition: border-color 0.15s;
}
.nb-cell:focus-within { border-bottom-color: #6366f1; }

/* ── Lower row (gutter + body) ─────────────────────────── */
.nb-cell-lower {
  display: flex;
  flex: 1;
  min-width: 0;
}

/* ── Gutter ────────────────────────────────────────────── */
.nb-gutter {
  width: 42px;
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding: 10px 8px 0 4px;
  color: var(--text-muted, #94a3b8);
  font-size: 0.66rem;
  font-family: var(--code-font, "JetBrains Mono", monospace);
  user-select: none;
}

/* ── Cell body ─────────────────────────────────────────── */
.nb-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  padding-left: 3px;
}

.nb-body::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 99px;
  background: transparent;
  transition:
    background   0.3s  cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow   0.3s  cubic-bezier(0.4, 0, 0.2, 1),
    top          0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    bottom       0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nb-cell:focus-within .nb-body::before {
  top: 6px;
  bottom: 6px;
  background: linear-gradient(180deg, #818cf8 0%, #6366f1 100%);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12), 0 0 18px rgba(99,102,241,0.3);
}

/* ── Per-cell toolbar ──────────────────────────────────── */
.nb-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: var(--bg, #f8fafc);
  flex-shrink: 0;
  position: relative;   /* anchors the ::after laser line */
}

.nb-toolbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  pointer-events: none;
  opacity: 0;
}

.nb-lang-select {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 4px;
  padding: 2px 6px 2px 4px;
  background: var(--surface, #ffffff);
  color: var(--text, #0f172a);
  cursor: pointer;
  margin-right: 4px;
  outline: none;
}
.nb-lang-select:focus { border-color: #6366f1; }

.nb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted, #64748b);
  font-size: 0.73rem;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
  font-family: inherit;
}
.nb-btn:hover    { background: var(--bg, #f1f5f9); color: var(--text, #0f172a); }
.nb-btn:disabled { opacity: 0.38; cursor: not-allowed; }

.nb-run       { color: #22c55e; font-size: 0.6rem; }
.nb-run:hover { background: #f0fdf4; color: #16a34a; }
.nb-del:hover { background: #fef2f2; color: #ef4444; }

.nb-cell-num {
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--code-font, "JetBrains Mono", monospace);
  color: var(--text-muted, #94a3b8);
  min-width: 14px;
  text-align: center;
  flex-shrink: 0;
  user-select: none;
}

/* ── Editor ────────────────────────────────────────────── */
.nb-editor {
  width: 100%;
  min-height: 88px;
  padding: 10px;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  overflow: hidden;
  font-family: var(--code-font, "JetBrains Mono", "Courier New", monospace);
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text, #0f172a);
  tab-size: 4;
  box-sizing: border-box;
}
.nb-editor::placeholder { color: var(--text-muted, #94a3b8); opacity: 0.55; }

/* ── Add-between row ───────────────────────────────────── */
.nb-add-row {
  display: flex;
  align-items: center;
  margin: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  transition: height 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease;
}
.nb-cells:hover .nb-add-row,
.nb-add-row:focus-within { height: 22px; opacity: 1; }

.nb-add-line {
  flex: 1;
  height: 1px;
  background: var(--border, #e2e8f0);
}

.nb-add-btn {
  width: 22px;
  height: 22px;
  border: 1.5px dashed var(--border, #cbd5e1);
  border-radius: 50%;
  background: var(--surface, #ffffff);
  color: var(--text-muted, #94a3b8);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.1s, color 0.1s, background 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin: 0 5px;
  font-family: inherit;
}
.nb-add-btn:hover { border-color: #6366f1; color: #6366f1; background: #eef2ff; border-style: solid; }

/* ── Per-cell output sections (in the Output panel) ───── */
.nb-output-section {
  border: none;
  border-bottom: 1px solid var(--border, #e2e8f0);
  overflow: hidden;
  margin: 0;
}
.nb-output-section:last-child  { border-bottom: none; }

.nb-output-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #22c55e;
  padding: 0 8px 0 12px;
  min-height: 28px;
  box-sizing: border-box;
  background: var(--bg, #f3f5f8);
  border-bottom: 1.5px solid currentColor;
  font-family: var(--code-font, "JetBrains Mono", monospace);
  user-select: none;
}

/* Dot badge before label text */
.nb-output-section-label-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nb-output-section-label-text::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.85;
}

.nb-output-section-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  font-size: 0.65rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  font-family: inherit;
  line-height: 1;
}
.nb-output-section-close:hover { background: #fef2f2; color: #ef4444; }

.nb-output-section-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg, #f3f5f8);
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.04);
}

/* ── Cell separator in output ──────────────────────────── */
.nb-output-separator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  color: var(--text-muted, #94a3b8);
}
.nb-output-separator::before,
.nb-output-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border, #e2e8f0);
}
.nb-sep-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ── Laser animations ──────────────────────────────────── */
@keyframes nb-laser-flow {
  0%   { background-position: 200% center; }
  100% { background-position: -100% center; }
}
@keyframes nb-laser-breathe {
  0%, 100% { opacity: 0.82; }
  50%       { opacity: 1;    }
}
