/* ==========================================================================
   Widget · La Fabrique du Rapport de Vraisemblance (Les Deux Mondes)
   Palette : Violet (#7c3aed M+), Ardoise (#64748b M-), Ambre (#d97706), Vert (#059669)
   Anti-jitter : tabular-nums, min-heights, minmax(0, 1fr)
   ========================================================================== */

.frv-widget {
  --frv-purple: #7c3aed;
  --frv-purple-light: #f5f3ff;
  --frv-purple-border: #ddd6fe;
  --frv-slate: #64748b;
  --frv-slate-light: #f1f5f9;
  --frv-slate-border: #cbd5e1;
  --frv-text: #0f172a;
  --frv-border: #e2e8f0;
  --frv-bg-card: #f8fafc;

  font-variant-numeric: tabular-nums;
  margin: 1.5rem 0 2rem;
}

/* Presets Bar */
.frv-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.85rem 0 1.25rem;
}

.frv-preset-btn {
  appearance: none;
  border: 1px solid var(--frv-border);
  background: #ffffff;
  color: #334155;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.25;
}

.frv-preset-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--frv-text);
}

.frv-preset-btn.active {
  background: #ede9fe;
  color: var(--frv-purple);
  border-color: #c4b5fd;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(124, 58, 237, 0.1);
}

/* Laboratory Laboratory Stage (The Two Vials) */
.frv-lab-stage {
  background: #ffffff;
  border: 1px solid var(--frv-border);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  margin-bottom: 1.25rem;
}

.frv-vials-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1.25rem;
  max-width: 620px;
  margin: 0 auto 1.25rem;
}

@media (max-width: 580px) {
  .frv-vials-grid {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.6rem;
  }
}

/* Vial Card */
.frv-vial-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  background: var(--frv-bg-card);
  border: 1px solid var(--frv-border);
  border-radius: 10px;
  padding: 0.9rem 0.75rem;
}

.frv-vial-col--mpos {
  border-top: 4px solid var(--frv-purple);
}

.frv-vial-col--mneg {
  border-top: 4px solid var(--frv-slate);
}

.frv-col-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 52px;
}

.frv-col-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--frv-text);
  line-height: 1.2;
}

.frv-col-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: 9999px;
  white-space: nowrap;
}

.frv-vial-col--mpos .frv-col-badge {
  background: #ede9fe;
  color: var(--frv-purple);
  border: 1px solid #ddd6fe;
}

.frv-vial-col--mneg .frv-col-badge {
  background: #f1f5f9;
  color: var(--frv-slate);
  border: 1px solid #e2e8f0;
}

/* The Vertical Glass Tube / Vial */
.frv-vial-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.frv-vial-scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 180px;
  font-size: 0.68rem;
  font-weight: 600;
  color: #94a3b8;
  padding: 2px 0;
  user-select: none;
}

.frv-vial-glass {
  width: 58px;
  height: 180px;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  border-radius: 8px 8px 12px 12px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(15, 23, 42, 0.08);
}

.frv-vial-fluid {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  transition: height 0.08s ease-out;
  border-radius: 0 0 10px 10px;
}

.frv-vial-col--mpos .frv-vial-fluid {
  background: linear-gradient(180deg, #9061f9 0%, #7c3aed 100%);
  border-top: 2px solid #c4b5fd;
}

.frv-vial-col--mneg .frv-vial-fluid {
  background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
  border-top: 2px solid #cbd5e1;
}

/* Vial Value Display */
.frv-vial-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--frv-text);
  white-space: nowrap;
}

.frv-vial-col--mpos .frv-vial-val {
  color: var(--frv-purple);
}

.frv-vial-col--mneg .frv-vial-val {
  color: var(--frv-slate);
}

/* Slider under each vial */
.frv-vial-slider-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.frv-vial-slider-wrap input[type="range"] {
  width: 100%;
  cursor: pointer;
}

.frv-vial-col--mpos input[type="range"] {
  accent-color: var(--frv-purple);
}

.frv-vial-col--mneg input[type="range"] {
  accent-color: var(--frv-slate);
}

/* Central Division Operator */
.frv-operator-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0 0.2rem;
}

.frv-op-symbol {
  font-size: 2.2rem;
  font-weight: 800;
  color: #94a3b8;
  line-height: 1;
}

.frv-op-text {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  text-align: center;
}

/* Calculation & Synthesis Card */
.frv-result-card {
  background: #f8fafc;
  border: 1px solid var(--frv-border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.frv-result-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.75rem;
}

.frv-formula-display {
  font-size: 0.95rem;
  font-weight: 600;
  color: #475569;
}

.frv-math-label {
  font-weight: 700;
  color: #334155;
  margin-right: 0.2rem;
}

.frv-math-num {
  color: var(--frv-purple);
  font-weight: 800;
}

.frv-math-den {
  color: var(--frv-slate);
  font-weight: 800;
}

.frv-math-op {
  color: #94a3b8;
  font-weight: 700;
  margin: 0 0.3rem;
}

.frv-rv-hero {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.frv-rv-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #475569;
}

.frv-rv-val {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--frv-text);
  line-height: 1;
  min-width: 4.2rem;
  text-align: right;
}

/* Badges Row */
.frv-badges-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.frv-multiplier-badge {
  font-size: 0.85rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: #ede9fe;
  color: var(--frv-purple);
  border: 1px solid #ddd6fe;
}

.frv-jaeschke-badge {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
}

.frv-jaeschke-badge--major {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.frv-jaeschke-badge--moderate {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.frv-jaeschke-badge--minimal {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.frv-jaeschke-badge--useless {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.frv-jaeschke-badge--theoretical {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* Dynamic Clinical Note */
.frv-dynamic-note {
  background: #ffffff;
  border: 1px solid var(--frv-border);
  border-radius: 8px;
  padding: 0.85rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #334155;
  min-height: 75px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.frv-dynamic-note--warning {
  border-left: 4px solid #f59e0b;
  background: #fffdfa;
}

.frv-note-warning {
  display: inline-block;
  color: #b45309;
  font-weight: 700;
  margin-top: 0.35rem;
}

.frv-dynamic-note strong {
  color: var(--frv-text);
}
