/* Resource artwork uses one atlas and the coordinates from resources.js. */
.resource-icon{display:inline-block;flex:0 0 auto;width:28px;height:28px;vertical-align:middle;background-image:url('/images/resource-atlas-v1.png');background-size:400% 200%;background-repeat:no-repeat;}
/* Produtos sem célula no atlas pintado usam um ícone vetorial no mesmo lugar. */
.resource-icon-vector{background-image:none}
.resource-icon-vector>svg{display:block;width:100%;height:100%;filter:drop-shadow(0 1px 1px #3b2f2433)}
#app .resource-icon::before,#app .resource-icon::after{content:none}
#app .panel .resource-icon{width:28px;height:28px}
#app .panel .item-art .resource-icon{width:38px;height:38px}
#gamePanelTitle{display:flex;align-items:center;gap:7px}
#gamePanelTitle .resource-icon{width:30px;height:30px}

/* Panels occupy a grid track above the HUD; only their own content scrolls. */
#app .interface{top:calc(var(--safe-top) + 8px)}
#app .interface #gamePanel{container:game-panel / inline-size;min-width:0;min-height:0;max-height:100%;width:100%;align-self:stretch;overflow:hidden}
#gamePanel .panel-body{min-height:0;overscroll-behavior:contain}
#gamePanel .panel-actions{max-height:44%;min-height:0;overscroll-behavior:contain}
#gamePanel :is(button,h3,strong,small,p,span,label,summary){word-break:normal;overflow-wrap:normal;hyphens:none}
#gamePanel button{touch-action:manipulation}
#gamePanel :is(button,summary):focus-visible{outline:3px solid #6f8c3e;outline-offset:2px}
@media(max-width:699px) and (min-height:500px){
  #app .interface #gamePanel{grid-area:3/1/4/-1;z-index:5}
}
#app.short-viewport .interface #gamePanel{grid-area:2/2/5/-1;align-self:stretch}

/* Whole category names, comfortable targets, and wrapping by panel width. */
#app #gamePanel[data-theme=market] .market-navigation{grid-template-columns:1fr;gap:10px;padding:9px}
#app #gamePanel[data-theme=market] .market-navigation section{grid-template-columns:1fr;gap:6px;min-width:0}
#app #gamePanel[data-theme=market] .market-navigation section>small{font-size:12px;line-height:1.2}
#app #gamePanel[data-theme=market] :is(.market-buy-tabs,.market-sell-tabs){grid-template-columns:repeat(auto-fit,minmax(min(100%,8rem),1fr))}
#app #gamePanel[data-theme=market] .market-tabs button{display:flex;flex-direction:column;gap:4px;min-height:64px;padding:6px;font-size:14px;line-height:1.2}
#app #gamePanel[data-theme=market] .market-tabs button .resource-label{font-size:14px;line-height:1.2;white-space:nowrap}
#app #gamePanel[data-theme=market] .market-tabs .resource-icon{width:28px;height:28px}
#app #gamePanel[data-theme=market] .market-product-head{grid-template-columns:48px minmax(0,1fr);gap:8px}
#app #gamePanel[data-theme=market] .market-product-head>span{grid-row:1/3;width:48px;height:48px;background:#f6ecd5;box-shadow:none}
#app #gamePanel[data-theme=market] .market-product-head .resource-icon{width:42px;height:42px}
#app #gamePanel[data-theme=market] .market-product-head h3{font-size:18px;line-height:1.25}
#app #gamePanel[data-theme=market] .market-product-head>div small{font-size:11px;line-height:1.3}
#app #gamePanel[data-theme=market] .market-product-head>b{grid-column:2;display:flex;align-items:baseline;justify-content:flex-start;gap:5px;font-size:16px;white-space:normal}
#app #gamePanel[data-theme=market] .market-product-head>b small{font-size:12px}
#app #gamePanel[data-theme=market] .market-stock-line{font-size:14px;line-height:1.35}
#app #gamePanel[data-theme=market] .market-facts{grid-template-columns:repeat(auto-fit,minmax(min(100%,6.5rem),1fr))}
#app #gamePanel[data-theme=market] .market-facts>div{grid-template-columns:1fr;justify-items:start;padding:8px;text-align:left;gap:3px}
#app #gamePanel[data-theme=market] .market-facts>div>span{grid-row:auto}
#app #gamePanel[data-theme=market] .market-facts small{font-size:12px;white-space:normal}
#app #gamePanel[data-theme=market] .market-facts strong{font-size:14px;line-height:1.3}
#app #gamePanel[data-theme=market] :is(.market-note,.summary-help summary,.market-total-card small){font-size:13px;line-height:1.35}
#app #gamePanel[data-theme=market] .market-total-card{grid-template-columns:minmax(0,1fr) auto}
#app #gamePanel[data-theme=market] .market-total-card span{font-size:11px}
#app #gamePanel[data-theme=market] .market-total-card small{grid-column:1/-1}
#app #gamePanel[data-theme=market] .market-total-card strong{grid-row:1}
@container game-panel (min-width:420px){
  #app #gamePanel[data-theme=market] .market-tabs button{flex-direction:row;min-height:48px;gap:7px}
  #app #gamePanel[data-theme=market] .market-product-head{grid-template-columns:48px minmax(0,1fr) auto}
  #app #gamePanel[data-theme=market] .market-product-head>span{grid-row:auto}
  #app #gamePanel[data-theme=market] .market-product-head>b{grid-column:3;flex-direction:column;gap:1px}
}

/* Summary first. The real 25-space interior is a detail, never a second system. */
#gamePanel .storage-heading{margin-top:0}
#gamePanel .storage-categories{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;margin:8px 0 14px}
#gamePanel .storage-categories button{min-width:0;gap:4px;padding:8px 4px;font-size:14px;line-height:1.25;box-shadow:none;background:#f5ead2;color:#58452c}
#gamePanel .storage-categories button[aria-pressed=true]{background:#e4edcf;border-color:#79944d;color:#385325;box-shadow:inset 0 -3px #79944d}
#gamePanel .storage-categories button strong{font-size:14px;white-space:nowrap}
#gamePanel .storage-categories button small{font-size:12px}
#gamePanel .storage-categories button>span:last-child{font-size:13px;line-height:1.3}
#gamePanel .field-nav{align-items:center;display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:6px}
#gamePanel .field-nav button{min-height:44px;min-width:0;padding:6px;font-size:14px;white-space:nowrap}
#gamePanel .field-nav>span{font-size:13px}
.warehouse-summary{overflow:hidden;border:1px solid #dbc69d;border-radius:14px;background:#fffdf6}
.warehouse-summary>header{display:grid;gap:4px;padding:12px 13px;border-bottom:1px solid #e9ddc4;background:#f4eddc}
.warehouse-summary>header small{font-size:11px;font-weight:800;letter-spacing:.07em;color:#826c46}
.warehouse-summary>header strong{font-size:16px;line-height:1.3;color:#4d5f32}
.stored-products{margin:0;padding:0 12px;list-style:none}
.stored-products li{display:grid;grid-template-columns:38px minmax(0,1fr) auto;align-items:center;gap:8px;padding:12px 0;border-bottom:1px solid #eee3cf}
#gamePanel .stored-products .resource-icon{width:38px;height:38px}
.stored-products li>div{display:grid;gap:4px}
.stored-products li strong{font-size:14px;line-height:1.35;color:#4e3e2a}
.stored-products li span:not(.resource-icon){font-size:14px;color:#79664b}
.stored-products li>small{font-size:12px;color:#6c743e;white-space:nowrap;background:#eff2e2;border-radius:7px;padding:5px}
.stored-products .is-highlighted{background:#edf3df;box-shadow:0 0 0 6px #edf3df;border-radius:4px}
.warehouse-capacity{display:grid;grid-template-columns:1fr auto;gap:7px;padding:12px 13px;font-size:13px;color:#756144}
.warehouse-capacity progress{grid-column:1/-1;width:100%;height:8px;accent-color:#79964e}
.warehouse-capacity .spaces-free{grid-column:1/-1;color:#4e6934;font-size:14px;font-weight:750}
#gamePanel .interior-toggle{display:flex;align-items:center;justify-content:space-between;min-height:44px;width:calc(100% - 24px);margin:0 12px 12px;padding:9px 12px;border:1px solid #9eaf79;border-radius:10px;background:#e9efd9;color:#45602e;font-size:14px}
.warehouse-interior{margin-top:12px;padding:10px;border:1px solid #d6c29b;border-radius:14px;background:#f5ecd8}
.warehouse-interior>header{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:4px;margin-bottom:8px}
.warehouse-interior>header strong{font-size:14px}
.warehouse-interior>header small{font-size:12px;color:#80704f}
#gamePanel .warehouse-slots{grid-template-columns:repeat(5,minmax(0,1fr));gap:4px;padding:6px;background:#e0d3b5;border-radius:10px;max-width:340px;margin-inline:auto}
#gamePanel .warehouse-slots button{display:grid;place-items:center;min-width:0;min-height:48px;height:52px;padding:10px 2px 2px;border-radius:7px;box-shadow:none}
#gamePanel .warehouse-slots button.is-free{background:#f4eddc;border-color:#d1c6ac;border-style:dashed}
#gamePanel .warehouse-slots button[aria-pressed=true]{outline:2px solid #698a3e;outline-offset:-2px;background:#edf3d8}
#gamePanel .warehouse-slots small{top:3px;left:4px;font-size:10px;line-height:1}
#gamePanel .warehouse-slots .resource-icon{width:32px;height:32px}
#gamePanel .warehouse-slots .empty-space{color:#b9ad91;font-size:22px}
#gamePanel #storageSlotInfo{display:grid;gap:7px;min-height:60px;margin-top:8px;padding:10px;border:1px solid #d7c8a6;border-radius:10px;background:#fffaf0}
.space-detail>small{font-size:12px;text-transform:uppercase;font-weight:800;letter-spacing:.04em;color:#847044}
.space-detail>div{display:flex;align-items:center;gap:9px}
.space-detail>div>span:last-child{display:grid;gap:3px;font-size:14px}
.space-detail>strong{font-size:14px;color:#607b42}
#gamePanel .storage-empty{display:block;color:#857252;font-size:14px;line-height:1.4}
#gamePanel .storage-card{display:grid;grid-template-columns:minmax(0,1fr);gap:9px;padding:16px;border:1px solid #d6c197;border-radius:14px;background:#fffdf6}
#gamePanel .storage-card>*{min-width:0;max-width:100%}
#gamePanel .storage-card p{margin:0;line-height:1.5;overflow-wrap:normal;word-break:normal}
#gamePanel .storage-card b{font-size:16px;line-height:1.4}
#gamePanel .storage-card>.resource-icon{width:48px;height:48px}
#gamePanel .storage-card progress{width:100%;height:10px;accent-color:#79964e}
#gamePanel .storage-receiving{font-size:13px;color:#856d42}
#gamePanel .animal-metric .resource-icon{width:25px;height:25px}
#gamePanel .animal-actions .resource-icon{width:23px;height:23px;margin-right:3px}
#gamePanel .field-status .resource-icon{width:22px;height:22px}

/* Compact four-category HUD; never add an item per resource variant. */
#app .bottom-info .stock-summary-item strong::before{content:none}
#app .bottom-info .stock-summary-item .resource-icon{width:28px;height:28px;min-width:28px}
#app .bottom-info .stock-summary-item strong{font-size:14px;line-height:1.2;white-space:normal;word-break:normal;overflow-wrap:normal}
#app .bottom-info .stock-summary-item small{font-size:12px;line-height:1.2}
#app .bottom-info .stock-summary-item{min-height:52px}
#app .bottom-info footer.tip-box{min-height:28px;padding-block:4px}
#app .bottom-info .tip-box #status{font-size:13px;line-height:1.3}
#app .bottom-info .tip-box.is-collapsed{min-height:24px;padding-block:3px}
@media(max-width:699px) and (min-height:500px){
  #app .bottom-primary{grid-template-columns:1fr;grid-template-rows:32px auto}
  #app .hud-clock{justify-content:center;border-right:0;border-bottom:1px solid #d8bd8d}
  #app .bottom-info .stock-summary-item{display:flex;flex-direction:column;gap:3px;min-height:78px;padding:5px 2px}
  #app .bottom-info .stock-summary-item>span:last-child{text-align:center;gap:2px}
  #app .bottom-info .stock-summary-item .resource-icon{width:25px;height:25px;min-width:25px}
}
#app.short-viewport .interface .bottom-info{grid-area:5/1/6/-1}
#app.short-viewport .bottom-primary{grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto}
#app.short-viewport .hud-clock{min-width:0;padding:4px 8px;border-right:1px solid #d8bd8d;border-bottom:0}
#app.short-viewport .hud-clock strong{font-size:14px}
#app.short-viewport .bottom-info .stock-summary-item{min-height:48px;padding:3px 5px}
#app.short-viewport .bottom-info .stock-summary-item .resource-icon{width:24px;height:24px;min-width:24px}

/* Keep the quantity and maximum shortcut together, including narrow panels. */
#app #gamePanel .quantity-control{min-width:0;gap:6px}
#app #gamePanel .quantity-label{display:flex;flex-wrap:wrap;align-items:baseline;gap:3px 8px;min-width:0;line-height:1.3}
#app #gamePanel .quantity-label small{color:#79664b;font-size:12px;font-weight:600}
#app #gamePanel .quantity-label strong{color:#513f29;font-size:14px;font-weight:700}
#app #gamePanel .quantity-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;width:100%;max-width:18rem;margin:0}
#app #gamePanel .quantity-stepper{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;gap:0;min-width:0;max-width:none;margin:0;padding:0;border:1px solid #d7bd8c;border-radius:10px;background:#fffdf7}
#app #gamePanel .quantity-stepper button{min-width:44px;min-height:44px;padding:0;border:0;border-radius:9px;background:#f2d58c;color:#553c17;box-shadow:none;font-size:24px;line-height:1}
#app #gamePanel .quantity-stepper input{min-width:0;height:44px;margin:0;padding:4px 0!important;border:0!important;border-radius:0;background:transparent!important;color:#3c3020;font-size:16px;font-weight:800;font-variant-numeric:tabular-nums;text-align:center}
#app #gamePanel .quantity-presets{display:flex;align-items:center;gap:0;margin:0}
#app #gamePanel .quantity-presets button{min-width:0;min-height:44px;margin:0;padding:8px 10px;border:1px solid #caa96d;border-radius:10px;background:#fbefd5;color:#654915;box-shadow:none;text-shadow:none;font-size:14px;line-height:1.3;white-space:nowrap}
#app #gamePanel .quantity-control button:disabled{background:#e9e2d5;color:#958a78;border-color:#d4cbbb}
@container game-panel (max-width:290px){
  #app #gamePanel .quantity-row{grid-template-columns:minmax(0,1fr);gap:5px}
  #app #gamePanel .quantity-presets button{width:100%}
}
/* Attention shortcuts retain readable light surfaces. */
#app #gamePanel .animal-overview button{background:#fff0c7;color:#654915;border:1px solid #c8a658;box-shadow:none;min-height:44px;padding:10px;font-size:14px;line-height:1.4}
/* Audio library stays inside the existing settings panel. */
.audio-library{display:grid;gap:10px;padding:12px;color:#54432d}.audio-library label{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.audio-library select{background:#fff7e5;color:#54432d;border:1px solid #bdab87;border-radius:8px;padding:10px;font:inherit}.audio-library button{background:#f1e2bf;color:#554123;border:1px solid #bd9e66;border-radius:9px;min-height:44px;padding:8px 12px;font:inherit}.track-choice{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;padding:9px 0;border-bottom:1px solid #ddccb0}.track-choice label{flex:1;min-width:145px}.track-choice input{width:20px;height:20px;accent-color:#628442}.audio-library details>summary{padding:12px 0;cursor:pointer}.audio-credits{font-size:12px;line-height:1.5}.audio-credits a{color:#48602e}
#app .interface #audioPanel{overflow-y:auto;overscroll-behavior:contain}
#app .interface #audioPanel>*{flex-shrink:0}
#app .interface #audioPanel>.panel-head{position:sticky;top:0;z-index:2}
#startAudio .track-choice label,#app .track-choice label{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;gap:8px;line-height:1.4}
#startAudio .track-choice input,#app .track-choice input{width:20px;height:20px;min-width:20px;padding:0;flex:0 0 20px}

/* Keep individual field actions readable at every viewport width. */
#gamePanel .individual-field-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
#gamePanel .individual-field-actions>button{min-width:0;white-space:normal;word-break:normal;overflow-wrap:normal;line-height:1.3}
#gamePanel .individual-field-actions>button:disabled{background:#ebe4d3!important;color:#665c49!important;border-color:#c9bda2!important;opacity:1;box-shadow:none}
#gamePanel .field-action-help{color:#55452e;line-height:1.4}
