/* ==============================================================
   ALT共识 DApp - Mobile-First Modern Dark Theme
   ============================================================== */

:root {
  --bg: #07090f;
  --bg-2: #0f1320;
  --bg-card: #161b2c;
  --bg-card-2: #1a2036;
  --line: #232b46;
  --text: #e7ebf6;
  --text-2: #98a3c4;
  --text-3: #6a7396;
  --primary: #ffd234;
  --primary-2: #ffb000;
  --green: #21c47b;
  --red: #ef4456;
  --blue: #5cb6ff;
  --shadow: 0 18px 60px rgba(0, 0, 0, .55);
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: radial-gradient(120% 80% at 50% 0%, #1a1f37 0%, #07090f 60%, #050709 100%) fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }

.container { max-width: 720px; margin: 0 auto; padding: 0 16px 96px; }

/* ====== TopBar ====== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(10,12,22,.95), rgba(10,12,22,.7));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--text); }
.topbar .logo .badge {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #1a1206;
}
.topbar .spacer { flex: 1; }
.topbar .lang { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-2); font-size: 12px; cursor: pointer; }
.topbar .wallet-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #1a1206; cursor: pointer; border: none; font-size: 13px;
}
.topbar .wallet-btn.connected {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line);
}

/* ====== Hero ====== */
.hero {
  margin: 16px 0;
  padding: 22px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,210,52,.18), rgba(36,52,98,.6) 60%);
  border: 1px solid rgba(255,210,52,.35);
  position: relative; overflow: hidden;
}
.hero h2 { margin: 0 0 6px; font-size: 22px; }
.hero .sub { color: var(--text-2); font-size: 13px; }
.hero .price-card {
  margin-top: 14px;
  background: rgba(0,0,0,.35);
  border-radius: 12px; padding: 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.hero .price { font-size: 22px; font-weight: 700; color: var(--primary); }
.hero .change.up { color: var(--green); }
.hero .change.down { color: var(--red); }

/* ====== Cards / Stats ====== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card h3 { margin: 0 0 12px; font-size: 15px; }
.card .row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed rgba(255,255,255,.05); }
.card .row:last-child { border-bottom: 0; }
.card .row .k { color: var(--text-2); font-size: 13px; }
.card .row .v { color: var(--text); font-weight: 600; }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-item {
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-radius: 12px; padding: 14px;
}
.stat-item .label { color: var(--text-2); font-size: 12px; }
.stat-item .value { color: var(--primary); font-size: 18px; font-weight: 700; margin-top: 6px; }
.stat-item.green .value { color: var(--green); }

/* ====== Buttons / Inputs ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px; border-radius: 10px;
  border: none; cursor: pointer; font-weight: 700; font-size: 14px;
  transition: transform .1s ease, box-shadow .2s;
}
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #1a1206;
}
.btn.primary:hover { box-shadow: 0 6px 16px rgba(255,210,52,.35); }
.btn.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--line);
}
.btn.full { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.green { background: var(--green); color: #fff; }
.btn.red { background: var(--red); color: #fff; }

.input, select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px; outline: none;
}
.input:focus, select:focus { border-color: var(--primary); }

/* ====== Package List ====== */
.pkg-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pkg {
  background: var(--bg-card-2);
  border: 1.5px solid var(--line);
  border-radius: 12px; padding: 14px;
  cursor: pointer; transition: .15s;
}
.pkg.active { border-color: var(--primary); background: linear-gradient(135deg, rgba(255,210,52,.15), transparent); }
.pkg .amt { font-size: 20px; font-weight: 800; color: var(--primary); }
.pkg .info { color: var(--text-2); font-size: 12px; margin-top: 6px; line-height: 1.6; }

/* ====== List / Table ====== */
.list-item {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
  margin-bottom: 10px;
}
.list-item .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 13px; }
.list-item .meta { color: var(--text-2); font-size: 12px; line-height: 1.6; }
.tag {
  display: inline-block; padding: 2px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--bg-2); color: var(--text-2); border: 1px solid var(--line);
}
.tag.running { color: var(--blue); border-color: var(--blue); }
.tag.expired { color: var(--primary); border-color: var(--primary); }
.tag.withdrawn { color: var(--green); border-color: var(--green); }
.tag.error { color: var(--red); border-color: var(--red); }

/* ====== BottomNav ====== */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around;
  background: rgba(8,11,22,.95);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
}
.bottomnav a {
  flex: 1; text-align: center; color: var(--text-3);
  font-size: 11px; padding: 4px 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-decoration: none;
}
.bottomnav a.active { color: var(--primary); }
.bottomnav a svg { width: 22px; height: 22px; }

/* ====== Modal / Toast ====== */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.85); color: #fff; padding: 12px 22px;
  border-radius: 10px; z-index: 99; font-size: 14px;
  border: 1px solid var(--line); max-width: 80%;
  text-align: center; pointer-events: none;
  animation: fade .3s;
}
@keyframes fade { from { opacity: 0; transform: translate(-50%,-60%);} to { opacity: 1; transform: translate(-50%,-50%);} }

/* ====== Tabs ====== */
.tabs { display: flex; gap: 6px; margin: 10px 0; }
.tabs .tab {
  flex: 1; padding: 10px; text-align: center;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; font-size: 13px;
  color: var(--text-2);
}
.tabs .tab.active {
  background: linear-gradient(135deg, rgba(255,210,52,.2), transparent);
  color: var(--primary); border-color: var(--primary);
}

/* ====== Misc ====== */
.row-flex { display: flex; gap: 10px; align-items: center; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.center { text-align: center; }
.mt-10 { margin-top: 10px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; } .mb-16 { margin-bottom: 16px; }
.flex-1 { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.copy-link {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2); border: 1px dashed var(--line);
  padding: 10px 12px; border-radius: 10px;
  font-family: monospace; font-size: 12px; word-break: break-all;
}
.qr-box {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-top: 14px;
}
.qr-box .qr {
  width: 200px; height: 200px;
  background: #fff; padding: 10px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.qr-box .qr svg, .qr-box .qr img {
  width: 100%; height: 100%; display: block;
  image-rendering: pixelated; image-rendering: -moz-crisp-edges;
}
.qr-box .qr-tip { color: var(--text-2); font-size: 12px; }
.copy-link .addr { flex: 1; color: var(--primary); }
.copy-link .copy {
  background: var(--primary); color: #1a1206;
  padding: 4px 10px; border-radius: 6px; font-size: 12px;
  cursor: pointer; border: none; font-weight: 700;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.2); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
  display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* iframe k-line */
.kline-card iframe { width: 100%; min-height: 280px; border: 0; border-radius: 10px; }

@media (min-width: 720px) {
  .container { padding-bottom: 16px; }
  .bottomnav { display: none; }
  .topbar nav { display: flex; gap: 14px; align-items: center; }
  .topbar nav a { color: var(--text-2); font-size: 13px; }
  .topbar nav a.active { color: var(--primary); }
}
