:root {
  --bg-sea-deep: #08203e;
  --bg-sea-bright: #1b4d79;
  --sand-gold: #e2a850;
  --sand-light: #fdf5e6;
  --parchment: #fcf6e8;
  --parchment-border: #c8ad7f;
  --parchment-dark: #e8d7ba;
  --marble-white: #f5f6fa;
  --marble-shadow: rgba(26, 32, 44, 0.2);
  --terracotta: #c85a32;
  --terracotta-dark: #963819;
  --text-dark: #2c2518;
  --text-muted: #6e6454;
  --gold-glow: rgba(245, 158, 11, 0.45);
  --greek-blue: #0d63b8;
  --emerald: #10b981;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', sans-serif;
  background: radial-gradient(circle at 50% 10%, #1f5f99 0%, #0c2540 85%, #051424 100%);
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background ambient island waves effect */
.sea-waves {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: 
    radial-gradient(ellipse at 20% 80%, rgba(20, 184, 166, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(245, 158, 11, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* App wrapper */
#aywarApp {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* TOP STATUS BAR - IKARIAM RESOURCE STRIP */
#topBar {
  background: linear-gradient(180deg, #2b1d0c 0%, #170f06 100%);
  border-bottom: 2px solid var(--sand-gold);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
  z-index: 100;
}

.polis-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.polis-logo {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #fff7ed 0%, var(--sand-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(226, 168, 80, 0.3);
}

.city-select-pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--sand-gold);
  color: #fff;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.city-select-pill:hover {
  background: rgba(226, 168, 80, 0.25);
}

/* Resource Strip */
.resource-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.resource-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(226, 168, 80, 0.3);
  color: #f8fafc;
  font-size: 0.85rem;
  font-weight: 600;
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.resource-item:hover {
  background: rgba(226, 168, 80, 0.18);
  border-color: var(--sand-gold);
  box-shadow: 0 0 10px rgba(226, 168, 80, 0.3);
}

.resource-icon {
  font-size: 1.1rem;
}

.resource-rate {
  font-size: 0.7rem;
  color: #34d399;
  margin-left: 2px;
}

/* RESOURCE HOVER TOOLTIPS (WHERE TO GET INSTRUCTIONS) */
.res-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: 290px;
  background: linear-gradient(165deg, #1c140b 0%, #100b06 100%);
  border: 1.5px solid var(--sand-gold);
  border-radius: 12px;
  padding: 14px 16px;
  color: #f1f5f9;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.85), 0 0 18px rgba(226, 168, 80, 0.25);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s;
  z-index: 1000;
  text-align: left;
  line-height: 1.45;
}

/* Tooltip Arrow */
.res-tooltip::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--sand-gold);
}

/* Show on Hover */
.resource-item:hover .res-tooltip,
.req-item:hover .res-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Prevent overflow on the right edge (e.g. Gold, Citizens) */
.resource-item:nth-last-child(-n+2) .res-tooltip {
  left: auto;
  right: 0;
  transform: translateY(8px);
}

.resource-item:nth-last-child(-n+2):hover .res-tooltip {
  transform: translateY(0);
}

.resource-item:nth-last-child(-n+2) .res-tooltip::before {
  left: auto;
  right: 20px;
  transform: none;
}

/* Prevent overflow on the left edge (e.g. Wood) */
.resource-item:first-child .res-tooltip {
  left: 0;
  transform: translateY(8px);
}

.resource-item:first-child:hover .res-tooltip {
  transform: translateY(0);
}

.resource-item:first-child .res-tooltip::before {
  left: 20px;
  transform: none;
}

.res-tooltip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: #fef08a;
  border-bottom: 1px solid rgba(226, 168, 80, 0.35);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.res-tooltip-icon {
  font-size: 1.25rem;
}

.res-tooltip-desc {
  font-size: 0.8rem;
  color: #cbd5e1;
  margin-bottom: 10px;
  line-height: 1.4;
}

.res-tooltip-source {
  background: rgba(0, 0, 0, 0.45);
  border-radius: 8px;
  border: 1px dashed rgba(226, 168, 80, 0.4);
  padding: 8px 10px;
  margin-bottom: 8px;
}

.res-source-title {
  display: block;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: #f59e0b;
  font-size: 0.8rem;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.res-tooltip-source ul {
  margin: 0;
  padding-left: 16px;
  list-style-type: disc;
}

.res-tooltip-source li {
  margin-bottom: 4px;
  font-size: 0.78rem;
  color: #e2e8f0;
  line-height: 1.35;
}

.res-tooltip-source li:last-child {
  margin-bottom: 0;
}

.res-tooltip-source li strong {
  color: #fde68a;
}

.res-tooltip-source li em {
  color: #93c5fd;
  font-style: normal;
}

.res-tooltip-hint {
  font-size: 0.72rem;
  color: #94a3b8;
  text-align: center;
  font-style: italic;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* CITIZENS / VILLAGERS & ARMY BREAKDOWN TOOLTIP */
.citizens-tooltip {
  width: 320px;
}

.pop-breakdown-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0 6px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pop-breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.pop-breakdown-row.highlight-villagers {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(5, 150, 105, 0.1) 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.45);
}

.pop-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pop-icon {
  font-size: 1.35rem;
}

.pop-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #34d399;
}

.pop-sub {
  font-size: 0.72rem;
  color: #94a3b8;
}

.pop-count {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: #f1f5f9;
}

.pop-military-header {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.14) 0%, rgba(185, 28, 28, 0.08) 100%);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
}

.pop-mil-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fca5a5;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
}

.pop-mil-total {
  background: rgba(239, 68, 68, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  color: #fee2e2;
  font-weight: 700;
}

.pop-military-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pop-military-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: #e2e8f0;
  padding: 2px 4px;
}

.mil-item-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mil-item-qty {
  font-weight: 700;
  color: #f8fafc;
  font-family: 'Outfit', sans-serif;
}


.auth-header-btn {
  background: linear-gradient(135deg, #e2a850 0%, #b87b28 100%);
  color: #1a0f02;
  font-weight: 800;
  font-size: 0.85rem;
  border: none;
  border-radius: 20px;
  padding: 6px 16px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(226, 168, 80, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.auth-header-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(226, 168, 80, 0.6);
}

/* NAVIGATION & ADVISORS STRIP */
#navStrip {
  background: rgba(14, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(226, 168, 80, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.view-tabs {
  display: flex;
  gap: 8px;
}

.view-tab {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  border-radius: 8px;
  padding: 6px 16px;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
}

.view-tab.active, .view-tab:hover {
  background: linear-gradient(135deg, rgba(226, 168, 80, 0.3) 0%, rgba(226, 168, 80, 0.1) 100%);
  border-color: var(--sand-gold);
  color: #fff;
  box-shadow: 0 0 12px rgba(226, 168, 80, 0.3);
}

/* Four Ikariam Advisors */
.advisors-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.advisor-btn {
  background: radial-gradient(circle, #3d2b15 0%, #1f1408 100%);
  border: 2px solid var(--sand-gold);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.advisor-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px var(--gold-glow);
}

.advisor-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 10px;
  padding: 2px 5px;
  border: 1px solid #fff;
}

/* MAIN VIEW CONTAINER */
#viewContainer {
  flex: 1;
  padding: 24px;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
}

/* HERO SCENIC BANNER */
.scenic-banner {
  background: linear-gradient(135deg, rgba(14, 38, 66, 0.8) 0%, rgba(10, 25, 45, 0.95) 100%);
  border: 2px solid var(--parchment-border);
  border-radius: 16px;
  padding: 28px 36px;
  margin-bottom: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.banner-content h1 {
  font-family: 'Cinzel', serif;
  font-size: 2.2rem;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 0%, var(--sand-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.banner-content p {
  color: #cbd5e1;
  max-width: 650px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.banner-actions {
  display: flex;
  gap: 12px;
}

.gold-action-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000;
  font-weight: 800;
  font-size: 1rem;
  font-family: 'Cinzel', serif;
  padding: 12px 28px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.gold-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(245, 158, 11, 0.6);
}

/* TOWN & ISLAND VIEWPORTS */
.view-panel {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.view-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* POLIS GRID (CITY VIEW) */
.polis-canvas-wrap {
  background: 
    radial-gradient(circle at 50% 50%, rgba(243, 232, 209, 0.95) 0%, rgba(220, 203, 169, 0.95) 100%),
    url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h40v40H0V0zm20 20h20v20H20V20zM0 20h20v20H0V20zm20-20h20v20H20V0z' fill='%23ab946b' fill-opacity='0.08' fill-rule='evenodd'/%3E%3C/svg%3E");
  border: 4px double var(--parchment-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  position: relative;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--parchment-border);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.panel-title {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-dark);
}

.panel-coords {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--terracotta);
  background: rgba(200, 90, 50, 0.1);
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid rgba(200, 90, 50, 0.3);
}

/* Building Grid */
.buildings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.building-slot {
  background: var(--parchment);
  border: 2px solid var(--parchment-border);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

.building-slot:hover {
  transform: translateY(-4px);
  border-color: var(--terracotta);
  box-shadow: 0 8px 24px rgba(200, 90, 50, 0.2);
}

.building-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.bldg-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.bldg-level {
  background: var(--terracotta);
  color: #fff;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 3px 8px;
  border-radius: 6px;
}

.bldg-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.bldg-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  flex: 1;
}

.bldg-cost {
  font-size: 0.78rem;
  color: #554832;
  background: var(--parchment-dark);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.upgrade-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.upgrade-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.upgrade-btn:disabled {
  background: #cbd5e1;
  color: #64748b;
  cursor: not-allowed;
  box-shadow: none;
}

/* UPGRADE TIMER PROGRESS BAR */
.progress-container {
  height: 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
  display: none;
}

.progress-bar {
  height: 100%;
  background: #f59e0b;
  width: 0%;
  transition: width 0.3s;
}

/* INTERACTIVE CANVAS & MAP PINS */
.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-toggle-btn {
  background: rgba(0, 0, 0, 0.08);
  border: 1px solid var(--parchment-border);
  color: var(--text-dark);
  border-radius: 6px;
  padding: 5px 12px;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.view-toggle-btn:hover, .view-toggle-btn.active {
  background: var(--terracotta);
  color: #fff;
  border-color: var(--terracotta);
  box-shadow: 0 2px 8px rgba(200, 90, 50, 0.3);
}

.interactive-map-box {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 3px solid var(--parchment-border);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  background: #08203e;
  user-select: none;
}

.map-bg-image {
  width: 100%;
  height: auto;
  display: block;
  filter: saturate(1.05) contrast(1.02);
}

.map-pins-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Individual interactive map pin */
.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10;
}

.map-pin:hover {
  transform: translate(-50%, -55%) scale(1.18);
  z-index: 50;
}

.pin-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffdf8 0%, #edd9bc 100%);
  border: 2.5px solid var(--sand-gold);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 12px rgba(226, 168, 80, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  position: relative;
  transition: box-shadow 0.2s;
}

.map-pin:hover .pin-circle {
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.8), 0 0 16px rgba(255, 255, 255, 0.6);
  border-color: #fff;
}

.pin-level {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--terracotta);
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 6px;
  border: 1.5px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pin-label {
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  margin-top: 4px;
  border: 1px solid rgba(226, 168, 80, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.pin-upgrading .pin-circle {
  border-color: #10b981;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.8);
  animation: pinPulse 1.5s infinite alternate;
}

@keyframes pinPulse {
  0% { transform: scale(1); box-shadow: 0 0 10px rgba(16, 185, 129, 0.5); }
  100% { transform: scale(1.06); box-shadow: 0 0 20px rgba(16, 185, 129, 0.9); }
}

/* Level 0 Unbuilt Areas (Grayed out until purchased/constructed to Level 1) */
.pin-level-0 {
  opacity: 0.72;
}

.pin-level-0 .pin-circle {
  background: radial-gradient(circle, #e2e8f0 0%, #94a3b8 100%) !important;
  border: 2px dashed #64748b !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4) !important;
  filter: grayscale(100%);
  transition: all 0.25s ease;
}

.pin-level-0 .pin-level {
  background: #64748b !important;
  border-color: #cbd5e1 !important;
  color: #f1f5f9 !important;
}

.pin-level-0 .pin-label {
  background: rgba(30, 41, 59, 0.88) !important;
  color: #94a3b8 !important;
  border-color: #64748b !important;
}

.pin-level-0:hover {
  opacity: 1;
}

.pin-level-0:hover .pin-circle {
  filter: grayscale(30%);
  border-color: var(--sand-gold) !important;
  box-shadow: 0 0 16px rgba(226, 168, 80, 0.7) !important;
}

/* Building/Field Slot Cards Level 0 */
.slot-level-0 {
  filter: grayscale(100%);
  opacity: 0.7;
  border-color: #64748b !important;
  transition: all 0.25s ease;
}

.slot-level-0:hover {
  filter: grayscale(20%);
  opacity: 1;
  border-color: var(--sand-gold) !important;
}

/* INSPECTOR MODAL STYLING */
.inspector-modal {
  max-width: 580px;
  width: 94%;
}

.inspector-header {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid var(--parchment-border);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.insp-icon {
  font-size: 3rem;
  width: 68px;
  height: 68px;
  background: radial-gradient(circle, #fffaf0 0%, #e8d7ba 100%);
  border: 2px solid var(--sand-gold);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.insp-title {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-dark);
}

.insp-level-badge {
  background: var(--terracotta);
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.insp-category {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.insp-desc {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #443828;
  margin-bottom: 16px;
}

/* Stats Comparison (Current vs Next) */
.stats-comparison-box {
  background: var(--parchment-dark);
  border: 1px solid var(--parchment-border);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stat-col {
  display: flex;
  flex-direction: column;
}

.stat-col-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
}

.stat-col.highlighted .stat-value {
  color: #059669;
}

.stat-arrow {
  font-size: 1.3rem;
  color: var(--sand-gold);
}

/* Upgrade Requirements Box */
.upgrade-requirements-box {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--parchment-border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 20px;
}

.req-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
  font-family: 'Cinzel', serif;
}

.req-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
}

.req-item {
  background: var(--parchment);
  border: 1px solid var(--parchment-border);
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
  cursor: help;
  transition: all 0.2s ease;
}

.req-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.req-item .res-tooltip {
  top: auto;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
}

.req-item:hover .res-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.req-item .res-tooltip::before {
  top: auto;
  bottom: -8px;
  border-bottom: none;
  border-top: 8px solid var(--sand-gold);
}

.req-item.affordable {
  border-color: #10b981;
  color: #065f46;
}

.req-item.lacking {
  border-color: #ef4444;
  color: #991b1b;
  background: #fee2e2;
}

.req-val {
  font-weight: 700;
  font-size: 0.95rem;
}

.req-label {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* FLOATING CONSTRUCTION QUEUE HUD */
.construction-queue-hud {
  position: fixed;
  bottom: 24px;
  right: 18px;
  width: 295px;
  background: rgba(14, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  border: 2px solid var(--sand-gold);
  border-radius: 14px;
  padding: 14px;
  color: #fff;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6), 0 0 15px rgba(226, 168, 80, 0.25);
  z-index: 1000;
  font-family: 'Outfit', sans-serif;
  transition: transform 0.2s;
  pointer-events: auto;
}

.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.queue-title {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--sand-gold);
  white-space: nowrap;
}

.queue-badge {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid var(--sand-gold);
  color: var(--sand-gold);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.queue-empty-msg {
  color: #94a3b8;
  font-size: 0.85rem;
  text-align: center;
  padding: 10px 0;
  font-style: italic;
}

.queue-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.queue-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.queue-timer {
  color: #10b981;
  font-family: monospace;
  font-size: 0.9rem;
  font-weight: 700;
}

.queue-bar-wrap {
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.queue-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
  width: 0%;
  transition: width 0.3s;
}

@media (max-width: 1024px) {
  .construction-queue-hud {
    position: static;
    width: 100%;
    margin: 16px auto;
  }
}

/* MODAL SYSTEM (Parchment Popups) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px 14px;
  overflow-y: auto;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
  display: flex;
}

.parchment-modal {
  background: var(--parchment);
  border: 4px double var(--parchment-border);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 30px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  position: relative;
  box-sizing: border-box;
  margin: auto;
  animation: modalPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  scrollbar-width: thin;
  scrollbar-color: rgba(180, 83, 9, 0.45) rgba(217, 119, 6, 0.08);
}

.parchment-modal::-webkit-scrollbar {
  width: 8px;
}

.parchment-modal::-webkit-scrollbar-track {
  background: rgba(217, 119, 6, 0.08);
  border-radius: 4px;
  margin: 6px 0;
}

.parchment-modal::-webkit-scrollbar-thumb {
  background: rgba(180, 83, 9, 0.4);
  border-radius: 4px;
}

.parchment-modal::-webkit-scrollbar-thumb:hover {
  background: rgba(180, 83, 9, 0.7);
}

.modal-close-btn {
  position: sticky;
  top: -10px;
  float: right;
  z-index: 50;
  background: rgba(254, 243, 199, 0.92);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(180, 83, 9, 0.25);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  margin-top: -14px;
  margin-right: -10px;
  margin-bottom: -32px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.modal-close-btn:hover {
  background: var(--terracotta);
  color: #fff;
  border-color: var(--terracotta);
  transform: scale(1.08);
}

.modal-title {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  color: var(--text-dark);
  margin-bottom: 8px;
  border-bottom: 2px solid var(--parchment-border);
  padding-bottom: 8px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-dark);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--parchment-border);
  background: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--sand-gold);
  box-shadow: 0 0 8px rgba(226, 168, 80, 0.4);
}

.modal-submit-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #c85a32 0%, #963819 100%);
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 4px 12px rgba(200, 90, 50, 0.3);
}

.modal-submit-btn:hover {
  background: linear-gradient(135deg, #e06539 0%, #a83f1d 100%);
}

.modal-switch-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 14px;
}

.modal-switch-link {
  color: var(--terracotta);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

/* FOOTER */
footer {
  text-align: center;
  padding: 24px;
  color: #94a3b8;
  font-size: 0.85rem;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

footer a {
  color: var(--sand-gold);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  #topBar {
    padding: 8px;
    gap: 8px;
  }
  .resource-strip {
    gap: 6px;
  }
  .scenic-banner {
    flex-direction: column;
    padding: 20px;
    text-align: center;
  }
  .banner-actions {
    width: 100%;
    justify-content: center;
  }
  .buildings-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   AEGEAN WORLD MAP COORDINATE GRID & TARGET ACTION MODALS
   ========================================================================== */

.world-map-wrap {
  color: var(--text-dark);
  display: flex;
  flex-direction: column;
}

.world-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--parchment-border) !important;
}

.world-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.world-title-wrap .panel-title {
  color: var(--text-dark);
}

.world-sector-label {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-family: 'Cinzel', serif;
}

.world-nav-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.nav-compass {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(15, 23, 42, 0.85);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.compass-mid {
  display: flex;
  align-items: center;
  gap: 2px;
}

.compass-btn {
  width: 28px;
  height: 26px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--sand-gold);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: all 0.15s ease;
}

.compass-btn:hover {
  background: var(--sand-gold);
  color: #1e1b18;
}

.compass-center {
  width: 28px;
  height: 26px;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid var(--sand-gold);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.compass-center:hover {
  background: var(--sand-gold);
  transform: scale(1.08);
}

.world-coord-jump {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.coord-label {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 600;
}

.current-coords {
  color: var(--sand-gold);
  font-weight: 700;
  font-family: monospace;
  font-size: 0.95rem;
  margin-right: 4px;
}

.coord-input {
  width: 50px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fff;
  border-radius: 4px;
  font-weight: 700;
  text-align: center;
  font-size: 0.85rem;
  font-family: 'Outfit', sans-serif;
  outline: none;
}

.coord-input:focus {
  border-color: var(--sand-gold);
  background: rgba(0, 0, 0, 0.65);
}

.jump-btn {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: #fff;
  border: 1px solid var(--sand-gold);
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.jump-btn:hover {
  opacity: 0.9;
}

/* World Map Zoom Controls */
.world-zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
  padding: 4px 10px;
}

.zoom-btn-group {
  display: flex;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.zoom-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.zoom-btn:hover {
  color: #fff;
  background: rgba(245, 158, 11, 0.2);
}

.zoom-btn.active {
  background: linear-gradient(135deg, #e2a850 0%, #b87b28 100%);
  color: #0f172a;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(226, 168, 80, 0.3);
}

.zoom-step-group {
  display: flex;
  gap: 4px;
}

.zoom-step-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(226, 168, 80, 0.3);
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.zoom-step-btn:hover {
  background: var(--sand-gold);
  color: #0f172a;
  border-color: var(--sand-gold);
}

/* Naval Dispatches Tracker */
.world-missions-bar {
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(226, 168, 80, 0.2);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.missions-label {
  font-weight: 700;
  color: var(--sand-gold);
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.missions-list {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mission-chip {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(226, 168, 80, 0.5);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  animation: pulseGlow 2.5s infinite alternate;
}

.mission-chip.attack {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.18);
}

.mission-chip.trade {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.18);
}

.mission-chip.talk {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.18);
}

.no-missions-msg {
  color: #64748b;
  font-style: italic;
  font-size: 0.8rem;
}

/* Cartographic Grid */
.world-grid-wrapper {
  padding: 10px;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 50% 50%, rgba(13, 56, 97, 0.5) 0%, rgba(8, 33, 59, 0.9) 100%);
  min-height: 590px;
  border: 3px solid var(--parchment-border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.world-grid-wrapper:active,
.world-grid-wrapper.is-dragging {
  cursor: grabbing !important;
}

.world-grid-wrapper.is-dragging * {
  cursor: grabbing !important;
}

.world-grid {
  display: grid;
  padding: 8px;
  background: rgba(4, 18, 33, 0.7);
  border: 2px solid rgba(226, 168, 80, 0.4);
  border-radius: 12px;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.6);
  user-select: none;
  box-sizing: border-box;
}

/* Dynamic Zoom-level Grid Sizing */
.world-grid.zoom-close {
  gap: 4px;
}
.world-grid.zoom-close .cell-island,
.world-grid.zoom-close .cell-sea {
  width: 66px;
  height: 66px;
  min-height: 66px;
  padding: 3px;
  box-sizing: border-box;
}
.world-grid.zoom-close .tile-icon {
  font-size: 1.4rem;
  margin-bottom: 2px;
}
.world-grid.zoom-close .tile-name {
  font-size: 0.65rem;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.world-grid.zoom-close .tile-coords {
  font-size: 0.58rem;
  color: #94a3b8;
}
.world-grid.zoom-close .tile-lux-badge {
  transform: scale(0.85);
  top: 1px;
  right: 1px;
}
.world-grid.zoom-close .cell-sea-flotsam {
  font-size: 1rem;
}
.world-grid.zoom-close .cell-sea-coords {
  font-size: 0.55rem;
}
.world-grid.zoom-close .grid-header-cell {
  font-size: 0.72rem;
}

.world-grid.zoom-medium {
  gap: 3px;
}
.world-grid.zoom-medium .cell-island,
.world-grid.zoom-medium .cell-sea {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 2px;
  box-sizing: border-box;
}
.world-grid.zoom-medium .tile-icon {
  font-size: 1.15rem;
  margin: 0;
}
.world-grid.zoom-medium .tile-name {
  font-size: 0.5rem;
  max-width: 34px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.world-grid.zoom-medium .tile-coords {
  display: none;
}
.world-grid.zoom-medium .tile-lux-badge {
  transform: scale(0.65);
  top: 0px;
  right: 0px;
}
.world-grid.zoom-medium .tile-player-laurel {
  font-size: 0.5rem;
  top: 0px;
  left: 0px;
}
.world-grid.zoom-medium .cell-sea-flotsam {
  font-size: 0.75rem;
}
.world-grid.zoom-medium .cell-sea-coords {
  display: none;
}
.world-grid.zoom-medium .grid-header-cell {
  font-size: 0.65rem;
}

.world-grid.zoom-far {
  gap: 2px;
}
.world-grid.zoom-far .cell-island,
.world-grid.zoom-far .cell-sea {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 1px;
  box-sizing: border-box;
}
.world-grid.zoom-far .tile-icon {
  font-size: 0.9rem;
  margin: 0;
}
.world-grid.zoom-far .tile-name,
.world-grid.zoom-far .tile-coords,
.world-grid.zoom-far .tile-lux-badge {
  display: none;
}
.world-grid.zoom-far .tile-player-laurel {
  font-size: 0.45rem;
  top: -1px;
  left: 0px;
}
.world-grid.zoom-far .cell-sea-flotsam {
  font-size: 0.6rem;
}
.world-grid.zoom-far .cell-sea-coords {
  display: none;
}
.world-grid.zoom-far .grid-header-cell {
  font-size: 0.55rem;
}

.grid-header-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--sand-gold);
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(226, 168, 80, 0.2);
  border-radius: 4px;
}

.cell-sea {
  background: radial-gradient(circle at 50% 50%, #0d3861 0%, #07223d 100%);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: default;
  transition: all 0.2s;
  overflow: hidden;
  min-height: 80px;
}

.cell-sea:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: radial-gradient(circle at 50% 50%, #11467a 0%, #092c4f 100%);
}

.cell-sea-flotsam {
  font-size: 1.1rem;
  opacity: 0.35;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.cell-sea-coords {
  font-size: 0.65rem;
  color: rgba(148, 163, 184, 0.4);
  position: absolute;
  bottom: 3px;
  font-family: monospace;
}

.cell-island {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 2px solid rgba(226, 168, 80, 0.5);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease-in-out;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  min-height: 80px;
  pointer-events: auto;
  user-select: none;
}

.cell-island * {
  pointer-events: none;
}

.cell-island:hover {
  transform: translateY(-3px) scale(1.03);
  border-color: var(--sand-gold);
  box-shadow: 0 8px 24px rgba(226, 168, 80, 0.4);
  z-index: 5;
}

.cell-island.player {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(15, 23, 42, 0.95) 100%);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.4);
}

.cell-island.claimed {
  border-color: #38bdf8;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18) 0%, rgba(15, 23, 42, 0.95) 100%);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
}

.cell-island.unclaimed {
  border-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(15, 23, 42, 0.95) 100%);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.25);
}

.cell-island.dangerous,
.cell-island.pirate {
  border-color: #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(15, 23, 42, 0.95) 100%);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.25);
}

.tile-icon {
  font-size: 1.7rem;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
  line-height: 1;
  margin-bottom: 3px;
}

.tile-name {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}

.tile-coords {
  font-size: 0.65rem;
  color: #cbd5e1;
  font-family: monospace;
}

.tile-lux-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  font-size: 0.7rem;
  background: rgba(0,0,0,0.6);
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid rgba(226, 168, 80, 0.3);
}

.tile-player-laurel {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 0.75rem;
}

.world-map-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  margin-top: 14px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
  font-size: 0.82rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #f1f5f9;
  font-weight: 600;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-player { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }
.dot-city { background: #38bdf8; }
.dot-pirate { background: #ef4444; }
.dot-sea { background: #0284c7; }

/* Target Modal Styling */
.world-target-modal {
  max-width: 580px;
  width: 95%;
  text-align: left;
}

.target-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid var(--parchment-border);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.target-icon {
  font-size: 2.8rem;
  background: rgba(226, 168, 80, 0.15);
  width: 65px;
  height: 65px;
  border-radius: 12px;
  border: 1px solid var(--parchment-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.target-title {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  color: #1e293b;
  font-weight: 900;
  margin: 0;
}

.target-coords-badge {
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 700;
  background: #334155;
  color: #f8fafc;
  padding: 2px 6px;
  border-radius: 4px;
}

.target-status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
  border: 1px solid #10b981;
  padding: 2px 8px;
  border-radius: 12px;
}

.target-ruler-line {
  font-size: 0.85rem;
  color: #475569;
  margin-top: 3px;
}

.target-lux-pill {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  color: #92400e;
}

.target-nav-info {
  font-size: 0.82rem;
  color: #64748b;
  margin-top: 4px;
  background: rgba(0,0,0,0.04);
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
}

.target-action-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--parchment-border);
  margin-bottom: 16px;
}

.target-tab {
  flex: 1;
  padding: 9px 6px;
  background: transparent;
  border: none;
  font-family: 'Cinzel', serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.target-tab:hover {
  color: var(--text-dark);
}

.target-tab.active {
  color: var(--terracotta);
  border-bottom-color: var(--terracotta);
}

.target-pane {
  display: none;
}

.target-pane.active {
  display: block;
}

.pane-instruction {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 12px;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
}

.form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  border: 1.5px solid var(--parchment-border);
  border-radius: 8px;
  background: #fff;
  color: #1e293b;
  outline: none;
  box-sizing: border-box;
}

.form-select:focus, .form-textarea:focus {
  border-color: var(--sand-gold);
}

.form-textarea {
  resize: vertical;
  min-height: 70px;
}

.action-feedback-box {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 12px;
  font-weight: 600;
}

.action-feedback-box.success {
  background: #ecfdf5;
  border: 1px solid #10b981;
  color: #047857;
}

.action-feedback-box.error {
  background: #fef2f2;
  border: 1px solid #ef4444;
  color: #b91c1c;
}

.troop-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.troop-item {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--parchment-border);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.troop-icon {
  font-size: 1.6rem;
}

.troop-name {
  font-weight: 700;
  font-size: 0.8rem;
  color: #1e293b;
}

.troop-sub {
  font-size: 0.7rem;
  color: #64748b;
}

.troop-qty-input {
  width: 60px;
  padding: 4px;
  text-align: center;
  font-weight: 700;
  border: 1px solid var(--parchment-border);
  border-radius: 6px;
  font-size: 0.9rem;
  margin-top: 4px;
  background: #fff;
}

.attack-warning-box {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  color: #92400e;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.target-intel-box {
  background: rgba(0,0,0,0.04);
  border: 1px dashed var(--parchment-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 0.88rem;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%) !important;
  border-color: #b91c1c !important;
}

.trade-exchange-grid {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.trade-col {
  flex: 1;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--parchment-border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.trade-col-title {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}

.trade-arrow {
  font-size: 1.4rem;
  color: var(--terracotta);
  font-weight: 900;
}

.trade-calc-note {
  font-size: 0.85rem;
  color: #475569;
  background: rgba(0,0,0,0.04);
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
  text-align: center;
}

.inspect-info-card {
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--parchment-border);
  border-radius: 8px;
  padding: 14px;
}

/* Battle Report Modal */
.battle-report-modal {
  max-width: 500px;
  text-align: left;
}

.battle-header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 2px solid var(--parchment-border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.battle-icon {
  font-size: 2.5rem;
}

.battle-title {
  font-family: 'Cinzel', serif;
  font-size: 1.35rem;
  color: #1e293b;
  font-weight: 900;
  margin: 0;
}

.battle-sub {
  font-size: 0.85rem;
  color: #64748b;
}

.battle-story {
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.5;
  margin-bottom: 14px;
}

.battle-plunder-box {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
}

.plunder-header {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: #166534;
}

.plunder-grid {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.plunder-pill {
  background: #dcfce7;
  border: 1px solid #4ade80;
  color: #15803d;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
}

.battle-casualties-box {
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 16px;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 5px rgba(226, 168, 80, 0.3); }
  100% { box-shadow: 0 0 14px rgba(226, 168, 80, 0.6); }
}

/* ==========================================================================
   BARRACKS ARMY RECRUITMENT & STANDING GARRISON
   ========================================================================== */

.barracks-recruit-wrap {
  margin-top: 16px;
  border-top: 2px solid var(--parchment-border);
  padding-top: 14px;
}

.recruit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.garrison-status-pill {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 3px 10px;
  border-radius: 20px;
}



/* ==========================================================================
   RAMBLING FOOL'S LAYER (DOES NOTHING)
   ========================================================================== */

.fool-warning-banner {
  background: #fef2f2;
  border: 1.5px dashed #ef4444;
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 12px;
  text-align: center;
}

.fool-dialogue-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
  font-style: italic;
  font-size: 0.88rem;
  color: #92400e;
  line-height: 1.45;
  margin: 10px 0 14px 0;
  position: relative;
}

.fool-wasted-box {
  font-size: 0.8rem;
  color: #64748b;
  background: rgba(0,0,0,0.03);
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
  text-align: center;
}

/* ==========================================================================
   SCIENCE & RESEARCH MODAL (ACADEMY OF THINKERS)
   ========================================================================== */

.science-modal {
  max-width: 650px;
  width: 95%;
  text-align: left;
}

.science-header {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid var(--parchment-border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.science-header-icon {
  font-size: 2.5rem;
  width: 55px;
  height: 55px;
  background: rgba(226, 168, 80, 0.15);
  border-radius: 12px;
  border: 1px solid var(--parchment-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.science-title {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  color: #1e293b;
  font-weight: 900;
  margin: 0;
}

.science-subtitle {
  font-size: 0.85rem;
  color: #64748b;
}

.science-desc {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 12px;
}

.science-active-banner {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.active-research-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.active-tech-icon {
  font-size: 1.8rem;
}

.active-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: #dbeafe;
  border-radius: 4px;
  overflow: hidden;
}

.active-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
  transition: width 0.4s ease;
}

.science-section-title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 12px 0 8px 0;
}

.science-tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.tech-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid var(--parchment-border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.tech-card:hover {
  border-color: var(--sand-gold);
  box-shadow: 0 4px 12px rgba(226, 168, 80, 0.25);
}

.tech-card.researched {
  background: #f0fdf4;
  border-color: #86efac;
}

.tech-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tech-icon {
  font-size: 1.5rem;
}

.tech-name {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
}

.tech-perk {
  font-size: 0.8rem;
  color: #047857;
  font-weight: 600;
  line-height: 1.35;
}

.tech-costs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: #64748b;
}

.btn-research {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  border: 1px solid #38bdf8;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-research:hover {
  filter: brightness(1.1);
}

.tech-badge-done {
  color: #16a34a;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Rambling Fool's Layer Special Styling */
.fool-warning-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
  border: 2px dashed #f59e0b;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  color: #92400e;
  font-size: 0.85rem;
  line-height: 1.45;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.15);
}

.fool-dialogue-box {
  background: rgba(255, 255, 255, 0.85);
  border-left: 4px solid #f59e0b;
  padding: 10px 14px;
  margin: 10px 0 14px 0;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: #451a03;
  font-size: 0.9rem;
  line-height: 1.5;
}

.fool-wasted-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: #64748b;
  text-align: center;
}

/* Barracks Recruitment UI Styling */
.barracks-recruit-wrap {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px dashed var(--parchment-border);
}

.recruit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.garrison-status-pill {
  background: rgba(180, 83, 9, 0.1);
  border: 1px solid rgba(180, 83, 9, 0.3);
  color: #b45309;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
}

.barracks-unit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 10px;
}

@media (max-width: 540px) {
  .barracks-unit-grid {
    grid-template-columns: 1fr;
  }
}

.unit-train-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid var(--parchment-border);
  border-radius: 10px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  min-width: 0;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.unit-train-card:hover {
  border-color: var(--sand-gold);
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.2);
  transform: translateY(-2px);
}

.unit-train-icon {
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 2px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.unit-train-name {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.25;
  margin-bottom: 2px;
  text-align: center;
  word-break: normal;
  overflow-wrap: normal;
}

.unit-train-garrison {
  font-size: 0.74rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 4px;
}

.unit-train-costs {
  font-size: 0.72rem;
  color: #475569;
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  margin: 4px 0 8px 0;
  padding: 6px 8px;
  background: rgba(245, 238, 226, 0.6);
  border: 1px solid rgba(226, 215, 196, 0.8);
  border-radius: 6px;
  box-sizing: border-box;
}

.unit-train-costs span {
  display: flex;
  align-items: center;
  gap: 5px;
  text-align: left;
  font-weight: 500;
}

.btn-train-unit {
  background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
  color: #fff;
  border: 1px solid #d97706;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  white-space: normal;
  line-height: 1.25;
  text-align: center;
  transition: all 0.15s ease;
  margin-top: auto;
}

.btn-train-unit:hover:not(:disabled) {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(180, 83, 9, 0.3);
}

.btn-train-unit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(40%);
}

/* Unit Training Speed & Quantity Controls */
.unit-train-speed-pill {
  background: rgba(180, 83, 9, 0.08);
  border: 1px solid rgba(180, 83, 9, 0.2);
  color: #78350f;
  font-size: 0.72rem;
  padding: 3px 6px;
  border-radius: 5px;
  margin: 3px 0 6px 0;
  font-weight: 600;
  width: 100%;
  box-sizing: border-box;
}

.unit-qty-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  margin: 4px 0 6px 0;
}

.qty-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.15s ease;
  user-select: none;
}

.qty-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.train-qty-input {
  width: 48px;
  height: 26px;
  text-align: center;
  border: 1.5px solid var(--parchment-border);
  border-radius: 4px;
  font-weight: 700;
  font-family: monospace;
  font-size: 0.85rem;
  color: #0f172a;
  background: #fff;
  box-sizing: border-box;
}

.qty-max-btn {
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.68rem;
  font-weight: 800;
  height: 26px;
  padding: 0 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.qty-max-btn:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.unit-train-time-row {
  font-size: 0.74rem;
  color: #b45309;
  font-weight: 600;
  margin: 2px 0 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
}

/* Active Barracks Training Queue */
.barracks-queue-wrap {
  background: rgba(254, 243, 199, 0.45);
  border: 1.5px solid rgba(217, 119, 6, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  box-shadow: inset 0 1px 4px rgba(180, 83, 9, 0.08);
}

.barracks-queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.barracks-queue-title {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #92400e;
}

.barracks-queue-badge {
  background: #d97706;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.barracks-queue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.barracks-queue-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.barracks-queue-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.barracks-queue-unit-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #1e293b;
}

.barracks-queue-timer {
  font-size: 0.78rem;
  font-weight: 700;
  color: #b45309;
  font-family: monospace;
}

.barracks-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(226, 232, 240, 0.9);
  border-radius: 3px;
  overflow: hidden;
}

.barracks-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
  border-radius: 3px;
  transition: width 0.3s linear;
}

/* ==========================================================================
   COSMIC AETHERIC AGE & ALIEN CONTACT STYLING
   ========================================================================== */

/* Era Badges */
.era-badge {
  font-size: 0.75rem;
  vertical-align: middle;
  padding: 3px 9px;
  border-radius: 12px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  margin-left: 6px;
  letter-spacing: 0.03em;
}

.era-badge.antiquity {
  background: rgba(226, 168, 80, 0.2);
  color: #b45309;
  border: 1px solid rgba(226, 168, 80, 0.4);
}

.era-badge.cosmic {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.25) 0%, rgba(147, 51, 234, 0.3) 100%);
  color: #38bdf8;
  border: 1.5px solid #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
  animation: cosmicPulse 2s infinite alternate ease-in-out;
}

@keyframes cosmicPulse {
  from { box-shadow: 0 0 8px rgba(56, 189, 248, 0.3); }
  to { box-shadow: 0 0 18px rgba(168, 85, 247, 0.6); }
}

/* Cosmic Map Pin */
.map-pin.pin-cosmic .pin-circle {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  border: 2px solid #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.8), 0 0 30px rgba(168, 85, 247, 0.5);
  animation: cosmicHalo 2.5s infinite ease-in-out;
}

@keyframes cosmicHalo {
  0% { transform: scale(1); box-shadow: 0 0 12px rgba(56, 189, 248, 0.7); }
  50% { transform: scale(1.08); box-shadow: 0 0 24px rgba(168, 85, 247, 0.9); }
  100% { transform: scale(1); box-shadow: 0 0 12px rgba(56, 189, 248, 0.7); }
}

/* Cosmic First Contact Modal */
.cosmic-modal {
  background: radial-gradient(circle at 50% 20%, #1e1b4b 0%, #0f172a 70%, #020617 100%);
  border: 3px double #38bdf8;
  color: #f8fafc;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(56, 189, 248, 0.35);
  max-width: 560px;
}

.cosmic-modal .modal-close-btn {
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(56, 189, 248, 0.4);
}

.cosmic-modal .modal-close-btn:hover {
  color: #fff;
  background: #0284c7;
  border-color: #38bdf8;
}

.cosmic-modal {
  scrollbar-color: rgba(56, 189, 248, 0.5) rgba(15, 23, 42, 0.4);
}

.cosmic-modal::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
}

.cosmic-modal::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.4);
}

.cosmic-modal::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.8);
}

.cosmic-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1.5px solid rgba(56, 189, 248, 0.3);
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.cosmic-ufo-icon {
  font-size: 3rem;
  animation: floatUfo 3s ease-in-out infinite;
  filter: drop-shadow(0 0 14px #38bdf8);
}

@keyframes floatUfo {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(-4deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

.cosmic-glyph-sub {
  display: block;
  font-family: monospace;
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  color: #38bdf8;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
  margin-bottom: 2px;
}

.cosmic-title {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #38bdf8 0%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  font-weight: 800;
}

.cosmic-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
}

.cosmic-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.cosmic-story-card p {
  margin: 0 0 10px 0;
}

.alien-transmission-box {
  color: #38bdf8;
  font-family: monospace;
  font-size: 0.86rem;
  background: rgba(2, 132, 199, 0.12);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px dashed #38bdf8;
  line-height: 1.45;
  box-shadow: inset 0 0 12px rgba(56, 189, 248, 0.15);
}

.cosmic-perks-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(147, 51, 234, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
}

.cosmic-perks-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: #c084fc;
  margin-bottom: 8px;
}

.cosmic-perks-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #e2e8f0;
}

.btn-cosmic {
  background: linear-gradient(135deg, #0284c7 0%, #7e22ce 100%);
  color: #fff;
  border: 1.5px solid #38bdf8;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 16px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 18px rgba(56, 189, 248, 0.35);
}

.btn-cosmic:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(168, 85, 247, 0.6);
  filter: brightness(1.15);
}

/* Alien Technology Cards in Science Modal */
.cosmic-section-title {
  color: #0284c7 !important;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px !important;
}

.locked-title {
  color: #64748b !important;
  margin-top: 18px !important;
}

.alien-locked-hint {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: #64748b;
  font-style: italic;
  margin-bottom: 12px;
}

.tech-card.alien-tech {
  background: linear-gradient(135deg, #f0fdfa 0%, #f5f3ff 100%);
  border: 1.5px solid #38bdf8;
  box-shadow: 0 3px 12px rgba(56, 189, 248, 0.15);
}

.tech-card.alien-tech:hover {
  border-color: #a855f7;
  box-shadow: 0 5px 18px rgba(168, 85, 247, 0.3);
}

.tech-card.alien-tech.researched {
  background: linear-gradient(135deg, #ecfeff 0%, #f0fdf4 100%);
  border-color: #06b6d4;
}

.tech-card.alien-tech .tech-perk {
  color: #7e22ce;
  font-weight: 700;
}






/* AUTH GATE & LOCKED STATE */
.auth-gate-overlay {
  z-index: 10000;
  background: rgba(10, 12, 16, 0.92) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.auth-gate-modal {
  max-width: 540px !important;
  text-align: center;
  border: 4px double #d97706 !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 50px rgba(245, 158, 11, 0.25) !important;
  animation: authModalFadeIn 0.35s ease-out;
}

@keyframes authModalFadeIn {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.game-container.auth-locked,
.top-bar.auth-locked {
  filter: blur(8px) grayscale(40%);
  pointer-events: none !important;
  user-select: none !important;
  opacity: 0.6;
}


.google-signin-btn-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  border-radius: 28px;
  padding: 11px 26px;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.google-signin-btn-custom:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.google-signin-btn-custom:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Diplomatic Messages & Notification Badge */
.msg-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: 9999px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fff;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.9);
  animation: pulseMsgBadge 2s infinite ease-in-out;
}

@keyframes pulseMsgBadge {
  0%, 100% { transform: scale(1); box-shadow: 0 0 8px rgba(239, 68, 68, 0.85); }
  50% { transform: scale(1.18); box-shadow: 0 0 16px rgba(239, 68, 68, 1); }
}

.talk-recipient-card {
  background: #f8fafc;
  border: 1.5px solid rgba(226, 168, 80, 0.4);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.recipient-label {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 600;
}

.recipient-value {
  font-size: 0.95rem;
  color: #1e293b;
}

.diplomatic-inbox-modal {
  max-width: 780px;
  width: 95%;
  min-height: 520px;
  position: relative;
}

.diplomatic-inbox-modal .modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  margin: 0;
  float: none;
  z-index: 60;
}

.modal-header-with-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding-right: 48px;
}

.modal-header-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
}

.inbox-pane {
  display: none;
}

.inbox-pane.active {
  display: block;
}

.messages-list {
  max-height: 440px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.message-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  transition: all 0.2s;
  position: relative;
}

.message-card.unread {
  border-left: 4px solid #ef4444;
  background: #fffbfb;
}

.message-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.message-sender {
  font-weight: 700;
  color: #1e293b;
  font-size: 0.95rem;
}

.message-location {
  font-size: 0.8rem;
  color: #64748b;
}

.message-time {
  font-size: 0.75rem;
  color: #94a3b8;
}

.message-subject {
  font-weight: 600;
  color: #b45309;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.message-body {
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.45;
  white-space: pre-wrap;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #f1f5f9;
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.btn-reply {
  background: var(--terracotta);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-reply:hover {
  background: #b91c1c;
}

.btn-delete-msg {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.18s ease;
}

.btn-delete-msg:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #f87171;
  transform: translateY(-1px);
}

.empty-inbox-msg {
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
  padding: 30px 10px;
  font-style: italic;
}

.btn-text-action {
  background: none;
  border: none;
  color: #64748b;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 6px;
  text-decoration: underline;
}

.btn-text-action:hover {
  color: #1e293b;
}

.tab-pill-badge {
  background: #ef4444;
  color: white;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 4px;
}

/* ----------------------------------------------------
   MESSAGE IN A BOTTLE, BURIED STASHES & OVERFLOW STYLES
   ---------------------------------------------------- */
.res-overflow-red {
  color: #ef4444 !important;
  font-weight: 700 !important;
  text-shadow: 0 0 6px rgba(239, 68, 68, 0.45);
  animation: overflowPulse 2s ease-in-out infinite alternate;
}

@keyframes overflowPulse {
  0% { color: #ef4444; }
  100% { color: #f87171; }
}

.bottle-banner {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1.5px solid #86efac;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
}

.bottle-list-header {
  font-weight: 700;
  color: var(--text-dark);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.bottle-list-container {
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  max-height: 150px;
  overflow-y: auto;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bottle-note-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left: 3.5px solid #059669;
  border-radius: 6px;
  padding: 8px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.bottle-note-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.bottle-note-author {
  color: #0f172a;
}

.bottle-note-time {
  color: #64748b;
  font-size: 0.75rem;
}

.bottle-note-text {
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.4;
  white-space: pre-wrap;
}

.empty-bottle-msg {
  text-align: center;
  color: #94a3b8;
  font-size: 0.85rem;
  font-style: italic;
  padding: 16px 8px;
}

.bottle-cast-form {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
}

.btn-bottle {
  background: linear-gradient(135deg, #059669, #047857) !important;
  color: white !important;
  font-weight: 700;
  margin-top: 8px;
}

.btn-bottle:hover {
  background: linear-gradient(135deg, #047857, #065f46) !important;
}

.claim-warning-card {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-radius: 10px;
  padding: 18px;
  text-align: center;
}

.claim-ready-card {
  background: #ecfdf5;
  border: 1.5px solid #10b981;
  border-radius: 10px;
  padding: 18px;
  text-align: center;
}

.claim-owned-card {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 18px;
  text-align: center;
}

.btn-claim {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: white !important;
  font-weight: 700;
}

.btn-claim:hover {
  background: linear-gradient(135deg, #059669, #047857) !important;
}

.battle-casualties-box {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  margin-top: 10px;
  color: #334155;
}

/* ==========================================================================
   MARKETPLACE RESOURCE EXCHANGE
   ========================================================================== */
.marketplace-exchange-wrap {
  margin-top: 16px;
  border-top: 2px solid var(--parchment-border);
  padding-top: 14px;
}

.exchange-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.exchange-ratio-pill {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 20px;
}

.exchange-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 12px;
  box-sizing: border-box;
}

.exchange-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.exchange-col .form-select {
  width: 100%;
  min-width: 0;
  padding: 5px 8px;
  font-size: 0.85rem;
  height: 34px;
  box-sizing: border-box;
}

.exchange-col-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exchange-arrow {
  font-size: 1.3rem;
  color: #d97706;
  padding: 0 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.exchange-input-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}

.exchange-input {
  width: 70px;
  max-width: 80px;
  padding: 4px 6px;
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
  border-radius: 5px;
  font-weight: 700;
  text-align: center;
  font-size: 0.88rem;
  font-family: 'Outfit', sans-serif;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.exchange-input:focus {
  border-color: #d97706 !important;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2) !important;
}

.exchange-input[readonly] {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  cursor: default;
}

.exchange-unit-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

#exchangeSellAvailable,
#exchangeRatioNote {
  font-size: 0.74rem;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 500px) {
  .exchange-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .exchange-arrow {
    transform: rotate(90deg);
  }
}

/* ==========================================================================
   SHIPYARD GATE MODAL (LEVEL 5 REQUIREMENT)
   ========================================================================== */
.shipyard-gate-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
}

.shipyard-gate-icon {
  font-size: 3.2rem;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
}

.shipyard-gate-title {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  color: #78350f;
  margin: 0 0 6px 0;
  font-weight: 800;
}

.shipyard-gate-level {
  background: #fef2f2;
  border: 1px solid #ef4444;
  color: #b91c1c;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 3px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.shipyard-gate-desc {
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.55;
  margin: 0 0 16px 0;
  text-align: center;
}

.shipyard-gate-progress-wrap {
  width: 100%;
  max-width: 300px;
  margin-bottom: 14px;
}

.shipyard-gate-progress-bar {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.shipyard-gate-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #d97706, #f59e0b);
  border-radius: 6px;
  transition: width 0.3s ease;
}

.shipyard-gate-progress-label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
  margin-top: 4px;
  text-align: center;
}

/* ==========================================================================
   MULTI-RESOURCE TRADE OFFERS (DIPLOMATIC COMMERCE)
   ========================================================================== */
.multi-trade-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 10px 0;
}

.multi-trade-col {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
}

.multi-trade-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.88rem;
  color: #1e293b;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}

.trade-total-badge {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.multi-trade-res-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.multi-trade-res-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.multi-res-label {
  width: 90px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}

.multi-trade-input {
  flex: 1;
  padding: 4px 8px;
  font-size: 0.85rem;
  height: 28px;
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 4px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  outline: none;
  box-sizing: border-box;
}

.multi-trade-input:focus {
  border-color: #d97706 !important;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2) !important;
}

/* Guard: all numeric and text inputs inside modals must have dark visible text */
.modal-overlay input.coord-input,
.modal-overlay input[type="number"],
.modal-overlay input[type="text"],
.marketplace-exchange-wrap input {
  color: #0f172a !important;
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  font-weight: 700;
}

.modal-overlay input[readonly],
.marketplace-exchange-wrap input[readonly] {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

.multi-res-avail {
  font-size: 0.72rem;
  color: #94a3b8;
  min-width: 42px;
  text-align: right;
}

@media (max-width: 580px) {
  .multi-trade-container {
    grid-template-columns: 1fr;
  }
}

/* Trade Offer Cards in Diplomacy Chancellery */
.trade-offer-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.trade-offer-card:hover {
  border-color: #cbd5e1;
}

.trade-offer-card.status-pending {
  border-left: 4px solid #f59e0b;
}

.trade-offer-card.status-accepted {
  border-left: 4px solid #10b981;
}

.trade-offer-card.status-rejected {
  border-left: 4px solid #ef4444;
}

.trade-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.trade-card-ruler {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e293b;
}

.trade-status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
}

.trade-status-pill.pending {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.trade-status-pill.accepted {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #10b981;
}

.trade-status-pill.rejected {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

.trade-offer-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.trade-details-box-title {
  font-weight: 700;
  color: #475569;
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.trade-details-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.trade-res-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e293b;
}

.trade-card-note {
  font-size: 0.82rem;
  color: #64748b;
  font-style: italic;
  margin-bottom: 8px;
}

.trade-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-trade-accept {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

.btn-trade-accept:hover {
  background: linear-gradient(135deg, #059669, #047857);
}

.btn-trade-reject {
  background: #f1f5f9;
  color: #dc2626;
  border: 1px solid #cbd5e1;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}

.btn-trade-reject:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.btn-trade-counter {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}

.btn-trade-counter:hover {
  background: #dbeafe;
}

/* Ko-fi Footer Button */
.kofi-footer-container {
  margin: 14px 0 10px 0;
  display: flex;
  justify-content: center;
  width: 100%;
}
.kofi-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000000 !important;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 8px 22px;
  border-radius: 9999px;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.4);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
}
.kofi-button:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 26px rgba(245, 158, 11, 0.6);
  filter: brightness(1.05);
}
.kofi-icon {
  font-size: 1.15rem;
  display: inline-block;
  animation: kofi-wiggle 3.5s ease-in-out infinite;
  transform-origin: bottom center;
}
@keyframes kofi-wiggle {
  0%, 82%, 100% { transform: rotate(0deg); }
  86% { transform: rotate(-12deg); }
  90% { transform: rotate(10deg); }
  94% { transform: rotate(-6deg); }
  97% { transform: rotate(4deg); }
}

