@import url("../css/tokens.css");

* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 2.5rem 1.25rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
}
.shell { max-width: 1080px; margin: 0 auto; }
.masthead { margin-bottom: 1.35rem; }
.eyebrow, .kicker {
  margin: 0 0 .5rem;
  color: var(--teal);
  font: .7rem var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
h1, h2 { font-family: var(--serif); font-weight: 600; }
h1 { max-width: 700px; margin: 0 0 .55rem; font-size: 1.85rem; line-height: 1.1; letter-spacing: -.01em; }
h2 { margin: 0; font-size: 1.25rem; }
.lede { max-width: 680px; margin: 0; color: var(--sub); line-height: 1.55; }
.controls, .stage-card, .info-card { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; }
.controls { display: flex; align-items: end; flex-wrap: wrap; gap: .6rem; padding: .8rem; margin-bottom: 1rem; }
.perm-field { flex: 1 1 300px; min-width: 220px; }
.perm-field span { display: block; margin: 0 0 .3rem .15rem; color: var(--sub); font: .67rem var(--mono); letter-spacing: .07em; text-transform: uppercase; }
input[type="text"], input:not([type]) { min-width: 0; }
.perm-field input { width: 100%; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); font: .9rem var(--mono); }
button { border: 1px solid var(--line); border-radius: 7px; padding: .65rem .85rem; color: var(--ink); background: transparent; cursor: pointer; font: .75rem var(--mono); }
button:hover { border-color: var(--teal); color: var(--teal); }
button:disabled { opacity: .35; cursor: default; border-color: var(--line); color: var(--sub); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
button.primary { border-color: var(--teal); background: var(--teal); color: white; }
button.primary:hover { background: color-mix(in srgb, var(--teal) 85%, black); color: white; }
button.secondary { background: var(--teal-soft); border-color: transparent; }
button.icon { padding: .53rem .78rem; font-size: 1.2rem; line-height: 1; }
button.icon.edge { font-size: .82rem; }
.status { align-self: center; min-width: 7rem; color: var(--sub); font: .7rem var(--mono); }
.stage-card { overflow: hidden; }
.stage-head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding: 1.05rem 1.2rem .8rem; border-bottom: 1px solid var(--line); }
.card-heading { display: flex; align-items: start; justify-content: space-between; gap: .8rem; }
.info-button, .modal-close { display: grid; place-items: center; width: 2rem; height: 2rem; padding: .3rem; border: 1px solid var(--line); border-radius: 50%; color: var(--sub); }
.info-button svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.info-button:hover, .modal-close:hover { color: var(--teal); border-color: var(--teal); }
.modal-close { font: 1.35rem/1 var(--sans); }
.facts { color: var(--sub); font: .7rem var(--mono); text-align: right; line-height: 1.7; }
.builder-grid { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(300px, .78fr); gap: 1.5rem; align-items: start; }
.stage-wrap { display: grid; place-items: center; min-height: 360px; padding: 1.1rem; background: var(--panel); }
.stage { width: min(100%, 540px); }
.stage svg { display: block; width: 100%; height: auto; overflow: visible; }
.canvas-bg { fill: var(--panel); stroke: var(--ink); stroke-width: 2; }
.room { stroke: var(--panel); stroke-width: 2; }
.room.active { stroke: var(--ink); stroke-width: 3; }
.room.blocked { stroke: var(--red); stroke-width: 3; }
.blocked-boundary .canvas-bg { stroke: var(--red); }
.room-label { font-family: var(--mono); font-size: 11px; fill: var(--room-ink); opacity: .8; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.room-label.pending { opacity: .28; }
.split-line { stroke: var(--teal); stroke-width: .075; stroke-dasharray: .16 .12; vector-effect: non-scaling-stroke; opacity: .9; }
.timeline-wrap { padding: .85rem 1.2rem 1rem; border-top: 1px solid var(--line); }
#timeline { width: 100%; accent-color: var(--teal); }
.timeline-labels { display: flex; justify-content: space-between; color: var(--sub); font: .65rem var(--mono); }
.side-stack { display: grid; gap: 1.5rem; }
.info-card { min-height: 150px; padding: 1.1rem 1.2rem; box-shadow: 0 1px 4px rgba(0, 0, 0, .04); }
.muted { color: var(--sub); line-height: 1.5; }
.move-log { display: grid; gap: .55rem; max-height: 310px; overflow: auto; margin-top: .85rem; padding-right: .25rem; }
.log-line { width: 100%; padding: .55rem .65rem; border-left: 3px solid var(--line); background: color-mix(in srgb, var(--bg) 55%, var(--panel)); color: var(--sub); cursor: pointer; font: .82rem/1.45 var(--sans); text-align: left; }
.log-line:hover { border-color: var(--teal); color: var(--ink); }
.log-line.split { border-left-color: var(--teal); }
.log-line.extension { border-left-color: var(--amber); }
.log-line.blocked { border-left-color: var(--red); }
.log-line.latest { color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.sequence { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .85rem; }
.seq-item { display: grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid var(--line); border-radius: 6px; color: var(--sub); font: .78rem var(--mono); }
.seq-item.done { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); }
.seq-item.active { border-color: var(--ink); background: var(--amber); color: var(--ink); transform: translateY(-2px); }
.match-note { margin: .9rem 0 0; color: var(--sub); font: .72rem var(--mono); }
.match-note.good { color: var(--teal); }
.error { min-height: 1.3rem; margin: .9rem 0; color: var(--red); font: .78rem var(--mono); }
footer { margin-top: 1.4rem; color: var(--sub); font: .68rem var(--mono); }
.rules-dialog { width: min(92vw, 520px); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); box-shadow: 0 18px 60px rgba(35, 38, 43, .22); }
.rules-dialog::backdrop { background: rgba(35, 38, 43, .38); }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.25rem .95rem; border-bottom: 1px solid var(--line); }
.rules-content { padding: 1rem 1.25rem 1.25rem; color: var(--sub); line-height: 1.55; }
.rules-content p { margin: 0 0 .9rem; }
.rules-content p:last-child { margin-bottom: 0; }
.rules-content ol { margin: 0 0 .9rem; padding-left: 1.35rem; }
.rules-content li { padding-left: .25rem; margin: .45rem 0; }
.rules-content strong { color: var(--ink); font-family: var(--mono); font-weight: 600; }
@media (max-width: 760px) {
  body { padding-top: 1.4rem; }
  .stage-wrap { min-height: 300px; }
  .builder-grid { grid-template-columns: 1fr; }
  .stage-head { flex-direction: column; }
  .facts { text-align: left; }
  .status { flex: 1 0 100%; }
}

/* Navigation between the explorer and the two branch pages. Deliberately quiet -- it lives in the
   eyebrow line, the same register as the "deeper:" line in the explorer's mosaic caption that
   sends you here, so the two ends of the trip look like each other. */
.branch-link {
  color: var(--teal);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--teal) 35%, transparent);
}
.branch-link:hover { border-bottom-color: var(--teal); }
