/* --- ovenfra-planen --- */
#ePlan.top { aspect-ratio: 400 / 184; }
#ePlan.kraken { aspect-ratio: 400 / 260; }
#ePlan.top .planArt { pointer-events: auto; }
#ePlan.top .planArt .waves path { fill: none; stroke: #8fc4e0; stroke-width: 0.8; opacity: 0.25; }
#ePlan.top .planArt .wake { fill: none; stroke: #d8eefa; stroke-width: 1.4; opacity: 0.3; stroke-dasharray: 5 4; }
#ePlan.top .planArt .planks line { stroke: #000; stroke-width: 0.45; opacity: 0.18; }
#ePlan.top .planArt .raised { fill: #fff; opacity: 0.09; }
#ePlan.top .planArt .edge { stroke: #1a0e06; stroke-width: 2; opacity: 0.6; }
#ePlan.top .planArt .sky { fill: #9fd3f0; opacity: 0.25; stroke: #2a1a0c; stroke-width: 1; }
#ePlan.top .planArt .hatch { fill: #2a1a0c; opacity: 0.7; }

#ePlan.top .planArt .wheel rect { fill: #4a2e18; } #ePlan.top .planArt .wheel line { stroke: #2a1a0c; stroke-width: 1.2; }
#ePlan.top .planArt .boat { fill: #7a5230; stroke: #2a1a0c; }
#ePlan.top .planArt .port { fill: #120a05; }
#ePlan.top .planArt .barrel { stroke: #23252a; stroke-linecap: round; }
#ePlan.top .planArt .barrel.bronze { stroke: #b5803a; }
#ePlan.top .planArt .barrel.broken { stroke: #6a2a1a; stroke-width: 3; stroke-dasharray: 3 2; }
#ePlan.top .planArt .sail { opacity: 0.92; stroke: #8a7a5a; stroke-width: 0.6; pointer-events: none; }
#ePlan.top .planArt .yard { stroke: #3a2414; stroke-width: 2.4; stroke-linecap: round; pointer-events: none; }
#ePlan.top .planArt .mast { fill: #6a4424; stroke: #2a1a0c; stroke-width: 1.2; pointer-events: none; }
#ePlan.top .planArt .stump { fill: #3a2414; stroke: #ff7a5a; stroke-width: 1.2; }
#ePlan.top .planArt .fallen { fill: #5a3a22; opacity: 0.85; }
#ePlan.top .planArt .bowsprit { stroke: #4a2e18; stroke-width: 3; stroke-linecap: round; }
#ePlan.top .planArt .scorch { fill: #120a06; opacity: 0.55; }
#ePlan.top .planArt .hole { fill: #050302; stroke: #d0a06a; stroke-width: 0.8; }

/* felterne: usynlige til man peger, så lyser de; sigtede felter får en rød kant */
@keyframes zoneBurn { to { fill: rgba(255, 160, 40, 0.5); } }
/* sigtekorset */

@keyframes retSpin { to { transform: rotate(360deg); } }
/* posterne som små skilte midt i deres felter */
#ePlan.top .station { position: absolute; transform: translate(-50%, -50%); width: auto !important; height: auto !important; min-width: 0; border-radius: 9px; background: rgba(12, 10, 8, 0.7); border: 1px solid rgba(214, 178, 108, 0.3); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); display: flex; flex-direction: column; align-items: center; gap: 0; pointer-events: auto; z-index: 2; }
#ePlan.top .station .nm { gap: 3px; white-space: nowrap; }
#ePlan.top .station .nm .hpn { font-size: 0.56rem; margin-left: 0; }
#ePlan.top .station:hover, #ePlan.top .station.hov { z-index: 4; border-color: #fff; }
#ePlan.top .station:hover .nm, #ePlan.top .station.hov .nm { font-size: 0.58rem; }
#ePlan.top .station .nm .tg, #ePlan.top .station .est, #ePlan.top .station .gbtns { display: none; }
#ePlan.top .station .ecrew { font-size: 0.48rem; line-height: 1; letter-spacing: -0.05em; }
#ePlan.top .station .bar { position: absolute; left: 6px; right: 6px; bottom: 1px; height: 2px; }
#ePlan.top .station.below { border-style: dashed; }
#ePlan.top .station.aimed { border-color: #ff6a3d; box-shadow: 0 0 0 1px rgba(255, 106, 61, 0.6); }
#ePlan.top .station[data-room="sails"], #ePlan.top .station[data-room="look"] { background: rgba(10, 16, 26, 0.72); }
#ePlan.top .station .px { width: 10px; height: 10px; }
/* hendes kanoner som knapper ved hver port */
#ePins { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
#ePins .egb.pin { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; width: 22px; height: 18px; border-radius: 9px; background: rgba(12, 10, 8, 0.78); }
#ePins .egb.pin .px { width: 12px; height: 12px; }
#ePins .egb.pin.ready { box-shadow: 0 0 0 1px #ff4a2a, 0 0 8px rgba(255, 74, 42, 0.5); }
#ePins .egb.pin.hov { border-color: #fff; }
#ePlan .station:hover { border-color: #f08a5d; }
.station .tg { font: 700 0.62rem var(--body); color: #ffd98a; min-height: 0.9em; }
.srow.targeted .sn::after { content: " ◎"; color: var(--warn); }

#stationTags { position: fixed; inset: 0; pointer-events: none; }
.stag {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%);
  pointer-events: auto; display: flex; flex-direction: column; gap: 2px; align-items: center;
  padding: 2px 6px 3px; border-radius: 5px;
  background: rgba(12, 24, 40, 0.62); border: 1px solid rgba(214,178,108,0.3);
  font: 700 0.6rem var(--body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--paper);
  white-space: nowrap;
}
.stag .bar { width: 36px; height: 3px; }
.stag .chips { display: flex; gap: 2px; }
.stag .chips:empty { display: none; }
.stag.target { border-color: var(--brass); background: rgba(80, 60, 22, 0.88); }
.stag.burning { background: rgba(120, 36, 14, 0.88); }

#pauseBanner {
  position: fixed;
  left: 50%;
  top: calc(14px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  padding: 6px 18px 7px;
  text-align: center;
  pointer-events: none;
  font-size: 1.35rem;
  color: var(--brass);
  letter-spacing: 0.12em;
}
#pauseBanner small { display: block; font-family: var(--body); font-size: 0.74rem; color: var(--muted); letter-spacing: 0.03em; }
body.paused #scene { filter: saturate(0.55) brightness(0.9); }

#gameover {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 14, 24, 0.55);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
#gameover .panel { padding: 22px 26px; max-width: 380px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
#gameover h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.9rem; color: var(--brass); }
#gameover p { margin: 0; line-height: 1.45; color: var(--muted); }

@media (pointer: coarse) {
  #enemyPanel { bottom: calc(144px + env(safe-area-inset-bottom, 0px)); }
}
@media (pointer: coarse) {
  #touch { display: grid; }
  
}
@media (max-width: 560px) {

  #title h1 { font-size: 1.35rem; }
  #help { width: 240px; }
}
@media (prefers-reduced-motion: reduce) { #toast, #enemyTag .fill { transition: none; } }

/* ===== Low-poly HUD: kantede, facetterede paneler, knapper og måler ===== */
:root { --cham: 10px; --edge: #c9a04a; }
.panel {
  border: 0 !important; border-radius: 0 !important;
  clip-path: polygon(var(--cham) 0, calc(100% - var(--cham)) 0, 100% var(--cham), 100% calc(100% - var(--cham)), calc(100% - var(--cham)) 100%, var(--cham) 100%, 0 calc(100% - var(--cham)), 0 var(--cham));
  background:
    linear-gradient(135deg, transparent 0 6.6px, var(--edge) 6.6px 8.4px, transparent 8.4px) top left / 13px 13px no-repeat,
    linear-gradient(225deg, transparent 0 6.6px, var(--edge) 6.6px 8.4px, transparent 8.4px) top right / 13px 13px no-repeat,
    linear-gradient(315deg, transparent 0 6.6px, var(--edge) 6.6px 8.4px, transparent 8.4px) bottom right / 13px 13px no-repeat,
    linear-gradient(45deg, transparent 0 6.6px, var(--edge) 6.6px 8.4px, transparent 8.4px) bottom left / 13px 13px no-repeat,
    linear-gradient(118deg, rgba(255,255,255,0.06) 0 22%, transparent 22.2%),
    linear-gradient(242deg, rgba(255,255,255,0.035) 0 32%, transparent 32.2%),
    linear-gradient(14deg, rgba(0,0,0,0.22) 0 26%, transparent 26.2%),
    linear-gradient(198deg, rgba(0,0,0,0.14) 0 16%, transparent 16.2%),
    linear-gradient(165deg, rgba(38, 54, 74, 0.95) 0%, rgba(22, 34, 50, 0.95) 55%, rgba(13, 21, 33, 0.96) 100%) !important;
  box-shadow: inset 0 0 0 1.6px rgba(201, 160, 74, 0.8), inset 0 0 0 3.5px rgba(0, 0, 0, 0.35) !important;
}
.wtools { top: 7px; right: 13px; }
.grip.br { right: 7px; bottom: 7px; } .grip.tr { right: 7px; top: 7px; }
.grip.bl { left: 7px; bottom: 7px; cursor: nesw-resize; }
.grip.bl::before { border-left-width: 2px; border-bottom-width: 2px; }
button:not(.egb):not(.wc):not(.stag):not(.cc) {
  border-radius: 0 !important;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  background-image: linear-gradient(160deg, rgba(255,255,255,0.13) 0 46%, rgba(0,0,0,0.12) 46% 100%);
  box-shadow: inset 0 0 0 1px rgba(201, 160, 74, 0.6);
  border-color: transparent !important;
}
button.primary:not(:disabled) { background-color: #c9a04a; color: #1a1006; background-image: linear-gradient(160deg, #f2d48a 0 46%, #c9a04a 46% 100%); }
.wbtn { clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px) !important; }
.bar { border-radius: 0 !important; clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%); }
.bar > i { border-radius: 0 !important; background-image: linear-gradient(180deg, rgba(255,255,255,0.35) 0 42%, rgba(0,0,0,0.12) 42% 100%); }
.gcard, .card, .eg, .wc, #ePlan .station, #crewPanel .srow, .cc, .stag {
  border-radius: 0 !important;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.gcard, .card, .eg { background-image: linear-gradient(150deg, rgba(255,255,255,0.06) 0 40%, transparent 40%); }
/* portrætter af besætningen: et lille pixelansigt i en ramme i rollens farve, livsbjælke forneden */
.cc { width: 30px !important; height: 32px !important; border-radius: 5px !important; clip-path: none !important; border: 2px solid var(--rc, #8a7a5a) !important; background: #120c08 !important; padding: 0; line-height: 0 !important; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.5); overflow: hidden; transition: transform 0.12s; }
.cc img { width: 100%; height: calc(100% - 3px); display: block; image-rendering: pixelated; image-rendering: crisp-edges; pointer-events: none; }
.cc .hp { height: 3px !important; bottom: 0; background: #4fc27a !important; }
.cc.hurt .hp { background: #e0602e !important; }
.cc:hover { transform: translateY(-2px) scale(1.08); z-index: 2; }
.cc.sel { border-color: #fff !important; box-shadow: 0 0 0 2px #f2cf7a, 0 0 10px rgba(242, 207, 122, 0.7) !important; transform: translateY(-2px) scale(1.1); }
.cc.moving { opacity: 0.5; filter: saturate(0.4); }
.cc.ill { border-color: #8fd04a !important; }
.cc.ill::after { right: 0 !important; top: 0 !important; }
#crewPanel .es { width: 30px; height: 32px; border-radius: 5px; }
#crewPanel #crewInfo .ciP { width: 20px; height: 20px; image-rendering: pixelated; vertical-align: -5px; margin-right: 5px; border-radius: 3px; }
.dragGhost small { display: block; font-size: 0.66rem; color: var(--muted); }
/* skrog- og moralmåler: facetterede ædelsten i en kantet ramme */
#hgBar, #mgBar { border: 0 !important; border-radius: 0 !important; padding: 5px 4px !important;
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
  background: linear-gradient(90deg, #0a121c 0%, #1c2a3a 50%, #0a121c 100%) !important; box-shadow: inset 0 0 0 2px #c9a04a, inset 0 0 0 4px rgba(0,0,0,0.5) !important; }
#hgBar i, #mgBar i { border-radius: 0 !important; clip-path: polygon(0 18%, 100% 0, 100% 82%, 0 100%); }
#hgBar i.on { background: linear-gradient(135deg, #b4f7bf 0 40%, #4fc27a 40% 100%) !important; box-shadow: none; }
#hullGauge.mid #hgBar i.on { background: linear-gradient(135deg, #ffdca0 0 40%, #f0962e 40% 100%) !important; }
#hullGauge.low #hgBar i.on { background: linear-gradient(135deg, #ffb0a2 0 40%, #e0402e 40% 100%) !important; }
#mgBar i.on { background: linear-gradient(135deg, #fff0bf 0 40%, #d6b26c 40% 100%) !important; box-shadow: none; }
#moraleGauge.eager #mgBar i.on { background: linear-gradient(135deg, #d4efff 0 40%, #6fb8e8 40% 100%) !important; }
#moraleGauge.full #mgBar i.on { background: linear-gradient(135deg, #f2fbff 0 40%, #9fd8ff 40% 100%) !important; }
#moraleGauge.sour #mgBar i.on { background: linear-gradient(135deg, #f0c088 0 40%, #c9842b 40% 100%) !important; }
#moraleGauge.mutiny #mgBar i.on { background: linear-gradient(135deg, #ffb0a2 0 40%, #e0402e 40% 100%) !important; }
/* ressourcer som sekskanter med guldkant */
#hudTop .chips { filter: drop-shadow(2px 0 0 #c9a04a) drop-shadow(-2px 0 0 #c9a04a) drop-shadow(0 2px 0 #c9a04a) drop-shadow(0 -2px 0 #c9a04a) drop-shadow(0 3px 4px rgba(0,0,0,0.5)); }
.chip2, #conds > span { border: 0 !important; border-radius: 0 !important; clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 12px 100%, 0 50%);
  padding: 5px 20px 5px 16px !important; background: linear-gradient(160deg, #3c2b12 0 48%, #22170a 48% 100%) !important; box-shadow: none !important; }
#infamyBox { border: 0 !important; border-radius: 0 !important; clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  background: linear-gradient(160deg, #4a1810 0 48%, #2a0c08 48% 100%) !important; padding: 4px 14px 5px !important; }
/* skrog og moral: en bred plade øverst i midten, lige under skibets navn og tællerne */
body #gauges { left: 50%; top: calc(64px + env(safe-area-inset-top, 0px)); translate: -50% 0; height: auto; width: min(640px, calc(100vw - 32px));
  display: grid; grid-template-columns: 1fr; grid-template-rows: auto auto auto; gap: 3px; }
body #hullGauge, body #moraleGauge { flex-direction: row; align-items: center; gap: 8px; }
body #gauges .hgHead { flex-direction: row-reverse; align-items: baseline; justify-content: flex-start; gap: 6px; width: 88px; flex: none; }
body #gauges .hgHead small { font-size: 0.6rem !important; letter-spacing: 0.14em !important; color: #cbb98f !important; }
body #hullGauge .hgHead b { font-size: 1.5rem; color: #fff; }
body #moraleGauge .hgHead b { font-size: 1.05rem; }
body #hgBar { width: auto !important; flex: 1; height: 24px; flex-direction: row; gap: 2px; padding: 5px 8px !important; }
body #mgBar { width: auto !important; flex: 1; height: 14px; flex-direction: row; gap: 2px; padding: 3px 8px !important; }
body #hgBar i, body #mgBar i { clip-path: polygon(30% 0, 100% 0, 70% 100%, 0 100%) !important; }
body #mgNote { justify-self: center; }
@keyframes hgShake { 20% { translate: calc(-50% - 4px) 0; } 40% { translate: calc(-50% + 4px) 1px; } 60% { translate: calc(-50% - 2px) -1px; } 80% { translate: calc(-50% + 2px) 0; } }
body #topleft { left: max(16px, env(safe-area-inset-left, 0px)); max-width: calc(100vw - 32px); }
body #battleLog { top: calc(134px + env(safe-area-inset-top, 0px)); }

body #pauseBanner { top: calc(200px + env(safe-area-inset-top, 0px)) !important; z-index: 9; }
body.in-combat #pauseBanner { top: calc(300px + env(safe-area-inset-top, 0px)) !important; }
@media (max-width: 1280px) { body #gauges { top: calc(88px + env(safe-area-inset-top, 0px)); width: min(520px, calc(100vw - 32px)); } body #battleLog { top: calc(158px + env(safe-area-inset-top, 0px)); } #breakPanel { top: calc(152px + env(safe-area-inset-top, 0px)) !important; } body.in-combat #battleLog { top: calc(246px + env(safe-area-inset-top, 0px)); } }

/* ===== Skadetal som små kort: overskrift + én linje pr. følge, mørk bund så de kan læses over havet ===== */
.floater { padding: 2px 9px 3px; border-radius: 6px; background: rgba(8, 12, 20, 0.72); box-shadow: 0 2px 8px rgba(0,0,0,0.45); font: 700 0.92rem var(--body); }
.floater.big { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 12px 5px; border: 1px solid currentColor; border-radius: 7px; font: 600 0.82rem/1.25 var(--body); white-space: nowrap; text-align: center; background: rgba(8, 12, 20, 0.82); }
.floater.big::first-line { font: inherit; letter-spacing: 0; }
.floater.big b { font: 400 1.18rem/1.1 var(--display); letter-spacing: 0.05em; }
.floater.big span { color: var(--paper); opacity: 0.92; }
.floater.big.good { border-color: rgba(255, 217, 138, 0.7); } .floater.big.bad { border-color: rgba(240, 138, 93, 0.8); background: rgba(40, 10, 6, 0.85); }

/* ===== Fjendepanelet, ny udgave ===== */
#enemyPanel { gap: 8px; }

/* felterne på tegningen ses altid svagt, så man kan se hvor man kan trykke */
#ePlan.top .station .nm { font-size: 0.56rem; }
#ePlan.top .station { padding: 2px 7px 4px; }
/* store målknapper */
@media (max-width: 560px) { #enemyPanel { width: auto; } }

/* ===== Våbenkammeret: valgt kanon, sted, flyttetilstand ===== */
.arShip .arMark { cursor: pointer; }
.arShip .arMark:not(.has) { cursor: default; }
#armory.moving .arShip .arMark, #armory.moving .arSlot, #armory.moving .arHold { cursor: copy; }
#armory.moving .arSlot, #armory.moving .arHold { border-color: rgba(255, 224, 138, 0.8); }
#armory.moving .wc.sel { animation: dousePulse 1.2s ease-in-out infinite; }
.arWhere { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: #ffd98a; }
.arMoveHint { color: #ffe08a !important; font-weight: 700; }

/* ===== Fjendepanelet v3: hendes 3D-model set skråt oppefra, faste skilte ovenpå ===== */
#enemyPanel { width: min(660px, calc(100vw - 32px)); }
#ePlan.v3d { aspect-ratio: 16 / 9; border-radius: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #2a4a64 0%, #13263a 100%);
  box-shadow: inset 0 0 0 1px rgba(201, 160, 74, 0.55), inset 0 0 40px rgba(0, 0, 0, 0.45);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px); }
#ePlan.v3d .planArt, #ePlan.v3d #ePins, #ePlan.v3d > .station { display: none !important; }
#ePlan.v3d::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at 50% 55%, transparent 60%, rgba(4, 10, 18, 0.55) 100%); }
#eView { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; transition: opacity 0.4s; }
#eView.waiting { opacity: 0; }
#ePlan.v3d.pointing #eView { cursor: cell; }
.eOver { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; overflow: visible; }
.eOver .vz { pointer-events: auto; cursor: crosshair; fill: rgba(255, 236, 190, 0.06); stroke: rgba(255, 236, 190, 0.35); stroke-width: 1; stroke-linejoin: round; transition: fill 0.15s, stroke 0.15s; }
.eOver .vz.below { stroke-dasharray: 4 3; }
.eOver .vz.band { fill: rgba(255, 236, 190, 0.03); }
.eOver .vz.facing { stroke: rgba(255, 217, 138, 0.6); }
.eOver .vz:hover, .eOver .vz.hov { fill: rgba(255, 236, 190, 0.26); stroke: #fff; stroke-width: 1.5; }
.eOver .vz.aimed { fill: rgba(255, 106, 61, 0.18); stroke: #ff6a3d; stroke-width: 1.6; }
.eOver .vz.burning { fill: rgba(255, 120, 30, 0.3); animation: zoneBurn 0.8s ease-in-out infinite alternate; }
.eOver .vz.hit { fill: rgba(255, 200, 120, 0.5); }
.eOver .vlead { stroke: rgba(255, 236, 190, 0.55); stroke-width: 1; }
.eOver .vdot { fill: #ffe9b8; }
.eOver .vret { pointer-events: none; }
.eOver .vret .r1 { fill: none; stroke: #ff6a3d; stroke-width: 1.8; stroke-dasharray: 6 3; transform-box: fill-box; transform-origin: center; animation: retSpin 4s linear infinite; }
.eOver .vret .r2 { fill: #ff6a3d; }
.eOver .vret path { stroke: #ff6a3d; stroke-width: 1.8; stroke-linecap: round; }
.eOver .vret rect { fill: rgba(20, 8, 4, 0.88); stroke: #ff6a3d; stroke-width: 1; }
.eOver .vret text { font: 700 9px var(--body); fill: #ffd8c8; }
.eOver .vret.sel .r1, .eOver .vret.sel path { stroke: #ffe08a; }
.eBadges { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.eBadges .vb { position: absolute; left: 0; top: 0; width: 96px; height: 34px; box-sizing: border-box; pointer-events: auto; will-change: transform;
  display: grid; grid-template-rows: auto 3px auto; gap: 1px; padding: 3px 6px 2px !important; text-align: left; font: inherit; color: var(--paper);
  background: rgba(10, 14, 22, 0.82) !important; box-shadow: inset 0 0 0 1px rgba(214, 178, 108, 0.45), 0 2px 8px rgba(0, 0, 0, 0.5) !important;
  cursor: crosshair; touch-action: manipulation; transition: background-color 0.15s, box-shadow 0.15s, opacity 0.2s; }
.eBadges .vb .vbh { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 0.66rem; line-height: 1; }
.eBadges .vb .vbh b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.eBadges .vb .vbh .px { width: 12px; height: 12px; flex: none; }
.eBadges .vb .vba { margin-left: auto; font: 700 0.56rem var(--body); font-style: normal; color: #ff9a7a; white-space: nowrap; }
.eBadges .vb .vbb { display: block; height: 3px; background: rgba(255,255,255,0.12); overflow: hidden; }
.eBadges .vb .vbb i { display: block; height: 100%; background: #8fe6a8; transition: width 0.3s; }
.eBadges .vb .vbb.low i { background: #ff7a5a; }
.eBadges .vb .vbs { font-size: 0.56rem; line-height: 1.1; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eBadges .vb:hover, .eBadges .vb.hov { background: rgba(40, 32, 18, 0.95) !important; box-shadow: inset 0 0 0 1.5px #fff, 0 2px 10px rgba(0, 0, 0, 0.6) !important; z-index: 2; }
.eBadges .vb.aimed { box-shadow: inset 0 0 0 2px #ff6a3d, 0 0 12px rgba(255, 106, 61, 0.45) !important; }
.eBadges .vb.bad .vbs { color: #ff9a7a; font-weight: 700; }
.eBadges .vb.burning { background: rgba(110, 32, 10, 0.92) !important; }
.eBadges .vb.hit { background: rgba(200, 110, 60, 0.9) !important; }
.eBadges .vb.wrecked { opacity: 0.6; }
.eBadges .vb.away { opacity: 0.72; }
.eBadges .vpin { position: absolute !important; left: 0; top: 0; width: 26px !important; height: 20px !important; pointer-events: auto; will-change: transform; transform: none; border-radius: 10px; background: rgba(10, 8, 6, 0.8) !important; z-index: 1; }
.eBadges .vpin .px { width: 13px; height: 13px; }
.eBadges .vpin.ready { box-shadow: 0 0 0 1px #ff4a2a, 0 0 9px rgba(255, 74, 42, 0.6); }
.eBadges .vpin.hov, .eBadges .vpin:hover { border-color: #fff; box-shadow: 0 0 0 1.5px #fff; z-index: 3; }
.eCorner { position: absolute; left: 12px; bottom: 8px; z-index: 3; pointer-events: none; font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: #cfe3f0; text-shadow: 0 1px 3px #000; }
.eCorner b { color: #ffd98a; }
/* faste højder: intet skubber resten af panelet, når man vælger eller peger */

.einfo { height: 5.8em; min-height: 0; overflow: hidden; box-sizing: border-box; }
#enemyPanel.sinking #ePlan::after { z-index: 4; }

/* ===== Flyt kanon til den anden side ===== */
#battery .gcard { grid-template-columns: 26px 1fr; }
.gcard .gn { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.gcard .mv { padding: 0 2px !important; min-width: 24px; font: 700 0.6rem var(--body); line-height: 1.5; color: var(--paper); background-color: rgba(255,255,255,0.08); }
.gcard.pside .mv { color: #8fe6a8; } .gcard.sside .mv { color: #ff8a7a; }
.gcard.shifting { border-color: #8fc8ff !important; background: rgba(20, 40, 70, 0.6); }
.gcard.shifting .mv { background: #2a5a8a !important; color: #fff; }

/* ===== Sælg i havnen ===== */
.sellBtn { display: inline-flex; align-items: center; gap: 6px; }
.sellBtn .px { width: 18px; height: 18px; }
.invWrap { display: flex; gap: 16px; align-items: flex-start; min-height: 0; }
.invWrap .invGrid { flex: 1; min-width: 0; }
#inventory.selling > .panel { width: min(1180px, 100%); }
.sellZone { position: sticky; top: 0; flex: none; width: 250px; display: flex; flex-direction: column; gap: 10px; }
.szDrop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 210px; padding: 16px 12px; text-align: center; cursor: pointer;
  border: 2px dashed rgba(242, 207, 122, 0.55); background: radial-gradient(circle at 50% 40%, rgba(242, 207, 122, 0.16), rgba(10, 8, 6, 0.4) 70%); transition: background 0.2s, border-color 0.2s, transform 0.2s; }
.szDrop b { font: 400 1.15rem var(--display); color: #f2cf7a; }
.szDrop small { font-size: 0.7rem; color: var(--muted); line-height: 1.35; }
.szCoin { display: block; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5)); transition: transform 0.25s; }
.szCoin .px { width: 96px; height: 96px; }
.szDrop.over, .szDrop.ready { border-color: #ffe08a; border-style: solid; background: radial-gradient(circle at 50% 40%, rgba(255, 224, 138, 0.35), rgba(40, 28, 8, 0.6) 70%); }
.szDrop.over .szCoin, .szDrop.ready .szCoin { transform: scale(1.12) rotate(-6deg); }
.szCoin.pay { animation: coinPay 0.6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes coinPay { 0% { transform: scale(1); } 35% { transform: scale(1.3) rotate(12deg); } 100% { transform: scale(1); } }
.szQty { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid rgba(242, 207, 122, 0.5); background: rgba(30, 22, 8, 0.7); }
.szItem { display: grid; grid-template-columns: 30px 1fr; gap: 0 8px; align-items: center; }
.szItem .px { width: 28px; height: 28px; grid-row: span 2; }
.szItem b { font-size: 0.86rem; } .szItem small { font-size: 0.68rem; color: var(--muted); }
.szStep { display: flex; align-items: center; justify-content: center; gap: 8px; }
.szStep button { width: 36px; height: 32px; padding: 0; font: 700 1.2rem var(--body); }
.szStep button.mini { width: auto; padding: 0 8px; font-size: 0.72rem; }
.szStep output { min-width: 44px; text-align: center; font: 700 1.4rem var(--body); font-variant-numeric: tabular-nums; }
.szTotal { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 0.9rem; color: #f2cf7a; }
.szTotal .px { width: 18px; height: 18px; } .szTotal b { font-size: 1.3rem; }
.szBtns { display: flex; gap: 6px; } .szBtns button { flex: 1; }
.szMsg { margin: 0; font-size: 0.76rem; color: #ffd98a; min-height: 1.2em; }
#inventory.selling .invItem:not(.sellable) { opacity: 0.4; }
#inventory.selling .invItem.sellable { cursor: grab; touch-action: none; }
#inventory.selling .invItem.sellable:hover { border-color: rgba(242, 207, 122, 0.7); }
.invItem.picked { border-color: #ffe08a !important; box-shadow: 0 0 0 2px rgba(255, 224, 138, 0.5); }
.invItem.dragging { opacity: 0.35; }
.invItem .n { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.ptag { display: inline-flex; align-items: center; gap: 2px; font: 700 0.62rem var(--body); font-style: normal; color: #f2cf7a; }
.ptag .px { width: 11px !important; height: 11px !important; }
body.sellDrag, body.sellDrag * { cursor: grabbing !important; }
.sellGhost { will-change: transform; }
.sellGhost .px { width: 24px; height: 24px; }
@media (max-width: 760px) { .invWrap { flex-direction: column-reverse; } .sellZone { position: static; width: 100%; } .szDrop { min-height: 130px; } .szCoin .px { width: 64px; height: 64px; } }

/* ===== Biomer på søkortet ===== */
#chart.b-swamp > .panel { box-shadow: inset 0 0 0 1.6px rgba(140, 170, 90, 0.85), inset 0 0 80px rgba(60, 90, 30, 0.35) !important; }
#chart.b-frozen > .panel { box-shadow: inset 0 0 0 1.6px rgba(190, 225, 245, 0.9), inset 0 0 80px rgba(160, 210, 240, 0.25) !important; }
#chart.b-swamp .chartWrap { filter: sepia(0.25) hue-rotate(40deg) saturate(0.85); }
#chart.b-frozen .chartWrap { filter: hue-rotate(-15deg) saturate(0.6) brightness(1.08); }
.biomeTag { display: inline-block; padding: 0 7px; font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; }
.biomeTag.swamp { background: #3a5a22; color: #d8f0a8; } .biomeTag.frozen { background: #2a5a7a; color: #e8f6ff; }

/* ===== Særlige valg i hændelser: guldtekst og et [mærke] for det, der låser op ===== */
.choices button.special { color: #f2cf7a; box-shadow: inset 0 0 0 1px rgba(242, 207, 122, 0.75), inset 3px 0 0 #f2cf7a; background-color: rgba(60, 44, 14, 0.55); }
.choices button.special:hover:not(:disabled) { background-color: rgba(90, 66, 20, 0.7); color: #ffe6a8; }
.choices button.special .spTag { font-weight: 700; color: #ffd36a; letter-spacing: 0.02em; }

.choices button.special small { color: #d9c08a; }

/* ===== Fjendepanelet: drej/zoom, størrelse, skjult uden udkig ===== */
#ePlan.v3d { touch-action: none; }
#ePlan.v3d.turning, #ePlan.v3d.turning * { cursor: grabbing !important; }
.eHint { position: absolute; right: 10px; bottom: 7px; z-index: 3; pointer-events: none; font-size: 0.6rem; color: rgba(207, 227, 240, 0.7); text-shadow: 0 1px 3px #000; opacity: 0; transition: opacity 0.3s; }
#ePlan.v3d:hover .eHint { opacity: 1; }

.eBadges .vb .vbb.unk i, .einfo .hpb.unk i { background: repeating-linear-gradient(90deg, rgba(255,255,255,0.22) 0 4px, transparent 4px 8px) !important; }
.eResize { position: absolute; left: 4px; top: 4px; z-index: 6; width: 22px; height: 22px; padding: 0 !important; cursor: nwse-resize; touch-action: none; background: transparent !important; box-shadow: none !important; clip-path: none !important; opacity: 0.55; }
.eResize::before { content: ""; position: absolute; left: 5px; top: 5px; width: 11px; height: 11px; border-left: 2px solid var(--brass); border-top: 2px solid var(--brass); }
.eResize::after { content: ""; position: absolute; left: 9px; top: 9px; width: 5px; height: 5px; border-left: 2px solid var(--brass); border-top: 2px solid var(--brass); }
.eResize:hover, .eResize.on { opacity: 1; }
#enemyPanel header { padding-left: 20px; }
#enemyPanel.min .eResize { display: none; }

/* Opgradering vises på skibet: butikspanelerne glider væk, et lille skilt fortæller hvad der bygges */
#port > .panel, #workshop > .panel { transition: opacity 0.35s ease, transform 0.35s ease; }
body.showcase #port, body.showcase #workshop { background: transparent !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; pointer-events: none; }
body.showcase #port > .panel, body.showcase #workshop > .panel { opacity: 0; transform: translateY(24px) scale(0.98); pointer-events: none; }
#showcaseCard { position: fixed; left: 50%; bottom: calc(10vh + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px); z-index: 40;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 26px 9px; min-width: 240px; max-width: calc(100vw - 32px);
  background: rgba(12, 24, 40, 0.82); border: 1px solid var(--panel-edge); border-radius: 10px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s, border-color 0.3s, box-shadow 0.3s; text-align: center; }
#showcaseCard.work, #showcaseCard.done { opacity: 1; transform: translate(-50%, 0); }
#showcaseCard.done { border-color: #ffd36a; box-shadow: 0 0 0 1px rgba(255, 211, 106, 0.5), 0 0 28px rgba(255, 190, 80, 0.45), 0 8px 30px rgba(0, 0, 0, 0.4); }
#showcaseCard small { font: 600 0.7rem var(--body); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
#showcaseCard b { font-family: var(--display); font-weight: 400; font-size: 1.5rem; color: var(--brass); line-height: 1.1; }
#showcaseCard.done b { color: #ffdf8a; }
#showcaseCard span { font-size: 0.95rem; color: var(--paper); font-variant-numeric: tabular-nums; }
#showcaseCard.work span { animation: scKnock 0.36s steps(2) infinite; }
#showcaseCard em { font-style: normal; font-size: 0.7rem; color: var(--muted); margin-top: 3px; }
@keyframes scKnock { 50% { transform: translateY(-1px); } }

/* Fortryd i butikkerne */
.undoBtn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; gap: 1px; max-width: 150px; }
.undoBtn small { font-size: 0.62rem; color: var(--muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.undoBtn small:empty { display: none; }
.undoBtn:disabled { opacity: 0.45; cursor: default; }
#inventory:not(.selling) #btnInvUndo { display: none; }

/* Biomer på søkortet: bløde pletter under ruterne, navn over hver */
#chartSvg .bioFill circle, #chartSvg .bioFill line { fill: currentColor; stroke: currentColor; }
#chartSvg .bioFill { opacity: 0.1; pointer-events: none; }
#chartSvg .bioFill.swamp { color: #8fd14f; } #chartSvg .bioFill.frozen { color: #bfe6ff; }
#chartSvg .bioEdge { pointer-events: none; }
#chartSvg .bioLbl { font: 600 11px var(--body); letter-spacing: 0.16em; text-transform: uppercase; text-anchor: middle; paint-order: stroke; stroke-width: 3px; pointer-events: none; }
#chartSvg .bioLbl.swamp { fill: #d8f0a8; stroke: rgba(30, 44, 14, 0.85); }
#chartSvg .bioLbl.frozen { fill: #f0faff; stroke: rgba(20, 50, 72, 0.85); }
#chartSvg .node.nb-swamp:not(.reach):not(.cur):not(.sel) circle { stroke: #9cc25a; }
#chartSvg .node.nb-frozen:not(.reach):not(.cur):not(.sel) circle { stroke: #cfeaff; }
#nodeInfo .biomeTag { margin-left: 4px; vertical-align: 1px; border-radius: 3px; }
#nodeInfo .bioDesc { color: var(--muted); }

/* Fokusknappen ved "Guns": bred men tynd, blød rød, så fanen ikke bliver højere */
#battery h2 { align-items: center; }
#battery h2 #gunHint { flex: 0 1 auto; min-width: 0; text-align: right; }
.focusBtn { flex: 1 1 150px; min-width: 110px; max-width: 240px; align-self: center; height: 18px; padding: 0 14px !important; line-height: 16px; font: 700 0.66rem var(--body) !important;
  letter-spacing: 0.1em; text-transform: uppercase; color: #fff3f0 !important; background: #c96a62 !important; border: 1px solid #e3928a !important; border-radius: 9px !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: none; }
.focusBtn:hover { background: #d77a72 !important; }
.focusBtn.arm { background: #e0857a !important; animation: focusArm 0.9s ease-in-out infinite; }
.focusBtn.on { background: #b8524a !important; border-color: #ffb0a6 !important; }
@keyframes focusArm { 50% { box-shadow: 0 0 0 3px rgba(240, 140, 128, 0.35); } }
.gcard.focused .gt { color: #ffb0a6; }

/* Hold ild (højreklik): en ladt kanon der venter får en langsomt flimrende guldkant */
.gcard.held { outline: 1px dashed rgba(214, 178, 108, 0.6); outline-offset: -1px; }
.gcard.held.ready { outline: none; border-color: #ffd36a !important; animation: heldGlow 2.2s ease-in-out infinite; }
@keyframes heldGlow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 211, 106, 0.85), 0 0 8px rgba(255, 196, 80, 0.45); }
  40% { box-shadow: 0 0 0 2px rgba(255, 224, 140, 1), 0 0 16px rgba(255, 200, 90, 0.75); }
  55% { box-shadow: 0 0 0 1px rgba(255, 211, 106, 0.5), 0 0 4px rgba(255, 196, 80, 0.25); }
  70% { box-shadow: 0 0 0 2px rgba(255, 224, 140, 0.95), 0 0 14px rgba(255, 200, 90, 0.65); }
}
.gcard.held .gt { color: #ffd98a; }
@media (prefers-reduced-motion: reduce) { .gcard.held.ready, .focusBtn.arm { animation: none; } }

/* Værkstedet: store materialeikoner med kant, ingen guldtæller */
#workshop #wsRes { display: flex; gap: 10px; align-items: center; }
#workshop #wsRes .wsMat { display: inline-flex; align-items: center; gap: 8px; }
#workshop .wsIco { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; border: 2px solid #c9a04a;
  background: rgba(20, 13, 4, 0.72); box-shadow: inset 0 0 0 1px rgba(255, 220, 140, 0.18), 0 2px 8px rgba(0, 0, 0, 0.35); }
#workshop .res .wsIco .px { width: 30px; height: 30px; }
#workshop .wsMat > span { display: flex; flex-direction: column; line-height: 1.05; }
#workshop .wsMat b { font-size: 1.15rem; color: var(--paper); font-variant-numeric: tabular-nums; }
#workshop .wsMat small { font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
#workshop .mcost { gap: 6px; }
#workshop .mcost span { gap: 4px; }
#workshop .mcost .px { width: 22px; height: 22px; padding: 2px; border: 1.5px solid #c9a04a; border-radius: 5px; background: rgba(20, 13, 4, 0.6); box-sizing: content-box; }
#workshop .mcost span.short .px { border-color: #ff8a6a; }

/* Ikoner på alt man kan købe og bygge */
.card.hasIco .ci { flex: 1; }
.card .cico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; border: 1.5px solid #c9a04a;
  background: rgba(20, 13, 4, 0.65); box-shadow: inset 0 0 0 1px rgba(255, 220, 140, 0.15); }
.card .cico .px { width: 24px; height: 24px; }
.card.done .cico { filter: saturate(0.4); }

/* Guldet i havnen: sin egen lille kasse i hjørnet med en guldmønt */
#port .res .goldBox { order: 9; display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 6px; border: 2px solid #c9a04a; border-radius: 8px;
  background: linear-gradient(160deg, #3c2b12 0 48%, #22170a 48% 100%); box-shadow: inset 0 0 0 1px rgba(255, 220, 140, 0.18), 0 2px 8px rgba(0, 0, 0, 0.35); }
#port .goldBox i { display: grid; place-items: center; }
#port .goldBox .px { width: 24px; height: 24px; }
#port .goldBox b { font-size: 1.2rem; color: #ffe08a; font-variant-numeric: tabular-nums; }

/* Vand i lasten: en blå bjælke under moralen, blinker når der skal folk til pumpen */
body #waterGauge { display: flex; flex-direction: row; align-items: center; gap: 8px; }
body #waterGauge .hgHead { display: flex; }
body #waterGauge .hgHead b { font-size: 1.05rem; }
#wgBar { display: flex; flex: 1; height: 14px; gap: 2px; padding: 3px 8px; border-radius: 0;
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
  background: linear-gradient(90deg, #0a121c 0%, #1c2a3a 50%, #0a121c 100%); box-shadow: inset 0 0 0 2px #c9a04a, inset 0 0 0 4px rgba(0,0,0,0.5); }
#wgBar i { flex: 1; background: rgba(255, 255, 255, 0.06); clip-path: polygon(30% 0, 100% 0, 70% 100%, 0 100%); }
#wgBar i.on { background: linear-gradient(135deg, #cfeaff 0 40%, #3f8fd0 40% 100%); }
#waterGauge.high #wgBar i.on { background: linear-gradient(135deg, #b8dcff 0 40%, #2a62b8 40% 100%); }
#waterGauge.alarm .hgHead b, #waterGauge.alarm .hgHead small { color: #ff9a7a !important; }
#waterGauge.alarm #wgBar { animation: wgAlarm 0.9s ease-in-out infinite; }
@keyframes wgAlarm { 50% { box-shadow: inset 0 0 0 2px #ff6a3d, inset 0 0 0 4px rgba(0,0,0,0.5), 0 0 12px rgba(255, 106, 61, 0.6); } }
