/* Fitting floor. Every selector is rooted at the station panel: no game/editor leakage.
   Loaded after legacy index styles; explicit component rules supersede their layout. */
@font-face { font-family: ShipyardAlbert; src: url('assets/fonts/AlbertSans-Regular.woff2') format('woff2'); font-display: swap; }
#shipyard-panel {
  --yard-bg:#142b2e; --yard-shell:#234145; --yard-line:#46605a;
  --yard-text:#e9e6d5; --yard-muted:#a3b7af; --yard-gold:#e8bd66; --yard-pink:#ee77a7;
  box-sizing:border-box; inset:0; padding:0; border:0;
  border-radius:0; color:var(--yard-text);
  background:var(--yard-bg); font:14px ShipyardAlbert,sans-serif;
  box-shadow:0 20px 70px #0009; overflow:hidden;
}
#shipyard-panel *, #shipyard-panel *::before, #shipyard-panel *::after { box-sizing:border-box; }
#shipyard-panel [hidden] { display:none!important; }
#shipyard-panel button {
  font:inherit; color:var(--yard-text); border:1px solid var(--yard-line);
  border-radius:14px 4px 14px 4px; background:#223e41; padding:10px 14px;
  min-height:42px; cursor:pointer; touch-action:manipulation; box-shadow:none;
}
#shipyard-panel button:hover:not(:disabled) { border-color:var(--yard-gold); color:var(--yard-gold); }
#shipyard-panel button:disabled { opacity:.45; cursor:default; }
#shipyard-panel button:focus-visible, #shipyard-panel input:focus-visible { outline:2px solid var(--yard-pink); outline-offset:2px; }
#shipyard-panel .shipyard-header { display:flex; align-items:center; gap:18px; padding:20px 26px; background:linear-gradient(120deg,#2d4c4f,#192f32); border-bottom:1px solid var(--yard-line); }
#shipyard-panel .shipyard-header h2 { font-size:24px; font-weight:400; text-shadow:none; margin:0; min-width:0; overflow-wrap:anywhere; }
#shipyard-panel #shipyard-credits { margin-left:auto; color:var(--yard-gold); white-space:nowrap; font-size:24px; }
#shipyard-panel #station-interior-btn { font-size:12px; }
#shipyard-panel #shipyard-fullscreen-btn { flex:0 0 44px; width:44px; height:44px; padding:0; font-size:24px; line-height:1; background:none; }
#shipyard-panel #shipyard-close-btn { width:auto; min-width:98px; min-height:44px; font:12px ShipyardAlbert,sans-serif; padding:12px 16px; border:1px solid var(--yard-line); border-radius:5px 16px 5px 16px; color:var(--yard-text); background:none; flex-shrink:0; }
#shipyard-panel #shipyard-tabs-host { flex:0 0 auto; min-width:0; }
#shipyard-panel #shipyard-scroll { padding:0; overflow:auto; min-height:0; scrollbar-color:#70877b #142b2e; overscroll-behavior:contain; }
#shipyard-panel #shipyard-content { height:auto; min-height:100%; }
#shipyard-panel .shipyard-tabs { display:flex; flex-wrap:nowrap; overflow-x:auto; gap:0; padding:0; margin:0; border:0; border-bottom:1px solid var(--yard-line); border-radius:0; background:#102629; scrollbar-width:thin; }
#shipyard-panel .shipyard-tabs button { position:static; top:auto; border:0; border-bottom:3px solid transparent; border-right:1px solid #3a514b; border-radius:0; padding:16px 20px; min-height:52px; background:none; color:var(--yard-muted); box-shadow:none; white-space:nowrap; font-weight:400; }
#shipyard-panel .shipyard-tabs button.selected { border-bottom-color:var(--yard-gold); color:var(--yard-gold); background:#2b4140; box-shadow:none; }
#shipyard-panel h3 { font-size:24px; font-weight:400; margin:0 0 16px; }
#shipyard-panel h4 { font-size:17px; font-weight:400; }
#shipyard-panel p { line-height:1.5; color:var(--yard-muted); }
#shipyard-panel .shipyard-weapons { display:grid; grid-template-columns:260px minmax(260px,1fr) 310px; gap:0; min-height:640px; align-items:stretch; }
#shipyard-panel .shipyard-parts-counter { padding:24px 20px; min-width:0; background:linear-gradient(90deg,#234044,#1c3437); border-right:1px solid var(--yard-line); }
#shipyard-panel .shipyard-catalog-tabs { display:grid; grid-template-columns:1fr 1fr; gap:5px; margin:0 0 18px; padding:4px; border:1px solid var(--yard-line); border-radius:14px 4px; background:#102629; }
#shipyard-panel .shipyard-catalog-tabs button { min-height:36px; padding:7px 9px; border:0; border-radius:10px 3px; background:none; color:var(--yard-muted); font-size:11px; }
#shipyard-panel .shipyard-catalog-tabs button.selected { background:#35484a; color:var(--yard-gold); box-shadow:inset 0 -2px var(--yard-gold); }
#shipyard-panel .shipyard-port-capability { font:11px monospace; text-transform:uppercase; color:var(--yard-gold); padding:0 0 12px; border-bottom:1px solid var(--yard-line); overflow-wrap:anywhere; }
#shipyard-panel .shipyard-weapon-grid { display:flex; flex-direction:column; gap:10px; max-height:calc(100dvh - 310px); min-height:140px; overflow:auto; padding:2px 5px 6px 2px; touch-action:pan-y; scrollbar-color:#70877b #142b2e; }
#shipyard-panel .shipyard-weapon-grid button { display:grid; grid-template-columns:64px minmax(0,1fr); align-items:center; gap:12px; min-height:98px; flex-shrink:0; padding:10px; border-radius:19px 5px 19px 5px; background:linear-gradient(135deg,#2b484b,#1a3034); box-shadow:inset 0 0 0 3px #152b2e; text-align:left; font-size:13px; }
#shipyard-panel .shipyard-weapon-grid button img { width:64px; height:70px; object-fit:contain; filter:drop-shadow(0 5px 4px #0006); }
#shipyard-panel .shipyard-weapon-grid button.selected, #shipyard-panel .shipyard-ship-list button.selected { border-color:var(--yard-pink); color:var(--yard-text); background:#3c3540; box-shadow:inset 0 0 0 2px #ee77a71b; }
#shipyard-panel .shipyard-fitting-bay { padding:24px; min-width:0; background:radial-gradient(ellipse at center,#35524d55,transparent 65%),repeating-linear-gradient(0deg,transparent 0 69px,#79938608 70px),#12282b; }
#shipyard-panel .shipyard-fitting-bay h3 { font-size:27px; }
#shipyard-panel .shipyard-weapons .shipyard-preview { width:100%; max-width:100%; height:clamp(280px,48dvh,600px); min-height:280px; max-height:none; aspect-ratio:auto; background:none; border:0; border-radius:0; overflow:hidden; }
#shipyard-panel .shipyard-preview canvas { display:block; max-width:100%; }
#shipyard-panel .shipyard-fitting-bay .shipyard-preview {
  background: url('assets/shipyard-bay.svg') center / contain no-repeat;
}
#shipyard-panel .shipyard-fitting-bay .shipyard-ship-list { display:flex; flex-direction:row; flex-wrap:wrap; gap:7px; max-height:150px; overflow:auto; padding:10px 0; }
#shipyard-panel .shipyard-fitting-bay .shipyard-ship-list { height:auto; min-height:0; }
#shipyard-panel .shipyard-fitting-bay .shipyard-ship-list button { font-size:11px; padding:8px 10px; min-height:38px; }
#shipyard-panel .shipyard-weapon-detail { display:flex; flex-direction:column; gap:12px; padding:24px; border-left:1px solid var(--yard-line); min-width:0; overflow:visible; background:linear-gradient(140deg,#1e383b,#182c2f); }
@media(min-width:601px) {
  #shipyard-panel #shipyard-scroll[data-shipyard-tab="weapons"] { overflow:hidden; }
  #shipyard-panel #shipyard-scroll[data-shipyard-tab="weapons"] #shipyard-content,
  #shipyard-panel #shipyard-scroll[data-shipyard-tab="weapons"] .shipyard-weapons { height:100%; min-height:0; }
  #shipyard-panel #shipyard-scroll[data-shipyard-tab="weapons"] .shipyard-weapon-detail { min-height:0; max-height:100%; overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; scrollbar-color:#70877b #142b2e; }
}
#shipyard-panel .shipyard-equipment-art { display:block; width:100%; height:190px; padding:22px; object-fit:contain; border:1px solid #56685c; border-radius:34px 7px 34px 7px; background:radial-gradient(ellipse,#4e5e4c55,#10282a); box-shadow:inset 0 0 0 5px #152e31; }
#shipyard-panel .shipyard-equipment-owned { font:10px monospace; margin:0; color:var(--yard-muted); }
#shipyard-panel .shipyard-weapon-stats { padding:0; border:0; border-radius:0; background:none; color:var(--yard-text); font-size:13px; line-height:1.5; }
#shipyard-panel .shipyard-weapon-stats > strong { display:block; font-size:25px; font-weight:400; margin:0 0 15px; }
#shipyard-panel .shipyard-weapon-stats > div > div { display:flex; gap:12px; justify-content:space-between; border-bottom:1px solid var(--yard-line); padding:9px 0; font-size:12px; }
#shipyard-panel .shipyard-weapon-stats > div > div > span { color:var(--yard-muted); }
#shipyard-panel .shipyard-weapon-stats > div > div > strong { font-weight:400; text-align:right; overflow-wrap:anywhere; }
#shipyard-panel .shipyard-weapon-requirement { margin:12px 0 0; padding:12px 0; border:0; border-top:1px solid var(--yard-line); background:none; color:var(--yard-gold); font-size:12px; }
#shipyard-panel .shipyard-weapon-requirement.missing { color:#f3a5a5; background:none; }
#shipyard-panel button.shipyard-primary { background:linear-gradient(#e8c882,#cfaa5c); color:#213536; border-color:#f3d694; min-height:48px; box-shadow:inset 0 0 0 3px #947d462b,0 3px 0 #102326; font-weight:600; }
#shipyard-panel button.shipyard-primary:hover:not(:disabled) { color:#102326; background:#f2d38c; }
#shipyard-panel .shipyard-open-modifiers { background:none; border-color:var(--yard-line); font-size:12px; }
/* First-pass styling for existing station workflows. Their state/actions are unchanged. */
#shipyard-panel :is(.shipyard-storage,.shipyard-market,.shipyard-missions,.shipyard-hangar,.shipyard-buffs,.shipyard-debug,.shipyard-rank,.shipyard-shop,.shipyard-weapon-modifier-workspace) { margin:0; padding:24px; max-width:none; width:100%; }
#shipyard-panel .shipyard-shop { height:calc(100dvh - 190px); min-height:420px; grid-template-columns:240px minmax(0,1fr); gap:24px; }
#shipyard-panel .shipyard-ship-list { scrollbar-color:#70877b #142b2e; }
#shipyard-panel .shipyard-ship-list button { background:#233f42; }
#shipyard-panel :is(.shipyard-hangar-card,.shipyard-market-row,.shipyard-modifier-card,.shipyard-buff-card,.shipyard-rank,.shipyard-weapon-modifier-workspace) { background:#1e383b; border:1px solid var(--yard-line); border-radius:20px 5px 20px 5px; box-shadow:none; }
#shipyard-panel :is(.shipyard-hangar-card.selected,.shipyard-modifier-slot.selected) { border-color:var(--yard-pink); background:#353540; box-shadow:none; }
#shipyard-panel :is(.shipyard-preview,.shipyard-materials,.shipyard-stats) { background:radial-gradient(ellipse,#304b4855,#142b2e); border-color:var(--yard-line); border-radius:20px 5px 20px 5px; }
#shipyard-panel :is(.shipyard-storage-row,.shipyard-modifier-slot,.shipyard-modifier-installed) { border-color:var(--yard-line); }
#shipyard-panel .shipyard-storage-actions { flex-wrap:wrap; }
#shipyard-panel .shipyard-market-row { gap:14px; padding:14px; }
#shipyard-panel .shipyard-market-actions { flex-wrap:wrap; }
#shipyard-panel .shipyard-market-actions button { background:#233f42; border-color:var(--yard-line); color:var(--yard-text); border-radius:12px 4px; }
#shipyard-panel .shipyard-market-search, #shipyard-panel input, #shipyard-panel select { background:#10272a; color:var(--yard-text); border:1px solid var(--yard-line); border-radius:12px 4px; padding:10px; font:inherit; max-width:100%; }
#shipyard-panel .shipyard-stats::before, #shipyard-panel .shipyard-stats strong { color:var(--yard-text); }
#shipyard-panel .shipyard-stats > div { border-color:var(--yard-line); }
#shipyard-panel .shipyard-stats > div > span { color:var(--yard-muted); }
#shipyard-panel .shipyard-rank-icon { color:var(--yard-gold); text-shadow:none; }
#shipyard-panel .shipyard-rank-bar { border-color:var(--yard-line); background:#10272a; }
#shipyard-panel .shipyard-rank-bar > div { background:var(--yard-gold); }
@media(max-width:1100px) {
  #shipyard-panel .shipyard-weapons { grid-template-columns:220px minmax(230px,1fr) 270px; }
  #shipyard-panel .shipyard-weapon-detail, #shipyard-panel .shipyard-fitting-bay { padding:18px; }
}
@media(max-width:850px) {
  #shipyard-panel { inset:0; border-radius:0; }
  #shipyard-panel .shipyard-header { padding:14px 16px; gap:12px; flex-wrap:wrap; }
  #shipyard-panel .shipyard-header h2 { font-size:20px; }
  #shipyard-panel #shipyard-credits { font-size:20px; }
  #shipyard-panel .shipyard-tabs button { padding:12px 16px; }
  #shipyard-panel .shipyard-weapons { grid-template-columns:minmax(0,1fr) 280px; }
  #shipyard-panel .shipyard-fitting-bay { grid-column:1; grid-row:1; }
  #shipyard-panel .shipyard-weapon-detail { grid-column:2; grid-row:1 / 3; }
  #shipyard-panel .shipyard-parts-counter { grid-column:1; grid-row:2; border-top:1px solid var(--yard-line); }
  #shipyard-panel .shipyard-shop { grid-template-columns:180px minmax(0,1fr); padding:16px; }
  #shipyard-panel .shipyard-ship-detail { grid-template-columns:minmax(0,1fr); }
}
@media(max-width:600px) {
  #shipyard-panel .shipyard-weapons { display:flex; flex-direction:column; }
  #shipyard-panel .shipyard-fitting-bay { order:0; }
  #shipyard-panel .shipyard-parts-counter { order:1; padding:20px 16px; border-right:0; }
  #shipyard-panel .shipyard-weapon-detail { order:2; border-left:0; border-top:1px solid var(--yard-line); }
  #shipyard-panel .shipyard-weapon-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); max-height:360px; }
  #shipyard-panel .shipyard-weapon-grid button { display:flex; flex-direction:column; text-align:center; font-size:12px; }
  #shipyard-panel .shipyard-equipment-art { height:170px; }
  #shipyard-panel .shipyard-weapons .shipyard-preview { height:330px; }
  #shipyard-panel .shipyard-shop { height:calc(100dvh - 200px); grid-template-columns:110px minmax(0,1fr); gap:12px; padding:12px; }
  #shipyard-panel .shipyard-shop .shipyard-preview { min-height:180px; }
  #shipyard-panel .shipyard-ship-list button { padding:8px; font-size:12px; overflow-wrap:anywhere; }
  #shipyard-panel .shipyard-stats { grid-template-columns:1fr; }
  #shipyard-panel .shipyard-market-row { grid-template-columns:32px minmax(0,1fr); }
  #shipyard-panel .shipyard-market-actions { grid-column:1/-1; }
  #shipyard-panel .shipyard-storage-row { flex-wrap:wrap; }
  #shipyard-panel .shipyard-storage-actions { width:100%; }
  #shipyard-panel .shipyard-modifier-layout, #shipyard-panel .shipyard-buffs { grid-template-columns:minmax(0,1fr); }
  #shipyard-panel .shipyard-weapon-modifier-workspace > header { flex-wrap:wrap; }
}
/* Tile-based catalogues and inventories. */
#shipyard-panel .shipyard-weapon-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-content:start; }
#shipyard-panel .shipyard-weapon-grid button { display:flex; flex-direction:column; justify-content:center; gap:8px; text-align:center; min-height:140px; }
#shipyard-panel .shipyard-weapon-grid button img { width:76px; height:76px; max-width:100%; }
#shipyard-panel .shipyard-weapon-grid button span { overflow:visible; overflow-wrap:anywhere; }
#shipyard-panel .shipyard-weapon-grid button small { color:var(--yard-gold); font:10px monospace; }
#shipyard-panel .shipyard-hangar-grid { grid-template-columns:repeat(auto-fill,minmax(min(260px,100%),1fr)); align-items:start; }
#shipyard-panel .shipyard-hangar-card { aspect-ratio:1; display:flex; flex-direction:column; min-width:0; }
#shipyard-panel .shipyard-hangar-preview { min-height:0; height:0; flex:1 1 0; border-radius:0; }
#shipyard-panel .shipyard-hangar-details { flex:0 0 auto; padding:12px; gap:5px; }
#shipyard-panel .shipyard-hangar-details button { min-height:36px; padding:7px; }
#shipyard-panel .shipyard-shop { grid-template-columns:minmax(270px,.8fr) minmax(0,1.4fr); }
#shipyard-panel .shipyard-catalogue-tiles { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); grid-auto-rows:minmax(200px,max-content); align-content:start; height:100%; min-height:0; max-height:100%; padding:3px; gap:10px; }
#shipyard-panel .shipyard-catalogue-tiles button { display:flex; flex-direction:column; align-items:center; min-width:0; padding:10px; gap:8px; text-align:center; }
#shipyard-panel .shipyard-catalogue-tiles canvas { display:block; width:100%; aspect-ratio:1; min-height:0; }
#shipyard-panel .shipyard-thumbnail-frame { position:relative; width:150px; max-width:100%; height:150px; flex-shrink:0; }
#shipyard-panel .shipyard-thumbnail-frame canvas { position:absolute; inset:0; width:100%; height:100%; border:0; }
#shipyard-panel .shipyard-catalogue-tiles span { font-size:12px; overflow-wrap:anywhere; }
#shipyard-panel .shipyard-storage-grid-workspace { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) 270px; gap:20px; padding:24px; align-items:start; }
#shipyard-panel .shipyard-inventory-pane { min-width:0; }
#shipyard-panel .shipyard-inventory-pane header { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; margin-bottom:18px; }
#shipyard-panel .shipyard-inventory-pane h3 { margin:0; }
#shipyard-panel .shipyard-inventory-pane header button { font-size:11px; }
#shipyard-panel .shipyard-inventory-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(105px,1fr)); gap:10px; padding:12px; background:#10272a; border:1px solid var(--yard-line); border-radius:22px 5px; }
#shipyard-panel button.shipyard-item-tile { position:relative; min-width:0; aspect-ratio:1; padding:12px 6px 8px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:7px; background:radial-gradient(ellipse,#46605850,#20393a); }
#shipyard-panel .shipyard-item-tile img { width:60px; height:60px; max-width:80%; object-fit:contain; min-height:0; }
#shipyard-panel .shipyard-item-tile span { font-size:11px; max-width:100%; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
#shipyard-panel .shipyard-item-tile b { position:absolute; top:5px; right:7px; font:10px monospace; color:var(--yard-gold); background:#142b2ee6; padding:2px; }
#shipyard-panel button.shipyard-item-tile.selected { border-color:var(--yard-pink); box-shadow:inset 0 0 0 1px #ee77a744; }
#shipyard-panel .shipyard-inventory-empty { grid-column:1/-1; min-height:90px; display:grid; place-items:center; }
#shipyard-panel .shipyard-storage-inspector { min-width:0; padding:18px; border:1px solid var(--yard-line); border-radius:24px 5px; background:#1e383b; position:sticky; top:18px; }
#shipyard-panel .shipyard-storage-inspector h3 { margin-top:18px; overflow-wrap:anywhere; }
#shipyard-panel .shipyard-storage-transfer-actions { display:grid; gap:10px; }
#shipyard-panel .shipyard-item-tile { touch-action:none; user-select:none; cursor:grab; }
#shipyard-panel .shipyard-item-tile[data-item-id="sealed_mission_cargo"] { touch-action:pan-y; cursor:pointer; }
#shipyard-panel .shipyard-item-tile.dragging { opacity:.4; cursor:grabbing; }
#shipyard-panel .shipyard-inventory-pane.drop-ready .shipyard-inventory-grid { border-color:var(--yard-gold); }
#shipyard-panel .shipyard-inventory-pane.drop-active .shipyard-inventory-grid { border-color:var(--yard-pink); background:#393341; box-shadow:inset 0 0 0 2px #ee77a750; }
#shipyard-panel .shipyard-drag-stack { position:fixed; pointer-events:none; z-index:10; display:flex; align-items:center; gap:10px; max-width:230px; padding:12px; border:1px solid var(--yard-pink); border-radius:16px 4px; background:#283b3fee; color:var(--yard-text); box-shadow:0 8px 24px #0008; font-size:12px; }
#shipyard-panel .shipyard-drag-stack img { width:48px; height:48px; object-fit:contain; }
@media(max-width:1000px) {
  #shipyard-panel .shipyard-storage-grid-workspace { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #shipyard-panel .shipyard-storage-inspector { grid-column:1/-1; position:static; }
  #shipyard-panel .shipyard-storage-inspector .shipyard-equipment-art { width:140px; height:140px; float:left; margin:0 18px 18px 0; }
  #shipyard-panel .shipyard-storage-transfer-actions { grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); clear:both; }
}
@media(max-width:600px) {
  #shipyard-panel .shipyard-shop { display:flex; flex-direction:column; height:auto; }
  #shipyard-panel .shipyard-catalogue-tiles { width:100%; height:auto; max-height:380px; flex-shrink:0; }
  #shipyard-panel .shipyard-thumbnail-frame { width:110px; height:110px; }
  #shipyard-panel .shipyard-catalogue-tiles { grid-auto-rows:minmax(160px,max-content); }
  #shipyard-panel .shipyard-ship-detail { width:100%; }
  #shipyard-panel .shipyard-storage-grid-workspace { grid-template-columns:1fr; padding:16px; }
  #shipyard-panel .shipyard-inventory-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; padding:8px; }
  #shipyard-panel .shipyard-item-tile img { width:50px; height:50px; }
}
#shipyard-panel .shipyard-storage-toast { position:absolute; z-index:20; bottom:24px; left:50%; transform:translateX(-50%); width:max-content; max-width:calc(100% - 40px); box-sizing:border-box; padding:12px 18px; border:1px solid var(--yard-pink); border-radius:14px 4px; background:#283b3ff5; color:var(--yard-text); box-shadow:0 6px 24px #0008; font-size:14px; text-align:center; pointer-events:none; }
@media(prefers-reduced-motion:reduce) { #shipyard-panel *, #shipyard-panel *::before, #shipyard-panel *::after { animation:none!important; transition:none!important; } }
