/* greed — Built by Shane Vee */
:root {
  --bg: #f4f4f4;
  --ink: #262626;
  --faint: #6e6e6e;   /* 4.64:1 on --bg: meets AA by default */
  --hint: #595959;    /* 6.37:1 */
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Spectral", Georgia, "Times New Roman", serif;
  --col-max: 420px;
  --gap: 12px;
  --col-gap: clamp(32px, 5vw, 80px);
  --pad-col: 32px;
  --pad-top: 44px;
  --btn-h: 50px;
  --fade: 380ms;
  --track-body: -0.02em;
  --track-focal: -0.03em;
  --track-display: -0.01em;   /* spectral is a text serif; it wants less squeeze than inter */
  /* fill vocabulary — see the block below the buttons */
  --fill-0: #26262608;
  --fill-1: #26262614;
  --hatch: #26262659;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { text-transform: lowercase; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  letter-spacing: var(--track-body);
  min-height: 100vh;
}

/* the margins. behind everything, never in front of a number, and it
   thins to nothing as the market is consumed. */
#field {
  position: fixed;
  inset: 0;
  width: 100%;              /* css owns the box; hidpi.js sizes the backing store */
  height: 100%;
  z-index: -1;              /* above the page, behind every number on it */
  pointer-events: none;
}

/* the gutter sits between colA and colB, so it only exists once there is
   more than one column to be between */
#gutter {
  flex: none;
  align-self: stretch;
  width: 22px;
  max-height: 640px;
  margin-top: var(--pad-top);
  opacity: 0.9;
  transition: opacity var(--fade) ease;
}

/* the interface starts as one small instrument in the top-left corner and
   grows rightward, column by column, until the work fills the screen */
#col {
  width: 100%;
  display: flex;
  flex-wrap: wrap;                 /* mid widths: a column wraps below, never off-screen */
  align-items: flex-start;
  gap: var(--col-gap);
  padding: var(--pad-top) var(--pad-col) 150px;
  text-align: left;
  transition: opacity var(--fade) ease;
}
.gcol {
  flex: 1 1 0;
  min-width: 300px;
  max-width: var(--col-max);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  transition: opacity var(--fade) ease;
}

/* phase 3 pulls everything that remains back to the center. the sprawl
   was the point; so is taking it away. */
#col.end {
  flex-direction: column;
  align-items: center;
  max-width: calc(var(--col-max) + 2 * var(--pad-col));
  margin: 0 auto;
  gap: 0;
  text-align: center;
}
#col.end .gcol { align-items: center; max-width: 100%; }
#col.end #eye { margin-left: auto; margin-right: auto; }

/* the hide utility must beat every id/display rule — !important is the law here */
.h { display: none !important; }
.pre { opacity: 0; }
.in { opacity: 1; transition: opacity var(--fade) ease; }

/* unfolds rise into place, not just fade — scoped so the ending's
   whole-column fade (#col.pre) stays a pure dissolve, no motion */
.section.pre, .gcol.pre { transform: translateY(10px); }
.section.in, .gcol.in {
  transform: none;
  transition: opacity var(--fade) ease, transform var(--fade) cubic-bezier(0.2, 0.7, 0.3, 1);
}

.label { font-size: 12px; color: var(--hint); margin-bottom: 6px; }
.section { width: 100%; margin-bottom: 28px; }
.subline {
  font-family: var(--ui);
  font-size: 11px;
  color: var(--hint);
  margin-top: 6px;
  min-height: 14px;
  font-variant-numeric: tabular-nums;
}
#costline, #demandline { margin-bottom: 8px; }
#demandline { font-family: var(--ui); font-size: 11px; color: var(--hint); font-variant-numeric: tabular-nums; margin-bottom: 28px; }

#eye {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 0 0 12px;
}
#worth .value {
  font-size: 44px;
  font-weight: 600;
  letter-spacing: var(--track-focal);
  font-variant-numeric: tabular-nums;
}
/* the hero and its instrument on one line: the number, and the rate the
   number is moving at — which nothing else on the desk shows */
.herorow { display: flex; align-items: center; gap: 16px; }
#spark { display: block; width: 64px; height: 18px; flex: none; }
#col.end .herorow { justify-content: center; }

#paperblock .value {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: var(--track-focal);
  font-variant-numeric: tabular-nums;
}

button {
  font-family: inherit;
  text-transform: lowercase;
  letter-spacing: var(--track-body);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 4px;
  min-height: var(--btn-h);
  padding: 0 24px;
  cursor: pointer;
  width: 100%;
  max-width: 280px;
  position: relative;
  z-index: 0;                      /* own stacking context, so the wipe sits
                                      above the background and below the text */
  overflow: hidden;
  transition: background 130ms ease, color 130ms ease, border-color 130ms ease, transform 90ms ease;
}
button:active { background: var(--ink); color: var(--bg); transform: scale(0.96); transition-duration: 40ms; }
button.dim { border-color: var(--faint); color: var(--faint); }
button.dim:active { background: transparent; color: var(--faint); transform: none; }
button:focus { outline: none; }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* ── fill vocabulary ──────────────────────────────────────────────────
   greyscale has no colour to spend on "you can afford this", "you own
   this" and "you are at the limit", so DENSITY carries all three. one
   vocabulary for every surface in the game:

     not owned / unaffordable   outline only, faint          (.dim)
     available                  outline ink, wipe on hover   (default)
     partial                    hatched, density = the ratio (.f-part)
     owned / full               solid ink at 8%              (.f-full)
     at limit                   hatched + dot-matrix edge    (.f-limit)

   the wipe replaces the flat #26262614 hover tint everywhere and doubles
   as the tooltip trigger later. touch never gets a stuck hover state —
   the hover query is the whole guard. */
button::before, .wipe::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--fill-1);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
}
button.dim::before { background: var(--fill-0); }
@media (hover: hover) and (pointer: fine) {
  button:hover::before, .wipe:hover::before { transform: scaleX(1); }
}

/* the ratio, drawn. --fill is set from state by render.js. */
.f-part {
  background-image: repeating-linear-gradient(45deg,
    var(--hatch) 0 calc(var(--fill, 0) * 5px),
    transparent calc(var(--fill, 0) * 5px) 5px);
}
.f-full { background-color: var(--fill-1); }
/* at the limit the hatch gains a dot-matrix rule along the top edge —
   the CAUTION register, before any CAUTION panel exists to say it */
.f-limit {
  background-image:
    repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(45deg, var(--hatch) 0 calc(var(--fill, 1) * 5px),
      transparent calc(var(--fill, 1) * 5px) 5px);
  background-size: 100% 2px, auto;
  background-repeat: repeat-x, repeat;
  background-position: top left, top left;
}

#pricerow { display: flex; align-items: center; justify-content: flex-start; gap: var(--gap); }
#pricerow button { width: var(--btn-h); min-width: var(--btn-h); padding: 0; font-size: 20px; font-weight: 400; }
#price {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: var(--track-focal);
  font-variant-numeric: tabular-nums;
  min-width: 110px;
  text-align: center;
}
#costline { font-size: 12px; color: var(--hint); margin-top: 8px; }

#shop { display: flex; flex-direction: column; gap: var(--gap); align-items: stretch; }
#shop .label { margin-bottom: 0; }
#mfgline { margin-top: 0; margin-bottom: 4px; }
.tier { width: 100%; max-width: 280px; }
.tier .owned { font-size: 12px; color: var(--hint); margin-bottom: 4px; min-height: 14px; }

#extras { display: flex; flex-direction: column; gap: var(--gap); align-items: stretch; }
#extras button { max-width: 280px; }
#influenceline { font-size: 12px; color: var(--hint); font-family: var(--ui); font-variant-numeric: tabular-nums; }

#rateline, #debtline { font-family: var(--ui); font-size: 11.5px; color: var(--hint); font-variant-numeric: tabular-nums; }
.insbtns { display: flex; gap: var(--gap); justify-content: flex-start; }
button.mini { min-height: 44px; flex: 1; padding: 0 12px; font-size: 14px; }
button.mini.on { background: var(--ink); color: var(--bg); }

/* brutalist signal panel: near-square, border sharpens on approach */
.panel {
  border: 1px solid var(--faint);
  border-radius: 8px;
  padding: 16px 14px 14px;
  max-width: 340px;
  transition: border-color 180ms ease;
}
@media (hover: hover) { .panel:hover { border-color: var(--hint); } }
#tapewrap { display: flex; gap: 8px; margin: 12px 0 8px; }
#tape { flex: 1; min-width: 0; width: 100%; }
#envelope { width: 68px; flex: none; }
#tapeprice, #heldsel { margin: 2px 0 8px; }
#instabs button.mini, #sizedetents button.mini, #levdetents button.mini { min-height: 44px; font-size: 12px; padding: 0 6px; }
#tradecontrols { max-width: 340px; }
#tradecontrols .label.lev { margin-top: 14px; }
#analyticsblock canvas { display: block; width: 100%; margin-top: 8px; }
#machines { display: block; width: 100%; max-width: 300px; margin: 4px 0 10px; }
#warehousegrid { display: block; width: 132px; margin: 4px 0 8px; }

#exchangepanel { width: 100%; transition: opacity var(--fade) ease; }

#p3 { width: 100%; transition: opacity var(--fade) ease; display: flex; flex-direction: column; align-items: center; text-align: center; }
#debtblock .value {
  font-family: var(--display);
  font-size: 48px;
  font-weight: 600;
  letter-spacing: var(--track-display);
  font-variant-numeric: tabular-nums;
}
#debtdelta { font-size: 14px; color: var(--hint); height: 20px; margin-top: 4px; opacity: 0; transition: opacity 200ms; }
.pulse { animation: pulse 320ms ease; }
.bump { animation: pulse 240ms ease; }   /* numbers answer the hand that moves them */
@keyframes pulse { 0% { transform: scale(1); } 30% { transform: scale(1.06); } 100% { transform: scale(1); } }
#p3caption { font-size: 13px; color: var(--hint); min-height: 18px; }
#p3buttons { display: flex; flex-direction: column; gap: var(--gap); align-items: center; width: 100%; }
#chart { width: 100%; max-width: 340px; }
.legend { font-size: 11px; color: var(--hint); margin-bottom: 6px; }
.legend span { margin: 0 8px; }
#verse {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: var(--track-display);
  max-width: 300px;
  margin-top: 38vh;
  opacity: 0;
  transition: opacity 2000ms ease;
  text-align: center;
}
#fork {
  margin-top: 56px;
  width: 100%;
  max-width: 280px;
  flex-direction: column;
  gap: var(--gap);
  opacity: 0;
  transition: opacity 1200ms ease;
  display: flex;
  align-items: center;
}
#summary { font-size: 12px; color: var(--hint); line-height: 1.9; margin-top: 64px; }

#dead {
  position: fixed;
  inset: 0;
  z-index: 50;              /* above the drawer, below the incorporation form */
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: var(--pad-col);
  text-align: center;
}
#deadline { font-family: var(--display); font-size: 19px; letter-spacing: var(--track-display); max-width: 300px; line-height: 1.6; }
#dead button { max-width: 280px; }

/* the brand layer brings its own buttons. the desk's button rules above
   are element-level, so they are undone for it here at the same zero-class
   specificity (:where), which lets the brand's own class rules win. */
:where(#svb-root) { text-transform: none; }
:where(#svb-root) button {
  min-height: 0; width: auto; max-width: none;
  text-transform: none; letter-spacing: normal;
  position: static; z-index: auto; overflow: visible;
}
:where(#svb-root) button::before { content: none; }
:where(#svb-root) button:active { background: transparent; color: inherit; transform: none; }
/* the badge's resting opacity (.58) puts its label at 4.35:1 on this paper;
   .74 clears AA. hover and focus still go to full. */
#svb-root .svb-badge { opacity: 0.74; }
#svb-root .svb-badge:hover, #svb-root .svb-badge:focus-visible { opacity: 1; }

/* the byline: a small, quiet credit in the game's own type. a text
   button, because it opens the credits. */
button.byline, #dead button.byline, #fork button.byline {
  width: auto; max-width: none; min-height: 44px;
  padding: 0 8px; border: 0; background: transparent;
  font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint);
  letter-spacing: 0; cursor: pointer;
}
button.byline::before { content: none; }
@media (hover: hover) { button.byline:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; } }
button.byline:active { background: transparent; color: var(--ink); transform: none; }
#incorp .byline { display: block; margin: 6px auto 0; }

/* the event log: what has happened, in order, bottom-left. the comedian's
   lines resolve through the teletype; data lines land plain and dimmer. */
#log {
  position: fixed;
  left: var(--pad-col);
  bottom: 14px;
  width: min(420px, calc(100vw - 2 * var(--pad-col)));
  font-family: var(--ui); font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--hint);
  text-align: left;
  pointer-events: none;
  background: linear-gradient(transparent, var(--bg) 40%);
  padding-top: 18px;
  transition: opacity 600ms;
}
#log .ln { min-height: 16px; animation: lnin 260ms ease; }
#log .ln.data { color: var(--faint); }
#log .ln:nth-last-child(2) { opacity: 0.72; }
#log .ln:nth-last-child(3) { opacity: 0.52; }
#log .ln:nth-last-child(4) { opacity: 0.38; }
#log .ln:nth-last-child(5) { opacity: 0.26; }
#log .ln:nth-last-child(n+6) { opacity: 0.15; }
@keyframes lnin { from { opacity: 0; transform: translateY(4px); } }

/* the explainer footnote. a form puts its marks on the fields and its text
   at the foot of the page — so this is bottom-right, opposite the log, and
   pointing at a control never moves anything on the desk. */
#footnote {
  position: fixed;
  right: var(--pad-col);
  bottom: 14px;
  z-index: 5;
  /* capped so it cannot reach the log: 420px is the log's own max width,
     plus a 20px gutter between the two voices */
  max-width: min(46ch, calc(100vw - 2 * var(--pad-col) - 440px));
  font-family: var(--ui); font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--hint);
  text-align: right;
  pointer-events: none;
  /* opaque, and above the log. at narrow widths the two do meet, and when
     they do the answer to the question you just asked wins — occluding a
     line of the comedian is the right outcome, not a bug to route around */
  background: var(--bg);
  padding: 4px 0 2px 10px;
  opacity: 0;
  transition: opacity 200ms ease;
}
#footnote.on { opacity: 1; }

/* ── the caution notice ───────────────────────────────────────────── */
.nt-row { padding: 14px 0; border-bottom: 1px solid var(--faint); }
.nt-head { display: flex; align-items: baseline; gap: 12px; }
.nt-title { font-size: 15px; }
.nt-bar {
  margin-left: auto;
  font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--ink);
  letter-spacing: 0.04em; white-space: pre;
}
.nt-note { font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--hint); margin-top: 6px; line-height: 1.6; }

/* ── the drawer ───────────────────────────────────────────────────────
   the desk (colA/colB/colC) is the primary loop and never grows a fourth
   column. everything else the revamp adds lives on a sheet pulled from
   this rail — filing tabs at the right edge, one sheet at a time, the
   desk washed out behind it. at the pivot the rail is removed with colB
   and colC, so the collapse to one column gets bigger, not smaller, for
   having had all this to take away. */
#rail {
  position: fixed;
  top: var(--pad-top);
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.railtab {
  writing-mode: vertical-rl;
  width: 30px;
  max-width: none;
  min-height: 0;
  height: auto;
  padding: 15px 0;
  border-right: 0;
  border-radius: 4px 0 0 4px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 400;
}
.railtab.on { background: var(--ink); color: var(--bg); }
.railtab.on::before { content: none; }
.railtab:active { transform: scale(0.97) translateX(1px); }

/* the wash. on a paper-coloured page the honest way to push the desk back
   is to lay more paper over it, not to darken it. */
#scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fade) ease;
}
#scrim.on { opacity: 0.88; pointer-events: auto; }

#sheetwrap {
  position: fixed;
  inset: 0;
  z-index: 31;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 52px 24px 24px;    /* keeps clear of the rail */
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fade) ease;
}
#sheetwrap.on { opacity: 1; pointer-events: auto; }
#sheetwrap { overscroll-behavior: contain; }
#sheet {
  width: 100%;
  max-width: 480px;
  margin: auto;                     /* centred when short, scrolls when tall */
  border: 1px solid var(--ink);
  background: var(--bg);
  padding: 26px 26px 22px;
}
#sheettop { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
#sheethead { font-size: 18px; font-weight: 600; letter-spacing: var(--track-focal); }
#sheetsub { font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint); margin-top: 3px; }
#sheetclose {
  width: auto; max-width: none; flex: none;
  min-height: 34px; padding: 0 14px; font-size: 12px;
}

/* sheet furniture. every sheet is a form, so they share one set of rows. */
.sh-head {
  font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint);
  margin: 26px 0 9px; padding-bottom: 5px;
  border-bottom: 1px solid var(--faint);
}
.sh-rec { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; font-size: 14px; }
.sh-v {
  margin-left: auto; text-align: right; word-break: break-word;
  font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--hint);
  font-variant-numeric: tabular-nums;
}
/* a ticked box on a form, not a switch — switches are game furniture */
.sh-box {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: none; min-height: 42px;
  padding: 0 4px;
  border: 0; border-bottom: 1px solid var(--faint); border-radius: 0;
  font-size: 15px; text-align: left;
}
.sh-box:active { background: transparent; color: var(--ink); transform: none; }
.sh-tick {
  margin-left: auto; flex: none;
  width: 18px; height: 18px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  transition: background 130ms ease;
}
.sh-tick.on { background: var(--ink); }
.sh-vol { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 13px 4px; font-size: 15px; }
.sh-dets { margin-left: auto; gap: 6px; }
.sh-dets { flex-wrap: wrap; }
.sh-dets button.mini { flex: none; width: auto; max-width: none; min-width: 44px; min-height: 44px; padding: 0 10px; font-size: 12px; }
.sh-key { display: flex; gap: 14px; padding: 6px 0; font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--hint); }
.sh-chord { min-width: 66px; color: var(--ink); }
.sh-foot { font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 10.5px; color: var(--faint); margin-top: 24px; line-height: 1.6; }

/* small screens: the columns stack; the game still starts top-left */
@media (max-width: 760px) {
  /* the right padding clears the rail — at these widths the columns run the
     full content box, so without it the desk runs under the tabs */
  /* 48px on top keeps the desk clear of the menu button's 44px hit area */
  #col { flex-direction: column; gap: 24px; padding: 48px 44px 170px 24px; }
  #menubtn { left: 14px; }
  .gcol { min-width: 0; max-width: 100%; width: 100%; }
  /* the footnote takes the bottom line and the log steps up above it,
     so a long-press explainer never lands on top of the comedian */
  /* stacked columns have nothing to sit between */
  #gutter { display: none !important; }
  #log { left: 24px; width: calc(100vw - 48px); bottom: 40px; }
  /* on a phone the log keeps its last three lines, so it never sits over
     more of the desk than it has to */
  #log .ln:nth-last-child(n+4) { display: none; }
  #log { background: var(--bg); padding-top: 6px; border-top: 1px solid var(--fill-1); }
  #menubtn { background: var(--bg); }
  #footnote { right: 24px; left: 24px; bottom: 8px; max-width: none; }
  /* the tabs stack tighter and the sheet takes the width */
  #rail { top: 12px; }
  .railtab { width: 26px; padding: 12px 0; font-size: 11px; }
  #sheetwrap { padding: 16px 38px 16px 16px; }
  #sheet { padding: 20px 18px 18px; }
}

/* ── the incorporation form ────────────────────────────────────────────
   not a menu and not a title screen. the first piece of paperwork the
   company produces, and the only one that ever asks the player a
   question. you sign it again every run. */
#incorp {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
#incorpsheet {
  width: 100%; max-width: 460px;
  border: 1px solid var(--ink);
  padding: 28px 28px 22px;
}
.ico-head { font-family: var(--display); font-size: 21px; font-weight: 600; letter-spacing: var(--track-display); line-height: 1.2; }
.ico-sub { font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint); margin-top: 3px; }
.ico-label {
  display: block;
  font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint);
  margin: 26px 0 9px; padding-bottom: 5px;
  border-bottom: 1px solid var(--faint);
}
.ico-namerow { display: flex; align-items: baseline; gap: 8px; }
#coname {
  flex: 1; min-width: 0;
  font-family: var(--ui); font-size: 20px;
  letter-spacing: var(--track-focal); text-transform: lowercase;
  color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--ink);
  padding: 4px 2px;
}
#coname:focus { outline: none; border-bottom-width: 2px; padding-bottom: 3px; }
#coname::placeholder { color: var(--faint); }
.ico-suffix { font-size: 20px; color: var(--hint); letter-spacing: var(--track-focal); }

/* the three modes, ranked by how much the game will explain. the order
   is the ranking — no adjective says it. */
.ico-mode {
  display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 3px;
  align-items: baseline; width: 100%; min-height: 44px;
  text-align: left; cursor: pointer;
  background: transparent; color: var(--ink);
  border: 0; border-left: 2px solid var(--faint);
  padding: 10px 12px; margin-bottom: 2px;
  max-width: none;
  font-family: var(--ui); font-size: 15px;
  letter-spacing: var(--track-body); text-transform: lowercase;
  transition: background var(--fade) ease, border-left-width 120ms ease;
}
.ico-mode .ico-name { font-weight: 500; }
.ico-mode .ico-tier { justify-self: end; font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint); }
.ico-mode .ico-blurb { grid-column: 1 / -1; font-size: 12.5px; line-height: 1.45; color: var(--hint); }
.ico-mode:active { transform: none; background: transparent; color: var(--ink); }
.ico-mode.on { border-left-width: 6px; border-left-color: var(--ink); background: var(--fill-1); }
.ico-mode.on .ico-tier, .ico-mode.on .ico-blurb { color: var(--ink); }

#incorpgo {
  width: 100%; max-width: none; height: var(--btn-h); margin-top: 26px;
  border: 1px solid var(--ink); border-radius: 4px;
  background: var(--ink); color: var(--bg);
  font-family: var(--ui); font-size: 15px;
  letter-spacing: var(--track-body); text-transform: lowercase; cursor: pointer;
}
#incorpgo::before { content: none; }   /* already solid; nothing to wipe in */
#incorpgo:active { transform: scale(0.97); }
.ico-foot { font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 10.5px; color: var(--faint); margin-top: 11px; }

/* pale paper: the original, quieter look. #b5b5b5 on #f4f4f4 is about
   1.87:1, under AA, so it is an option and never the default. */
html.pale {
  --faint: #b5b5b5;
  --hint: #8a8a8a;
}

/* high contrast. greyscale gives this almost for free, and it wins over
   pale paper when both are ticked. */
html.hc, html.hc.pale {
  --bg: #ffffff;
  --ink: #000000;
  --faint: #767676;   /* 4.54:1 */
  --hint: #595959;    /* 7.0:1  */
  /* the fill vocabulary densifies too, or "partial" and "full" become the
     same white as "empty" for exactly the people this mode is for */
  --fill-0: #00000012;
  --fill-1: #00000024;
  --hatch: #00000080;
}

/* reduced motion: the eye stays and the pupil still tracks — it is
   content, not decoration. what goes is the movement between states. */
html.rm *, html.rm *::before, html.rm *::after {
  transition-duration: 0ms !important;
  animation-duration: 0ms !important;
}

/* ── the announcement (system c) ─────────────────────────────────────
   the same wash the drawer uses, for the same reason: on paper you push
   something back by laying more paper over it, not by darkening it. the
   tick keeps running behind this — it is a reading surface, not a pause. */
#announce {
  position: fixed;
  inset: 0;
  z-index: 40;                      /* over the drawer; under nothing */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fade) ease;
}
#announce.in { opacity: 1; pointer-events: auto; }
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  #announce { background: var(--bg); }
  #announce.in { opacity: 0.97; }
}

#announcesheet {
  width: 100%;
  max-width: 460px;
  border: 1px solid var(--ink);
  background: var(--bg);
  padding: 24px 24px 18px;
}
#announcehead {
  font-family: var(--ui); font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--hint);
  letter-spacing: 0.06em;
}
#announcebody {
  font-size: 17px;
  line-height: 1.42;
  letter-spacing: var(--track-focal);
  margin-top: 10px;
}

/* the countdown block. faint, because it is the wait made visible and not
   a thing to read — the sentence above it is the thing to read. */
#announceart {
  display: block;
  margin: 18px 0 14px;
  font-size: 7px;
  color: var(--faint);
  opacity: 0.5;
  overflow: hidden;
  user-select: none;
}

#announcerow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
#announcesub {
  font-family: var(--ui); font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  color: var(--faint);
}
#announceskip {
  width: auto; max-width: none; flex: none;
  min-height: 34px; padding: 0 14px;
  font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11.5px;
}

@media (max-width: 520px) {
  #announcesheet { padding: 20px 18px 16px; }
  #announcebody { font-size: 15.5px; }
  #announceart { font-size: 5.5px; }
  #announcerow { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ── the confirmation ────────────────────────────────────────────────
   the same paper wash as the announcement, over everything, the form
   included: a seed link can ask before the form appears. */
#confirm {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  #confirm { background: var(--bg); }
}
#confirm.in #confirmsheet { animation: sheet-in 200ms cubic-bezier(0.2, 0.7, 0.3, 1); }
#confirmsheet {
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--ink);
  background: var(--bg);
  padding: 24px 24px 18px;
}
#confirmhead { font-size: 18px; font-weight: 600; letter-spacing: var(--track-focal); }
#confirmbody { font-size: 15px; line-height: 1.45; margin-top: 10px; color: var(--ink); }
#confirmrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
#confirmrow button { width: auto; flex: 1 1 140px; max-width: none; min-height: 44px; padding: 0 14px; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { #confirm.in #confirmsheet { animation: none; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── the pause menu ──────────────────────────────────────────────────
   the same paper wash; above the drawer and the announcement, under the
   confirmation it can open. */
#pause {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  #pause { background: var(--bg); }
}
#pause.in #pausesheet { animation: sheet-in 200ms cubic-bezier(0.2, 0.7, 0.3, 1); }
@media (prefers-reduced-motion: reduce) { #pause.in #pausesheet { animation: none; } }
#pausesheet {
  width: 100%;
  max-width: 340px;
  border: 1px solid var(--ink);
  background: var(--bg);
  padding: 24px 24px 20px;
}
#pausehead { font-size: 18px; font-weight: 600; letter-spacing: var(--track-focal); }
#pausesub { font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint); margin-top: 3px; }
#pauseitems { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
#pauseitems button { max-width: none; min-height: 44px; font-size: 14px; }

/* phones have no esc key: the menu is always one tap away, top-left */
#menubtn {
  position: fixed;
  top: 0;
  left: calc(var(--pad-col) - 10px);
  z-index: 25;
  width: auto; max-width: none;
  min-height: 44px; min-width: 44px;
  padding: 0 10px;
  border: 0; background: transparent;
  font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint);
  letter-spacing: 0;
}
#menubtn::before { content: none; }
@media (hover: hover) { #menubtn:hover { color: var(--ink); } }
#menubtn:active { background: transparent; color: var(--ink); transform: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ── s5 · the statement ──────────────────────────────────────────────
   a document, not a panel. it gets a document's furniture: a heading that
   names the company and dates itself, section rules, totals ruled above,
   and a memorandum below the totals where a memo row belongs — outside
   the arithmetic, which is exactly what the player will assume it is. */
.st-title {
  font-family: var(--ui); font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--ink);
  line-height: 1.7;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
}
.st-l { padding-right: 10px; }
/* a total is ruled off from what it totals. the rule is the arithmetic. */
.st-total { border-top: 1px solid var(--faint); margin-top: 2px; }
.st-total .sh-v { color: var(--ink); }
/* the memo row sits apart, below everything, in the register of a note */
.st-memo { border-top: 1px solid var(--faint); margin-top: 6px; }
/* the leaders. a real statement uses them to carry the eye across to a
   figure; for an hour these carry it across to nothing. */
.st-lead {
  color: var(--faint);
  letter-spacing: 0.18em;
}

/* ── s5 · the record ─────────────────────────────────────────────────
   filing tabs. a milestone tab carries its label whether or not it is
   filled — the ladder is the offer, and seeing `net worth $1t` sitting
   unfilled is the offer being made. */
.rc-grid { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 2px; }
.rc-tab {
  font-family: var(--ui); font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  line-height: 1;
  padding: 8px 9px;
  border: 1px solid var(--faint);
  border-bottom-width: 3px;
  color: var(--faint);
  background: transparent;
}
.rc-tab.on { color: var(--ink); border-color: var(--ink); background: var(--fill-0); }

/* an achievement row is BLANK until it is earned. the slot is the whole
   message: you can see that there is something there and not what. */
.rc-list { padding: 4px 0 2px; }
.rc-row {
  display: flex; align-items: baseline; gap: 12px;
  min-height: 34px; padding: 8px 0 8px 10px;
  border-left: 3px solid var(--faint);
  border-bottom: 1px solid var(--faint);
  font-size: 13.5px;
}
.rc-row.on { border-left-color: var(--ink); }
.rc-note { color: var(--ink); }
.rc-mode {
  margin-left: auto; flex: none;
  font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 10.5px; color: var(--hint);
}

@media (max-width: 520px) {
  .st-title { font-size: 10px; }
  .rc-row { font-size: 12.5px; }
}

/* the monument's last page. the ending column centres everything — a
   statement is the one thing that must not be centred, because a balance
   sheet reads down two aligned edges or it is not a balance sheet. */
#finalstatement {
  text-align: left;
  width: 100%;
  max-width: var(--col-max);
  margin: 56px auto 0;
}
#finalstatement .sh-foot { color: var(--faint); }
/* the monument's heading is set in the display face: it is the one title
   in the game that is meant to outlast the run */
#finalstatement .st-title { font-family: var(--display); font-size: 15px; letter-spacing: var(--track-display); }

/* ── the field guide ─────────────────────────────────────────────────
   the offer is a dialog on the same paper wash as the pause menu. the
   card is a slip clipped to the desk: it points at the real control and
   never takes a key from it. */
#guideoffer {
  position: fixed; inset: 0; z-index: 62;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  #guideoffer { background: var(--bg); }
}
#guideoffer.in #guideoffersheet { animation: sheet-in 200ms cubic-bezier(0.2, 0.7, 0.3, 1); }
#guideoffersheet {
  width: 100%; max-width: 400px;
  border: 1px solid var(--ink); background: var(--bg);
  padding: 24px 24px 18px;
}
#guideofferhead { font-size: 18px; font-weight: 600; letter-spacing: var(--track-focal); }
#guideofferbody { font-size: 15px; line-height: 1.45; margin-top: 10px; }
#guideofferrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
#guideofferrow button { width: auto; flex: 1 1 150px; max-width: none; min-height: 44px; padding: 0 14px; font-size: 14px; }
#guideofferfoot { font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint); margin-top: 12px; }

#guide {
  position: fixed; z-index: 36;
  left: 50%; bottom: 20px; transform: translateX(-50%);
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--ink); background: var(--bg);
  padding: 12px 14px 12px;
  box-shadow: 0 1px 0 var(--ink);
  animation: guide-in 220ms cubic-bezier(0.2, 0.7, 0.3, 1);
}
#guide.dock-top { bottom: auto; top: 52px; }
@media (max-width: 760px) { #guide { bottom: 12px; } #guide.dock-top { top: 52px; width: min(360px, calc(100vw - 60px)); left: calc(50% - 14px); } }
@keyframes guide-in { from { opacity: 0; } to { opacity: 1; } }
#guidetop { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#guidecount { font-family: var(--ui); font-size: 11px; color: var(--hint); font-variant-numeric: tabular-nums; }
#guideskip, #guiderow button {
  width: auto; max-width: none; min-height: 44px; margin: -10px -8px -10px 0;
  padding: 0 8px; border: 0; background: transparent;
  font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint); letter-spacing: 0;
}
#guideskip::before { content: none; }
@media (hover: hover) { #guideskip:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; } }
#guideskip:active { background: transparent; color: var(--ink); transform: none; }
#guidewhat { font-size: 15px; font-weight: 500; line-height: 1.4; margin-top: 6px; }
#guidewhy { font-size: 13px; line-height: 1.45; color: var(--hint); margin-top: 4px; }
#guidewhy:empty { display: none; }
#guideprog { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
#guidebar {
  flex: 1; height: 6px; border: 1px solid var(--ink); position: relative; overflow: hidden;
}
#guidebar::after {
  content: ''; position: absolute; inset: 0; background: var(--ink);
  transform-origin: left center; transform: scaleX(var(--p, 0));
  transition: transform 200ms linear;
}
#guideprogtext { font-family: var(--ui); font-size: 11px; color: var(--hint); font-variant-numeric: tabular-nums; white-space: nowrap; }
#guiderow { display: flex; justify-content: flex-end; }
#guiderow button {
  margin: 8px 0 0; border: 1px solid var(--ink); padding: 0 14px;
  font-family: inherit; font-size: 13px; color: var(--ink);
}
#guiderow button.h { display: none; }

/* the control the guide is pointing at: one ring, one pulse, no loop */
.guide-target { outline: 2px solid var(--ink) !important; outline-offset: 3px; animation: guide-ring 300ms ease-out 1; }
@keyframes guide-ring { from { outline-offset: 9px; } to { outline-offset: 3px; } }
html.rm #guide, html.rm .guide-target { animation: none; }
@media (prefers-reduced-motion: reduce) {
  #guide, .guide-target, #guideoffer.in #guideoffersheet { animation: none; }
  #guidebar::after { transition: none; }
}

/* ── form 3 · how to play ─────────────────────────────────────────── */
.ht-p { font-size: 14.5px; line-height: 1.5; margin: 6px 0 4px; }
.ht-fig { margin: 14px 0 4px; }
.ht-fig:empty { display: none; }
.ht-controls { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
.ht-controls th {
  text-align: left; font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 10.5px; font-weight: 400;
  color: var(--hint); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--faint);
}
.ht-controls td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--fill-1); vertical-align: baseline; line-height: 1.35; }
.ht-controls .ht-key { font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap; }
.ht-controls .ht-touch { color: var(--hint); }
.ht-list { margin: 6px 0 4px; padding-left: 18px; font-size: 14px; line-height: 1.5; }
.ht-list li + li { margin-top: 4px; }
.ht-row { margin-top: 8px; }
.ht-row button.mini, .sh-link, .ht-again { flex: none; width: auto; min-height: 44px; padding: 0 14px; font-size: 12.5px; }
.ht-primers .sh-rec { align-items: center; }

/* ── primers ─────────────────────────────────────────────────────────
   the pause menu's paper wash; above the drawer, so "read again" from
   how to play opens over the sheet it was pressed on. */
#primer {
  position: fixed; inset: 0; z-index: 63;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  #primer { background: var(--bg); }
}
#primer.in #primersheet { animation: sheet-in 200ms cubic-bezier(0.2, 0.7, 0.3, 1); }
#primersheet { width: 100%; max-width: 400px; border: 1px solid var(--ink); background: var(--bg); padding: 22px 24px 18px; }
#primertop { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
#primerhead { font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint); }
#primercount { font-family: var(--ui); font-size: 11px; color: var(--hint); font-variant-numeric: tabular-nums; }
#primerwhat { font-size: 18px; font-weight: 600; letter-spacing: var(--track-focal); line-height: 1.3; margin-top: 10px; }
#primerwhy { font-size: 15px; line-height: 1.5; margin-top: 8px; }
#primerrow { display: flex; justify-content: flex-end; margin-top: 18px; }
#primerrow button { width: auto; max-width: none; min-height: 44px; padding: 0 22px; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { #primer.in #primersheet { animation: none; } }
html.rm #primer.in #primersheet, html.rm #guideoffer.in #guideoffersheet,
html.rm #pause.in #pausesheet, html.rm #confirm.in #confirmsheet { animation: none; }

/* ── the goal strip ──────────────────────────────────────────────────
   under cash: what this phase is reaching for, in the fill vocabulary.
   the bar is hatched like a partly filled field, ruled like a form. */
#goal { margin-top: 12px; max-width: 320px; }
.goal-label { font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint); }
.goal-row { margin-top: 6px; }
.goal-bar {
  height: 6px; border: 1px solid var(--hint); background: var(--fill-0);
  position: relative; overflow: hidden;
}
.goal-bar::after {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(45deg, var(--hatch) 0 2px, transparent 2px 4px);
  background-color: var(--fill-1);
  transform-origin: left center; transform: scaleX(var(--p, 0));
  transition: transform 300ms linear;
}
.goal-text { font-family: var(--ui); font-size: 11px; color: var(--hint); margin-top: 3px; font-variant-numeric: tabular-nums; }
html.rm .goal-bar::after { transition: none; }
@media (prefers-reduced-motion: reduce) { .goal-bar::after { transition: none; } }

/* ── quiet feedback ──────────────────────────────────────────────────
   what came in, beside cash: rises 8px and fades, transform and opacity
   only. under reduced motion it simply appears and goes. */
.herorow { position: relative; }
.ghost {
  position: absolute; right: 0; top: 2px; text-align: right;
  font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--hint);
  font-variant-numeric: tabular-nums;
  opacity: 0; pointer-events: none;
}
.ghost.go { animation: ghost-rise 600ms cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
@keyframes ghost-rise {
  0% { opacity: 0; transform: translateY(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) { .ghost.go { animation: none; opacity: 1; } }
html.rm .ghost.go { animation: none; opacity: 1; }
#col.end .ghost { display: none; }

/* a control that just unfolded: one fading ring, once */
.newly { animation: newly 1.2s ease-out 1; }
@keyframes newly { from { outline: 1px solid var(--ink); outline-offset: 3px; } to { outline: 1px solid transparent; outline-offset: 3px; } }
@media (prefers-reduced-motion: reduce) { .newly { animation: none; } }

/* numbers that do not jitter as they change */
.subline, #costline, #demandline, #influenceline, #debtline, #rateline, #tapeprice, #heldsel { font-variant-numeric: tabular-nums; }

/* ── the exchange, legible ───────────────────────────────────────────
   the margin meter: equity as a share of what you hold. the call line
   and the warning line are ruled on it; below the warning it hatches. */
#marginmeter { margin-top: 10px; max-width: 340px; }
.mm-track { position: relative; height: 8px; border: 1px solid var(--hint); background: var(--fill-0); }
.mm-fill {
  position: absolute; inset: 0; background: var(--fill-1);
  transform-origin: left center; transform: scaleX(var(--r, 1));
  transition: transform 200ms linear;
}
#marginmeter.low .mm-fill {
  background-color: var(--fill-1);
  background-image: repeating-linear-gradient(45deg, var(--hatch) 0 2px, transparent 2px 4px);
}
.mm-tick { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--ink); }
#mmcall { left: calc(var(--call, 0.25) * 100%); }
#mmclose { left: calc(var(--close, 0.32) * 100%); background: var(--hint); }
.mm-labels { position: relative; height: 16px; font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 10.5px; color: var(--hint); margin-top: 3px; }
.mm-lab { position: absolute; top: 0; transform: translateX(-50%); }
#mmcalllab { left: calc(var(--call, 0.25) * 100%); transform: translateX(-100%); padding-right: 3px; }
#mmcloselab { left: calc(var(--close, 0.32) * 100%); transform: none; padding-left: 3px; }
.mm-val { position: absolute; right: 0; top: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
#marginmeter.shake { animation: mm-shake 200ms ease-out 1; }
@keyframes mm-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) { #marginmeter.shake { animation: none; } .mm-fill { transition: none; } }

/* each instrument says its temperament under its name */
#instabs button.mini { min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; line-height: 1.1; }
#instabs .temp { font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 10px; font-weight: 400; color: var(--hint); }
#instabs button.on .temp { color: var(--bg); }

/* ── chapter marks and the end screens ───────────────────────────────── */
#chapter {
  position: fixed; left: 50%; top: 42%; z-index: 45;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-size: 26px; font-weight: 500; letter-spacing: var(--track-display);
  color: var(--ink); background: var(--bg); padding: 10px 18px;
  pointer-events: none; opacity: 0; white-space: nowrap;
}
#chapter.go { animation: chapter 2400ms ease-out forwards; }
@keyframes chapter { 0% { opacity: 0; } 12.5% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #chapter.go { animation: none; opacity: 1; } }
html.rm #chapter.go { animation: none; opacity: 1; }

#deadsummary { font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--hint); max-width: 320px; line-height: 1.7; margin-top: -24px; }
#deadrow { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 280px; }
button.quiet {
  border-color: transparent; color: var(--hint); min-height: 44px; font-size: 14px;
}
@media (hover: hover) { button.quiet:hover { color: var(--ink); } }
button.byline, button.quietlink {
  width: auto; max-width: none; min-height: 44px;
  padding: 0 8px; border: 0; background: transparent;
  font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint);
  letter-spacing: 0; cursor: pointer;
}
button.quietlink::before { content: none; }
@media (hover: hover) { button.quietlink:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; } }
button.quietlink:active { background: transparent; color: var(--ink); transform: none; }
#monumentby { display: flex; align-items: center; justify-content: center; gap: 2px; color: var(--hint); font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; }
#guiderow #guidelink { margin-right: auto; border: 0; padding: 0; font-family: var(--ui); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--hint); text-decoration: underline; text-underline-offset: 3px; }
#guiderow #guidelink::before { content: none; }

/* a short desk window keeps the log to its last four lines, so it stays in
   the margin under the works instead of climbing over them */
@media (min-width: 761px) and (max-height: 860px) {
  #log .ln:nth-last-child(n+5) { display: none; }
}

/* ── the board (shared sv kit, restyled as paperwork) ─────────────────
   the kit's widgets are themed only through --sv-kit-* tokens, so they
   are pointed at the page's own: paper, ink, hairlines, no colour, no
   rounded pills. rarity is told by weight of ink and by its words, not
   by a rainbow; the five inks still pass AA on --bg. */
:root {
  --sv-kit-bg: var(--bg);
  --sv-kit-surface: var(--bg);
  --sv-kit-surface-2: var(--fill-0);
  --sv-kit-fg: var(--ink);
  --sv-kit-muted: var(--hint);
  --sv-kit-border: var(--ink);
  --sv-kit-accent: var(--ink);
  --sv-kit-accent-fg: var(--bg);
  --sv-kit-track: var(--fill-1);
  --sv-kit-flame: var(--ink);
  --sv-kit-risk: #8c2a1c;      /* the one red on the page: 7.2:1, attendance at risk */
  --sv-kit-freeze: var(--hint);
  --sv-kit-focus: var(--ink);
  --sv-kit-radius: 2px;
  --sv-kit-font: var(--ui);
  --sv-kit-shadow: none;
  --sv-kit-common: #6e6e6e;
  --sv-kit-uncommon: #555555;
  --sv-kit-rare: #3d3d3d;
  --sv-kit-epic: #262626;
  --sv-kit-legendary: #000000;
  --sv-kit-dur: 260ms;
}
html.hc { --sv-kit-common: #595959; --sv-kit-uncommon: #404040; --sv-kit-rare: #262626; --sv-kit-epic: #000; --sv-kit-legendary: #000; --sv-kit-risk: #7a1f12; }
.sv-kit { letter-spacing: var(--track-body); }
.sv-kit .sv-kit-badge { border-radius: 2px; min-width: 30px; height: 30px; font-size: 13px; font-weight: 600; }
.sv-kit .sv-kit-track { height: 6px; border-radius: 0; }
.sv-kit .sv-kit-xp-row { font-size: 11px; }
.sv-kit .sv-kit-xp-row strong { font-weight: 500; }
.sv-kit .sv-kit-streak { border-radius: 2px; background: transparent; }
.sv-kit .sv-kit-streak-n { font-weight: 600; font-size: 15px; }
.sv-kit-card { border-top-width: 1px; padding: 12px 14px; gap: 4px; }
.sv-kit-card[data-rarity=rare], .sv-kit-card[data-rarity=epic] { border-top-width: 3px; }
.sv-kit-card[data-rarity=legendary] { border-top-width: 5px; }
.sv-kit-card .sv-kit-card-rarity { font-size: 11px; font-weight: 500; text-transform: lowercase; }
.sv-kit-card .sv-kit-card-name { font-family: var(--display); font-weight: 500; font-size: 18px; letter-spacing: var(--track-display); }
.sv-kit-card .sv-kit-card-odds { font-size: 12px; }
.sv-kit-card .sv-kit-card-empty { font-size: 12px; }
/* the meeting: the same sheet as a primer, a form over washed paper */
.sv-kit-backdrop { background: color-mix(in srgb, var(--bg) 92%, transparent); }
.sv-kit-modal { border: 1px solid var(--ink); padding: 22px 24px 18px; max-width: 420px; }
.sv-kit-modal h2 { font-family: var(--ui); font-size: 11px; font-weight: 400; color: var(--hint); margin-bottom: 10px; }
.sv-kit-modal p { font-size: 16px; line-height: 1.5; color: var(--ink); }
.sv-kit-days { gap: 4px; }
.sv-kit-day { border-radius: 2px; background: transparent; border: 1px solid var(--fill-1); font-size: 11px; padding: 7px 0; }
.sv-kit-day b { font-weight: 500; font-size: 13px; }
.sv-kit-day[data-done] { opacity: 1; background: var(--fill-1); }
.sv-kit-day[data-today] { border-color: var(--ink); }
.sv-kit .sv-kit-btn { width: auto; max-width: none; min-height: 44px; border-radius: 4px; font-size: 14px; font-weight: 500; padding: 0 20px; }
.sv-kit .sv-kit-btn:hover { filter: none; }
.sv-kit .sv-kit-btn[data-primary] { border-color: var(--ink); }
.sv-kit .sv-kit-btn[data-primary]::before { content: none; }
.sv-kit .sv-kit-btn:disabled { opacity: 1; color: var(--faint); border-color: var(--faint); background: transparent; }
.sv-kit-toasts { top: 14px; }
.sv-kit-toast { border-radius: 2px; border-color: var(--ink); font-weight: 500; font-size: 14px; padding: 8px 14px 8px 8px; }
.sv-kit-toast .sv-kit-badge { border-radius: 2px; }
.sv-kit-fx { mix-blend-mode: multiply; }

/* the career strip under cash */
#exec { margin-top: 16px; max-width: 320px; }
.exec-title { font-family: var(--display); font-size: 15px; letter-spacing: var(--track-display); margin: 6px 0 8px 40px; }
#meetbtn { width: auto; max-width: 100%; flex: none; min-height: 44px; font-size: 13px; padding: 0 14px; }
#meetbtn.risk { border-color: var(--sv-kit-risk); color: var(--sv-kit-risk); }
#guidanceline { margin-top: 8px; }

/* the windfall slip: bottom-right, above the footnote, never over the desk's buttons */
#windfall {
  position: fixed; right: calc(var(--pad-col) + 18px); bottom: 56px; z-index: 25;
  width: min(300px, calc(100vw - 2 * var(--pad-col)));
  background: var(--bg); border: 1px solid var(--ink); padding: 12px 14px 12px;
  animation: slip-in 260ms cubic-bezier(0.2, 0.7, 0.3, 1);
}
#windfall .sv-kit-card { border: 0; border-top: 1px solid var(--ink); padding: 10px 0 6px; background: transparent; }
#windfall[data-kind=scandal] .sv-kit-card-name { font-style: italic; }
#windfallkind { font-size: 11px; color: var(--hint); }
#windfalleffect { font-size: 14px; font-variant-numeric: tabular-nums; margin-top: 2px; }
#windfallrow { display: flex; gap: 8px; margin-top: 10px; }
#windfallrow button { min-height: 44px; font-size: 12px; }
@keyframes slip-in { from { opacity: 0; transform: translateY(8px); } }
html.rm #windfall { animation: none; }
@media (max-width: 520px) { #windfall { right: 16px; left: 16px; width: auto; bottom: 64px; } }

/* the board sheet */
.bd-xp { margin: 4px 0 6px; }
.bd-note { font-size: 12px; line-height: 1.55; color: var(--hint); margin: 6px 0 2px; }
.bd-streakrow { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.bd-streakrow .bd-attend { flex: none; width: auto; max-width: none; min-height: 44px; font-size: 13px; }
.bd-week .bd-target.done .sh-k { text-decoration: line-through; text-decoration-thickness: 1px; color: var(--hint); }
.bd-rivals tr.you td { font-weight: 600; color: var(--ink); }
.bd-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.bd-rivals th:last-child, .bd-odds th:last-child { text-align: right; }
.bd-last { margin-top: 12px; }
.bd-rank { width: 3em; font-variant-numeric: tabular-nums; }
#windfall .sv-kit-card { border-radius: 0; }
