@import url('./game-frame.css');
@import url('./works-window.css');

@import url('./side-features.css');
.smeltory-wordmark {
  white-space: nowrap;
  color: #f4efdf;
  font:
    700 clamp(14px, 1.65vw, 23px) / 0.95 'Barlow Semi Condensed',
    system-ui,
    sans-serif;
  letter-spacing: -0.04em;
}
footer {
  flex-wrap: wrap;
  gap: 8px 16px;
}
footer .legal-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-left: auto;
}
.legal-links a,
.shift-radio {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.legal-links a:hover,
.shift-radio:hover {
  color: #daebd6;
}
.shift-radio {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  appearance: none;
  font: inherit;
  padding: 3px;
  border: 0;
  background: none;
  cursor: pointer;
}
#toast.show,
#modal-toast.show {
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  text-align: left;
}
#toast.show {
  bottom:var(--notice-bottom);
  width: max-content;
}
#toast button,
#modal-toast button {
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  width: 32px;
  height: 32px;
  cursor: pointer;
}
#toast .achievement-art,
#modal-toast .achievement-art {
  flex-shrink: 0;
}
@media (max-width: 650px) {
  footer .legal-links {
    margin-left: 0;
  }
  .brand {
    gap: 6px;
  }
}
@media (max-width:350px) {
  .top nav button {min-width:0;min-height:44px;flex-direction:column;gap:1px;padding-inline:2px}
  .top nav button span {white-space:normal;overflow-wrap:anywhere;line-height:1.1}
}
@media (prefers-reduced-motion: reduce) {
  #toast {
    transition: none;
  }
}
.report-link {
  font: inherit;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: none;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#bug-report {
  display: grid;
  gap: 0.6rem;
}
#bug-report label {
  font-weight: bold;
}
#bug-report textarea {
  box-sizing: border-box;
  max-width: 100%;
  min-height: 7rem;
  resize: vertical;
}
#bug-report p {
  margin: 0;
}
#bug-report small {
  color: var(--soft);
}
#bug-report button {
  justify-self: start;
}
.quick-info[hidden] {
  display: none;
}
.quick-info {
  max-height: calc(100dvh - 12px);
  overflow-y: auto;
  overscroll-behavior: contain;
  position: fixed;
  z-index: 1000;
  box-sizing: border-box;
  min-width: 156px;
  width: max-content;
  max-width: min(26rem, calc(100vw - 16px));
  overflow-wrap: anywhere;
  padding: 9px 11px;
  background: #1c2926;
  color: #e7eee5;
  border: 1px solid #668377;
  border-radius: 5px;
  box-shadow: 0 4px 16px #09100faa;
  pointer-events: auto;
  font:
    12px/1.35 system-ui,
    sans-serif;
}
.quick-info > strong {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 13px;
}
.quick-info .sprite {
  width: 20px;
  height: 20px;
}
.quick-info .detail-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 14px;
  padding: 2px 0;
  border: 0;
  font-size: 11px;
  min-height: 0;
}
.quick-info .detail-line strong {
  margin-inline-start: auto;
  max-width: 100%;
  min-width: 0;
  text-align: end;
  white-space: normal;
  font-variant-numeric: tabular-nums;
}
.recipe-preview {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid #476154;
}
.tip-recipe-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px 10px;
  font-size: 11px;
}
.recipe-preview .material {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 3px;
  color: inherit;
  font: inherit;
}
.recipe-preview .material-name {
  display: inline;
  white-space: normal;
}
.recipe-preview .sprite {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}
.tip-inputs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
}
.quick-info:has(.recipe-preview) {
  min-width: min(234px, calc(100vw - 16px));
}
.quick-info > .recipe-preview {
  border: 0;
  padding-block: 0;
  margin-block: 6px;
}
.quick-info > .recipe-preview .bill-tokens {display:flex;flex-wrap:wrap;gap:4px}
.quick-info .machine-flows :is(td,th) {border:0}
.quick-info .recipe-preview:first-child {
  margin: 0;
  padding: 0;
  border: 0;
}
.unavailable-order {
  display: inline-flex;
  max-width: 100%;
}
.unavailable-order button:disabled {
  pointer-events: none;
}
.dialog-body .recipe-preview {
  margin: 0.55rem 0;
  padding: 0.5rem 0.65rem;
  background: #1c2823;
  border: 1px solid #405348;
  border-radius: 3px;
}

/* Keyboard help must not intercept a tap or mouse click on a control beneath it. */
.quick-info[data-mode='keyboard'] {
  pointer-events: none;
}
@media (hover: none) and (pointer: coarse) {
  .quick-info {
    pointer-events: none;
  }
}

.legacy-choice {border-top:1px solid var(--line);padding:.65rem 0}
.legacy-panel{margin-top:.75rem}.legacy-panel>.actionbtn,.legacy-panel>.btn{margin:.6rem .85rem}.legacy-choice p{margin:.2rem 0 .5rem}

.lever:disabled{cursor:wait;filter:saturate(.45)}
.qualification-link{display:flex;align-items:center;gap:.65rem;width:100%;margin:.5rem 0 .85rem;padding:.65rem .85rem;color:var(--ink);background:var(--panel);border:1px solid var(--line);border-radius:4px;text-align:left}
.qualification-link>span{flex:1}.qualification-link small{display:block;color:var(--soft);margin-top:.15rem}
.qualification-link b,.qual-materials td{font-variant-numeric:tabular-nums;white-space:nowrap}
.qual-heading{display:flex;justify-content:space-between;align-items:center;gap:.5rem;margin:1rem 0 .25rem}
.qual-heading small{color:var(--soft)}.qual-materials{width:100%;font-size:.83rem;margin:.6rem 0}.qual-materials :is(td,th){padding:.3rem;text-align:right}.qual-materials th:first-child{text-align:left}

.radio-reading {display:grid;gap:.4rem}
.log-list li small {font:inherit;color:var(--soft);margin-inline-end:.35rem}
.log-list .log-empty {display:block;color:var(--soft)}
.attention-note{font-size:.78rem;color:var(--soft);line-height:1.45}
.upgrade-section .btn, .upgrade-section small { margin:.35rem .35rem .15rem 0 }
.upgrade-section small, .legacy-choice small { display:block; color:var(--soft) }
#save-notice { position:fixed; z-index:10; left:max(.6rem,env(safe-area-inset-left)); bottom:var(--notice-bottom); padding:.33rem .6rem; border:1px solid #5d7668; background:#1c2b24; color:#d9eade; border-radius:4px; font-size:.75rem; pointer-events:none }
body:has(#toast.show,#modal-toast.show) #save-notice { visibility:hidden }

.dialog-body .paired-actions {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,9.5rem),1fr));
  align-items:stretch;
  gap:.5rem;
}
.dialog-body .paired-actions > button {
  display:flex;
  align-items:center;
  justify-content:center;
  box-sizing:border-box;
  min-height:44px;
  margin:0;
  padding:.4rem .65rem;
  font:600 .85rem/1.2 var(--display);
  text-align:center;
}
.quick-info > p, .radio-reading > p { margin:.45rem 0; line-height:1.4 }
.quick-info > small { color:#c5cbbb }
.dialog-body input[type='file']::file-selector-button {
  min-height:44px;
  margin-inline-end:.6rem;
  padding:.4rem .65rem;
  border:1px solid #4a544d;
  border-radius:3px;
  background:#303834;
  color:var(--ink);
  cursor:pointer;
}

.console.direct-work { display:grid; grid-template-columns:1fr; gap:.65rem; padding:.75rem 1rem; align-items:start }
.hand-row { display:grid; grid-template-columns:minmax(5rem,auto) 1fr; gap:.55rem .9rem; align-items:center; min-width:0 }
.hand-row > strong { color:var(--soft); font-size:.8rem }
.hand-row > div { display:flex; flex-wrap:wrap; align-items:center; gap:.4rem }
.field-action { display:inline-flex; align-items:center; justify-content:center; gap:.4rem; min-height:40px; padding:.35rem .55rem; color:var(--ink); background:#303a33; border:1px solid #586650; border-radius:4px; touch-action:manipulation }
.field-action .sprite {width:27px;height:27px;flex:0 0 27px}
.field-action b { font-variant-numeric:tabular-nums; color:#f5c38e }
.field-action:disabled { opacity:.58 }
.dialog-body > :is(.detail-line,button,p,.cost-rows) + :is(button,p,.detail-line,.cost-rows) { margin-block-start:.6rem }
.dialog-section > h3 + :is(p,div,button,small) { margin-block-start:.45rem }
@media(max-width:540px) { .hand-row { grid-template-columns:1fr } .field-action { min-height:44px } }

.mark-filter {display:flex;align-items:center;gap:8px;margin:8px 12px 14px;font-size:0.88em}.mark-filter select {max-width:75%;padding:5px 8px}

.direct-work .next-deposit {display:inline-flex;align-items:center;gap:5px;background:transparent;color:var(--muted);min-height:36px;border:1px dashed currentColor;padding:5px 9px}

.material-hand-action { margin: .25rem 0 .8rem }
.resource-rates { display:flex;flex-wrap:wrap;gap:.5rem 1rem;margin:.5rem 0 1rem }
.resource-rates > .detail-line { flex:1 1 38% }
.consumption-comparison { flex:1 0 100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.65rem;padding:.5rem .625rem;background:var(--panel);border:1px solid var(--line);border-radius:4px }
.resource-rates .consumption-comparison .detail-line { display:flex;flex-direction:column;align-items:flex-start;justify-content:space-between;border:0 }
@media (max-width:540px) {
  .consumption-comparison { grid-template-columns:1fr;gap:0 }
  .resource-rates .consumption-comparison .detail-line { flex-direction:row;align-items:baseline;gap:1rem }
}
.resource-rates .detail-line { display:grid;align-content:start;justify-items:start;gap:.25rem;min-width:0;margin:0;padding:.4rem 0 }
.resource-rates .detail-line strong { max-width:100%;white-space:nowrap }
.automation-action { display:grid;grid-template-columns:auto minmax(0,1fr);align-items:start;gap:.55rem 1rem;padding:.8rem 0;margin:.3rem 0;border-block-start:1px solid var(--line) }
.automation-action >small { align-self:start;margin-top:.45rem;color:var(--soft) }
.automation-action >div { display:flex;flex-wrap:wrap;align-items:center;gap:.5rem .75rem;min-width:0 }
.automation-action .btn, .material-hand-action .primary { min-height:40px }
.automation-bill .material-list { display:flex;flex-wrap:wrap;gap:.3rem .5rem }
@media (max-width:420px) {
  .automation-action { grid-template-columns:minmax(0,1fr);gap:.3rem }
  .automation-action .btn, .material-hand-action .primary { min-height:44px }
}

.supply-routing { margin:1rem 0; }
.supply-routing h3 { margin-bottom:.4rem; }
.supply-routing table {width:100%;border-collapse:collapse}
.supply-routing th,.supply-routing td {padding:.3rem .2rem;text-align:end}
.supply-routing th:first-child {text-align:start}
.supply-routing thead th {font-size:.8rem;color:var(--soft)}
.supply-routing tbody tr {border-top:1px solid var(--line)}
.supply-routing td {font:600 .8rem var(--mono);white-space:nowrap}
.flow-in {color:#a2d7ad}
.flow-out {color:#e8a998}
.stock-reading .stock-trend.steady {color:var(--soft)}
.supply-routing .supply-short {color:#e8a998}
.supply-machine { display:flex;align-items:center;gap:.4rem;min-width:0;text-align:left; }
.supply-machine .sprite { width:26px;height:26px; flex:none; }
.buy-section > .bill-tokens {margin-block-start:.5rem}
.investment .split { flex-wrap:wrap;gap:.5rem; }
.investment-options { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem;margin:.6rem 0; }
.investment-options article { display:flex;min-width:0;flex-direction:column;align-items:flex-start;gap:.45rem;padding:.7rem;background:#232c28;border:1px solid var(--line);border-radius:4px; }
.investment-options article > strong { font:600 1.1rem var(--mono);white-space:nowrap;color:var(--cream); }
.investment-options h4 { margin:0; }
.investment-options article > small { color:var(--soft); }
.investment-options .material-list { display:flex;gap:.25rem;flex-wrap:wrap; }
.investment-options .material-name { position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%); }
.investment-options article > button, .investment-options article > .unavailable-order { margin-top:auto;width:100%; }
.investment-options .unavailable-order > button { width:100%; }
@media (max-width:450px) {
  .supply-machine .sprite {display:none;}
  .investment-options article {padding:.5rem;}
}

/* Valuation and inventory figures remain legible as the site grows. */
.company-reading {display:grid;justify-items:end;gap:3px;flex:none;color:var(--soft);font-size:.85rem}
.company-reading strong {font:600 clamp(1rem,2.1vw,1.45rem)/1.1 var(--mono);color:var(--ink);white-space:nowrap}
.first-shift {padding:0 0 1rem}
.first-shift + footer .shift-radio {display:none}
.opening-stock,.opening-plan {background:var(--panel,#212725);border:1px solid var(--line);border-radius:5px;margin:0 0 .75rem;padding:.85rem 1rem}
:is(.opening-stock,.opening-plan) h2 {margin:0 0 .6rem;display:flex;align-items:center;gap:.5rem;font:650 1rem/1.15 var(--display);color:var(--soft)}
/* Stock and hand work share a card. Inspecting and gathering have distinct hit targets. */
.warehouse-heading {display:flex;align-items:center;gap:.45rem;margin:.15rem 0 .5rem;color:var(--soft);font:650 .93rem var(--display)}
/* The card surface inspects. The inset tool is an independent hit target. */
.opening-stock.stockboard {margin:0 0 14px;padding:12px 14px}
.opening-stock.stockboard .warehouse-heading {margin:0 0 8px}
.stockboard .resources.source-cards {display:grid;grid-template-columns:repeat(auto-fill,minmax(min(180px,100%),1fr));gap:7px}
.stock-source {position:relative;min-width:0;border:1px solid var(--line);border-radius:5px;background:#232a28}
.stock-inspect {display:flex;align-items:center;width:100%;min-height:76px;gap:9px;padding:7px 50px 7px 10px;text-align:start;border-radius:4px}
.stock-product .stock-inspect {padding-inline-end:8px}
.stock-source:focus-within {background:#2b332f}
@media(hover:hover) {.stock-source:hover {background:#2b332f}}
.stock-source>.stock-inspect {background:transparent}
.stock-source>.stock-inspect::after {content:"";position:absolute;inset:0;border-radius:inherit}
.stock-inspect:focus-visible,.stock-mine:focus-visible {outline:2px solid #e7c285;outline-offset:-2px}
.stock-inspect>.sprite {width:30px;height:30px;flex:none}
.stock-reading {display:grid;min-width:0;align-content:center;line-height:1.1;gap:1px;font-variant-numeric:tabular-nums}
.stock-reading>span {font-size:.86rem;color:#c8d0c4}
.stock-reading strong {font:700 clamp(1.55rem,2.25vw,2.1rem)/1.03 var(--display);white-space:nowrap}
.stock-reading .stock-trend {color:#a2d7ad;font:600 .77rem var(--mono)}
.stock-reading .stock-trend.negative {color:#e8a998}
.stock-mine {position:absolute;inset-inline-end:4px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:40px;height:44px;color:#f1c38d;border-radius:5px;isolation:isolate}
.stock-mine::before {content:"";position:absolute;z-index:-1;width:29px;height:29px;border:1px solid #735f47;border-radius:4px;background:#38322b}
.stock-mine:hover::before,.stock-mine:focus-visible::before {background:#514231;border-color:#bc9460}
.stock-mine:active::before {background:#63503b}
.stock-mine svg {transform-origin:75% 80%}
@media(min-width:760px) {
  .opening-stock.stockboard::after {width:23%;opacity:.48}
  .opening-stock.stockboard:not([data-phase="0"]) {padding-block:8px}
  .opening-stock[data-phase]:not([data-phase="0"])::after {content:none}
}
@media(max-width:620px) {
  .opening-stock.stockboard {padding:8px}
  .stockboard .resources.source-cards {grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
  .stock-inspect {min-height:73px;gap:4px;padding:5px 40px 5px 6px}
  .stock-inspect>.sprite {width:20px;height:20px}
  .stock-mine {inset-inline-end:0;width:44px}
  .stock-reading>span {font-size:.76rem}
  .stock-reading strong {font-size:1.55rem}
}
.opening-order {display:grid;grid-template-columns:60px minmax(0,1fr) auto;gap:.6rem 1rem;align-items:center;border-top:1px solid var(--line);padding-top:.65rem}
.opening-order>.sprite {width:60px;height:60px}
.opening-bill h3 {margin:0 0 .3rem;font:650 1.17rem/1.12 var(--display)}
.opening-bill ul {display:flex;flex-wrap:wrap;gap:.25rem 1rem;padding:0;margin:0;list-style:none}
.opening-bill li,.opening-output>span {display:inline-flex;align-items:center;gap:.3rem;font-size:.8rem;color:var(--soft)}
.opening-bill li b {font:600 .76rem var(--mono);white-space:nowrap}
.opening-bill li.met b {color:#a2d7ad}
.opening-bill .sprite,.opening-output .sprite {width:20px;height:20px}
.plan-valuation {display:block;margin-top:.35rem;color:var(--soft);font-size:.8rem}
.opening-output {display:grid;justify-items:end;gap:.45rem}
.opening-output button {min-height:42px}
.update-actions {display:flex;align-items:center;flex-wrap:wrap;gap:.65rem;margin-top:1rem}
.update-summary {padding-inline-start:1.25rem}
.update-summary li + li {margin-top:.4rem}
.update-versions {font-variant-numeric:tabular-nums;color:var(--soft)}
.opening-machine {display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;margin:.7rem 0;color:var(--soft);font-size:.87rem}
.opening-machine>.sprite {width:30px;height:30px}
.opening-machine strong {font:.8rem var(--mono);color:#a2d7ad}
.opening-machine progress {width:clamp(36px,10vw,84px);height:6px;margin-left:auto;border:0;background:#323b36;accent-color:#a3c79a}
.opening-machine progress::-webkit-progress-bar {background:#323b36}
.opening-machine progress::-webkit-progress-value {background:#a3c79a}
.opening-machine {padding:.5rem .7rem;border:1px solid var(--line);border-radius:5px}
@media(min-width:760px) {
  .opening-stock {position:relative;overflow:hidden;isolation:isolate}
  .opening-stock::after {content:"";position:absolute;z-index:-1;inset:0 0 0 auto;width:33%;background:
    linear-gradient(90deg,var(--panel,#212725),transparent 50%),url('../public/art/valley/foothills.webp') 65% 61% / cover;image-rendering:pixelated;opacity:.76}
  .opening-stock-items {max-width:67%}
}
@media(max-width:620px) {
  .opening-stock,.opening-plan {padding:.65rem .7rem}

  .opening-order {grid-template-columns:40px minmax(0,1fr);gap:.5rem}
  .opening-order>.sprite {width:40px;height:40px}
  .opening-output {grid-column:1/-1;display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center}
}
.reset-link { display:block;margin-top:.95rem;color:#e5b0a0; }
button.destructive {color:#f7dbc9;border-color:#84544b;background:#49302d;}
@media (max-width:620px) {
  .work-scene .console.direct-work {padding:.5rem .65rem;gap:.3rem;}
  .work-scene .hand-row {grid-template-columns:4.5rem minmax(0,1fr);gap:.35rem;}
  .work-scene .hand-row > strong {font-size:.72rem;}
  .work-scene .hand-row > div {min-width:0;overflow-x:auto;flex-wrap:nowrap;scrollbar-width:thin;overscroll-behavior-x:contain;}
  .work-scene .hand-row > div > * {flex:none;white-space:nowrap;}
  .work-scene .field-action {padding:.25rem .4rem;gap:.22rem;min-height:44px;}
  .work-scene .field-action .sprite {width:21px;height:21px;flex-basis:21px;}
}

/* Keep real native select menus, including their keyboard and touch controls. */
body select:not([multiple]):not([size]), body select[size="1"] {
  appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3.5 6 4.5 4.5L12.5 6' fill='none' stroke='%23e0e6d6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-size:1em 1em;background-position:right .6em center;
  padding-inline-end:2.25em;
}
body select:not([multiple]):not([size]):dir(rtl),body select[size="1"]:dir(rtl) {background-position:left .6em center}
/* The ledger is the work surface. All sheets share the same view switch. */
.work-view-frame:empty {display:none}
.work-view-frame:not(:empty) {margin-bottom:12px}
.work-view-frame .work-scene {position:static;width:100%;margin:0;--stage-height:clamp(340px,62svh,720px)}
.work-home .work-view-tabs {flex:none}
.work-ledger,.work-primary,.work-sidebar {display:grid;min-width:0;gap:12px;align-content:start}
.work-ledger {align-items:start;grid-template-rows:max-content 1fr}
.work-controls {display:contents}
.work-controls>.warehouse {grid-area:1/1}
.work-sidebar {grid-area:1/2/3/3}
.work-primary {grid-area:2/1}
.work-ledger:has(.work-sidebar) {grid-template-columns:minmax(0,1.55fr) minmax(315px,1fr)}
.work-primary>.dispatch,.work-sidebar>.research-tray,.work-ledger .opening-stock.stockboard {margin:0}
.work-ledger .opening-stock.stockboard::after {content:none}
.work-ledger .research-tiles {display:flex;flex-wrap:wrap;gap:5px}
.work-ledger .research-tile {display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;padding:4px}
.work-ledger .research-tile:focus-visible {outline:2px solid var(--amber);outline-offset:2px}
.warehouse-head,.shop-heading {display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 12px}
.warehouse-head {margin-bottom:8px}
.warehouse-jump {display:none}
.work-ledger .warehouse .warehouse-heading {margin:0}
.stock-batch,.order-switch {display:inline-flex;align-items:center;gap:3px}
.stock-batch>span {display:inline-flex;align-items:center;gap:3px;margin-inline-end:3px;color:var(--soft);font-size:12px}
.order-switch {gap:1px;padding:2px;border:1px solid #4b584c;border-radius:4px;background:#1e2421}
.order-switch .order-choice {min-width:31px;padding:4px 6px;min-height:29px;border:1px solid transparent;border-radius:2px;color:#bfcbbf;font:600 12px var(--mono);white-space:nowrap}
.order-switch .order-choice[aria-pressed=true] {color:#fbdfaf;background:#403c32;border-color:#837254}
.order-switch .order-choice:hover:not([aria-pressed=true]) {background:#303932}
.work-ledger .stock-source {container-type:inline-size;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:stretch;overflow:visible}
.work-ledger .stock-inspect {grid-area:1/1;min-width:0;gap:6px;padding:8px 2px 8px 9px;min-height:70px}
.work-ledger .stock-product .stock-inspect {padding-inline-end:8px}
.stock-reading>span {overflow-wrap:anywhere}
.work-ledger .stock-action {grid-area:1/2;z-index:1;position:relative;align-self:center;margin-inline-end:3px;min-width:0}
/* Keep the entire visible tool operable, with clearance for the inventory reading. */
/* Two sibling controls: work across the tile, inspection in its top corner. */
.work-ledger .stock-source .stock-action {grid-area:1/1/2/-1;align-self:stretch;justify-self:stretch;margin:0;min-width:0}
.work-ledger .stock-source .stock-tile {
  position:relative;inset:auto;transform:none;display:flex;flex-direction:column;align-items:stretch;
  justify-content:flex-start;gap:2px;width:100%;height:100%;min-height:80px;margin:0;padding:5px 9px 7px;
  text-align:start;background:transparent;color:var(--ink);border:0;border-radius:4px;overflow:hidden;
}
.stock-source .stock-tile:disabled {color:var(--ink);opacity:1;cursor:default}
.stock-source:has(.stock-craft:enabled) {border-color:#61795e}
.stock-source:has(.stock-tile:disabled) .work-tool {opacity:.8}
@media(hover:hover) {
  .stock-source:has(.stock-tile:enabled:hover) {border-color:#b79a6c}
  .stock-source:has(.stock-craft:enabled:hover) {border-color:#a8c78f}
}
.stock-source .stock-tile::before,.stock-source .stock-tile::after,.stock-source .stock-more::after {content:none}
.work-ledger .stock-source .stock-more {
  position:absolute;z-index:2;inset:0 0 auto auto;display:grid;place-items:center;
  width:32px;height:32px;min-height:0;min-width:0;padding:0;border:0;background:transparent;color:#a7b4a8;border-radius:4px;
}
.stock-source .stock-more:hover,.stock-source .stock-more:focus-visible {color:#fff0c9;background:#37443a}
.stock-tile .stock-heading {display:flex;align-items:center;min-width:0;min-height:27px;gap:5px;padding-inline-end:23px;color:#c2cbc1;font:500 .84rem/1.18 system-ui,sans-serif}
.stock-heading>span:not(.sprite) {display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;min-width:0;overflow:hidden;hyphens:auto;overflow-wrap:anywhere}
.stock-heading .sprite {width:28px;height:28px;object-fit:contain;flex:none}
.stock-source {--stock-glint:#86a6ae}
.stock-source:is([data-material-id=stone],[data-material-id=clay],[data-material-id=sand],[data-material-id=brick]) {--stock-glint:#c5a17d}
.stock-source:is([data-material-id=copper],[data-material-id=copperPlate],[data-material-id=wire],[data-material-id=gear],[data-material-id=tool]) {--stock-glint:#dc9f63}
.stock-source:is([data-material-id=water],[data-material-id=coolant],[data-material-id=glass]) {--stock-glint:#78bace}
.stock-source:is([data-material-id=circuit],[data-material-id=processor],[data-material-id=data]) {--stock-glint:#8bb881}
.stock-source .stock-heading .sprite {background:radial-gradient(ellipse,color-mix(in srgb,var(--stock-glint) 18%,transparent),transparent 74%)}
.stock-tile .stock-reading {display:grid;grid-template-rows:auto minmax(1rem,auto);gap:1px;min-width:0}
.work-ledger .stock-tile .stock-reading strong {justify-self:start;font-size:min(1.48rem,calc((100cqi - 21px) / var(--balance-chars) * 1.8));line-height:1.08;white-space:nowrap}
.stock-tile .stock-trend.idle {color:var(--soft)}
.stock-tile .stock-trend {display:inline-flex;align-items:center;gap:3px;justify-self:start;white-space:nowrap;padding-inline-end:19px;line-height:1.15}
.stock-tile .work-tool {position:absolute;right:8px;bottom:8px;color:#f2c388;display:grid;place-items:center}
.stock-craft .work-tool {color:#c2daac}
.stock-tile:disabled .work-tool {color:#7d8a7e}
.stock-tile:enabled:active {background:#374237}
.stock-tile .hand-yields {position:absolute;display:grid;place-items:center;right:14px;bottom:20px;pointer-events:none;color:#ffdaa1;font:700 1rem/1.1 system-ui,sans-serif;text-shadow:0 1px 3px #181c18}
.stock-tile .work-contact {pointer-events:none;position:absolute;inset:auto 4px 4px auto;width:27px;height:26px;opacity:0;border:2px solid #ebc78e;border-radius:50%}
.stock-tile.stock-craft .work-contact {border-color:#c2daac}
.work-ledger .stock-product>.grid-kpi {grid-column:1/-1;min-height:80px}
@media(pointer:coarse) {
  .work-ledger .stock-source .stock-more {width:40px;height:40px}
  .stock-tile .stock-heading {min-height:35px;padding-inline-end:29px}
}
.work-sidebar>.catalog.machine-shop {display:block;min-width:0;min-height:0;max-height:none;position:static;overflow:visible;border:1px solid var(--line);border-radius:5px;background:var(--panel)}
.shop-heading {padding:8px 11px;border-bottom:1px solid var(--line)}
.shop-heading h2,.shop-future h3 {display:inline-flex;align-items:center;gap:6px;margin:0;font:650 17px/1.15 var(--display)}
.shop-heading h2 svg {color:var(--amber)}
.machine-shop .blueprints {display:grid;grid-template-columns:minmax(0,1fr);padding:0;gap:0}
.machine-shop .blueprint {position:static;display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"info info" "bill build";align-items:center;gap:5px 8px;min-width:0;padding:9px 1px;border:0;border-block-end:1px solid #39433e;border-radius:0;box-shadow:none;background:transparent;overflow:visible}
.machine-shop .blueprint:last-child {border-block-end:0}
.machine-shop .order-info {grid-area:info;display:grid;grid-template-columns:33px minmax(0,1fr) auto;align-items:center;gap:8px;width:100%;min-width:0;min-height:40px;padding:0;text-align:start;color:var(--ink);border:0;border-radius:3px;background:transparent}
.machine-shop .order-info:hover {background:#2a322d}
.machine-heading {grid-area:info;display:flex;align-items:center;gap:4px;min-width:0}
.machine-heading .order-info {flex:1;min-width:0}
.machine-toggle {display:grid;place-items:center;flex:none;width:36px;height:40px;border:1px solid transparent;border-radius:4px;color:var(--soft);background:transparent}
.machine-toggle:hover,.machine-toggle:focus-visible {background:#2e3731;border-color:var(--line);color:var(--ink)}
.machine-toggle[data-value="false"] {color:var(--amber)}
@media(pointer:coarse) { .machine-toggle {width:44px;height:44px} }
.machine-shop .order-info>.sprite {width:32px;height:32px}
.machine-copy,.machine-copy small {display:block;min-width:0}
.machine-copy strong {display:block;font:650 1rem/1.25 system-ui,sans-serif;overflow-wrap:anywhere}
.machine-copy small .material {display:inline-flex;align-items:center;gap:3px;color:var(--soft);font:600 11px/1.2 var(--mono)}
.machine-copy small .sprite {width:15px;height:15px}
.machine-copy small .material-name {display:none}
.machine-copy .fitted-mark {white-space:nowrap;color:var(--soft);font:600 .75rem/1 var(--mono)}
.machine-copy small {display:flex;align-items:center;flex-wrap:wrap;gap:2px 9px;margin-top:3px}
.machine-load {display:inline-flex;align-items:center;gap:4px;color:#a4cea9;font:600 .73rem/1.25 var(--mono);font-variant-numeric:tabular-nums;white-space:nowrap}
.machine-load::before {content:"";width:6px;height:6px;border-radius:50%;background:currentColor}
.machine-load[data-load="limited"] {color:#f3c17b}
.machine-load[data-load="limited"]::before {border-radius:1px;transform:rotate(45deg)}
.machine-load[data-load="paused"],.machine-load[data-load="standby"] {color:#a6babd}
.machine-load[data-load="paused"]::before,.machine-load[data-load="standby"]::before {background:transparent;border:1px solid currentColor}
.machine-sheet {display:grid;gap:14px}
.machine-sheet .machine-summary {margin:0}
.machine-sheet>.detail-line {margin:0;padding:0;border:0}
.machine-sheet>.dialog-section {margin:0;padding-block-start:14px;border-top:1px solid var(--line)}
.machine-sheet>.dialog-section h3 {margin:0 0 9px}
.machine-sheet .machine-flows table {margin:0}
.machine-sheet .machine-flows :is(td,th) {padding-block:7px;border:none}
.machine-sheet .machine-flows thead {border-bottom:1px solid var(--line)}
.machine-sheet .machine-flows tbody tr+tr {border-top:1px solid #39433d}
.machine-flows {min-inline-size:0}
.machine-flows table {width:100%;margin:5px 0;border-collapse:collapse}
.machine-flows th,.machine-flows td {padding:4px 5px;background:none;color:var(--ink);font:600 .8rem/1.2 var(--mono);font-variant-numeric:tabular-nums}
.machine-flows thead th,.machine-flows tbody th small {color:var(--soft);font:500 .72rem/1.2 var(--ui,system-ui)}
.machine-flows tbody th {padding-inline-start:0;text-align:start;white-space:normal}
.machine-flows tbody th small {display:block}
.machine-flows th .material {font:600 .86rem/1.2 var(--display);overflow-wrap:anywhere}
.machine-flows .sprite {width:16px;height:16px;flex:none}
.machine-flows td:last-child {color:var(--soft)}
.machine-shop .order-info>.machine-count {display:inline-flex;align-items:center;gap:4px;padding:2px 5px;color:#c6d0c1;font:600 13px var(--mono)}
.machine-count svg {opacity:.8}
.machine-shop .order-price {grid-area:bill;min-width:0}
.machine-shop .order-price .material-list {display:flex;flex-wrap:wrap;gap:3px}
.machine-shop .order-price .cost-token {min-width:0;max-width:100%;min-height:25px;padding:2px 4px}
.machine-shop .cost-token .material {display:inline-flex;align-items:center;min-width:0;gap:3px}
.machine-shop .cost-token .material-name {position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%)}
.machine-shop .cost-token .sprite {width:17px;height:17px;flex:none}
.machine-shop .order-submit {grid-area:build;justify-self:end}
.machine-shop .order-control,.machine-shop .unavailable-order {display:inline-flex}
.machine-shop .buildbtn {display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:35px;padding:5px 11px;border:1px solid #a9c296;border-bottom-color:#799368;border-radius:4px;background:#b5cf9f;box-shadow:0 2px #596b50;color:#202e22;font:700 .95rem/1 var(--display);white-space:nowrap}
.machine-shop .buildbtn:hover:not(:disabled) {background:#c4dbad}
.machine-shop .buildbtn:active:not(:disabled) {transform:translateY(1px);box-shadow:0 1px #596b50}
.machine-shop .buildbtn:disabled {opacity:1;color:#a6ada2;background:#2e3530;border-color:#485248;box-shadow:none}
.shop-future {padding:9px 11px 11px;border-top:1px solid var(--line)}
.shop-future h3,.shop-future>small {font-size:.8rem;color:var(--soft)}
.shop-future ul {margin:5px 0;padding:0;list-style:none}
.shop-future li {display:flex;align-items:center;gap:8px;padding:3px 4px;color:#9ca79c;font:600 .88rem var(--display)}
.shop-future li>svg {margin-inline-start:auto;color:#728074}
.shop-future .sprite {width:22px;height:22px;filter:grayscale(1) brightness(.27)}
/* Installation count leads both available machinery and matching silhouettes. */
.machine-shop .order-info {grid-template-columns:minmax(max-content,44px) 34px minmax(0,1fr)}
.machine-shop .order-info>.machine-count {display:block;align-self:center;text-align:center;color:var(--ink);padding:0;font:700 26px/1 var(--display);font-variant-numeric:tabular-nums;letter-spacing:-.02em}
.machine-shop .machine-count[data-installed-count="0"] {color:var(--muted)}
.machine-shop {--order-width:7.35rem}
.machine-actions {grid-area:build;justify-self:end;inline-size:var(--order-width);max-inline-size:100%}
.machine-actions :is(.order-submit,.order-control,.unavailable-order,.machine-primary) {inline-size:100%}
.machine-shop .machine-primary {background:#b7caa5;border-color:#a6b999 #92a488 #76866c;box-shadow:0 1px #52634d}
.machine-shop .machine-primary[data-quantity]:not([data-quantity="1"]) svg {display:none}
.work-sidebar>.catalog.machine-shop {container-type:inline-size}
/* The controls stay independently operable inside the machine's inspection surface. */
.machine-shop .order-card {cursor:pointer;grid-template-areas:"info status" "bill bill" "build build";min-block-size:84px;padding-inline:12px}
.governor {display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;padding-block:10px}
.pace-steps {display:inline-flex;gap:3px}
.pace-steps button,.machine-shop .throttle-reset {font:600 .82rem/1.2 system-ui,sans-serif;font-variant-numeric:tabular-nums}
.pace-steps button {min-height:38px;padding:6px 9px}
.pace-steps [aria-pressed=true],.machine-shop .throttle-reset {background:#273c40;color:#c2e5e9;border:1px solid #60888d}
.machine-shop .throttle-reset {display:inline-flex;align-items:center;gap:3px;min-height:34px;padding:3px 5px;white-space:nowrap}
.machine-status {grid-area:status;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:3px;min-height:44px}
.machine-shop .order-card:focus-within {background:#29342e}
@media(hover:hover) {
  .machine-shop .order-card:hover {background:#2a342e}
  .machine-shop .order-card .order-info:hover {background:transparent}
}
@container (min-width:450px) {
  .machine-status:has(.throttle-reset) {display:grid;grid-template-columns:auto auto;align-content:center}
  .machine-status .throttle-reset {grid-area:2 / 1 / 3 / 3;justify-content:center}
  .machine-shop .order-card {grid-template-columns:minmax(0,1fr) auto auto;grid-template-areas:"info status build" "bill status build";row-gap:2px}
}
@container (max-width:449px) {
  .machine-shop .order-card:not(:has(.machine-status)) {grid-template-areas:"info build" "bill build"}
  .machine-shop .order-card:has(.machine-status) {grid-template-areas:"info info" "bill bill" "status build"}
  .machine-status {justify-content:flex-start}
  .machine-actions {max-width:100%}
}
.machine-shop .buildbtn {min-height:44px;padding:7px 13px;font:600 .96rem/1.15 system-ui,sans-serif;letter-spacing:0}
.company-reading:focus-visible {outline:2px solid var(--amber);outline-offset:3px}
.company-reading strong {font-variant-numeric:tabular-nums;white-space:nowrap}
.machine-shop .retrofit-btn {display:inline-grid;place-items:center;min-height:44px;min-width:44px;padding:0;border:0;border-radius:4px;background:transparent;color:#f1d7aa;font:600 .78rem/1.1 var(--mono);white-space:nowrap}
.retrofit-face {display:inline-flex;align-items:center;gap:3px;padding:4px 6px;border:1px solid #9b805a;border-radius:4px;background:#38372f}
.retrofit-face svg {transform:rotate(-90deg);stroke-width:2.5}
.retrofit-btn:is(:hover,:focus-visible):not(:disabled) .retrofit-face {background:#4b4233;border-color:#d4ae70;color:#fff0db}
.retrofit-btn:disabled .retrofit-face {color:#bec1b5;border-color:#545c52;background:#2e342f}
.machine-shop .retrofit-btn:disabled {opacity:1}
.shop-future {padding:0 10px 8px}
.shop-future h3 {margin:12px 0 4px;font:600 .88rem/1.25 system-ui,sans-serif}
.shop-future ul {margin:0 -10px}
.shop-future .unknown-machine {grid-template-areas:"info build";min-block-size:84px;padding-inline:12px;align-items:center;color:var(--muted);background:transparent}
.shop-future .order-info,.shop-future .order-info:hover {background:transparent;color:#a2aaa3}
.shop-future .order-info {grid-template-columns:34px minmax(0,1fr)}
.shop-future .order-info .sprite {filter:grayscale(.85) saturate(.6) brightness(.82)}
.shop-future .order-info .sealed-print {display:grid;place-items:center;filter:none;border:1px dashed #5d6860;border-radius:3px;color:#9fa99f;font:650 19px var(--mono)}
.shop-future .unknown-build {grid-area:build;justify-self:end;inline-size:var(--order-width);min-height:44px}
.shop-controls {display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.shop-controls .machine-sort {min-width:0;max-width:100%;font-size:.81rem}
.machine-scroll {max-block-size:clamp(220px,57svh,700px);overflow-y:auto;scrollbar-gutter:auto;scrollbar-color:#53665b transparent;overflow-anchor:none}
.machine-scroll:focus-visible {outline:2px solid var(--amber);outline-offset:-2px}
.warehouse:has(.warehouse-jump) .source-cards {max-block-size:55svh;overflow-y:auto;scrollbar-gutter:stable;scrollbar-color:#53665b transparent;padding:2px}
.machine-scroll>.dispatch-presets {padding:8px 10px;border-top:1px solid var(--line)}
@media(max-width:729px) {
  .warehouse-jump {display:inline-flex;align-items:center;gap:5px;min-height:32px;margin:-4px 0 4px;color:var(--soft);font:600 .87rem var(--display)}
  .warehouse-jump svg:last-child {transform:rotate(90deg)}
  .work-ledger .warehouse:has(.warehouse-jump) {position:sticky;top:0;z-index:3;background:var(--panel)}
  .warehouse:has(.warehouse-jump) .source-cards {max-block-size:clamp(80px,17svh,150px)}
  .machine-scroll {max-block-size:clamp(170px,43svh,410px)}
  #machine-shop-title {scroll-margin-block-start:calc(clamp(80px,17svh,150px) + 9rem)}
  .work-ledger:has(.work-sidebar) {grid-template-columns:minmax(0,1fr)}
  .work-ledger {display:flex;flex-direction:column;align-items:stretch}
  .work-controls {display:grid;min-width:0;gap:8px}
  .work-controls>.warehouse,.work-sidebar,.work-primary {grid-area:auto}
  .work-ledger,.work-sidebar {gap:8px}
  .work-view-frame:not(:empty) {margin-bottom:8px}
  .work-ledger .stock-inspect {min-height:61px;padding-inline-start:5px;gap:4px}
  .work-ledger .stock-action {margin-inline-end:0}
  .work-ledger .research-tray {padding:6px 8px 8px}
  .work-ledger .research-tray header {margin:0 0 5px}
  .work-ledger .research-tray h2 {font-size:15px;gap:4px}
}
@media(pointer:coarse) {
  .order-switch .order-choice {min-height:40px;min-width:38px}
  .machine-shop .buildbtn {min-height:44px}
}
@media(max-width:370px) {
  .work-home .page-title h1 {font-size:31px}
  .work-ledger .stock-inspect>.sprite {width:18px;height:18px}
  .warehouse-head {gap:4px}
  .stock-batch>span {font-size:0}
}
@media(forced-colors:active){
  body select:not([multiple]):not([size]),body select[size="1"] {appearance:auto;background-image:none;padding-inline-end:.5em}
  .order-choice[aria-pressed=true] {outline:1px solid Highlight}
}

/* Live readings keep the baseline and column widths of their surrounding row. */
[data-reading] { font-variant-numeric:tabular-nums; font-kerning:none; }
span[data-reading], b[data-reading], strong[data-reading] { display:inline-block; }

.title-line {display:flex;align-items:center;gap:8px;min-width:0}
.page-title>div:first-child,.title-line h1 {min-width:0}
.title-line h1 {overflow-wrap:anywhere}
.title-line [data-company-title] {display:block;max-width:100%;margin:0;border:0;background:none;padding:0;font:inherit;letter-spacing:inherit;line-height:inherit;color:inherit;overflow-wrap:anywhere;text-align:start;cursor:text;touch-action:manipulation}
.company-registration {display:flex;align-items:center;gap:4px;max-width:100%;min-width:0}
.company-registration input {box-sizing:border-box;width:clamp(6ch,28vw,20ch);min-width:0;max-width:100%;padding:2px 5px;border:1px solid var(--amber);border-radius:3px;color:var(--ink);background:var(--panel);font:700 clamp(1.5rem,3vw,2.7rem)/1.1 var(--display)}
.company-registration button {flex:none;display:grid;place-items:center;width:30px;height:34px;border:1px solid var(--line);border-radius:4px;color:var(--soft);background:transparent}
.company-registration button[type=submit] {color:var(--green)}
@media(pointer:coarse) {
  .company-registration button {width:40px;height:44px}
}

/* Pocket-sized trade cards sit in fitted sockets on the foreman's board. */
.culture-board {margin:0 0 12px;min-width:0;container:cardboard / inline-size}
.culture-board h2 {margin:0;font:700 1.14rem var(--display)}
.culture-tab {position:relative;isolation:isolate;width:100%;min-height:46px;padding:5px clamp(8px,1.4vw,16px);display:flex;align-items:center;gap:9px;text-align:left;border:0;border-radius:inherit;color:var(--ink);background:transparent;cursor:pointer;font:inherit}
.culture-switch {display:flex;align-items:center;gap:inherit;padding:0;border:0;color:inherit;background:none;font:inherit;text-align:left;cursor:pointer}
.culture-tab h2 {display:flex;align-items:center;gap:inherit}
.culture-switch::after {content:"";position:absolute;inset:0;z-index:0;cursor:pointer}
.culture-tab:has(.culture-switch:focus-visible) {outline:2px solid var(--accent);outline-offset:-2px}
.culture-tab-glyph {position:relative;display:grid;place-items:center;flex:none;width:26px;height:30px;border:1px solid #af9463;border-radius:4px;background:#333a30;color:#eac084;box-shadow:-2px 2px #232923,-3px 3px #8b795a}
.culture-tab-name {min-width:0;line-height:1.05}
.culture-tab small {font:600 .78rem/1.1 var(--sans,sans-serif);color:#c7cebf}
.culture-tab>svg {flex:none;margin-left:2px;color:#c7cebf;transition:transform .15s}
.culture-tab[aria-expanded=true]>svg {transform:rotate(90deg)}
.culture-tab:has(.culture-switch:hover),.culture-tab:has(.culture-switch:focus-visible) {background:#303a32}
.culture-pips {margin-inline-start:auto;display:flex;align-items:center;gap:3px}
.culture-pip {box-sizing:border-box;flex:none;width:26px;height:32px;padding:0;display:grid;place-items:center;border:1px solid #566155;border-radius:3px;color:#869387;background:repeating-linear-gradient(45deg,transparent 0 3px,#76847613 3px 4px),#29312b}
.culture-pip.available {background:#25342c;color:#d7bd88;border-style:dashed;border-color:#ac996c}
.culture-pip.occupied {position:relative;z-index:1;cursor:help;background:#d7caa4;border-color:#e4cf96}
.culture-pip.occupied:hover,.culture-pip.occupied:focus-visible {outline:2px solid #e8bd7c;outline-offset:1px}
.culture-pip .sprite {width:21px;height:23px}
#company-card-collection {padding:clamp(9px,1.4vw,17px);border-top:1px solid #4a5447;background:radial-gradient(ellipse at 10% 0%,#39463662,transparent 70%),#222c27}
#company-card-collection[hidden] {display:none}
#company-card-collection>p {margin:0 auto 10px;max-width:56ch;text-align:center;color:var(--soft);font-size:.8rem;line-height:1.4}
.culture-table {display:grid;gap:14px;align-items:start}
.culture-table h3 {display:flex;align-items:center;justify-content:center;gap:7px;margin:0 0 7px;color:#e0e7d8;font:600 .9rem/1.2 var(--display)}
.culture-table h3>span {border:1px solid #536051;border-radius:3px;padding:1px 5px;font:500 .7rem/1.2 var(--mono);color:var(--soft)}
.culture-rack,.culture-hand {min-width:0}
.culture-rack {padding:6px 6px 2px;border:1px solid #4d5545;border-radius:6px;background:#29322b}
.culture-rack:has(+.culture-hand) {position:sticky;top:0;z-index:2;align-self:start;box-shadow:0 2px 3px #161d1770}
.culture-slots {display:grid;grid-template-columns:repeat(3,minmax(0,92px));justify-content:center;align-items:start;gap:clamp(6px,2cqi,16px)}
.culture-socket {position:relative;display:grid;grid-template-rows:auto auto;min-width:0;text-align:center}
.culture-socket>.culture-card,.culture-socket>.culture-sleeve,.culture-empty,.culture-back {width:100%;height:auto;aspect-ratio:5 / 7;border-radius:7px}
.culture-empty,.culture-back {position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;color:#c6d3bd;background:#25342c}
.culture-empty {border:1px dashed #a3a082;font:600 .87rem var(--display);cursor:pointer}
.culture-empty::before,.culture-back::before {content:"";position:absolute;inset:4px;border:1px solid #7a896b69;border-radius:4px;pointer-events:none}
.culture-empty-emblem {width:30px;height:30px;display:grid;place-items:center;border:1px solid #9e9877;border-radius:50%}
.culture-back {border:1px solid #657260;background:repeating-linear-gradient(45deg,#64765724 0 1px,transparent 1px 6px),repeating-linear-gradient(-45deg,#64765724 0 1px,transparent 1px 6px),#28392f;color:#bbba9d}
.culture-back::before {inset:4px;border:3px double #7a896d9c}
.culture-back svg {box-sizing:content-box;padding:8px;border:3px double #9b9c7c;border-radius:50%;background:#29392d}
.culture-slot-caption,.culture-socket.sealed>small {min-height:27px;display:flex;align-items:center;justify-content:center;gap:3px}
.culture-slot-caption>small,.culture-socket.sealed>small,.culture-slot-label {font:500 .73rem/1.15 var(--mono);color:#bbc7b8}
.culture-socket.sealed>small {color:#a3afa3}
.culture-slot-label {padding:3px;background:transparent;border:0;cursor:pointer}
.culture-slot-label:disabled {opacity:1;cursor:default}
.culture-slot.selected .culture-empty,.culture-slot.selected .fitted {outline:1px solid #dcb475;outline-offset:1px}
.culture-slot.selected .culture-slot-label,.culture-slot.selected .culture-empty-emblem {color:#f1c784}
/* Keep the rack within reach when a drag starts at the end of a long hand. */
body[data-card-drag=reveal] #app .culture-rack:has(+.culture-hand) {position:sticky;top:0}
@container carddrawer (max-height:155px) {
  body[data-card-drag=reveal] .culture-rack :is(h3,.culture-slot-caption,.sealed>small) {display:none}
}
body[data-card-drag] .culture-slot:not([data-held]) :is(.culture-empty,.fitted) {outline:1px dashed #e5c88c;outline-offset:2px}
body[data-card-drop-slot="0"] .culture-slot[data-drop-slot="0"],
body[data-card-drop-slot="1"] .culture-slot[data-drop-slot="1"],
body[data-card-drop-slot="2"] .culture-slot[data-drop-slot="2"] {--landing-ring:#ffcf7d;--landing-glow:#ffc37278}
body[data-card-drag] .culture-slot:not([data-held]) :is(.culture-empty,.fitted) {box-shadow:0 0 0 3px var(--landing-ring,transparent),0 0 14px var(--landing-glow,transparent)}
.culture-remove {display:grid;place-items:center;min-width:26px;min-height:26px;border:0;border-radius:4px;padding:0;background:transparent;color:#cad4c6}
.culture-remove:hover,.culture-slot-label:enabled:hover {background:#36413a}
.culture-slot-caption .culture-timer {display:inline-flex;align-items:center;gap:2px;white-space:nowrap;color:#e3bc84;font:500 .68rem var(--mono);font-variant-numeric:tabular-nums}
.culture-slot:has(.culture-timer) .culture-slot-caption {flex-wrap:wrap;gap:1px 3px}
.culture-library {display:flex;flex-wrap:wrap;justify-content:center;align-items:stretch;gap:10px}
.culture-library>* {flex:0 1 min(44%,129px)}
.culture-sleeve {display:grid;min-width:0;border-radius:8px;cursor:help}
.culture-sleeve:focus-visible {outline:2px solid #f1ca89;outline-offset:2px}
.culture-sleeve>.culture-card {pointer-events:none;height:100%}
.culture-hand .culture-card {min-block-size:max-content}
.culture-card {--print:#4f3922;--metal:#b89255;--paper:#ecdfbb;--scene:url("../public/art/industry.webp");--frame:50% 50%;position:relative;isolation:isolate;box-sizing:border-box;display:flex;align-items:center;flex-direction:column;gap:5px;min-width:0;width:100%;min-height:0;aspect-ratio:2 / 3;padding:6px 7px 10px;border:2px solid var(--metal);border-radius:8px;color:var(--print);background:linear-gradient(125deg,#fff5dd,var(--paper) 56%,#e0cba8);box-shadow:0 2px 2px #10140f80;overflow:hidden;text-align:center;user-select:none}
.culture-card[data-ink=earth] {--print:#643721;--paper:#efd3b6;--metal:#bc845d}
.culture-card[data-ink=leaf] {--print:#344d36;--paper:#dce2c9;--metal:#8c9b6f}
.culture-card[data-ink=ink] {--print:#294955;--paper:#dadfcf;--metal:#829c9f}
.culture-card[data-ink=violet] {--print:#513755;--paper:#e3d6df;--metal:#ae91ab}
.culture-card[data-id=fieldwork],.culture-card[data-id=deepVein] {--scene:url("../public/art/valley/foothills.webp");--frame:24% 44%}
.culture-card[data-id=deepVein] {--frame:72% 74%}
.culture-card[data-id=maintenance] {--frame:78% 50%}
.culture-card[data-id=circular] {--frame:22% 30%}
.culture-card[data-id=condenser] {--frame:100% 80%}
.culture-card[data-id=patents],.culture-card[data-id=cleanroom],.culture-card[data-id=customs] {--scene:url("../public/art/technology.webp");--frame:0% 45%}
.culture-card[data-id=cleanroom] {--frame:67% 55%}
.culture-card[data-id=customs] {--frame:100% 45%}
.culture-card[data-id=packing],.culture-card[data-id=refit],.culture-card[data-id=peakLoad] {--scene:url("../public/art/space.webp");--frame:15% 70%}
.culture-card[data-id=peakLoad] {--frame:82% 38%}
.culture-card[data-id=clockwork] {--scene:url("../public/art/reality.webp");--frame:55% 40%}
.culture-card::before,.culture-card::after {content:"";position:absolute;pointer-events:none}
.culture-card::before {inset:2px;border:1px solid var(--print);opacity:.65;border-radius:5px}
.culture-card::after {left:calc(50% - 2px);bottom:4px;width:3px;height:3px;background:var(--metal);transform:rotate(45deg)}
.culture-print {position:relative;isolation:isolate;display:grid;place-items:end start;flex:0 0 auto;width:100%;height:82px;border:1px solid var(--print);border-radius:3px 3px 0 0;background:#403d32 var(--scene) var(--frame) / auto 152% no-repeat;image-rendering:pixelated;box-shadow:inset 0 0 0 1px #fbdeb448}
.culture-print i {position:absolute;z-index:1;top:-2px;right:3px;width:18px;height:23px;display:grid;place-items:center;padding-bottom:4px;clip-path:polygon(0 0,100% 0,100% 100%,50% 83%,0 100%);color:#fff5db;background:var(--print)}
.culture-print::before {content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,#171b1980,transparent 80%),linear-gradient(0deg,#20211da6,transparent 60%)}
.culture-cameo {margin:0 0 1px 3px;display:grid;place-items:center;width:66px;height:66px;filter:drop-shadow(0 2px 1px #17150bd9)}
.culture-cameo .sprite {width:100%;height:100%}
.culture-card-name {display:block;width:100%;margin-top:1px;font:700 1.05rem/1.08 var(--display);color:var(--print);overflow-wrap:anywhere;text-wrap:balance}
.culture-rule {display:block;width:100%;padding-top:5px;border-top:1px solid var(--metal);font:500 .83rem/1.16 var(--sans,sans-serif);color:#312e28;text-wrap:balance;overflow-wrap:break-word}
.culture-card[draggable=true] {cursor:grab}
.culture-card[draggable=true]:active {cursor:grabbing}
.culture-card[aria-pressed=true] {outline:2px solid #eacf9e;outline-offset:2px}
.culture-grip {position:absolute;z-index:1;right:0;top:0;width:34px;height:min(100%,34px)}
.culture-card[draggable=true] .culture-grip {touch-action:none}
.culture-card:disabled {opacity:1;cursor:default}
.culture-card.fitted {gap:3px;padding:5px 5px 7px}
.culture-card.fitted .culture-print {height:auto;flex:1 1 auto;min-height:32px}
.culture-card.fitted .culture-print i {width:13px;height:17px}
.culture-card.fitted .culture-print i svg {width:10px;height:10px}
.culture-card.fitted .culture-cameo {width:42px;height:42px;margin-left:2px}
.culture-rating {margin-top:auto;color:var(--print);font:700 .77rem/1 var(--mono)}
.culture-card.fitted .culture-card-name {font-size:.82rem;line-height:1.05}
.culture-ghost {position:fixed;left:0;top:0;width:80px;height:112px;z-index:1000;pointer-events:none;opacity:.92;box-shadow:0 7px 18px #16191072}
@media (hover:hover) and (pointer:fine) {
  .culture-card:enabled:hover {box-shadow:0 0 0 1px var(--metal),0 4px 8px #10140f99}
  .culture-empty:hover {background-color:#304133}
}
@media (prefers-reduced-motion:no-preference) {
  .culture-card {transition:box-shadow .15s,transform .15s}
  .culture-hand .culture-card:enabled:hover {transform:translateY(-2px)}
}
.culture-hand :is(.culture-card,.culture-sleeve) {scroll-margin-block-start:11.5rem}
@container carddrawer (max-height:330px) {
  .culture-hand :is(.culture-card,.culture-sleeve) {scroll-margin-block-start:0}
}
/* A shallow drawer keeps slot names, the countdown and the swap action above the cards. */
@container carddrawer (max-height:285px) {
  .culture-rack .culture-sleeve {aspect-ratio:auto}
  .culture-rack .culture-card.fitted {display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:24px auto;gap:2px 3px;align-content:start;padding:4px;aspect-ratio:auto;min-height:58px}
  .culture-rack .fitted .culture-print {height:24px;min-height:0}
  .culture-rack .fitted .culture-cameo {width:22px;height:22px}
  .culture-rack .fitted .culture-card-name {grid-column:1/-1;grid-row:2;margin:0}
  .culture-rack .fitted .culture-rating {grid-column:2;grid-row:1;margin:0;align-self:center}
  .culture-rack :is(.culture-empty,.culture-back) {aspect-ratio:auto;min-height:58px}
}
@container cardboard (max-width:350px) {
  .culture-tab {gap:6px}
  .culture-tab small {font-size:.72rem}
  .culture-pip {width:22px;height:27px}
  .culture-pip .sprite {width:17px;height:20px}
  .culture-library {gap:7px}
  .culture-slot-caption .culture-timer svg {display:none}
}
@media(max-width:760px){.culture-board{margin-bottom:8px}}

dialog:has(.welcome-setup) {width:min(27rem,calc(100% - 24px))}
.welcome-setup {display:grid;gap:14px}
.setting-row .volume-control {display:inline-flex;align-items:center;gap:7px;max-width:65%}
.volume-control input {min-width:0;width:min(9rem,100%)}
.volume-control [data-volume-label] {min-width:4ch;text-align:end;white-space:nowrap;font-variant-numeric:tabular-nums}
@media(max-width:520px) {
  .setting-row:has(select[data-change=notation]) {display:grid;grid-template-columns:minmax(0,1fr);gap:5px;padding-block:7px}
  .setting-row select[data-change=notation] {width:100%;max-width:100%}
}
.welcome-languages {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.welcome-language {display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:46px;padding:8px 13px;border:1px solid #58635a;border-radius:4px;background:#28312b;color:var(--ink);font:inherit;font-weight:600;text-align:start}
.welcome-language[aria-pressed=true] {background:#39362a;color:#ffdaa3;border-color:#c59863}
.welcome-language:hover,.welcome-language:focus-visible {border-color:#e9bd84}
.welcome-fact {display:grid;grid-template-columns:20px minmax(0,1fr);gap:10px;align-items:start}
.welcome-fact svg {color:var(--amber);margin-top:2px}
.welcome-fact p {margin:0;line-height:1.45}
.welcome-setup .primary {min-height:44px;justify-self:end}


.group-panels {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-block:18px}
.group-panels .panel {min-width:0;margin:0;overflow:hidden}
.group-ledger,.group-panels>.group-panel:only-child {grid-column:1/-1}
.group-content p{max-width:75ch}
.group-horizon{display:flex;align-items:center;gap:.65rem;padding-block:.45rem;border-top:1px solid var(--line);color:var(--soft);font-size:.82rem}
.group-horizon .sprite{width:48px;height:48px;object-fit:contain;flex:none}
.group-horizon strong{display:block;color:var(--ink);font-variant-numeric:tabular-nums;font-size:1rem}
.group-ledger ul {list-style:none;margin:0;padding:0 16px;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,235px),1fr));gap:0 20px}
.group-ledger li {display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-content:center;align-items:center;column-gap:8px;min-width:0;padding-block:10px}
.group-ledger li>svg {grid-column:1;grid-row:1 / 3;color:var(--amber)}
.group-ledger li>span {grid-column:2;grid-row:1 / 3;font-weight:650;min-width:0;overflow-wrap:anywhere}
.group-ledger li small {display:block;font-weight:400;font-size:.76rem;color:var(--soft);font-variant-numeric:tabular-nums}
.group-ledger li b,.group-ledger .parent-income {grid-column:3;justify-self:end;font-variant-numeric:tabular-nums;white-space:nowrap}
.group-ledger li:not(:has(.parent-income)) b {grid-row:1 / 3}
.group-ledger .parent-income {color:#bbcfaf}
.group-total {color:var(--amber);font-variant-numeric:tabular-nums}
.group-benefit,.group-conditions span {display:flex;align-items:center;gap:9px}
.group-benefit svg {color:var(--amber);flex:none}
.group-content {padding:14px;display:flex;flex-direction:column;align-items:start;gap:10px}
@media(min-width:800px){
  .group-panel:only-child .group-content:has(.group-horizon){display:grid;grid-template-columns:minmax(0,2fr) minmax(15rem,1fr);column-gap:2rem;justify-items:start}
  .group-panel:only-child .group-content>*{grid-column:1}
  .group-panel:only-child .group-content>.group-horizon{grid-column:2;grid-row:1 / span 7;align-self:stretch;justify-self:stretch;justify-content:center;flex-direction:column;text-align:center;border-top:0;border-inline-start:1px solid var(--line);gap:12px}
  .group-panel:only-child .group-horizon .sprite{width:88px;height:88px}
  .group-panel:only-child .group-horizon strong{font:700 1.5rem var(--display)}
}
.group-content p,.founding-form p {margin:0;line-height:1.45}
.group-caption,.group-conditions,.founding-form label {color:var(--soft);font-size:.82rem}
.group-benefit {padding:7px 10px;border-left:2px solid #a6c18d;background:#333e32}
.group-benefit b {font-variant-numeric:tabular-nums}
.group-conditions {display:grid;gap:5px}
.group-action {min-height:38px}
.founding-form {display:grid;gap:12px}
.founding-form label {font-weight:650;margin-bottom:-7px}
.founding-form input {width:100%;min-width:0;padding:8px 11px;min-height:42px;font:inherit;background:#202723;color:var(--ink);border:1px solid var(--line);border-radius:3px}
.supply-choice-list {display:grid;gap:4px;margin:0;min-width:0;padding:0;border:0}
.supply-choice-list legend {padding:0;font-weight:700}
.supply-choice-list p {padding:2px 0 5px;font-size:.84rem;color:var(--soft)}
.founding-form .supply-choice {display:flex;align-items:center;gap:8px;margin:0;padding:5px 8px;min-height:40px;color:var(--ink);border:1px solid var(--line);border-radius:4px;cursor:pointer}
.supply-choice:has(input:checked) {background:#303d35;border-color:#92ad8d}
.supply-choice:focus-within {outline:2px solid var(--amber);outline-offset:1px}
.founding-form .supply-choice input {flex:none;width:16px;height:16px;min-height:0;margin:0;padding:0;accent-color:#b2ca9a}
.supply-choice>span,.supply-choice small {display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.supply-choice small .sprite {width:19px;height:19px}
.supply-choice>b {margin-left:auto;white-space:nowrap;color:#c0d8ac;font-variant-numeric:tabular-nums}

.founding-terms {display:grid;gap:2px}
.founding-actions {display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;gap:7px}
@media(max-width:700px){.group-panels{grid-template-columns:minmax(0,1fr)}}

.group-ledger .group-history{margin:4px 16px 8px}.group-history ul{padding:0}
.group-backing {display:flex;align-items:flex-start;gap:8px;margin:0 16px;padding:10px 0;border-top:1px solid var(--line);font-size:.83rem}
.group-backing svg {color:var(--amber);flex:none;margin-top:2px}
.group-backing>div {display:grid;gap:3px;color:var(--soft)}
.group-backing strong {color:var(--ink)}
.subsidiary-badge {display:inline-flex;align-items:center;justify-content:center;gap:4px;flex:none;min-height:30px;padding:3px 7px;color:#d3dbbd;background:#29352c;border:1px solid #54644e;border-radius:4px;font-family:inherit;font-size:.8rem;font-weight:650;line-height:1.1;font-variant-numeric:tabular-nums;white-space:nowrap;cursor:pointer}
.subsidiary-badge:hover,.subsidiary-badge:focus-visible {color:#eef5dd;border-color:#acbc91;background:#334333}
@media(max-width:600px){.subsidiary-badge .badge-output{display:none}}
.title-line:has(.subsidiary-badge) {flex-wrap:wrap;gap:3px 7px}


.rank-entry { margin: 0.8rem 0 1rem; }
.rank-panel > p { margin: 0 0 0.8rem; }
.rank-panel > small { display: block; margin-top: 0.55rem; color: var(--muted); }
.rank-scroll { max-height: min(45dvh, 25rem); overflow: auto; }
.rank-scroll table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.rank-scroll :is(th,td) { text-align: right; padding: 0.45rem; border-bottom: 1px solid var(--edge,#49534c); }
.rank-scroll th:nth-child(2) { text-align: left; overflow-wrap: anywhere; }
.rank-scroll thead { position: sticky; top: 0; background: var(--panel,#252c29); }
.rank-mine { color: var(--accent,#f3bb73); }
.rank-empty { color: var(--muted); }
.ipo-threshold { display:grid; gap:.2rem; padding:.65rem .8rem; border-inline-start:2px solid var(--amber); }
.ipo-threshold span { color:var(--soft); font-variant-numeric:tabular-nums; }
.rank-panel :is(.rank-scroll,.rank-empty) { margin-block-start:.9rem; }
#rank-enroll,.rank-member { margin-block:.6rem; }
#rank-enroll label { display: block; margin-bottom: 0.3rem; }
#rank-enroll > div,.rank-member { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
#rank-enroll input { flex: 1 1 10rem; min-width: 0; }

.works-inspections{margin-block-start:var(--gap,12px)}
.group-patents ul{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,15rem),1fr));gap:1rem;list-style:none;margin:0;padding:.85rem}
.group-patents li{display:flex;align-items:flex-start;gap:.5rem;min-width:0}
.group-patents li>.sprite{flex:none;width:1.7rem;height:1.7rem}
.group-patents li p{margin:.2rem 0 .4rem;line-height:1.35}
.group-patents li small{color:var(--soft)}
.works-inspections .group-content{display:grid;gap:.45rem}
.works-inspections .group-content p{margin:0}
.works-inspections ul{list-style:none;margin:0;padding:0}
.inspection-row{display:grid;grid-template-columns:2rem 1fr auto;gap:.65rem;align-items:center;border-top:1px solid var(--line);padding:.55rem 0}
.inspection-row .sprite{width:2rem;height:2rem}
.inspection-row strong,.inspection-row small{display:block}
.inspection-row small{color:var(--soft);font-variant-numeric:tabular-nums}
@media(max-width:640px){.inspection-row{grid-template-columns:1.75rem minmax(0,1fr)}.inspection-modes{grid-column:2}.inspection-row .btn{white-space:normal}}


/* Keep the optional exchange outside the workshop grid. */
.yard-choices,.yard-choice,.yard-receipts,.yard-receipts>span {display:flex;align-items:center;flex-wrap:wrap;gap:5px}
.yard-choice {justify-content:center;min-height:38px;padding:5px 9px;border:1px solid #89764e;border-radius:4px;background:#34352b;color:#f6e1b7;cursor:pointer}
.yard-choice:hover:enabled {background:#484332}
.yard-choice:disabled {opacity:.65;cursor:default}
.yard-choice .sprite,.yard-receipts .sprite {width:20px;height:20px}
.yard-receipts {font-size:.79rem;color:var(--soft)}
.yard-receipts>span {background:var(--panel);border:1px solid var(--line);border-radius:4px;padding:3px 7px}
@media(max-width:760px) {
 .yard-choice {min-height:44px}
 .yard-choices {flex-basis:100%}
}


.machine-status > .fitted-mark {flex:none;align-self:center;white-space:nowrap;padding:4px 6px;border:1px solid #728071;border-radius:4px;color:#e1edda;font:600 .78rem/1.1 var(--mono)}
.machine-status > .fitted-mark[data-level="0"] {color:var(--soft);border-color:var(--line)}
.bill-tokens .cost-token .material-name {display:none}
#cost-tip {position:fixed;z-index:10000;pointer-events:none;width:max-content;max-width:min(22rem,calc(100vw - 12px));box-sizing:border-box;padding:.4rem .65rem;background:#202c26;color:#f3efe2;border:1px solid #728a79;border-radius:.35rem;box-shadow:0 3px 10px #0005;font:inherit;line-height:1.35}
#cost-tip strong {font-size:.85rem}
.bill-tokens .cost-token.needed {border-color:#c57270;background:#472c30;color:#ffe5df}
.bill-tokens .needed .material-amount {white-space:normal;overflow-wrap:anywhere}
.founding-panel .group-benefit b {white-space:nowrap}
.group-conditions .unmet {color:#ffb7ae}
.group-conditions .met svg {color:#abcaa0}
.founding-panel .group-content {display:grid;gap:10px;align-content:start;justify-items:start}
.founding-panel .group-content > * {margin:0}
.group-patents li small:has(.bill-tokens) {display:flex;gap:8px;flex-wrap:wrap;align-items:center}

#factory-opening {margin:auto;text-align:center;padding:1rem;color:var(--soft);font:500 1rem/1.5 system-ui,sans-serif}
#factory-opening img {width:48px;height:48px;image-rendering:pixelated}
#factory-opening p {margin:.6rem 0}
#factory-opening a {color:var(--amber)}
.warehouse-head .opening-tip {margin:0;flex-basis:100%;font-size:.82rem;color:var(--soft);line-height:1.4}
@media (forced-colors:active) {
  .machine-shop .retrofit-btn:focus-visible {outline:2px solid Highlight;outline-offset:2px}
}

.group-outlook {display:flex;align-items:flex-start;gap:10px;margin-top:14px;padding:12px 14px;border:1px dashed #566354;border-radius:4px;color:var(--soft)}
.group-outlook svg {flex:none;color:var(--amber)}
.group-outlook span {line-height:1.4}

.share-choices {display:flex;flex-wrap:wrap;gap:.5rem;margin-block:.8rem}
.footer-works .share-launch {
  display: inline-flex;
  align-items: center;
  gap: .32em;
  border-radius: 3px;
  font: inherit;
  white-space: nowrap;
}
.share-launch svg { color: #caaa7d; flex: none }
.share-choices .btn svg { flex: none }
.award-rarity,.rarity-key {display:block;color:var(--soft);font:inherit;font-size:.78rem;font-variant-numeric:tabular-nums}
.rarity-key {margin-top:.45rem}
