/* ==========================================================================
   HRT 计算器 · 私有样式
   —— 只做布局与动画；颜色一律引用 tools/tool.css 的语义令牌。
      例外：粉蓝白旗与曲线渐变用「跨性别旗」标准色（装饰性，仅本文件使用）。
   ========================================================================== */
:root {
  --flag-blue: #5BCEFA;
  --flag-pink: #F5A9B8;
  --flag-white: #FFFFFF;
  --ease-write: cubic-bezier(0.16, 1, 0.3, 1);
}

/* —— 顶部发丝旗带（个性化）—— */
.mtf-flag-band { display: flex; height: 3px; width: 100%; }
.mtf-flag-band i { flex: 1; }
.mtf-flag-band i:nth-child(1), .mtf-flag-band i:nth-child(5) { background: var(--flag-blue); }
.mtf-flag-band i:nth-child(2), .mtf-flag-band i:nth-child(4) { background: var(--flag-pink); }
.mtf-flag-band i:nth-child(3) { background: #cfd8dd; }

/* —— 页头 —— */
.mtf-head { position: relative; }
.mtf-hero { position: absolute; right: 0; top: -4px; width: 250px; opacity: .95; pointer-events: none; }
.mol-svg { width: 100%; height: auto; display: block; }
.m-orbit { fill: none; stroke: var(--flag-blue); stroke-width: 1; opacity: .3; transform-origin: 125px 80px; animation: orbitPulse 5s ease-in-out infinite; }
.m-orbit-2 { stroke: var(--flag-pink); animation-delay: -1.6s; }
@keyframes orbitPulse { 0%, 100% { transform: scale(1); opacity: .24; } 50% { transform: scale(1.06); opacity: .48; } }
.mol .mol-bond { fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: writeOn 1.05s var(--ease-write) forwards; }
.mol .mol-b1 { animation-delay: .16s; }
.mol .mol-b2 { animation-delay: .32s; }
.mol .mol-b3 { animation-delay: .48s; }
.mol .mol-bond2 { fill: none; stroke: var(--text); stroke-width: 1.3; opacity: .8; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: writeOn 1.05s var(--ease-write) .55s forwards; }
.mol .mol-sub { stroke: var(--text-2); stroke-width: 1.4; }
.mol .mol-txt { font-size: 11px; font-weight: 700; fill: var(--text-2); font-family: 'english', 'chinese', sans-serif; }
.mol .mol-cap { font-size: 9px; letter-spacing: .14em; fill: var(--text-3); font-family: 'english', monospace; }
@keyframes writeOn { to { stroke-dashoffset: 0; } }

.mtf-note { margin: .5rem 0 1rem; font-size: .78rem; color: var(--text-2);
  border-left: 3px solid var(--flag-pink); padding-left: .6rem; }
.mtf-note strong { color: var(--accent-strong); font-weight: 700; }
.mtf-note-sm { margin-top: .5rem; font-size: .74rem; color: var(--text-3); line-height: 1.5; }

/* —— 单页板块：竖排 + 小标题分隔（原来靠 tab 切换）—— */
.mtf-panel { margin-top: 1.6rem; }
.mtf-panel:first-of-type { margin-top: 0; }
.mtf-block-title { position: relative; margin: 0 0 .75rem; padding-left: .65rem;
  font-size: .95rem; font-weight: 700; letter-spacing: .02em; color: var(--text-2); }
.mtf-block-title::before { content: ""; position: absolute; left: 0; top: .12em; bottom: .12em;
  width: 3px; border-radius: 2px; background: var(--card-accent, var(--accent)); }

/* —— 卡片标题下划线「书写」+ 行错峰 —— */
.card-title { position: relative; padding-bottom: 4px; }
.mtf-panel.is-anim .card-title::after {
  content: ""; position: absolute; left: 0; bottom: -4px; height: 2px; width: 30px;
  background: var(--card-accent, var(--accent)); transform-origin: left;
  animation: writeBar .52s var(--ease-write) both;
}
@keyframes writeBar { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.mtf-cols { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 1rem; }
.mtf-cols > .glass-card { align-self: start; }

/* —— 按钮 —— */
.mtf-btn { margin-top: .6rem; border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text-2); border-radius: 8px; padding: .4rem .8rem; font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: .16s; }
.mtf-btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.mtf-btn:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 1px; }

/* —— 参考区间游标 —— */
.mtf-range { margin-top: .6rem; }
.mtf-range-track { position: relative; height: 12px; border-radius: 999px; background: var(--surface-3); }
.mtf-range-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px;
  background: linear-gradient(90deg, rgba(91, 206, 250, .45), rgba(245, 169, 184, .5));
  transition: left .45s var(--ease-write), width .45s var(--ease-write); }
.mtf-range-cursor { position: absolute; top: -4px; width: 3px; height: 20px; border-radius: 2px;
  background: var(--accent-strong); box-shadow: 0 0 0 3px var(--accent-soft);
  transition: left .45s var(--ease-write), opacity .2s; }
.mtf-range-ends { display: flex; justify-content: space-between; margin-top: .35rem; font-size: .72rem; color: var(--text-3); }
.mtf-verdict { margin-top: .5rem; font-size: .82rem; color: var(--text-2); font-weight: 600; }

/* —— 曲线 —— */
.mtf-chart { width: 100%; }
.ch-svg { width: 100%; height: auto; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-axis { stroke: var(--border-strong); stroke-width: 1.2; }
.ch-ytick, .ch-xtick, .ch-unit { fill: var(--text-3); font-size: 9px; font-family: 'english', monospace; }
.ch-axis-label { fill: var(--text-3); font-size: 9px; }
.ch-band { fill: rgba(var(--macaron-mint-rgb), .10); stroke: rgba(var(--macaron-mint-rgb), .35); stroke-dasharray: 4 4; }
.ch-band-label { fill: var(--macaron-mint-ink); font-size: 9px; }
.ch-area { fill: url(#mtfArea); opacity: 0; animation: areaIn .9s var(--ease-write) .25s forwards; }
@keyframes areaIn { to { opacity: 1; } }
.ch-line { fill: none; stroke: url(#mtfLine); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: writeOn .95s var(--ease-write) forwards; }
.ch-dot { stroke: var(--text); stroke-width: 1.4; opacity: 0; animation: popIn .3s var(--ease-write) .95s forwards; }
.ch-dot-peak { fill: var(--flag-blue); }
.ch-dot-trough { fill: var(--flag-pink); }
.ch-mark-line { stroke: var(--border-strong); stroke-dasharray: 3 3; opacity: 0; animation: areaIn .3s .95s forwards; }
.ch-tag { font-size: 10px; font-weight: 700; opacity: 0; animation: popIn .3s var(--ease-write) 1.05s forwards; }
.ch-tag-peak { fill: var(--macaron-sky-ink); }
.ch-tag-trough { fill: var(--macaron-pink-ink); }
@keyframes popIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* —— 读数块 —— */
.mtf-readout-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: .8rem; }
.mtf-readout { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: .5rem .65rem; }
.mtf-ro-k { display: block; font-size: .72rem; color: var(--text-3); }
.mtf-ro-v { display: block; font-size: 1.12rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

/* —— 等效剂量表 —— */
.mtf-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.mtf-table th, .mtf-table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); }
.mtf-table thead th { color: var(--text-3); font-weight: 600; font-size: .76rem; }
.mtf-table .eq-route { font-weight: 700; color: var(--text); }
.mtf-panel.is-anim .eq-row { animation: rowIn .5s var(--ease-write) both; animation-delay: calc(var(--i) * 55ms); }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.mtf-refs { margin-top: .6rem; font-size: .72rem; color: var(--text-3); }

/* —— 给药途径 —— */
.routes-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.routes-wrap { display: grid; gap: 1rem; }
.route-block { position: relative; border: 1px solid var(--border); border-radius: 14px; background: var(--surface, #fff); padding: 1rem 1.1rem; }
.route-block::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 2px; background: var(--route-c, var(--accent)); }
.route-lilac { --route-c: #7c6cf0; }
.route-sand { --route-c: #d9822b; }
.route-mint { --route-c: #12a594; }
.route-peach { --route-c: #e0526a; }
.route-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding-left: .6rem; }
.route-badge { font-size: .68rem; font-weight: 700; letter-spacing: .08em; color: #fff; background: var(--route-c, var(--accent)); border-radius: 999px; padding: .15rem .55rem; }
.route-title { margin: 0; font-size: 1.02rem; font-weight: 800; color: var(--text); }
.route-lead { flex-basis: 100%; margin: .1rem 0 0; font-size: .8rem; color: var(--text-2); }
.route-body { display: grid; grid-template-columns: minmax(0, 250px) minmax(0, 1fr) minmax(0, 320px); gap: 1rem; margin-top: .9rem; padding-left: .6rem; }
.route-mol, .route-chart { align-self: start; }
.route-info { display: grid; gap: .6rem; }
.rt-item { border: 1px solid var(--border); border-radius: 10px; padding: .6rem .7rem; background: var(--surface-2); }
.rt-name { font-size: .86rem; font-weight: 700; color: var(--text); }
.rt-brand { margin-top: .1rem; font-size: .68rem; color: var(--text-3); }
.rt-fields { margin: .4rem 0 0; display: grid; gap: .15rem; }
.rt-field { display: flex; gap: .4rem; font-size: .76rem; }
.rt-field dt { flex: 0 0 4.6rem; color: var(--text-3); }
.rt-field dd { margin: 0; color: var(--text-2); }
.rt-pros, .rt-cons { margin: .35rem 0 0; font-size: .75rem; line-height: 1.5; }
.rt-pros { color: var(--macaron-mint-ink); }
.rt-cons { color: var(--macaron-pink-ink); }
.rt-pros b, .rt-cons b { margin-right: .35rem; font-size: .68rem; opacity: .85; }
.rt-note { margin: .3rem 0 0; font-size: .7rem; color: var(--text-3); }
.route-chart-cap { font-size: .72rem; color: var(--text-3); margin-bottom: .2rem; }
.route-more { margin: .7rem 0 0; padding-left: .6rem; font-size: .74rem; color: var(--text-3); line-height: 1.55; }

/* —— 对比曲线图例 / 条形 —— */
.cmp-legend { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .3rem; }
.cmp-lg { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; color: var(--text-2); }
.cmp-lg i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.bar-label { fill: var(--text-2); font-size: 11px; }
.bar-track { fill: var(--surface-3); }
.bar-val { fill: var(--text-3); font-size: 10px; }

/* —— 注射区块：部位选择器 + 方法 —— */
.inject-host { margin-top: 1rem; padding-left: .6rem; }
.inj-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 250px); gap: 1rem; }
.inj-cap { font-size: .72rem; color: var(--text-3); margin-bottom: .3rem; }
.inj-map-svg { width: 100%; height: auto; }
.sfig { fill: var(--surface-3); stroke: var(--border-strong); stroke-width: 1; }
.sfig-cap { fill: var(--text-3); font-size: 10px; }
.site-dot { cursor: pointer; }
.site-dot circle { fill: var(--surface, #fff); stroke: var(--route-c, var(--accent)); stroke-width: 2; transition: .15s; }
.site-dot.is-on circle { fill: var(--route-c, var(--accent)); }
.site-lab { fill: var(--text-2); font-size: 10px; pointer-events: none; }
.site-dot.is-on .site-lab { fill: var(--route-c, var(--accent)); font-weight: 700; }
.inj-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.inj-chip { border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); border-radius: 999px; padding: .2rem .6rem; font-size: .74rem; cursor: pointer; transition: .15s; }
.inj-chip:hover { border-color: var(--route-c, var(--accent)); color: var(--accent-strong); }
.inj-chip.is-on { border-color: var(--route-c, var(--accent)); color: #fff; background: var(--route-c, var(--accent)); }
.inj-detail { align-self: start; border: 1px solid var(--border); border-radius: 10px; padding: .6rem .7rem; background: var(--surface-2); }
.inj-detail-name { display: flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--text); }
.inj-tag { font-size: .66rem; font-weight: 600; color: var(--route-c, var(--accent)); border: 1px solid currentColor; border-radius: 999px; padding: .05rem .4rem; }
.inj-method { margin-top: 1rem; }
.inj-method-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.inj-method-svg { width: 100%; height: auto; margin-top: .4rem; }
.inj-tip { margin: .4rem 0 0; font-size: .75rem; color: var(--text-2); }
.ml-skin { fill: #f4d8c6; }
.ml-fat { fill: #f7e6a8; }
.ml-muscle { fill: #d98b8b; opacity: .8; }
.ml-lab { fill: var(--text-3); font-size: 10px; }
.syringe { fill: var(--surface-2); stroke: var(--text-2); stroke-width: 1.2; }
.needle-line { stroke: var(--text); stroke-width: 2; stroke-linecap: round; animation: needleIn .5s var(--ease-write) both; }
.hub { fill: var(--text-2); }
.ang-arc { stroke: var(--text-3); stroke-dasharray: 3 3; }
.ang-lab { fill: var(--text-3); font-size: 11px; font-family: 'english', monospace; }
.pinch { fill: none; stroke: var(--text-3); stroke-width: 1.2; stroke-dasharray: 4 3; }
@keyframes needleIn { from { transform: translateY(-14px); } to { transform: translateY(0); } }

/* —— 抗雄区块：受体拮抗示意 —— */
.rc-pocket { fill: none; stroke: var(--text-2); stroke-width: 2; }
.rc-lig { fill: var(--flag-pink); stroke: var(--text); stroke-width: 1.2; }
.rc-block { stroke: var(--macaron-pink-ink); stroke-width: 2.4; stroke-linecap: round; }

@media (max-width: 1024px) {
  .mtf-cols { grid-template-columns: 1fr; }
  .routes-overview { grid-template-columns: 1fr; }
  .route-body { grid-template-columns: 1fr; }
  .inj-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .mtf-hero { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .mol-bond, .mol-bond2, .ch-line, .ch-area, .ch-dot, .ch-tag, .ch-mark-line, .needle-line,
  .mtf-panel.is-anim .card-title::after, .mtf-panel.is-anim .eq-row, .m-orbit {
    animation: none !important; stroke-dashoffset: 0; opacity: 1;
  }
  .needle-line { transform: none !important; }
  .mtf-range-fill, .mtf-range-cursor, .site-dot circle, .inj-chip { transition: none; }
}
