:root {
  --bg: #070b14;
  --bg-elevated: #0d1320;
  --surface: #121a2b;
  --surface-2: #182236;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(56, 189, 248, 0.35);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #22d3ee;
  --accent2: #818cf8;
  --tron: #ff2d96;
  --tron-soft: rgba(255, 45, 150, 0.14);
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(34, 211, 238, 0.08), transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 50%, rgba(255, 45, 150, 0.05), transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 20%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

.header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.72);
  backdrop-filter: blur(12px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  color: var(--text);
  max-width: min(100%, 520px);
}

.logo span:last-child,
.logo [data-app-name] {
  line-height: 1.35;
  font-size: clamp(0.78rem, 2.6vw, 0.95rem);
  font-weight: 600;
}

.logo-icon {
  flex-shrink: 0;
  color: var(--accent);
  font-size: 1.25rem;
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.45));
}

.container {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
}

.card {
  background: linear-gradient(165deg, rgba(24, 34, 54, 0.95), rgba(18, 26, 43, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.hero-panel {
  position: relative;
  overflow: hidden;
  padding: 1.75rem 1.5rem;
}

.hero-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--tron));
  opacity: 0.85;
}

.hero { margin-bottom: 1.25rem; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.22);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 0.85rem;
}

.hero-title {
  font-size: clamp(1.35rem, 4.5vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.55rem;
  text-wrap: balance;
  background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  color: var(--muted);
  margin-bottom: 1.15rem;
  font-size: 0.88rem;
  line-height: 1.55;
  max-width: 22rem;
  text-wrap: pretty;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.88rem;
  border: 1px solid transparent;
}

.status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.status.idle {
  background: rgba(148, 163, 184, 0.08);
  border-color: var(--border);
}
.status.connected {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.25);
}
.status.connected .dot { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status.authorized {
  background: rgba(34, 211, 238, 0.08);
  border-color: rgba(34, 211, 238, 0.28);
}
.status.authorized .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.status.error {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.28);
}
.status.error .dot { background: var(--danger); }

.wallet-info {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.wallet-info.hidden { display: none; }
.ui-hidden { display: none !important; }

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
}

.info-row span { color: var(--muted); }

.info-row code {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  word-break: break-all;
  text-align: right;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
.btn:not(:disabled):hover { transform: translateY(-2px); }
.btn:not(:disabled):active { transform: translateY(0); }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.25);
}

.btn.secondary {
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  border: 1px solid rgba(129, 140, 248, 0.35);
}

.btn.ghost {
  background: rgba(15, 23, 42, 0.5);
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn.danger { color: var(--danger); border-color: rgba(248, 113, 113, 0.35); }
.btn.small { padding: 0.4rem 0.85rem; font-size: 0.8rem; }

.log-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}

.log-header {
  padding: 0.55rem 1rem;
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

#logOutput {
  padding: 1rem;
  font-family: ui-monospace, monospace;
  font-size: 0.76rem;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: #7dd3fc;
  line-height: 1.5;
}

.features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.feature h3 { font-size: 0.92rem; margin-bottom: 0.65rem; font-weight: 600; }
.feature ul, .feature ol { padding-left: 1.15rem; color: var(--muted); font-size: 0.84rem; }
.feature li { margin-bottom: 0.3rem; }
.feature p { font-size: 0.84rem; color: var(--muted); margin-bottom: 0.5rem; line-height: 1.55; }

.deeplink {
  display: block;
  font-size: 0.72rem;
  word-break: break-all;
  padding: 0.55rem 0.65rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.78rem;
  opacity: 0.75;
}

.provider-hint {
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(34, 211, 238, 0.05);
  border: 1px solid rgba(34, 211, 238, 0.12);
  border-radius: var(--radius-sm);
  line-height: 1.55;
}

/* imToken 验证主卡片 */
.verify-card {
  position: relative;
  margin-bottom: 1.25rem;
  padding: 1.35rem 1.25rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: linear-gradient(160deg, rgba(34, 211, 238, 0.07) 0%, rgba(99, 102, 241, 0.05) 45%, rgba(255, 45, 150, 0.04) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 16px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.verify-card-shine {
  position: absolute;
  top: -40%;
  right: -20%;
  width: 55%;
  height: 80%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.12), transparent 65%);
  pointer-events: none;
}

.imtoken-card.imtoken-ready {
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.15) inset,
    0 0 32px rgba(34, 211, 238, 0.12),
    0 16px 40px rgba(0, 0, 0, 0.35);
}

.imtoken-header {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  margin-bottom: 1.15rem;
  position: relative;
  z-index: 1;
}

.imtoken-icon-wrap {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(255, 45, 150, 0.15));
  border: 1px solid rgba(251, 191, 36, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.imtoken-icon {
  font-size: 1.35rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.5));
}

.verify-title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: 0.01em;
  line-height: 1.3;
  text-wrap: balance;
}

.verify-desc {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
  white-space: pre-line;
  text-wrap: pretty;
}

.btn.imtoken-btn {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.35;
  border-radius: 12px;
  background: linear-gradient(135deg, #22d3ee 0%, #6366f1 50%, #a855f7 100%);
  color: #fff;
  border: none;
  box-shadow:
    0 4px 14px rgba(34, 211, 238, 0.35),
    0 8px 28px rgba(99, 102, 241, 0.25);
}

.btn.imtoken-btn:not(:disabled):hover {
  filter: brightness(1.06);
  box-shadow:
    0 6px 20px rgba(34, 211, 238, 0.4),
    0 12px 32px rgba(99, 102, 241, 0.3);
}

.imtoken-hint {
  position: relative;
  z-index: 1;
  margin-top: 0.85rem;
  padding: 0.65rem 0.8rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-line;
  text-wrap: pretty;
  background: rgba(7, 11, 20, 0.45);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.network-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.network-tab {
  flex: 1;
  padding: 0.55rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.network-tab:hover:not(.active) {
  border-color: rgba(148, 163, 184, 0.3);
  color: var(--text);
}

.network-tab.active {
  color: var(--text);
  border-color: rgba(34, 211, 238, 0.55);
  background: rgba(34, 211, 238, 0.1);
}

.network-tab.tron-active {
  border-color: rgba(255, 45, 150, 0.55);
  background: var(--tron-soft);
  color: #fda4d4;
}

.metamask-card {
  margin-bottom: 1.25rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid rgba(245, 133, 66, 0.3);
  background: linear-gradient(135deg, rgba(245, 133, 66, 0.08), rgba(227, 118, 20, 0.04));
}

.metamask-card.metamask-ready {
  border-color: rgba(245, 133, 66, 0.55);
  box-shadow: 0 0 28px rgba(245, 133, 66, 0.1);
}

.metamask-header {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.metamask-icon { font-size: 1.75rem; line-height: 1; }
.metamask-header strong { display: block; margin-bottom: 0.25rem; }
.metamask-header p { font-size: 0.82rem; color: var(--muted); margin: 0; line-height: 1.55; }

.btn.metamask-btn {
  width: 100%;
  background: linear-gradient(135deg, #f6851b, #e2761b);
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
}

.btn.metamask-btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn.metamask-btn:disabled { opacity: 0.55; background: #475569; }

.metamask-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.65rem;
  line-height: 1.55;
}

.balance-box,
.transfer-form,
.delegate-block,
.backend-session,
.hint { /* keep admin/legacy hooks */ }

.balance-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
}

.hero h2 { font-size: 1.2rem; margin-bottom: 0.35rem; }

@media (max-width: 600px) {
  .header { padding: 0.75rem 1rem; }
  .logo { font-size: 0.82rem; }
  .container { padding: 1rem 0.85rem 2rem; }
  .hero-panel { padding: 1.35rem 1.1rem; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; }
  .verify-card { padding: 1.15rem 1rem; }
}
