/* MINDSHAFT extras: behaviour and micro-motion styles (owned by the extras work).
   Motion is transform/opacity only; everything here stops under prefers-reduced-motion. */

.ms-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
html:not(.js) #rig-expand { display: none; }

/* ---------- numbers: tabular, countdowns never change width ---------- */
.live-clock, .rail-live-time, .ms-num { font-variant-numeric: tabular-nums; }
.live-clock { min-width: 3.4ch; text-align: right; }
.sheet-group li .amt, .live-answers li b { font-family: var(--text); font-size: 0.92em; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; justify-content: flex-end; }
.sheet-end .ms-num { font-family: var(--text); font-variant-numeric: tabular-nums; display: inline-block; min-width: 4ch; text-align: left; }

/* ---------- ore glyphs and model emblems: one colour, 14px ---------- */
.ms-ore, .ms-emblem { display: inline-block; flex: none; width: 14px; height: 14px; vertical-align: -2px; }
.ms-ore { margin-right: 4px; }
.ms-emblem { margin-right: 5px; }
.ms-model { font-weight: inherit; }

/* ---------- ledger: depth mark, thin rules, the stamp ---------- */
.ms-mark { display: inline-block; width: 8px; height: 8px; margin-right: 7px; vertical-align: 1px; background: var(--d1); }
.ms-mark[data-level="2"] { background: var(--d2); }
.ms-mark[data-level="3"] { background: var(--d3); }

.live-head { padding-bottom: 12px; border-bottom: 1px solid rgba(236, 235, 231, 0.16); } /* ledger rule, asked for in the brief. taste-skill-ignore */
.live-foot { padding-top: 12px; border-top: 1px solid rgba(236, 235, 231, 0.16); } /* ledger rule. taste-skill-ignore */

.ms-ledger {
  display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid rgba(23, 20, 15, 0.22); /* ledger rule. taste-skill-ignore */
  font-size: var(--s-small); font-weight: 600; color: var(--paper-soft);
}

.ms-stamp {
  display: inline-block; margin-left: 10px; padding: 1px 6px; border: 1.5px solid currentColor; border-radius: 2px;
  font-family: var(--display); font-weight: 700; font-size: 0.8rem; line-height: 1.3; letter-spacing: 0.08em;
  text-transform: uppercase; white-space: nowrap; transform: rotate(-4deg);
}
.live-card .ms-stamp.is-ore { color: var(--ok-on-dark); }
.live-card .ms-stamp.is-none { color: var(--basalt-soft); }
.slip-opts li.is-right .ms-stamp { margin-left: auto; color: inherit; }
.ms-stamp-in .ms-stamp { animation: ms-stamp 240ms var(--ease) both; }
@keyframes ms-stamp { from { opacity: 0; transform: rotate(-4deg) scale(1.4); } to { opacity: 1; transform: rotate(-4deg) scale(1); } }

/* ---------- calm live updates: new rows slide in with a short highlight ---------- */
.sheet-group li, .live-answers li { position: relative; }
.sheet-group li.is-new, .live-answers li.is-new { animation: ms-arrive 260ms var(--ease) both; }
.sheet-group li.is-new::after, .live-answers li.is-new::after {
  content: ""; position: absolute; inset: -3px -8px; pointer-events: none; opacity: 0;
  background: var(--lamp); animation: ms-glint 1200ms ease-out;
}
.live-answers li.is-new::after { inset: 0; background: var(--basalt-ink); }
@keyframes ms-arrive { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes ms-glint { from { opacity: 0.16; } to { opacity: 0; } }

/* ---------- copy: check mark, and a lamp mark on the step that stays ---------- */
.copy.is-copied { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ms-check { flex: none; }
.copy.is-copied .ms-check { animation: ms-pop 200ms var(--ease) both; }
.step .term { position: relative; }
.step.is-done .term::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--lamp);
  transform-origin: 50% 0; animation: ms-bar 250ms var(--ease) both;
}
.step.is-restored .term::before, .step.is-restored .ms-done .ms-check { animation: none; }
.ms-done { display: inline-block; color: var(--lamp); vertical-align: 0.05em; }
.ms-done .ms-check { width: 0.8em; height: 0.8em; animation: ms-pop 220ms var(--ease) both; }
@keyframes ms-bar { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes ms-pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }

/* ---------- depth tabs: a square in the depth's colour beside the active name ---------- */
.ms-tabmark {
  display: inline-block; width: 0.26em; height: 0.26em; margin-right: 0.28em; vertical-align: 0.2em;
  background: var(--d1); border: 2px solid currentColor; opacity: 0; transform: scale(0.6);
  transition: transform 200ms var(--ease), opacity 200ms var(--ease);
}
[data-level="2"] > .ms-tabmark { background: var(--d2); }
[data-level="3"] > .ms-tabmark { background: var(--d3); }
[aria-selected="true"] > .ms-tabmark { opacity: 1; transform: scale(1); }

/* ---------- demo round ---------- */
.ms-demo-tag { display: inline-block; margin-right: 8px; padding: 0 6px; border-radius: 2px; background: var(--basalt-ink); color: var(--basalt); font-weight: 600; }
.live-card[data-demo] .live-dot { opacity: 0.3; }
.ms-fade { animation: ms-in 250ms var(--ease) both; }
.ms-demo-row { animation: ms-arrive 260ms var(--ease) both; }
.ms-think { position: relative; align-self: center; width: 64px; height: 4px; overflow: hidden; background: rgba(236, 235, 231, 0.16); }
.ms-think i { position: absolute; inset: 0; background: var(--basalt-ink); transform-origin: 0 50%; animation: ms-think 1500ms linear both; }
.live-answers li b.is-wait { color: var(--basalt-soft); }
#demo-round[aria-disabled="true"] { opacity: 0.6; cursor: default; }
@keyframes ms-think { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ms-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- the rig screen: parts a command points at ---------- */
.rig-term [data-part], .rig-term [data-panel] > span { transition: opacity 200ms var(--ease); }
.rig-term[data-focus] [data-part], .rig-term[data-focus] [data-panel] > span:not(.rig-part) { opacity: 0.3; }
.rig-term[data-focus="login"] [data-part="login"],
.rig-term[data-focus="agent"] [data-part="agent"],
.rig-term[data-focus="mine"] [data-part="mine"] { opacity: 1; }
.rig-term[data-focus="login"] .rig-part[data-part="login"],
.rig-term[data-focus="agent"] .rig-part[data-part="agent"],
.rig-term[data-focus="mine"] .rig-part[data-part="mine"] { background: rgba(236, 235, 231, 0.1); }

.ms-rig-dialog {
  width: min(1120px, calc(100vw - 32px)); max-height: calc(100svh - 32px); padding: 0; overflow: auto;
  border: 0; border-radius: 2px; background: #101113; color: var(--basalt-ink);
}
.ms-rig-dialog[open] { animation: ms-in 200ms var(--ease) both; }
.ms-rig-dialog::backdrop { background: rgba(10, 10, 11, 0.72); }
.ms-rig-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 10px 10px 20px; background: #18191b; }
.ms-rig-top h2 { font-size: var(--s-lead); }
.ms-rig-close { min-height: 44px; min-width: 44px; padding: 0 16px; border: 0; border-radius: 2px; background: var(--step-1); color: var(--basalt-ink); font-weight: 600; cursor: pointer; }
@media (hover: hover) { .ms-rig-close:hover { background: #33353a; } }
.ms-rig-help { padding: 14px 20px 0; color: var(--basalt-soft); font-size: var(--s-small); }
.ms-rig-legend { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px 4px; }
.ms-rig-legend button {
  display: grid; gap: 2px; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 2px;
  background: var(--step-1); color: var(--basalt-ink); text-align: left; cursor: pointer; transition: background-color 160ms var(--ease);
}
.ms-rig-legend button code { font-size: var(--s-small); }
.ms-rig-legend button span { font-size: var(--s-small); color: var(--basalt-soft); }
.ms-rig-legend button[aria-pressed="true"] { background: #3a3c41; }
@media (hover: hover) { .ms-rig-legend button:hover { background: #33353a; } }
.ms-rig-dialog .rig-body { flex-wrap: wrap; overflow-x: auto; gap: 28px; padding: 20px; }
.ms-rig-dialog .rig-body [data-scene] { display: block; }
.ms-rig-dialog .rig-body pre { font-size: clamp(13px, 0.55rem + 0.75vw, 21px); line-height: 1.25; }

/* ---------- the core moment: crystals in the rock light up once ---------- */
.ms-crystals { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; color: var(--lamp); }
.ms-crystals span { position: absolute; width: 18px; height: 18px; opacity: 0; transform: rotate(var(--r)); }
.ms-crystals svg { display: block; width: 100%; height: 100%; }
.ms-crystals.is-settled span { opacity: 0.2; }
.ms-crystals.is-lit span { animation: ms-crystal 900ms var(--ease) calc(var(--i) * 170ms) both; }
@keyframes ms-crystal {
  0% { opacity: 0; transform: rotate(var(--r)) scale(0.7); }
  35% { opacity: 0.95; transform: rotate(var(--r)) scale(1.12); }
  100% { opacity: 0.2; transform: rotate(var(--r)) scale(1); }
}

/* ---------- easter egg: the lamp over the assay sheet ---------- */
.ms-lamp { position: relative; display: block; }
.ms-lamp .sheet-vignette { cursor: pointer; }
.ms-lamp-glow {
  position: absolute; right: 8%; top: 0; width: 34%; aspect-ratio: 1; pointer-events: none; opacity: 0;
  background: var(--lamp); mix-blend-mode: multiply;
  -webkit-mask-image: radial-gradient(circle, #000 0, transparent 68%); mask-image: radial-gradient(circle, #000 0, transparent 68%); /* mask only. taste-skill-ignore */
}
.ms-lamp-glow.is-on { animation: ms-lamp 1000ms var(--ease); }
.ms-lamp-btn { position: absolute; right: 10%; top: 0; width: 30%; height: 60%; min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 2px; background: none; cursor: pointer; }
@keyframes ms-lamp { 0% { opacity: 0; } 30% { opacity: 0.75; } 100% { opacity: 0; } }

/* ---------- easter egg: a miner's note on the panorama ---------- */
.ms-pano { cursor: pointer; }
.ms-note {
  position: absolute; left: 12px; bottom: 12px; z-index: 2; max-width: min(340px, calc(100% - 24px));
  padding: 8px 12px; border-radius: 2px; background: var(--paper-ink); color: var(--paper);
  font-family: var(--text); font-size: var(--s-small); font-weight: 500; line-height: 1.35; pointer-events: none;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease), visibility 0s linear 200ms;
}
.ms-note.is-on { opacity: 1; visibility: visible; transform: none; transition: opacity 200ms var(--ease), transform 200ms var(--ease), visibility 0s; }

/* ---------- reduced motion: no movement at all, end states only ---------- */
@media (prefers-reduced-motion: reduce) {
  .sheet-group li.is-new, .live-answers li.is-new, .ms-demo-row, .ms-fade, .ms-stamp-in .ms-stamp,
  .copy.is-copied .ms-check, .ms-done .ms-check, .step.is-done .term::before, .ms-rig-dialog[open],
  .ms-crystals.is-lit span, .ms-lamp-glow.is-on, .ms-think i { animation: none; }
  .sheet-group li.is-new::after, .live-answers li.is-new::after { display: none; }
  .ms-crystals.is-lit span { opacity: 0.2; }
  .ms-tabmark, .ms-note, .ms-note.is-on, .rig-term [data-part], .rig-term [data-panel] > span { transition: none; }
  .ms-note { transform: none; }
}
