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

:root {
  --bg:      #080c14;
  --bg2:     #0f1623;
  --bg3:     #172030;
  --bg4:     #1e2a3c;
  --border:  rgba(255,255,255,.07);
  --bord2:   rgba(255,255,255,.13);
  --text:    #e2e8f0;
  --muted:   #64748b;
  --amber:   #f59e0b;
  --green:   #10b981;
  --blue:    #3b82f6;
  --red:     #ef4444;
  --r: 10px;
}

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.6;
  min-height: 100vh;
}

/* ── HEADER ──────────────────────────────── */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name {
  font-size: 20px; font-weight: 800;
  background: linear-gradient(135deg, #f59e0b, #10b981);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-sub { font-size: 11px; color: var(--muted); }
.wallet-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg3); border: 1px solid var(--bord2);
  border-radius: var(--r); padding: 6px 14px;
}
.wallet-chip .addr { font-family: monospace; font-size: 12px; color: var(--muted); }
.wallet-chip .bal  { font-weight: 700; color: var(--amber); }

/* ── BUTTONS ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: var(--r);
  padding: 9px 18px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: filter .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover  { filter: brightness(1.12); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }
.btn-amber { background: var(--amber); color: #1a0800; }
.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: 6px 12px; font-size: 12px; }

/* ── LANDING ─────────────────────────────── */
.landing {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 60px); padding: 40px 20px;
}
.landing-card {
  background: var(--bg2); border: 1px solid var(--bord2);
  border-radius: 16px; padding: 48px 40px;
  max-width: 480px; width: 100%; text-align: center;
}
.landing-icon { font-size: 64px; margin-bottom: 16px; display: block; }
.landing-card h1 { font-size: 32px; font-weight: 800; margin-bottom: 8px; }
.landing-card p  { color: var(--muted); line-height: 1.7; margin-bottom: 24px; }
.landing-card strong { color: var(--text); }

.asset-tags { display: flex; justify-content: center; gap: 8px; margin-bottom: 28px; flex-wrap: wrap; }
.asset-tag  {
  background: var(--bg3); border: 1px solid var(--bord2);
  border-radius: 20px; padding: 4px 12px;
  font-size: 12px; color: var(--muted);
}
.asset-tag code { color: var(--amber); font-size: 11px; }

.wallet-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 18px;
  background: var(--bg3); border: 1px solid var(--bord2);
  border-radius: var(--r); cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--text);
  transition: border-color .15s, background .15s;
}
.wallet-btn:hover { border-color: var(--amber); background: var(--bg4); }
.wallet-btn img   { width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0; }
.wallet-btn-text  { flex: 1; text-align: left; }
.wallet-btn-sub   { font-size: 11px; color: var(--muted); font-weight: 400; display: block; }
.wallet-btn-arrow { color: var(--muted); font-size: 22px; }
.landing-note { font-size: 12px; color: var(--muted); margin-top: 16px; }
.landing-note a { color: var(--amber); text-decoration: none; }

/* ── GAME ────────────────────────────────── */
.page { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }

.section-title {
  font-size: 18px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.section-title .count {
  font-size: 12px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 8px; color: var(--muted); font-weight: 400;
}

/* Mine cards grid */
.mines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 40px;
}

.mine-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px 16px;
  cursor: pointer; transition: border-color .2s, transform .15s;
  position: relative; overflow: hidden;
}
.mine-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--mine-color, var(--amber));
}
.mine-card:hover { border-color: var(--mine-color, var(--amber)); transform: translateY(-2px); }
.mine-card.owned { border-color: var(--mine-color, var(--amber)); opacity: .8; }
.mine-card.owned:hover { transform: none; }

.mine-emoji { font-size: 32px; margin-bottom: 8px; display: block; }
.mine-name  { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.mine-price { font-size: 13px; color: var(--amber); font-weight: 600; margin-bottom: 2px; }
.mine-yield { font-size: 12px; color: var(--muted); }
.mine-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px; margin-top: 8px;
  text-transform: uppercase; letter-spacing: .06em;
}
.mine-badge.owned    { background: rgba(16,185,129,.15); color: var(--green); border: 1px solid rgba(16,185,129,.3); }
.mine-badge.building { background: rgba(245,158,11,.15); color: var(--amber); border: 1px solid rgba(245,158,11,.3); }
.mine-badge.ready    { background: rgba(59,130,246,.15); color: var(--blue); border: 1px solid rgba(59,130,246,.3); }

/* Build progress bar */
.build-bar { margin-top: 10px; }
.build-track { background: var(--bg3); border-radius: 99px; height: 5px; overflow: hidden; }
.build-fill  { background: var(--amber); height: 100%; border-radius: 99px; transition: width .5s; }
.build-label { font-size: 10px; color: var(--muted); margin-top: 3px; }

/* My mines table */
.owned-section { margin-bottom: 40px; }
.owned-table-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.owned-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.owned-table th {
  background: var(--bg3); text-align: left; padding: 10px 14px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.owned-table td { padding: 11px 14px; border-top: 1px solid var(--border); }
.owned-table td:last-child { text-align: right; }
.no-mines { padding: 24px; text-align: center; color: var(--muted); }

/* Progress in table */
.tbl-bar { background: var(--bg3); border-radius: 99px; height: 4px; overflow: hidden; min-width: 80px; }
.tbl-fill { background: var(--amber); height: 100%; border-radius: 99px; }

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

/* ── MODAL ───────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg2); border: 1px solid var(--bord2);
  border-radius: 16px; padding: 32px 28px;
  max-width: 400px; width: 90%; position: relative;
  transform: translateY(8px); transition: transform .2s;
}
.modal-overlay.open .modal { transform: none; }
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; color: var(--muted);
  font-size: 20px; cursor: pointer; line-height: 1;
}
.modal-emoji  { font-size: 48px; margin-bottom: 12px; display: block; }
.modal-title  { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.modal-sub    { color: var(--muted); margin-bottom: 20px; font-size: 13px; }
.modal-rows   { border-top: 1px solid var(--border); padding-top: 14px; margin-bottom: 18px; }
.modal-row    { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.modal-row span  { color: var(--muted); }
.modal-row strong { color: var(--text); }
.modal-row .amber { color: var(--amber); }
.modal-row .green { color: var(--green); }
.modal-actions { display: flex; gap: 8px; }
.modal-actions .btn { flex: 1; justify-content: center; }

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

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 600px) {
  .landing-card { padding: 28px 18px; }
  .mines-grid { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 16px 12px; }
}
