:root {
  --oil: #0d0f12;
  --oil-2: #12151a;
  --panel: #161a20;
  --panel-2: #1c2129;
  --steel: #1f2937;
  --steel-2: #2b3544;
  --line: #2a313c;
  --text: #e5e7eb;
  --muted: #9aa3b2;
  --dim: #6b7280;
  --gold: #f59e0b;
  --gold-2: #fbbf24;
  --gold-dark: #b45309;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #60a5fa;
  --hazard: repeating-linear-gradient(-45deg, #f59e0b 0 10px, #111316 10px 20px);
  --hud-h: 64px;
  --panel-w: 380px;
  --mono: 'Share Tech Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Rajdhani', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--oil); color: var(--text); font-family: var(--sans); font-size: 15px; overflow: hidden; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--gold-2); }

/* ------------------------------------------------------------- HUD */
#hud {
  position: fixed; inset: 0 0 auto 0; height: var(--hud-h); z-index: 20;
  display: flex; align-items: center; gap: 14px; padding: 0 14px;
  background: linear-gradient(180deg, #171b21, #101317);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 0 #000, 0 6px 20px rgba(0,0,0,.5);
}
#hud::after { content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px; background: var(--hazard); opacity: .85; }
.brand { display: flex; align-items: center; gap: 8px; flex: none; }
.brand svg { width: 30px; height: 30px; filter: drop-shadow(0 0 6px rgba(245,158,11,.5)); }
.brand-text { font-weight: 700; letter-spacing: .08em; line-height: .95; font-size: 13px; color: var(--muted); }
.brand-text b { display: block; color: var(--gold); font-size: 18px; letter-spacing: .14em; }
.stats { display: flex; gap: 8px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.stats::-webkit-scrollbar { display: none; }
.stat {
  position: relative; flex: none; min-width: 108px; padding: 5px 10px 6px; border-radius: 6px;
  background: linear-gradient(180deg, #0b0d10, #14181e); border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
  text-align: left;
}
.stat label { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.stat .v { font-family: var(--mono); font-size: 17px; color: var(--gold-2); white-space: nowrap; }
.stat small { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.stat .gauge { height: 4px; border-radius: 2px; background: #000; margin-top: 3px; overflow: hidden; }
.stat .gauge i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #92400e, var(--gold)); transition: width .4s; }
.stat .gauge i.full { background: var(--red); animation: blink 1s steps(2) infinite; }
.stat-market { cursor: pointer; }
.stat-market:hover { border-color: var(--gold-dark); }
.chg.up { color: var(--green); } .chg.down { color: var(--red); }
.wallet-area { display: flex; align-items: center; gap: 8px; flex: none; }
.badge {
  font-family: var(--mono); font-size: 12px; padding: 4px 8px; border-radius: 999px;
  background: rgba(245,158,11,.12); color: var(--gold-2); border: 1px solid rgba(245,158,11,.45); white-space: nowrap;
}

/* ------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 6px; border: 1px solid var(--steel-2); cursor: pointer;
  background: linear-gradient(180deg, #2a3341, #1d242e); color: var(--text); font-weight: 600; letter-spacing: .03em;
  transition: transform .06s, filter .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); border-color: #3d4a5d; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-gold { background: linear-gradient(180deg, #fbbf24, #d97706); color: #1a1205; border-color: #f59e0b; text-shadow: 0 1px 0 rgba(255,255,255,.3); }
.btn-ghost { background: transparent; }
.btn-danger { background: linear-gradient(180deg, #7f1d1d, #571313); border-color: #991b1b; }
.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-big { padding: 12px 22px; font-size: 17px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 6px; border: 1px solid var(--line); cursor: pointer;
  background: #14181e; color: var(--muted); font-size: 18px; display: grid; place-items: center;
}
.icon-btn:hover { color: var(--gold-2); border-color: var(--gold-dark); }
.icon-btn svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------- stage */
#stage { position: fixed; top: var(--hud-h); left: 0; right: var(--panel-w); bottom: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #151a20, #07080a 75%); }
#map { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#map.dragging { cursor: grabbing; }
#map.placing { cursor: crosshair; }
#map-controls { position: absolute; right: 12px; top: 14px; display: flex; flex-direction: column; gap: 6px; }
#region-legend { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
#region-legend span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; background: rgba(0,0,0,.55); border: 1px solid var(--line); color: var(--muted); }
#region-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
#mode-banner {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 0; border-radius: 6px; overflow: hidden;
  background: rgba(13,15,18,.92); border: 1px solid var(--gold-dark); box-shadow: 0 6px 20px rgba(0,0,0,.6); max-width: calc(100% - 100px);
}
#mode-banner .stripe { align-self: stretch; width: 14px; background: var(--hazard); }
#mode-text { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------- hero */
#hero { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5,6,8,.55); backdrop-filter: blur(2px); padding: 16px; z-index: 5; }
.hero-card {
  position: relative; max-width: 520px; width: 100%; padding: 30px 28px 22px; border-radius: 10px; overflow: hidden;
  background: linear-gradient(180deg, #181c22, #0f1216); border: 1px solid #3a2a10;
  box-shadow: 0 0 0 1px #000, 0 20px 60px rgba(0,0,0,.7), 0 0 80px rgba(245,158,11,.08);
}
.hero-card .hazard { position: absolute; inset: 0 0 auto 0; height: 8px; background: var(--hazard); }
.hero-card h1 { margin: 6px 0 2px; font-size: 38px; letter-spacing: .08em; line-height: 1; }
.hero-card h1 span { color: var(--gold); text-shadow: 0 0 20px rgba(245,158,11,.4); }
.hero-card .tag { margin: 0 0 14px; color: var(--muted); font-size: 17px; }
.hero-card ul { margin: 0 0 20px; padding-left: 18px; color: #cbd2dc; line-height: 1.45; }
.hero-card li { margin-bottom: 6px; }
.hero-card li::marker { color: var(--gold); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.fine { color: var(--dim); font-size: 12.5px; margin: 14px 0 0; }

/* ------------------------------------------------------------- panel */
#panel {
  position: fixed; top: var(--hud-h); right: 0; bottom: 0; width: var(--panel-w); z-index: 10;
  display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line);
  box-shadow: -6px 0 20px rgba(0,0,0,.4);
}
#panel-grip { display: none; }
.tabs { display: flex; border-bottom: 1px solid var(--line); background: #111418; flex: none; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  flex: 1; padding: 11px 6px 9px; background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  color: var(--muted); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.tabs button.on { color: var(--gold); border-bottom-color: var(--gold); background: linear-gradient(180deg, transparent, rgba(245,158,11,.06)); }
.tabs button:hover { color: var(--text); }
#panel-body { flex: 1; overflow-y: auto; padding: 14px; scrollbar-width: thin; scrollbar-color: #2b3544 transparent; }

.sec { margin-bottom: 16px; }
.sec h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.sec h3::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.title-row h2 { margin: 0; font-size: 22px; letter-spacing: .03em; }
.chip { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.plains { color: #e8c58a; border-color: #6b5530; }
.chip.canyon { color: #e7a07c; border-color: #6b3622; }
.chip.offshore { color: #7cc7e8; border-color: #1f5670; }
.chip.gold { color: var(--gold-2); border-color: var(--gold-dark); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-family: var(--mono); font-size: 13.5px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); font-size: 13px; }
.good { color: var(--green); } .bad { color: var(--red); } .gold { color: var(--gold-2); }
.mono { font-family: var(--mono); }
.note { font-size: 13px; color: var(--muted); padding: 8px 10px; border-left: 3px solid var(--gold-dark); background: rgba(245,158,11,.05); border-radius: 0 4px 4px 0; margin: 8px 0; }
.note.warn { border-left-color: var(--red); background: rgba(239,68,68,.06); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .btn { flex-direction: column; gap: 1px; padding: 8px 6px; }
.actions .btn small { font-family: var(--mono); font-size: 12px; opacity: .85; font-weight: 500; }
.actions .wide { grid-column: span 2; }
.bar { height: 8px; border-radius: 4px; background: #07080a; border: 1px solid var(--line); overflow: hidden; margin: 3px 0 8px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #92400e, var(--gold)); }
.bar.dur i { background: linear-gradient(90deg, #b91c1c, #eab308 50%, #22c55e); }
.oilmeter { display: flex; gap: 3px; margin: 4px 0 8px; }
.oilmeter span { flex: 1; height: 8px; border-radius: 2px; background: #22272f; }
.oilmeter span.on { background: var(--gold); box-shadow: 0 0 6px rgba(245,158,11,.6); }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card {
  position: relative; text-align: left; padding: 10px; border-radius: 8px; cursor: pointer;
  background: linear-gradient(180deg, #1c2129, #161a20); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; min-height: 108px;
}
.card:hover { border-color: #4a5568; }
.card.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(245,158,11,.15); }
.card.locked { opacity: .55; }
.card canvas { width: 44px; height: 40px; }
.card b { font-size: 15px; line-height: 1.1; }
.card .cost { font-family: var(--mono); color: var(--gold-2); font-size: 13px; }
.card .desc { color: var(--muted); font-size: 12px; line-height: 1.25; }
.card .lock { position: absolute; top: 8px; right: 8px; font-size: 11px; color: var(--red); }

.upg { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); margin-bottom: 8px; }
.upg b { font-size: 15px; }
.upg .lv { display: flex; gap: 2px; margin-top: 4px; grid-column: 1; }
.upg .lv i { width: 10px; height: 6px; border-radius: 1px; background: #2a313c; }
.upg .lv i.on { background: var(--gold); }
.upg .btn { grid-row: span 3; align-self: center; flex-direction: column; min-width: 92px; }
.upg .btn small { font-family: var(--mono); font-size: 12px; font-weight: 500; }

.price-big { font-family: var(--mono); font-size: 40px; color: var(--gold-2); line-height: 1; text-shadow: 0 0 18px rgba(245,158,11,.25); }
#chart { width: 100%; height: 150px; display: block; border: 1px solid var(--line); border-radius: 6px; background: #0a0c0f; margin: 10px 0; }
.sellrow { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.sellrow .btn { flex: 1; }

table.lb { width: 100%; border-collapse: collapse; font-size: 14px; }
table.lb th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); padding: 4px 4px 6px; border-bottom: 1px solid var(--line); }
table.lb td { padding: 6px 4px; border-bottom: 1px solid #1e242c; }
table.lb td.n { text-align: right; font-family: var(--mono); font-size: 13px; }
table.lb tr.me td { color: var(--gold-2); background: rgba(245,158,11,.06); }
table.lb td.rank { width: 28px; color: var(--dim); font-family: var(--mono); }
table.lb tr:nth-child(2) td.rank { color: #fde047; } table.lb tr:nth-child(3) td.rank { color: #d1d5db; } table.lb tr:nth-child(4) td.rank { color: #d97706; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.seg button { flex: 1; padding: 6px; border: 0; background: #111418; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 13px; }
.seg button.on { background: var(--steel); color: var(--gold-2); }
.pool { padding: 12px; border-radius: 8px; border: 1px solid var(--gold-dark); background: linear-gradient(135deg, rgba(245,158,11,.10), rgba(0,0,0,0)); margin-bottom: 12px; }
.pool .big { font-family: var(--mono); font-size: 22px; color: var(--gold-2); }

.guide ol { padding-left: 20px; line-height: 1.45; color: #cbd2dc; }
.guide li { margin-bottom: 6px; }
.guide table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.guide td, .guide th { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.guide th { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }

/* ------------------------------------------------------------- toasts / modal */
#toasts { position: fixed; left: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  padding: 10px 14px; border-radius: 6px; background: rgba(18,21,26,.97); border: 1px solid var(--line); border-left: 4px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0,0,0,.6); font-size: 14px; animation: toastIn .25s ease-out; pointer-events: auto;
}
.toast.err { border-left-color: var(--red); }
.toast.good { border-left-color: var(--green); }
.toast.big { font-size: 17px; font-weight: 700; color: var(--gold-2); }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } }
@keyframes blink { 50% { opacity: .35; } }
#modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.65); display: grid; place-items: center; padding: 16px; }
.modal-card { width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.7); position: relative; }
.modal-card h2 { margin: 0 0 12px; font-size: 22px; }
.modal-card .x { position: absolute; top: 10px; right: 10px; }
.wallet-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.wallet-list .btn { justify-content: space-between; padding: 12px 14px; }
input[type=text], textarea, input[type=number] {
  width: 100%; padding: 9px 10px; border-radius: 6px; border: 1px solid var(--steel-2); background: #0b0d10; color: var(--text);
  font-family: var(--mono); font-size: 14px;
}
input:focus, textarea:focus { outline: none; border-color: var(--gold); }
.row { display: flex; gap: 8px; align-items: center; }
.addr { font-family: var(--mono); font-size: 13px; word-break: break-all; padding: 8px; background: #0b0d10; border-radius: 6px; border: 1px solid var(--line); }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  :root { --panel-w: 340px; }
  .brand-text { display: none; }
  .stat { min-width: 96px; }
}
@media (max-width: 820px) {
  :root { --hud-h: 104px; }
  #hud { flex-wrap: wrap; height: var(--hud-h); align-content: center; row-gap: 6px; padding: 6px 10px; }
  .brand { order: 1; }
  .wallet-area { order: 2; margin-left: auto; }
  .stats { order: 3; flex-basis: 100%; }
  .stat { min-width: 86px; padding: 3px 8px 4px; }
  .stat .v { font-size: 15px; }
  #stage { right: 0; bottom: 0; }
  #panel {
    top: auto; left: 0; right: 0; width: auto; height: 46vh; border-left: 0; border-top: 1px solid var(--line);
    border-radius: 12px 12px 0 0; transition: height .25s ease; padding-bottom: env(safe-area-inset-bottom);
  }
  #panel.collapsed { height: 92px; }
  #panel.expanded { height: 82vh; }
  #panel-grip { display: block; height: 18px; border: 0; background: none; cursor: pointer; flex: none; }
  #panel-grip i { display: block; width: 44px; height: 4px; border-radius: 2px; background: #3b4452; margin: 6px auto; }
  #map-controls { top: 10px; right: 10px; }
  #region-legend { display: none; }
  #toasts { bottom: auto; top: calc(var(--hud-h) + 10px); }
  .hero-card h1 { font-size: 30px; }
  #token-badge { display: none; }
}
@media (max-width: 420px) {
  .btn-gold#btn-wallet { padding: 7px 10px; font-size: 13px; }
  .cards { grid-template-columns: 1fr 1fr; }
}

/* ------------------------------------------------------------- landing */
#hero { position: fixed; top: var(--hud-h); left: 0; right: 0; bottom: 0; z-index: 15; overflow-y: auto; align-items: center; }
.hero-card.landing { max-width: 1040px; padding: 28px 28px 18px; }
.landing-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: 26px; align-items: stretch; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); padding: 3px 10px; border: 1px solid var(--gold-dark); border-radius: 999px; background: rgba(245,158,11,.08); margin-top: 6px; }
.landing h1 { font-size: 46px; margin: 10px 0 4px; }
.landing .tag { font-size: 20px; margin-bottom: 16px; color: #cbd2dc; }
.landing .tag b { color: var(--gold-2); }
.steps { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps i { flex: none; width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; font-style: normal; font-weight: 700; color: #1a1205; background: linear-gradient(180deg, #fbbf24, #d97706); box-shadow: 0 0 14px rgba(245,158,11,.35); }
.steps b { display: block; font-size: 16px; }
.steps span { color: var(--muted); font-size: 14px; line-height: 1.3; }
.perks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.perks span { font-size: 13px; padding: 5px 9px; border-radius: 6px; background: #0b0d10; border: 1px solid var(--line); color: #cbd2dc; }
.perks b { color: var(--gold-2); }
.btn.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.55); } 50% { box-shadow: 0 0 0 10px rgba(245,158,11,0); } }
.live { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-family: var(--mono); font-size: 13px; color: var(--muted); min-height: 18px; }
.live b { color: var(--gold-2); font-weight: 400; }
.live .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 6px; box-shadow: 0 0 8px var(--green); animation: blink 1.6s infinite; }
.landing-demo { position: relative; display: flex; flex-direction: column; border-radius: 10px; overflow: hidden; border: 1px solid #3a2a10; background: radial-gradient(ellipse at 50% 55%, #1b2027, #08090b 80%); min-height: 380px; }
.demo-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 0; font-size: 15px; z-index: 1; }
.demo-badge { font-size: 11px; font-weight: 700; letter-spacing: .14em; padding: 2px 8px; border-radius: 4px; background: var(--gold); color: #111; }
#demo-canvas { flex: 1; width: 100%; min-height: 250px; display: block; cursor: pointer; touch-action: manipulation; }
.demo-hud { position: absolute; top: 40px; right: 10px; display: flex; gap: 6px; }
.demo-hud div { background: rgba(8,9,11,.82); border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; text-align: right; }
.demo-hud small { display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.demo-hud b { font-family: var(--mono); font-weight: 400; color: var(--gold-2); font-size: 15px; }
#demo-rate { color: var(--green); }
.demo-msg { padding: 9px 12px; font-size: 14px; color: #cbd2dc; border-top: 1px solid var(--line); background: rgba(0,0,0,.35); min-height: 40px; }
.demo-msg.pop { animation: msgpop .35s ease-out; }
@keyframes msgpop { from { transform: translateY(4px); opacity: .3; color: var(--gold-2); } }
.demo-cta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: linear-gradient(90deg, rgba(245,158,11,.18), rgba(245,158,11,.04)); border-top: 1px solid var(--gold-dark); font-weight: 600; animation: toastIn .3s ease-out; }
@media (max-width: 900px) {
  .landing-grid { grid-template-columns: 1fr; gap: 16px; }
  .landing-demo { order: -1; min-height: 300px; }
  #demo-canvas { min-height: 210px; }
  .landing h1 { font-size: 32px; }
  .landing .tag { font-size: 17px; margin-bottom: 10px; }
  .hero-card.landing { padding: 20px 16px 14px; }
  #hero { align-items: start; }
  .steps span { font-size: 13px; }
}
