/*! BetterHeart 心房顫動與血栓栓塞 3D © 2026 黃天祈醫師（Tien-Chi Huang, MD），保留所有權利。 */
/* layout on top of heart-anatomy/heart.css + atherosclerosis-3d/athero.css */
.af-app #viewport{height:clamp(440px,64vh,660px);margin-bottom:0;position:relative;background:radial-gradient(ellipse at 50% 45%,#fffdf9 0%,#f4ede3 78%)}
.af-app #viewport canvas{pointer-events:auto;touch-action:pan-y}
.af-app [hidden]{display:none!important}
.af-levels{grid-template-columns:1fr!important}.af-rhythm{grid-template-columns:1fr 1fr!important}.af-dests{grid-template-columns:1fr 1fr!important}
.af-levels button,.af-dests button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;line-height:1.35;text-align:left;position:relative}
.af-levels small,.af-dests small{font-size:11px;color:#8a7a6c;font-weight:400}.af-levels .active small,.af-dests .active small{color:inherit;opacity:.85}
.af-dests button{padding:7px 8px 7px 34px;min-height:46px}
.af-dests button b{position:absolute;left:7px;top:50%;transform:translateY(-50%);width:21px;height:21px;border-radius:50%;color:#fff;font-size:11.5px;display:inline-flex;align-items:center;justify-content:center}
/* labels on the 3D view */
.af-labels{position:absolute;inset:0;pointer-events:none;z-index:3;overflow:hidden}
.af-labels span,.af-labels button{position:absolute;transform:translate(-50%,-50%);white-space:nowrap;font:inherit;font-size:12px;line-height:1.3;padding:3px 7px;border-radius:6px;background:rgba(255,253,249,.92);border:1px solid #d8c9b8;color:#5c483c;box-shadow:0 1px 4px #6f514014}
.af-labels span.key{background:#332f2c;color:#fff;border-color:#332f2c;font-weight:700}
.af-labels span.warn{background:#b8322a;color:#fff;border-color:#b8322a;font-weight:700}
.af-labels .af-dest{pointer-events:auto;cursor:pointer;display:inline-flex;align-items:center;gap:5px;padding:3px 9px 3px 3px;border-radius:999px;color:#3b2d22}
.af-labels .af-dest b{width:20px;height:20px;border-radius:50%;color:#fff;font-size:11px;display:inline-flex;align-items:center;justify-content:center}
.af-labels .af-dest em{font-style:normal}
.af-labels .af-dest.compact{padding:2px;gap:0}.af-labels .af-dest.compact em{display:none}.af-labels .af-dest.compact:hover em{display:inline;margin:0 4px}
.af-labels .af-dest:hover,.af-labels .af-dest.focus{background:#332f2c;color:#fff;border-color:#332f2c;z-index:2}
/* ECG strip */
.af-ecg{position:absolute;top:10px;right:12px;z-index:5;margin:0;width:min(260px,46%);background:rgba(255,253,249,.94);border:1px solid #d8c9b8;border-radius:12px;padding:6px 8px;box-shadow:0 2px 10px #584a3620}
.af-ecg canvas{display:block;width:100%;height:auto}
.af-ecg figcaption{font-size:11.5px;font-weight:700;color:#3b2d22;line-height:1.4;margin-top:2px}
.af-ctl{top:auto!important;bottom:10px;left:12px}
.af-scale{top:auto!important;bottom:10px!important;left:auto!important;right:12px;max-width:52%}
.af-go{display:block;margin-top:10px;border:0;border-radius:10px;background:#596b60;color:#fff;font:inherit;font-weight:700;padding:9px 14px;cursor:pointer}
.af-go:hover{background:#4b5c51}
/* card under the caption */
.af-card{margin:12px 0;background:#fffdfa;border:1px solid var(--line,#e2d6c6);border-radius:14px;padding:14px 16px;font-size:14px;line-height:1.7}
.af-card h3{margin:0 0 8px;font-size:16.5px;display:flex;align-items:center;gap:8px}
.af-card h3 b,.af-others b{flex:none;width:24px;height:24px;border-radius:50%;color:#fff;font-size:12.5px;display:inline-flex;align-items:center;justify-content:center}
.af-card h4{margin:8px 0 2px;font-size:13px;color:#2f4a3a}.af-card section>h4:first-child{margin-top:0}
.af-card p{margin:0}.af-card ul{margin:0;padding-left:1.2em}
.af-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px 22px}.af-grid .wide{grid-column:1/-1}
.af-note{border-top:1px dashed #eadfcf;padding-top:8px;color:var(--muted,#7c746b);font-size:13px}
.af-why{margin:0;padding-left:1.3em}.af-why strong{display:block;color:#2f4a3a}
.af-links{margin-top:10px!important;font-size:13px}
.af-others{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-top:12px;font-size:12.5px}.af-others span{color:var(--muted,#7c746b)}
.af-others button{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line,#e2d6c6);border-radius:999px;background:#fff;color:var(--ink,#332f2c);font:inherit;font-size:12.5px;padding:3px 10px 3px 3px;cursor:pointer}
.af-others button b{background:var(--c);width:20px;height:20px;font-size:11px}
.af-others button:hover{background:#332f2c;color:#fff;border-color:#332f2c}
@media(max-width:650px){.af-app #viewport{height:clamp(320px,52vh,460px)}.af-grid{grid-template-columns:1fr}.af-scale{display:none}.af-dests small{display:none}.af-dests button{min-height:40px}.af-labels span,.af-labels button{font-size:11px}}
/* numbered stage chips under the view (same look as the procedure steps of the heart page) */
.af-chips{display:flex;flex-wrap:wrap;justify-content:center;gap:5px;padding:12px 14px 4px;background:#fbf8f3;border-top:1px solid var(--line,#e2d6c6)}
.af-chips button{font:inherit;font-size:13px;line-height:1.3;padding:4px 11px;border-radius:999px;border:1px solid #e0d4c6;background:#fff;color:#7c746b;cursor:pointer;display:inline-flex;gap:5px;align-items:center;touch-action:manipulation}
.af-chips button b{font-weight:700}
.af-chips button.done{color:#596b60;border-color:#b9c8bd}
.af-chips button.active{background:#955c4b;border-color:#955c4b;color:#fff}
.af-chips .af-replay{color:#955c4b;border-color:#d9b9ab}
.af-app #ticks{display:none}
.af-app .athero-caption b em{font-style:normal;color:#955c4b;margin-right:2px}
@media(max-width:650px){.af-chips{gap:4px;padding:10px 8px 2px}.af-chips button{font-size:12px;padding:3px 8px}.af-chips button{text-align:left}}
/* phone: level switch (and destination picker) above the 3D view instead of the drop-down */
.af-level-m,.af-dest-m{display:none}
@media(max-width:650px){
.af-app .quick-mode{display:none}
.af-level-m{display:flex;margin:10px 12px 0;border:1px solid var(--line,#e2d6c6);border-radius:10px;overflow:hidden;background:#fffdfa}
.af-level-m button{flex:1;border:0;background:transparent;color:var(--ink,#332f2c);padding:10px 6px;font:inherit;font-size:15px;font-weight:700;cursor:pointer;touch-action:manipulation}
.af-level-m button.active{background:var(--sage,#596b60);color:#fff}
.af-dest-m{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;margin:8px 12px 0}
.af-dest-m[hidden]{display:none}
.af-dest-m button{display:flex;flex-direction:column;align-items:center;gap:3px;border:1px solid var(--line,#e2d6c6);border-radius:10px;background:#fffdfa;color:var(--ink,#332f2c);padding:6px 2px;font:inherit;font-size:13px;line-height:1.2;cursor:pointer;touch-action:manipulation}
.af-dest-m button b{width:20px;height:20px;border-radius:50%;color:#fff;font-size:11px;display:inline-flex;align-items:center;justify-content:center}
.af-dest-m button.active{background:#332f2c;border-color:#332f2c;color:#fff}
}
/* Collapsible ECG overlay (and docked below viewport on phones) */
.af-ecg-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:2px}
.af-ecg-title{font-size:11px;font-weight:700;color:#5c483c;white-space:nowrap}
.af-ecg-fold{flex:none;border:1px solid var(--line,#e2d6c6);border-radius:999px;background:#fffdfa;color:#5c483c;font:inherit;font-size:10.5px;line-height:1.1;padding:2px 8px;cursor:pointer;min-height:22px}
.af-ecg-fold:hover{border-color:var(--accent,#955c4b);color:var(--accent,#955c4b);background:#f7efe8}
.af-ecg.folded{width:auto;padding:5px 10px}
.af-ecg.folded .af-ecg-head{margin-bottom:0;cursor:pointer}
.af-ecg.folded canvas,.af-ecg.folded figcaption{display:none}
.af-ecg.flow{position:static;width:auto;margin:6px 10px 6px;box-shadow:none;padding:6px 10px;border-radius:10px}
.af-ecg.flow canvas{height:52px;width:100%;object-fit:contain}
.af-ecg.flow figcaption{font-size:11.5px;margin-top:2px}
.af-ecg.flow.folded{padding:6px 10px}
