/* Hierarchy section: per-level turntable loops with a level stepper. Everything is prefixed hier-. */
.hier { --hier-accent: #2f6fd6; --hier-line: #e3e6eb; --hier-muted: #5c6470; color: #1f2328; }
.hier-btabs { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }
.hier-btab { border: 1px solid var(--hier-line); background: #fff; border-radius: 18px; padding: 4px 14px; cursor: pointer;
             font: inherit; font-size: 14px; color: #3a414a; }
.hier-btab.is-active { background: var(--hier-accent); border-color: var(--hier-accent); color: #fff; }
.hier-bld { display: none; }
.hier-bld.is-active { display: block; }

.hier-levels { display: flex; gap: 5px; margin-bottom: 10px; }
.hier-lvl { flex: 1 1 0; min-width: 0; position: relative; border: 0; border-radius: 8px; background: #f2f4f7; cursor: pointer;
            padding: 6px 4px 9px; font: inherit; color: var(--hier-muted); text-align: center; line-height: 1.15; }
.hier-lvl:hover { background: #e9edf3; }
.hier-lvl b { display: block; font-size: 13px; color: inherit; }
.hier-lvl span { display: block; font-size: 11px; }
.hier-lvl.is-active { background: #e6eefb; color: #1f2328; }
.hier-lvl.is-active b { color: var(--hier-accent); }
.hier-lvl i { position: absolute; left: 8px; right: 8px; bottom: 3px; height: 3px; border-radius: 2px; background: transparent; }
.hier-lvl.is-active i { background: var(--hier-accent); }

.hier-main { display: flex; gap: 22px; align-items: flex-start; }
.hier-stage { position: relative; flex: 0 0 44%; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden;
              background: #fff; border: 1px solid var(--hier-line); }
.hier-vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0;
            transition: opacity .35s ease; background: transparent; }
.hier-vid.is-on { opacity: 1; }
.hier-tag { position: absolute; left: 10px; top: 8px; font-size: 12px; font-weight: 700; color: var(--hier-accent);
            background: rgba(255,255,255,.85); padding: 1px 8px; border-radius: 10px; }

.hier-info { flex: 1 1 auto; min-width: 0; position: relative; }
.hier-card { display: none; font-size: 14.5px; line-height: 1.5; }
.hier-card.is-active { display: block; animation: hier-in .35s ease-out; }
@keyframes hier-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hier-card h3 { font-size: 19px; font-weight: 700; margin: 2px 0 6px; }
.hier-card h3 small { font-size: 13px; font-weight: 600; color: var(--hier-muted); margin-left: 6px; }
.hier-card p { margin: 0 0 8px; color: #3a414a; }
.hier-who { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 10px; margin-bottom: 6px; }
.hier-who.is-spec { background: #eef2f7; color: #4a5563; }
.hier-who.is-code { background: #e2ecfb; color: #1d4f9f; }
.hier-who.is-out { background: #fdeedd; color: #a24d06; }
.hier-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 3px 12px; margin: 6px 0 8px;
               font-size: 12.5px; }
.hier-legend div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hier-legend code, .hier-card code { font-size: 11.5px; background: #f2f4f7; color: #2b3440; padding: 0 4px; border-radius: 4px; }
.hier-sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hier-shapes { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin: 4px 0 2px; }
.hier-shapes figure { margin: 0; text-align: center; }
.hier-shapes img { display: block; max-height: 70px; max-width: 90px; margin: 0 auto; }
.hier-shapes figcaption { font-size: 10.5px; color: #8a919c; max-width: 90px; line-height: 1.2; margin-top: 2px; }
.hier-cap { font-size: 11.5px !important; color: #8a919c !important; margin: 0 0 6px !important; }
.hier-stats { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.hier-stats span { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #f2f4f7; color: #3a414a; }
.hier-ctl { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.hier-ctl button { border: 1px solid var(--hier-line); background: #fff; border-radius: 16px; height: 28px; padding: 0 12px;
                   cursor: pointer; font-size: 13px; color: #3a414a; }
.hier-ctl button:hover { background: #f2f4f7; }
.hier-ctl .hier-hint { font-size: 12px; color: #8a919c; }

@media (max-width: 860px) {
  .hier-levels { flex-wrap: wrap; }
  .hier-lvl { flex: 1 1 22%; }
  .hier-main { flex-direction: column; }
  .hier-stage { flex: none; width: 100%; max-width: 420px; margin: 0 auto; }
}
