﻿:root {
  --pine: var(--art-pine);
  --teal: var(--art-teal);
  --oak: var(--art-oak);
  --vellum: var(--art-vellum);
  --gilt: var(--art-gilt);
  --leather: var(--art-leather);
  --journal: var(--art-journal);
  --ink: #382815;
  --cream: #fff4ce;
}
* { box-sizing: border-box; }
body { margin: 0; background: #403422; color: var(--ink); font: 15px/1.35 "Segoe UI", sans-serif; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; font-weight: 650; }
button:disabled { cursor: default; filter: saturate(.32) brightness(.8); }
button:hover:enabled { filter: brightness(1.17); }
button:active:enabled { transform: translateY(1px); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: none; text-decoration: underline double; text-underline-offset: 3px; filter: brightness(1.22); }
input:focus-visible { --skin: var(--gilt); color: var(--ink); }
/* The painted outer slices carry the bevels, stitching, corner fittings and rims. */
header, aside, button, input, select, footer, .tools, .purse, .caption, .deal, .item em, #toast, dialog {
  border: 10px solid transparent;
  border-image: var(--skin, var(--oak)) 15 21 fill / 9px 12px stretch;
  background: transparent;
}
header { height: 62px; display: flex; align-items: center; padding: 0 16px; gap: 18px; color: var(--cream); }
.brand { font: bold 29px Georgia, serif; letter-spacing: .5px; }
.place { color: #fae6bd; font: italic 16px Georgia, serif; }
.purse { --skin: var(--pine); margin-left: auto; padding: 0 8px; font-variant-numeric: tabular-nums; }
.gold-icon {color:#ffdc71;font-style:normal;text-shadow:0 1px 2px #4c3416}
main { display: grid; grid-template-columns: minmax(0, 1fr) clamp(350px, 30vw, 435px); height: calc(100vh - 62px); }
#field { position: relative; overflow: hidden; background: #a4ac70; }
#scene { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#light { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#field.dusk { background-blend-mode: multiply; background-color: #858a9d; }
#field.dusk #scene { filter: brightness(.74) saturate(.82); }
.caption, .viewtools, .tools, #toast { position: absolute; }
.caption { --skin: var(--leather); top: 16px; left: 16px; color: var(--cream); padding: 3px 10px; pointer-events: none; }
h1 { font: normal clamp(17px, 1.5vw, 24px) Georgia, serif; margin: 0; }
.viewtools { right: 12px; top: 16px; display: flex; gap: 2px; }
.viewtools button, .tools button { --skin: var(--pine); color: var(--cream); font-size: 13px; padding: 0 3px; min-width: 32px; min-height: 35px; border-width: 7px; }
.tools { bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 3px; padding: 1px 3px; white-space: nowrap; }
.tools span { width: 4px; }
.tools .on, .viewtools .on, nav button.active, .toggle .on { --skin: var(--gilt); color: var(--ink); }
.on, nav button.active { text-decoration: underline; text-underline-offset: 3px; }
#toast { --skin: var(--leather); color: var(--cream); left: 50%; bottom: 82px; transform: translateX(-50%); padding: 2px 8px; pointer-events: none; text-align: center; opacity: 0; }
#toast.show { opacity: 1; }
aside { color: #f3e4c4; display: flex; flex-direction: column; min-height: 0; border-width: 14px; border-image: var(--journal) 56 fill / 23px stretch; }
nav { display: flex; gap: 3px; padding: 7px 5px; }
nav button { --skin: var(--pine); color: var(--cream); flex: 1; min-width: 0; font-size: 14px; padding: 2px 0; border-width: 8px; }
#panel { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding: 9px 14px 15px; scrollbar-color: #946f45 transparent; }
h2, h3 { font-family: Georgia, serif; font-weight: normal; }
h2 { font-size: 31px; color: #ffe5b0; margin: 0 0 6px; }
h3 { font-size: 22px; margin: 0; }
.intro, .sub, .receipt, footer, #dealinfo, .switch, .odds { font-size: 14px; }
.intro, .sub { margin: 4px 0 8px; }
.machine { position: relative; width: 100%; aspect-ratio: 3 / 2; margin: 7px 0 5px; background: var(--art-mill) center/contain no-repeat; }
.reels { position: absolute; left: 17.7%; top: 49%; width: 64.6%; height: 30%; display: grid; grid-template-columns: repeat(3, 1fr); }
.reel { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.reel img { position: absolute; inset: 6% 9.5%; width: 81%; height: 88%; object-fit: contain; }
.rolling .reel img { animation: tumble .16s ease-in-out infinite alternate; }
@keyframes tumble { to { transform: translateY(3px) scale(.94); } }
.primary { --skin: var(--teal); color: var(--cream); width: 100%; padding: 2px 8px; font: bold 17px Georgia, serif; min-height: 39px; }
.soft, .toggle button { --skin: var(--oak); color: var(--cream); padding: 1px 5px; font-size: 13px; }
.row, .line, .switch { display: flex; justify-content: space-between; align-items: center; gap: 7px; }
.line { margin: 15px 0 5px; }
.switch { margin: 10px 0; }
.toggle { display: flex; gap: 2px; }
.items { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; }
.item { --skin: var(--leather); color: #f4e3c3; position: relative; display: flex; flex-direction: column; align-items: flex-start; padding: 0 3px 2px; font-size: 14px; text-align: left; }
.item.selected { --skin: var(--teal); color: var(--cream); }
.item.selected img { transform: scale(1.06); }
.item img { width: 100%; height: 53px; object-fit: contain; margin-bottom: 3px; }
.item em { --skin: var(--pine); position: absolute; top: -5px; right: -4px; padding: 0 3px; border-width: 4px; border-image-width: 4px; color: var(--cream); font: 650 11px "Segoe UI", sans-serif; }
.item small { font-size: 12px; font-weight: 400; }
.item.locked img { filter: saturate(.45); }
footer { --skin: var(--leather); color: var(--cream); margin: 2px 4px 4px; padding: 0 5px; }
.receipt { margin: 8px 0; }
.receipt:empty { display: none; }
.deal { --skin: var(--oak); display: grid; gap: 3px; padding: 0 4px; margin: 6px 0; position: sticky; top: -10px; z-index: 1; }
.deal input, select { --skin: var(--leather); color: var(--cream); padding: 0 3px; min-height: 30px; border-width: 6px; font-size: 13px; }
.deal input { width: 61px; }
select { appearance: none; cursor: pointer; max-width: 140px; text-align: center; }
select option { background-color: #463824; color: var(--cream); }
.deal .primary { width: auto; min-height: 32px; padding: 0 4px; font-size: 15px; }
.odds { display: grid; grid-template-columns: 1fr auto; gap: 4px; font-variant-numeric: tabular-nums; }
dialog { --skin: var(--vellum); top: 40%; padding: 12px 20px; z-index: 4; }
@media (max-width: 1170px) {
  .caption { top: 58px; }
  #panel { padding-inline: 8px; }
  .tools button { padding-inline: 0; }
}
@media (max-height: 760px) {
  .machine { max-width: 270px; margin-inline: auto; }
  .line { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .rolling .reel img { animation: none; }
  button:active:enabled { transform: none; }
}


/* The meadow and the workbench share one masthead and a single content inset. */
:root { --workbench-inset: clamp(8px, 1.2vw, 18px); }
.brand { margin: 0; }
.place { font-size: 17px; }
.skip { position:absolute; left:12px; top:-80px; z-index:8; padding:8px 18px; color:var(--cream); background:var(--leather) center/100% 100%; }
.skip:focus-visible { top:8px; }
nav { padding-inline:var(--workbench-inset); }
#panel { padding:14px var(--workbench-inset) 18px; }
footer { margin-inline:var(--workbench-inset); }
h2 { font-size:clamp(29px,2.4vw,37px); line-height:1.05; margin-bottom:9px; }
.intro, .sub, .switch, .item small { color:#e4d1af; }
.machine { margin:14px auto 8px; max-width:360px; }
.primary { min-height:42px; }
.line { margin-top:22px; }
.odds { grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px 14px; }
.chance { display:grid; grid-template-columns:29px minmax(0,1fr) auto; align-items:center; gap:5px; min-height:34px; font-size:13px; }
.chance img { width:29px; height:29px; object-fit:contain; }
.chance b { color:#ffdfa3; font-weight:650; }
.trade-piece { display:flex; align-items:center; gap:9px; }
.trade-piece img { width:37px; height:37px; object-fit:contain; }
.trade-piece strong { font:600 17px Georgia,serif; }
.item { padding:3px 4px 5px; }
.item img { height:62px; margin-bottom:6px; }
.item:focus-visible, button:focus-visible { outline:2px solid #ffe3a1; outline-offset:-4px; }
@media(prefers-reduced-motion:no-preference) {
  button { transition:transform 130ms ease-out,filter 130ms ease-out; }
  button:hover:enabled { transform:translateY(-1px); }
  .item:hover { transform:translateY(-2px); }
  button:active:enabled { transform:translateY(1px); }
  .item img { transition:transform 140ms ease-out; }
  .item:hover img { transform:scale(1.03); }
  body[data-ready] aside { animation:open-workbench 280ms ease-out both; }
  @keyframes open-workbench { from { opacity:.3; transform:translateX(5px); } }
}
@media(max-width:1150px) {
  .odds { gap:4px 8px; }
  .chance { grid-template-columns:23px minmax(0,1fr) auto; }
  .chance img { width:23px; height:23px; }
}
@media(max-height:760px) { .machine { max-width:260px; margin-block:5px; } .line { margin-top:12px; } }
.brand { font-size:clamp(31px,2.7vw,40px); } .skip:focus-visible { outline:3px solid #fff8d4; outline-offset:2px; } @media(min-height:761px){ .machine { max-width:none; } }
.track,.symbol { width:100%; height:100%; } .symbol { position:relative; } .reels { grid-template-rows:minmax(0,1fr); }
kbd {font:inherit;font-size:.78em;color:inherit;opacity:.84} @media(max-width:1170px){.tools{gap:1px}.tools button{font-size:12px}}
#reset-build {margin-left:auto} header .purse {margin-left:0} :is(#reset-dialog,#plan-dialog,#new-game-dialog) {max-width:380px;top:0;margin:auto;color:var(--ink)} :is(#reset-dialog,#plan-dialog,#new-game-dialog) h2 {color:var(--ink);font-size:24px} :is(#reset-dialog,#plan-dialog,#new-game-dialog) button {color:var(--cream)} :is(#reset-dialog,#plan-dialog,#new-game-dialog)::backdrop {background:#18170fb3}
#panel { scrollbar-gutter:stable; }
.receipt,.receipt:empty { display:flex; align-items:center; gap:10px; block-size:68px; margin:7px 0; }
.receipt > span { min-width:0; }
#reward-tile { --skin:var(--gilt); flex:0 0 60px; height:60px; padding:0; border-width:6px; cursor:grab; }
#reward-tile img { width:100%; height:100%; object-fit:contain; pointer-events:none; }
.receipt small { display:block; }
#piece-tools { position:absolute; display:grid; justify-items:center; gap:3px; transform:translateX(-50%); z-index:2; }
#piece-caption {max-width:100%;padding:3px 8px;border:1px solid #977b48;border-radius:4px;background:#42321f;color:var(--cream);font-size:13px;text-align:center;pointer-events:none}
.piece-actions {display:flex;align-items:center;gap:2px}
#piece-dye { --skin:var(--vellum); height:34px; padding:0 3px; border-width:5px; font-size:13px; }
#piece-tools[hidden] { display:none; }
#piece-tools button { --skin:var(--pine); color:var(--cream); min-width:34px; height:34px; padding:0; border-width:6px; font-size:19px; line-height:1; }
#sections { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px }
.work-row { display:flex;gap:6px;align-items:center;margin:8px 0;flex-wrap:wrap }
.work-row strong { text-transform:capitalize }
.work-row span { flex:1;font-size:13px }
.work-row small,.plan-piece small {display:block}
.plan-piece img {width:34px;height:40px;object-fit:contain}
.plan-piece div {flex:1}
#panel label {display:block;margin:8px 0}
.material-filter {display:flex;align-items:center;gap:8px;margin:6px 0}
#material-filter {appearance:auto;max-width:100%;text-align:left}
#work-recipe {max-width:100%}
.bag-stack {display:flex;flex-direction:column;min-width:0}
.bag-stack .item {flex:1}
.satchel-heading {display:flex;align-items:center;gap:6px;margin-bottom:6px}
.satchel-heading h2 {min-width:0;margin:0}
.satchel-heading h2 small,.mobile-tray-title small {font:500 12px/1.2 "Segoe UI",sans-serif}
.satchel-heading [data-work^="sell"] {margin-left:auto;white-space:nowrap;flex:none}
.mobile-tray-title {display:none}
.commission.deal {position:static;gap:6px;margin-bottom:12px}
.client {display:flex;align-items:center;gap:12px}
.client img {width:52px;height:58px;object-fit:contain}
.client strong,.client small {display:block}
.client strong {font:600 17px Georgia,serif}
.job-building {width:100%;height:118px;object-fit:contain}
#award {--skin:var(--journal);color:var(--cream);top:0;margin:auto;width:min(330px,90vw);text-align:center;padding:16px 20px}
#award h2 {margin:0 0 12px;color:inherit}
#award .client {justify-content:center;text-align:left}
#award::backdrop {background:#15180fc4}
.award-chest,.award-loot {display:grid;justify-items:center;gap:4px;margin:10px auto;color:var(--cream)}
.award-chest img,.award-loot img {width:122px;height:100px;object-fit:contain}
#collect-award {margin:10px auto 0}
.board-pager,.resource-loot {display:flex;align-items:center;justify-content:space-between;gap:8px}
#award:has(.chest-contents) {width:min(590px,90vw);max-height:90vh;overflow:auto}
.chest-contents h3 {text-transform:capitalize}
.loot-grid {display:flex;justify-content:center;flex-wrap:wrap;gap:8px}
.loot-grid div {display:grid;align-content:start;justify-items:center;flex:0 1 88px}
.loot-grid img {width:70px;height:68px;object-fit:contain}
.loot-grid strong {font-size:13px;line-height:1.2}
.resource-loot {justify-content:center;flex-wrap:wrap;margin:14px 0}
.resource-loot span {display:flex;gap:5px;align-items:center}
.resource-loot img {width:32px;height:32px;object-fit:contain}
.recipe-grid {display:grid;grid-template-columns:repeat(auto-fill,minmax(54px,1fr));gap:7px;margin:9px 0 14px}
.recipe-icon {--skin:var(--leather);position:relative;display:grid;place-items:center;min-width:0;height:61px;padding:1px}
.recipe-icon img {max-width:100%;width:46px;height:44px;object-fit:contain;pointer-events:none}
.recipe-icon[data-blocked=true] img {opacity:.55}
.recipe-icon.job-needed::after {content:"";position:absolute;inset:-6px;border:2px solid #ffd04d;pointer-events:none}
button.info-tip {display:inline-grid;place-items:center;vertical-align:middle;width:22px;height:22px;min-width:0;min-height:0;padding:0;border:1px solid currentColor;border-image:none;border-radius:50%;background:#463825;color:#ffe8b4;font:bold 15px/1 Georgia,serif;cursor:help}
button.info-tip[aria-pressed=true],button.info-tip:focus-visible {outline:2px solid #f6d17b;outline-offset:1px}
#hint {display:flex;align-items:center;justify-content:space-between;gap:6px}
#workshop-help h4 {margin:8px 0 3px}
#recipe-tip {position:fixed;inset:auto;margin:0;width:max-content;max-width:min(330px,calc(100vw - 12px));max-height:calc(100vh - 12px);overflow:auto;padding:8px 11px;background:#42321f;color:var(--cream);font:13px/1.35 "Segoe UI",sans-serif;border:9px solid transparent;border-image:var(--journal) 15 21 fill / 9px 12px stretch}
#recipe-tip strong {display:block;margin-bottom:4px;font:600 17px Georgia,serif}
.tip-blocker,.tip-material.lacking {color:#ffd2ab;font-weight:650}
.tip-bill,.tip-material {display:flex;align-items:center;gap:5px}
.tip-bill {flex-wrap:wrap;margin:5px 0}
.tip-material img {width:23px;height:23px;object-fit:contain}
.tip-quality {width:100%;margin-top:5px;border-collapse:collapse;font-variant-numeric:tabular-nums}
.tip-quality td {white-space:nowrap}
.tip-quality :is(th,td) {padding:2px 3px;text-align:right}
.tip-quality th:first-child {text-align:left}
.tip-quality tbody img,.market-material {width:23px;height:23px;object-fit:contain;vertical-align:middle;margin-right:4px}
.tip-quality thead {border-bottom:1px solid #957b55}
.tip-quality tbody th {font-weight:400}
.waiting-client {display:grid;margin:7px 0}
.fit-grades,.requirements {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
.fit-grades button {padding:2px 0;font-size:13px}
.fit-grades button[aria-pressed=true] {--skin:var(--gilt);color:var(--ink)}
.fit-grades small {display:block;font-variant-numeric:tabular-nums}
.requirements {gap:8px;margin:9px 0 15px;align-items:start}
.requirement {display:grid;gap:2px}
.requirement .item {width:100%;height:auto;min-height:132px}
.requirement .item img {height:43px}
.requirement .item strong,.requirement .item small {display:block}
.requirement .item strong {font-size:12px;line-height:1.15}
.requirement .item[aria-disabled=true] {filter:none}
.requirement .item[aria-disabled=true] img {filter:grayscale(1);opacity:.43}
.requirement>.soft {min-height:23px;font-size:12px;padding:0}

.recipe-icon .stored-count {position:absolute;right:-5px;bottom:-5px;padding:0 3px;border:3px solid transparent;border-image:var(--pine) 15 21 fill / 3px stretch;color:var(--cream);font:700 12px/1.1 "Segoe UI",sans-serif;pointer-events:none}

.craft-art {position:relative;display:grid;place-items:center;width:100%;pointer-events:none}
.craft-art img {margin:0}
#craft-progress {position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:38px;height:38px;border-radius:50%;background:conic-gradient(#ffe197 var(--progress,0%),#2b211dd9 0);mask:radial-gradient(closest-side,transparent 71%,black 75%);pointer-events:none}
.requirement.craft-blocked .item {outline:2px solid #d66855;outline-offset:-3px;box-shadow:inset 0 0 16px #a33b3388}
.requirement.craft-blocked .item strong {color:#ffb6a4}

#resource-stock {display:flex;align-items:center;gap:12px;margin:0;padding:0;list-style:none;font-variant-numeric:tabular-nums}
#resource-stock li {display:flex;align-items:center;gap:3px;white-space:nowrap}
#resource-stock img {width:29px;height:30px;object-fit:contain}
header .place {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
header button,header .purse {white-space:nowrap}
@media(max-width:1200px){
 header {gap:8px;padding-inline:8px}
 #resource-stock {gap:6px;font-size:13px}
 #resource-stock img {width:24px;height:26px}
}

.contract-stats {display:grid;grid-template-columns:repeat(4,1fr);align-items:end;gap:4px;margin:6px 0}
.contract-stat {display:grid;justify-items:center;gap:3px;cursor:help}
.contract-stat small {color:#e4d1af;font-size:12px}
.contract-stat b {display:flex;align-items:center;justify-content:center;gap:4px;height:29px;font-variant-numeric:tabular-nums}
.contract-stat img {width:27px;height:27px;object-fit:contain}
.contract-stat .gold-icon {font:normal 21px Georgia,serif}
.contract-quality {margin:3px 0 7px;font-size:14px;cursor:help}

.workshop-help-button {position:absolute;left:12px;top:16px;z-index:2;anchor-name:--workshop-help;width:52.5px;height:52.5px;font-size:22.5px;padding:0 3px}
#workshop-help {position:fixed;inset:auto;position-anchor:--workshop-help;top:anchor(bottom);left:anchor(left);margin:4px 0 0;width:min(374px,90vw);max-height:70vh;overflow:auto;padding:8px 12px;color:var(--cream);background:transparent;border:10px solid transparent;border-image:var(--journal) 15 21 fill / 9px 12px stretch}
#workshop-help h3 {margin:4px 0 7px}
#workshop-help ul {list-style:none;padding:0;margin:6px 0}
#workshop-help li {display:flex;align-items:baseline;gap:12px;padding:2px 0}
#workshop-help li b {margin-left:auto}
#workshop-help .skill-progress li {display:grid;grid-template-columns:6em max-content minmax(32px,1fr) max-content;gap:6px;align-items:center}
.skill-progress progress {appearance:none;width:100%;height:8px;overflow:hidden;border:1px solid #977b48;border-radius:4px}
.skill-progress progress::-webkit-progress-bar {background:#32281d}
.skill-progress progress::-webkit-progress-value {background:#dfb46b}
.skill-progress small {min-width:64px;text-align:right;font-variant-numeric:tabular-nums}
.trade-tabs {display:flex;flex-wrap:wrap;gap:3px;margin:6px 0 10px}
.trade-tabs button {flex:1 0 29%;padding:2px 3px;line-height:1.15}
.trade-tabs [aria-selected=true] {--skin:var(--gilt);color:var(--ink)}
#workshop-help .sub {margin:5px 0 9px}

aside {position:relative;display:grid;grid-template-columns:minmax(0,1fr) 48px;grid-template-rows:minmax(0,1fr) auto}
#sections {grid-column:2;grid-row:1/3;display:flex;flex-direction:column;align-self:start;align-items:stretch;gap:6px;padding:8px 0}
#sections button {position:relative;flex:none;width:46px;height:49px;display:grid;place-items:center;padding:0}
#sections img {height:32px;width:32px;object-fit:contain;pointer-events:none}
#panel {grid-column:1;grid-row:1;min-width:0}
aside footer {grid-column:1;grid-row:2}
#job-badge {position:absolute;top:-9px;right:-8px;min-width:17px;border-radius:12px;padding:1px 3px;color:#ffedc8;background:#913d27;box-shadow:0 0 0 1px #e4b46a;font:700 12px/16px sans-serif}


.bulk-buy {display:flex;align-items:center;gap:3px;white-space:nowrap;font-size:13px}
#buy-count {--skin:var(--leather);box-sizing:border-box;width:53px;min-height:28px;padding:0 1px;color:var(--cream);border-width:5px}
#resource-stock button {display:flex;align-items:center;gap:3px;min-height:30px;padding:0 2px;background:transparent;border:0;color:inherit;font:inherit;cursor:pointer}
#resource-stock button:hover {background:#edc76a24}
.recipe-icon {height:auto;min-height:68px;grid-template-rows:1fr auto}
.recipe-icon .stored-count {top:-5px;bottom:auto}
.shortfalls {display:flex;align-self:end;align-items:center;justify-content:center;flex-wrap:wrap;gap:1px 3px;color:#ffbfa2;font:700 12px/1.1 sans-serif}
.shortfalls span {display:inline-flex;align-items:center;gap:1px}
.recipe-icon .shortfalls img,.requirement .item .shortfalls img {width:15px;height:15px;opacity:1;filter:none;margin:0}
@media(max-width:1200px){#resource-stock {gap:3px}.bulk-buy {gap:1px}#buy-count {width:44px}}

.timber-order.deal {position:static}
#stock-order {display:block;width:100%;max-width:100%;text-align:left}

#archive-view {top:0;margin:auto;width:min(1440px,96vw);max-height:96vh;padding:9px 14px 14px}
#archive-view form {display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
#archive-view h2 {margin:0;color:var(--ink)}
#archive-view::backdrop {background:#171811bc}
#archive-view #field {height:min(75vh,850px);width:100%}
#archive-view :is(.tools,.workshop-help-button,#piece-tools,#toast) {display:none}
#archive-view #scene {cursor:grab}
#archive-view #scene:active {cursor:grabbing}
#zoom-value {align-self:center;background:#213b31e8;color:var(--cream);padding:3px 5px;text-align:center;min-width:5ch;font-size:12px;font-variant-numeric:tabular-nums}
.job-tabs {display:flex;gap:3px;margin:6px 0 12px}
.job-tabs button {flex:1;padding:2px;line-height:1.15}
.job-tabs [aria-pressed=true] {--skin:var(--gilt);color:var(--ink)}
.archive-list {display:grid;gap:6px}
.archive-row {width:100%;display:flex;align-items:center;gap:12px;text-align:left}
.archive-row img {width:82px;height:62px;object-fit:contain}
.archive-row span {display:grid;gap:3px}
.archive-row small {font-weight:400}



#game-settings {display:flex;align-items:center;gap:6px;margin-left:auto}
.phone-only {display:none}
@media (max-width:760px) and (orientation:portrait) {
 body {height:100vh;height:100dvh;display:flex;flex-direction:column;overflow:hidden}
 .phone-only:not([hidden]) {display:inline-flex;align-items:center;justify-content:center}
 header {position:relative;z-index:3;flex:none;display:grid;height:auto;grid-template-columns:minmax(0,1fr) auto auto auto;gap:0 4px;align-items:center;border-width:5px;padding:0 4px}
 header .brand {font-size:clamp(18px,5.5vw,25px)}
 header .place {display:none}
 header #zone {font-size:12px;min-height:44px;padding:0 2px}
 header .purse {grid-area:1/3;min-width:42px;text-align:center;padding:0 2px;border-width:6px}
 #settings-toggle {grid-area:1/4;min-height:44px;min-width:44px;font-size:19px}
 #game-settings {display:none;position:absolute;right:2px;top:44px;padding:6px;z-index:3;background:#403422;border:1px solid #aa8251;box-shadow:0 3px 8px #2b1f1880}
 #game-settings.expanded {display:flex}
 #game-settings button,#buy-count {min-height:44px}
 #resource-stock {grid-column:1/-1;width:100%;justify-content:space-between;overflow-x:auto;gap:3px}
 #resource-stock li {flex:1}
 #resource-stock button {justify-content:center;width:100%;min-height:38px;font-size:12px}
 #resource-stock img {width:clamp(17px,5vw,24px);height:23px}
 main {--compact-height:clamp(200px,33.333%,248px);--expanded-height:78.5%;--grip-height:26px;height:auto;flex:1;min-height:0;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) clamp(var(--compact-height),var(--drag-height,var(--panel-height,var(--compact-height))),var(--expanded-height))}
 #field {min-height:0}
 .viewtools {top:5px;right:5px;max-width:calc(100% - 60px);align-items:center;justify-content:flex-end;flex-wrap:wrap}
 .viewtools button {min-width:44px;min-height:44px}
 .viewtools:not(.expanded) :is(#turn,#cut,#dusk,#center) {display:none}
 .viewtools.expanded {display:grid;grid-template-columns:repeat(4,44px);justify-items:stretch;background:#334936;padding:2px}
 .workshop-help-button {top:5px;left:5px;width:44px;height:44px}
 #workshop-help {left:6px;top:145px;width:min(374px,calc(100vw - 12px));max-height:58dvh;margin:0}
 .tools {bottom:3px;width:max-content;max-width:calc(100% - 6px);overflow-x:auto;overscroll-behavior-x:contain;justify-content:flex-start;border-width:5px;padding:0 2px;scrollbar-width:thin}
 .tools button {flex:none;min-height:44px;min-width:44px;font-size:12px;border-width:5px}
 .tools span,.tools kbd {display:none}
 #piece-tools button {min-width:40px;height:40px}
 #toast {width:max-content;max-width:94%;bottom:56px;font-size:13px}
 aside {grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;border-width:6px}
 #sections {grid-area:1/1;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:2px;padding:2px 3px}
 #sections button {width:auto;height:45px;padding:0;border-width:3px;grid-template-rows:24px auto}
 #sections img {height:23px;width:23px}

 #job-badge {top:0;right:0}
 #panel {grid-area:2/1;padding:8px;overscroll-behavior-y:contain}
 #panel h2 {font-size:26px}
 aside footer {grid-area:3/1;margin:0 4px 2px;font-size:12px}
 dialog {max-width:calc(100% - 12px);max-height:90dvh;overflow:auto}
 #archive-view #field {height:72dvh}
}

#panel-size {display:none}
@media (max-width:760px) and (orientation:portrait) {
 main.panel-expanded {--panel-height:var(--expanded-height)}
 #panel-size {position:absolute;z-index:2;bottom:calc(100% + 6px);left:-6px;right:-6px;height:var(--grip-height);display:grid;place-items:end center;touch-action:none;user-select:none;cursor:ns-resize}
 #panel-size::before {content:"";grid-area:1/1;width:76px;height:18px;border-radius:10px 10px 0 0;background:#302818b3}
 #panel-size::after {content:"";grid-area:1/1;width:40px;height:4px;margin-bottom:7px;border-radius:4px;background:#ffe7b9cc}
 #panel-size:focus-visible {outline:2px solid #ffdc71;outline-offset:-2px}

 .trade-tabs {flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;margin:3px 0}
 .trade-tabs button {flex:1 0 auto;min-height:44px;font-size:13px;border-width:5px}
 #trade-recipes .line {margin:4px 0}
 .recipe-grid {margin:5px 0 10px}
}

#filters-dialog {inset:0;margin:auto;width:min(330px,90vw);height:fit-content;color:var(--ink)}
#filters-dialog h2 {color:var(--ink);font-size:24px}
#filters-dialog::backdrop {background:#171811aa}
#filter-fields,.material-filter:has(#filter-material) {display:grid;gap:4px}
#filter-fields {margin:12px 0}
#filter-fields select {appearance:auto;max-width:none;min-height:44px}
#filters-dialog button {--skin:var(--pine);min-height:44px;color:var(--cream)}
@media (max-width:760px) and (orientation:portrait) {
 header {grid-template-columns:36px minmax(0,1fr) auto 34px;border-width:3px;padding:0 2px;gap:2px}
 header .brand {display:none}
 header #zone {grid-area:1/1}
 header #resource-stock {grid-area:1/2;min-width:0;gap:1px;scrollbar-width:none}
 #resource-stock button {padding:0;min-height:44px;gap:1px;font-size:11px}
 #resource-stock img {width:clamp(15px,4.4vw,25px);height:22px}
 header .purse {min-width:0;padding:0;border-width:4px;font-size:12px}
 header #settings-toggle {min-width:0}
 #game-settings {top:44px}
 #workshop-help {top:98px}
 #sections button {grid-template-rows:1fr}
 #sections img {height:29px;width:29px}
 #panel>.material-filter,#panel>.trade-tabs {display:none}
 #panel h2:has(.filter-button) {display:flex;align-items:center;gap:6px;margin:0}
 #panel .filter-button {padding:0;margin-left:auto;position:relative;width:44px;height:44px;--skin:var(--pine);color:var(--cream)}
 .filter-button[data-active=true]::after {content:"";position:absolute;right:0;top:0;width:8px;height:8px;border-radius:50%;background:#ffcf65}
 .tools {display:flex;justify-content:space-evenly;width:min(380px,100%);max-width:100%;bottom:var(--grip-height);padding:0;gap:1px}
 #toast {bottom:calc(56px + var(--grip-height))}
 .tools button {flex:1;min-width:0;min-height:44px}
 .tools [hidden] {display:none}
 button[data-icon],header #zone,.tools button[data-icon],.viewtools button[data-icon] {font-size:0}
 button[data-icon]::before {content:"";display:inline-block;width:21px;height:21px;background:currentColor;mask:var(--glyph) center/contain no-repeat;vertical-align:middle}
 [data-icon="home"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M2%2011%2012%203l10%208%20M5%2010v11h5v-6h4v6h5V10%22/%3E%3C/svg%3E")}
 [data-icon="settings"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M9%204l1-2h4l1%202%203%202%202%200%202%204-2%202v2l2%202-2%204-3-1-3%202h-4l-2-2-3%201-2-4%202-2v-3L2%209l2-4%203%201z%20M15%2012a3%203%200%201%201-6%200%203%203%200%200%201%206%200%22/%3E%3C/svg%3E")}
 [data-icon="hammer"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22m3%2020%209-10%202%202-9%2010z%20M8%206l5-4%208%207-4%204-5-5-2%201z%22/%3E%3C/svg%3E")}
 [data-icon="turn"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M5%2010a7%207%200%200%201%2013-3l1%203%20M20%204v7h-7%20M7%2014l5-2%205%202-5%203z%20M7%2014v5l5%203%205-3v-5%22/%3E%3C/svg%3E")}
 [data-icon="flip"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M12%202v20%20M3%2018l6-11v11z%20M21%2018%2015%207v11z%22/%3E%3C/svg%3E")}
 [data-icon="trash"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M3%206h18%20M9%206V3h6v3%20M6%206l1%2015h10l1-15%20M10%2010v7m4-7v7%22/%3E%3C/svg%3E")}
 [data-icon="rotate"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M20%207a9%209%200%201%200%201%208%20M20%202v6h-6%22/%3E%3C/svg%3E")}
 [data-icon="move"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M12%202v20%20M8%206l4-4%204%204%20M8%2018l4%204%204-4%20M2%2012h20%20M6%208l-4%204%204%204%20M18%208l4%204-4%204%22/%3E%3C/svg%3E")}
 [data-icon="path"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M3%2019q13%202%208-5T17%203%20M7%2021q13%200%208-7t4-9%22/%3E%3C/svg%3E")}
 [data-icon="levels"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22m2%208%2010-5%2010%205-10%205z%20M3%2013l9%205%209-5%20M3%2017l9%205%209-5%22/%3E%3C/svg%3E")}
 [data-icon="camera"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M3%207h4l2-3h6l2%203h4v13H3z%20M16%2013a4%204%200%201%201-8%200%204%204%200%200%201%208%200%22/%3E%3C/svg%3E")}
 [data-icon="orbit"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M3%2013a9%205%200%201%200%208-5%20M3%206v7h7%22/%3E%3C/svg%3E")}
 [data-icon="cut"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22m2%2011%2010-8%2010%208%20M5%2010v11h14V10%20M5%2015h14%20M12%2011v9%22/%3E%3C/svg%3E")}
 [data-icon="moon"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M19%2016A9%209%200%200%201%208%204a9%209%200%201%200%2011%2012z%22/%3E%3C/svg%3E")}
 [data-icon="center"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M12%202v5m0%2010v5%20M2%2012h5m10%200h5%20M18%2012a6%206%200%201%201-12%200%206%206%200%200%201%2012%200%22/%3E%3C/svg%3E")}
 [data-icon="filter"] {--glyph:url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20stroke=%22black%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%3E%3Cpath%20d=%22M3%204h18l-7%208v7l-4%202v-9z%22/%3E%3C/svg%3E")}
}

@media (max-width:760px) and (orientation:portrait) {
 main:not(.panel-expanded) aside:has(#panel .tile-tray) #hint {display:none}
 #panel:has(.tile-tray) {padding:2px 6px;scrollbar-gutter:auto}
 .desktop-tray-title,#trade-recipes>.line {display:none}
 .mobile-tray-title {display:inline}
 #panel :is(.tray-heading,.satchel-heading h2) {font-size:16px;line-height:1.15}
 .satchel-heading {margin:0;gap:5px}
 .satchel-heading h2 span {display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .satchel-heading h2 small {display:block}
 #panel .satchel-heading .filter-button {margin-left:0}
 .satchel-heading [data-work^="sell"] {padding-inline:3px;min-height:36px}
 #panel .tile-tray {--tile:40px;display:grid;grid-auto-flow:column;grid-template-columns:none;grid-auto-columns:var(--tile);grid-template-rows:repeat(2,var(--tile));justify-content:start;align-content:start;gap:3px;margin:0;padding:2px;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;touch-action:pan-x;scrollbar-width:thin}
 #panel .tile-tray:empty {display:none}
 .tile-tray .item,.tile-tray .recipe-icon {box-sizing:border-box;width:100%;height:100%;min-height:0;border-width:4px;padding:1px;display:grid;grid-template-rows:1fr;place-items:center}
 .tile-tray .item img,.tile-tray .craft-art img {width:23px;height:23px;max-width:100%;object-fit:contain;margin:0}
 .tile-tray .shortfalls,.tile-tray .stack-label,.tile-tray .item small {display:none}
 .tile-tray .recipe-icon:has(.shortfalls)::before {content:"";position:absolute;bottom:1px;left:1px;width:5px;height:5px;background:#ffbfa2;border-radius:50%}
 .tile-tray .item em,.tile-tray .stored-count {position:absolute;top:-2px;right:-2px;bottom:auto;padding:0 2px;border-width:1px;font:700 9px/11px "Segoe UI",sans-serif}
 .tile-tray .grade-exceptional,.tile-tray .grade-worn {box-shadow:inset 0 -2px var(--grade-color)}
 .tile-tray .grade-exceptional {--grade-color:#ffdc71}
 .tile-tray .grade-worn {--grade-color:#bd8164}
 .tile-tray .recipe-icon.job-needed::after {inset:-2px}
}
