/*
 * 质押前端样式 —— **中性占位**。
 *
 * ⚠️ 等新的代币合约地址定了再定视觉风格。
 *    到时候只改下面的 CSS 变量即可，app.js 不用动。
 *
 * 组织方式：一套 CSS 变量 → 语义化的类 → 断点换布局。
 * 不是「做三个页面」，是一套标记换布局。
 */

/* ══════════════════ 设计令牌 ══════════════════ */

:root {
  --bg: #0f1115;
  --bg-elev: #161a21;
  --bg-elev-2: #1d222b;
  --line: #2a313d;
  --text: #e7ecf3;
  --text-dim: #98a3b3;
  --text-mute: #6b7686;

  --accent: #4a9eff;
  --accent-dim: #2d6fb8;
  --ok: #3fbf7f;
  --warn: #e8a33d;
  --bad: #e05c5c;

  --radius: 10px;
  --radius-lg: 14px;
  --gap: 20px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

/* ══════════════════ 顶栏 ══════════════════ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(15, 17, 21, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 700;
  font-size: 17px;
}

.brand-text { font-weight: 600; letter-spacing: 0.04em; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.net-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.btn-net, .btn-wallet {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  transition: 0.15s;
  white-space: nowrap;
}

.btn-net:hover, .btn-wallet:hover { border-color: var(--accent-dim); }
.btn-wallet { background: var(--accent); border-color: var(--accent); color: #06121f; }

/* ══════════════════ 布局 ══════════════════ */

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--gap) clamp(16px, 4vw, 40px) 60px;
  display: grid;
  gap: var(--gap);
}

.dash {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: var(--gap);
  align-items: start;
}

.col { display: grid; gap: var(--gap); min-width: 0; }

/* ══════════════════ 数据来源条 ══════════════════ */

.source-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  padding: 10px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--text-mute); }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.dot.idle { background: var(--text-mute); }

/* ══════════════════ 统计块 ══════════════════ */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.stat { background: var(--bg-elev); padding: 18px 16px; min-width: 0; }

.stat label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin-bottom: 8px;
}

.stat output {
  display: block;
  font-family: var(--mono);
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat.hot output { color: var(--accent); }

.stat small {
  display: block;
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══════════════════ 面板 ══════════════════ */

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-head {
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--text-mute);
  border-bottom: 1px solid var(--line);
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
}

.kv {
  background: var(--bg-elev);
  padding: 14px 16px;
  min-width: 0;
}

.kv span {
  display: block;
  font-size: 11px;
  color: var(--text-mute);
  margin-bottom: 4px;
}

.kv b {
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warn {
  margin: 0;
  padding: 12px 16px;
  background: rgba(232, 163, 61, 0.1);
  border-top: 1px solid rgba(232, 163, 61, 0.3);
  color: var(--warn);
  font-size: 13px;
}

/* ══════════════════ 票券（操作区）══════════════════ */

.ticket { padding-bottom: 18px; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  margin: 0 0 18px;
}

.tabs button {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  padding: 13px 8px;
  border: 0;
  background: var(--bg-elev);
  color: var(--text-dim);
  cursor: pointer;
  transition: 0.15s;
}

.tabs button[aria-selected="true"] { background: var(--accent); color: #06121f; }

.field-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  margin: 0 18px 8px;
}

.field-meta b { color: var(--text-dim); font-variant-numeric: tabular-nums; }

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 18px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.field:focus-within { border-color: var(--accent-dim); }

.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.field input::-webkit-outer-spin-button,
.field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.max {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  cursor: pointer;
}

.max:hover { background: var(--accent); color: #06121f; }

.quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 10px 18px 0;
}

.quick button {
  font-family: var(--mono);
  font-size: 11px;
  padding: 8px 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  border-radius: 6px;
  cursor: pointer;
}

.quick button:hover { border-color: var(--accent-dim); color: var(--text); }

.rows { margin: 18px 18px 0; border-top: 1px solid var(--line); }

.rows div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.rows b {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ══════════════════ 收益预估 ══════════════════ */

.projection {
  margin: 18px 18px 0;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.proj-head {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  margin-bottom: 12px;
}

.proj-big { text-align: center; margin-bottom: 14px; }

.proj-big strong {
  display: block;
  font-family: var(--mono);
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.proj-big span { font-size: 12px; color: var(--text-mute); }

.proj-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.proj-grid div { background: var(--bg-elev); padding: 10px 8px; text-align: center; min-width: 0; }

.proj-grid label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-mute);
}

.proj-grid output {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unstake-note {
  margin: 18px 18px 0;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-dim);
}

.unstake-note b { color: var(--text); }

.action {
  width: calc(100% - 36px);
  margin: 18px 18px 0;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  padding: 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #06121f;
  cursor: pointer;
  transition: 0.15s;
}

.action:hover:not(:disabled) { filter: brightness(1.1); }

.action:disabled {
  background: var(--bg-elev-2);
  color: var(--text-mute);
  cursor: not-allowed;
}

.fine {
  margin: 12px 18px 0;
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.6;
}

.projection .fine { margin: 12px 0 0; }

/* ══════════════════ 领取 ══════════════════ */

.claim-box { padding: 20px 18px; text-align: center; }

.claim-num {
  font-family: var(--mono);
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.claim-label { font-size: 12px; color: var(--text-mute); margin-bottom: 16px; }

.btn-solid {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  padding: 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ok);
  color: #06121f;
  cursor: pointer;
}

.btn-solid:disabled { background: var(--bg-elev-2); color: var(--text-mute); cursor: not-allowed; }

/* ══════════════════ 规则 ══════════════════ */

.rules {
  margin: 0;
  padding: 16px 18px 16px 34px;
  color: var(--text-dim);
  font-size: 13px;
}

.rules li { margin-bottom: 8px; }
.rules li:last-child { margin-bottom: 0; }
.rules b { color: var(--text); }

/* ══════════════════ 地址 ══════════════════ */

.addr-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.addr-row label { color: var(--text-mute); }

.addr-row code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

/* ══════════════════ 弹窗 ══════════════════ */

.mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  padding: 20px;
}

.mask[hidden] { display: none; }

.modal {
  width: min(420px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  border-bottom: 1px solid var(--line);
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--text-mute);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.modal-body { padding: 10px; display: grid; gap: 6px; }

.modal-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--bg-elev-2);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.modal-item:hover { border-color: var(--accent-dim); }

.modal-item b { font-size: 14px; }

.modal-item span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  margin-left: auto;
}

.modal-item .cur {
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: 0;
}

/* ══════════════════ toast ══════════════════ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 70;
  transform: translate(-50%, 140%);
  max-width: calc(100vw - 40px);
  padding: 12px 20px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s;
}

.toast.show { transform: translate(-50%, 0); }

/* ══════════════════ 断点 ══════════════════ */

@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .net-label { display: none; }
  .quick { grid-template-columns: repeat(2, 1fr); }
  .proj-grid { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .stats { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr; }
}
