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

:root {
  --bg:     #0a0f1e;
  --bg2:    #111827;
  --bg3:    #1c2a3a;
  --bg4:    #243040;
  --border: rgba(255,255,255,.07);
  --bord2:  rgba(255,255,255,.14);
  --text:   #e2e8f0;
  --muted:  #6b7a8d;
  --amber:  #f59e0b;
  --green:  #10b981;
  --blue:   #3b82f6;
  --coral:  #f87171;
  --teal:   #5DCAA5;
  --orange: #EF9F27;
  --pink:   #F09595;
  --purple: #7F77DD;
  --r: 8px; --rl: 14px;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── HEADER ─────────────────────────────────── */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-icon { font-size: 24px; }
.brand-name {
  font-size: 18px; font-weight: 700;
  background: linear-gradient(135deg, var(--amber), var(--teal));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-tag {
  font-size: 10px; font-weight: 600; letter-spacing: .05em;
  background: rgba(139,92,246,.2); color: var(--purple);
  border: 1px solid rgba(139,92,246,.3);
  border-radius: 20px; padding: 2px 8px;
}

/* Balances chip */
.bal-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg3); border: 1px solid var(--bord2);
  border-radius: var(--r); padding: 6px 14px;
}
.bal { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.bal-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.bal-val { font-size: 15px; font-weight: 700; }
.bal-val.amber { color: var(--amber); }
.bal-sep { width: 1px; height: 30px; background: var(--border); }
.addr { font-size: 11px; color: var(--muted); font-family: monospace; }
.wallet-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── BUTTONS ────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: none; border-radius: var(--r);
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: filter .15s, transform .1s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover  { filter: brightness(1.12); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-amber  { background: var(--amber);  color: #1a0a00; }
.btn-green  { background: var(--green);  color: #001a0a; }
.btn-ghost  { background: transparent; border: 1px solid var(--bord2); color: var(--muted); }
.btn-ghost:hover { border-color: var(--amber); color: var(--amber); filter: none; }
.btn-sm     { padding: 5px 10px; font-size: 12px; }

/* ── LANDING ─────────────────────────────────── */
.landing {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 56px); padding: 40px 20px;
}
.landing-card {
  background: var(--bg2); border: 1px solid var(--bord2);
  border-radius: var(--rl); padding: 44px 40px;
  max-width: 520px; width: 100%; text-align: center;
}
.landing-icon { font-size: 56px; display: block; margin-bottom: 14px; }
.landing-card h1 { font-size: 28px; font-weight: 800; margin-bottom: 10px; }
.landing-card p  { color: var(--muted); line-height: 1.7; margin-bottom: 20px; }
.landing-card strong { color: var(--text); }
.asset-pills { display: flex; justify-content: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.asset-pill { background: var(--bg3); border: 1px solid var(--bord2); border-radius: 20px; padding: 4px 12px; font-size: 12px; color: var(--muted); }
.asset-pill code { color: var(--amber); font-size: 11px; }
.yields-box { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; margin-bottom: 24px; text-align: left; }
.yields-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 10px; }
.yields-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.yields-row span { color: var(--muted); }
.yields-row strong { color: var(--amber); font-weight: 600; }

/* Wallet buttons */
.wallet-chooser { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.wallet-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px; background: var(--bg3);
  border: 1px solid var(--bord2); border-radius: var(--r);
  cursor: pointer; font-size: 14px; font-weight: 600;
  color: var(--text); width: 100%; text-align: left;
  transition: border-color .15s, background .15s;
}
.wallet-btn:hover { border-color: var(--amber); background: var(--bg4); }
.wallet-btn img { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
.wallet-name { flex: 1; }
.wallet-desc { font-size: 11px; color: var(--muted); font-weight: 400; display: block; }
.wallet-arrow { color: var(--muted); font-size: 20px; }
.landing-note { font-size: 12px; color: var(--muted); }
.landing-note a { color: var(--amber); text-decoration: none; }

/* ── TOOLBAR ────────────────────────────────── */
.toolbar {
  background: var(--bg2); border-bottom: 1px solid var(--border);
  padding: 8px 20px; display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.legend { display: flex; gap: 14px; flex-wrap: wrap; }
.leg { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot.hydro { background: var(--teal); }
.dot.oil   { background: var(--orange); }
.dot.mine  { background: var(--pink); }
.dot.owned { background: var(--purple); border: 2px solid #AFA9EC; }
.income-row { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.income-row strong { color: var(--amber); }

/* ── MAP ─────────────────────────────────────── */
.map-wrap {
  position: relative; background: #071524;
  height: 520px; overflow: hidden; cursor: default;
}
.map-wrap svg { width: 100%; height: 100%; display: block; }
.country-path { fill: #1a3d28; stroke: #071524; stroke-width: .5; }
.graticule    { fill: none; stroke: rgba(255,255,255,.04); stroke-width: .5; }

/* Markers */
.marker { cursor: pointer; }
.marker:hover circle { filter: brightness(1.3); }
.marker-label {
  font-size: 9px; fill: rgba(255,255,255,.7);
  pointer-events: none; text-anchor: middle;
}

/* Tooltip */
.tip {
  position: absolute; background: var(--bg2);
  border: 1px solid var(--bord2); border-radius: var(--rl);
  padding: 14px 16px; width: 228px;
  display: none; z-index: 50; pointer-events: none;
}
.tip.show { display: block; pointer-events: auto; }
.tip-name    { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.tip-country { font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.tip-rows    { border-top: 1px solid var(--border); padding-top: 8px; margin-bottom: 10px; }
.tip-row     { display: flex; justify-content: space-between; padding: 3px 0; font-size: 12px; }
.tip-row span   { color: var(--muted); }
.tip-row strong { color: var(--text); }
.tip-owned { color: var(--teal); font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.tip-progress { margin-bottom: 10px; }
.tip-prog-bar { background: var(--bg3); border-radius: 99px; height: 5px; overflow: hidden; }
.tip-prog-fill { background: linear-gradient(90deg, var(--amber), var(--green)); height: 100%; border-radius: 99px; }
.tip-prog-label { font-size: 10px; color: var(--muted); margin-top: 3px; }
.tip-accrued { font-size: 12px; color: var(--amber); margin-bottom: 8px; font-weight: 500; }

/* ── GAME CONTENT ────────────────────────────── */
.game-body { max-width: 1400px; margin: 0 auto; padding: 20px; display: grid; gap: 20px; }

/* Portfolio */
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 10px; }
.asset-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 14px; position: relative;
}
.asset-card.hydro { border-left: 3px solid var(--teal); }
.asset-card.oil   { border-left: 3px solid var(--orange); }
.asset-card.mine  { border-left: 3px solid var(--pink); }
.ac-flag    { font-size: 16px; margin-bottom: 4px; }
.ac-name    { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.ac-country { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.ac-bar     { background: var(--bg3); border-radius: 99px; height: 4px; margin-bottom: 4px; overflow: hidden; }
.ac-fill    { background: linear-gradient(90deg, var(--amber), var(--green)); height: 100%; border-radius: 99px; }
.ac-pct     { font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.ac-earn    { font-size: 12px; color: var(--amber); font-weight: 600; }
.ac-btn     { width: 100%; margin-top: 8px; }
.no-assets  { color: var(--muted); padding: 16px 0; font-size: 13px; }

/* Leaderboard */
.lb-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--rl); overflow: hidden; }
.lb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lb-table th { background: var(--bg3); text-align: left; padding: 9px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.lb-table td { padding: 9px 14px; border-top: 1px solid var(--border); }
.lb-table .mono { font-family: monospace; font-size: 11px; }
.lb-table .amber { color: var(--amber); font-family: monospace; }

/* ── TOAST ───────────────────────────────────── */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--bg2); border: 1px solid var(--bord2);
  border-radius: var(--r); padding: 11px 16px;
  font-size: 13px; z-index: 9999; max-width: 320px;
  animation: toastIn .25s ease;
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
}
.toast.ok  { border-color: var(--green); }
.toast.err { border-color: var(--coral); }
@keyframes toastIn { from{transform:translateY(12px);opacity:0} to{opacity:1} }

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 600px) {
  .map-wrap { height: 320px; }
  .landing-card { padding: 28px 20px; }
  .asset-grid { grid-template-columns: 1fr 1fr; }
  .game-body { padding: 12px; }
}
