* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 基础变量定义 - 深色配色与金/蓝点缀 */
:root {
  --primary: #f0b90b;
  --primary-glow: rgba(240, 185, 11, 0.28);
  --bg-dark: #0b0b0b;
  --card-bg: rgba(18, 18, 18, 0.95);
  --glass-border: rgba(255, 255, 255, 0.06);
  --text-main: #f5f5f5;
  --text-muted: #9aa0a6;
  --accent-blue: #2f6fff;
  --transition: all 0.35s ease;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* 页面背景与流动装饰 */
body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #0b0b0b;
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  animation: float 20s infinite alternate;
}

body::before {
  background: rgba(240, 185, 11, 0.08);
  top: -100px;
  left: -100px;
}

body::after {
  background: rgba(47, 111, 255, 0.08);
  bottom: -100px;
  right: -100px;
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 100px) scale(1.2); }
}

/* 破碎粒子飘落层 */
#particle-layer {
  position: fixed;
  pointer-events: none;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: radial-gradient(circle, rgba(240, 185, 11, 0.9), rgba(240, 185, 11, 0.2));
  box-shadow: 0 0 8px rgba(240, 185, 11, 0.45);
  animation: fall linear forwards;
  opacity: 0.8;
}

.particle.blue {
  background: radial-gradient(circle, rgba(58, 134, 255, 0.9), rgba(58, 134, 255, 0.25));
  box-shadow: 0 0 8px rgba(58, 134, 255, 0.45);
}

@keyframes fall {
  0% { transform: translateY(-10vh) rotate(0deg) scale(1); opacity: 0.9; }
  100% { transform: translateY(110vh) rotate(180deg) scale(0.6); opacity: 0; }
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}

/* 顶部 Hero */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  animation: fadeInDown 0.8s ease-out;
}

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

.logo {
  font-weight: 800;
  font-size: 24px;
  background: linear-gradient(135deg, var(--primary), #fff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  padding: 10px;
  border: 2px solid var(--primary);
  border-radius: 12px;
  box-shadow: 0 0 20px var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
  border-radius: 8px;
  background: #0b0b0b;
  padding: 4px;
}

.brand-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(8, 8, 8, 0.98);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.topbar-content {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-spacer {
  height: 76px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

/* 玻璃态卡片 */
.stat-card,
.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover,
.card:hover {
  transform: translateY(-8px);
  border-color: rgba(240, 185, 11, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* 数据看板 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 16px;
  padding: 6px 4px;
}

.stats-header .title {
  font-size: 20px;
  font-weight: 700;
}

.stat-card .label {
  color: var(--text-muted);
  font-size: 14px;
}

.stat-card .value {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 10px 0 6px;
  font-family: 'Monaco', monospace;
}

.stat-card .value.accent {
  color: var(--primary);
  text-shadow: 0 0 8px var(--primary-glow);
}

.stat-card .value.address {
  font-size: 14px;
  word-break: break-all;
}

.stat-card .sub {
  color: var(--text-muted);
  font-size: 13px;
}

.inline-action {
  margin-top: 10px;
}

/* 主体栅格 */
.grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 25px;
  margin-bottom: 40px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.title {
  font-size: 18px;
  font-weight: 700;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

.balance {
  color: var(--text-muted);
  font-size: 14px;
}

.balance span {
  font-weight: 700;
  color: var(--text-main);
  margin-left: 6px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 14px;
}

/* 输入框 */
.input-group {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  padding: 4px 8px;
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  margin-top: 10px;
}

.stake-slider {
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 10px 12px;
}

.stake-slider input[type="range"] {
  width: 100%;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.stake-slider input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px rgba(240, 185, 11, 0.35);
  cursor: pointer;
}

.stake-slider input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px rgba(240, 185, 11, 0.35);
  cursor: pointer;
  border: none;
}

.stake-slider-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

input[type="number"],
input {
  background: transparent;
  border: none;
  color: #fff;
  padding: 12px;
  flex: 1;
  font-size: 1.1rem;
  outline: none;
}

/* 按钮 */
.btn {
  border-radius: 14px;
  padding: 12px 24px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  color: #fff;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), #d4a017);
  color: #000;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn.primary:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 25px var(--primary-glow);
}

.btn.primary.connected {
  background: linear-gradient(135deg, #4caf50, #2e7d32);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.btn.primary.connected:hover {
  box-shadow: 0 6px 25px rgba(76, 175, 80, 0.6);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
}

.btn.small { padding: 10px 16px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* 锁定期选项（兼容 lock-option 与 lock-item 类名） */
.lock-options {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.lock-option,
.lock-item {
  flex: 1 1 120px;
  text-align: center;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: var(--transition);
}

.lock-option.active,
.lock-item.active {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 12px 30px rgba(240, 185, 11, 0.25);
  transform: translateY(-2px);
}

.lock-option .days,
.lock-item .days {
  font-weight: 700;
  margin-bottom: 4px;
}

.lock-option .mult,
.lock-item .mult {
  color: var(--primary);
  font-weight: 600;
}

/* 权重与进度条 */
.weight-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.weight-display .big {
  font-size: 28px;
  font-weight: 700;
}

.muted {
  color: var(--text-muted);
  font-size: 14px;
}

.multiplier {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  background: rgba(240, 185, 11, 0.12);
  color: var(--primary);
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 700;
}

.progress {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  margin-top: 15px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-blue));
  width: 10%;
  transition: width 0.6s ease-in-out;
}

.actions {
  margin-top: 12px;
}

.hint {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* 持仓卡片 */
.holdings-card {
  display: flex;
  flex-direction: column;
}

.holdings-card .positions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.holdings-card .positions::-webkit-scrollbar {
  width: 6px;
}

.holdings-card .positions::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

.holdings-card .positions::-webkit-scrollbar-thumb {
  background: rgba(240, 185, 11, 0.4);
  border-radius: 999px;
}

.position-item {
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.position-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mono {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  word-break: break-all;
}

.tag {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 13px;
}

.position-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin-top: 8px;
}

.position-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.empty {
  color: var(--text-muted);
  text-align: center;
  padding: 20px 12px;
  border: 1px dashed var(--glass-border);
  border-radius: 12px;
}

/* 规则与底部 */
.rules {
  margin-top: 18px;
}

.rules-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.rule {
  padding: 12px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.rule-title {
  color: var(--text-main);
  font-weight: 700;
  margin-bottom: 6px;
}

.footer-info {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.links a:hover {
  text-decoration: underline;
}

.contract {
  text-align: right;
}

.address {
  font-size: 14px;
}

/* 动画 */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 响应式 */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .footer-info { flex-direction: column; text-align: left; }
  .contract { text-align: left; }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .topbar-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}

/* ========================
   钱包选择模态窗口样式
   ======================== */

.wallet-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wallet-modal.active {
  display: flex;
}

.wallet-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease-out;
}

.wallet-modal-content {
  position: relative;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(23, 27, 38, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.wallet-modal-header {
  grid-column: 1 / -1;
  padding: 24px 32px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wallet-modal-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: var(--transition);
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.wallet-modal-body {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

/* 左侧信息栏 */
.wallet-info {
  padding: 32px;
  background: rgba(0, 0, 0, 0.2);
  border-right: 1px solid var(--glass-border);
}

.wallet-info h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 24px 0;
}

.wallet-info-item {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  align-items: flex-start;
}

.info-icon {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(240, 185, 11, 0.1);
  border-radius: 12px;
  flex-shrink: 0;
}

.info-text strong {
  display: block;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.info-text p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}

/* 右侧钱包列表 */
.wallet-list {
  padding: 32px;
  display: flex;
  flex-direction: column;
}

.wallet-list-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.wallet-options {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wallet-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.wallet-option:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
  transform: translateX(4px);
}

.wallet-option.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.wallet-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wallet-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}

.wallet-status {
  font-size: 12px;
  color: var(--text-muted);
}

.wallet-status.installed {
  color: #4caf50;
}

.wallet-status.not-installed {
  color: var(--text-muted);
}

.wallet-footer {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--glass-border);
  text-align: center;
}

.wallet-footer a {
  color: var(--accent-blue);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.wallet-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 移动端适配 */
@media (max-width: 768px) {
  .wallet-modal-content {
    grid-template-columns: 1fr;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 95vh;
  }

  .wallet-modal-body {
    grid-template-columns: 1fr;
  }

  .wallet-info {
    display: none; /* 移动端隐藏信息栏 */
  }

  .wallet-list {
    padding: 20px;
  }

  .wallet-modal-header {
    padding: 20px;
  }

  .wallet-option {
    padding: 14px 16px;
  }

  .wallet-icon {
    width: 40px;
    height: 40px;
  }

  .wallet-icon img {
    width: 28px;
    height: 28px;
  }
}
