.ms-section { color:var(--ink); }
.ms-section .section-title { max-width: 22em; }
.ms-board { margin-top: clamp(1.25rem, 2.2vw, 2rem); border:1px solid var(--rule); border-radius:var(--panel-radius); overflow:clip; background:var(--surface); }
.ms-toolbar { display: flex; align-items: stretch; justify-content: space-between; background: var(--night); color: #f7f7ef; border-bottom: 1px solid #38525d; }
.ms-chapters { display: flex; }
.ms-chapters button, .ms-transport { border: 0; background: transparent; color: #c6d7dc; font:var(--tab-face); }
.ms-chapters button { position: relative; padding: 1rem clamp(.85rem, 2.2vw, 2.3rem); border-right: 1px solid #49616b; }
.ms-chapters button[aria-pressed="true"] { color: #fff7e6; background: var(--dark-panel); }
.ms-chapters button i { position: absolute; height: 2px; inset: auto 0 0; background: var(--amber); transform-origin: left; transform: scaleX(var(--ms-progress,0)); }
.ms-chapters button:hover, .ms-transport:hover { color: #fff6df; background: #324e5b; }
.ms-transport { padding-inline: 1.1rem; display: inline-flex; justify-content: center; align-items: center; gap: .5rem; min-width: 5.7rem; }
.ms-transport i { width: 0; height: 0; border-block: .3rem solid transparent; border-left: .5rem solid currentColor; }
.ms-transport[data-playing="true"] i { width: .53rem; height: .68rem; border-block: 0; border-inline: .17rem solid currentColor; }
.ms-transport[data-replay="true"] i { border: 0; width: auto; height: auto; font-size: 1.05rem; }
.ms-transport[data-replay="true"] i::after { content: '↻'; }
.ms-stage { padding: clamp(.3rem, 1vw, .9rem) clamp(.3rem, 1.4vw, 1.5rem); }
.ms-stage svg { display: block; width: 100%; height: auto; max-height: 24rem; margin: auto; }
.ms-stage[data-compact="true"] svg { max-height: 28rem; }
.ms-stage svg text { font-family: var(--sans); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.ms-stage .ms-label { fill: #203d49; font-size: 17px; font-weight: 600; }
.ms-stage .ms-sub { fill: #4f6874; font-size: 14px; }
.ms-stage .ms-token-label { font-family: var(--sans); font-weight: 650; fill: #214250; stroke: none; }
.ms-stage .ms-path { fill: none; stroke: #7398ad; stroke-width: 1.75; stroke-linecap: round; }
.ms-stage .ms-path.ms-action { stroke: #bb956d; }
.ms-stage .ms-path.ms-neutral { stroke: #9eafb9; }
.ms-stage .ms-back { fill: #fff; stroke: #9eb1b7; stroke-width: 1.5; }
.ms-caption { display: flex; align-items: center; justify-content: space-between; gap: 1.3rem; border-top:1px solid var(--rule); background:var(--surface); padding: .9rem clamp(.85rem, 1.8vw, 1.6rem); color:var(--muted); }
.ms-caption p { color:var(--muted); font:var(--caption-face); max-width:var(--reading-measure); margin: 0; }
.ms-caption a { color: #2f657c; white-space: nowrap; font: 600 .88rem/1.4 var(--sans); text-underline-offset: .24em; }
@media(max-width:700px) {
  .ms-section .ms-board { margin-top: 1.15rem; }
  .ms-chapters { flex: 1; }
  .ms-chapters button { flex: 1; padding: .72rem .38rem; font-size:var(--tab-size); }
  .ms-transport { min-width: 4rem; padding-inline: .35rem; font-size: .83rem; gap: .32rem; }
  .ms-caption { display: block; }
  .ms-caption p { font-size: .94rem; }.ms-caption a { display: inline-block; margin-top: .47rem; }
}

.ms-chapters button[aria-pressed=true] { font-weight:600; }
@media (min-width: 1500px) {
  .ms-stage svg {
    max-height: max(10rem,min(56svh,calc(100svh - 27.5rem)));
  }
  .ms-stage { padding-block: clamp(.3rem,1svh,.9rem); }
}
@media (min-width: 1500px) and (min-aspect-ratio: 2/1) {
  .ms-board .reader-content {
    display:grid; grid-template-columns:minmax(0,1fr) clamp(14rem,17%,24rem);
    align-items:center;
  }
  .ms-board .reader-content .ms-stage { min-width:0; }
  .ms-board .reader-content svg { max-height:max(10rem,min(58svh,calc(100svh - 22.5rem))); }
  .ms-board .ms-caption {
    flex-direction:column; justify-content:center; align-items:start; align-self:stretch;
    border-block-start:0; border-inline-start:1px solid var(--rule);
  }
}
