:root {
  --bg: #070a14;
  --bg-2: #0c1122;
  --panel: rgba(17, 23, 43, 0.82);
  --line: rgba(148, 163, 207, 0.16);
  --text: #e8ecf6;
  --muted: #8b95b2;
  --accent: #ff7a2f;      /* engine flame */
  --accent-2: #ffb35c;
  --blue: #5aa9ff;
  --up: #2fd083;
  --down: #ff5c6c;
  --gold: #ffd166;
  --radius: 16px;
  --font: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 70% -10%, #1a2350 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}
.stars-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .55;
  background-image:
    radial-gradient(1px 1px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 140px 90px, #cfd8ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 80px 160px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 200px 220px, #9fb2ff 50%, transparent 51%);
  background-size: 240px 240px;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h2 { font-size: 1.15rem; letter-spacing: .02em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(7, 10, 20, .75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: .12em; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 18px; margin-left: auto; }
.nav a { color: var(--muted); font-size: .92rem; }
.nav a:hover { color: var(--text); text-decoration: none; }
@media (max-width: 560px) { .nav { display: none; } #connectBtn { margin-left: auto; } }

.demo-banner {
  text-align: center; padding: 6px; font-size: .8rem; font-weight: 600;
  background: repeating-linear-gradient(45deg, #3a2a00, #3a2a00 10px, #2a1f00 10px, #2a1f00 20px);
  color: var(--gold);
}

main { max-width: 1180px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 32px) 40px; display: grid; gap: 20px; }

/* ---------------- buttons ---------------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: 999px; padding: 10px 18px; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s ease, filter .15s ease, background .15s ease;
  color: var(--text); white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #ff4d2f); color: #fff; box-shadow: 0 6px 24px -8px rgba(255, 106, 47, .7); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: rgba(255,255,255,.05); }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn-lg { padding: 14px 34px; font-size: 1.1rem; }
.btn-gold { background: linear-gradient(135deg, var(--gold), #ff9f43); color: #1b1300; }

/* ---------------- hero ---------------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: stretch; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.eyebrow { color: var(--accent-2); font-family: var(--mono); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 10px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); letter-spacing: -.01em; }
.hero h1 small { font-size: .4em; color: var(--muted); font-family: var(--mono); font-weight: 400; margin-left: 6px; }
.lead { color: #c3cbe2; max-width: 56ch; margin: 14px 0 18px; }
.ca-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; max-width: 100%; }
.ca-label { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.ca-row code { font-family: var(--mono); font-size: .85rem; overflow-wrap: anywhere; min-width: 0; flex: 1; }
.hero-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.fee-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.fee-card h3 { font-size: 1rem; margin-bottom: 14px; }
.fee-bar { display: grid; grid-template-columns: 1fr 1fr; border-radius: 12px; overflow: hidden; }
.fee-half { padding: 14px; display: grid; gap: 2px; }
.fee-half b { font-size: 1.6rem; }
.fee-half span { font-size: .85rem; }
.fee-half.a { background: linear-gradient(135deg, #123a6b, #1d5aa6); }
.fee-half.b { background: linear-gradient(135deg, #6b2a12, #b84a1d); }
.fee-list { margin: 14px 0 0; padding-left: 18px; color: #c3cbe2; font-size: .9rem; display: grid; gap: 4px; }

/* ---------------- stats ---------------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 420px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.stat span { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.stat b { font-family: var(--mono); font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---------------- panels ---------------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.panel-head { display: grid; gap: 6px; margin-bottom: 14px; }
.panel-head.row { display: flex; align-items: center; justify-content: space-between; }
.panel h2 + .pool-big { margin-top: 10px; }

.live-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: .85rem; }
.sep { color: var(--muted); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 0 rgba(47,208,131,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47,208,131,.6); } 70% { box-shadow: 0 0 0 8px rgba(47,208,131,0); } 100% { box-shadow: 0 0 0 0 rgba(47,208,131,0); } }
.seg { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { font: inherit; font-size: .78rem; background: transparent; color: var(--muted); border: 0; padding: 4px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: rgba(255,255,255,.08); color: var(--text); }
.live-canvas { width: 100%; height: clamp(260px, 42vw, 420px); display: block; border-radius: 12px; background: #050814; }

/* ---------------- game ---------------- */
.game-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .game-grid { grid-template-columns: 1fr; } }
.game-wrap { position: relative; width: 100%; max-width: 480px; margin: 0 auto; aspect-ratio: 480 / 640; border-radius: 12px; overflow: hidden; background: #040611; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#gameCanvas { width: 100%; height: 100%; display: block; }
.game-overlay {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px;
  text-align: center; padding: 24px; background: rgba(4, 6, 17, .72); backdrop-filter: blur(2px);
}
.game-overlay h3 { font-size: 1.6rem; }
.game-overlay p { margin: 0; max-width: 32ch; }
.hud { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; }
.hud span { display: block; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.hud b { font-family: var(--mono); font-size: 2rem; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.me-row { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: .88rem; color: var(--muted); }
.me-row b { color: var(--text); font-family: var(--mono); font-weight: 600; }

.side { display: grid; gap: 20px; min-width: 0; }
.countdown { text-align: right; display: grid; }
.countdown b { font-family: var(--mono); font-size: 1.3rem; color: var(--gold); }

.lb { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; counter-reset: r; }
.lb li { counter-increment: r; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.03); font-family: var(--mono); font-size: .88rem; }
.lb li::before { content: counter(r); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; background: rgba(255,255,255,.08); flex: none; }
.lb li.top::before { background: var(--gold); color: #1b1300; font-weight: 700; }
.lb li.me { outline: 1px solid var(--accent); }
.lb li .addr { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lb li .pts { font-weight: 600; }
.lb li.muted::before { display: none; }
.lb li.muted { font-family: var(--font); }

.pool-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pool-big b { font-family: var(--mono); font-size: 1.7rem; color: var(--gold); }
.split { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: .85rem; margin: 8px 0; }
.split td { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.split td:last-child { text-align: right; }

.claim-list { display: grid; gap: 10px; }
.claim-item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.03); border: 1px solid var(--line); }
.claim-item .grow { flex: 1; min-width: 180px; }
.claim-item b { font-family: var(--mono); }
.tag { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.08); }
.tag.ok { background: rgba(47,208,131,.15); color: var(--up); }

.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 20px 16px 40px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: #1a2140; border: 1px solid var(--line); color: var(--text);
  padding: 10px 16px; border-radius: 12px; font-size: .9rem; max-width: calc(100vw - 32px);
  transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--down); }
[hidden] { display: none !important; }

/* ---------------- wallet picker ---------------- */
.wm-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(3, 5, 12, .7); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; }
.wm { width: 100%; max-width: 380px; background: #10162c; border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.8); }
.wm-head { display: flex; align-items: center; justify-content: space-between; }
.wm-head h3 { font-size: 1.15rem; }
.wm-x { background: none; border: 0; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.wm-x:hover { background: rgba(255,255,255,.06); color: var(--text); }
.wm .muted.small { margin: 4px 0 12px; }
.wm-list { display: grid; gap: 8px; }
.wm-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.wm-item:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.wm-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wm-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; color: #fff; overflow: hidden; flex: none; }
.wm-ico img { width: 100%; height: 100%; object-fit: cover; }
.wm-name { flex: 1; font-weight: 600; }
.wm-tag { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--muted); }
.wm-tag.ok { background: rgba(47,208,131,.15); color: var(--up); }
.wm-note { margin: 12px 0 0 !important; }

.pool-wallet { display: grid; gap: 2px; margin: 10px 0 8px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.03); border: 1px dashed var(--line); }
.pool-wallet code { font-family: var(--mono); font-size: .88rem; }

/* ---------------- about / how it works ---------------- */
.about { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 960px) { .about { grid-template-columns: 1fr; } }
.about-card h2 { margin: 8px 0 10px; }
.about-card p { margin: 0 0 10px; color: #c3cbe2; font-size: .93rem; }
.about-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: rgba(255,122,47,.12); border: 1px solid rgba(255,122,47,.25); }
.about-list { margin: 0 0 10px; padding-left: 18px; display: grid; gap: 6px; color: #c3cbe2; font-size: .93rem; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.steps li { counter-increment: s; position: relative; padding-left: 34px; color: #c3cbe2; font-size: .93rem; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: rgba(255,255,255,.08); color: var(--text); }
.steps b, .about-list b { color: var(--text); }
