/* NABLA — integration.css v3 */

[hidden] {
  display: none !important;
}


.int-body { grid-template-columns: 37.5fr 25fr 37.5fr; }
@media (max-width: 1100px) { .int-body { grid-template-columns: 1fr; } }

/* ─── fn input ─────────────────────────────────────────────────────────────── */
.int-field-block { display: flex; flex-direction: column; gap: 0.5rem; }

.fn-wrap {
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--void); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0.62rem 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fn-wrap:focus-within { border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange-dim); }
.fn-glyph { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 700; color: var(--orange-bright); flex-shrink: 0; }
.fn-input { flex: 1; background: transparent; border: none; outline: none; color: var(--text-primary); font-family: var(--font-mono); font-size: 0.86rem; min-width: 0; }
.fn-hint { font-size: 0.7rem; color: var(--text-muted); line-height: 1.6; padding: 0.4rem 0.6rem; background: var(--surface-raised); border-radius: var(--radius-sm); }
.fn-hint code { font-family: var(--font-mono); color: var(--text-code); background: rgba(255,180,84,0.08); padding: 0.04em 0.28em; border-radius: 3px; }

/* ─── bounds + ±∞ ─────────────────────────────────────────────────────────── */
.inf-badge {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.06em;
  background: rgba(255,180,84,0.14); color: var(--amber);
  border: 1px solid rgba(255,180,84,0.3); border-radius: var(--radius-pill);
  padding: 0.1rem 0.45rem; margin-left: 0.5rem; vertical-align: middle;
}
.bounds-stack { display: flex; flex-direction: column; }
.bound-row {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--void); border: 1px solid var(--border); padding: 0.52rem 0.75rem;
  transition: border-color 0.15s;
}
.bound-row:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.bound-row:last-child  { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.bound-row:focus-within { border-color: var(--orange); z-index: 1; position: relative; }
.bound-label { font-family: var(--font-mono); font-size: 0.88rem; font-weight: 700; color: var(--orange-bright); min-width: 16px; display: flex; align-items: baseline; gap: 0.28rem; }
.bound-sub { font-size: 0.62rem; font-weight: 400; color: var(--text-muted); letter-spacing: 0.04em; }
.bound-input { flex: 1; background: transparent; border: none; outline: none; color: var(--text-primary); font-family: var(--font-mono); font-size: 0.88rem; text-align: right; min-width: 0; }
.inf-btn {
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700;
  color: var(--text-muted); background: var(--surface-raised);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.15rem 0.42rem; cursor: pointer; transition: all 0.15s; flex-shrink: 0;
}
.inf-btn:hover { color: var(--amber); border-color: var(--amber); background: rgba(255,180,84,0.08); }
.bound-connector { display: flex; align-items: center; background: var(--surface-raised); border-left: 1px solid var(--border); border-right: 1px solid var(--border); padding: 0 0.85rem; height: 28px; }
.bound-line { flex: 1; height: 1px; background: var(--border); }
.bound-int-symbol { font-family: var(--font-mono); font-size: 1.55rem; color: var(--orange); opacity: 0.45; padding: 0 0.45rem; line-height: 1; user-select: none; }

/* ─── singularity banner ──────────────────────────────────────────────────── */
.sing-banner {
  display: flex; align-items: flex-start; gap: 0.55rem;
  padding: 0.6rem 0.75rem; background: rgba(248,113,113,0.07);
  border: 1px solid rgba(248,113,113,0.22); border-radius: var(--radius-md); color: #F87171;
}
.sing-banner svg { flex-shrink: 0; width: 14px; height: 14px; margin-top: 1px; }
.sing-content { display: flex; flex-direction: column; gap: 0.1rem; }
.sing-label { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; }
.sing-detail { font-family: var(--font-mono); font-size: 0.64rem; color: rgba(248,113,113,0.7); line-height: 1.5; }
.sing-result-warn { font-family: var(--font-mono); font-size: 0.7rem; color: #FBBF24; background: rgba(251,191,36,0.07); border: 1px solid rgba(251,191,36,0.2); border-radius: var(--radius-sm); padding: 0.35rem 0.6rem; margin-top: 0.25rem; }

/* ─── presets ─────────────────────────────────────────────────────────────── */
.preset-row { display: flex; flex-wrap: wrap; gap: 0.38rem; }
.preset-chip { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-secondary); background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 0.25rem 0.62rem; cursor: pointer; transition: all 0.15s; }
.preset-chip:hover { color: var(--orange-bright); border-color: var(--orange); background: rgba(255,106,26,0.06); }

/* ─── def card (bottom left, 2 tabs only) ────────────────────────────────── */
.def-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin-top: auto; }
.def-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--surface-raised); }
.def-tab { flex: 1; font-family: var(--font-mono); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.05em; color: var(--text-muted); background: none; border: none; padding: 0.52rem 0.25rem; cursor: pointer; transition: all 0.15s; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.def-tab.active { color: var(--orange-bright); border-bottom-color: var(--orange-bright); }
.def-tab:hover:not(.active) { color: var(--text-secondary); }
.def-body { padding: 0.75rem 0.9rem; }
.def-page { display: none; flex-direction: column; gap: 0.45rem; }
.def-page.active { display: flex; }
.def-page p { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.65; }
.def-page p strong { color: var(--text-primary); }

/* ─── method badge ────────────────────────────────────────────────────────── */
.badge-new { display: inline-block; font-family: var(--font-mono); font-size: 0.5rem; font-weight: 700; letter-spacing: 0.08em; background: rgba(255,138,61,0.18); color: var(--orange-bright); border: 1px solid rgba(255,138,61,0.3); border-radius: var(--radius-pill); padding: 0.08rem 0.36rem; vertical-align: middle; margin-left: 0.25rem; }

/* ─── method groups ───────────────────────────────────────────────────────── */
.mgroup-label { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin: 1rem 0 0.45rem; }
.mgroup-label:first-of-type { margin-top: 0; }

/* ─── output toolbar ──────────────────────────────────────────────────────── */
.output-toolbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.view-toggle { display: flex; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 2px; gap: 2px; }
.vtoggle-btn { font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500; padding: 0.26rem 0.65rem; border-radius: var(--radius-pill); border: none; background: transparent; color: var(--text-muted); cursor: pointer; transition: all 0.15s; }
.vtoggle-btn.active { background: var(--grad-brand); color: #fff; font-weight: 700; }
.vtoggle-btn:not(.active):hover { color: var(--text-secondary); }

.export-group { display: flex; align-items: center; gap: 0.3rem; }
.export-btn { display: flex; align-items: center; gap: 0.28rem; font-family: var(--font-mono); font-size: 0.66rem; font-weight: 600; color: var(--text-secondary); background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.26rem 0.55rem; cursor: pointer; transition: all 0.15s; }
.export-btn:hover { color: var(--orange-bright); border-color: var(--border-hover); }
.export-btn svg { width: 11px; height: 11px; flex-shrink: 0; }

/* ─── result card ─────────────────────────────────────────────────────────── */
.int-result-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem 1.15rem; display: flex; flex-direction: column; gap: 0.4rem; }
.int-result-label { font-family: var(--font-mono); font-size: 0.62rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--orange-bright); display: flex; align-items: center; gap: 0.38rem; }
.int-result-label::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--orange-bright); box-shadow: 0 0 6px var(--orange-bright); }
.int-result-value { font-family: var(--font-mono); font-size: 1.65rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.03em; line-height: 1; word-break: break-all; }
.int-result-meta { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); }

/* ─── canvas wrap + expand corner button ─────────────────────────────────── */
.canvas-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.7rem; position: relative; }
.int-canvas { width: 100%; height: auto; border-radius: 4px; display: block; background: var(--void); }

.canvas-expand-corner {
  position: absolute; bottom: 12px; right: 12px;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,106,26,0.14); border: 1px solid rgba(255,106,26,0.3);
  border-radius: 5px; color: var(--orange-bright); cursor: pointer;
  opacity: 0; transition: opacity 0.18s, background 0.15s;
}
.canvas-wrap:hover .canvas-expand-corner { opacity: 1; }
.canvas-expand-corner:hover { background: rgba(255,106,26,0.26); }
.canvas-expand-corner svg { width: 10px; height: 10px; }

/* ─── OVERLAY ─────────────────────────────────────────────────────────────── */
.graph-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: var(--void); display: flex; flex-direction: column;
  animation: ovIn 0.16s ease;
}
@keyframes ovIn { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: scale(1); } }

.graph-overlay-header {
  display: flex; align-items: center; justify-content: space-between;
  height: 48px; padding: 0 1.1rem; flex-shrink: 0;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.graph-overlay-title { font-family: var(--font-mono); font-size: 0.76rem; color: var(--orange-bright); font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 55vw; }

.overlay-tools { display: flex; align-items: center; gap: 0.28rem; }
.overlay-tool-btn { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; transition: all 0.14s; }
.overlay-tool-btn:hover { color: var(--orange-bright); border-color: var(--border-hover); }
.overlay-tool-btn svg { width: 13px; height: 13px; }
.overlay-close:hover { color: #F87171; border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.07); }
.overlay-sep { width: 1px; height: 20px; background: var(--border); margin: 0 0.12rem; }

.overlay-canvas-wrap { flex: 1; position: relative; overflow: hidden; cursor: crosshair; min-height: 0; }
#overlayCanvas { display: block; width: 100%; height: 100%; }

/* crosshair */
.overlay-crosshair { position: absolute; inset: 0; pointer-events: none; }
.crosshair-x { position: absolute; left: 0; right: 0; height: 1px; background: rgba(255,180,84,0.38); }
.crosshair-y { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,180,84,0.38); }
.crosshair-label { position: absolute; font-family: var(--font-mono); font-size: 0.68rem; color: var(--amber); background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 0.14rem 0.4rem; white-space: nowrap; pointer-events: none; }

.overlay-footer {
  height: 44px; flex-shrink: 0; border-top: 1px solid var(--border);
  background: var(--surface); display: flex; align-items: center;
  padding: 0 1.1rem; gap: 1.5rem;
}
.overlay-slider-row { display: flex; align-items: center; gap: 0.65rem; flex-shrink: 0; }
.overlay-slider-label { font-family: var(--font-mono); font-size: 0.66rem; color: var(--text-muted); white-space: nowrap; }
.overlay-slider {
  -webkit-appearance: none; width: 130px; height: 3px;
  background: var(--border); border-radius: 2px; outline: none; cursor: pointer;
}
.overlay-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--orange-bright); cursor: pointer; box-shadow: 0 0 5px rgba(255,138,61,0.45);
}
.overlay-slider-val { font-family: var(--font-mono); font-size: 0.66rem; color: var(--orange-bright); min-width: 36px; }
.overlay-coords { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-secondary); flex: 1; }