/* TokenArena — Arena-Neon dunkel, mobile-first */
:root {
  --bg: #0b0d12;
  --bg2: #11141c;
  --panel: #151a25;
  --panel2: #1b2130;
  --line: #262e40;
  --tx: #e8ecf4;
  --mut: #8a94a8;
  --gold: #f5b942;
  --gold2: #ffd97a;
  --cyan: #4fd1c5;
  --red: #f0655a;
  --green: #5dd39e;
  --violet: #9d7cff;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--tx);
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
#ember { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5; }
main, header, footer { position: relative; z-index: 1; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold2); }

/* ---------- header ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 22px;
  background: rgba(11,13,18,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.logo { font-weight: 800; font-size: 1.15rem; letter-spacing: .12em; display: flex; align-items: center; gap: 8px; color: var(--tx); }
.logo .gl { color: var(--gold); font-size: 1.3rem; }
.logo small { color: var(--mut); font-weight: 400; letter-spacing: .05em; }
nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-left: auto; }
nav a, nav button.link {
  color: var(--mut); padding: 7px 12px; border-radius: 9px; font-size: .92rem;
  transition: color .15s, background .15s; background: none; border: none; cursor: pointer; font-family: inherit;
}
nav a:hover, nav button.link:hover { color: var(--tx); background: var(--panel2); }
nav a.on { color: var(--gold); background: rgba(245,185,66,.08); }
.langbtn { border: 1px solid var(--line) !important; }
#headerPulse { display: flex; gap: 5px; align-items: center; font-size: .78rem; color: var(--mut); }
#headerPulse .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: breathe 2.2s infinite; }
@keyframes breathe { 50% { opacity: .35; } }

/* ---------- layout ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 26px 18px 80px; }
footer { text-align: center; color: var(--mut); font-size: .8rem; padding: 26px; border-top: 1px solid var(--line); }
.grid { display: grid; gap: 16px; }
.cols2 { grid-template-columns: 1fr 1fr; }
.cols3 { grid-template-columns: repeat(3, 1fr); }
.cols4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .14em; color: var(--mut); margin-bottom: 12px; }
.kpi { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; }
.kpi small { font-size: .85rem; color: var(--mut); font-weight: 400; }
.subtle { color: var(--mut); font-size: .85rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .85rem; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 58px 10px 34px; }
.hero h1 {
  font-size: clamp(1.9rem, 5.4vw, 3.4rem); font-weight: 900; letter-spacing: -.02em; line-height: 1.08;
}
.hero h1 .hl {
  background: linear-gradient(92deg, var(--gold), var(--gold2) 55%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { color: var(--mut); max-width: 640px; margin: 16px auto 26px; font-size: 1.05rem; }
.ctarow { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.badgerow { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.badge {
  border: 1px solid var(--line); background: var(--panel); border-radius: 99px;
  padding: 6px 14px; font-size: .8rem; color: var(--mut); display: inline-flex; gap: 7px; align-items: center;
}
.badge b { color: var(--tx); }

/* ---------- buttons & forms ---------- */
button, .btn {
  font-family: inherit; font-size: .92rem; cursor: pointer;
  background: var(--panel2); color: var(--tx);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 16px;
  transition: transform .08s, border-color .15s, background .15s;
}
button:hover { border-color: var(--gold); }
button:active { transform: scale(.97); }
button.primary {
  background: linear-gradient(180deg, var(--gold), #d99e2b);
  color: #181206; border-color: transparent; font-weight: 700;
}
button.primary:hover { filter: brightness(1.1); }
button.danger { color: var(--red); }
button.danger:hover { border-color: var(--red); }
button.small { padding: 4px 10px; font-size: .8rem; border-radius: 8px; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea {
  font-family: inherit; font-size: .95rem;
  background: var(--bg2); color: var(--tx);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
label { display: block; font-size: .8rem; color: var(--mut); margin: 12px 0 4px; }
form .row { display: flex; gap: 10px; flex-wrap: wrap; }
form .row > * { flex: 1; min-width: 160px; }
form.wide { max-width: 420px; margin: 40px auto; }
.hint { font-size: .78rem; color: var(--mut); margin-top: 6px; }

/* ---------- gauges ---------- */
.gaugewrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.gauge { position: relative; width: 150px; height: 150px; }
.gauge svg { width: 100%; height: 100%; transform: rotate(0deg); }
.gauge .track { fill: none; stroke: var(--panel2); stroke-width: 10; }
.gauge .val { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .9s cubic-bezier(.4,0,.2,1), stroke .5s; filter: drop-shadow(0 0 6px currentColor); }
.gauge .pct {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.glabel { font-size: .8rem; color: var(--mut); text-transform: uppercase; letter-spacing: .12em; }
.gmeta { font-size: .75rem; color: var(--mut); }
.spark { width: 100%; height: 46px; display: block; margin-top: 8px; }
.spark polyline { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark .fillarea { stroke: none; opacity: .12; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; color: var(--mut); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,.02); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .72rem; font-weight: 700; letter-spacing: .03em; }
.pill.ok { background: rgba(93,211,158,.14); color: var(--green); }
.pill.warn { background: rgba(245,185,66,.14); color: var(--gold); }
.pill.err { background: rgba(240,101,90,.14); color: var(--red); }
.pill.mut { background: var(--panel2); color: var(--mut); }

/* ---------- charts ---------- */
.barchart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 8px; }
.barchart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; align-items: stretch; min-width: 0; }
.barchart .seg { border-radius: 3px 3px 0 0; transition: height .6s cubic-bezier(.4,0,.2,1); }
.barchart .seg.pt { background: var(--cyan); }
.barchart .seg.gt { background: var(--gold); }
.barchart .xlabel { font-size: .6rem; color: var(--mut); text-align: center; margin-top: 3px; white-space: nowrap; overflow: hidden; }
.legend { display: flex; gap: 14px; font-size: .75rem; color: var(--mut); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* ---------- calculator ---------- */
.calc input[type=range] { width: 100%; accent-color: var(--gold); padding: 0; }
.calcout { font-size: 2rem; font-weight: 800; color: var(--gold); text-align: center; padding: 10px 0; font-variant-numeric: tabular-nums; }

/* ---------- admin tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs button { border-radius: 99px; padding: 7px 15px; font-size: .85rem; }
.tabs button.on { background: var(--gold); color: #181206; border-color: transparent; font-weight: 700; }
.corebars { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.corebars .cb { height: 60px; background: var(--panel2); border-radius: 5px; position: relative; overflow: hidden; }
.corebars .cb i { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(180deg, var(--cyan), #2b7f78); transition: height .4s; }
.corebars .cb span { position: absolute; bottom: 2px; width: 100%; text-align: center; font-size: .55rem; color: var(--mut); }

/* ---------- toast & modal ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--gold);
  padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: .9rem;
  animation: slidein .25s ease-out; max-width: 340px;
}
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
dialog {
  background: var(--panel); color: var(--tx); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; max-width: 420px; width: calc(100vw - 40px);
}
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }

/* ---------- misc ---------- */
.keybox {
  background: var(--bg2); border: 1px dashed var(--gold); border-radius: 10px;
  padding: 12px; font-family: ui-monospace, monospace; word-break: break-all; font-size: .85rem;
}
.sectiontitle { font-size: 1.5rem; font-weight: 800; margin: 34px 0 14px; letter-spacing: -.01em; }
.sectiontitle:first-child { margin-top: 6px; }
.balance-big { font-size: 2.6rem; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.balance-big.flash { animation: flashup .6s; }
@keyframes flashup { 40% { color: var(--cyan); transform: scale(1.04); } }
pre.code {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; overflow-x: auto; font-size: .82rem; line-height: 1.5; position: relative;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
pre.code .copybtn { position: absolute; top: 8px; right: 8px; }
#banner { background: linear-gradient(90deg, rgba(245,185,66,.15), rgba(79,209,197,.1)); border-bottom: 1px solid var(--line); padding: 8px 20px; text-align: center; font-size: .88rem; }
.vouchershare textarea { min-height: 110px; }
.empty { text-align: center; color: var(--mut); padding: 30px 10px; font-size: .9rem; }

/* ---------- mobile-first ---------- */
@media (max-width: 880px) {
  .cols2, .cols3, .cols4 { grid-template-columns: 1fr; }
  header { flex-direction: column; gap: 8px; padding: 10px 14px; }
  nav { margin-left: 0; justify-content: center; }
  #headerPulse { display: none; }
  .hero { padding: 30px 4px 20px; }
  table.stack thead { display: none; }
  table.stack tr { display: block; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; padding: 4px 2px; }
  table.stack td { display: flex; justify-content: space-between; gap: 12px; border: none; padding: 6px 12px; }
  table.stack td::before { content: attr(data-l); color: var(--mut); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
  table.stack td.no-l { display: block; }
  table.stack td.no-l::before { content: none; }
  .balance-big { font-size: 2rem; }
}
