/* Port health and paid service controls share the footer; the ship view stays clear. */
#preparation .prep-bottom{grid-template-columns:240px minmax(180px,220px) minmax(280px,440px) 144px 240px;gap:12px}
#preparation #prepVital{gap:5px}
#preparation .prep-health-row,#preparation .prep-crew-row{display:grid;grid-template-columns:minmax(0,1fr) 68px;align-items:center;gap:6px;min-width:0}
#preparation .prep-health-summary{min-width:0}
#preparation .prep-health-heading{display:grid;grid-template-columns:30px minmax(0,1fr);align-items:center;gap:5px;margin-bottom:3px}
#preparation .prep-health-heading>img{width:30px;height:30px;object-fit:contain}
#preparation #prepVital .prep-health-heading b,#preparation #prepVital .prep-crew-row .prep-stat>b{font:600 24px/28px var(--font-body);white-space:nowrap;font-variant-numeric:tabular-nums;text-align:center}
#preparation #prepHealth{position:relative;height:25px;overflow:hidden;background:#6e5140;border:1px solid #755431;box-shadow:inset 0 1px 3px #2c211a88}
#preparation #prepHealth .prep-health-fill{position:absolute;inset:0 auto 0 0;background:linear-gradient(#62936a,#3d704f);min-width:0}
#preparation #prepHealth.damaged .prep-health-fill{background:linear-gradient(#bd8b43,#93612e)}
#preparation #prepHealth.critical .prep-health-fill{background:linear-gradient(#ba6650,#923d32)}
#preparation #prepHealth strong{position:relative;display:block;z-index:1;font:600 20px/23px var(--font-body);text-align:center;color:#fff1d2;text-shadow:0 1px 2px #251b15;font-variant-numeric:tabular-nums}
#preparation #prepRepairDock,#preparation #prepCrewDock{width:68px;min-width:0;display:grid;place-items:center}
#preparation #prepRepair{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;position:static;width:68px;height:62px;min-height:62px;padding:0;border:0;background:none;box-shadow:none;clip-path:none;filter:none;color:#422c1b}
#preparation #prepRepair>img{width:38px;height:38px;object-fit:contain}
#preparation #prepRepair .repair-button-details{display:flex;align-items:center;justify-content:center;gap:4px;width:100%;height:24px}
#preparation #prepRepair b{position:static;inset:auto;font:600 20px/24px var(--font-body);text-shadow:none;white-space:nowrap}
#preparation #prepRepair .repair-button-cost{display:flex;align-items:center;gap:1px;font:600 20px/24px var(--font-body);color:inherit}
#preparation #prepRepair .repair-button-cost img{width:17px;height:20px;object-fit:contain}
#preparation #prepRepair .repair-button-cost span{font:inherit;color:inherit}
#preparation #prepRepair:hover{background:none;filter:drop-shadow(0 0 3px #ba9248)}
#preparation #prepRepair:disabled{opacity:.45;filter:grayscale(.65);cursor:default}
#preparation #prepReplenishCrew{display:flex;align-items:center;justify-content:center;gap:3px;width:68px;min-height:40px;padding:2px 0;border:0;background:none;box-shadow:none;color:#422c1b}
#preparation #prepReplenishCrew .crew-recruit-art{position:relative;display:block;width:28px;height:28px;flex:none}
#preparation #prepReplenishCrew .crew-recruit-art>img{display:block;width:100%;height:100%;object-fit:contain}
#preparation #prepReplenishCrew .crew-recruit-art>i{position:absolute;right:-2px;bottom:-1px;display:grid;place-items:center;width:14px;height:14px;border:1px solid #e4c68d;border-radius:50%;background:#356a58;color:#fff1be;box-shadow:0 1px 2px #44321b88;font:700 16px/12px var(--font-body);font-style:normal;text-shadow:none}
#preparation #prepReplenishCrew .crew-button-cost{display:flex;align-items:center;gap:2px;min-width:0}
#preparation #prepReplenishCrew .crew-button-cost>img{width:17px;height:20px;object-fit:contain;flex:none}
#preparation #prepReplenishCrew .crew-button-cost>b{font:600 20px/24px var(--font-body);font-variant-numeric:tabular-nums;white-space:nowrap}
#preparation #prepReplenishCrew:hover{background:#b68a4726}
#preparation #prepReplenishCrew:disabled{opacity:.45;cursor:default;border-color:transparent}
#preparation :is(#prepRepair,#prepReplenishCrew):focus-visible{outline:2px solid #9a6833;outline-offset:2px}
#preparation #prepVital .prep-stat{min-height:35px;grid-template-columns:30px minmax(0,1fr)}
#preparation #prepVital .prep-stat>img{width:30px;height:30px}
#preparation #prepPortMoney{display:flex;align-items:center;gap:14px;min-height:30px}
#preparation :is(#prepWallet,#prepMaterials){display:flex;align-items:center;gap:5px;min-height:30px;width:max-content;padding:0;border:0;background:none;box-shadow:none;color:#f0dbae;text-shadow:0 2px 4px #081a20}
#preparation :is(#prepWallet,#prepMaterials)>img{width:28px;height:28px;object-fit:contain}
#preparation :is(#prepWallet,#prepMaterials)>b{font:600 24px/28px var(--font-body);white-space:nowrap;font-variant-numeric:tabular-nums}
#repairBeforeBattle{width:min(640px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow:auto;padding:22px 26px;color:#422c1b;border:4px double #916d41;font:20px/1.25 var(--font-body)}
#repairBeforeBattle::backdrop{background:#061b23a6}
#repairBeforeBattle h2{margin:0 0 16px;font:600 30px/34px var(--font-display)}
#repairBeforeBattle .repair-health-preview{display:flex;align-items:center;justify-content:center;gap:12px;padding:10px 0;border-block:1px solid #a9805055;font-size:24px;font-variant-numeric:tabular-nums}
#repairBeforeBattle .repair-health-preview img{width:38px;height:38px;object-fit:contain}
#repairBeforeBattle .repair-health-preview>b{white-space:nowrap}
#repairBeforeBattle .repair-offer-details{margin:14px 0 10px}
#repairBeforeBattle .repair-offer-cost{display:flex;align-items:center;gap:7px;font-size:22px}
#repairBeforeBattle .repair-offer-cost img{width:32px;height:32px;object-fit:contain}
#repairBeforeBattle .repair-crew-note{font-size:20px;color:#765333;margin:12px 0 18px}
#repairBeforeBattle .repair-offer-reason{font-size:20px;color:#923d32;margin:8px 0}
#repairBeforeBattle .repair-departure-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}
#repairBeforeBattle button{min-height:48px;padding:8px;font:600 20px/24px var(--font-display);border:1px solid #9a7041;color:#422c1b;background:#c6a87533;clip-path:none}
#repairBeforeBattle #repairProceed{color:#fff0ce;background:linear-gradient(#a8583a,#813c2b);border-color:#8f5037}
#repairBeforeBattle #cancelDeparture{grid-column:1/-1;border:0;background:none}
#repairBeforeBattle button:focus-visible{outline:2px solid #815729;outline-offset:2px}
#repairBeforeBattle button:disabled{opacity:.45;cursor:default}
@media(max-width:1800px){#preparation .prep-bottom{grid-template-columns:240px minmax(160px,196px) minmax(260px,370px) 126px 210px;gap:10px}}
@media(max-width:1400px){#preparation .prep-bottom{grid-template-columns:220px minmax(150px,176px) minmax(250px,326px) 104px 180px;gap:8px}#preparation #prepHull .hull-diagram{grid-template-columns:68px minmax(0,1fr) 68px}#preparation #prepMasts .mast-diagram{gap:0 3px}#preparation .prep-health-heading{grid-template-columns:28px minmax(0,1fr);gap:3px}#preparation #prepPortMoney{gap:10px}}
@media(max-width:1150px){#preparation .prep-bottom{grid-template-columns:220px minmax(130px,1fr) minmax(210px,1.5fr) 96px 155px;gap:6px;padding-inline:8px}#preparation #prepHull .hull-diagram{grid-template-columns:58px minmax(0,1fr) 58px}}
@media(max-width:640px){#repairBeforeBattle{padding:18px}#repairBeforeBattle .repair-health-preview{gap:7px;font-size:20px}#repairBeforeBattle .repair-health-preview img{width:28px;height:28px}#repairBeforeBattle .repair-departure-actions{grid-template-columns:1fr}#repairBeforeBattle .repair-offer-cost{flex-wrap:wrap}}

/* The port footer shares a fixed vertical budget; additional ship stats form
   two rows instead of extending below the parchment. */
#preparation{grid-template-rows:104px minmax(0,1fr) 160px}
#preparation .prep-bottom{grid-template-columns:240px minmax(160px,220px) minmax(260px,440px) 200px 220px;padding:6px 16px;gap:12px}
#preparation #prepVital{gap:2px}
#preparation .prep-health-heading{margin-bottom:2px}
#preparation .prep-health-heading>img{width:28px;height:28px}
#preparation #prepHealth{height:18px}
#preparation #prepHealth strong{font-size:16px;line-height:16px}
#preparation #prepRepair{height:48px;min-height:48px}
#preparation #prepRepair>img{width:26px;height:26px}
#preparation #prepRepair .repair-button-details{height:20px}
#preparation #prepRepair b,#preparation #prepRepair .repair-button-cost{font-size:17px;line-height:20px}
#preparation #prepReplenishCrew,#preparation #prepCargo{min-height:44px}
#preparation #prepMovement{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 12px;align-content:center}
#preparation #prepMovement .prep-stat{grid-template-columns:28px minmax(0,1fr);gap:4px;min-height:44px}
#preparation #prepMovement .prep-stat>img{width:28px;height:28px}
#preparation #prepMovement .prep-stat>b{font-size:24px;line-height:28px}
#preparation #prepMasts .mast-diagram{height:118px;grid-template-rows:100px 18px;margin:0}
#preparation #prepMasts .mast-condition{height:100px;gap:0}
#preparation #prepMasts .model-mast{height:56px;width:42px}
#preparation #prepMasts .mast-condition small{font-size:14px;line-height:18px}
#preparation #prepMasts .mast-condition b{font-size:21px;line-height:24px}
#preparation #prepMasts .mast-condition em{font-size:14px;line-height:24px}
#preparation #prepHull .hull-diagram{height:116px;grid-template-rows:38px 40px 38px}
#preparation #prepHull .horizontal-hull{height:40px}
#preparation .battle-launch{min-height:72px;font-size:24px;line-height:26px}

/* Six assignments are a single overview. Short screens place the four skills
   in a row so names and all posts remain visible without clipping or scroll. */
#preparation .prep-posts{display:flex;flex-direction:column;max-height:660px}
#preparation #prepOfficers{flex:1;display:grid;grid-template-rows:repeat(6,minmax(0,1fr));overflow:visible;min-height:0}
#preparation #prepOfficers .prep-officer{min-height:0;padding-block:2px}
#preparation #prepOfficers .prep-skills-grid{--prep-skill-size:36px;gap:4px}
@media(max-width:1800px){
 #preparation .prep-bottom{grid-template-columns:240px minmax(150px,196px) minmax(250px,370px) 176px 190px;gap:8px}
}
@media(max-width:1400px){
 #preparation .prep-bottom{grid-template-columns:220px minmax(130px,176px) minmax(230px,326px) 160px 160px;gap:6px;padding-inline:8px}
 #preparation #prepMovement{gap:4px 6px}
 #preparation #prepMovement .prep-stat{grid-template-columns:24px minmax(0,1fr)}
 #preparation #prepMovement .prep-stat>img{width:24px;height:24px}
 #preparation #prepMovement .prep-stat>b{font-size:22px}
 #preparation .battle-launch{font-size:21px;line-height:24px;padding:6px}
}
@media(max-height:850px){
 #preparation{grid-template-rows:82px minmax(0,1fr) 160px}
 #preparation #prepOfficers .prep-officer{grid-template-columns:8px 48px minmax(0,1fr) auto;gap:4px;padding-block:1px}
 #preparation #prepOfficers .officer-mini{width:48px;height:48px}
 #preparation #prepOfficers .prep-skills-grid{--prep-skill-size:28px;grid-template-columns:repeat(4,var(--prep-skill-size));grid-template-rows:var(--prep-skill-size);gap:3px}
 #preparation #prepOfficers .prep-officer-info b{font-size:19px;line-height:21px}
 #preparation #prepOfficers .prep-officer-info small{font:600 12px/15px var(--font-body)!important}
 #preparation #prepOfficers .prep-officer-info b,#preparation #prepOfficers .prep-officer-info small,#preparation #prepOfficers .prep-officer-info .officer-level{margin:0}
 #preparation #prepOfficers .prep-officer-info .officer-level{font-size:11px;line-height:15px}
 #preparation #prepOfficers .prep-skill .passive-mark{font-size:14px;line-height:15px}
 #preparation #prepOfficers .prep-skill>img{padding:2px}
 #preparation #prepOfficers .prep-skill .skill-cooldown{font-size:18px}
}
@media(max-height:700px){
 #preparation{padding-block:8px;gap:6px}
 #preparation .prep-posts{padding:6px 10px}
 #preparation .prep-posts h2{font-size:21px;line-height:24px;margin-bottom:4px;padding-bottom:4px}
 #preparation .prep-posts .panel-hint{font-size:12px;line-height:14px;padding-top:2px}
 #preparation #prepOfficers .prep-officer{grid-template-columns:8px 36px minmax(0,1fr) auto}
 #preparation #prepOfficers .officer-mini{width:36px;height:36px}
 #preparation #prepOfficers .prep-officer-info b{font-size:17px;line-height:19px}
 #preparation #prepOfficers .prep-officer-info small{font:600 11px/13px var(--font-body)!important}
 #preparation #prepOfficers .prep-officer-info .officer-level{font-size:10px;line-height:13px}
}
