/* Mint view: the linked position. Readout + rail first, then slip + tier list. */
.stage, .work { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: stretch; }
.work { margin-top: 20px; align-items: start; }

/* ---------- readout ---------- */
.readout { padding: clamp(18px, 2.2vw, 28px); display: flex; flex-direction: column; gap: 18px; }
.ro-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; flex-wrap: wrap; }
.ro-head h1 { font-size: clamp(24px, 2.4vw, 32px); }
.feed { display: flex; gap: 8px; align-items: center; }
.ro-src { font-size: 14px; color: var(--text-2); max-width: 60ch; }

.ro-count { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.ro-count b {
  font: 700 clamp(48px, 6.4vw, 88px)/.95 var(--display); letter-spacing: -.02em; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.ro-of { font: 500 16px/1 var(--mono); color: var(--text-3); }
.ro-pct { font: 700 14px/1 var(--mono); padding: 6px 8px; border-radius: 6px; background: var(--text); color: var(--acc-ink); }
/* a preview count is drawn as an outline, so it cannot be mistaken for a live figure */
.ro-count[data-source="preview"] b { color: transparent; -webkit-text-stroke: 1.5px var(--text); }
.ro-count[data-source="preview"] .ro-pct { background: transparent; color: var(--text-2); border: 1px dashed var(--line-2); }
.ro-count[data-source="stale"] b { color: var(--text-3); }
.ro-count[data-source="live"] .ro-pct { background: var(--acc); }
/* yellow means "now"; a stale snapshot is not now */
.ro-count[data-source="stale"] ~ .ro-grid .ro-key dd b { color: var(--text-2); }

.ro-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); }
.ro-grid div { padding: 14px 12px 0 0; }
.ro-grid div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.ro-grid dt { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.ro-grid dd { margin: 0; font: 600 18px/1.2 var(--mono); }
.ro-grid dd small { font-size: 12px; color: var(--text-3); font-weight: 500; }
.ro-key dd b { color: var(--acc); font-size: 22px; }
.ro-count[data-source="preview"] ~ .ro-grid .ro-key dd b { color: var(--text); }

.ro-tier { margin-top: auto; }
.ro-tier-bar { height: 6px; border-radius: 6px; background: rgba(236,236,230,.1); overflow: hidden; margin-bottom: 10px; }
.ro-tier-bar i { display: block; height: 100%; width: 0; background: var(--acc); border-radius: 6px; transition: width .5s var(--ease); }
.ro-tier p { font-size: 14px; color: var(--text-2); }

/* ---------- rail ---------- */
.rail { padding: clamp(18px, 2.2vw, 28px); display: flex; flex-direction: column; gap: 14px; }
.rail-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.rail-key { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.rail-key span { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-left: 6px; }
.k-lit { background: var(--text); }
.k-dim { background: rgba(236,236,230,.16); }
.k-open { width: 2px !important; height: 12px !important; background: var(--acc); }

.rail-body { position: relative; padding-top: 94px; }
.rail-track {
  position: relative; height: clamp(110px, 14vw, 150px); touch-action: none; user-select: none;
  border-top: 2px solid var(--steel-d); border-radius: 2px;
}
.rail-track svg { display: block; width: 100%; height: 100%; }
.rail.is-scrub .rail-track { cursor: grab; }
.rail.is-drag .rail-track { cursor: grabbing; }
.rail-track:focus-visible { outline-offset: 6px; }
.comb-dim rect { fill: rgba(236,236,230,.14); }
.comb-lit rect { fill: var(--text); }
.rail[data-source="preview"] .comb-lit rect { fill: rgba(236,236,230,.55); }
.comb-now { fill: rgba(255,216,74,.18); stroke: var(--acc); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.band-cut { stroke: rgba(236,236,230,.16); stroke-dasharray: 3 4; }
.band-cut.is-open { stroke: var(--acc); stroke-dasharray: none; opacity: .75; }
/* the jaw line: exactly where the next share sits */
.rail-track::after {
  content: ""; position: absolute; left: var(--at, 0%); top: -10px; bottom: 0; width: 2px; margin-left: -1px;
  background: var(--acc); transition: left .5s var(--ease); pointer-events: none;
}
/* the jaw line above is exact; the clip body is kept inside the rail so its tag never hits the heading or legend */
.rail-clip {
  position: absolute; top: 28px; left: clamp(32px, var(--at, 0%), calc(100% - 32px)); width: 54px; margin-left: -27px; z-index: 2;
  transition: left .5s var(--ease); pointer-events: none; filter: drop-shadow(0 8px 10px rgba(0,0,0,.6));
}
.rail-clip::after {
  position: absolute; left: 50%; top: -6px; transform: translate(-50%, -100%);
  font: 700 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
  padding: 4px 6px; border-radius: 4px;
}
.rail[data-source="live"] .rail-clip::after { content: "Live"; background: var(--acc); color: var(--acc-ink); }
.rail[data-source="preview"] .rail-clip::after { content: "Preview"; border: 1px dashed var(--text-2); color: var(--text-2); background: rgba(0,0,0,.5); }
.rail[data-source="stale"] .rail-clip::after { content: "Stale"; border: 1px solid #b9a76a; color: #d8cfa8; background: rgba(0,0,0,.6); }
.rail[data-source="stale"] .comb-lit rect { fill: rgba(236,236,230,.55); }
.rail[data-source="stale"] .rail-track::after { background: #b9a76a; }
.rail.is-drag .rail-clip, .rail.is-drag .rail-track::after { transition: none; }
.rail-bands { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); }
.rail-bands li { padding: 0 6px; border-left: 1px solid var(--line); display: grid; gap: 2px; }
.rail-bands li:first-child { border-left: 0; padding-left: 0; }
.rail-bands b { font: 600 12px/1.2 var(--mono); color: var(--text-2); }
.rail-bands span { font-size: 11px; color: var(--text-3); }
.rail-note { font-size: 12px; color: var(--text-3); }

.preview { border-top: 1px solid var(--line); padding-top: 14px; margin-top: auto; }
.pv-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pv-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pv-row input { width: 150px; flex: none; }
.pv-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.pv-hint { font-size: 12px; color: var(--text-3); margin-top: 8px; }

/* ---------- slip ---------- */
.slip { padding: clamp(18px, 2.2vw, 26px); display: grid; gap: 16px; }
.slip-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.slip-src { font-size: 13px; color: var(--text-2); padding: 10px 12px; border-radius: var(--r-sm); background: rgba(0,0,0,.3); border: 1px solid var(--line); }
.qty-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stepper { display: grid; grid-template-columns: 44px 72px 44px; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; background: rgba(0,0,0,.35); }
.stepper input { border: 0; border-radius: 0; text-align: center; font-size: 22px; font-weight: 700; background: transparent; padding: 0; }
.step { border: 0; background: rgba(236,236,230,.05); color: var(--text); cursor: pointer; display: grid; place-items: center; min-height: 48px; }
.step svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }
.step:hover:not(:disabled) { background: rgba(236,236,230,.12); }
.step:disabled { color: var(--text-3); opacity: .5; cursor: not-allowed; }
.quick { display: flex; gap: 6px; }
.quick button { min-width: 48px; min-height: 48px; font: 700 15px/1 var(--mono); color: var(--text); background: rgba(236,236,230,.04); border: 1px solid var(--line-2); border-radius: var(--r-sm); cursor: pointer; }
.quick button:hover { background: rgba(236,236,230,.1); }
.quick button[aria-pressed="true"] { background: var(--text); color: var(--acc-ink); border-color: var(--text); }

.receipt { border-radius: var(--r-sm); border: 1px solid var(--line); background: rgba(0,0,0,.28); padding: 14px; }
.r-void { display: none; font-size: 14px; color: var(--text-2); }
.receipt.is-void .r-void { display: block; }
.receipt.is-void .r-body { display: none; }
.r-range { font: 600 12px/1.3 var(--mono); color: var(--text-3); margin-bottom: 8px; }
.r-lines { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.r-lines li { display: flex; justify-content: space-between; font: 500 14px/1.4 var(--mono); color: var(--text-2); }
.r-lines small { color: var(--text-3); margin-left: 6px; }
.r-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px dashed var(--line-2); padding-top: 10px; }
.r-total span { font-size: 14px; color: var(--text-2); }
.r-total b { font: 700 clamp(24px, 2.6vw, 30px)/1 var(--display); color: var(--acc); }
.r-split { margin: 10px 0 0; display: grid; gap: 4px; }
.r-split div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.r-split dt { color: var(--text-3); }
.r-split dd { margin: 0; font-family: var(--mono); color: var(--text-2); text-align: right; }
.r-note { font-size: 13px; color: var(--text-2); }
.r-note:not(:empty) { margin-top: 10px; }
.r-raw { margin-top: 10px; font-size: 13px; color: var(--text-3); }
.r-raw summary { cursor: pointer; color: var(--text-2); min-height: 32px; display: flex; align-items: center; }
.r-raw p + p { margin-top: 6px; }

/* ---------- tier list ---------- */
.tiers { padding: clamp(18px, 2.2vw, 26px); display: grid; gap: 10px; }
.tiers-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
/* tier rows: the full list and the three-row excerpt in the readout share one look */
.tiers-cols, .tier-rows li { display: grid; grid-template-columns: 56px minmax(0, 1fr) 80px 168px; gap: 10px; align-items: center; }
.tiers-cols { font-size: 12px; color: var(--text-3); padding: 0 14px; }
.tiers-cols span:nth-child(3), .tiers-cols span:nth-child(4) { text-align: right; }
.tiers-box { max-height: 432px; overflow: auto; border-radius: var(--r-sm); border: 1px solid var(--line); background: rgba(0,0,0,.22); position: relative; }
.tier-rows { list-style: none; margin: 0; padding: 4px; }
.tier-rows li { padding: 9px 8px; border-radius: 6px; font: 500 14px/1.2 var(--mono); color: var(--text); border: 1px solid transparent; }
.tier-rows li + li { margin-top: 2px; }
.tl-n { color: var(--text-3); }
.tl-p { text-align: right; }
.tl-s { font-size: 12px; color: var(--text-3); text-align: right; white-space: nowrap; }
.tier-rows li.is-done { color: var(--text-3); }
.tier-rows li.is-done .tl-p { text-decoration: line-through; text-decoration-color: rgba(236,236,230,.25); }
.tier-rows li.is-now { background: var(--acc-soft); border-color: rgba(255,216,74,.55); }
.tier-rows li.is-now .tl-n, .tier-rows li.is-now .tl-s { color: var(--acc); font-weight: 700; }
.tier-rows li.is-next { background: rgba(236,236,230,.04); }
.tier-rows li.is-next .tl-s { color: var(--text-2); }
.tier-rows.ro-ladder { padding: 0; margin: 0 0 12px; }
.tier-rows.ro-ladder li { grid-template-columns: 44px minmax(0, 1fr) 64px 88px; padding: 7px 8px; font-size: 13px; }/* ---------- allowance ---------- */
.allow { margin-top: 20px; padding: clamp(18px, 2.2vw, 26px); display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 14px 28px; }
.allow-head p { font-size: 14px; color: var(--text-2); margin-top: 8px; }
.ledger { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.ledger li { background: rgba(14,14,13,.85); padding: 12px; display: grid; gap: 4px; }
.ledger b { font: 700 22px/1 var(--display); }
.ledger span { font-size: 13px; color: var(--text-2); }
.ledger .minus b { color: var(--text-3); }
.allow .fine { grid-column: 2; }

/* ---------- intro: the clip drops onto the rail, then the numbers settle ---------- */
.intro .rail-clip { animation: drop 1s var(--ease) both; }
.intro .readout, .intro .rail { animation: rise .7s var(--ease) both; }
.intro .rail { animation-delay: .12s; }
.intro .comb-lit { animation: fillIn 1.1s .3s var(--ease) both; }
@keyframes drop { 0% { transform: translateY(-90px); opacity: 0; } 60% { transform: translateY(6px); opacity: 1; } 80% { transform: translateY(-3px); } 100% { transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fillIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 1080px) {
  .ro-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ro-grid div:nth-child(3) { padding-left: 0; border-left: 0; }
  .ro-grid div:nth-child(n+3) { border-top: 1px solid var(--line); margin-top: 12px; }
}
@media (max-width: 900px) {
  .stage, .work, .allow { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .work { margin-top: 14px; }
  .allow .fine { grid-column: auto; }
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rail-body { padding-top: 80px; }
  .rail-clip { width: 44px; margin-left: -22px; top: 24px; left: clamp(32px, var(--at, 0%), calc(100% - 32px)); }
  .rail-bands b { font-size: 10px; }
  .rail-bands span { font-size: 10px; }
  .rail-bands li { padding: 0 3px; }
  .tiers-box { max-height: 360px; }
  .pv-row input { width: 100%; }
}
/* narrow columns (phones, and the two-column layout just above 900px): tier, shares and price on one line;
   the "now / next" state drops below on the rows that have one */
@media (max-width: 560px), (min-width: 901px) and (max-width: 1080px) {
  .tiers-cols, .tier-rows li, .tier-rows.ro-ladder li { grid-template-columns: 44px minmax(0, 1fr) 60px; gap: 2px 8px; }
  .tiers-cols span:nth-child(4) { display: none; }
  .tiers-cols { padding: 0 12px; }
  .tier-rows li { font-size: 13px; padding: 8px 6px; }
  .tl-s { grid-column: 1 / -1; text-align: left; }
  .tier-rows li.is-done .tl-s, .tl-s:empty {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}
@media (hover: none) and (pointer: coarse) { .kb-only { display: none; } }
