/* Curvature app: 3D view on the left, formulas and values on the right. */
.cv { display: flex; }
.cv-view { position: relative; flex: 1; min-width: 0; min-height: 0; }
.cv-view canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.cv-view canvas.deform { cursor: crosshair; }
.cv-hint {
  position: absolute; left: 0.75rem; bottom: 2rem; max-width: 24rem;
  color: var(--text-dim); pointer-events: none; line-height: 1.4;
}
.cv-tools { position: absolute; left: 0.75rem; top: 0.625rem; display: flex; gap: 0.25rem; }
.cv-legend {
  position: absolute; left: 0.75rem; bottom: 0.625rem; display: flex; align-items: center; gap: 0.5rem;
  color: var(--text-dim); font-variant-numeric: tabular-nums; pointer-events: none;
}
.cv-legend .bar { width: 9rem; height: 0.5rem; border-radius: 0.25rem; border: 1px solid var(--border); }

.cv-side {
  width: clamp(36rem, 46vw, 52rem); flex: none; overflow: hidden; border-left: 1px solid var(--border);
  background: var(--panel-alt); user-select: text;
}
.cv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; padding: 0.5rem; align-items: stretch; }
.cv-values { display: contents; }
.cv-card {
  min-width: 0; padding: 0.5rem 0.625rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--panel);
}
.cv-card.span2 { grid-column: span 2; }
.cv-card a.lnk { color: var(--accent); font-weight: 400; margin-left: auto; }
.cv-fv { display: flex; flex-direction: column; }
.cv-card.span2 .cv-fv { flex-direction: row; align-items: center; gap: 0.75rem; }
.cv-card.span2 .cv-f { flex: 1 1 auto; min-width: 0; }
.cv-card.span2 .cv-v { flex: 0 1 auto; min-width: 0; margin-top: 0; }
.cv-v:empty { display: none; }
.cv-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cv-label {
  position: absolute; left: 0; top: 0; padding: 0.0625rem 0.375rem; border-radius: 0.375rem; white-space: nowrap;
  font-size: 0.6875rem; font-weight: 600; background: var(--panel); border: 1px solid currentColor;
}
.cv-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4375rem; }
.cv-row:last-child { margin-bottom: 0; }
.cv-row.wrap { flex-wrap: wrap; gap: 0.375rem 0.75rem; }
.cv-row > label { width: 8.5rem; flex: none; color: var(--text-dim); }
.cv-row select { flex: 1; min-width: 0; }
.cv-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); }
.cv-row .val { width: 3rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.chk { display: inline-flex; align-items: center; gap: 0.3125rem; color: var(--text-dim); cursor: pointer; }
.chk input { accent-color: var(--accent); }

.cv-h { display: flex; align-items: baseline; gap: 0.5rem; margin: 0 0 0.375rem; font-weight: 600; font-size: 0.8125rem; }
.cv-tag {
  font-size: 0.625rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.0625rem 0.3125rem; border-radius: 0.25rem;
}
.cv-tag.dep { color: var(--kind-a); background: color-mix(in srgb, var(--kind-a) 18%, transparent); }
.cv-tag.inv { color: var(--kind-b); background: color-mix(in srgb, var(--kind-b) 18%, transparent); }
.cv-block { margin-bottom: 0.5rem; }
.cv-block:last-child { margin-bottom: 0; }
.cv-f { overflow-x: auto; overflow-y: hidden; padding: 0.125rem 0; }
.cv-f mjx-container[display="true"], .cv-v mjx-container[display="true"] { margin: 0.3125rem 0 !important; text-align: left !important; }
#params { margin-bottom: 0.4375rem; }
.cv-v {
  margin-top: 0.25rem; padding: 0.125rem 0.5rem; border-left: 2px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 0.375rem 0.375rem 0; overflow-x: auto; overflow-y: hidden;
}
.cv-v .cap { font-size: 0.6875rem; color: var(--text-dim); padding-top: 0.25rem; }
.cv-note { color: var(--text-dim); line-height: 1.45; margin-bottom: 0.625rem; }
.cv-note.warn { color: var(--warn); }
.cv-kv { display: grid; grid-template-columns: auto 1fr; gap: 0.1875rem 0.75rem; font-variant-numeric: tabular-nums; }
.cv-kv dt { color: var(--text-dim); }
.cv-sw { display: inline-block; width: 0.625rem; height: 0.1875rem; border-radius: 0.125rem; vertical-align: middle; margin-right: 0.25rem; }

@media (max-width: 1000px) {
  .cv { flex-direction: column; overflow-y: auto; }
  .cv-view { flex: none; height: 55vh; }
  .cv-side { width: auto; border-left: none; border-top: 1px solid var(--border); overflow: visible; }
  .cv-grid { grid-template-columns: 1fr; }
  .cv-card.span2 { grid-column: auto; }
  .cv-card.span2 .cv-fv { flex-direction: column; align-items: stretch; }
  .cv-hint { display: none; }
}
.cv-f:has(+ #v-gam) { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1.5rem; }
.cv-tag { white-space: nowrap; }
.cv-h > span:first-child { white-space: nowrap; }
