*, *::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;
}

.auth-small-link {
  color: #c8a84a; font-size: 0.82em; text-decoration: underline; cursor: pointer;
}
.auth-small-link:hover { color: #ffd700; }

.auth-hint {
  font-size: 0.83em; color: #a09060; margin: 0 0 8px; text-align: center;
}

/* ── Change name modal ────────────────────────────────────────────────────── */
#changeNameModal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
#changeNameBox {
  background: rgba(15, 25, 40, 0.97);
  border: 1px solid rgba(180, 140, 60, 0.5);
  border-radius: 10px;
  padding: 28px 32px;
  width: 320px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.7);
}
#changeNameTitle {
  font-size: 1.15em; font-weight: bold; color: #ffd700;
  text-align: center; margin-bottom: 4px;
  font-family: 'Georgia', serif;
}
#changeNameStatus {
  font-size: 0.83em; color: #a08040; min-height: 18px;
  text-align: center; font-style: italic;
}
.settings-btn {
  right: 120px !important;
}

/* ── 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: 140px; 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;
}

/* ── Island capture prompt ──────────────────────────────────────────────── */

#capturePrompt {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 300; background: rgba(0,0,0,0.55);
  pointer-events: auto;
}
#capturePromptInner {
  background: rgba(7,21,32,0.97); border: 2px solid #c8a030;
  border-radius: 8px; padding: 32px 40px; max-width: 440px; width: 90%;
  text-align: center; box-shadow: 0 0 50px rgba(200,160,48,0.3);
  font-family: Georgia, serif;
}
#capturePromptTitle {
  color: #ffd700; font-size: 1.4em; letter-spacing: 2px; margin-bottom: 14px;
  text-shadow: 0 0 14px rgba(255,215,0,0.5);
}
#capturePromptBody {
  color: #c8b880; font-size: 0.95em; line-height: 1.55; margin-bottom: 24px;
}
#capturePromptBtns { display: flex; gap: 14px; justify-content: center; }
.capture-btn {
  padding: 10px 26px; border: none; border-radius: 4px;
  font-family: Georgia, serif; font-size: 0.95em; cursor: pointer;
  transition: filter 0.15s;
}
.capture-btn:hover { filter: brightness(1.2); }
.capture-btn-yes { background: #8b1c1c; color: #ffd700; border: 1px solid #c8a030; }
.capture-btn-no  { background: rgba(255,255,255,0.08); color: #a0a0a0; border: 1px solid #555; }

/* 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; position: relative;
}

#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-cell { display: flex; align-items: center; gap: 3px; }
.qty-input {
  width: 52px; padding: 4px 4px;
  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; }
.qty-preset-btn {
  padding: 3px 6px; font-size: 0.75em; line-height: 1;
  background: rgba(60,50,10,0.5); border: 1px solid #5a4510;
  color: #b09040; border-radius: 3px; cursor: pointer; white-space: nowrap;
}
.qty-preset-btn:hover { background: rgba(100,80,20,0.5); 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; }

/* Quest UI */
.tavern-wrap { max-width: 520px; }
.quest-offer-box {
  margin-top: 18px; padding: 14px 16px;
  background: rgba(139,105,20,0.1); border: 1px solid rgba(139,105,20,0.3); border-radius: 4px;
}
.quest-reward-line { margin-bottom: 12px; color: #a09050; font-size: 0.88em; }
.quest-reward { color: #ffd700; font-weight: bold; }
.manage-island-btn {
  position: absolute; bottom: 72px; left: 50%; transform: translateX(-50%);
  background: rgba(80,60,20,0.5); border-color: #806030; color: #c0a050;
  padding: 7px 18px; font-size: 0.88em; z-index: 10;
}
.manage-island-btn:hover { filter: brightness(1.3); }
.quest-accept-btn {
  background: rgba(60,130,60,0.3); border-color: #507050; color: #90e090;
  padding: 8px 20px; font-size: 0.92em;
}
.quest-accept-btn:hover { filter: brightness(1.2); }
.quest-complete-btn {
  background: rgba(180,130,20,0.3); border-color: #a09030; color: #ffd060;
  padding: 8px 20px; font-size: 0.92em; margin-top: 12px;
}
.quest-complete-btn:hover { filter: brightness(1.2); }
.quest-phase-title { color: #c0a040; font-size: 1em; font-weight: bold; margin-bottom: 14px; }
.quest-step {
  display: flex; gap: 12px; align-items: flex-start;
  margin-bottom: 10px; color: #7a6838; font-size: 0.88em;
}
.quest-step.active { color: #d0c080; }
.quest-step.done   { color: #507050; }
.quest-step-num {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(139,105,20,0.2); border: 1px solid rgba(139,105,20,0.4);
  display: flex; align-items: center; justify-content: center; font-size: 0.82em;
}
.quest-step.active .quest-step-num { background: rgba(180,140,30,0.3); border-color: #a09030; color: #ffd700; }
.quest-step.done   .quest-step-num { background: rgba(50,100,50,0.3);  border-color: #507050; color: #70c070; }
.quest-here-tag {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  background: rgba(50,120,50,0.3); border: 1px solid #507050;
  border-radius: 3px; color: #70d070; font-size: 0.82em; font-style: normal;
}
.quest-progress { font-size: 0.82em; margin-top: 8px; }

/* 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: #050e18;
  display: flex; flex-direction: column;
  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; }

/* ── Stat upgrade list (Dry Dock R6) ────────────────────────────────────────── */
.stat-upgrade-list {
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto; flex: 1; padding-right: 2px;
}
.stat-row {
  display: grid;
  grid-template-columns: 1fr 60px 80px 70px 80px auto;
  align-items: center; gap: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 5px; padding: 6px 8px;
  font-size: 0.83em;
}
.stat-row:hover { background: rgba(255,255,255,0.07); }
.stat-name    { color: #e8d090; font-weight: 600; }
.stat-level   { color: #a09050; text-align: center; }
.stat-current { color: #78b878; text-align: right; }
.stat-next    { color: #a0c8ff; text-align: right; font-style: italic; }
.stat-cost    { color: #d4a832; text-align: right; }
.stat-upgrade-btn {
  background: rgba(139,105,20,0.25); border: 1px solid #6a5010;
  color: #c8a030; padding: 3px 8px; border-radius: 4px;
  cursor: pointer; font-size: 0.9em; white-space: nowrap;
}
.stat-upgrade-btn:hover:not([disabled]) {
  background: rgba(180,140,30,0.4); border-color: #c8a030;
}
.stat-upgrade-btn[disabled] { opacity: 0.45; cursor: default; }


/* ── Island Scene Page ───────────────────────────────────────────────────────── */
#islandScenePage {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, #1a2e1a 0%, #243824 40%, #2e4828 100%);
}

#islandSky {
  height: 72px; flex-shrink: 0;
  background: linear-gradient(180deg, #0a180a 0%, #142414 50%, #1e3418 100%);
  position: relative;
}
/* Stars in the island sky */
#islandSky::before {
  content: '✦ ✧ ✦ ✧ ✦ ✧ ✦ ✧ ✦';
  position: absolute; top: 14px; left: 0; right: 0;
  text-align: center; color: rgba(255,255,220,0.35); font-size: 10px;
  letter-spacing: 18px;
}

#islandBuildingsRow {
  flex: 1; display: flex; align-items: flex-end; justify-content: center;
  gap: 28px; padding: 0 40px 0 40px; min-height: 180px;
}

#islandGround {
  height: 38px; flex-shrink: 0;
  background: linear-gradient(180deg, #5a3820 0%, #432a14 100%);
  border-top: 3px solid #7a4e28;
}

/* ── Island Sub-Page (building interior) ─────────────────────────────────────── */
#islandSubPage {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

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

#islandSubTitle { font-size: 1.05em; color: #ffd700; letter-spacing: 1px; }

#islandBackBtn {
  background: rgba(60,100,40,0.25); border: 1px solid #405820;
  color: #90c060; font-family: Georgia, serif; font-size: 0.85em;
  padding: 6px 14px; border-radius: 3px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
#islandBackBtn:hover { background: rgba(100,180,60,0.15); color: #b0e080; }

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

/* ── Island building (same hover as port building) ───────────────────────────── */
.island-building { cursor: pointer; }
.island-building:hover  { transform: translateY(-8px) !important; filter: brightness(1.3); }
.island-building:active { transform: translateY(-4px) !important; filter: brightness(1.1); }

/* Building level chip */
.bldg-lvl-chip {
  font-size: 0.74em; background: rgba(139,105,20,0.4);
  color: #ffd700; padding: 1px 5px; border-radius: 3px; margin-left: 3px;
}

/* ── Governor's House variants ───────────────────────────────────────────────── */

/* Run-down (unclaimed) */
.govhouse-rundown-roof {
  width: 68px; height: 32px;
  background: #4a3018;
  clip-path: polygon(0% 100%, 50% 0%, 100% 100%);
  margin: 0 auto; opacity: 0.85;
}
.govhouse-rundown-body {
  width: 68px; height: 65px;
  background: #5c3c20;
  border: 2px solid #3a2408;
  margin: 0 auto; position: relative;
}
.govhouse-broken-window {
  width: 20px !important; height: 18px !important;
  opacity: 0.4; border-color: #666 !important;
  background: rgba(20,20,20,0.6) !important;
}

/* Claimed (proper governor's house) */
.govhouse-claimed-roof {
  width: 108px; height: 44px;
  background: linear-gradient(135deg, #8a6028 0%, #a87840 50%, #8a6028 100%);
  clip-path: polygon(0% 100%, 50% 0%, 100% 100%);
  margin: 0 auto;
}
.govhouse-claimed-body {
  width: 108px; height: 88px;
  background: linear-gradient(180deg, #9a7838 0%, #88682a 100%);
  border: 2px solid #6a4820;
  margin: 0 auto; position: relative;
}

/* ── Governor's House sub-panel (owner tabs) ─────────────────────────────────── */
.gov-house-panel {
  display: flex; flex-direction: column; height: 100%;
}
.gov-house-tabs {
  display: flex; border-bottom: 1px solid rgba(139,105,20,0.35); flex-shrink: 0;
  margin-bottom: 12px;
}
.gov-tab {
  flex: 1; padding: 9px 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;
}
.gov-tab:last-child { border-right: none; }
.gov-tab:hover  { background: rgba(255,215,0,0.06); color: #c8a030; }
.gov-tab.active { background: rgba(139,105,20,0.18); color: #ffd700; border-bottom: 2px solid #ffd700; }
.gov-house-content { flex: 1; overflow-y: auto; }


/* ═══════════════════════════════════════════════════════════════════════════ */
/* ── Chat Widget ──────────────────────────────────────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════ */

#chatWidget {
  position: fixed;
  bottom: 52px;
  left: 14px;
  width: 260px;
  z-index: 500;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  display: none;   /* hidden until game starts — game.js sets display:flex */
  flex-direction: column-reverse;
  align-items: stretch;
  pointer-events: auto;
}

/* Collapsed tab strip */
#chatTab {
  background: rgba(10, 24, 40, 0.88);
  border: 1px solid rgba(180, 140, 60, 0.4);
  border-top: none;
  border-radius: 0 0 6px 6px;
  color: #c8a030;
  padding: 5px 14px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  letter-spacing: 0.5px;
  transition: background 0.15s;
  text-align: center;
}
#chatTab:hover,
#chatTab.chat-collapsed-active { background: rgba(20, 42, 70, 0.95); color: #ffd700; }

/* Expanded panel — grows upward */
#chatPanel {
  width: 100%;
  height: 300px;
  background: rgba(6, 16, 28, 0.94);
  border: 1px solid rgba(180, 140, 60, 0.45);
  border-radius: 6px 6px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Panel header */
#chatPanelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(20, 42, 68, 0.95);
  border-bottom: 1px solid rgba(180, 140, 60, 0.3);
  padding: 0 6px 0 0;
  flex-shrink: 0;
}

#chatTabRow {
  display: flex;
  flex: 1;
}

.chat-tab-btn {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #8a7040;
  padding: 7px 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
  position: relative;
}
.chat-tab-btn:hover   { color: #c8a030; }
.chat-tab-btn.active  { color: #ffd700; border-bottom-color: #ffd700; }

/* Unread badge */
.chat-badge {
  position: absolute;
  top: 3px;
  right: 2px;
  background: #c03030;
  color: #fff;
  font-size: 9px;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 6px;
  pointer-events: none;
}

#chatClose {
  background: none;
  border: none;
  color: #6a5030;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
}
#chatClose:hover { color: #ffd700; }

/* Message body */
#chatBody {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
}
#chatBody::-webkit-scrollbar       { width: 4px; }
#chatBody::-webkit-scrollbar-thumb { background: #3a2a10; border-radius: 2px; }

/* Input row */
#chatInputRow {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: rgba(10, 24, 40, 0.9);
  border-top: 1px solid rgba(180, 140, 60, 0.25);
  flex-shrink: 0;
}
#chatInput {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(180,140,60,0.3);
  border-radius: 4px;
  color: #e8e0c8;
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  font-family: inherit;
}
#chatInput:focus { border-color: rgba(255,215,0,0.5); background: rgba(255,255,255,0.09); }
#chatInput::placeholder { color: #5a4a28; }
#chatSend {
  background: rgba(139,105,20,0.3);
  border: 1px solid rgba(180,140,60,0.4);
  border-radius: 4px;
  color: #c8a030;
  padding: 5px 9px;
  cursor: pointer;
  font-size: 13px;
}
#chatSend:hover { background: rgba(180,140,30,0.45); color: #ffd700; }

/* Individual messages */
.chat-msg {
  font-size: 12px;
  line-height: 1.4;
  color: #c8bfa0;
  word-break: break-word;
}
.chat-ts   { color: #50402a; font-size: 10px; margin-right: 3px; }
.chat-name { color: #d4a832; font-weight: 600; }
.chat-kill-feed { color: #c06060; font-style: italic; }
.chat-info-msg {
  color: #7a6840;
  font-size: 12px;
  padding: 8px 4px;
  line-height: 1.5;
}

/* ── Crew tab content ─────────────────────────────────────────────────────── */
.crew-section       { padding: 4px 2px; }
.crew-section-title { color: #c8a030; font-size: 11px; font-weight: 600; letter-spacing: 0.5px; margin-bottom: 6px; text-transform: uppercase; }
.crew-empty         { color: #5a4a28; font-size: 12px; font-style: italic; padding: 4px 0; }

.crew-create-row {
  display: flex;
  gap: 6px;
}
.crew-text-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(180,140,60,0.3);
  border-radius: 4px;
  color: #e8e0c8;
  font-size: 12px;
  padding: 4px 8px;
  outline: none;
  font-family: inherit;
}
.crew-text-input:focus { border-color: rgba(255,215,0,0.5); }

.crew-invite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  padding: 5px 7px;
  margin-bottom: 4px;
  font-size: 12px;
  color: #c0b090;
  gap: 6px;
}

.crew-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 8px;
  border-bottom: 1px solid rgba(180,140,60,0.2);
  margin-bottom: 4px;
  flex-shrink: 0;
}
.crew-name-display   { color: #ffd700; font-weight: 600; font-size: 13px; }
.crew-member-count   { color: #6a5830; font-size: 11px; }

.crew-chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  padding: 2px 0;
}
.crew-chat-log::-webkit-scrollbar       { width: 4px; }
.crew-chat-log::-webkit-scrollbar-thumb { background: #3a2a10; border-radius: 2px; }

.crew-actions {
  display: flex;
  gap: 6px;
  padding: 6px 0 4px;
  flex-shrink: 0;
}
.crew-action-btn { font-size: 11px; padding: 4px 10px; }
.crew-leave-btn  {
  font-size: 11px; padding: 4px 10px;
  background: rgba(120,30,30,0.25);
  border: 1px solid rgba(160,40,40,0.4);
  color: #c06060;
}
.crew-leave-btn:hover { background: rgba(160,40,40,0.4); color: #ff8080; }

.crew-search-dropdown {
  background: rgba(10, 24, 40, 0.97);
  border: 1px solid rgba(180,140,60,0.4);
  border-radius: 4px;
  margin-top: 2px;
  max-height: 120px;
  overflow-y: auto;
}
.crew-search-item {
  padding: 5px 10px;
  font-size: 12px;
  color: #c8bfa0;
  cursor: pointer;
}
.crew-search-item:hover { background: rgba(180,140,30,0.15); color: #ffd700; }

/* ── Island ban timers ────────────────────────────────────────────────────── */
#banTimers {
  position: fixed;
  top: 90px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 200;
  pointer-events: none;
}
.ban-entry {
  background: rgba(120, 20, 20, 0.82);
  border: 1px solid rgba(220, 80, 80, 0.5);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 12px;
  color: #ffaaaa;
  font-family: 'Georgia', serif;
  text-shadow: 0 1px 3px #000;
}
