/* hero widget styles (mount #tb-hero; classes .tbh-*) */
#tb-hero { isolation: isolate;
  background: radial-gradient(120% 90% at 50% 38%, var(--surface) 55%, var(--surface-2) 100%); }
#tb-hero { container: tbh / inline-size; }
/* keep the scene roomy where the card is narrow (phones, and the two-column layout on small laptops) */
@media (max-width: 600px), (min-width: 861px) and (max-width: 1100px) { #tb-hero { aspect-ratio: 4 / 5; } }
@media (min-width: 601px) and (max-width: 860px) { #tb-hero { aspect-ratio: 5 / 4; } }

#tb-hero .tbh-stage { position: absolute; inset: 0; z-index: 0; user-select: none; -webkit-user-select: none; }

/* top row: legend + schematic tag */
#tb-hero .tbh-top { position: absolute; top: 12px; left: 14px; right: 14px; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; pointer-events: none; }
#tb-hero .tbh-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font: 500 12px/1.6 var(--sans); color: var(--muted); }
#tb-hero .tbh-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#tb-hero .tbh-legend__hn { color: var(--ours-ink); transition: opacity .3s; }
#tb-hero .tbh-k { display: inline-block; flex: none; }
#tb-hero .tbh-k--img { width: 9px; height: 9px; border-radius: 3px; background: var(--img); }
#tb-hero .tbh-k--txt { width: 9px; height: 9px; border-radius: 50%; background: var(--txt); }
#tb-hero .tbh-k--hn { width: 16px; height: 0; border-top: 2px dashed var(--ours); }
#tb-hero .tbh-tag { flex: none; font: 600 12px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 5px 9px; border: 1px solid var(--rule-2); border-radius: 999px; background: color-mix(in srgb, var(--surface) 80%, transparent); }

/* labels that follow the scene */
#tb-hero .tbh-lab { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; white-space: nowrap; will-change: transform; }
#tb-hero .tbh-lab--hub { font: 700 12px/1 var(--sans); letter-spacing: .04em; color: var(--bad); background: var(--bad-soft); padding: 3px 7px; border-radius: 999px; }
#tb-hero .tbh-gap { display: grid; font: 600 12px/1 var(--sans); }
#tb-hero .tbh-gap > span { grid-area: 1 / 1; justify-self: center; padding: 4px 9px; border-radius: 999px; }
#tb-hero .tbh-gap__a { color: var(--ink-2); background: color-mix(in srgb, var(--surface) 85%, transparent); }
#tb-hero .tbh-gap__b { color: var(--good); background: var(--good-soft); }

/* bottom panel */
#tb-hero .tbh-panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 12px 16px 14px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--surface) 0%, transparent), var(--surface) 16px); }
#tb-hero .tbh-text { transition: opacity .2s ease, transform .2s ease; }
#tb-hero .tbh-text.is-swap { opacity: 0; transform: translateY(4px); }
#tb-hero .tbh-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; min-height: 34px; }
#tb-hero .tbh-title { margin: 0; font: 600 clamp(1.08rem, 1.6vw, 1.25rem)/1.2 var(--serif); letter-spacing: -0.01em; color: var(--ink); }
#tb-hero[data-act="3"] .tbh-title { color: var(--ours-ink); }
#tb-hero .tbh-cap { margin: 4px 0 0; font-size: 0.84rem; line-height: 1.45; color: var(--ink-2); min-height: 2.9em; max-width: 60ch; }

#tb-hero .tbh-ro { display: flex; align-items: center; gap: 7px; flex: none; }
#tb-hero .tbh-ro.is-empty { visibility: hidden; }
#tb-hero .tbh-ro__v { font: 650 1.3rem/1 var(--mono); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
#tb-hero .tbh-ro__l { display: flex; flex-direction: column; font: 500 12px/1.2 var(--sans); color: var(--muted); }
#tb-hero .tbh-ro--bad .tbh-ro__v { color: var(--bad); }
#tb-hero .tbh-ro--ours .tbh-ro__v { color: var(--ours); }

#tb-hero .tbh-controls { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
#tb-hero .tbh-pills { display: flex; gap: 6px; flex: 1 1 auto; min-width: 0; }
#tb-hero .tbh-pill { position: relative; overflow: hidden; flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface-2); color: var(--muted);
  font: 600 12px/1 var(--sans); cursor: pointer; transition: color .2s, border-color .2s, background .2s; --p: 0; --pc: var(--neutral); --ps: var(--neutral-soft); }
#tb-hero .tbh-pill--bad { --pc: var(--bad); --ps: var(--bad-soft); }
#tb-hero .tbh-pill--ours { --pc: var(--ours); --ps: var(--ours-soft); }
#tb-hero .tbh-pill:hover { color: var(--ink); border-color: var(--rule-2); }
#tb-hero .tbh-pill.is-on { color: var(--ink); border-color: color-mix(in srgb, var(--pc) 55%, var(--rule)); background: var(--surface); }
#tb-hero .tbh-pill__fill { position: absolute; left: 0; bottom: 0; height: 100%; width: 0; background: var(--ps); z-index: 0; }
#tb-hero .tbh-pill.is-on .tbh-pill__fill { width: calc(var(--p) * 1%); }
#tb-hero .tbh-pill__fill::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--pc); }
#tb-hero .tbh-pill:not(.is-on) .tbh-pill__fill { display: none; }
#tb-hero .tbh-pill__n, #tb-hero .tbh-pill__t { position: relative; z-index: 1; }
#tb-hero .tbh-pill__n { width: 16px; height: 16px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; letter-spacing: 0;
  background: var(--rule); color: var(--ink-2); flex: none; }
#tb-hero .tbh-pill.is-on .tbh-pill__n { background: var(--pc); color: var(--surface); }
#tb-hero .tbh-pill__t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tb-hero .tbh-pill:focus-visible, #tb-hero .tbh-play:focus-visible { outline: 2px solid var(--ours); outline-offset: 2px; }

#tb-hero .tbh-play { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--rule-2); background: var(--surface); color: var(--ink-2);
  display: grid; place-items: center; cursor: pointer; padding: 0; transition: border-color .2s, color .2s, transform .15s; }
#tb-hero .tbh-play:hover { border-color: var(--ours); color: var(--ink); }
#tb-hero .tbh-play:active { transform: scale(.94); }
#tb-hero .tbh-play svg { width: 13px; height: 13px; fill: currentColor; display: block; }

@container tbh (max-width: 440px) {
  #tb-hero .tbh-panel { padding: 10px 12px 12px; }
  #tb-hero .tbh-pills { gap: 5px; }
  #tb-hero .tbh-pill { flex: 1 1 auto; padding: 0 8px; gap: 5px; }
  #tb-hero .tbh-pill__n { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #tb-hero .tbh-text, #tb-hero .tbh-pill, #tb-hero .tbh-legend__hn { transition: none; }
}
