:root {
  --paper: #f1ede2;
  --paper-bright: #fbf8f0;
  --ink: #172321;
  --ink-soft: #263733;
  --rail: #12201e;
  --muted: #66736d;
  --rule: rgba(23, 35, 33, 0.15);
  --accent: #f0643c;
  --accent-dark: #bd3f23;
  --teal: #08716b;
  --teal-bright: #30b6a3;
  --gold: #e1af43;
  --danger: #cf3f39;
  --card: rgba(255, 253, 247, 0.8);
  --shadow: 0 24px 70px rgba(44, 38, 28, 0.11);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 92% -6%, rgba(240, 100, 60, 0.13), transparent 34rem),
    linear-gradient(rgba(23, 35, 33, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 100% 28px, auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 278px minmax(0, 1fr);
  min-height: 100vh;
}

.miner-rail {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 27px 20px 20px;
  overflow: hidden;
  color: #edf2e9;
  background:
    radial-gradient(circle at 15% 12%, rgba(48, 182, 163, 0.17), transparent 18rem),
    linear-gradient(145deg, rgba(255,255,255,0.035), transparent 40%),
    var(--rail);
  border-right: 1px solid rgba(255,255,255,0.08);
}

.miner-rail::after {
  position: absolute;
  right: 0;
  bottom: 5%;
  width: 3px;
  height: 28%;
  background: linear-gradient(transparent, var(--accent), transparent);
  content: "";
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 5px 22px;
}

.rail-brand p,
.rail-brand strong { margin: 0; }
.rail-brand p {
  color: rgba(237, 242, 233, 0.55);
  font: 700 0.61rem/1.3 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.rail-brand strong {
  display: block;
  margin-top: 2px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.42rem;
  font-weight: 400;
}

.brand-mark {
  position: relative;
  display: block;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
}
.brand-mark::before,
.brand-mark::after {
  position: absolute;
  background: rgba(255,255,255,0.12);
  content: "";
}
.brand-mark::before { top: 50%; left: 5px; width: 26px; height: 1px; transform: rotate(-31deg); }
.brand-mark::after { top: 6px; left: 18px; width: 1px; height: 26px; transform: rotate(29deg); }
.brand-mark i {
  position: absolute;
  z-index: 1;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(240,100,60,0.8);
}
.brand-mark i:nth-child(1) { left: 7px; top: 23px; }
.brand-mark i:nth-child(2) { left: 17px; top: 7px; background: var(--teal-bright); }
.brand-mark i:nth-child(3) { right: 6px; bottom: 7px; background: var(--gold); }

.page-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: min(100%, 670px);
  margin: 0 auto 42px;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: 15px;
  background: rgba(255,253,247,0.7);
  box-shadow: 0 10px 32px rgba(44,38,28,0.06);
}
.page-switcher a {
  padding: 13px 18px;
  color: var(--muted);
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}
.page-switcher a:hover { color: var(--teal); background: rgba(8,113,107,0.055); transform: translateY(-1px); }
.page-switcher a[aria-current="page"] {
  color: var(--paper-bright);
  background: var(--ink);
  box-shadow: 0 5px 15px rgba(23,35,33,0.17);
}

.new-n-form {
  padding: 17px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 15px;
  background: rgba(255,255,255,0.055);
}
.new-n-form label,
.saved-heading {
  color: rgba(237,242,233,0.58);
  font: 700 0.64rem/1.2 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.new-n-form > div {
  display: grid;
  grid-template-columns: auto 1fr 34px;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.new-n-form > div > span { color: rgba(255,255,255,0.65); font: 700 0.8rem var(--mono); }
.new-n-form input {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  color: white;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.28);
  outline: 0;
  background: transparent;
  font: 500 1.4rem/1 Georgia, serif;
}
.new-n-form input:focus { border-color: var(--teal-bright); }
.new-n-form button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  color: white;
  background: var(--accent);
  font-size: 1.35rem;
  line-height: 1;
}
.new-n-form small {
  display: block;
  margin-top: 10px;
  color: rgba(237,242,233,0.4);
  font-size: 0.67rem;
}

.saved-heading {
  display: flex;
  justify-content: space-between;
  margin: 27px 6px 10px;
}
.saved-heading span:last-child {
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 999px;
  color: rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.08);
  text-align: center;
}

.saved-list {
  flex: 1 1 auto;
  min-height: 80px;
  margin: 0 -5px;
  padding: 0 5px 12px;
  overflow-y: auto;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.saved-n {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 3px 0;
  padding: 11px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  color: rgba(237,242,233,0.72);
  background: transparent;
  text-align: left;
  transition: transform 140ms ease, color 140ms ease, background 140ms ease;
}
.saved-n:hover { color: white; background: rgba(255,255,255,0.055); transform: translateX(2px); }
.saved-n[aria-current="true"] {
  color: white;
  border-color: rgba(48,182,163,0.23);
  background: linear-gradient(90deg, rgba(48,182,163,0.16), rgba(255,255,255,0.04));
}
.saved-n > strong { font: 400 1.43rem/1 Georgia, serif; }
.saved-n div { min-width: 0; }
.saved-n div strong,
.saved-n div small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-n div strong { font-size: 0.72rem; }
.saved-n div small { margin-top: 3px; color: rgba(237,242,233,0.4); font: 600 0.58rem/1.2 var(--mono); }
.saved-n > span { color: var(--gold); font: 700 0.66rem var(--mono); }

.rail-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 16px 7px 2px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.rail-footer strong,
.rail-footer small { display: block; }
.rail-footer strong { font-size: 0.73rem; }
.rail-footer small { margin-top: 2px; color: rgba(237,242,233,0.38); font-size: 0.61rem; }
.engine-light {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--teal-bright);
  box-shadow: 0 0 12px rgba(48,182,163,0.7);
}
.engine-light.running { background: var(--gold); box-shadow: 0 0 14px rgba(225,175,67,0.8); animation: enginePulse 1s ease-in-out infinite; }

.miner-main {
  width: min(1350px, calc(100% - 64px));
  margin: 0 auto;
  padding: 50px 0 70px;
}

.miner-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 30px;
}
.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font: 750 0.68rem/1.2 var(--mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.eyebrow { display: flex; align-items: center; gap: 9px; }
.eyebrow::before { width: 30px; height: 2px; background: var(--accent); content: ""; }
.miner-header h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 5vw, 5.25rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.95;
}
.miner-header h1 em { color: var(--teal); font-weight: 400; }
.lede {
  max-width: 740px;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.65;
}
.header-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.quiet-button {
  padding: 10px 13px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  cursor: pointer;
  color: var(--ink-soft);
  background: rgba(255,253,247,0.5);
  font-size: 0.72rem;
  font-weight: 750;
}
.quiet-button:hover { border-color: rgba(8,113,107,0.5); background: var(--paper-bright); }
.quiet-button.danger:hover { color: var(--danger); border-color: rgba(207,63,57,0.45); }

.stat-grid {
  display: grid;
  grid-template-columns: 1.45fr repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.stat-card {
  position: relative;
  min-width: 0;
  padding: 19px 20px 17px;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 15px;
  background: var(--card);
}
.stat-card::after {
  position: absolute;
  right: -15px;
  bottom: -24px;
  color: rgba(23,35,33,0.035);
  font: 400 5rem/1 Georgia, serif;
  content: "∴";
}
.stat-label { display: block; color: var(--muted); font: 750 0.64rem/1.2 var(--mono); letter-spacing: 0.09em; text-transform: uppercase; }
.stat-card > strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 9px;
  overflow: hidden;
  color: var(--ink);
  font: 400 clamp(1.75rem, 2.5vw, 2.65rem)/1 Georgia, serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stat-card small { position: relative; z-index: 1; display: block; margin-top: 8px; overflow: hidden; color: var(--muted); font-size: 0.67rem; text-overflow: ellipsis; white-space: nowrap; }
.stat-space { background: linear-gradient(135deg, rgba(8,113,107,0.1), rgba(255,253,247,0.85) 70%); }
.stat-found > strong { color: var(--accent-dark); }

.progress-card,
.board-card,
.control-card,
.telemetry-card,
.solutions-card,
.engine-notes {
  border: 1px solid var(--rule);
  background: var(--card);
  box-shadow: 0 14px 45px rgba(44,38,28,0.065);
}
.progress-card { margin-bottom: 12px; padding: 18px 21px 16px; border-radius: 15px; }
.progress-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.progress-heading h2,
.board-heading h2,
.control-heading h2,
.card-heading-row h2,
.engine-notes h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.progress-heading .section-kicker { margin-bottom: 4px; }
.progress-heading > strong { color: var(--teal); font: 500 1.25rem/1 var(--mono); }
.progress-track {
  position: relative;
  height: 13px;
  margin-top: 15px;
  overflow: hidden;
  border: 1px solid rgba(23,35,33,0.11);
  border-radius: 999px;
  background: rgba(23,35,33,0.08);
}
.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--teal-bright), var(--gold));
  transition: width 280ms ease;
}
.progress-fill::after {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.35) 46%, transparent 62%);
  background-size: 70px 100%;
  animation: shimmer 2.8s linear infinite;
  content: "";
}
.progress-probe { position: absolute; top: -3px; left: 0; width: 2px; height: 17px; opacity: 0; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.progress-probe.active { opacity: 1; animation: scanMeter 1.9s linear infinite; }
.progress-foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 10px; color: var(--muted); font-size: 0.69rem; }
.progress-foot strong { color: var(--ink-soft); }

.workbench {
  display: grid;
  grid-template-columns: minmax(420px, 1.5fr) minmax(300px, 0.72fr);
  gap: 12px;
}
.board-card,
.control-card { border-radius: 20px; }
.board-card { position: relative; min-width: 0; padding: 22px; overflow: hidden; }
.board-card::before { position: absolute; top: 0; right: 0; width: 150px; height: 6px; background: var(--accent); content: ""; }
.board-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.board-heading .section-kicker { margin-bottom: 4px; }
.frame-badge {
  padding: 6px 9px;
  border: 1px solid rgba(8,113,107,0.22);
  border-radius: 999px;
  color: var(--teal);
  background: rgba(8,113,107,0.07);
  font: 750 0.59rem/1 var(--mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.frame-badge:not(:disabled) { cursor: pointer; }
.frame-badge.cut { color: var(--danger); border-color: rgba(207,63,57,0.22); background: rgba(207,63,57,0.07); }
.frame-badge.found { color: #846212; border-color: rgba(225,175,67,0.35); background: rgba(225,175,67,0.12); }
.frame-badge.best { color: #79590d; border-color: rgba(225,175,67,0.42); background: rgba(225,175,67,0.14); box-shadow: 0 0 18px rgba(225,175,67,0.14); }
.score-marquee {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  color: #f4f1e8;
  background:
    radial-gradient(circle at 12% 0%, rgba(48,182,163,0.16), transparent 45%),
    linear-gradient(135deg, #152522, #101b19);
  box-shadow: 0 12px 28px rgba(23,35,33,0.14);
}
.score-marquee-item {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 105px;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  padding: 16px 19px 14px;
  overflow: hidden;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}
.score-marquee-item + .score-marquee-item { border-left: 1px solid rgba(255,255,255,0.1); }
.score-marquee-item::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--teal-bright);
  content: "";
}
.score-marquee-item.current::before { background: var(--accent); }
.score-marquee-item.overall::before { background: var(--gold); }
.score-marquee-item > span {
  color: rgba(244,241,232,0.55);
  font: 750 0.59rem/1 var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.score-marquee-item > strong {
  display: block;
  max-width: 100%;
  margin-top: 5px;
  padding: 1px 0 4px;
  overflow: visible;
  color: var(--teal-bright);
  font: 500 clamp(2rem, 4.4vw, 3.55rem)/1.04 Georgia, "Times New Roman", serif;
  letter-spacing: -0.045em;
  white-space: nowrap;
}
.score-marquee-item.current > strong { color: #ff7955; }
.score-marquee-item.overall > strong { color: var(--gold); }
.score-marquee-item > small { display: block; margin-top: 2px; color: rgba(244,241,232,0.38); font-size: 0.58rem; line-height: 1.35; }
button.score-marquee-item:not(:disabled) { cursor: pointer; transition: background 150ms ease; }
button.score-marquee-item:not(:disabled):hover { background: rgba(255,255,255,0.055); }
button.score-marquee-item:disabled { cursor: default; }
.board-stage.searching + .board-readout { border-color: rgba(48,182,163,0.2); }
.board-card:has(.board-stage.searching) .score-marquee-item.current > strong { animation: scorePulse 1.25s ease-in-out infinite; }
.board-stage {
  position: relative;
  width: min(100%, 650px);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 15px;
  background: #111d1b;
  box-shadow: inset 0 0 45px rgba(0,0,0,0.32), 0 18px 35px rgba(24,32,29,0.14);
  transition: box-shadow 300ms ease;
}
.board-stage::before,
.board-stage::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  content: "";
}
.board-stage::before {
  background:
    radial-gradient(circle at 50% 50%, transparent 0 22%, rgba(48,182,163,0.1) 42%, transparent 66%),
    conic-gradient(from 0deg at 50% 50%, transparent, rgba(48,182,163,0.08), transparent 18%, transparent 76%, rgba(240,100,60,0.08), transparent);
  mix-blend-mode: screen;
}
.board-stage::after {
  background: repeating-linear-gradient(0deg, transparent 0 5px, rgba(150,255,235,0.025) 6px, transparent 7px);
}
.board-stage.searching {
  box-shadow: inset 0 0 65px rgba(48,182,163,0.13), 0 18px 40px rgba(24,32,29,0.19), 0 0 0 1px rgba(48,182,163,0.15);
}
.board-stage.searching::before { opacity: 1; animation: fieldRotate 7s linear infinite, fieldBreathe 2.2s ease-in-out infinite alternate; }
.board-stage.searching::after { opacity: 1; animation: scanTexture 1.2s linear infinite; }
#miner-board { position: relative; z-index: 1; display: block; width: 100%; height: 100%; }
.board-sweep {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  width: 100%;
  height: 30%;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(transparent, rgba(48,182,163,0.045), rgba(48,182,163,0.15));
  border-bottom: 1px solid rgba(48,182,163,0.4);
}
.board-sweep.running { opacity: 1; animation: boardSweep 2.2s ease-in-out infinite; }
.board-empty {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: rgba(243,239,229,0.7);
  pointer-events: none;
  text-align: center;
}
.board-empty[hidden] { display: none; }
.board-empty > span { color: var(--accent); font: 400 4rem/1 Georgia, serif; }
.board-empty strong { margin-top: 5px; font: 400 1.25rem/1.2 Georgia, serif; }
.board-empty small { max-width: 280px; margin-top: 8px; color: rgba(243,239,229,0.4); font-size: 0.68rem; line-height: 1.45; }
.board-readout { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 17px 3px 0; }
.board-readout span { display: block; color: var(--muted); font: 700 0.58rem/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.board-readout strong { display: block; margin-top: 5px; font-size: 0.82rem; }
.board-readout p { margin: 0; color: var(--muted); font-size: 0.7rem; line-height: 1.55; }

.control-card { padding: 25px; }
.control-heading { margin-bottom: 25px; }
.control-heading .section-kicker { margin-bottom: 4px; }
.amount-label { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font: 750 0.67rem/1.2 var(--mono); letter-spacing: 0.07em; text-transform: uppercase; }
.amount-label input {
  width: 96px;
  padding: 8px 9px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  background: var(--paper-bright);
  font: 700 0.84rem var(--mono);
  text-align: right;
}
.amount-label input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8,113,107,0.09); }
.amount-label input.infinite { color: #8a6012; border-color: rgba(225,175,67,0.48); background: rgba(255,247,220,0.82); }
.amount-slider { width: 100%; margin: 22px 0 7px; accent-color: var(--accent); cursor: pointer; }
.slider-ticks { display: flex; justify-content: space-between; color: var(--muted); font: 650 0.57rem/1 var(--mono); }
.search-buttons { display: grid; gap: 9px; margin-top: 25px; }
.search-button {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 10px 15px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  color: white;
  text-align: left;
  box-shadow: 0 10px 24px rgba(8,113,107,0.16);
  transition: transform 140ms ease, filter 140ms ease;
}
.search-button:hover { filter: brightness(1.05); transform: translateY(-1px); }
.search-button:active { transform: translateY(0); }
.search-button:disabled { cursor: wait; filter: grayscale(0.35); opacity: 0.55; transform: none; }
.search-button > span:first-child { font-size: 1.25rem; text-align: center; }
.search-button > span:last-child { font-size: 0.78rem; font-weight: 650; }
.search-button strong { font-family: var(--mono); }
.search-button.random { background: linear-gradient(135deg, var(--teal), #095650); }
.search-button.next { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); box-shadow: 0 10px 24px rgba(240,100,60,0.15); }
.search-button.guided { color: #241c0e; background: linear-gradient(135deg, #edc568, var(--gold)); box-shadow: 0 10px 24px rgba(225,175,67,0.2); }
.stop-button { padding: 10px; border: 1px solid rgba(207,63,57,0.25); border-radius: 9px; cursor: pointer; color: var(--danger); background: rgba(207,63,57,0.06); font-size: 0.7rem; font-weight: 750; }
.method-toggle { display: grid; grid-template-columns: 27px 1fr; gap: 10px; margin-top: 20px; padding: 13px; border: 1px solid rgba(8,113,107,0.15); border-radius: 11px; background: rgba(8,113,107,0.055); }
.method-icon { color: var(--teal); font-size: 1.2rem; }
.method-toggle p { margin: 0; color: var(--muted); font-size: 0.67rem; line-height: 1.5; }
.method-toggle strong { color: var(--ink-soft); }
.batch-status { margin-top: 22px; }
.batch-status > div:first-child { display: flex; justify-content: space-between; color: var(--muted); font: 700 0.61rem var(--mono); }
.batch-status > div:first-child strong { color: var(--ink-soft); }
.mini-track { height: 5px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: rgba(23,35,33,0.08); }
.mini-track span { display: block; width: 0; height: 100%; background: var(--accent); transition: width 180ms linear; }
.mini-track span.infinite {
  width: 30%;
  background: linear-gradient(90deg, transparent, var(--gold), #ffe39b, transparent);
  transform: translateX(-115%);
  transition: none;
  animation: infiniteBatch 1.45s ease-in-out infinite;
}

.score-panel {
  margin-top: 23px;
  padding-top: 21px;
  border-top: 1px solid var(--rule);
}
.score-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.score-heading .section-kicker { margin-bottom: 3px; }
.score-heading h3 { margin: 0; font: 400 1.28rem/1.1 Georgia, "Times New Roman", serif; }
.best-score { min-width: 48px; padding: 4px 0 4px 8px; border: 0; cursor: pointer; background: transparent; text-align: right; }
.best-score:disabled { cursor: default; }
.best-score:not(:disabled):hover strong { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.best-score span { display: block; color: var(--muted); font: 700 0.54rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.best-score strong { display: block; margin-top: 3px; color: var(--teal); font: 500 1.05rem/1 var(--mono); }
.score-explainer { margin: 10px 0 14px; color: var(--muted); font-size: 0.64rem; line-height: 1.45; }
.score-histogram {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 128px;
  padding: 8px 5px 21px;
  border-bottom: 1px solid rgba(23,35,33,0.22);
  background:
    linear-gradient(rgba(23,35,33,0.055) 1px, transparent 1px);
  background-size: 100% 25%;
}
.histogram-empty { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; flex-direction: column; color: var(--muted); }
.histogram-empty span { color: rgba(8,113,107,0.48); font-size: 1.8rem; }
.histogram-empty small { margin-top: 3px; font-size: 0.61rem; }
.histogram-bin {
  position: relative;
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  align-items: end;
  justify-content: center;
}
.histogram-bin i {
  display: block;
  width: min(100%, 25px);
  min-height: 2px;
  border-radius: 4px 4px 1px 1px;
  background: linear-gradient(to top, var(--teal), var(--teal-bright));
  box-shadow: 0 0 10px rgba(48,182,163,0.13);
  transform-origin: bottom;
  animation: histogramRise 350ms ease-out both;
}
.histogram-bin.zero i { background: linear-gradient(to top, #b98519, var(--gold)); box-shadow: 0 0 13px rgba(225,175,67,0.32); }
.histogram-bin b {
  position: absolute;
  bottom: -18px;
  left: 50%;
  overflow: hidden;
  width: calc(100% + 4px);
  color: var(--muted);
  font: 650 0.49rem/1 var(--mono);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
}
.histogram-bin em {
  position: absolute;
  top: -14px;
  left: 50%;
  opacity: 0;
  color: var(--ink-soft);
  font: 700 0.51rem/1 var(--mono);
  font-style: normal;
  transform: translateX(-50%);
  transition: opacity 120ms ease;
}
.histogram-bin:hover em { opacity: 1; }
.histogram-axis { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font: 650 0.51rem/1 var(--mono); }
.histogram-meta { margin: 10px 0 0; color: var(--muted); font-size: 0.59rem; line-height: 1.4; }

.lower-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 12px; margin-top: 12px; }
.telemetry-card,
.solutions-card { min-width: 0; padding: 23px; border-radius: 17px; }
.card-heading-row { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.card-heading-row .section-kicker { margin-bottom: 4px; }
.card-heading-row > span { color: var(--muted); font: 700 0.62rem var(--mono); }
.cut-bars { display: grid; gap: 10px; margin-top: 23px; }
.cut-row { display: grid; grid-template-columns: 134px minmax(50px, 1fr) 54px; align-items: center; gap: 10px; }
.cut-row > span { color: var(--muted); font-size: 0.68rem; }
.cut-row > div { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(23,35,33,0.07); }
.cut-row i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width 300ms ease; }
.cut-row:nth-child(2) i { background: var(--teal); }
.cut-row:nth-child(3) i { background: var(--gold); }
.cut-row > strong { font: 700 0.64rem var(--mono); text-align: right; }
.event-log { display: grid; gap: 0; max-height: 160px; margin: 22px 0 0; padding: 0; overflow-y: auto; list-style: none; border-top: 1px solid var(--rule); }
.event-log li { display: grid; grid-template-columns: 58px 1fr; gap: 10px; padding: 9px 2px; border-bottom: 1px solid rgba(23,35,33,0.08); color: var(--muted); font-size: 0.66rem; line-height: 1.35; }
.event-log time { color: var(--teal); font: 700 0.58rem var(--mono); }
.solution-cabinet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 21px; }
.cabinet-empty { grid-column: 1 / -1; display: flex; min-height: 154px; align-items: center; justify-content: center; flex-direction: column; border: 1px dashed var(--rule); border-radius: 12px; color: var(--muted); text-align: center; }
.cabinet-empty span { color: var(--gold); font-size: 2rem; }
.cabinet-empty p { max-width: 260px; margin: 8px 20px 0; font-size: 0.7rem; line-height: 1.5; }
.solution-chip { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 9px; align-items: center; padding: 10px; border: 1px solid rgba(225,175,67,0.25); border-radius: 10px; cursor: pointer; background: rgba(225,175,67,0.07); text-align: left; }
.solution-chip:hover { border-color: rgba(225,175,67,0.65); }
.solution-chip > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #79590d; background: rgba(225,175,67,0.2); font: 500 0.7rem var(--mono); }
.solution-chip strong,
.solution-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.solution-chip strong { font-size: 0.7rem; }
.solution-chip small { margin-top: 3px; color: var(--muted); font: 600 0.56rem var(--mono); }

.engine-notes { margin-top: 12px; padding: 31px; border-radius: 18px; }
.notes-intro { display: grid; grid-template-columns: 0.6fr 1.2fr; column-gap: 40px; align-items: end; }
.notes-intro .eyebrow { grid-column: 1; }
.notes-intro h2 { grid-column: 1; font-size: 2rem; }
.notes-intro > p:last-child { grid-column: 2; grid-row: 1 / span 2; margin: 0; color: var(--muted); line-height: 1.6; }
.note-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 28px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.note-grid article { padding: 22px 18px 22px 0; }
.note-grid article + article { padding-left: 18px; border-left: 1px solid var(--rule); }
.note-grid span { color: var(--accent); font: 700 0.61rem var(--mono); }
.note-grid h3 { margin: 8px 0 7px; font: 400 1.05rem Georgia, serif; }
.note-grid p { margin: 0; color: var(--muted); font-size: 0.68rem; line-height: 1.55; }
.scope-note { margin: 18px 0 0; color: var(--muted); font-size: 0.69rem; line-height: 1.55; }
.scope-note strong { color: var(--ink-soft); }

.record-celebration {
  position: fixed;
  z-index: 45;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  color: #fff8df;
  background: radial-gradient(circle at 50% 46%, rgba(225,175,67,0.19), rgba(7,21,20,0.07) 34%, transparent 68%);
}
.record-celebration[hidden] { display: none; }
.record-celebration.active { animation: recordCurtain 3.5s ease both; }
.record-glow {
  position: absolute;
  width: min(72vw, 760px);
  aspect-ratio: 1;
  border: 1px solid rgba(255,226,151,0.28);
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, rgba(255,232,166,0.16) 0 1deg, transparent 1deg 9deg),
    radial-gradient(circle, rgba(225,175,67,0.22), transparent 64%);
  filter: blur(0.15px);
  mix-blend-mode: screen;
  animation: recordHalo 2.8s cubic-bezier(0.16, 0.72, 0.25, 1) both;
}
.record-copy {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  padding: 30px;
  text-align: center;
  text-shadow: 0 4px 28px rgba(0,0,0,0.5);
  animation: recordPop 650ms cubic-bezier(0.16, 1.35, 0.35, 1) both, recordCopyOut 450ms 2.65s ease forwards;
}
.record-copy > span {
  color: #ffe39b;
  font: 750 clamp(0.72rem, 1.7vw, 1rem)/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.record-copy > strong {
  margin-top: 10px;
  font: 400 clamp(3.4rem, 10vw, 8.5rem)/0.9 Georgia, "Times New Roman", serif;
  letter-spacing: -0.065em;
}
.record-copy > small {
  margin-top: 15px;
  color: rgba(255,248,223,0.76);
  font-size: clamp(0.68rem, 1.4vw, 0.86rem);
}
.record-sparks { position: absolute; inset: 0; }
.record-sparks i {
  position: absolute;
  top: 47%;
  left: 50%;
  width: var(--spark-size);
  height: calc(var(--spark-size) * 0.38);
  border-radius: 999px;
  opacity: 0;
  background: var(--spark-color);
  box-shadow: 0 0 13px var(--spark-color);
  animation: recordSpark 1.45s var(--spark-delay) cubic-bezier(0.12, 0.62, 0.2, 1) both;
}
.board-stage.record-found { animation: recordBoard 1.7s ease both; }
.score-marquee-item.overall.record-set { animation: recordScore 3.2s ease both; }

.toast {
  position: fixed;
  z-index: 50;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100% - 40px));
  padding: 12px 15px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  color: white;
  background: var(--ink-soft);
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  font-size: 0.72rem;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }

@keyframes shimmer { from { background-position: -70px 0; } to { background-position: 140px 0; } }
@keyframes scanMeter { from { left: 0; } to { left: 100%; } }
@keyframes boardSweep { 0% { transform: translateY(-100%); } 55%, 100% { transform: translateY(335%); } }
@keyframes enginePulse { 50% { opacity: 0.45; transform: scale(0.82); } }
@keyframes fieldRotate { to { transform: rotate(360deg) scale(1.1); } }
@keyframes fieldBreathe { to { opacity: 0.48; } }
@keyframes scanTexture { to { background-position: 0 28px; } }
@keyframes histogramRise { from { transform: scaleY(0.05); opacity: 0.25; } }
@keyframes scorePulse { 50% { opacity: 0.62; text-shadow: 0 0 18px rgba(240,100,60,0.55); } }
@keyframes infiniteBatch { to { transform: translateX(435%); } }
@keyframes recordCurtain {
  0% { opacity: 0; }
  12%, 78% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes recordHalo {
  0% { opacity: 0; transform: scale(0.12) rotate(-12deg); }
  32% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.55) rotate(30deg); }
}
@keyframes recordPop {
  0% { opacity: 0; transform: scale(0.55) translateY(24px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes recordCopyOut { to { opacity: 0; transform: scale(1.06) translateY(-8px); } }
@keyframes recordSpark {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--spark-angle)) translateX(0) scale(0.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--spark-angle)) translateX(var(--spark-distance)) scale(0.05); }
}
@keyframes recordBoard {
  0%, 100% { box-shadow: inset 0 0 45px rgba(0,0,0,0.32), 0 18px 35px rgba(24,32,29,0.14); }
  35% { box-shadow: inset 0 0 80px rgba(225,175,67,0.26), 0 0 0 3px rgba(255,225,146,0.74), 0 0 58px rgba(225,175,67,0.52); }
}
@keyframes recordScore {
  0%, 100% { background: transparent; }
  20%, 72% { background: rgba(225,175,67,0.2); box-shadow: inset 0 0 0 1px rgba(255,226,151,0.38); }
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 235px minmax(0, 1fr); }
  .miner-rail { padding-inline: 15px; }
  .miner-main { width: min(100% - 36px, 950px); padding-top: 36px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .workbench { grid-template-columns: 1fr; }
  .board-stage { width: min(100%, 610px); }
  .control-card { display: grid; grid-template-columns: 1fr 1fr; column-gap: 25px; }
  .control-heading, .amount-label, .amount-slider, .slider-ticks { grid-column: 1; }
  .search-buttons { grid-column: 2; grid-row: 1 / span 4; margin-top: 0; align-self: start; }
  .method-toggle, .batch-status, .score-panel { grid-column: 1 / -1; }
  .note-grid { grid-template-columns: repeat(2, 1fr); }
  .note-grid article:nth-child(3) { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .note-grid article:nth-child(4) { border-top: 1px solid var(--rule); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .miner-rail { position: relative; height: auto; padding: 16px; overflow: visible; }
  .miner-rail::after, .saved-heading, .rail-footer { display: none; }
  .rail-brand { padding: 0 0 13px; }
  .rail-brand p { display: none; }
  .page-switcher { width: min(100%, 620px); margin: 0 auto 30px; }
  .new-n-form { display: grid; grid-template-columns: auto minmax(170px, 230px); align-items: center; gap: 16px; padding: 11px 13px; }
  .new-n-form > div { margin: 0; }
  .new-n-form small { display: none; }
  .saved-list { display: flex; gap: 5px; margin: 12px 0 0; padding: 0; overflow-x: auto; }
  .saved-n { width: auto; min-width: 118px; margin: 0; padding: 9px; }
  .saved-n:hover { transform: none; }
  .miner-main { width: min(100% - 24px, 680px); padding: 30px 0 55px; }
  .miner-header { align-items: start; flex-direction: column; gap: 18px; }
  .miner-header h1 { font-size: clamp(2.7rem, 12vw, 4.5rem); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .lower-grid { grid-template-columns: 1fr; }
  .notes-intro { display: block; }
  .notes-intro > p:last-child { margin-top: 12px; }
}

@media (max-width: 520px) {
  .miner-rail { padding: 13px; }
  .rail-brand strong { font-size: 1.18rem; }
  .brand-mark { width: 31px; height: 31px; }
  .brand-mark::before, .brand-mark::after, .brand-mark i { display: none; }
  .page-switcher { gap: 3px; margin-bottom: 26px; padding: 4px; }
  .page-switcher a { display: grid; place-items: center; padding: 10px 6px; font-size: 0.68rem; line-height: 1.2; }
  .new-n-form { grid-template-columns: auto 1fr; gap: 9px; }
  .new-n-form label { font-size: 0.58rem; }
  .miner-main { width: calc(100% - 18px); padding-top: 24px; }
  .miner-header h1 { font-size: clamp(2.4rem, 14vw, 3.8rem); }
  .lede { font-size: 0.85rem; }
  .header-actions { width: 100%; }
  .quiet-button { flex: 1; }
  .stat-grid { gap: 7px; }
  .stat-card { padding: 15px 13px; }
  .stat-card > strong { font-size: 1.55rem; }
  .stat-card small { font-size: 0.59rem; }
  .progress-card { padding: 16px 14px; }
  .progress-heading { align-items: start; }
  .progress-heading h2 { font-size: 1.17rem; }
  .progress-heading > strong { font-size: 0.83rem; }
  .progress-foot { align-items: start; flex-direction: column; gap: 4px; }
  .board-card, .control-card, .telemetry-card, .solutions-card { padding: 17px; }
  .board-heading h2, .control-heading h2, .card-heading-row h2 { font-size: 1.3rem; }
  .board-readout { gap: 8px; }
  .score-marquee-item { min-height: 88px; padding: 13px 10px 11px; }
  .score-marquee-item > strong { font-size: clamp(1.65rem, 10vw, 2.6rem); }
  .score-marquee-item > small { font-size: 0.5rem; }
  .control-card { display: block; }
  .search-buttons { margin-top: 22px; }
  .cut-row { grid-template-columns: 105px minmax(40px, 1fr) 45px; gap: 7px; }
  .solution-cabinet { grid-template-columns: 1fr; }
  .score-histogram { height: 120px; }
  .note-grid { grid-template-columns: 1fr; }
  .note-grid article,
  .note-grid article + article { padding: 17px 0; border-left: 0; border-top: 1px solid var(--rule); }
  .note-grid article:first-child { border-top: 0; }
  .engine-notes { padding: 22px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .record-celebration.active { opacity: 1; animation: none !important; }
  .record-glow, .record-copy, .record-sparks i { animation: none !important; }
  .record-sparks { display: none; }
  .mini-track span.infinite { width: 100%; opacity: 0.58; transform: none; animation: none !important; }
}
