/* Molarity & Dilution — 37degrees. Scoped to .md-root. Dark default + .md-theme-light. */
.md-root {
  --md-navy-900: #082540; --md-navy-950: #04141f; --md-navy-700: #133b56; --md-navy-400: #5d83a1;
  --md-text: #dde4ed; --md-muted: #8ba5bd; --md-accent: #ff7bac; --md-accent-2: #ec1f6a;
  --md-surface: rgba(4,20,31,0.55); --md-radius: 14px; --md-radius-sm: 10px;
  --md-mono: "JetBrains Mono","SFMono-Regular",ui-monospace,Menlo,Consolas,monospace;
  --md-font: "Nunito Sans Variable","Nunito Sans",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  position: relative; font-family: var(--md-font); color: var(--md-text);
  background: radial-gradient(70% 55% at 12% 8%, rgba(255,123,172,0.13) 0%, rgba(255,123,172,0) 60%), radial-gradient(60% 55% at 88% 95%, rgba(52,211,153,0.08) 0%, rgba(52,211,153,0) 65%), linear-gradient(180deg,var(--md-navy-900) 0%,var(--md-navy-950) 100%);
  border: 1px solid var(--md-navy-700); border-radius: var(--md-radius); padding: 24px;
  display: grid; grid-template-columns: minmax(0,1fr) minmax(0,0.9fr);
  grid-template-areas: "header header" "rail result" "footer footer"; gap: 18px;
  box-shadow: 0 10px 40px rgba(4,20,31,0.35); box-sizing: border-box; max-width: 100%;
}
.md-root *, .md-root *::before, .md-root *::after { box-sizing: border-box; }
@media (max-width: 760px) { .md-root { grid-template-columns: 1fr; grid-template-areas: "header" "rail" "result" "footer"; } }
.md-root.md-theme-light {
  --md-text: #082540; --md-muted: #5d83a1; --md-navy-700: #dde4ed; --md-surface: #f7f9fc;
  background: radial-gradient(70% 55% at 12% 8%, rgba(255,123,172,0.07) 0%, rgba(255,123,172,0) 60%), radial-gradient(60% 55% at 88% 95%, rgba(52,211,153,0.045) 0%, rgba(52,211,153,0) 65%), linear-gradient(180deg,#ffffff 0%,#f1f4f8 100%); border-color: #dde4ed; box-shadow: 0 6px 24px rgba(8,37,64,0.08);
}
.md-root.md-theme-light .md-card, .md-root.md-theme-light .md-result, .md-root.md-theme-light .md-num,
.md-root.md-theme-light .md-unit, .md-root.md-theme-light .md-serial-row, .md-root.md-theme-light .md-serial-head { background: #fff; border-color: #dde4ed; color: var(--md-text); }
.md-root.md-theme-light .md-segmented { background: #f1f4f8; border-color: #dde4ed; }
.md-root.md-theme-light .md-segmented-btn[aria-checked="true"] { background: #fff1f6; border-color: var(--md-accent); color: var(--md-accent-2); }

.md-header { grid-area: header; display: flex; flex-direction: column; gap: 4px; }
.md-eyebrow { font-size: 11px; letter-spacing: 3px; font-weight: 800; color: var(--md-accent); }
.md-title { font-size: 22px; font-weight: 800; line-height: 1.2; }
.md-subtitle { font-size: 14px; color: var(--md-muted); line-height: 1.45; }

.md-rail { grid-area: rail; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.md-card { background: rgba(8,37,64,0.4); border: 1px solid var(--md-navy-700); border-radius: var(--md-radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.md-pane { display: flex; flex-direction: column; gap: 12px; }
.md-pane[hidden] { display: none; }

.md-segmented { display: inline-flex; background: var(--md-surface); border: 1px solid var(--md-navy-700); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; width: max-content; max-width: 100%; }
.md-segmented-btn { font-family: inherit; font-size: 12px; font-weight: 700; color: var(--md-muted); background: transparent; border: 1px solid transparent; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.md-segmented-btn:hover { color: var(--md-text); }
.md-segmented-btn[aria-checked="true"] { background: rgba(255,123,172,0.14); border-color: var(--md-accent); color: var(--md-accent); }
.md-segmented-sm .md-segmented-btn { font-size: 11px; padding: 5px 10px; }
.md-solvelabel { font-size: 10px; letter-spacing: 1.5px; font-weight: 800; color: var(--md-muted); text-transform: uppercase; }

.md-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 auto; }
.md-label { font-size: 11px; letter-spacing: 1.5px; font-weight: 800; color: var(--md-muted); text-transform: uppercase; }
.md-inline { display: flex; align-items: center; gap: 8px; }
.md-row2 { gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.md-suffix { font-size: 12px; font-weight: 700; color: var(--md-muted); white-space: nowrap; }
.md-num { width: 100%; font-family: var(--md-mono); font-size: 16px; font-weight: 800; color: var(--md-text); background: var(--md-surface); border: 1px solid var(--md-navy-700); border-radius: var(--md-radius-sm); padding: 9px 12px; outline: none; min-width: 0; }
.md-num:focus { border-color: var(--md-accent); box-shadow: 0 0 0 3px rgba(255,123,172,0.18); }
.md-num.md-output { background: rgba(255,123,172,0.10); border-color: var(--md-accent); color: var(--md-accent); }
.md-unit { font-family: inherit; font-size: 13px; font-weight: 700; color: var(--md-text); background: var(--md-surface); border: 1px solid var(--md-navy-700); border-radius: var(--md-radius-sm); padding: 9px 8px; outline: none; cursor: pointer; flex: 0 0 auto; }

.md-result { grid-area: result; background: rgba(8,37,64,0.4); border: 1px solid var(--md-navy-700); border-radius: var(--md-radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.md-result-title { font-size: 11px; letter-spacing: 2px; font-weight: 800; color: var(--md-accent); text-transform: uppercase; }
.md-big { font-family: var(--md-mono); font-size: 30px; font-weight: 800; line-height: 1.1; letter-spacing: -0.5px; word-break: break-word; }
.md-note { font-size: 13px; color: var(--md-muted); line-height: 1.5; }
.md-viz { display: flex; justify-content: center; padding-top: 4px; }
.md-beaker { width: 150px; max-width: 60%; height: auto; }
.md-glass { stroke: var(--md-muted); stroke-width: 4; stroke-linecap: round; }
.md-liquid { fill: var(--md-accent); }
.md-tick { stroke: var(--md-muted); stroke-width: 2; }

.md-serial-out { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.md-serial-head, .md-serial-row { display: grid; grid-template-columns: 28px 1fr 1fr; gap: 8px; align-items: center; font-size: 12.5px; }
.md-serial-head { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--md-muted); font-weight: 800; }
.md-serial-row { background: var(--md-surface); border: 1px solid var(--md-navy-700); border-radius: 8px; padding: 5px 8px; }
.md-serial-c { font-family: var(--md-mono); font-weight: 800; color: var(--md-accent); }

.md-export { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; }
.md-export-label { font-size: 10px; letter-spacing: 1.5px; font-weight: 800; color: var(--md-muted); text-transform: uppercase; }
.md-export-btn { font-family: inherit; font-size: 12px; font-weight: 700; color: var(--md-text); background: rgba(141,165,189,0.10); border: 1px solid var(--md-navy-700); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.md-export-btn:hover { background: rgba(255,123,172,0.12); border-color: var(--md-accent); color: var(--md-accent); }
.md-footer { grid-area: footer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--md-muted); }
.md-footer a { color: var(--md-text); text-decoration: none; font-weight: 700; }
.md-footer-brand { color: #ff7bac !important; font-weight: 700; } .md-footer-brand:hover { color: #ec1f6a !important; text-decoration: underline; } .md-footer-sep { opacity: 0.5; }
.md-fatal { padding: 16px; border-radius: 10px; background: rgba(236,31,106,0.12); border: 1px solid #ec1f6a; color: #fff; }

.md-expand-icon { position: absolute; top: 14px; right: 14px; z-index: 50; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; background: rgba(255,123,172,0.10); color: #ec1f6a; border: 1px solid rgba(255,123,172,0.30); border-radius: 10px; cursor: pointer; padding: 0; font-family: inherit; transition: background .12s, transform .12s; }
.md-expand-icon:hover { background: rgba(255,123,172,0.22); transform: scale(1.05); }
.md-expand-icon-label { display: none; }
.md-brand-mark { display: none; }
html.md-html-locked, body.md-body-locked { overflow: hidden !important; height: 100vh !important; }
.md-root.md-is-expanded { position: fixed; inset: 0; z-index: 99990; margin: 0; border: none; border-radius: 0; box-shadow: none; background: #fff; color: #082540; --md-text: #082540; --md-muted: #5d83a1; --md-navy-700: #dde4ed; --md-surface: #f7f9fc; grid-template-columns: 360px minmax(0,1fr); grid-template-areas: "brand result" "rail result" "footer footer"; grid-template-rows: auto minmax(0,1fr) auto; gap: 0; padding: 0; height: 100vh; overflow: hidden; }
.md-root.md-is-expanded .md-header { display: none; }
.md-root.md-is-expanded .md-rail { grid-area: rail; overflow-y: auto; padding: 18px; border-right: 1px solid #dde4ed; background: #f1f4f8; min-height: 0; }
.md-root.md-is-expanded .md-result { grid-area: result; overflow-y: auto; min-height: 0; background: #fff; padding: 24px; }
.md-root.md-is-expanded .md-card, .md-root.md-is-expanded .md-num, .md-root.md-is-expanded .md-unit { background: #fff; border-color: #dde4ed; color: #082540; }
.md-root.md-is-expanded .md-expand-icon { position: fixed; top: 18px; right: 22px; z-index: 99991; }
.md-root.md-is-expanded .md-rail .md-expand-icon { position: static; top: auto; right: auto; width: 100%; height: 40px; margin-bottom: 4px; gap: 8px; justify-content: center; font-weight: 800; font-size: 13px; }
.md-root.md-is-expanded .md-expand-icon-label { display: inline-block; }
.md-root.md-is-expanded .md-brand-mark { grid-area: brand; display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; background: #082540; font-family: var(--md-font); font-weight: 800; font-size: 15px; line-height: 1; padding: 14px 20px; }
.md-root.md-is-expanded .md-brand-mark svg { height: 28px; width: 28px; display: block; }
.md-root.md-is-expanded .md-brand-mark .md-brand-sep { color: #ff7bac; margin: 0 2px; } .md-root.md-is-expanded .md-brand-mark .md-tool-name { color: #ff7bac; }
.md-root.md-is-expanded .md-footer { grid-area: footer; background: #082540; padding: 12px 24px; justify-content: center; margin: 0; }
.md-root.md-is-expanded .md-footer, .md-root.md-is-expanded .md-footer span { color: #fff; } .md-root.md-is-expanded .md-footer a { color: #ff7bac; }
@media (max-width: 960px) { .md-root.md-is-expanded { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0,1fr) auto; grid-template-areas: "brand" "rail" "result" "footer"; } .md-root.md-is-expanded .md-rail { border-right: none; border-bottom: 1px solid #e4ecf2; max-height: 45vh; } .md-root.md-is-expanded .md-brand-mark .md-brand-sep, .md-root.md-is-expanded .md-brand-mark .md-tool-name { display: none; } }
@media (max-width: 640px) { .md-root { padding: 18px; } .md-title { font-size: 19px; } .md-big { font-size: 24px; } }
