.market-setup{display:flex!important;gap:12px;align-items:center;margin:14px 0;padding:14px;border:1px solid #a8864f;border-radius:10px;background:#142534;color:#f6e8c9}.market-setup input{width:20px;height:20px}.market-dialog{color:inherit;max-width:1100px;margin:auto}.market-grid{display:grid;grid-template-columns:repeat(auto-fit,252px);gap:20px;justify-content:center}.market-card-slot{position:relative;width:252px;height:352px;padding:0!important;border:0!important;background:transparent!important;color:inherit;overflow:hidden;flex:none}.market-card-slot>.sw-market-card{transform:scale(.6666667);transform-origin:top left}.market-detail{display:flex;gap:24px;align-items:flex-start}.market-detail>div:last-child{flex:1;min-width:0}.market-options{display:grid;gap:10px;max-height:52vh;overflow:auto}.market-options button{display:block;text-align:left;min-height:48px}.market-options small{display:block;margin-top:6px}.market-options .mk-icon{width:22px;height:22px;vertical-align:middle}.market-dialog .mk-icon{width:22px;height:22px;vertical-align:middle}.market-card-slot .mk-icon{width:25px;height:25px}.market-options button:disabled{opacity:.55}.market-dialog button:focus-visible{outline:3px solid #63d8df;outline-offset:3px}@media(max-width:650px){.market-detail{flex-direction:column;align-items:center}.market-detail>div:last-child{width:100%}.market-options{max-height:40vh}}
.market-detail>.market-card-slot{width:378px;height:528px}.market-detail>.market-card-slot>.sw-market-card{transform:none}@media(max-width:650px){.market-detail>.market-card-slot{width:252px;height:352px}.market-detail>.market-card-slot>.sw-market-card{transform:scale(.6666667)}}
.market-players{display:flex;flex-wrap:wrap;gap:8px;margin-top:20px}
/* Market-only surfaces. Existing board geometry and other dialogs stay owned by their views. */
.market-dialog{background:transparent!important}.market-heading{display:flex;justify-content:space-between;align-items:baseline;gap:18px;padding:0 42px 0 0!important;background:transparent!important;border:0!important;box-shadow:none!important;min-height:0!important}.market-heading h2{margin:0!important;font-size:clamp(22px,2.3vw,30px)!important}.market-heading>span{font-size:13px;white-space:nowrap}.market-filters{display:flex;gap:7px;flex-wrap:wrap;margin:14px 0 10px;padding:0!important;background:transparent!important;border:0!important;box-shadow:none!important}.market-filters button{min-height:38px;padding:7px 12px;margin:0;border-left:3px solid var(--market-owner,#b99559)!important;white-space:nowrap;font-size:14px}.market-filters button[aria-pressed=true]{background:#c8ad79!important;color:#17202c!important}.market-gallery-caption{margin:8px 0 12px!important;font-size:14px}.market-gallery{display:flex;justify-content:center;align-items:flex-start;gap:12px;min-width:0}.market-gallery-item{display:flex;flex-direction:column;gap:8px;min-width:0}.market-gallery .market-card-slot>.sw-market-card{transform:scale(var(--market-scale,.6666667))}.market-owner-label{font-size:12px;line-height:1.4;border-left:3px solid var(--market-owner);padding-left:6px;max-width:250px}.market-pagination{display:flex;justify-content:center;align-items:center;gap:10px;margin-top:14px;background:transparent!important}.market-pagination>button{min-width:40px;min-height:36px;margin:0;font-size:20px}.market-pagination>[data-market-board-toggle]{font-size:13px;margin-left:12px}.market-company{background:transparent!important;color:inherit!important;border-top:1px solid #a88c6359;padding-top:12px;margin-top:16px}.market-company h3{display:flex;flex-wrap:wrap;gap:8px;align-items:baseline}.market-company h3 small{font-size:12px;font-weight:normal}.market-owned-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:8px;margin-bottom:12px}.market-owned-link{display:flex!important;gap:10px;align-items:center;text-align:left;padding:8px!important;border-left:3px solid var(--market-owner)!important;min-width:0;white-space:normal!important}.market-owned-link>img{width:52px;height:66px;object-fit:cover;border-radius:5px;flex:none}.market-owned-link>span{display:grid;gap:5px;min-width:0}.market-owned-link b{font-size:14px}.market-owned-link small{font-size:12px;line-height:1.3}
html[data-ui-runtime=web] body.faithful-target dialog#modal:has(.market-overview){width:min(1400px,calc(100vw - 28px))!important;max-width:calc(100vw - 28px)!important;max-height:calc(100dvh - 24px)!important;margin:auto!important;padding:18px 20px!important;--astrolabe-edge:28px}
html[data-ui-runtime=web] body.faithful-target dialog#modal:has(.market-overview) #modalbody{padding:0!important;max-height:none!important;overflow:visible!important}
html[data-ui-runtime=web] body.faithful-target dialog#modal:has(.market-dialog)>.close{width:36px!important;height:36px!important;min-width:36px!important;min-height:36px!important;top:10px!important;right:12px!important;border:0!important;background:transparent!important;box-shadow:none!important;border-radius:50%!important;padding:0!important;display:grid!important;place-items:center!important;line-height:1!important;font:26px/1 Arial,sans-serif!important;transform:none!important;color:inherit!important}
html[data-ui-runtime=web] body.faithful-target dialog#modal:has(.market-dialog)>.close:focus{outline:none!important}html[data-ui-runtime=web] body.faithful-target dialog#modal:has(.market-dialog)>.close:focus-visible{outline:2px solid #caac72!important;outline-offset:2px!important}
#market-board-tray {
 position:fixed;z-index:60;background:transparent!important;border:0!important;padding:0;
 box-shadow:none!important;pointer-events:none
}
#market-board-tray .market-board-heading {
 display:grid;grid-template-columns:36px auto 36px;justify-content:center;align-items:center;column-gap:8px;
 height:48px;color:#fff1cf;text-shadow:0 2px 5px #000
}
#market-board-tray .market-board-heading button {pointer-events:auto;color:#fff1cf;background:#111c29!important}
#market-board-tray [data-market-board-overview] {
 grid-column:2;padding:5px 14px;border:1px solid #bc9c61;border-radius:999px;font-weight:700
}
#market-board-tray [data-market-board-close] {
 grid-column:3;display:grid;place-items:center;width:36px;height:36px;padding:0;
 border:1px solid #bc9c61;border-radius:50%;font:24px/1 Arial,sans-serif
}
#market-board-tray .market-board-heading button:hover {background:#25394b!important;border-color:#ffe1a2}
#market-board-tray .market-board-cards{display:flex;justify-content:center;gap:12px;background:transparent!important}#market-board-tray .market-card-slot{width:var(--market-board-width);height:var(--market-board-height);pointer-events:auto;filter:drop-shadow(0 5px 8px #0008)}#market-board-tray .market-card-slot>.sw-market-card{transform:scale(var(--market-board-scale))}#market-board-toggle[aria-expanded=true]{outline:2px solid #c8ad79;outline-offset:2px}
@media(max-width:650px){.market-heading{align-items:start;flex-direction:column;gap:5px}.market-heading h2{font-size:23px!important}.market-filters{gap:5px;margin-top:10px}.market-filters button{font-size:12px;padding:5px 8px;min-height:34px}.market-gallery-caption{font-size:12px}.market-pagination{gap:6px;margin-top:10px}.market-pagination>[data-market-board-toggle]{display:none}.market-owned-list{grid-template-columns:1fr}.market-heading>span{font-size:12px}.market-owner-label{font-size:11px}html[data-ui-runtime=web] body.faithful-target dialog#modal:has(.market-overview){padding:12px!important;--astrolabe-edge:18px}.market-pagination>button{min-height:34px}}
.market-filter-mobile{display:none}.market-heading{position:static!important;height:auto!important;width:auto!important;flex:none!important;margin:0!important}.market-filter-mobile select{min-height:40px}
@media(max-width:650px),(max-height:520px){.market-filters{display:none!important}.market-filter-mobile{display:flex;align-items:center;gap:10px;margin:10px 0}.market-filter-mobile select{flex:1;min-width:0;width:auto}}
.market-overview{max-width:none}
@media(max-width:950px){.market-pagination>[data-market-board-toggle]{display:none}}
@media(max-height:520px) and (min-width:651px){
 .market-overview{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}.market-overview .market-heading{grid-column:1;grid-row:1;padding-right:0!important}.market-overview .market-heading>span,.market-overview .market-gallery-caption{display:none}.market-overview .market-filter-mobile{grid-column:2;grid-row:1;margin:0;max-width:300px}.market-overview .market-gallery,.market-overview .market-pagination{grid-column:1/-1}.market-overview .market-pagination{margin-top:0}.market-overview .market-heading h2{font-size:22px!important}html[data-ui-runtime=web] body.faithful-target dialog#modal:has(.market-overview){--astrolabe-edge:12px;padding:8px 12px!important}
}
/* Card spotlight: physical card and separate controls, without an outer frame. */
html[data-ui-runtime=web] body.faithful-target dialog#modal[open]:has(.market-detail){--market-zoom-width:min(430px,calc((100dvh - 76px)*.7159),calc(100vw - 64px));width:min(990px,calc(100vw - 24px))!important;max-width:calc(100vw - 24px)!important;max-height:calc(100dvh - 24px)!important;padding:12px!important;border:0!important;border-image:none!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;filter:none!important;color:#f6ebd6!important;--ink:#f6ebd6;--soft-ink:#c7bda9;--surface:#111c29}
html[data-ui-runtime=web] body.faithful-target dialog#modal[open]:has(.market-detail) #modalbody{padding:0!important;background:transparent!important;max-height:none!important}
.market-dialog:has(.market-detail)>h2{display:none}.market-detail{justify-content:center;gap:22px}.market-detail>.market-card-slot{width:var(--market-zoom-width)!important;height:calc(var(--market-zoom-width)*1.3968254)!important;overflow:visible;filter:drop-shadow(0 16px 22px #0009);animation:market-card-zoom .25s cubic-bezier(.2,.75,.2,1) both}.market-detail>.market-card-slot>.sw-market-card{transform:scale(var(--market-zoom-scale,1))!important;transform-origin:top left}.market-detail>div:last-child{background:#111c29!important;color:#f6ebd6!important;border:1px solid #a2bcc03b;border-radius:14px;padding:18px;max-height:calc(100dvh - 50px);overflow:auto;min-width:0}.market-detail>div:last-child>p:first-child{padding-right:42px}.market-detail .market-options{max-height:44vh}.market-detail details{margin:12px 0}.market-detail button{color:#f6ebd6!important;background:#192b3c!important}.market-detail .market-card-slot :is(button,select){color:inherit}
@keyframes market-card-zoom{from{opacity:0;transform:translateY(14px) scale(.91)}to{opacity:1;transform:translateY(0) scale(1)}}
@media(max-width:650px){.market-detail{gap:12px}.market-detail>div:last-child{width:100%;max-height:none;padding:14px}.market-detail .market-options{max-height:35vh}}
@media(prefers-reduced-motion:reduce){.market-detail>.market-card-slot{animation:none}}

.market-payment{display:inline-flex;align-items:center;flex-wrap:wrap;gap:8px}.market-payment .mk-amount{gap:5px}.market-action-count{display:block;margin-top:8px;font-size:12px;line-height:1.45;font-weight:normal;color:inherit}.market-detail .market-action-count{margin-bottom:6px}

#market-board-toggle .workshop-icon>img{display:block;width:30px;height:30px;object-fit:contain}

/* The card stays frameless; its separate action panel keeps the approved D1 frame. */
.market-detail>div:last-child{border:24px solid transparent!important;border-image:url(visuals/cosmic/astrolabe-d1.webp) 180 stretch!important;border-image-width:24px!important;border-radius:0!important;background:linear-gradient(135deg,#202b38,#151d2b)!important;background-clip:border-box!important;padding:16px!important}
.market-detail>div:last-child>p:first-child{margin:0 52px 16px 0!important;min-height:44px;display:flex;align-items:center;padding-right:0!important}
html[data-ui-runtime=web] body.faithful-target dialog#modal[open]:has(.market-detail)>.close{top:var(--market-close-top,40px)!important;left:var(--market-close-left,auto)!important;right:auto!important;z-index:25}
@media(max-width:650px){
 html[data-ui-runtime=web] body.faithful-target dialog#modal[open]:has(.market-detail){display:flex!important;flex-direction:column;gap:8px}
 html[data-ui-runtime=web] body.faithful-target dialog#modal[open]:has(.market-detail)>.close{position:sticky!important;align-self:flex-end;top:0!important;left:auto!important;right:auto!important;flex:none!important;background:#111c29!important}
 .market-detail>div:last-child{border-width:18px!important;border-image-width:18px!important;padding:14px!important}
 .market-detail>div:last-child>p:first-child{margin-right:0!important;min-height:0}
}
/* Reserve hover/focus paint space inside the scroll area; keep button alignment unchanged. */
.market-options{padding:8px;margin:-8px}

.priority-order-panel{padding-right:12px}
.priority-order-panel h2{padding-right:38px}
@media(max-width:950px){
 html[data-ui-runtime=web] body dialog#modal[open]:has(.priority-order-panel){
  position:fixed!important;inset:auto 0 0!important;margin:0!important;
  width:100%!important;max-width:100%!important;max-height:85dvh!important;
  border-radius:18px 18px 0 0!important;overflow:auto!important;
  padding-bottom:max(16px,env(safe-area-inset-bottom))!important
 }
}

/* Keep the filter outline inside the button, including when hovered in the scrollable dialog. */
#modal .market-filters button{
 border:1px solid #7790a0!important;transform:none!important;overflow:visible;
}
#modal .market-filters button:is(:hover,:focus-visible){
 box-shadow:inset 0 0 0 1px #e0bc7c!important;outline-offset:-3px
}
#modal .market-filters button[aria-pressed=true]{border-color:#e3c795!important}

.player-card-strip{
 position:fixed;bottom:12px;z-index:32;display:flex;flex-wrap:wrap;align-content:flex-end;align-items:flex-end;gap:7px;
 overflow:auto;padding:4px 4px 6px;scrollbar-width:thin
}
#market-owned-strip{left:20px}
#research-owned-strip{right:20px;direction:rtl}
.player-card-strip button{
 direction:ltr;
 position:relative;display:block;flex:0 0 auto;width:var(--strip-w,clamp(43px,4vw,68px));aspect-ratio:5/7;
 padding:0!important;margin:0;overflow:hidden;border:1px solid #bc9c61;border-radius:7px;
 background:#142534;color:#fff0cb;box-shadow:0 2px 8px #000a
}
.player-card-strip button:hover{border-color:#ffe1a2;transform:none}
.player-card-strip button:focus-visible{outline:2px solid #80d7dd;outline-offset:1px}
.player-card-strip img{width:100%;height:100%;object-fit:cover;display:block}
.player-card-strip button>span{position:absolute;inset:auto 0 0;background:#101d29e8;padding:2px;font:700 10px/1.25 system-ui}
@media(max-width:950px){.player-card-strip{display:none}}

body.phone-refined #phone-faithful .footer:has([data-mobile-panel="market"]){grid-template-columns:repeat(5,minmax(0,1fr))}
.mobile-market-icon{position:relative;display:inline-grid;place-items:center;width:19px;height:19px}
.mobile-market-icon img{width:100%;height:100%;object-fit:contain}
.mobile-market-icon b{position:absolute;top:-3px;left:100%;min-width:14px;padding:1px 3px;border:1px solid #b99559;border-radius:9px;background:#142534;color:#fff1cf;font:700 9px/1.1 system-ui,sans-serif;text-align:center}
.phone-refined .mini[data-refined-orientation="landscape"] .mobile-market-icon{width:auto;height:15px;grid-template-columns:15px auto;gap:2px}
.phone-refined .mini[data-refined-orientation="landscape"] .mobile-market-icon b{position:static;grid-area:1/2}
.market-company .market-company-mobile-link{display:none}
.phone-refined .market-company .market-company-mobile-link{display:inline-block}
.phone-refined .market-company .market-company-desktop-link{display:none}
.market-mobile-overview{max-width:560px}
.market-mobile-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin:12px 0}
.market-mobile-tabs button{min-height:44px;min-width:0;padding:5px 2px;margin:0;font-size:clamp(11px,3.4vw,15px);overflow-wrap:anywhere}
.market-mobile-tabs button[aria-pressed="true"]{background:#c8ad79!important;color:#142534!important;border-color:#ead29e!important}
.market-mobile-tabs small{font-size:.82em}
.market-mobile-player{display:flex;align-items:center;gap:8px;margin-bottom:12px}
.market-mobile-player select{flex:1;min-width:0;min-height:44px}
.market-mobile-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.market-mobile-grid .market-card-slot{width:100%;height:auto;aspect-ratio:378/528}
.market-mobile-grid .market-card-slot>.sw-market-card{transform:scale(var(--market-scale,1));transform-origin:top left;pointer-events:none}
@media (orientation:landscape) and (max-height:500px){
 .market-mobile-grid{max-width:clamp(230px,calc((100dvh - 200px)*1.4318 + 8px),430px);margin-inline:auto}
}

/* Keep the board cards readable. The tray scrolls if the full row cannot fit. */
#market-board-tray .market-board-cards {
 justify-content: safe center;
 overflow-x: auto;
 padding-block: 3px 8px;
 scrollbar-width: thin;
 pointer-events: auto;
}
#market-board-tray .market-card-slot {
 flex: 0 0 var(--market-board-width);
}

/* Available cards can be browsed directly from the enlarged view. */
.market-detail > .market-card-slot:has(.market-card-nav) {
 position: relative;
 margin-bottom: 54px;
}
#modal .market-card-nav {
 position: absolute;
 inset: calc(100% + 8px) 0 auto;
 display: grid;
 grid-template-columns: 44px 1fr 44px;
 align-items: center;
 gap: 8px;
}
#modal .market-card-nav button {
 display: grid;
 place-items: center;
 width: 44px;
 height: 44px;
 min-height: 44px;
 margin: 0;
 padding: 0 0 3px;
 border: 1px solid #bda16c !important;
 border-radius: 50%;
 background: #152836 !important;
 color: #f4ddb1 !important;
 font: 32px/1 Georgia, serif;
}
#modal .market-card-nav button:is(:hover, :focus-visible) {
 background: #304655 !important;
 border-color: #ffdda0 !important;
}
.market-card-position {
 color: #f4ddb1;
 font: 600 13px/1.2 system-ui, sans-serif;
 font-variant-numeric: tabular-nums;
 text-align: center;
 text-shadow: 0 1px 4px #000;
}
@media (min-width: 1150px) and (min-height: 560px) {
 .market-detail > .market-card-slot:has(.market-card-nav) {
  margin-inline: 52px;
  margin-bottom: 24px;
 }
 #modal .market-card-nav {
  inset: 0 -52px;
  pointer-events: none;
 }
 #modal .market-card-nav button { pointer-events: auto; }
 .market-card-position {
  position: absolute;
  inset: calc(100% + 8px) 52px auto;
 }
 #modal .market-card-nav button:last-child { grid-column: 3; }
}

@media (max-width: 650px) {
 html[data-ui-runtime=web] body.faithful-target dialog#modal[open]:has(.market-detail) {
  overflow-y: auto!important;
 }
 html[data-ui-runtime=web] body.faithful-target dialog#modal[open]:has(.market-detail) #modalbody {
  flex: none;
  overflow: visible!important;
 }
 .market-detail .market-options {
  max-height: none;
  overflow: visible;
 }
}
@media (orientation: landscape) and (max-height: 500px) {
 html[data-ui-runtime=web] body.faithful-target dialog#modal[open]:has(.market-card-nav) {
  --market-zoom-width: min(430px, calc((100dvh - 104px) * .7159), calc(100vw - 64px));
 }
}

/* The two-word name wraps within the existing desktop and phone controls. */
#desktop-workshop #market-board-toggle > span:last-child,
#phone-faithful .market-nav-label {
 min-width: 0;
 white-space: normal;
 line-height: 1;
 overflow-wrap: anywhere;
}
#desktop-workshop #market-board-toggle {
 height: auto;
}

/* Grouped card actions: one heading per thing you can do, its variants listed beneath. */
.market-option-group{margin:12px 0;padding:10px 12px;border:1px solid #a2bcc03b;border-radius:12px;background:#0d1621}
.market-option-group>h3{margin:0 0 4px;font-size:16px;font-weight:600;color:#f6ebd6}
.market-option-help{display:block;margin:2px 0 6px;font-size:13px;line-height:1.4;font-weight:normal;opacity:.85}
.market-option-group>.market-option-help{margin-bottom:6px}
.market-option-choices{display:grid;gap:8px;margin-top:8px}
.market-options button .market-option-help{margin-top:4px}
.market-type{margin:0 0 6px!important;font-size:13px;opacity:.85;letter-spacing:.02em}.market-limits{margin:6px 0 2px!important;font-size:13px;opacity:.85}

/* Horizontal touch gestures navigate cards while vertical scrolling and pinch zoom remain available. */
.market-detail .market-card-slot,.market-gallery{touch-action:pan-y pinch-zoom}
