/* APEX Empire — Game CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #06080F;
  --bg-card: #0C1018;
  --bg-card-hover: #111827;
  --bg-input: #0D1117;
  --gold: #D4A843;
  --gold-hover: #F0C75E;
  --gold-dim: #8B7330;
  --text: #E8E8E8;
  --text-dim: #888;
  --text-muted: #555;
  --green: #4ade80;
  --red: #f87171;
  --blue: #60a5fa;
  --purple: #c084fc;
  --orange: #fbbf24;
  --border: #1a1f2e;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; overflow: hidden; -webkit-tap-highlight-color: transparent; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, .nav-item, .bnav-item, .more-item, .option-card { 
  touch-action: manipulation; 
  -webkit-user-select: none; 
  user-select: none; 
}

/* === LAYOUT === */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
#top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 20px; background: var(--bg-card);
  border-bottom: 1px solid var(--border); min-height: 48px; flex-shrink: 0;
}
#top-bar .logo { font-weight: 700; font-size: 18px; color: var(--gold); letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
.game-logo-img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); flex-shrink: 0; }
#top-bar .stats { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
#top-bar .stat { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
#top-bar .controls { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

#main-container { display: flex; flex: 1; overflow: hidden; }

/* === LEFT SIDEBAR === */
#sidebar {
  width: 200px; min-width: 200px; background: var(--bg-card);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; cursor: pointer; transition: all 0.2s;
  border-left: 3px solid transparent; font-size: 13px;
}
.nav-item:hover { background: var(--bg-card-hover); color: var(--gold); }
.nav-item.active { border-left-color: var(--gold); color: var(--gold); background: rgba(212,168,67,0.08); }
.nav-icon { font-size: 18px; }

/* === CONTENT === */
#content {
  flex: 1; overflow-y: auto; padding: 20px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
#content::-webkit-scrollbar { width: 6px; }
#content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* === RIGHT SIDEBAR === */
#right-panel {
  width: 320px; min-width: 320px; background: var(--bg-card);
  border-left: 1px solid var(--border); display: flex; flex-direction: column;
  overflow: hidden;
}
#right-panel .panel-section {
  border-bottom: 1px solid var(--border); padding: 12px;
}
#right-panel .panel-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--gold); margin-bottom: 8px;
}
#news-feed { flex: 1; overflow-y: auto; padding: 12px; }
#news-feed::-webkit-scrollbar { width: 4px; }
#news-feed::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.news-item {
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 12px; line-height: 1.4;
}
.news-item.positive { color: var(--green); }
.news-item.negative { color: var(--red); }
.news-item.warning { color: var(--orange); }
.news-item.event { color: var(--blue); }
.news-item.gold { color: var(--gold); font-weight: 600; }
.news-item.action { color: var(--purple); }
.news-item .day { color: var(--text-muted); font-size: 10px; margin-right: 6px; }

#alerts-panel { max-height: 160px; overflow-y: auto; }
.alert-item { padding: 6px 8px; margin: 4px 0; border-radius: 6px; font-size: 12px; background: rgba(248,113,113,0.1); color: var(--red); }
.alert-item.critical { background: rgba(248,113,113,0.2); font-weight: 600; }
.alert-item.warning { background: rgba(251,191,36,0.1); color: var(--orange); }
.alert-item.info { background: rgba(96,165,250,0.1); color: var(--blue); }

/* === ACTION BAR === */
#action-bar {
  display: flex; gap: 8px; padding: 10px 20px;
  background: var(--bg-card); border-top: 1px solid var(--border);
  flex-wrap: wrap; flex-shrink: 0;
}
.action-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text); cursor: pointer;
  font-size: 12px; font-family: inherit; transition: all 0.2s; white-space: nowrap;
}
.action-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(212,168,67,0.08); }
.action-btn:active { transform: scale(0.96); }

/* === CARDS === */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.card-title {
  font-size: 13px; font-weight: 600; color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }

/* === PROGRESS BARS === */
.progress-bar {
  height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.progress-fill.green { background: var(--green); }
.progress-fill.red { background: var(--red); }
.progress-fill.gold { background: var(--gold); }
.progress-fill.blue { background: var(--blue); }
.progress-fill.purple { background: var(--purple); }

.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; }
.stat-label { color: var(--text-dim); }
.stat-value { font-weight: 600; }
.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }

/* === EXEC CARDS === */
.exec-card {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; margin-bottom: 8px;
}
.exec-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.exec-name { font-weight: 600; font-size: 14px; }
.exec-role { color: var(--text-dim); font-size: 12px; }
.exec-bars { display: flex; flex-direction: column; gap: 4px; }
.exec-bar-row { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.exec-bar-label { width: 70px; color: var(--text-dim); }
.exec-bar { flex: 1; }
.exec-bar-val { width: 35px; text-align: right; font-weight: 500; }

.warning-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; margin-top: 4px;
}
.warning-badge.danger { background: rgba(248,113,113,0.2); color: var(--red); }
.warning-badge.warn { background: rgba(251,191,36,0.2); color: var(--orange); }

/* === MARKET === */
.market-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.03); }
.market-rank { font-weight: 700; color: var(--gold); width: 24px; }
.market-name { width: 120px; }
.market-bar { flex: 1; }

/* === WORLD MAP === */
.city-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.city-locked { color: var(--text-muted); }

/* === CHARACTER CREATION === */
#creation-screen {
  position: fixed; inset: 0; background: var(--bg-primary);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; overflow-y: auto;
}
.creation-card {
  background: var(--bg-card); border: 1px solid var(--gold);
  border-radius: 16px; padding: 32px 28px;
  max-width: 680px; width: 100%; max-height: 100vh;
  position: relative; overflow-y: auto;
}
.creation-card h1 { color: var(--gold); font-size: 28px; text-align: center; margin-bottom: 8px; }

/* 3D Logo */
.logo-3d-container {
  perspective: 800px;
  display: flex; justify-content: center; margin-bottom: 20px;
  position: relative;
}
.logo-3d {
  width: 160px; height: 160px;
  animation: logoFloat 4s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(212,168,67,0.4));
  transform-style: preserve-3d;
}
.logo-glow {
  position: absolute; top: 50%; left: 50%;
  width: 200px; height: 200px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(212,168,67,0.15) 0%, transparent 70%);
  animation: logoGlow 3s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes logoFloat {
  0%, 100% { transform: rotateY(-5deg) rotateX(5deg) translateY(0); }
  50% { transform: rotateY(5deg) rotateX(-3deg) translateY(-10px); }
}
@keyframes logoGlow {
  0% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}
.title-3d {
  color: var(--gold);
  font-size: 32px;
  text-align: center;
  text-shadow: 0 0 40px rgba(212,168,67,0.3), 0 2px 10px rgba(0,0,0,0.5);
  letter-spacing: 6px;
  font-weight: 800;
  margin-bottom: 8px;
}

/* Avatar Preview */
.avatar-preview {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 20px; gap: 8px;
}
.avatar-frame {
  width: 100px; height: 100px;
  border-radius: 50%; position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border: 3px solid var(--border);
  transition: all 0.5s ease;
  background: var(--bg-input);
}
.avatar-frame.has-combo {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(212,168,67,0.3), 0 0 40px rgba(212,168,67,0.1);
}
.avatar-frame.avatar-lg {
  width: 120px; height: 120px;
  border-width: 4px;
}
.avatar-base {
  width: 100%; height: 100%;
  object-fit: cover;
  position: absolute; top: 0; left: 0;
  transition: filter 0.5s ease;
}
.avatar-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  mix-blend-mode: color;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.avatar-ring {
  position: absolute; top: -4px; left: -4px; right: -4px; bottom: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color 0.5s ease;
}
.avatar-label {
  font-size: 12px; color: var(--text-dim); text-align: center;
  font-style: italic;
}

/* Personality visual effects */
.personality-visionario .avatar-overlay { background: linear-gradient(135deg, #3b82f6, #8b5cf6); opacity: 0.35; }
.personality-visionario .avatar-base { filter: contrast(1.1) brightness(1.1); }
.personality-visionario .avatar-ring { border-color: #8b5cf6; box-shadow: 0 0 15px rgba(139,92,246,0.4); }

.personality-agressivo .avatar-overlay { background: linear-gradient(135deg, #ef4444, #f97316); opacity: 0.35; }
.personality-agressivo .avatar-base { filter: contrast(1.2) saturate(1.3); }
.personality-agressivo .avatar-ring { border-color: #ef4444; box-shadow: 0 0 15px rgba(239,68,68,0.4); }

.personality-diplomata .avatar-overlay { background: linear-gradient(135deg, #10b981, #34d399); opacity: 0.3; }
.personality-diplomata .avatar-base { filter: brightness(1.05) saturate(0.9); }
.personality-diplomata .avatar-ring { border-color: #10b981; box-shadow: 0 0 15px rgba(16,185,129,0.4); }

.personality-mercenario .avatar-overlay { background: linear-gradient(135deg, #d4a843, #f0c75e); opacity: 0.3; }
.personality-mercenario .avatar-base { filter: contrast(1.15) brightness(0.95); }
.personality-mercenario .avatar-ring { border-color: #d4a843; box-shadow: 0 0 15px rgba(212,168,67,0.5); }

/* Wizard Progress */
.wizard-progress { height: 3px; background: var(--border); border-radius: 4px; margin-bottom: 16px; overflow: hidden; }
.wizard-progress-fill { height: 100%; background: var(--gold); border-radius: 4px; transition: width 0.4s ease; width: 20%; }
.wizard-steps { display: flex; gap: 8px; justify-content: center; margin-bottom: 24px; }
.wstep {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-dim); font-weight: 600; transition: all 0.3s;
}
.wstep.active { border-color: var(--gold); color: var(--gold); background: rgba(212,168,67,0.1); }
.wstep.done { border-color: var(--gold); background: var(--gold); color: #000; }

/* Wizard Steps */
.wizard-step { display: none; animation: fadeUp 0.35s ease; }
.wizard-step.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.step-icon { font-size: 48px; text-align: center; margin-bottom: 12px; }
.step-number { font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; margin-bottom: 8px; }
.step-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.step-desc { font-size: 14px; color: var(--text-dim); line-height: 1.5; margin-bottom: 16px; }
.step-hint { font-size: 12px; color: var(--text-dim); text-align: center; margin-top: 16px; font-style: italic; }

/* Wizard Inputs */
.wizard-step input[type="text"] {
  width: 100%; padding: 14px 16px; border-radius: 10px; border: 2px solid var(--border);
  background: var(--bg-input); color: var(--text); font-family: inherit; font-size: 16px;
  transition: border-color 0.2s; margin-bottom: 16px; box-sizing: border-box;
}
.wizard-step input[type="text"]:focus { outline: none; border-color: var(--gold); }
.wizard-step input[type="text"]::placeholder { color: rgba(255,255,255,0.25); }

/* Wizard Option Cards */
.wizard-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; max-height: 340px; overflow-y: auto; padding-right: 4px; }
.wizard-options::-webkit-scrollbar { width: 4px; }
.wizard-options::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.woption {
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: all 0.2s;
}
.woption:hover { border-color: var(--gold-dim); background: rgba(212,168,67,0.03); }
.woption.selected { border-color: var(--gold); background: rgba(212,168,67,0.08); }
.woption.selected .woption-img { border-color: var(--gold); }
.woption-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.woption-img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); flex-shrink: 0; }
.woption-icon { font-size: 18px; }
.woption-name { font-weight: 600; font-size: 14px; color: var(--text); flex: 1; }
.woption-tag { font-size: 11px; color: var(--gold); background: rgba(212,168,67,0.15); padding: 2px 8px; border-radius: 12px; font-weight: 600; }
.woption-body { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.wpro { font-size: 11px; color: #4ade80; }
.wcon { font-size: 11px; color: #f87171; }

/* Summary Card */
.summary-card { background: var(--bg-input); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.summary-row:last-child { border-bottom: none; }
.summary-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.summary-value { font-size: 14px; font-weight: 600; color: var(--text); }

/* Buttons */
.btn-primary {
  display: block; width: 100%; padding: 14px; margin-top: 8px;
  background: linear-gradient(135deg, var(--gold), var(--gold-hover));
  color: #000; font-weight: 700; font-size: 15px; border: none;
  border-radius: 10px; cursor: pointer; font-family: inherit; transition: all 0.2s;
  box-sizing: border-box;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(212,168,67,0.3); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-full { width: 100%; }
.btn-back {
  background: none; border: none; color: var(--text-dim); font-size: 13px;
  cursor: pointer; padding: 8px 0; font-family: inherit; transition: color 0.2s;
}
.btn-back:hover { color: var(--text); }
.wizard-back-btn { margin-top: 12px; }

/* === PANELS === */
.panel { display: none; }
.panel.active { display: block; }
.section-title { font-size: 16px; font-weight: 600; color: var(--gold); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* === KPI GRID === */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; text-align: center;
}
.kpi-value { font-size: 20px; font-weight: 700; }
.kpi-label { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* === RESPONSIVE === */

/* Tablet */
@media (max-width: 1024px) {
  #right-panel { display: none; }
  #sidebar { width: 60px; min-width: 60px; }
  .nav-item span:not(.nav-icon) { display: none; }
  .nav-item { justify-content: center; padding: 12px 8px; }
  .mobile-news-btn { display: flex !important; }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE: MOBILE (max-width: 768px)
   ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  html, body { overflow: hidden; -webkit-overflow-scrolling: touch; }

  /* ── TOUCH INTERACTIONS ── */
  #app { touch-action: manipulation; height: 100dvh; }

  /* Disable hover-dependent behaviors on mobile */
  .nav-item:hover,
  .action-btn:hover,
  .bnav-item:hover,
  .more-item:hover,
  .woption:hover,
  .btn-primary:hover,
  .btn-back:hover,
  .tab-btn:hover {
    background: unset;
    color: unset;
    border-color: unset;
    transform: unset;
    box-shadow: unset;
  }
  .nav-item.active:hover { background: rgba(212,168,67,0.08); color: var(--gold); }

  /* Touch active states */
  .action-btn:active { transform: scale(0.94); opacity: 0.85; }
  .bnav-item:active { transform: scale(0.9); }
  .nav-item:active { background: rgba(212,168,67,0.06); }
  .more-item:active { transform: scale(0.92); background: rgba(255,255,255,0.05); }
  .btn-primary:active { transform: scale(0.97); }

  /* ── LAYOUT ── */
  #sidebar { display: none !important; }
  #right-panel { display: none !important; }
  #main-container { flex: 1; overflow: hidden; }

  /* ── TOP BAR — Full width stats ── */
  #top-bar {
    padding: 6px 12px;
    min-height: 44px;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
  }
  #top-bar .logo {
    font-size: 15px;
    flex-shrink: 0;
  }
  #top-bar .logo span {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
  }
  .game-logo-img {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px;
    min-height: 26px;
  }
  #top-bar .stats {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px 8px;
    font-size: 11px;
  }
  #top-bar .stat {
    gap: 3px;
    white-space: nowrap;
    font-size: 11px;
  }
  #top-bar .controls { gap: 4px; flex-shrink: 0; }
  #top-bar .controls .action-btn {
    padding: 5px 8px;
    font-size: 12px;
    min-height: 34px;
    border-radius: 6px;
  }
  /* Hide save/load on mobile top bar (accessible via menu) */
  #btn-save, #btn-load { display: none; }
  .mobile-menu-btn { display: flex !important; }
  .mobile-news-btn { display: none !important; }

  /* ── CONTENT — Full width ── */
  #content {
    padding: 12px 16px;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    overflow-y: auto;
  }

  /* ── SECTION TITLES (sticky) ── */
  .section-title {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
    padding: 10px 0 8px;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    font-size: 15px;
  }

  /* ── ACTION BAR — Full width scrollable pills ── */
  #action-bar {
    padding: 8px 12px;
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    border-top: 1px solid var(--border);
    position: relative;
    min-height: 56px;
    align-items: center;
    background: var(--bg-card);
    flex-shrink: 0;
  }
  #action-bar::-webkit-scrollbar { display: none; }

  /* Show icon only on mobile for more space */
  .action-btn span.btn-text { display: none !important; }
  #action-bar .action-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
    font-size: 18px;
    flex-shrink: 0;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    white-space: nowrap;
  }

  /* Scroll fade indicators */
  #action-bar::before,
  #action-bar::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 28px;
    z-index: 1;
    pointer-events: none;
    transition: opacity 0.3s;
  }
  #action-bar::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-card), transparent);
    opacity: 0;
  }
  #action-bar::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-card), transparent);
    opacity: 1;
  }
  #action-bar.scroll-start::before { opacity: 1; }
  #action-bar.scroll-end::after { opacity: 0; }

  /* ── KPI GRID (2 columns, bigger) ── */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi {
    padding: 12px 10px;
    min-height: 72px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .kpi-value { font-size: 17px; }
  .kpi-label { font-size: 10px; }

  /* ── CARDS ── */
  .card { padding: 14px; margin-bottom: 12px; }
  .card-grid { grid-template-columns: 1fr; }
  .card-title { font-size: 13px; margin-bottom: 10px; }
  .stat-row { padding: 6px 0; font-size: 12px; }
  .stat-label { font-size: 11px; }

  /* ── EXEC CARDS ── */
  .exec-card {
    padding: 14px;
    margin-bottom: 12px;
    border-radius: 10px;
  }
  .exec-header { flex-wrap: wrap; gap: 6px; }
  .exec-name { font-size: 15px; }
  .exec-role { font-size: 11px; }
  .exec-bar-row { font-size: 10px; }
  .exec-bar-label { width: 60px; font-size: 10px; }

  /* Gold border for pending request */
  .exec-card:has(.exec-pending) {
    border: 2px solid var(--gold);
    box-shadow: 0 0 16px rgba(212,168,67,0.15);
    background: rgba(212,168,67,0.02);
  }
  .exec-pending {
    padding: 10px !important;
    border-width: 2px !important;
  }

  /* Exec action buttons → 2x2 grid */
  .exec-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin-top: 10px !important;
  }
  .exec-actions .action-btn {
    justify-content: center;
    width: 100%;
    min-height: 44px;
    font-size: 12px !important;
    padding: 8px 6px !important;
    border-radius: 8px !important;
  }

  /* ── BOTTOM NAV — Full width, prominent ── */
  #bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 200;
    height: 60px;
    padding-bottom: env(safe-area-inset-bottom);
    justify-content: space-around;
    flex-shrink: 0;
  }
  .bnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 9px;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
    min-width: 48px;
    position: relative;
    transition: color 0.2s;
    padding: 4px 0;
  }
  .bnav-item.active {
    color: var(--gold);
  }
  .bnav-item.active::after {
    content: '';
    position: absolute;
    top: 0; left: 25%; right: 25%;
    height: 2px;
    background: var(--gold);
    border-radius: 0 0 2px 2px;
  }
  .bnav-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: background 0.2s;
  }
  .bnav-item.active .bnav-icon {
    background: rgba(212,168,67,0.12);
  }
  .bnav-text {
    font-size: 9px;
    line-height: 1;
    text-align: center;
  }

  /* ── MORE MENU ── */
  #more-menu {
    display: none;
    position: fixed;
    bottom: 60px; left: 0; right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 250;
    padding: 12px;
    max-height: 50vh;
    overflow-y: auto;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  }
  #more-menu.show {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    animation: mobileMenuUp 0.2s ease;
  }
  .more-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 4px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 10px;
    min-height: 60px;
    justify-content: center;
  }
  .more-icon { font-size: 22px; }

  /* ── NEWS BOTTOM SHEET ── */
  #mobile-news-overlay {
    position: fixed; inset: 0;
    z-index: 300;
    pointer-events: none;
    background: transparent;
    transition: background 0.3s ease;
  }
  #mobile-news-overlay.show {
    pointer-events: auto;
    background: rgba(0,0,0,0.6);
  }
  #mobile-news-sheet {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-card);
    max-height: 60vh;
    border-radius: 16px 16px 0 0;
    padding: 16px;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.5);
  }
  #mobile-news-overlay.show #mobile-news-sheet {
    transform: translateY(0);
  }
  .sheet-handle {
    width: 40px; height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    margin: 0 auto 16px;
  }

  /* ── MODALS / ALERTS ── */
  .modal, .modal-overlay, [class*="modal-"], [role="dialog"] {
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    top: auto !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: 90vh;
    border-radius: 16px 16px 0 0 !important;
    margin: 0 !important;
    transform: none !important;
  }

  /* ── CREATION SCREEN MOBILE ── */
  .creation-card {
    padding: 20px 16px; max-width: 100%; width: 100%;
    max-height: 100vh; overflow-y: auto;
    border-radius: 0; border: none;
  }
  .creation-card h1 { font-size: 22px; }
  .step-title { font-size: 18px; }
  .step-desc { font-size: 13px; }
  .woption { padding: 12px 14px; }
  .woption-name { font-size: 13px; }
  .wizard-options { max-height: 280px; }
  .logo-3d { width: 120px; height: 120px; }
  .title-3d { font-size: 24px; letter-spacing: 4px; }
  .avatar-frame { width: 80px; height: 80px; }
  .avatar-frame.avatar-lg { width: 100px; height: 100px; }

  /* ── CTX TIPS ── */
  .ctx-tip { font-size: 11px; padding: 10px; }

  /* ── BOTTOM SPACING ── */
  #app { padding-bottom: 0; }
  /* Action bar fixed just above bottom nav */
  #action-bar {
    position: fixed;
    bottom: 60px;
    left: 0; right: 0;
    z-index: 199;
    margin-bottom: 0;
    background: linear-gradient(to bottom, var(--bg-card), rgba(12,16,24,0.98));
    box-shadow: 0 -4px 16px rgba(0,0,0,0.3);
  }
  /* Content needs padding for action bar + bottom nav */
  #content { padding-bottom: 130px; }
  #top-bar { padding-top: max(6px, env(safe-area-inset-top)); }

  /* ── MARKET ROWS ── */
  .market-row { gap: 8px; font-size: 12px; }
  .market-name { width: 90px; font-size: 11px; }

  /* ── WORLD / CITY ROWS ── */
  .city-row { flex-wrap: wrap; gap: 6px; }
}

@keyframes mobileMenuUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ── Hidden on desktop ── */
#bottom-nav { display: none; }
#more-menu { display: none; }
#mobile-news-overlay { display: none; }
.mobile-news-btn { display: none; }
.mobile-menu-btn { display: none; }

/* === MISC === */
.tab-bar { display: flex; gap: 4px; margin-bottom: 16px; }
.tab-btn { padding: 8px 16px; border-radius: 8px 8px 0 0; background: transparent; border: 1px solid var(--border); border-bottom: none; color: var(--text-dim); cursor: pointer; font-family: inherit; font-size: 12px; }
.tab-btn.active { background: var(--bg-input); color: var(--gold); border-color: var(--gold); }

.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ═══════════════════════════════════════════════════════
   CREATION WIZARD — Full Screen Mobile
   ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #creation-screen {
    align-items: flex-start;
    padding: 0;
  }
  .creation-card {
    max-width: 100%;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    border: none;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
  }
  .creation-card h1 { font-size: 24px; }
  .title-3d { font-size: 26px; letter-spacing: 4px; }
  .logo-3d { width: 120px; height: 120px; }
  .step-desc { font-size: 13px; margin-bottom: 16px; }
  .step-title { font-size: 20px; }
  .wizard-options { max-height: none; flex: 1; overflow-y: auto; }
  .woption { padding: 12px; }
  .woption-header { font-size: 14px; }
  .woption-body { font-size: 11px; }
  .btn-primary { min-height: 48px; font-size: 15px; }
  .btn-back { min-height: 44px; }
  input[type="text"] { min-height: 48px; font-size: 16px; }

  /* Avatar preview */
  .avatar-frame { width: 80px; height: 80px; }
  .summary-avatar .avatar-lg { width: 100px; height: 100px; }
}

/* ═══════════════════════════════════════════════════════
   CREATION WIZARD — Desktop Wide
   ═══════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  .creation-card {
    max-width: 720px;
    padding: 40px 48px;
  }
  .wizard-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: none;
  }
  .logo-3d { width: 180px; height: 180px; }
  .title-3d { font-size: 36px; }
}

/* ═══════════════════════════════════════════════════════
   GAME — Desktop Improvements
   ═══════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  #content { padding: 24px 28px; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .kpi { padding: 14px 12px; }
  .kpi-value { font-size: 20px; }
  .card { padding: 20px; }
}
