/* Academy layout: cards first, then a focused tracing with optional study tools. */
/* Clipping X must not create a non-scrolling ancestor for the sticky menu. */
body.cm-ecg-page-body {overflow-x:clip;}
body.cm-ecg-page-body.cm-no-scroll {overflow:hidden;}
body.cm-ecg-page-body #cm-sidebar.cm-sidebar {height:calc(100dvh - var(--cm-sidebar-offset,0px));min-height:0;max-height:calc(100dvh - var(--cm-sidebar-offset,0px));}
body.cm-ecg-page-body #cm-sidebar .cm-scroll {min-height:0;padding-bottom:max(16px,env(safe-area-inset-bottom));}
.cm-ecg-sim { --ecg-surface:#101b2d; --ecg-line:#2a3b53; --ecg-muted:#a3b4cc; --ecg-accent:#71e2cf; --ecg-control-size:max(14px,.9rem); color:#edf4ff; width:min(1440px,100%); }
.cm-ecg-sim [hidden] { display:none!important; }
.cm-ecg-sim button,.cm-ecg-sim input,.cm-ecg-sim select,.cm-ecg-sim textarea { font:inherit; }
.cm-ecg-sim :is(button,select,input,textarea):focus-visible,.cm-ecg-sim summary:focus-visible { outline:3px solid #71e2cf; outline-offset:3px; }
.cm-ecg-sim :is(.ecg-navigation,.ecg-library,.ecg-practice-home,.ecg-focus-header,.ecg-study,.ecg-stage-toolbar,.ecg-electric,.ecg-quiz,.ecg-chat,.ecg-advanced,.ecg-guide-focus) { font-family:"Avenir Next","Segoe UI",sans-serif; }
.cm-ecg-sim :is(.ecg-library,.ecg-practice-home,.ecg-study,.ecg-focus-header) h2 { margin:0; color:#f2f6ff; letter-spacing:-.035em; line-height:1.15; }
.cm-ecg-sim button { cursor:pointer; touch-action:manipulation; }
.cm-ecg-sim button:disabled { cursor:default;opacity:.5; }
.ecg-kicker { display:block; font-size:.66rem;letter-spacing:.14em;font-weight:800;color:var(--ecg-accent);line-height:1.7; }
.ecg-muted { color:var(--ecg-muted);font-size:.82rem;line-height:1.6; }
.ecg-navigation { display:flex;gap:6px;flex-wrap:wrap;padding:6px;background:#0c1423;border:1px solid var(--ecg-line);border-radius:14px; }
.ecg-navigation button { border:0;border-radius:10px;padding:12px 19px;color:#b7c6da;background:transparent;font-size:var(--ecg-control-size);font-weight:700;min-height:44px; }
.ecg-navigation button[aria-pressed=true] { color:#092b2b;background:var(--ecg-accent); }
.ecg-library-hero { display:grid;grid-template-columns:1.2fr .8fr;gap:30px;align-items:center;background:radial-gradient(ellipse at 85% 10%,#173d43 0,transparent 60%),#101b2c;border:1px solid #2e4857;border-radius:22px;padding:clamp(24px,4vw,48px); }
.cm-ecg-sim .ecg-library-hero h2 {font-size:clamp(1.8rem,3vw,2.8rem);margin:10px 0 16px;}
.ecg-library-hero p { color:#b3c4d8;line-height:1.7;max-width:52ch;font-size:.95rem;margin:0 0 24px; }
.ecg-primary { background:var(--ecg-accent)!important;color:#082a29!important;border:1px solid transparent!important;border-radius:10px;padding:12px 18px;font-weight:800;min-height:44px; }
.ecg-primary:hover { filter:brightness(1.08); }
.ecg-hero-visual { color:#7ce8d5;padding:28px 16px;background-image:linear-gradient(#72dfcb08 1px,transparent 1px),linear-gradient(90deg,#72dfcb08 1px,transparent 1px);background-size:18px 18px; }
.ecg-hero-visual>span {display:block;font-size:.62rem;letter-spacing:.2em;text-align:center;color:#a2cec9;}
.ecg-hero-visual svg { width:100%;margin:20px 0 0;overflow:visible; }
.ecg-hero-visual path {fill:none;stroke:#71e2cf;stroke-width:2.5;stroke-linejoin:round;stroke-linecap:round;filter:drop-shadow(0 0 5px #71e2cf55);}
.ecg-hero-visual>div {display:flex;justify-content:space-around;font-size:.72rem;}
.ecg-hero-visual small {display:block;text-align:center;font-size:.69rem;color:#9bbabf;margin-top:26px;}
.ecg-library-tools,.ecg-practice-settings {display:flex;gap:16px;align-items:end;margin:24px 0 16px;}
.ecg-library-tools label:first-child {flex:1;}
.ecg-library-tools label,.ecg-practice-settings label {display:grid;gap:7px;color:#aebed3;font-size:.76rem;font-weight:700;}
.ecg-library-tools input,.ecg-library-tools select,.ecg-practice-settings select {background:#101b2d;color:#f3f7ff;border:1px solid #354761;border-radius:10px;padding:12px 14px;min-height:46px;width:100%;color-scheme:dark;}
.ecg-filter-row {display:flex;gap:7px;flex-wrap:wrap;}
.ecg-filter-row button,.ecg-guide-focus button {border:1px solid #34465f;background:#152238;color:#cbd8e8;border-radius:999px;padding:9px 13px;font-size:var(--ecg-control-size);min-height:38px;}
.ecg-filter-row button[aria-pressed=true],.ecg-guide-focus button[aria-pressed=true] {border-color:#70dfcc;background:#173c3d;color:#a3f8e5;}
.ecg-case-grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;}
.ecg-case-card {display:flex;flex-direction:column;gap:16px;padding:21px;text-align:left;background:#101c2e;border:1px solid #2c3c54;border-radius:16px;color:#f0f5ff;transition:transform .18s,border-color .18s;min-width:0;}
.ecg-case-card:hover {transform:translateY(-3px);border-color:var(--case-accent);background:#132338;}
.ecg-card-top,.ecg-card-footer {display:flex;justify-content:space-between;gap:12px;font-size:.7rem;color:#9aadc5;}
.ecg-card-top>span:first-child {color:var(--case-accent);font-weight:700;}
.ecg-case-card svg {width:100%;height:38px;opacity:.7;}
.ecg-case-card svg path {fill:none;stroke:var(--case-accent);stroke-width:1.4;}
.ecg-case-card strong {font-size:1.07rem;line-height:1.35;min-height:2.7em;}
.ecg-card-copy {font-size:.81rem;line-height:1.6;color:#9eb1ca;flex:1;}
.ecg-card-footer {padding-top:14px;border-top:1px solid #27384e;width:100%;align-items:center;}
.ecg-card-footer>span:first-child {background:#213048;padding:4px 8px;border-radius:6px;color:#d3deef;}
.ecg-empty {grid-column:1/-1;padding:35px;border:1px dashed #52627b;border-radius:16px;}
.cm-ecg-sim:is(.is-library,.is-practice-home) :is(.simulator-workspace,.ecg-study,.ecg-reference) {display:none!important;}
.cm-ecg-sim .simulator-workspace {width:100%;gap:16px;}
.ecg-focus-header {padding:4px 0 8px;scroll-margin-top:18px;}
.ecg-back {border:0;background:transparent;color:#b6c8df;padding:6px 0;margin-bottom:18px;font-size:var(--ecg-control-size);min-height:36px;}
.ecg-focus-heading {display:flex;justify-content:space-between;gap:16px;align-items:center;}
.cm-ecg-sim .ecg-focus-heading h2 {font-size:clamp(1.5rem,2.5vw,2.15rem);margin-top:5px;}
.ecg-focus-header>p {color:#b6c6dc;font-size:.95rem;line-height:1.65;max-width:95ch;margin:12px 0 0;}
.ecg-case-navigation {display:flex;gap:8px;}
.ecg-case-navigation button {width:42px;height:42px;border:1px solid #35455d;border-radius:10px;background:#152138;color:#e7f3ff;}
.ecg-config-note {font-size:.9rem!important;padding:12px 16px;background:#41392160;border:1px solid #8a754d;border-radius:10px;}
.ecg-config-note button {color:#ffe0a0;text-decoration:underline;background:none;border:0;}
.cm-ecg-sim .stage {padding:0;border:1px solid #3b4b61;border-radius:18px;background:#0d1727;box-shadow:0 18px 60px #0002;overflow:hidden;scroll-margin-top:14px;}
.ecg-stage-toolbar {display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;padding:13px 16px;background:#111e31;color:#dfebfc;border-bottom:1px solid #34445d;}
.ecg-stage-brand {display:flex;flex-direction:column;gap:3px;flex-shrink:0;}
.ecg-stage-brand img {width:135px;height:36px;object-fit:contain;object-position:left center;}
.ecg-stage-brand span {font-size:.58rem;letter-spacing:.12em;text-transform:uppercase;color:#9eafc6;}
.ecg-stage-actions {display:flex;flex:1 1 600px;min-width:0;gap:8px;flex-wrap:wrap;justify-content:flex-end;}
.ecg-stage-actions button {padding:9px 11px;min-height:44px;line-height:1.4;border:1px solid #3a4d67;border-radius:8px;background:#1b2d45;color:#e0ebfb;font-size:var(--ecg-control-size);font-weight:700;}
.ecg-stage-actions button[aria-pressed=true] {color:#a5f5e6;border-color:#70dfcc;background:#173c3d;}
.ecg-stage-actions #ecg-chat-open {background:#224048;border-color:#406568;color:#a6f2e5;}
.ecg-case-workspace {container:ecg-case/inline-size;min-width:0;--ecg-paper-height:clamp(200px,62dvh,660px);}
.ecg-question-layout {display:grid;grid-template-columns:minmax(0,1fr);align-items:start;min-width:0;}
.ecg-paper-wrap {position:relative;display:grid;grid-template-columns:minmax(0,1fr);align-items:stretch;gap:0;background:#091321;min-width:0;}
.has-electric .ecg-paper-wrap {grid-template-columns:minmax(0,1fr) clamp(280px,29%,440px);}
.cm-ecg-sim .ecg-paper-wrap .sheet {display:block;width:min(100%,calc(var(--ecg-paper-height) * 160 / 126));height:auto;min-width:0;max-width:100%;border-radius:0;box-shadow:none;align-self:center;margin-inline:auto;background:transparent;}
.ecg-electric {padding:22px 18px;background:#101e32;color:#ebf3ff;border-left:1px solid #3b4b61;display:flex;flex-direction:column;justify-content:safe center;gap:12px;}
.ecg-electric-header {display:flex;gap:8px;justify-content:space-between;align-items:start;}
.ecg-electric-header .ecg-kicker {font-size:.55rem;}
.ecg-electric h3 {margin:4px 0 0;font-size:1rem;color:#f0f5ff;}
.ecg-electric-header button {background:transparent;color:#b6c9e3;border:1px solid #435775;width:32px;height:32px;border-radius:8px;}
.ecg-electric>svg {display:block;width:100%;height:auto;aspect-ratio:300/320;max-height:460px;flex:0 0 auto;overflow:visible;}
.ecg-electric-part {stroke:#47667e;fill:#47667e;stroke-width:3;stroke-linecap:round;transition:stroke .07s,fill .07s;}
.ecg-electric-part path {fill:none;}
.ecg-electric-part.is-active {stroke:#89f7d7;fill:#89f7d7;filter:drop-shadow(0 0 5px #63d9be);}
.ecg-repolarization {stroke:#7b587b;opacity:.12;}
.ecg-repolarization.is-active {stroke:#dea7ef;opacity:.8;}
.ecg-electric-labels {fill:#c3d3e9;font-size:10px;font-weight:600;}
.ecg-electric #ecg-electric-phase {font-size:.88rem;line-height:1.5;color:#a5f5e3;min-height:3em;margin:0;}
.ecg-electric .ecg-muted {font-size:.75rem;margin:0;}
.ecg-electric-key {display:flex;flex-wrap:wrap;gap:8px;font-size:.68rem;color:#89f7d7;}
.ecg-electric-key span:last-child {color:#dea7ef;}
.ecg-electric.is-blocked [data-electric-part=av] {stroke:#ffb77d;fill:#ffb77d;}
.cm-ecg-sim .stage>.metrics {padding:10px 14px;display:flex;flex-wrap:wrap;gap:8px;border-top:1px solid #34445d;}
.cm-ecg-sim .stage>.metrics .metric {padding:6px 10px;font-size:.67rem;width:auto;background:#1b293e;color:#cbd9ec;border:0;box-shadow:none;}
.ecg-advanced {order:2;border:1px solid #304058;border-radius:13px;background:#101b2d;overflow:hidden;}
.ecg-advanced>summary,.ecg-reference>summary {padding:16px 20px;color:#c8d7eb;cursor:pointer;font-size:var(--ecg-control-size);font-weight:700;}
.ecg-advanced .controls {padding:0 12px 12px;}
.ecg-advanced .controls__status .controls__actions {display:flex!important;flex-wrap:wrap;}
.ecg-advanced #toggle-freeze,.ecg-advanced #toggle-ecg-fullscreen,.ecg-advanced #open-pathology-guide {display:none;}
.ecg-reference {border:1px solid #2c3b50;border-radius:13px;background:#101b2d;}
.ecg-reference :is(.legend,.lead-grid,.footnote) {margin:14px;}
.ecg-study {padding:24px;border:1px solid #30445a;border-radius:18px;background:#111f32;}
.ecg-study-header {display:flex;justify-content:space-between;gap:16px;align-items:center;}
.cm-ecg-sim .ecg-study-header h2 {font-size:1.4rem;margin-top:5px;}
.ecg-study-header button {font-size:var(--ecg-control-size);}
.ecg-study-findings {list-style:none;padding:0;margin:24px 0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;}
.ecg-study-findings li {padding:18px;background:#0c182a;border:1px solid #2d435c;border-radius:12px;}
.ecg-study-findings li>span {display:grid;place-items:center;width:28px;height:28px;border-radius:8px;background:#244746;color:#88efda;font-weight:800;font-size:.8rem;}
.ecg-study-findings p {font-size:.85rem;line-height:1.7;color:#c3d3e6;margin:12px 0 0;}
.ecg-study-reasoning {display:grid;grid-template-columns:1fr 1fr;gap:30px;}
.ecg-study h3 {font-size:.92rem;color:#e9f3ff;margin:0 0 9px;}
.ecg-study-reasoning p {color:#aebeD4;font-size:.86rem;line-height:1.7;margin:0;}
.ecg-study-source,.ecg-study a {color:#96dcd2;}
.cm-ecg-sim .pathology-guide {margin:0;border-radius:0;border:0;border-top:1px solid #354d60;box-shadow:none;padding:20px;}
.ecg-guide-focus {display:flex;flex-wrap:wrap;gap:7px;}
.ecg-practice-home {padding:clamp(22px,4vw,42px);border:1px solid #32465f;border-radius:18px;background:radial-gradient(ellipse at top right,#233654,transparent 65%),#101b2d;}
.cm-ecg-sim .ecg-practice-home h2 {font-size:clamp(1.8rem,3vw,2.5rem);margin:12px 0 16px;}
.ecg-practice-home>p {max-width:76ch;color:#b0c0d6;line-height:1.75;}
.ecg-quiz {padding:22px;color:#e8f1ff;background:#111e30;border-top:1px solid #354b66;min-width:0;overflow-wrap:anywhere;}
.cm-ecg-sim.is-quiz .ecg-case-workspace {--ecg-paper-height:clamp(180px,52dvh,560px);}
.cm-ecg-sim.is-quiz .ecg-back {margin-bottom:8px;}
.ecg-quiz fieldset {margin:0;padding:0;border:0;}
.ecg-quiz legend {font-size:1.05rem;font-weight:800;line-height:1.5;padding:0 0 16px;}
.ecg-answer-options {display:grid;grid-template-columns:1fr 1fr;gap:10px;}
.ecg-answer-options label {position:relative;}
.ecg-answer-options input {position:absolute;opacity:0;}
.ecg-answer-options label>span {display:flex;align-items:center;gap:12px;min-height:55px;padding:12px;border:1px solid #3a4c64;border-radius:10px;background:#18263c;cursor:pointer;font-size:var(--ecg-control-size);}
.ecg-answer-options input:checked+span {border-color:#77e4d0;background:#244844;}
.ecg-answer-options input:focus-visible+span {outline:3px solid #77e4d0;outline-offset:2px;}
.ecg-answer-options input:disabled+span {opacity:.65;cursor:default;}
.ecg-answer-options b {color:#90a9c7;}
.ecg-quiz-actions {display:flex;gap:10px;justify-content:space-between;margin-top:18px;flex-wrap:wrap;}
.ecg-quiz-actions button {background:#1d304a;color:#daebff;border:1px solid #415d7b;padding:12px 16px;border-radius:10px;min-height:44px;font-size:var(--ecg-control-size);}
#ecg-feedback {margin:0;padding:18px;border:1px solid #437c72;border-radius:12px;background:#143039;}
#ecg-feedback h3 {font-size:1.15rem;color:#aaf3de;margin:0 0 12px;}
#ecg-feedback p,#ecg-feedback summary {font-size:.88rem;line-height:1.75;color:#d1e6e9;}
#ecg-feedback summary {cursor:pointer;}
#ecg-results {margin-top:25px;border-top:1px solid #45617d;padding-top:18px;}
#ecg-results li {margin:8px 0;color:#99e9d2;}
#ecg-results button {background:transparent;color:#c5e9f6;border:0;text-decoration:underline;text-align:left;padding:8px;}
.cm-ecg-sim.is-quiz :is(.ecg-advanced,.ecg-reference) {display:none!important;}
.cm-ecg-sim.is-blind :is(#metric-pathology,#metric-rate,.pathology-guide,#ecg-electric,.ecg-study) {display:none!important;}
.cm-ecg-sim.is-blind :is(#ecg-show-guide,#ecg-show-electric) {display:none;}
.ecg-chat {position:fixed;inset:auto 22px 22px auto;z-index:2147483646;margin:0;width:min(410px,calc(100vw - 24px));height:min(680px,calc(100dvh - 36px));padding:0;border:1px solid #47617e;border-radius:17px;background:#101d30;color:#eaf3ff;box-shadow:0 20px 80px #0009;overflow:auto;}
.ecg-chat[open] {display:flex;flex-direction:column;}
.ecg-chat:not([open]) {display:none;}
.ecg-chat-dock {position:fixed;inset:0;z-index:2000;pointer-events:none;}
.ecg-chat-dock .ecg-chat {pointer-events:auto;}
.ecg-chat-launcher {pointer-events:auto;position:absolute;right:max(24px,env(safe-area-inset-right));bottom:max(24px,env(safe-area-inset-bottom));display:grid;place-items:center;width:68px;height:68px;padding:11px;border:1px solid #3ed8c5;border-radius:50%;background:linear-gradient(145deg,#0d1c2cf7,#092336f7);box-shadow:0 12px 36px #0007,0 0 0 4px #3ed8c512;color:#eaf3ff;transition:transform .18s ease;}
.ecg-chat-launcher img {display:block;width:44px;height:44px;object-fit:contain;filter:drop-shadow(0 3px 9px #20c4c840);}
.ecg-chat-launcher:hover {transform:translateY(-3px);}
.ecg-chat-launcher::before {content:attr(data-tooltip);position:absolute;right:0;bottom:calc(100% + 12px);white-space:nowrap;font:500 12px "Avenir Next","Segoe UI",sans-serif;padding:9px 12px;border:1px solid #33566b;border-radius:9px;background:#10283a;color:#d4f5f0;opacity:0;visibility:hidden;pointer-events:none;}
.ecg-chat-launcher:focus-visible::before {opacity:1;visibility:visible;}
@media(hover:hover) {.ecg-chat-launcher:hover::before {opacity:1;visibility:visible;}}
@media(max-width:620px) {.ecg-chat-launcher {right:max(16px,env(safe-area-inset-right));bottom:max(16px,env(safe-area-inset-bottom));width:60px;height:60px;padding:10px;}.ecg-chat-launcher img {width:38px;height:38px;}}
@media(prefers-reduced-motion:reduce) {.ecg-chat-launcher {transition:none;}}
.ecg-chat-heading {display:flex;position:sticky;top:0;z-index:1;flex-shrink:0;background:#101d30;justify-content:space-between;align-items:center;padding:18px 18px 12px;gap:10px;}
.ecg-chat-heading h2 {font-size:1.12rem!important;margin:4px 0 0;color:#f0f6ff;}
.ecg-chat-heading button {flex-shrink:0;border:1px solid #425571;background:#1b2c45;color:#e0edfc;border-radius:8px;width:36px;height:36px;}
.ecg-chat-context {margin:0;padding:10px 18px;color:#93e2d1;background:#163337;font-size:.85rem;line-height:1.5;}
#ecg-chat-log {flex:1;min-height:80px;overflow:auto;overscroll-behavior:contain;padding:18px;}
.ecg-chat-message {font-size:.85rem;line-height:1.75;overflow-wrap:anywhere;margin:0 0 14px;}
.ecg-chat-message p {margin:8px 0;}
.ecg-chat-message.is-user {padding:10px 14px;border-radius:12px;background:#233c59;white-space:pre-wrap;}
.ecg-chat-message h3 {color:#9bedd9;font-size:.92rem;}
.ecg-chat-message .an-chat-table {overflow:auto;}
.ecg-chat-message table {border-collapse:collapse;font-size:.77rem;}
.ecg-chat-message :is(td,th) {border:1px solid #435776;padding:7px;}
.ecg-chat-message blockquote {border-left:3px solid #8ad8c6;margin:12px 0;padding-left:12px;}
.ecg-chat-prompts {display:flex;flex-wrap:wrap;gap:7px;padding:0 16px 10px;}
.ecg-chat-prompts button {padding:8px;border:1px solid #3c536e;border-radius:8px;background:#172b41;color:#afcddd;font-size:var(--ecg-control-size);}
#ecg-chat-form {flex-shrink:0;padding:12px 16px;border-top:1px solid #324660;}
#ecg-chat-form label {font-size:.7rem;color:#b5c9df;}
#ecg-chat-input {resize:vertical;max-height:110px;min-height:64px;width:100%;border:1px solid #425b79;border-radius:9px;background:#0b1728;color:#f0f5ff;padding:10px;font-size:16px;margin-top:5px;}
#ecg-chat-status {font-size:.9rem;color:#ffc8a8;margin:6px 0;line-height:1.45;}
.ecg-chat-footer {display:flex;justify-content:space-between;align-items:center;gap:8px;}
.ecg-chat-footer button {font-size:var(--ecg-control-size);}
#ecg-chat-clear {background:transparent;border:0;color:#b5c9df;padding:10px 0;}
@media(max-height:650px) {.ecg-chat-prompts{display:none;}.ecg-chat-heading{padding:12px;}.ecg-chat-context{max-height:4.5em;overflow:auto;flex-shrink:0;}#ecg-chat-log{min-height:40px;padding:12px;}}
/* Fullscreen uses square-preserving SVG fit: no horizontal/vertical ECG distortion. */
.cm-ecg-sim .stage:fullscreen,.cm-ecg-sim .stage:-webkit-full-screen,.cm-ecg-sim.is-ecg-only .stage {display:flex!important;flex-direction:column;height:100dvh!important;min-height:0!important;overflow:auto!important;background:#0d1727!important;}
.cm-ecg-sim :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-case-workspace,.cm-ecg-sim.is-ecg-only .ecg-case-workspace {display:flex;flex:1;min-height:220px;}
.cm-ecg-sim :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-question-layout,.cm-ecg-sim.is-ecg-only .ecg-question-layout {flex:1;min-width:0;min-height:0;align-items:stretch;grid-template-rows:minmax(180px,1fr) auto;}
.cm-ecg-sim :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-paper-wrap,.cm-ecg-sim.is-ecg-only .ecg-paper-wrap {flex:1;min-height:180px;overflow:hidden;}
.cm-ecg-sim :is(.stage:fullscreen,.stage:-webkit-full-screen) .sheet,.cm-ecg-sim.is-ecg-only .sheet {width:100%!important;min-width:0!important;height:100%!important;min-height:0!important;max-height:100%!important;object-fit:contain;}
.cm-ecg-sim :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-stage-toolbar,.cm-ecg-sim.is-ecg-only .ecg-stage-toolbar {flex-shrink:0;}
.cm-ecg-sim :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-electric,.cm-ecg-sim.is-ecg-only .ecg-electric {justify-content:safe center;padding:18px;overflow:auto;}
.cm-ecg-sim :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-electric>svg,.cm-ecg-sim.is-ecg-only .ecg-electric>svg {max-height:min(460px,56dvh);}
.cm-ecg-sim :is(.stage:fullscreen,.stage:-webkit-full-screen) :is(.pathology-guide,.ecg-quiz),.cm-ecg-sim.is-ecg-only :is(.pathology-guide,.ecg-quiz) {flex-shrink:0;max-height:34dvh;overflow:auto;}
.cm-ecg-sim .stage .ecg-fullscreen-exit {display:none!important;}
.cm-ecg-sim.is-ecg-only .ecg-advanced {display:none!important;}
@media (min-width:1500px) {.ecg-case-grid {grid-template-columns:repeat(4,minmax(0,1fr));}}
@media (max-width:1000px) {.ecg-case-grid {grid-template-columns:repeat(2,minmax(0,1fr));}.ecg-library-hero{grid-template-columns:1.4fr .6fr;}.ecg-stage-toolbar{align-items:start;}.ecg-study-findings{gap:10px;}.ecg-study-findings li{padding:13px;}}
@media (max-width:720px) {
  .ecg-navigation button {font-size:var(--ecg-control-size);padding:10px;flex:1;}
  .ecg-library-hero {grid-template-columns:1fr;gap:0;padding:24px;}.ecg-hero-visual{display:none;}
  .ecg-library-tools {align-items:stretch;}.ecg-library-tools label:first-child{min-width:0;}.ecg-library-tools label:last-child{width:135px;}
  .ecg-case-grid {gap:10px;}.ecg-case-card {padding:16px;gap:12px;}.ecg-card-copy{font-size:.77rem;}.ecg-card-footer{flex-wrap:wrap;}
  .ecg-study {padding:18px;}.ecg-study-header{align-items:start;flex-direction:column;}.ecg-study-findings,.ecg-study-reasoning{grid-template-columns:1fr;gap:12px;}.ecg-study-findings li{display:flex;gap:12px;align-items:start;}.ecg-study-findings li>span{flex-shrink:0;}.ecg-study-findings p{margin:0;}
  .ecg-stage-toolbar {flex-direction:column;padding:12px;gap:10px;}.ecg-stage-brand{flex-direction:row;align-items:center;gap:10px;}.ecg-stage-brand img{width:120px;height:30px;}.ecg-stage-actions{flex:0 1 auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));justify-content:start;width:100%;}.ecg-stage-actions button{min-width:0;overflow-wrap:anywhere;font-size:var(--ecg-control-size);padding:8px;}
  .has-electric .ecg-paper-wrap {grid-template-columns:1fr;}.ecg-electric {border-left:0;border-top:1px solid #3b4b61;display:grid;grid-template-columns:140px 1fr;gap:10px 16px;justify-content:stretch;padding:16px;}.ecg-electric-header{grid-column:2;grid-row:1;}.ecg-electric>svg{grid-column:1;grid-row:1/5;max-height:185px;}.ecg-electric>p,.ecg-electric-key{grid-column:2;}.ecg-electric h3{font-size:.9rem;}
  .ecg-answer-options{grid-template-columns:1fr;}.ecg-quiz{padding:16px;}.ecg-practice-settings{flex-wrap:wrap;}.ecg-practice-settings label{flex:1;min-width:120px;}
  .ecg-chat{right:12px;bottom:12px;height:min(650px,calc(100dvh - 24px));}
  .cm-ecg-sim :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-paper-wrap,.cm-ecg-sim.is-ecg-only .ecg-paper-wrap{overflow:auto;grid-template-rows:minmax(160px,1fr) auto;}
  .cm-ecg-sim :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-electric,.cm-ecg-sim.is-ecg-only .ecg-electric{max-height:170px;grid-template-columns:110px 1fr;}
  .cm-ecg-sim :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-electric>svg,.cm-ecg-sim.is-ecg-only .ecg-electric>svg{max-height:140px;}
}
@media (max-width:460px) {.ecg-case-grid{grid-template-columns:1fr;}.ecg-case-card strong{min-height:0;}.ecg-case-card svg{height:30px;}.ecg-library-tools{flex-direction:column;}.ecg-library-tools label:last-child{width:100%;}.ecg-navigation{flex-direction:column;}.ecg-navigation button{text-align:left;}.ecg-case-navigation{display:none;}.ecg-focus-header>p{font-size:.85rem;}}
@media (prefers-reduced-motion:reduce) {.ecg-case-card,.ecg-electric-part{transition:none;}.cm-ecg-sim .pathology-guide-mark,.cm-ecg-sim .pathology-guide-label,.cm-ecg-sim .pathology-guide-line{animation:none;}}
/* Override the old desktop two-column control layout. */
body.cm-ecg-page-body .cm-ecg-page-content .cm-ecg-sim .simulator-workspace {grid-template-columns:minmax(0,1fr);}
body.cm-ecg-page-body .cm-ecg-page-content .cm-ecg-sim .simulator-workspace>.stage {grid-column:1;grid-row:auto;order:1;width:100%;}
body.cm-ecg-page-body .cm-ecg-page-content .cm-ecg-sim .ecg-advanced {grid-column:1;grid-row:auto;order:2;}
body.cm-ecg-page-body .cm-ecg-page-content .cm-ecg-sim .stage>.technical-strip {border:0;border-top:1px solid #34445d;border-radius:0;padding:10px 14px;margin:0;display:block;box-shadow:none;}
.cm-ecg-sim .stage>.technical-strip .technical-strip__heading {display:none;}
body.cm-ecg-page-body .cm-ecg-page-content .cm-ecg-sim .stage>.technical-strip .metrics {display:flex;flex-wrap:wrap;gap:6px;}
body.cm-ecg-page-body .cm-ecg-page-content .cm-ecg-sim .stage>.technical-strip .metric {font-size:.66rem;min-height:0;padding:5px 9px;}
.cm-ecg-sim :is(.stage:fullscreen,.stage:-webkit-full-screen) .technical-strip,.cm-ecg-sim.is-ecg-only .technical-strip{flex-shrink:0;}
.ecg-paper-scroll {width:100%;min-width:0;min-height:0;max-height:var(--ecg-paper-height);overflow:auto;overscroll-behavior:contain;align-self:center;}
.ecg-paper-scroll:focus-visible {outline:3px solid #c77726;outline-offset:-3px;}
.cm-ecg-sim :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-paper-scroll,.cm-ecg-sim.is-ecg-only .ecg-paper-scroll {align-self:stretch;height:100%;max-height:none;}
.cm-ecg-sim .stage.is-paper-zoomed .ecg-paper-scroll .sheet {width:max(100%,900px)!important;min-width:900px!important;max-width:none!important;height:auto!important;max-height:none!important;}
@media(max-width:720px) {.ecg-paper-scroll {width:100%;}}
.cm-ecg-ad-label {display:block;text-align:center;font-size:.65rem;letter-spacing:.13em;text-transform:uppercase;color:#9eaec6;margin-bottom:12px;}
.ecg-preview-ad {display:grid;place-content:center;min-height:170px;border:1px dashed #435570;border-radius:12px;color:#acbcd2;text-align:center;font-size:.9rem;background:#101b2d;}
.ecg-preview-ad small {font-size:.75rem;color:#8196b2;line-height:2;}
/* Respond to the content width, including when the site's sidebar is expanded. */
@container ecg-case (min-width:960px) {
  .cm-ecg-sim.is-quiz .ecg-question-layout {grid-template-columns:minmax(0,1fr) clamp(310px,30%,390px);}
  .cm-ecg-sim.is-quiz .ecg-quiz {border-top:0;border-left:1px solid #354b66;align-self:stretch;max-height:max(460px,62dvh);overflow:auto;scrollbar-width:thin;}
  .cm-ecg-sim.is-quiz .ecg-answer-options {grid-template-columns:1fr;}
  .cm-ecg-sim.is-quiz :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-question-layout,.cm-ecg-sim.is-quiz.is-ecg-only .ecg-question-layout {grid-template-rows:minmax(180px,1fr);}
  .cm-ecg-sim.is-quiz :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-quiz,.cm-ecg-sim.is-quiz.is-ecg-only .ecg-quiz {max-height:none;min-height:0;}
}
@media (max-height:550px) {
  @container ecg-case (min-width:700px) {
    .cm-ecg-sim.is-quiz .ecg-question-layout {grid-template-columns:minmax(0,1fr) 300px;}
    .cm-ecg-sim.is-quiz .ecg-quiz {border-top:0;border-left:1px solid #354b66;max-height:320px;overflow:auto;}
    .cm-ecg-sim.is-quiz .ecg-answer-options {grid-template-columns:1fr;}
    .cm-ecg-sim.is-quiz :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-question-layout,.cm-ecg-sim.is-quiz.is-ecg-only .ecg-question-layout {grid-template-rows:minmax(180px,1fr);}
    .cm-ecg-sim.is-quiz :is(.stage:fullscreen,.stage:-webkit-full-screen) .ecg-quiz,.cm-ecg-sim.is-quiz.is-ecg-only .ecg-quiz {max-height:none;min-height:0;}
  }
}
@container ecg-case (max-width:800px) {
  .has-electric .ecg-paper-wrap {grid-template-columns:minmax(0,1fr);}
  .ecg-paper-wrap .ecg-electric {border-left:0;border-top:1px solid #3b4b61;display:grid;grid-template-columns:minmax(110px,180px) minmax(0,1fr);gap:10px 16px;padding:16px;}
  .ecg-paper-wrap .ecg-electric-header {grid-column:2;grid-row:1;}
  .ecg-paper-wrap .ecg-electric>svg {grid-column:1;grid-row:1/5;max-height:220px;}
  .ecg-paper-wrap .ecg-electric>p,.ecg-paper-wrap .ecg-electric-key {grid-column:2;}
}
@container ecg-case (max-width:450px) {
  .ecg-paper-wrap .ecg-electric {grid-template-columns:minmax(100px,1fr) minmax(0,1fr);padding:12px;gap:10px;}
  .ecg-paper-wrap .ecg-electric-header {grid-column:1/-1;grid-row:1;}
  .ecg-paper-wrap .ecg-electric>svg {grid-column:1;grid-row:2;max-height:200px;}
  .ecg-paper-wrap .ecg-electric #ecg-electric-phase {grid-column:2;grid-row:2;align-self:center;font-size:.78rem;}
  .ecg-paper-wrap .ecg-electric>p.ecg-muted,.ecg-paper-wrap .ecg-electric-key {grid-column:1/-1;}
}
.cm-ecg-sim.is-quiz .has-electric .ecg-paper-wrap {grid-template-columns:minmax(0,1fr);}
.cm-ecg-sim.is-quiz .ecg-paper-wrap .ecg-electric {border-left:0;border-top:1px solid #3b4b61;}
.cm-ecg-sim.is-quiz .ecg-paper-wrap .ecg-electric>svg {max-height:280px;}
.cm-ecg-sim.is-basic-reading-mode .ecg-case-workspace {display:none!important;}
