.tie-guide {
  color: #182d32;
  background: #fff;
  border: 1px solid #9cafa9;
  border-radius: 12px;
  width: min(37rem, calc(100% - 2rem));
  max-width: none;
  max-height: 90vh;
  max-height: 90dvh;
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  font-family: var(--sans, Arial, sans-serif);
  box-shadow: 0 18px 70px #122d343e;
}

.tie-guide::backdrop { background: #0b2028ac; }
.tie-guide [hidden] { display: none !important; }
.tie-guide :is(h2, h3, p, figure) { margin: 0; }
.tie-guide__head,
.tie-guide__controls,
.tie-guide__sources {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding-inline: clamp(.9rem, 3.5vw, 1.4rem);
}
.tie-guide__head {
  position: sticky;
  top: 0;
  z-index: 1;
  justify-content: space-between;
  padding-block: .6rem;
  border-bottom: 1px solid #d6ddd7;
  background: #fff;
}
.tie-guide__head h2 { font-size: clamp(1.12rem, 3vw, 1.45rem); letter-spacing: -.03em; }
.tie-guide button {
  min-height: 44px;
  padding: .55rem .85rem;
  border: 1px solid #92a7a2;
  border-radius: 5px;
  font: 700 .9rem/1.2 var(--sans, Arial, sans-serif);
  color: #1d3c40;
  background: #fff;
  cursor: pointer;
}
.tie-guide button:hover:enabled { border-color: var(--lor-core); background: var(--lor-fog); }
.tie-guide :is(a, button):focus-visible { outline: 3px solid var(--lor-signal); outline-offset: 2px; }
.tie-guide button:disabled { opacity: .44; cursor: default; }
.tie-guide__figure { border-bottom: 1px solid #d6ddd7; background: #f7f5e9; }
.tie-guide__image { position: relative; margin-inline: auto; max-width: 32rem; }
.tie-guide__image img,
.tie-guide__marks { display: block; width: 100%; height: auto; }
.tie-guide__marks { position: absolute; inset: 0; pointer-events: none; }
.tie-guide__openings,
.tie-guide__strip { display: none; fill: none; }
.tie-guide[data-stage="1"] .tie-guide__openings { display: block; stroke: #996200; stroke-width: 4; }
.tie-guide[data-stage="2"] .tie-guide__strip {
  display: block;
  stroke: #106354;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 13 10;
}
@media (prefers-reduced-motion: no-preference) {
  .tie-guide[data-playing="true"][data-stage="2"] .tie-guide__strip {
    animation: tie-guide-dashes 1.4s linear infinite;
  }
  @keyframes tie-guide-dashes { to { stroke-dashoffset: -46; } }
}
.tie-guide figcaption {
  padding: .4rem clamp(.9rem, 3.5vw, 1.4rem) .65rem;
  color: #485c53;
  font-size: .81rem;
  line-height: 1.4;
}
.tie-guide__stage { padding: 1.05rem clamp(.9rem, 3.5vw, 1.4rem) .85rem; }
.tie-guide__count {
  color: var(--lor-technical);
  font: 650 .72rem/1.45 var(--mono, monospace);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.tie-guide__stage h3 { margin: .2rem 0 .28rem; font-size: clamp(1.35rem, 4vw, 1.65rem); letter-spacing: -.035em; }
.tie-guide__instruction { color: #2a4044; font-size: 1rem; line-height: 1.5; }
.tie-guide__controls { flex-wrap: wrap; justify-content: flex-start; padding-block: 0 .95rem; }
.tie-guide__controls [data-play] { background: var(--lor-core); border-color: var(--lor-core); color: white; }
.tie-guide__controls [data-play]:hover:enabled { background: var(--lor-technical); color: white; }
.tie-guide__sources { flex-wrap: wrap; column-gap: 1rem; row-gap: 0; border-top: 1px solid #d6ddd7; }
.tie-guide__sources a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--lor-core);
  font: 650 .84rem/1.3 var(--sans, Arial, sans-serif);
  text-underline-offset: .16em;
}
@media (max-width: 28rem) {
  .tie-guide { width: calc(100% - 1rem); max-height: 94dvh; }
  .tie-guide__controls button { flex: 1 1 auto; }
}
