/* egg.css — calm, restrained palette with a yolk/gold accent.
   Mobile-first; widens to a two-column layout on larger screens. */

:root {
  --bg: #17130d;
  --bg-panel: #211a12;
  --bg-row: #2a2117;
  --bg-row-hover: #34291b;
  --ink: #f3ead9;
  --ink-dim: #b7a98f;
  --ink-faint: #7d7160;
  --line: #3a2f20;
  --yolk: #f5c542;
  --yolk-deep: #e0a92e;
  --gold: #ffd76a;
  --good: #8fd17a;
  --danger: #d97b6b;
  --shell: #fbf6ec;
  --radius: 12px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.potato-home-link {
  display: inline-block;
  padding: 10px 14px;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.85rem;
}
.potato-home-link:hover { color: var(--ink); }

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
}
.topbar .brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.topbar .totals { display: flex; align-items: baseline; gap: 6px; }
.topbar .eggs {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--shell);
  font-variant-numeric: tabular-nums;
}
.topbar .eggs.eggfinity-active {
  line-height: 1;
}
.eggfinity {
  display: inline-flex;
  align-items: center;
  vertical-align: -0.16em;
  filter: drop-shadow(0 0 8px rgba(255, 215, 106, 0.24));
}
.eggfinity svg {
  width: 2.85em;
  height: 1.05em;
  overflow: visible;
}
.eggfinity-shell {
  fill: #fbf6ec;
  stroke: #ffd76a;
  stroke-width: 2;
}
.eggfinity-shine {
  fill: none;
  stroke: rgba(255, 255, 255, 0.76);
  stroke-width: 2.4;
  stroke-linecap: round;
}
.topbar .eps { color: var(--yolk); font-variant-numeric: tabular-nums; }
.albumen-total {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--shell);
  font-variant-numeric: tabular-nums;
}
.albumen-total .aps { color: var(--ink-dim); font-size: 0.8rem; }
.shells-total { color: var(--gold); font-variant-numeric: tabular-nums; }
.ishell { width: 1em; height: 1em; vertical-align: -0.15em; }
.cash-total { display: inline-flex; align-items: center; gap: 4px; color: #f0d873; font-variant-numeric: tabular-nums; }
.icash { width: 1em; height: 1em; vertical-align: -0.15em; }
.faith-total { display: inline-flex; align-items: center; gap: 6px; color: #e7b86a; font-variant-numeric: tabular-nums; }
.ifaith { width: 1em; height: 1em; vertical-align: -0.15em; }
.faith-total .fps { color: var(--ink-dim); font-size: 0.8rem; }
.paperwork-total { display: inline-flex; align-items: baseline; gap: 6px; color: #cdd3da; font-variant-numeric: tabular-nums; }
.paperwork-total .pps { color: var(--ink-dim); font-size: 0.8rem; }
.heat-total { display: inline-flex; align-items: baseline; gap: 6px; color: #ffb45b; font-variant-numeric: tabular-nums; }
.heat-total .hps { color: var(--ink-dim); font-size: 0.8rem; }
.signal-total { display: inline-flex; align-items: baseline; gap: 6px; color: #b8d6ff; font-variant-numeric: tabular-nums; }
.signal-total .sps { color: var(--ink-dim); font-size: 0.8rem; }
.topbar .spacer { flex: 1; }
.topbar .util-btn {
  background: var(--bg-row);
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.85rem;
}
.topbar .util-btn:hover { background: var(--bg-row-hover); color: var(--ink); }

/* --- Layout --- */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px;
  max-width: 1100px;
  margin: 0 auto;
}
.left-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
/* Mobile: flatten the left column so the shop stays near the egg, then the
   Phase 3 Star Map appears before older project lists. */
@media (max-width: 859px) {
  .left-col { display: contents; }
  .stage { order: 1; }
  .panel { order: 2; }
  #star-map-section { order: 3; }
  #project-section { order: 4; }
}
@media (min-width: 860px) {
  .layout { grid-template-columns: 1fr 360px; align-items: start; }
}

/* --- Stage (egg) --- */
.stage {
  position: relative;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(circle at 50% 35%, #221a11 0%, var(--bg) 70%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  user-select: none;
}

.egg-button {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  width: 200px;
  height: 250px;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.45));
  transition: transform 0.06s ease;
}
.egg-button:active { transform: scale(0.97); }
.egg-button.squash { animation: squash 0.16s ease; }
@keyframes squash {
  0% { transform: scale(1, 1); }
  40% { transform: scale(1.08, 0.9); }
  100% { transform: scale(1, 1); }
}
.reduced-motion .egg-button.squash { animation: none; }

.status-line {
  color: var(--ink-dim);
  font-style: italic;
  min-height: 1.4em;
  text-align: center;
  padding: 0 12px;
}

.warmth-pill {
  position: absolute;
  top: 12px;
  z-index: 5;
  pointer-events: none;
  padding: 6px 12px;
  background: rgba(33, 25, 12, 0.92);
  border: 1px solid var(--yolk-deep);
  color: var(--gold);
  border-radius: 999px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* floating click numbers */
.float-num {
  position: absolute;
  pointer-events: none;
  color: var(--gold);
  font-weight: 700;
  font-size: 1.1rem;
  transform: translate(-50%, -50%);
  animation: floatUp 0.9s ease-out forwards;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
@keyframes floatUp {
  0% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -160%); }
}
.golden-collect-pop {
  position: absolute;
  left: 50%;
  top: 26%;
  z-index: 8;
  pointer-events: none;
  min-width: min(280px, 86%);
  padding: 10px 14px;
  border: 1px solid rgba(255, 215, 106, 0.72);
  border-radius: 999px;
  background: rgba(33, 25, 12, 0.92);
  color: var(--gold);
  text-align: center;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 24px rgba(255, 215, 106, 0.36), 0 8px 28px rgba(0, 0, 0, 0.38);
  animation: goldenCollectPop 1.7s ease-out forwards;
}
.golden-collect-pop span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff0b6;
}
.golden-collect-pop strong {
  display: block;
  margin-top: 2px;
  color: var(--shell);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}
.golden-collect-pop.auto {
  border-color: rgba(139, 189, 255, 0.74);
  box-shadow: 0 0 24px rgba(139, 189, 255, 0.3), 0 8px 28px rgba(0, 0, 0, 0.38);
}
@keyframes goldenCollectPop {
  0% { opacity: 0; transform: translate(-50%, -44%) scale(0.92); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  72% { opacity: 1; transform: translate(-50%, -58%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -74%) scale(0.98); }
}

/* event egg */
.event-egg {
  position: absolute;
  width: 56px;
  height: 56px;
  font-size: 32px;
  line-height: 56px;
  text-align: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  animation: pop 0.3s ease, bob 1.6s ease-in-out infinite 0.3s;
}
.event-gold { background: radial-gradient(circle at 40% 35%, #fff1c2, var(--yolk-deep)); box-shadow: 0 0 18px var(--gold); }
.event-yolk { background: radial-gradient(circle at 40% 35%, #ffe2a8, #e08a2e); box-shadow: 0 0 18px #ffae5b; }
.event-rotten { background: radial-gradient(circle at 40% 35%, #d6e0a8, #6f7a3a); box-shadow: 0 0 18px #9bb24a; filter: saturate(0.8); }
.event-dense { background: radial-gradient(circle at 40% 35%, #cfc3e6, #4a3a6f); box-shadow: 0 0 18px #9b7ee0; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.reduced-motion .event-egg,
.reduced-motion .golden-collect-pop { animation: none; }

/* --- Panel --- */
.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.panel section,
#project-section,
#star-map-section,
#signal-decoder-section {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.panel h2,
#project-section h2,
#star-map-section h2,
#signal-decoder-section h2 {
  margin: 0 0 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

/* producer rows */
.shop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--bg-row);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  color: var(--ink);
  opacity: 0.55;
  transition: background 0.1s, opacity 0.1s;
}
.shop-row.affordable { opacity: 1; }
.shop-row.affordable:hover { background: var(--bg-row-hover); }
.shop-row:disabled { cursor: default; }
.row-icon { font-size: 1.5rem; }
.row-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.row-name { font-weight: 600; }
.row-owned { color: var(--yolk); font-weight: 700; }
.row-sub { font-size: 0.78rem; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.row-cost { font-variant-numeric: tabular-nums; color: var(--shell); white-space: nowrap; }

/* upgrades */
.upgrade-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.upgrade-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  background: var(--bg-row);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  color: var(--ink);
  opacity: 0.55;
}
.upgrade-card.affordable { opacity: 1; border-color: var(--yolk-deep); }
.upgrade-card.affordable:hover { background: var(--bg-row-hover); }
.upgrade-card:disabled { cursor: default; }
.up-name { font-weight: 600; font-size: 0.85rem; }
.up-desc { font-size: 0.72rem; color: var(--ink-dim); }
.up-cost { font-size: 0.8rem; color: var(--shell); font-variant-numeric: tabular-nums; }

.aps-note { font-weight: 400; color: var(--ink-faint); text-transform: none; letter-spacing: 0; }
.empty-note { grid-column: 1 / -1; font-size: 0.78rem; color: var(--ink-faint); margin: 0; }

/* projects */
.project-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--bg-row);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  color: var(--ink);
  cursor: pointer;
  opacity: 0.55;
}
button.project-row.affordable { opacity: 1; border-color: var(--yolk-deep); }
button.project-row.affordable:hover { background: var(--bg-row-hover); }
button.project-row:disabled { cursor: default; }
.project-row.done { opacity: 0.45; cursor: default; }
.project-row.done .proj-name { color: var(--good); }
.proj-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.proj-name { font-weight: 600; }
.proj-desc { font-size: 0.75rem; color: var(--ink-dim); }
.proj-cost { font-size: 0.8rem; color: var(--shell); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Phase 3 star map */
#star-map-section {
  border-color: rgba(135, 180, 255, 0.28);
  background:
    radial-gradient(circle at 74% 12%, rgba(86, 127, 206, 0.18), transparent 35%),
    radial-gradient(circle at 22% 86%, rgba(245, 197, 66, 0.08), transparent 30%),
    var(--bg-panel);
}
.star-map-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.star-map-head h2 { margin: 0; }
.star-map-stage {
  font-size: 0.76rem;
  color: #b8d6ff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.star-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.75fr);
  gap: 12px;
}
.star-map {
  width: 100%;
  min-height: 340px;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(101, 143, 214, 0.12), transparent 58%),
    radial-gradient(circle at 70% 18%, rgba(255, 215, 106, 0.06), transparent 28%),
    #090d16;
  border: 1px solid rgba(135, 180, 255, 0.22);
  border-radius: 12px;
  box-shadow: inset 0 0 55px rgba(20, 50, 100, 0.34), 0 0 0 1px rgba(255,255,255,0.02);
}
.star-map-bg { fill: transparent; opacity: 0; }
.egg-galaxy-fill {
  fill: rgba(44, 71, 122, 0.18);
}
.egg-galaxy-halo {
  fill: rgba(143, 209, 122, 0.035);
  stroke: rgba(184, 214, 255, 0.08);
  stroke-width: 0.8;
  filter: drop-shadow(0 0 7px rgba(135, 180, 255, 0.2));
}
.egg-galaxy-outline {
  fill: none;
  stroke: rgba(255, 247, 211, 0.42);
  stroke-width: 0.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(255, 215, 106, 0.38));
}
.star-decor { fill: #dbe9ff; opacity: 0.62; }
.star-decor-1 { fill: #fff0b6; opacity: 0.48; }
.star-decor-2 { fill: #9fc6ff; opacity: 0.56; }
.ovoid-guide {
  fill: rgba(143, 209, 122, 0.025);
  stroke: rgba(143, 209, 122, 0.18);
  stroke-width: 0.45;
  stroke-dasharray: 1.2 1.4;
}
.ovoid-guide-4 {
  fill: rgba(143, 209, 122, 0.045);
  stroke: rgba(255, 215, 106, 0.28);
  stroke-width: 0.55;
}
.ovoid-shell-path {
  fill: none;
  stroke: rgba(255, 247, 211, 0.18);
  stroke-width: 0.45;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px rgba(255, 215, 106, 0.28));
}
.star-route {
  stroke: rgba(150, 185, 235, 0.18);
  stroke-width: 0.35;
  stroke-linecap: round;
}
.star-route.route-lit {
  stroke: rgba(184, 214, 255, 0.7);
  stroke-width: 0.55;
}
.star-route.route-ovoid.route-lit {
  stroke: rgba(194, 229, 177, 0.78);
  stroke-width: 0.62;
  filter: drop-shadow(0 0 2px rgba(143, 209, 122, 0.25));
}
.star-route.route-active {
  stroke: #ffd76a;
  stroke-width: 0.9;
  stroke-dasharray: 1.2 1;
  animation: routePulse 1.1s linear infinite;
  filter: drop-shadow(0 0 3px rgba(255, 215, 106, 0.7));
}
@keyframes routePulse {
  from { stroke-dashoffset: 0; opacity: 0.65; }
  50% { opacity: 1; }
  to { stroke-dashoffset: -2.2; opacity: 0.65; }
}
.star-node-wrap { cursor: pointer; outline: none; }
.star-node-hit {
  fill: transparent;
  pointer-events: all;
}
.star-node-core { fill: #7f8da5; }
.star-node-ring {
  fill: transparent;
  stroke: rgba(127, 141, 165, 0.55);
  stroke-width: 0.35;
}
.star-node-available .star-node-core,
.star-node-active .star-node-core { fill: var(--gold); }
.star-node-available .star-node-ring,
.star-node-active .star-node-ring {
  stroke: var(--gold);
  animation: nodePulse 1.4s ease-in-out infinite;
}
.star-node-complete .star-node-core { fill: #8fd17a; opacity: 0.82; }
.star-node-complete .star-node-ring { stroke: rgba(143, 209, 122, 0.48); }
.star-node-wrap.selected .star-node-ring {
  stroke: #fff7d3;
  stroke-width: 0.8;
  filter: drop-shadow(0 0 4px rgba(255, 247, 211, 0.45));
}
.star-node-capstone .star-node-core {
  fill: var(--gold);
  filter: drop-shadow(0 0 5px rgba(255, 215, 106, 0.75));
}
.star-node-capstone .star-node-ring {
  stroke: var(--gold);
  stroke-width: 0.75;
}
.probe-dot {
  fill: #fff7d3;
  stroke: var(--gold);
  stroke-width: 0.45;
  filter: drop-shadow(0 0 6px rgba(255, 215, 106, 0.95));
}
@keyframes nodePulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
.reduced-motion .star-route.route-active,
.reduced-motion .star-node-ring { animation: none; }
.star-node-detail {
  background: rgba(13, 16, 24, 0.72);
  border: 1px solid rgba(135, 180, 255, 0.22);
  border-radius: 12px;
  padding: 12px;
  min-height: 260px;
}
.star-node-detail h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--shell);
}
.node-region {
  margin: 0 0 6px;
  color: #b8d6ff;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.node-desc,
.node-flavor {
  margin: 0 0 10px;
  color: var(--ink-dim);
  font-size: 0.8rem;
}
.node-flavor { color: var(--ink-faint); font-style: italic; }
.node-stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 0 0 10px;
  font-size: 0.78rem;
}
.node-stats dt { color: var(--ink-faint); }
.node-stats dd { margin: 0; color: var(--shell); font-variant-numeric: tabular-nums; }
.expedition-bar {
  height: 8px;
  background: var(--bg-row);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 0 10px;
}
.expedition-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #8bbdff, var(--gold));
}
.node-action {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-row);
  color: var(--ink-dim);
  padding: 8px 10px;
  cursor: default;
}
.node-action.affordable {
  color: #251b08;
  background: var(--gold);
  border-color: var(--gold);
  cursor: pointer;
  font-weight: 700;
}
.signal-decoder {
  margin-top: 12px;
  border-color: rgba(184, 214, 255, 0.24);
  background:
    radial-gradient(circle at 16% 12%, rgba(184, 214, 255, 0.12), transparent 34%),
    rgba(17, 22, 33, 0.92);
}
.signal-decoder-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.signal-decoder-head h2 { margin: 0; }
.signal-decoder-head span {
  color: #b8d6ff;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.signal-decoder-copy,
.signal-result {
  margin: 0 0 10px;
  color: var(--ink-dim);
  font-size: 0.8rem;
}
.signal-readout {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(135, 180, 255, 0.22);
  background: #090d16;
  color: #b8d6ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
}
.signal-decoded {
  margin: 8px 0;
  color: var(--shell);
  font-size: 1rem;
  font-weight: 700;
}
.signal-tuning {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0;
}
.signal-tune {
  display: flex;
  min-height: 128px;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(135, 180, 255, 0.22);
  border-radius: 10px;
  background: rgba(9, 13, 22, 0.82);
  color: var(--ink-dim);
  padding: 9px;
  text-align: left;
  cursor: pointer;
}
.signal-tune:hover:not(:disabled) {
  border-color: rgba(255, 215, 106, 0.55);
  background: rgba(37, 29, 13, 0.76);
}
.signal-tune:disabled {
  cursor: default;
  opacity: 0.66;
}
.signal-tune.tuned {
  border-color: rgba(143, 209, 122, 0.62);
  box-shadow: inset 0 0 18px rgba(143, 209, 122, 0.08);
}
.signal-tune-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.signal-tune strong {
  display: block;
  margin-bottom: 8px;
  color: var(--shell);
  font-size: 0.9rem;
}
.frequency-track {
  position: relative;
  display: block;
  width: 100%;
  height: 42px;
  border-bottom: 2px solid rgba(139, 189, 255, 0.42);
  background: repeating-linear-gradient(90deg, transparent 0 13px, rgba(184, 214, 255, 0.16) 14px 15px);
}
.frequency-track b {
  position: absolute;
  bottom: -7px;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #8bbdff;
  box-shadow: 0 0 14px rgba(139, 189, 255, 0.75);
  transform: translateX(-50%);
  transition: left 0.14s ease;
}
.frequency-track em {
  position: absolute;
  bottom: -3px;
  width: 1px;
  height: 18px;
  background: rgba(255, 247, 211, 0.38);
}
.frequency-track em:nth-of-type(1) { left: 12%; }
.frequency-track em:nth-of-type(2) { left: 50%; }
.frequency-track em:nth-of-type(3) { left: 88%; }
.signal-tune-frequency[data-value="0"] .frequency-track b { left: 12%; }
.signal-tune-frequency[data-value="1"] .frequency-track b { left: 50%; }
.signal-tune-frequency[data-value="2"] .frequency-track b { left: 88%; }
.phase-dial {
  position: relative;
  display: block;
  width: 58px;
  height: 58px;
  margin: 0 auto;
  border: 1px solid rgba(135, 180, 255, 0.22);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 215, 106, 0.18), transparent 32%),
    conic-gradient(from 0deg, rgba(150, 111, 255, 0.1), rgba(184, 214, 255, 0.24), rgba(150, 111, 255, 0.1));
  box-shadow: inset 0 0 18px rgba(150, 111, 255, 0.12);
}
.phase-dial b {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 25px;
  border-radius: 999px;
  background: #c8b8ff;
  box-shadow: 0 0 12px rgba(200, 184, 255, 0.78);
  transform-origin: 50% 100%;
  transform: translate(-50%, -100%) rotate(0deg);
  transition: transform 0.14s ease;
}
.signal-tune-phase[data-value="0"] .phase-dial b { transform: translate(-50%, -100%) rotate(-50deg); }
.signal-tune-phase[data-value="1"] .phase-dial b { transform: translate(-50%, -100%) rotate(0deg); }
.signal-tune-phase[data-value="2"] .phase-dial b { transform: translate(-50%, -100%) rotate(50deg); }
.shell-selector {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
}
.shell-selector em {
  display: block;
  width: 24px;
  height: 34px;
  border: 2px solid rgba(255, 247, 211, 0.28);
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  background: rgba(255, 215, 106, 0.04);
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}
.shell-selector em:nth-child(1) { width: 18px; height: 30px; }
.shell-selector em:nth-child(3) { width: 30px; height: 40px; }
.signal-tune-shell[data-value="0"] .shell-selector em:nth-child(1),
.signal-tune-shell[data-value="1"] .shell-selector em:nth-child(2),
.signal-tune-shell[data-value="2"] .shell-selector em:nth-child(3) {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(255, 215, 106, 0.58);
  transform: translateY(-3px);
}
.signal-resonance {
  height: 9px;
  margin: 0 0 10px;
  overflow: hidden;
  border: 1px solid rgba(135, 180, 255, 0.22);
  border-radius: 999px;
  background: #090d16;
}
.signal-resonance span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #8bbdff, var(--gold));
  transition: width 0.16s ease;
}
.signal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.signal-actions .node-action:not(:disabled) {
  color: #251b08;
  background: var(--gold);
  border-color: var(--gold);
  cursor: pointer;
  font-weight: 700;
}
@media (max-width: 720px) {
  .star-map-layout { grid-template-columns: 1fr; }
  .star-map { min-height: 260px; }
  .signal-tuning { grid-template-columns: 1fr; }
  .signal-actions { grid-template-columns: 1fr; }
}

/* prestige */
#prestige-section { border-color: var(--yolk-deep); }
.prestige-summary { font-size: 0.82rem; color: var(--ink-dim); margin: 0 0 10px; }
.prestige-tabs { display: flex; gap: 6px; margin: 0 0 10px; flex-wrap: wrap; }
.prestige-tab {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  cursor: pointer;
}
.prestige-tab.active { color: var(--ink); border-color: var(--gold); background: rgba(232,195,74,0.08); }
.prestige-tab:disabled { opacity: 0.45; cursor: default; }
.shell-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shell-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  background: var(--bg-row);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  color: var(--ink);
  cursor: pointer;
  opacity: 0.55;
}
button.shell-card.affordable { opacity: 1; border-color: var(--gold); }
button.shell-card.affordable:hover { background: var(--bg-row-hover); }
button.shell-card:disabled { cursor: default; }

/* Cult of egg (Phase 2A) */
.cult-summary { font-size: 0.82rem; color: var(--ink-dim); margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.doctrine-card .shell-lvl { color: #e7b86a; font-size: 0.74rem; font-weight: 600; }
button.doctrine-card.affordable { border-color: #e7b86a; }

/* Chapter-transition banner (Phase 2 break) */
.chapter-banner {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
  background: rgba(8, 6, 4, 0);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease, background 0.6s ease;
}
.chapter-banner.show {
  opacity: 1;
  pointer-events: auto;
  background: rgba(8, 6, 4, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.chapter-banner-text {
  max-width: 640px;
  margin: 0;
  font-size: clamp(1.25rem, 3.2vw, 1.9rem);
  line-height: 1.4;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.65);
  transform: translateY(10px);
  transition: transform 0.6s ease;
}
.chapter-banner.show .chapter-banner-text { transform: translateY(0); }
.chapter-banner-hint { font-size: 0.76rem; letter-spacing: 0.04em; color: var(--ink-dim); text-transform: uppercase; }
.reduced-motion .chapter-banner,
.reduced-motion .chapter-banner-text { transition: none; transform: none; }

/* Former Operations (collapsed phase-1 shop) */
.former-ops {
  background: var(--bg-row);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.former-projects { margin-bottom: 12px; }
.former-ops-note { font-size: 0.82rem; color: var(--ink-dim); margin: 0 0 4px; font-style: italic; }
.former-ops-stat { font-size: 0.78rem; color: var(--ink-faint); margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.former-ops-toggle {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.76rem;
  cursor: pointer;
}
.former-ops-toggle:hover { color: var(--ink); border-color: var(--gold); }

/* commerce (Empire A) */
.demand-line { font-size: 0.82rem; color: var(--ink-dim); margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.commerce-hint { font-size: 0.72rem; color: var(--ink-faint); margin: 0 0 10px; }
.sell-slider { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.sell-slider .slider-end { font-size: 0.8rem; color: var(--ink-dim); min-width: 30px; }
.sell-slider .slider-end:last-child { text-align: right; }
.sell-slider input[type="range"] { flex: 1; accent-color: var(--yolk); cursor: pointer; }
.order-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-row);
  border: 1px solid var(--yolk-deep);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}
.order-text { font-size: 0.85rem; }
.order-reward { font-size: 0.8rem; color: var(--gold); display: flex; align-items: center; gap: 4px; }
.order-accept {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  color: var(--ink-faint);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: default;
}
.order-accept.affordable { background: var(--yolk); color: #2a1f08; border-color: var(--yolk); font-weight: 700; cursor: pointer; }
.order-timer { font-size: 0.72rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* communications array (the inside joke) */
.comms-log {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
  background: var(--bg-row);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.comms-line { line-height: 1.3; }
.comms-good { color: var(--good); }
.comms-bad { color: var(--danger); }
.comms-sys { color: var(--ink-faint); font-style: italic; }
.comms-input {
  width: 100%;
  background: var(--bg-row);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
}
.comms-input:focus { outline: none; border-color: var(--yolk-deep); }

/* --- Toasts / save flash --- */
.toasts {
  position: fixed;
  left: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
}
.toast {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-faint);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-good { border-left-color: var(--good); }
.toast-gold { border-left-color: var(--gold); }

.cloud-status {
  position: fixed;
  right: 16px;
  bottom: 16px;
  font-size: 0.78rem;
  color: var(--ink-faint);
  opacity: 0;
  transition: opacity 0.25s;
}
.cloud-status.show { opacity: 1; }

/* --- Modal --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: min(440px, 100%);
  max-height: 80vh;
  overflow: auto;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 1rem; }
.modal-close {
  background: none; border: none; color: var(--ink-dim);
  font-size: 1.3rem; cursor: pointer; line-height: 1;
}
.modal-body { padding: 16px; }

.ach-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ach-list li { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; background: var(--bg-row); }
.ach-list li.locked { opacity: 0.5; }
.ach-list li.got strong { color: var(--gold); }
.ach-list span { font-size: 0.78rem; color: var(--ink-dim); }

.stats-grid { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; margin: 0; }
.stats-grid dt { color: var(--ink-dim); }
.stats-grid dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--shell); }

.setting { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.modal-body hr { border: none; border-top: 1px solid var(--line); margin: 12px 0; }
.danger {
  background: transparent; border: 1px solid var(--danger); color: var(--danger);
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
}
.danger:hover { background: rgba(217, 123, 107, 0.12); }
