*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #071520;
  font-family: Georgia, 'Times New Roman', serif;
}

/* ── Login Screen ─────────────────────────────────────────────────────────── */

#loginScreen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  background: radial-gradient(ellipse at center, #0d2840 0%, #071520 70%);
}

#loginBox {
  text-align: center;
  padding: 40px 52px 36px;
  border: 1px solid #8b6914;
  border-radius: 6px;
  background: rgba(7, 21, 32, 0.97);
  box-shadow: 0 0 60px rgba(255,180,0,0.08), inset 0 0 40px rgba(0,0,0,0.4);
  min-width: 360px;
}

#loginTitle {
  font-size: 3.2em; color: #ffd700;
  text-shadow: 0 0 30px rgba(255,215,0,0.45), 0 2px 4px rgba(0,0,0,0.8);
  letter-spacing: 3px; margin-bottom: 6px;
}

#loginSubtitle {
  font-size: 1em; color: #9a7e3a;
  font-style: italic; letter-spacing: 1px; margin-bottom: 24px;
}

/* Tabs */
#loginTabs {
  display: flex; gap: 0; margin-bottom: 20px;
  border: 1px solid #5a4510; border-radius: 4px; overflow: hidden;
}

.tab-btn {
  flex: 1; padding: 9px;
  background: rgba(255,255,255,0.03);
  border: none; color: #7a6030;
  font-size: 0.9em; font-family: Georgia, serif;
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.tab-btn.active { background: rgba(255,215,0,0.1); color: #ffd700; }
.tab-btn:hover:not(.active) { background: rgba(255,255,255,0.06); color: #b89040; }

/* Auth inputs */
.auth-input {
  display: block; width: 100%;
  padding: 11px 14px; margin-bottom: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid #5a4510; border-radius: 4px;
  color: #f0d090; font-size: 0.95em; font-family: Georgia, serif;
  outline: none; transition: border-color 0.2s;
}
.auth-input::placeholder { color: #4a3a18; }
.auth-input:focus { border-color: #ffd700; background: rgba(255,255,255,0.08); }

.auth-btn {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, #8b6914 0%, #d4a832 50%, #8b6914 100%);
  border: none; border-radius: 4px;
  color: #071520; font-size: 1em; font-weight: bold;
  font-family: Georgia, serif; letter-spacing: 1px;
  cursor: pointer; transition: filter 0.15s; margin-bottom: 4px;
}
.auth-btn:hover  { filter: brightness(1.15); }
.auth-btn:active { filter: brightness(0.9); }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }

#loginStatus {
  margin-top: 12px; font-size: 0.85em;
  color: #a08040; min-height: 20px; font-style: italic;
}

/* ── Game Canvas ──────────────────────────────────────────────────────────── */

#gameCanvas {
  display: block; position: fixed; inset: 0; cursor: default;
}

/* ── HUD ──────────────────────────────────────────────────────────────────── */

#hud {
  position: fixed; inset: 0; pointer-events: none;
}

#hudTopRight {
  position: absolute; top: 14px; right: 14px;
  display: flex; flex-direction: column; gap: 5px; align-items: flex-end;
  pointer-events: none;
}
#playerCount, #hudGold {
  color: #9a8040; font-size: 0.8em; font-family: monospace;
  background: rgba(7,21,32,0.6); padding: 5px 10px;
  border-radius: 3px; border: 1px solid rgba(139,105,20,0.3);
}
#hudGold { color: #d4a832; }

#hudBottomLeft {
  position: absolute; bottom: 14px; left: 14px;
  color: #9a8040; font-size: 0.78em; font-family: monospace;
  background: rgba(7,21,32,0.6); padding: 5px 10px;
  border-radius: 3px; border: 1px solid rgba(139,105,20,0.3);
}

#hudBottomRight { position: absolute; bottom: 14px; right: 14px; }

#minimapWrap {
  pointer-events: auto;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
}
#minimapWrap:hover #minimap {
  border-color: #d4a832;
  box-shadow: 0 0 16px rgba(212,168,50,0.35);
}
#minimapLabel {
  color: #8a7030; font-size: 0.62em; font-family: monospace;
  letter-spacing: 1px; user-select: none;
  display: flex; align-items: center; gap: 4px;
}
.minimap-key {
  background: rgba(139,105,20,0.25);
  border: 1px solid rgba(139,105,20,0.5);
  color: #c8a030; padding: 0 5px; border-radius: 2px;
  font-size: 0.9em;
}
#minimap {
  display: block; border: 2px solid #8b6914;
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(0,0,0,0.8), 0 0 8px rgba(139,105,20,0.3);
  transition: border-color 0.15s, box-shadow 0.15s;
}

#controls {
  position: absolute; top: 46px; right: 14px;
  color: #6a5828; font-size: 0.72em; font-family: monospace; line-height: 1.7;
  background: rgba(7,21,32,0.5); padding: 6px 10px;
  border-radius: 3px; border: 1px solid rgba(139,105,20,0.2);
}

/* HUD action buttons */
.hud-action-btn {
  position: absolute; pointer-events: auto;
  background: rgba(7,21,32,0.8); border: 1px solid #8b6914;
  color: #c8a030; font-family: Georgia, serif; font-size: 0.8em;
  padding: 6px 12px; border-radius: 3px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.hud-action-btn:hover { background: rgba(255,215,0,0.1); color: #ffd700; }

#inventoryBtn { bottom: 230px; right: 14px; }
.logout-btn   { bottom: 14px; left: 14px; margin-left: 120px; }

/* HP bar */
#hudHp {
  position: absolute; top: 100px; left: 14px;
  background: rgba(7,21,32,0.7);
  border: 1px solid rgba(139,105,20,0.3);
  border-radius: 3px; padding: 6px 10px; min-width: 160px;
}
#hudHpLabel {
  color: #7a6828; font-size: 0.72em; font-family: monospace;
  margin-bottom: 4px; letter-spacing: 1px;
}
#hpBarWrap {
  width: 140px; height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px; overflow: hidden; margin-bottom: 3px;
}
#hpFill {
  height: 100%; width: 100%;
  background: #4ecb6e;
  border-radius: 4px;
  transition: width 0.3s ease, background 0.3s ease;
}
#hpText {
  color: #8a9880; font-size: 0.72em; font-family: monospace;
}

/* Damage flash */
#damageFlash {
  position: fixed; inset: 0; z-index: 290;
  background: rgba(200, 30, 30, 0.35);
  pointer-events: none; opacity: 0;
  transition: opacity 0.4s ease;
}

/* Ship sunk message */
#sunkMessage {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 295; text-align: center;
  background: rgba(7,5,5,0.92);
  border: 2px solid #801010; border-radius: 6px;
  color: #e04040; font-size: 1.6em; font-family: Georgia, serif;
  padding: 28px 48px;
  text-shadow: 0 0 20px rgba(220,40,40,0.6);
  box-shadow: 0 0 40px rgba(180,20,20,0.4);
  letter-spacing: 2px;
  pointer-events: none;
}

/* Dock prompt */
#dockPrompt {
  position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(7,21,32,0.88); border: 1px solid #8b6914;
  color: #ffd700; font-size: 0.95em; font-family: Georgia, serif;
  padding: 10px 22px; border-radius: 4px;
  text-align: center; pointer-events: none;
  animation: pulsePrompt 1.8s ease-in-out infinite;
}
#dockPrompt.error { color: #e07070; border-color: #802020; animation: none; }

@keyframes pulsePrompt {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* ── Cannon reload HUD ───────────────────────────────────────────────────── */

#hudCannon {
  position: absolute; bottom: 268px; right: 14px;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-end;
  pointer-events: none;
}

#cannonReloadWrap {
  width: 140px; height: 6px;
  background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden;
  border: 1px solid rgba(139,105,20,0.4);
}
#cannonReloadFill {
  height: 100%; width: 100%;
  background: #4ecb6e; border-radius: 3px;
  transition: width 0.1s linear, background 0.3s;
}
#cannonAmmo {
  color: #c8a030; font-size: 0.72em; font-family: monospace;
  background: rgba(7,21,32,0.6); padding: 3px 8px;
  border-radius: 3px; border: 1px solid rgba(139,105,20,0.3);
}

/* ── Floating notification ───────────────────────────────────────────────── */

#hudNotification {
  position: absolute; bottom: 140px; left: 50%; transform: translateX(-50%);
  color: #d4c080; font-size: 0.9em; font-family: Georgia, serif;
  background: rgba(7,21,32,0.82); border: 1px solid rgba(139,105,20,0.4);
  padding: 7px 18px; border-radius: 4px;
  pointer-events: none; opacity: 0;
  transition: opacity 0.4s ease;
  white-space: nowrap;
}

/* ── Inventory Panel (Bannerlord-style table) ─────────────────────────────── */

#inventoryPanel {
  position: fixed; top: 50%; right: 14px;
  transform: translateY(-50%);
  width: 440px; max-height: 80vh; z-index: 150;
  background: rgba(7,21,32,0.97);
  border: 1px solid #8b6914; border-radius: 5px;
  box-shadow: 0 0 30px rgba(0,0,0,0.7);
  display: flex; flex-direction: column; overflow: hidden;
}

.inv-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: rgba(139,105,20,0.15);
  border-bottom: 1px solid rgba(139,105,20,0.3);
  flex-shrink: 0;
}
.inv-title { color: #ffd700; font-size: 0.95em; letter-spacing: 1px; }
.inv-close {
  background: none; border: none; color: #7a6030;
  font-size: 1em; cursor: pointer; line-height: 1; transition: color 0.15s;
}
.inv-close:hover { color: #ffd700; }

/* Stats bar */
.inv-stats-bar {
  display: flex; justify-content: space-between;
  padding: 7px 14px; font-size: 0.85em; color: #c8a030;
  flex-shrink: 0;
}
.inv-cargo-label { color: #9a8040; }

/* Cargo bar */
.inv-cargo-bar-wrap {
  height: 4px; background: rgba(255,255,255,0.08);
  margin: 0 14px 8px; border-radius: 2px; overflow: hidden; flex-shrink: 0;
}
.inv-cargo-bar-fill {
  height: 100%; width: 0; background: #4ecb6e;
  border-radius: 2px; transition: width 0.3s, background 0.3s;
}

/* Category filter tabs */
.inv-filter-tabs {
  display: flex; gap: 0; margin: 0 14px 8px; flex-shrink: 0;
  border: 1px solid rgba(139,105,20,0.3); border-radius: 3px; overflow: hidden;
}
.inv-tab {
  flex: 1; padding: 6px 4px; font-size: 0.78em;
  background: rgba(255,255,255,0.02); border: none;
  color: #6a5828; font-family: Georgia, serif;
  cursor: pointer; transition: background 0.12s, color 0.12s;
}
.inv-tab.active { background: rgba(255,215,0,0.1); color: #ffd700; }
.inv-tab:hover:not(.active) { background: rgba(255,255,255,0.05); color: #a08040; }

/* Sortable table */
.inv-table-wrap {
  overflow-y: auto; flex: 1;
}
.inv-table-wrap::-webkit-scrollbar { width: 5px; }
.inv-table-wrap::-webkit-scrollbar-thumb { background: #5a4010; border-radius: 3px; }

#invTable {
  width: 100%; border-collapse: collapse; font-size: 0.83em;
}

.inv-th {
  position: sticky; top: 0; z-index: 1;
  padding: 7px 10px; text-align: left;
  background: rgba(10, 28, 45, 0.98);
  color: #7a6030; font-weight: normal; letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(139,105,20,0.4);
  white-space: nowrap;
}
.inv-th.sortable { cursor: pointer; user-select: none; }
.inv-th.sortable:hover { color: #c8a030; }
.inv-th.active-sort { color: #ffd700; }
.sort-icon { font-size: 0.85em; margin-left: 3px; opacity: 0.7; }

.inv-row td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #b0a060;
}
.inv-row:hover td { background: rgba(255,255,255,0.03); }
.inv-row:last-child td { border-bottom: none; }

.inv-name { color: #e0c880; font-weight: bold; }
.inv-cat  { color: #8a8060; font-size: 0.9em; text-transform: capitalize; }
.inv-num  { text-align: right; color: #9a8c60; }
.inv-total { color: #c8a830 !important; }

/* Category row tints */
.inv-cat-combat    td { background: rgba(180, 60, 60, 0.04); }
.inv-cat-equipment td { background: rgba(60, 120, 180, 0.05); }

.inv-empty-cell {
  text-align: center; padding: 20px;
  color: #4a3818; font-style: italic;
}

/* ── Port Overlay ─────────────────────────────────────────────────────────── */

#portOverlay {
  position: fixed; inset: 0; z-index: 300;
  display: flex; flex-direction: column;
  background: #050e18;
}

#portHeader {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px; background: rgba(0,0,0,0.5);
  border-bottom: 1px solid rgba(139,105,20,0.4);
  flex-shrink: 0;
}
#portName {
  font-size: 1.6em; color: #ffd700;
  text-shadow: 0 0 20px rgba(255,215,0,0.4); letter-spacing: 2px;
}
#leavePortBtn {
  background: rgba(139,105,20,0.2); border: 1px solid #8b6914;
  color: #c8a030; font-family: Georgia, serif; font-size: 0.9em;
  padding: 8px 18px; border-radius: 4px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
#leavePortBtn:hover { background: rgba(255,215,0,0.15); color: #ffd700; }

#portError {
  background: rgba(150,30,30,0.9);
  border: 1px solid #802020; color: #ffaaaa;
  padding: 8px 20px; text-align: center;
  font-size: 0.9em; flex-shrink: 0;
}

/* ── Port Scene (buildings) ───────────────────────────────────────────────── */

#portScenePage {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

#portSky {
  flex: 1;
  background: linear-gradient(to bottom,
    #04080f 0%, #071520 25%, #0d2840 55%, #1a3d5a 75%, #2a6888 88%, #8a6030 100%);
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 0;
}

#portBuildingsRow {
  display: flex; justify-content: center; align-items: flex-end;
  gap: 18px; padding: 0 30px;
  position: relative; z-index: 2;
  background: linear-gradient(to bottom, transparent, rgba(4,10,18,0.3));
}

/* Individual buildings */
.port-building {
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s;
  user-select: none;
}
.port-building:hover { transform: translateY(-8px); filter: brightness(1.25); }
.port-building:active { transform: translateY(-4px); filter: brightness(1.1); }

/* Roofs — CSS triangle trick */
.building-roof {
  width: 0; height: 0;
}
.tavern-roof {
  border-left: 75px solid transparent;
  border-right: 75px solid transparent;
  border-bottom: 55px solid #7a1a1a;
}
.market-roof {
  border-left: 90px solid transparent;
  border-right: 90px solid transparent;
  border-bottom: 44px solid #1a4880;
}
.ship-roof {
  border-left: 70px solid transparent;
  border-right: 70px solid transparent;
  border-bottom: 48px solid #2a4040;
}
.dock-roof {
  border-left: 95px solid transparent;
  border-right: 95px solid transparent;
  border-bottom: 36px solid #3a3a2a;
}
.bank-roof {
  border-left: 85px solid transparent;
  border-right: 85px solid transparent;
  border-bottom: 50px solid #3c3830;
}

/* Building bodies */
.building-body {
  display: flex; flex-direction: column; align-items: center;
  justify-content: space-between;
  padding: 10px 8px 0; border: 2px solid rgba(0,0,0,0.5);
}

.tavern-body {
  width: 150px; height: 155px;
  background: linear-gradient(to bottom, #5a3010, #4a2808);
  border-color: #3a1e08;
}
.market-body {
  width: 180px; height: 148px;
  background: linear-gradient(to bottom, #c09040, #a07030);
  border-color: #7a5018;
}
.ship-body {
  width: 140px; height: 145px;
  background: linear-gradient(to bottom, #3a4a5a, #2a3848);
  border-color: #1a2838;
}
.dock-body {
  width: 190px; height: 135px;
  background: linear-gradient(to bottom, #4a4838, #3a3828);
  border-color: #2a2818;
}
.bank-body {
  width: 170px; height: 150px;
  background: linear-gradient(to bottom, #8a8070, #6a6050);
  border-color: #4a4038;
}

/* Building sign */
.building-sign {
  background: rgba(0,0,0,0.5);
  color: #ffd700; font-size: 0.68em; font-weight: bold;
  padding: 3px 8px; border: 1px solid rgba(255,215,0,0.25);
  letter-spacing: 1px; text-align: center; white-space: nowrap;
}

/* Windows */
.building-windows { display: flex; gap: 10px; }
.building-window {
  width: 22px; height: 22px;
  background: rgba(255,220,100,0.55);
  border: 2px solid rgba(0,0,0,0.35);
  box-shadow: 0 0 8px rgba(255,200,50,0.4);
}

/* Door */
.building-door {
  width: 28px; height: 46px;
  background: #1a0e04;
  border: 2px solid rgba(0,0,0,0.5);
  border-radius: 4px 4px 0 0;
  margin-top: auto;
}
.wide-door { width: 40px; }

/* Bank columns */
.building-columns {
  display: flex; gap: 16px; margin-top: 8px;
}
.column {
  width: 12px; height: 70px;
  background: linear-gradient(to right, #a09880, #d0c8b0, #a09880);
  border-radius: 2px;
}

/* Building label below */
.building-label {
  margin-top: 10px;
  color: #c8a040; font-size: 0.8em; font-weight: bold;
  letter-spacing: 1px; text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* Dock planks */
#portDock {
  height: 64px; flex-shrink: 0;
  background: repeating-linear-gradient(
    90deg,
    #5a3a1a 0px, #5a3a1a 78px,
    #4a2e12 78px, #4a2e12 82px
  );
  border-top: 5px solid #3a2010;
  border-bottom: 3px solid #2a1808;
  box-shadow: inset 0 -6px 16px rgba(0,0,0,0.5), 0 -4px 14px rgba(0,0,0,0.6);
}

/* ── Port Sub-panel ───────────────────────────────────────────────────────── */

#portSubPage {
  flex: 1; flex-direction: column; overflow: hidden;
  background: rgba(5,14,22,0.98);
}

#portSubHeader {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 22px; border-bottom: 1px solid rgba(139,105,20,0.3);
  flex-shrink: 0; background: rgba(0,0,0,0.3);
}
#portBackBtn {
  background: rgba(139,105,20,0.2); border: 1px solid #6a5010;
  color: #c8a030; font-family: Georgia, serif; font-size: 0.85em;
  padding: 6px 14px; border-radius: 3px; cursor: pointer;
  transition: background 0.15s;
}
#portBackBtn:hover { background: rgba(255,215,0,0.12); color: #ffd700; }
#portSubTitle { font-size: 1.2em; color: #ffd700; letter-spacing: 1px; }

#portSubContent {
  flex: 1; overflow-y: auto; padding: 24px;
}
#portSubContent::-webkit-scrollbar { width: 6px; }
#portSubContent::-webkit-scrollbar-thumb { background: #5a4010; border-radius: 3px; }

/* Marketplace */
.market-header {
  display: flex; gap: 20px; margin-bottom: 14px; flex-wrap: wrap;
}
.gold-badge, .cargo-badge {
  background: rgba(139,105,20,0.2); border: 1px solid rgba(139,105,20,0.4);
  color: #ffd700; padding: 6px 14px; border-radius: 3px; font-size: 0.9em;
}
.cargo-badge { color: #b0a060; }
.gold-badge.standalone { display: inline-block; margin-bottom: 18px; }

.shop-scroll { overflow-x: auto; }

.shop-table {
  width: 100%; border-collapse: collapse; font-size: 0.88em;
  color: #c0a060;
}
.shop-table th {
  padding: 8px 12px; text-align: left;
  background: rgba(139,105,20,0.15);
  border-bottom: 2px solid rgba(139,105,20,0.3);
  color: #8a7040; font-weight: normal; letter-spacing: 1px;
}
.shop-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.shop-table tr:hover td { background: rgba(255,255,255,0.03); }
.item-name  { color: #e0c880; font-weight: bold; }
.buy-price  { color: #e06060; }
.sell-price { color: #60c060; }
.item-owned { color: #8a9890; }

.qty-input {
  width: 60px; padding: 4px 6px;
  background: rgba(255,255,255,0.06); border: 1px solid #5a4510;
  color: #f0d090; border-radius: 3px; font-size: 0.9em;
  text-align: center; outline: none;
}
.qty-input:focus { border-color: #ffd700; }

.action-btns { display: flex; gap: 6px; }

.shop-btn {
  padding: 5px 12px;
  border: 1px solid; border-radius: 3px;
  font-family: Georgia, serif; font-size: 0.82em;
  cursor: pointer; transition: filter 0.12s;
}
.buy-btn  { background: rgba(60,120,60,0.25); border-color: #406040; color: #80d080; }
.sell-btn { background: rgba(120,60,60,0.25); border-color: #604040; color: #d08080; }
.shop-btn:hover:not(:disabled) { filter: brightness(1.3); }
.shop-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Upgrade grid */
.upgrade-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin-top: 8px;
}
.upgrade-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(139,105,20,0.3); border-radius: 5px;
  padding: 16px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.15s;
}
.upgrade-card:hover:not(.locked) { border-color: rgba(255,215,0,0.4); }
.upgrade-card.locked { opacity: 0.5; }
.upgrade-name { color: #ffd700; font-size: 0.9em; font-weight: bold; }
.upgrade-desc { color: #8a9880; font-size: 0.82em; font-style: italic; }
.upgrade-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.upgrade-cost { color: #d4a832; font-size: 0.88em; }
.upgrade-btn {
  background: rgba(139,105,20,0.2); border-color: #6a5010; color: #c8a030;
}

/* Info panels (tavern, shipwright, bank) */
.port-info-msg {
  color: #b0a060; line-height: 1.8; font-size: 0.95em; text-align: center;
  padding: 20px; max-width: 480px; margin: 0 auto;
}
.port-info-msg p { margin-bottom: 14px; }
.dim-text { color: #6a5828 !important; font-style: italic; }
.coming-soon { color: #4a4028 !important; font-size: 0.85em; font-style: italic; margin-top: 24px; }

/* Ship health bar */
.ship-health-bar {
  width: 100%; max-width: 300px; height: 14px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 7px; overflow: hidden; margin: 12px auto;
}
.ship-health-fill {
  height: 100%;
  background: linear-gradient(to right, #3a8840, #4ecb6e);
  border-radius: 7px;
}

/* Repair section */
.repair-section { margin-top: 16px; }
.repair-info { color: #9a8040; font-size: 0.88em; margin-bottom: 12px; }
.repair-btn {
  background: rgba(60,120,60,0.25); border-color: #406040; color: #80d080;
  font-size: 0.9em; padding: 8px 20px;
}
.red-text { color: #e06060 !important; }

/* Bank balance (legacy, kept for safety) */
.bank-balance {
  font-size: 2.4em; color: #ffd700;
  text-shadow: 0 0 20px rgba(255,215,0,0.3);
  margin: 18px 0; letter-spacing: 2px;
}

/* ── Bank UI ──────────────────────────────────────────────────────────────── */

.bank-layout {
  display: flex; flex-direction: column; gap: 20px;
  max-width: 500px; margin: 0 auto; text-align: left;
}

.bank-summary {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(139,105,20,0.3);
  border-radius: 6px; padding: 14px 18px;
}

.bank-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.bank-row:last-child { border-bottom: none; }
.bank-label { color: #8a7830; font-size: 0.88em; }
.bank-amount { font-size: 1.1em; letter-spacing: 1px; font-weight: bold; }
.bank-amount.carried { color: #e8c84a; }
.bank-amount.vaulted { color: #6aafe0; }

.bank-tip {
  margin-top: 10px; font-size: 0.78em;
  color: #5a4820 !important; text-align: center; line-height: 1.6;
}

.bank-actions {
  display: flex; gap: 14px;
}
.bank-action-group {
  flex: 1; display: flex; flex-direction: column; gap: 8px;
}
.bank-action-label {
  color: #9a8040; font-size: 0.82em; text-transform: uppercase; letter-spacing: 1px;
}
.bank-input-row {
  display: flex; gap: 6px;
}
.bank-input {
  flex: 1; background: rgba(0,0,0,0.4); border: 1px solid #5a4510;
  color: #e8d090; padding: 7px 10px; border-radius: 3px;
  font-family: Georgia, serif; font-size: 0.9em;
  outline: none;
}
.bank-input:focus { border-color: #8b6914; }
.bank-max-btn {
  padding: 6px 10px; font-size: 0.78em; white-space: nowrap;
}
.bank-action-btn {
  padding: 9px 12px; font-size: 0.88em; text-align: center; width: 100%;
}
.deposit-btn  { background: rgba(40,120,60,0.25); border-color: #305040; color: #70d090; }
.withdraw-btn { background: rgba(60,80,180,0.25); border-color: #304080; color: #80a0e0; }
.deposit-btn:hover:not(:disabled)  { background: rgba(40,140,70,0.4); color: #90e8a8; }
.withdraw-btn:hover:not(:disabled) { background: rgba(60,90,200,0.4); color: #a0b8f0; }

/* ── HUD ship type badge ──────────────────────────────────────────────────── */
#hudShipType {
  color: #9ac0e0; font-size: 0.82em;
  background: rgba(0,0,0,0.3); border: 1px solid rgba(100,160,200,0.25);
  border-radius: 3px; padding: 2px 8px;
}
#hudBank {
  color: #6aafe0;
}

/* ── Dry Dock owned ship ─────────────────────────────────────────────────── */
.upgrade-card.owned {
  border-color: rgba(100,200,120,0.4);
  background: rgba(40,100,60,0.15);
}
.upgrade-card.owned .upgrade-cost { color: #70d090; }

/* ── Full World Map Overlay ─────────────────────────────────────────────────── */

#fullMapOverlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(2, 8, 16, 0.97);
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding: 6px;
  gap: 6px;
  backdrop-filter: blur(4px);
}

#fullMapHeader {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  background: rgba(7,21,32,0.9);
  border: 1px solid rgba(139,105,20,0.5); border-radius: 4px;
  padding: 7px 14px;
  flex-shrink: 0;
}

#fullMapTitle {
  color: #ffd700; font-size: 1.1em; letter-spacing: 2px;
  text-shadow: 0 0 16px rgba(255,215,0,0.3);
}

#fullMapLegend {
  display: flex; align-items: center; gap: 6px;
  color: #8a7830; font-size: 0.78em; font-family: monospace;
}
.map-legend-dot {
  display: inline-block; width: 9px; height: 9px;
  border-radius: 50%; vertical-align: middle;
}

#fullMapCloseBtn {
  background: rgba(139,105,20,0.2); border: 1px solid #6a5010;
  color: #c8a030; font-family: Georgia, serif; font-size: 0.85em;
  padding: 6px 14px; border-radius: 3px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
#fullMapCloseBtn:hover { background: rgba(255,215,0,0.12); color: #ffd700; }

#fullMapBody {
  display: flex; align-items: center; justify-content: center;
  flex: 1;
}

#fullMapCanvas {
  border: 2px solid rgba(139,105,20,0.5);
  border-radius: 4px;
  box-shadow: 0 0 40px rgba(0,0,0,0.8), inset 0 0 60px rgba(0,0,0,0.3);
}

/* ── Island Overlay ───────────────────────────────────────────────────────── */

#islandOverlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(2,8,16,0.96);
  display: flex; flex-direction: column;
  align-items: stretch;
  padding: 0;
  backdrop-filter: blur(4px);
  max-width: 860px; margin: auto;
  top: 40px; bottom: 40px; left: 50%; transform: translateX(-50%);
  border: 1px solid rgba(139,105,20,0.5);
  border-radius: 8px;
  overflow: hidden;
}

#islandOverlayHeader {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: rgba(7,21,32,0.95);
  border-bottom: 1px solid rgba(139,105,20,0.35);
  flex-shrink: 0;
}

#islandOverlayTitle {
  font-size: 1.3em; color: #ffd700; letter-spacing: 2px;
  text-shadow: 0 0 16px rgba(255,215,0,0.3);
}

#islandCloseBtn {
  background: rgba(139,105,20,0.2); border: 1px solid #6a5010;
  color: #c8a030; font-family: Georgia, serif; font-size: 0.85em;
  padding: 6px 14px; border-radius: 3px; cursor: pointer;
}
#islandCloseBtn:hover { background: rgba(255,215,0,0.12); color: #ffd700; }

#islandError {
  background: rgba(140,30,30,0.7); color: #ffaaaa;
  padding: 8px 20px; font-size: 0.88em;
  border-bottom: 1px solid rgba(200,60,60,0.4);
  flex-shrink: 0;
}

#islandTabsRow {
  display: flex; gap: 0;
  background: rgba(7,21,32,0.8);
  border-bottom: 1px solid rgba(139,105,20,0.3);
  flex-shrink: 0;
}

.island-tab {
  flex: 1; padding: 10px 6px;
  background: transparent; border: none; border-right: 1px solid rgba(139,105,20,0.2);
  color: #8a7830; cursor: pointer; font-family: Georgia, serif; font-size: 0.88em;
  transition: background 0.15s, color 0.15s;
}
.island-tab:last-child { border-right: none; }
.island-tab:hover    { background: rgba(255,215,0,0.06); color: #c8a030; }
.island-tab.active   { background: rgba(139,105,20,0.18); color: #ffd700; border-bottom: 2px solid #ffd700; }

#islandContent {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  color: #b0a060;
}

/* Info tab */
.island-info-layout { display: flex; flex-direction: column; gap: 10px; }
.island-info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.9em;
}
.island-info-row span:first-child { color: #7a6828; }
.island-info-table {
  width: 100%; border-collapse: collapse; font-size: 0.88em; margin-top: 8px;
}
.island-info-table th {
  text-align: left; color: #7a6828; padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.island-info-table td { padding: 5px 8px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.green-text  { color: #70d090 !important; }

/* Manage tab */
.island-manage-layout { display: flex; flex-direction: column; gap: 12px; }
.island-section-title {
  color: #9a8040; font-size: 0.88em; text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 6px;
}
.island-action-btn {
  width: 100%; margin-top: 14px; padding: 10px; font-size: 0.95em; text-align: center;
}
.disabled-btn { opacity: 0.45; cursor: not-allowed; }

/* Claim tab */
.island-section { max-width: 460px; margin: 0 auto; text-align: center; line-height: 1.9; }
.island-section p { margin-bottom: 10px; }

/* Stash tab */
.island-stash-layout { display: flex; gap: 14px; height: 100%; }
.island-stash-half { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* Owned badge on upgrade cards */
.upgrade-card.owned { border-color: rgba(100,200,120,0.4); background: rgba(40,100,60,0.15); }
.upgrade-card.owned .upgrade-cost { color: #70d090; }
