/* Companion counters and formation use the game panel and button materials. */
#expeditionDesk[data-view] {
  width:min(540px,calc(100vw - 16px)); max-height:min(87dvh,720px);
  color:var(--sb-ink); border:1px solid #cdbb8b; border-radius:16px;
  background:var(--sb-grain),linear-gradient(160deg,var(--sb-paper),#f4efdf);
  box-shadow:inset 0 1px 0 white,var(--sb-shadow);
}
#expeditionDesk[data-view]::backdrop {background:#203a307a;backdrop-filter:blur(3px);}
#expeditionDesk[data-view] > header {
  position:sticky;top:0;z-index:2;min-height:43px;box-sizing:border-box;padding:6px 14px;
  border-bottom:1px solid var(--sb-line);background:linear-gradient(110deg,#f8f2df,#edf1e2);
}
#expeditionDesk[data-view] h2 {font:800 18px var(--sb-serif);color:var(--sb-forest);letter-spacing:.08em;}
#expeditionDesk[data-view] button {padding:4px 10px;min-height:28px;font-size:12px;line-height:1.35;border-radius:8px;}
#expeditionDesk[data-view] .desk-close {width:29px;height:29px;padding:0;border-radius:50%!important;font:20px/1 system-ui;}
#expeditionDesk[data-view] :is(button,summary):focus-visible,
.shelf-slots input:focus-visible + span {outline:2px solid #9d732e;outline-offset:2px;}
#expeditionDesk[data-view] button:disabled {
  opacity:1;cursor:default;background:linear-gradient(#eeede1,#dfdfce)!important;color:#5b6555!important;
  border-color:#bdc1a9!important;box-shadow:0 1px 0 #b5b9a0,inset 0 1px 0 #fffdf2!important;text-shadow:none;
}
#expeditionDesk[data-view="shop"] .desk-body {padding:10px 14px 14px;}
.shop-counter,.shop-approach,.shelf-book-title,.shelf-slots {display:flex;align-items:center;gap:8px;}
.shop-counter {border-bottom:1px solid var(--sb-line);padding-bottom:8px;}
.shop-counter img {width:54px;height:54px;object-fit:contain;flex:none;}
.shop-counter > div {min-width:0;overflow-wrap:anywhere;}
.shop-counter strong,.shelf-book strong {font:800 16px var(--sb-serif);color:var(--sb-forest-lo);}
.shop-counter small {display:block;color:var(--sb-ink-soft);font-size:11px;}
.shop-counter .companion-money {display:inline-flex;align-items:center;gap:3px;margin-left:auto;white-space:nowrap;font-size:13px;}
.shop-approach {justify-content:space-between;padding:8px 0 0;color:var(--sb-forest);font-size:12px;}
.shop-approach button {flex:none;}
.shelf-tools {min-width:0;margin:11px 0;padding:0;border:0;}
.shelf-tools legend,.skill-library summary {color:var(--sb-forest);font:700 14px var(--sb-serif);}
.shelf-tools legend small,.skill-library summary small {font:600 11px system-ui;color:var(--sb-ink-soft);}
.shelf-slots {flex-wrap:wrap;gap:6px;margin-top:5px;}
.shelf-slots label {position:relative;min-width:0;max-width:100%;margin:0;cursor:pointer;}
.shelf-slots input,.sr-only {position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}
.slot-key {display:inline-flex;align-items:center;gap:5px;padding:4px 8px;min-height:25px;box-sizing:border-box;font-size:12px;overflow-wrap:anywhere;}
.slot-key b {font:700 10px/1.2 system-ui;opacity:.8;}
.shop-books {border:1px solid #d1c29c;border-radius:12px;overflow:hidden;background:linear-gradient(115deg,#fffcf2,#f5eedb);box-shadow:0 2px 0 #dfd2af;}
.shelf-book {display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px;padding:9px 12px;}
.shelf-book + .shelf-book {border-top:1px solid var(--sb-line-soft);box-shadow:inset 0 1px 0 #fffdf5;}
.skill-cover {
  position:relative;display:grid;place-items:center;width:30px;height:36px;box-sizing:border-box;
  color:#fff4ca;border:1px solid color-mix(in srgb,var(--grade) 80%,#302618);
  border-radius:3px 5px 5px 3px;background:linear-gradient(90deg,#0002 0 9%,#fff4 10% 14%,transparent 15%),
    linear-gradient(135deg,color-mix(in srgb,var(--grade) 79%,#fff2bd),var(--grade));
  box-shadow:inset 0 1px 0 #fff5,inset 0 -2px 0 #e6dcbf,0 2px 2px #3c361e35;
}
.skill-cover .ui-icon {width:16px;height:16px;margin-left:2px;}
.shelf-book-title {flex-wrap:wrap;gap:3px 6px;}
.shelf-book-title strong {font-size:15px;}
.shelf-book-title small {color:var(--grade);font:700 10px/1.4 system-ui;border-radius:99px;padding:0 5px;
  background:color-mix(in srgb,var(--grade) 7%,#fffdf2);border:1px solid color-mix(in srgb,var(--grade) 35%,#f1e9ce);}
#expeditionDesk .shelf-copy p {margin:3px 0 0;color:var(--sb-ink-soft);font-size:var(--ui-caption);line-height:1.55;overflow-wrap:anywhere;}
.skill-meta {font-size:10px;color:#526650;}
.shelf-action {display:grid;gap:3px;justify-items:center;min-width:54px;}
.shelf-price {display:inline-flex;align-items:center;gap:2px;color:#80570e;font:700 12px system-ui;font-variant-numeric:tabular-nums;}
.shelf-price .ui-icon {width:13px;height:13px;}
.shelf-action button {min-width:54px;}
.skill-library {margin-top:11px;}
.skill-library summary {width:fit-content;cursor:pointer;padding:4px 0;}
.skill-library[open] summary {margin-bottom:6px;}
.shop-receipt {margin:0 0 8px;color:var(--sb-forest);font-weight:650;}
.shop-receipt:empty {display:none;}
.upgrade-cost {display:inline-flex;align-items:center;gap:3px;vertical-align:baseline;white-space:nowrap;}
.duel-statuses:not(:empty) {display:flex;flex-wrap:wrap;gap:2px 5px;color:#e6d6a9;font:10px/1.25 sans-serif;}
.placement-wallet {display:flex;gap:8px;align-items:center;color:var(--sb-ink-soft);font-size:12px;}
.placement-wallet[hidden],.placement-policy[hidden] {display:none!important;}
.placement-wallet select {max-width:65%;}
#adminPanel .editor-workspace {padding:12px;border:1px solid var(--sb-line);border-radius:12px;background:var(--sb-paper);}
#adminPanel .editor-heading {padding:0 0 10px;border-bottom:1px solid var(--sb-line);color:var(--sb-forest);}
#adminPanel .editor-heading h3,#adminPanel .editor-sidebar h4 {font-family:var(--sb-serif);color:var(--sb-forest);}
#adminPanel .editor-tools {padding:8px 10px;border-radius:8px;background:#eef0e1;border:1px solid #d8ddc8;}
#adminPanel .editor-sidebar {background:#fcf9ed;border-color:var(--sb-line);border-radius:9px;}
#adminPanel .editor-canvas-wrap {padding:6px;background:#e6e7d4;border:1px solid #c7c6aa;border-radius:10px;}
#adminPanel .editor-palette button {background:#fffaf0;border:1px solid var(--sb-line-soft);border-radius:7px;font-size:12px;min-height:38px;box-shadow:none;}
#adminPanel .editor-palette .active,#adminPanel .editor-world-objects .active {background:#e6eddc!important;border-color:var(--sb-forest)!important;color:var(--sb-forest);}
.editor-palette .monster-asset {width:30px;height:30px;flex:0 0 30px;}
.editor-object-art .monster-asset {width:100%;height:100%;}
.placement-policy {grid-column:1/-1;padding:9px;background:#f5efde;border:1px solid var(--sb-line);border-radius:8px;}
.policy-fields {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin:6px 0;font-size:11px;}
#adminPanel .policy-fields input {width:100%;box-sizing:border-box;min-width:0;}
html body .cmd-menu.target-action-menu.storefront-command .cmd-menu-head {
  background:linear-gradient(110deg,#f7f1df,#edf2e4)!important;border-bottom:1px solid var(--sb-line)!important;
}
html body .cmd-menu.target-action-menu.storefront-command .cmd-menu-head :is(b,button,.command-seal,.ui-icon) {
  color:var(--sb-forest)!important;
}
.service-price {font:600 11px/1.45 system-ui;color:#76561c;}
.command-btn .service-price {display:inline-flex;align-items:center;gap:2px;white-space:nowrap;}
.storefront-command .target-action-row:has(.service-price) {background:#fffaf0;}
#adminPanel #savePlacementPolicy {
  background:var(--sb-forest);color:#fff8e2;border:1px solid #496c4b;
  border-radius:6px;padding:5px 10px;font:600 12px/1.3 system-ui;cursor:pointer;
}
#adminPanel .editor-palette .place-tile-preview {flex:0 0 27px;width:27px;height:27px;}
#adminPanel .editor-object-art .place-tile-preview {width:100%;height:100%;}

.bestiary-lore {font-size:12px;color:var(--sb-ink-soft);margin:3px 0;}
.cmd-menu.target-action-menu.storefront-command {width:min(306px,calc(100vw - 16px));max-height:calc(100dvh - 16px);}
.storefront-command .target-detail-body {min-width:0;overflow-wrap:anywhere;}
.storefront-command .map-detail-art {width:56px;height:56px;}
.cmd-menu.storefront-command .target-action-label {overflow:visible;text-overflow:clip;white-space:normal;}
.storefront-command .target-action-label .service-price {white-space:normal;line-height:1.4;}
.storefront-command .service-price .ui-icon {flex:none;}
.cmd-menu.storefront-command .target-action-row {column-gap:5px!important;padding:6px 0!important;}
.storefront-command .utility-action .target-action-mode {grid-column:2 / -1;justify-self:end;}
html body .cmd-menu.storefront-command .target-action-mode,
html body .bld-detail :is(.bld-actions button,.bld-upgrade-btn,.bld-alert-btn),
#objActionPopup[data-type="building"] .obj-btn {
  width:auto;min-width:0;min-height:26px;height:auto;padding:3px 7px!important;
  font:650 12px/1.35 var(--sb-sans,system-ui);letter-spacing:0;border-radius:7px!important;
}
.bld-detail .building-detail-title {display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin:0;}
.building-detail-title .map-art-sprite {width:42px;height:42px;}
#objActionTitle .map-art-sprite {width:24px;height:24px;}
.bld-detail .bld-row {flex-wrap:wrap;}
.bld-detail .bld-row > span {min-width:0;overflow-wrap:anywhere;}
.bld-detail .bld-upgrade-btn {margin-inline-start:auto;}
.map-art-sprite.place-tile-preview {image-rendering:auto;}
@media(pointer:coarse) {
  html body .cmd-menu.storefront-command .target-action-mode {min-height:30px;}
}
@media(max-width:280px) {
  .cmd-menu.storefront-command .target-action-row {grid-template-columns:repeat(2,max-content);justify-content:space-between;}
  .storefront-command .target-action-label {grid-column:1/-1;}
}
@media(max-width:510px) {
  #expeditionDesk[data-view="shop"] .desk-body {padding:8px 11px;}
  .shelf-book {column-gap:8px;padding:9px;}
  .shop-counter img {width:49px;height:49px;}
  #adminPanel .editor-workspace {padding:6px;}
}

/* Art-first placement cards; keep full descriptions readable at narrow widths. */
#placeGrid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap:8px; }
#placeGrid .place-card { min-width:0; gap:3px; padding:8px 7px 10px; }
#placeGrid .place-card-icon { width:88px; height:88px; flex:0 0 88px; font-size:40px; }
#placeGrid .place-card-icon :is(.asset-sprite-wrap, .pixel-sprite, .place-tile-preview, .map-art-sprite) { width:100%; height:100%; }
#placeGrid .place-card-name { font-size:11px!important; line-height:1.35; }
#placeGrid :is(.place-card-size, .place-card-ap, .place-card-loc) { font-size:9px!important; line-height:1.4; }
#placeGrid .place-card-effect { font-size:9.5px!important; line-height:1.5; overflow-wrap:anywhere; }
#placeGrid .place-card.selected { outline:2px solid var(--sb-gold, #b58b36); outline-offset:-2px; }

/* Embedded dismiss controls belong to the surrounding chip/menu, not a second pill. */
html body :is(.log-filter-clear, .cmd-menu-close, .near-death-alert-close) {
  background:transparent!important; border:0!important; box-shadow:none!important;
  border-radius:0!important; min-height:24px; width:24px; height:24px;
  padding:0!important; flex:0 0 24px; color:var(--muted);
}
html body :is(.log-filter-clear, .cmd-menu-close, .near-death-alert-close):hover { color:var(--sb-forest, #305e43); }
html body :is(.log-filter-clear, .cmd-menu-close, .near-death-alert-close):focus-visible { outline:2px solid var(--sb-forest, #305e43); outline-offset:1px; }

/* Capture settlement uses the same controls as shops and building services. */
html body .capture-panel {top:52px;left:12px;width:min(330px,calc(100% - 24px));max-height:calc(100% - 64px);padding:14px;border:1px solid var(--sb-line,#d8cba4);border-radius:14px;background:linear-gradient(140deg,#fffaeb,#f0f2e2);color:#2e4438;box-shadow:0 8px 24px #263c2926;font-size:12px;box-sizing:border-box;}
.capture-panel header {align-items:flex-start;padding-bottom:10px;border-bottom:1px solid #d7d8bf;gap:12px;}
.capture-panel header>div {min-width:0;display:grid;gap:3px;}
.capture-panel header strong {font-family:var(--sb-serif);font-size:15px;overflow-wrap:anywhere;}
.capture-panel .capture-eyebrow {font-size:10px;color:#74826a;letter-spacing:.12em;}
.capture-panel time {font-size:10px;white-space:nowrap;color:#74826a;padding-top:3px;}
.capture-panel label {display:grid;grid-template-columns:64px minmax(0,1fr);font-size:11px;gap:8px;margin:10px 0;color:#667b69;}
html body .capture-panel select {width:100%;max-width:100%;min-width:0;min-height:32px;padding:5px 24px 5px 9px;font-size:12px;color:#2e4438;border:1px solid #d4c59e;border-radius:9px;background-color:#fffbed;box-shadow:inset 0 1px 0 #fff,0 2px 0 #d8cba4;}
.capture-summary {display:flex;justify-content:space-between;gap:8px;padding:9px 0;font-size:11px;border-bottom:1px solid #dedfc9;}
.capture-summary b {color:#8c661b;}
.capture-panel .capture-balance {font-size:10px;color:#73816c;margin:6px 0;}
.capture-panel .capture-choices {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:12px;}
html body .capture-choices button {min-width:0;min-height:34px;padding:6px 8px;font-size:12px;line-height:1.4;font-weight:700;border:1px solid #d6c399;border-radius:9px;color:#294536;background:linear-gradient(#fffdf4,#f3edd8);box-shadow:inset 0 1px 0 #fff,0 3px 0 #d5c79e;cursor:pointer;}
html body .capture-choices button.primary {color:#fffbee;border-color:#315b3e;background:linear-gradient(#51875d,#244936);box-shadow:inset 0 1px 0 #b1d1a780,0 3px 0 #1e382a;}
html body .capture-choices button.danger-btn {color:#9e4d40;}
html body .capture-choices button:hover:not(:disabled) {filter:brightness(1.04);}
html body .capture-choices button:active:not(:disabled) {transform:translateY(2px);box-shadow:inset 0 1px 2px #38492d22;}
html body .capture-choices button:disabled {opacity:.48;cursor:default;}
.capture-panel .capture-notice {display:block;margin-top:10px;font-size:10px;color:#8b7051;line-height:1.5;}
.capture-panel .capture-notice:empty {display:none;}
