/* MedDex Chat Rich — whiteboard, calculator, media and side-by-side cards.
   The same quiet card language as meddex-visuals.css. Sized by the card, not
   the screen, so they fit a 340 px bubble, a side panel and a desktop column. */
.mdx-visual-whiteboard, .mdx-visual-calculator, .mdx-visual-row { container-type: inline-size; }

/* Formulas */
.mdx-math { display: block; min-width: 0; padding: 2px 0; color: var(--v-ink, #0e1726); font-family: "Iowan Old Style", "Palatino", Georgia, "Times New Roman", serif; font-size: 1.04rem; line-height: 1.5; overflow-wrap: anywhere; }
.mdx-math.mdx-math-inline { display: inline; padding: 0; }
.mdx-math sup, .mdx-math sub { position: relative; font-size: 0.68em; line-height: 0; vertical-align: baseline; }
.mdx-math sup { top: -0.48em; }
.mdx-math sub { top: 0.28em; }
.mdx-frac { display: inline-flex; flex-direction: column; align-items: center; margin: 0 3px; vertical-align: middle; font-size: 0.9em; line-height: 1.2; }
.mdx-frac-top { padding: 0 4px 1px; border-bottom: 1.2px solid currentColor; }
.mdx-frac-bottom { padding: 1px 4px 0; }
.mdx-sqrt { display: inline-flex; align-items: flex-start; }
.mdx-sqrt-under { padding: 0 3px; border-top: 1.2px solid currentColor; display: inline-flex; align-items: center; }
.mdx-sqrt-index { margin-right: -5px; font-size: 0.6em; }

/* Whiteboard */
.mdx-wb-paper { position: relative; overflow: hidden; padding: 10px 12px; border: 1px solid var(--v-hair, rgba(14, 23, 38, 0.08)); border-radius: 12px; background-color: var(--v-sunken, #f7f9fc); background-image: radial-gradient(var(--v-hair-strong, rgba(14, 23, 38, 0.16)) 0.7px, transparent 0.8px); background-size: 18px 18px; }
.mdx-wb-draw { display: block; width: 100%; max-height: 300px; margin: 0 0 8px; overflow: visible; }
.mdx-wb-stroke { fill: none; stroke: currentColor; stroke-width: 0.55; stroke-linecap: round; stroke-linejoin: round; }
.mdx-wb-text { fill: currentColor; font-size: 2.5px; font-weight: 600; }
.mdx-wb-shape { color: var(--v-ink, #0e1726); }
.mdx-wb-shape.is-blue { color: var(--v-accent, #1769ff); }
.mdx-wb-shape.is-red { color: var(--v-red, #dc2626); }
.mdx-wb-shape.is-green { color: var(--v-green, #0f9d6c); }
.mdx-wb-shape.is-amber { color: var(--v-amber, #a16207); }
.mdx-wb-shape.is-new .mdx-wb-stroke { stroke-dasharray: 1; stroke-dashoffset: 1; animation: mdxWbDraw 0.8s var(--v-ease, ease) forwards; }
@keyframes mdxWbDraw { to { stroke-dashoffset: 0; } }
.mdx-wb-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.mdx-wb-step { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; }
.mdx-wb-step[hidden] { display: none; }
.mdx-wb-step.is-current { animation: mdxWbIn 0.32s var(--v-ease, ease); }
@keyframes mdxWbIn { from { opacity: 0; transform: translateY(4px); } }
.mdx-wb-n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--v-accent-wash, rgba(23, 105, 255, 0.08)); color: var(--v-accent-ink, #0b46b5); font-size: 0.72rem; font-weight: 700; }
.mdx-wb-body { min-width: 0; }
.mdx-wb-say { margin: 1px 0 2px; color: var(--v-ink-2, #33415a); font-size: 0.86rem; }
.mdx-wb-ink { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--v-accent, #1769ff); pointer-events: none; }
.mdx-wb-paper.is-pen { -webkit-user-select: none; user-select: none; }
.mdx-wb-paper.is-pen .mdx-wb-ink { pointer-events: auto; touch-action: none; cursor: crosshair; }
.mdx-wb-paper.is-pen { box-shadow: inset 0 0 0 1.5px var(--v-accent, #1769ff); }
.mdx-wb .mdx-visual-controls [hidden] { display: none; }

/* Calculator */
.mdx-calc-formula { margin: 0 0 8px; padding: 6px 10px; border-radius: 10px; background: var(--v-sunken, #f7f9fc); }
.mdx-calc-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@container (min-width: 460px) { .mdx-calc-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mdx-calc-field { display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; min-width: 0; color: var(--v-ink-2, #33415a); font-size: 0.8rem; font-weight: 600; }
.mdx-visual .mdx-calc-field > label { display: block; margin: 0; padding: 0; min-height: 0; color: inherit; font: inherit; }
.mdx-calc-field.is-check { flex-direction: row; justify-content: flex-start; align-items: center; gap: 8px; min-height: 40px; padding: 4px 10px; border: 1px solid var(--v-hair, rgba(14, 23, 38, 0.08)); border-radius: 10px; font-weight: 500; cursor: pointer; }
.mdx-calc-field.is-check:has(input:checked) { border-color: var(--v-accent, #1769ff); background: var(--v-accent-wash, rgba(23, 105, 255, 0.08)); }
.mdx-calc-field input[type="checkbox"] { flex: 0 0 18px; width: 18px; height: 18px; margin: 0; accent-color: var(--v-accent, #1769ff); }
/* The field keeps the app's own input look; the unit sits beside it. */
.mdx-calc-box { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* 16 px keeps iOS from zooming the page when a field takes focus. */
.mdx-visual .mdx-calc-box input, .mdx-visual .mdx-calc-field select { flex: 1 1 auto; width: 100%; min-width: 0; min-height: 40px; margin: 0; padding: 7px 10px; border-radius: 10px; -webkit-appearance: none; appearance: none; color: var(--v-ink, #0e1726); font: inherit; font-size: 16px; font-weight: 500; }
.mdx-calc-box input[type="number"]::-webkit-inner-spin-button, .mdx-calc-box input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.mdx-calc-box input[type="number"] { -moz-appearance: textfield; }
.mdx-visual .mdx-calc-field select { border: 1px solid var(--v-hair-strong, rgba(14, 23, 38, 0.16)); background: var(--v-surface, #fff) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235f6c80' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center; padding-right: 28px; }
.mdx-calc-unit { flex: 0 0 auto; color: var(--v-muted, #5f6c80); font-size: 0.74rem; font-weight: 500; white-space: nowrap; }
.mdx-calc-result { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--v-sunken, #f7f9fc); border-left: 3px solid var(--v-hair-strong, rgba(14, 23, 38, 0.16)); }
.mdx-calc-result[data-tone="ok"] { background: var(--v-green-wash, rgba(15, 157, 108, 0.1)); border-left-color: var(--v-green, #0f9d6c); }
.mdx-calc-result[data-tone="warn"] { background: var(--v-amber-wash, rgba(202, 138, 4, 0.12)); border-left-color: var(--v-amber, #a16207); }
.mdx-calc-result[data-tone="bad"] { background: var(--v-red-wash, rgba(220, 38, 38, 0.08)); border-left-color: var(--v-red, #dc2626); }
.mdx-calc-value { color: var(--v-ink-2, #33415a); font-size: 0.86rem; }
.mdx-calc-value strong { color: var(--v-ink, #0e1726); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.mdx-calc-reading { margin: 2px 0 0; color: var(--v-ink, #0e1726); font-size: 0.86rem; font-weight: 550; }
.mdx-calc-extra { margin: 2px 0 0; color: var(--v-muted, #5f6c80); font-size: 0.78rem; }
.mdx-calc-extra:empty { display: none; }
.mdx-calc-working { margin-top: 10px; }
.mdx-calc-working > summary { min-height: 32px; color: var(--v-accent-ink, #0b46b5); font-size: 0.8rem; font-weight: 650; cursor: pointer; }
.mdx-calc-working[open] > summary { margin-bottom: 6px; }
.mdx-visual-calculator > .mdx-visual-caption { margin-top: 10px; }

/* Media */
.mdx-media-stage, .mdx-media-video { display: block; position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: #0e1726; }
.mdx-media-play { position: absolute; inset: 0; display: grid; place-items: center; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; color: #fff; cursor: pointer; text-decoration: none; }
.mdx-media-play img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mdx-media-icon { position: relative; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: rgba(14, 23, 38, 0.72); font-size: 1.15rem; }
.mdx-media-frame { display: block; width: 100%; height: 100%; border: 0; }
.mdx-visual-video .mdx-media-stage{min-height:200px;}
.mdx-video-source{margin-top:8px;}
.mdx-media-title { margin: 8px 0 0; color: var(--v-ink, #0e1726); font-size: 0.86rem; font-weight: 600; line-height: 1.3; }
.mdx-media-credit { margin: 2px 0 0; color: var(--v-muted, #5f6c80); font-size: 0.72rem; overflow-wrap: anywhere; }
.mdx-media-credit a { color: inherit; }
.mdx-note-text { margin: 0; color: var(--v-ink-2, #33415a); font-size: 0.9rem; }

/* Side by side: columns only where each keeps a readable width. */
.mdx-visual.mdx-visual-row { max-width: 720px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.mdx-visual-row-title { margin: 0 0 8px; font-size: 1rem; font-weight: 700; color: var(--mdx-ink, #0e1726); }
.mdx-row-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: start; }
@container (min-width: 520px) { .mdx-row-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); } }
.mdx-row-grid > .mdx-visual { margin: 0; }
.mdx-row-grid > [hidden] { display: none; }

/* A card between paragraphs keeps the rhythm of the text around it. */
.mdx-visual.is-inline { margin: 14px 0; }

/* Dark surfaces come from the --mdx tokens; the board's dots follow them. */
@media (prefers-reduced-motion: reduce) {
  .mdx-wb-shape.is-new .mdx-wb-stroke { animation: none; stroke-dashoffset: 0; }
  .mdx-wb-step.is-current { animation: none; }
}
