/* Molt Season — trace player.
   Palette: abyssal ink, shell cream, ONE coral (the crab, the losses, the
   stamp). Same discipline as the divorce player: three colors, big type,
   nothing decorative that isn't carrying a number. */

:root {
  --ink: #0d1417;
  --ink-2: #131d21;
  --ink-3: #1b282d;
  --shell: #f2ede1;
  --coral: #d4573d;
  --kelp: #4f8f76;
  --gold: #c9a227;
  --cream-90: rgba(242, 237, 225, 0.9);
  --cream-70: rgba(242, 237, 225, 0.7);
  --cream-50: rgba(242, 237, 225, 0.5);
  --cream-30: rgba(242, 237, 225, 0.3);
  --cream-15: rgba(242, 237, 225, 0.15);
  --cream-07: rgba(242, 237, 225, 0.07);
  --serif: Georgia, 'Times New Roman', Times, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--ink);
  color: var(--shell);
  font-family: var(--sans);
  font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: var(--mono); }
.dim { color: var(--cream-50); }

button {
  font: inherit; cursor: pointer; background: none;
  border: 1px solid var(--cream-30); color: var(--cream-90);
  border-radius: 4px; padding: 0.3rem 0.7rem;
}
button:hover { border-color: var(--cream-70); }
a { color: var(--cream-70); }

/* ----------------------------------------------------------------- chrome */
#chrome {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(var(--ink) 78%, transparent);
  padding: 0.9rem 1.2rem 1.2rem;
}
#topbar { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; max-width: 1180px; margin: 0 auto; }
#brand { font-family: var(--serif); font-size: 1.5rem; letter-spacing: 0.14em; }
#sub { color: var(--cream-50); font-size: 0.85rem; font-style: italic; }
#playctl { margin-left: auto; display: flex; gap: 0.4rem; }
#playctl button { font-size: 0.8rem; }

#stage { max-width: 1180px; margin: 0 auto; padding: 0 1.2rem 5rem; }
.scene { margin: 3.2rem 0; }
.sect {
  font-family: var(--serif); font-weight: normal; font-size: 1.6rem;
  letter-spacing: 0.02em; margin: 0 0 0.4rem;
}
.lede { color: var(--cream-70); max-width: 62ch; margin: 0 0 1.4rem; }

.card {
  background: var(--ink-2); border: 1px solid var(--cream-15);
  border-radius: 10px; padding: 1.3rem 1.4rem;
}

/* ------------------------------------------------------------- crab card */
.crabhead { display: flex; gap: 1rem; align-items: center; }
.crabhead .glyph { font-size: 3rem; line-height: 1; }
.crabcard h1 { font-family: var(--serif); font-weight: normal; font-size: 2rem; margin: 0; }
#crab-line { font-size: 0.85rem; letter-spacing: 0.04em; }
#crab-body { margin-top: 1.1rem; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.fact { border-left: 2px solid var(--cream-15); padding-left: 0.8rem; }
.fact .k { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cream-50); }
.fact .v { font-size: 1.25rem; font-family: var(--mono); }
.fact .n { font-size: 0.8rem; color: var(--cream-50); }
.fact.hot { border-left-color: var(--coral); }
.fact.hot .v { color: var(--coral); }

/* ---------------------------------------------------------- price ledger */
#prices { display: grid; gap: 0.5rem; }
.prow {
  display: grid; grid-template-columns: 8.5rem 1fr auto; align-items: center;
  gap: 0.9rem; padding: 0.5rem 0.7rem; border-radius: 6px; background: var(--cream-07);
}
.prow .iname { font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.05em; }
.bars { display: grid; gap: 3px; }
.bar { height: 15px; border-radius: 2px; position: relative; min-width: 2px; }
.bar.worth { background: var(--kelp); }
.bar.cost { background: var(--coral); opacity: 0.75; }
.bar span {
  position: absolute; left: calc(100% + 6px); top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 0.7rem; color: var(--cream-50); white-space: nowrap;
}
.pgap { font-family: var(--mono); font-size: 0.9rem; text-align: right; min-width: 6.5rem; }
.pgap.good { color: var(--kelp); }
.pgap.bad { color: var(--coral); }
.plegend { margin-top: 0.7rem; font-size: 0.8rem; color: var(--cream-50); }
.plegend b { font-weight: 600; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }

/* ------------------------------------------------------------- the race */
#clockbar {
  position: sticky; top: 3.6rem; z-index: 10;
  display: flex; align-items: center; gap: 1.2rem;
  background: var(--ink); padding: 0.6rem 0; margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--cream-15);
}
.daybox { display: flex; align-items: baseline; gap: 0.5rem; }
.daynum { font-size: 2.4rem; line-height: 1; font-variant-numeric: tabular-nums; }
.daylab { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cream-50); }
#expiry { font-size: 0.8rem; color: var(--gold); }
#expiry.gone { color: var(--coral); }

#race { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.lane { background: var(--ink-2); border: 1px solid var(--cream-15); border-radius: 10px; padding: 1rem; min-height: 320px; }
.lanehead h3 { font-family: var(--serif); font-weight: normal; font-size: 1.15rem; letter-spacing: 0.1em; margin: 0; }
.lanesub { font-size: 0.75rem; color: var(--cream-50); margin-bottom: 0.9rem; }
#lane-slow { border-top: 3px solid var(--coral); }
#lane-fast { border-top: 3px solid var(--kelp); }

.feed { display: grid; gap: 0.55rem; }
.ev {
  border: 1px solid var(--cream-15); border-radius: 7px; padding: 0.6rem 0.75rem;
  background: var(--ink-3); animation: pop 0.35s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ev .evtop { display: flex; justify-content: space-between; gap: 0.6rem; font-family: var(--mono); font-size: 0.72rem; color: var(--cream-50); letter-spacing: 0.06em; }
.ev .evmain { margin-top: 0.25rem; font-size: 0.95rem; }
.ev .pkg { margin-top: 0.4rem; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.chip {
  font-family: var(--mono); font-size: 0.68rem; padding: 0.1rem 0.4rem;
  border-radius: 3px; border: 1px solid var(--cream-15); color: var(--cream-50);
}
.chip.on { border-color: var(--kelp); color: var(--kelp); }
.ev .val { margin-top: 0.4rem; font-family: var(--mono); font-size: 0.75rem; color: var(--cream-50); }
.ev .val b { color: var(--cream-90); font-weight: 600; }
.ev.refused { border-color: rgba(212,87,61,0.5); }
.ev.logic { background: none; border-style: dashed; font-style: italic; color: var(--cream-70); font-size: 0.85rem; }
.ev.wait { background: none; border-style: dashed; color: var(--cream-50); }

.laneend { margin-top: 0.9rem; padding: 0.9rem; border-radius: 8px; text-align: center; animation: pop 0.4s ease-out; }
.laneend.bad { background: rgba(212,87,61,0.14); border: 1px solid var(--coral); }
.laneend.good { background: rgba(79,143,118,0.14); border: 1px solid var(--kelp); }
.laneend .stamp { font-family: var(--serif); font-size: 1.5rem; letter-spacing: 0.1em; }
.laneend.bad .stamp { color: var(--coral); }
.laneend.good .stamp { color: var(--kelp); }
.laneend .note { font-size: 0.85rem; color: var(--cream-70); margin-top: 0.3rem; }

/* --------------------------------------------------------------- the bill */
#bill { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.bcard { background: var(--ink-2); border: 1px solid var(--cream-15); border-radius: 10px; padding: 1rem 1.1rem; }
.bcard h4 { margin: 0 0 0.7rem; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cream-50); font-weight: 600; }
.brow { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.3rem 0; border-bottom: 1px dotted var(--cream-15); font-size: 0.9rem; }
.brow:last-child { border-bottom: none; }
.brow .n { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.brow.total { margin-top: 0.4rem; border-top: 1px solid var(--cream-30); padding-top: 0.5rem; font-weight: 600; }
.pos { color: var(--kelp); }
.neg { color: var(--coral); }

.punch {
  margin-top: 1.6rem; padding: 1.4rem 1.5rem; border-radius: 10px;
  background: var(--shell); color: #14100e;
  font-family: var(--serif); font-size: 1.35rem; line-height: 1.45;
}
.punch b { color: var(--coral); }
.punch .small { display: block; margin-top: 0.6rem; font-family: var(--sans); font-size: 0.85rem; color: #4c463d; }

/* ------------------------------------------------------------- science */
#science { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
table.sci { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.sci th, table.sci td { padding: 0.35rem 0.5rem; text-align: right; border-bottom: 1px solid var(--cream-15); }
table.sci th:first-child, table.sci td:first-child { text-align: left; }
table.sci th { color: var(--cream-50); font-weight: 600; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
table.sci td.n { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.sci tr.hi td { background: var(--cream-07); }
.killrow { display: flex; gap: 0.5rem; align-items: baseline; padding: 0.3rem 0; font-size: 0.85rem; border-bottom: 1px dotted var(--cream-15); }
.killrow .kid { font-family: var(--mono); font-size: 0.72rem; color: var(--cream-50); min-width: 2.2rem; }
.killrow .verdict { margin-left: auto; font-family: var(--mono); font-size: 0.72rem; text-align: right; max-width: 46%; }
.verdict.held { color: var(--kelp); }
.verdict.fired { color: var(--coral); }
#caveats { margin-top: 1.4rem; font-size: 0.85rem; color: var(--cream-50); max-width: 72ch; }
#caveats li { margin-bottom: 0.35rem; }

#foot { max-width: 1180px; margin: 0 auto; padding: 2rem 1.2rem 4rem; color: var(--cream-50); font-size: 0.85rem; border-top: 1px solid var(--cream-15); }

#error { background: rgba(212,87,61,0.15); border: 1px solid var(--coral); padding: 1rem; border-radius: 8px; }

@media (max-width: 760px) {
  #race { grid-template-columns: 1fr; }
  .daynum { font-size: 1.8rem; }
  .prow { grid-template-columns: 6rem 1fr; }
  .pgap { grid-column: 2; text-align: left; }
  .bar span { position: static; transform: none; display: block; }
}

/* Folded research history. Open by choice, not by default. */
.bmore { background: var(--ink-2); border: 1px solid var(--cream-15); border-radius: 10px; }
.bmore > summary { cursor: pointer; padding: 0.9rem 1.1rem; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cream-50); font-weight: 600; list-style: none; display: flex; align-items: center; gap: 0.6rem; }
.bmore > summary::-webkit-details-marker { display: none; }
.bmore > summary::before { content: '\25B8'; font-size: 0.8rem; transition: transform 0.15s ease; }
.bmore[open] > summary::before { transform: rotate(90deg); }
.bmore > summary:hover { color: var(--cream); }
.bmore-note { margin: 0 1.1rem 1rem; font-size: 0.85rem; color: var(--cream-50); max-width: 62ch; }
.bmore > .bcard { margin: 0 1.1rem 1.1rem; }
