/* =========================================================
   IsoWorld — Global Styles, Landing Page & City Viewer HUD
   ========================================================= */

:root {
  --bg-dark: #0f172a;
  --bg-panel: rgba(15, 23, 42, 0.86);
  --bg-card: rgba(30, 41, 59, 0.78);
  --border-subtle: rgba(148, 163, 184, 0.2);
  --border-glow: rgba(59, 130, 246, 0.55);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --emerald: #10b981;
  --amber: #f59e0b;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-lg: 0 20px 45px rgba(0, 0, 0, 0.42);
}

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

html,
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  color: var(--text-primary);
  background: var(--bg-dark);
  -webkit-font-smoothing: antialiased;
}

/* ---------------- Landing Page ---------------- */

.landing-body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background: radial-gradient(circle at 20% 0%, #1e3a5f 0%, #0f172a 55%, #090d16 100%);
}

.landing-bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    linear-gradient(30deg, #3b82f6 1px, transparent 1px),
    linear-gradient(150deg, #3b82f6 1px, transparent 1px);
  background-size: 64px 37px;
  mask-image: radial-gradient(circle at 50% 20%, black 20%, transparent 78%);
}

.landing-header {
  position: relative;
  z-index: 2;
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-name {
  display: block;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-tag {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.6);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.btn-outline:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.18);
  transform: translateY(-1px);
}

.landing-main {
  position: relative;
  z-index: 2;
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px 24px 64px;
}

.hero {
  text-align: center;
  max-width: 720px;
  margin: 20px auto 44px;
}

.hero-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.hero-sub {
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.selector-section {
  margin-bottom: 42px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.section-meta {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.country-card {
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  color: var(--text-primary);
  backdrop-filter: blur(10px);
  transition: transform 0.18s, border-color 0.2s, box-shadow 0.2s;
}

.country-card.active {
  cursor: pointer;
}

.country-card.active.selected,
.country-card.active:hover {
  border-color: var(--border-glow);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3), 0 14px 28px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.country-card.locked {
  opacity: 0.62;
  cursor: not-allowed;
}

.country-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.country-flag {
  font-size: 1.6rem;
  line-height: 1;
}

.country-card h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.country-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge-live {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-locked {
  background: rgba(245, 158, 11, 0.13);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.32);
}

.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.city-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.42), rgba(15, 23, 42, 0.85));
  border: 1px solid var(--border-glow);
  text-decoration: none;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  transition: transform 0.18s, box-shadow 0.2s;
}

.city-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 50px rgba(37, 99, 235, 0.24);
}

.city-card-preview {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #38bdf8 0%, #7cb342 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.iso-mini-tile {
  width: 36px;
  height: 36px;
  background: #f8fafc;
  transform: rotate(45deg) skew(-15deg, -15deg);
  box-shadow: 6px 6px 0 #1e40af;
  border-radius: 4px;
}

.city-card-info {
  flex: 1;
  min-width: 0;
}

.city-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.city-card-info h3 {
  font-size: 1.2rem;
}

.city-card-info p {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.city-card-cta {
  font-size: 0.86rem;
  font-weight: 700;
  color: #93c5fd;
}

.landing-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle);
}

/* ---------------- Fullscreen City Viewer ---------------- */

.viewer-body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background: #72a944;
  user-select: none;
  touch-action: none;
}

#city-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#city-canvas.dragging {
  cursor: grabbing;
}

.hud-top-bar {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  pointer-events: none;
}

.hud-top-bar > * {
  pointer-events: auto;
}

.hud-top-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hud-economy {
  display: flex;
  align-items: center;
  gap: 12px;
}

.economy-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.22);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

.economy-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.coin-icon {
  background: radial-gradient(circle at 30% 30%, #fde047, #eab308 65%, #b45309 100%);
  color: #713f12;
  font-weight: 900;
  font-size: 1rem;
  box-shadow: inset 0 0 0 2px rgba(254, 240, 138, 0.55);
}

.citizen-icon {
  background: radial-gradient(circle at 30% 30%, #3b82f6, #1d4ed8 100%);
  box-shadow: inset 0 0 0 2px rgba(147, 197, 253, 0.35);
}

.economy-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.economy-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: #94a3b8;
  text-transform: uppercase;
}

.economy-value {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.economy-value-cash {
  color: #facc15;
}

.economy-value-citizens {
  color: #f8fafc;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  color: var(--text-primary);
  font-size: 0.86rem;
}

.hud-back {
  text-decoration: none;
  font-weight: 600;
  transition: border-color 0.2s, background 0.2s;
}

.hud-back:hover {
  border-color: var(--accent);
  background: rgba(30, 41, 59, 0.95);
}

.hud-city-name {
  font-weight: 700;
}

.hud-divider {
  width: 1px;
  height: 14px;
  background: var(--border-subtle);
}

.hud-stat {
  color: #cbd5e1;
  font-size: 0.82rem;
}

.hud-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-claim-floating {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.45);
  transition: transform 0.16s, box-shadow 0.2s;
}

.btn-claim-floating:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.6);
}

.hud-bottom-right {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zoom-controls {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.hud-btn {
  width: 42px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.hud-btn:hover {
  background: rgba(59, 130, 246, 0.22);
}

.hud-btn + .hud-btn {
  border-top: 1px solid var(--border-subtle);
}

.hud-bottom-left {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-coords {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: #cbd5e1;
}

/* ---------------- Resident / Plot Pop-up Modal ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 6, 23, 0.56);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.resident-modal {
  width: 100%;
  max-width: 390px;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s ease;
}

.modal-backdrop.open .resident-modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.modal-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 10px;
  background: rgba(59, 130, 246, 0.16);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.modal-badge.available {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
}

.resident-modal h2 {
  font-size: 1.35rem;
  margin-bottom: 4px;
}

.modal-coords {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.modal-note {
  font-size: 0.92rem;
  line-height: 1.5;
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
}

.modal-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  transition: background 0.15s;
}

.modal-action-btn:hover {
  background: var(--accent-hover);
}

@media (max-width: 820px) {
  .hud-stat.hide-mobile,
  .hud-divider.hide-mobile {
    display: none;
  }
}

@media (max-width: 640px) {
  .hud-top-left {
    top: 10px;
    left: 10px;
  }
  .hud-top-right {
    top: 10px;
    right: 10px;
  }
  .btn-claim-floating {
    padding: 9px 13px;
    font-size: 0.8rem;
  }
  .hud-bottom-left {
    left: 10px;
    bottom: 10px;
  }
  .hud-bottom-right {
    right: 10px;
    bottom: 10px;
  }
}
