:root {
  color-scheme: dark;
  --bg: #020b0c;
  --bg-deep: #010606;
  --surface: rgba(6, 28, 30, 0.72);
  --surface-2: rgba(8, 36, 38, 0.88);
  --surface-solid: #061c1e;
  --ink: #f4fffc;
  --muted: #8aaba6;
  --line: rgba(0, 255, 224, 0.22);
  --line-strong: rgba(0, 255, 224, 0.45);
  --accent: #00ffe0;
  --accent-2: #ff5c78;
  --accent-3: #d4fc50;
  --accent-ink: #021010;
  --warn: #f0c45a;
  --danger: #ff6b7d;
  --ok: #5be0ad;
  --glow: 0 0 24px rgba(0, 255, 224, 0.18), 0 0 60px rgba(0, 255, 224, 0.08);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 10px;
  --nav-h: 72px;
  --font-sans: "Inter", "IBM Plex Sans", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", "Roboto Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #e8f7f4;
  --bg-deep: #d4efe9;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-2: rgba(232, 247, 244, 0.95);
  --surface-solid: #ffffff;
  --ink: #071413;
  --muted: #4d6662;
  --line: rgba(0, 140, 128, 0.22);
  --line-strong: rgba(0, 160, 145, 0.4);
  --accent: #00c8b0;
  --accent-2: #e2556c;
  --accent-3: #b8e040;
  --accent-ink: #021010;
  --warn: #b87400;
  --danger: #d13d4e;
  --ok: #168a65;
  --glow: 0 0 20px rgba(0, 200, 176, 0.12);
  --shadow: 0 18px 46px rgba(16, 20, 19, 0.1);
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-lang="zh"] body {
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", "Heiti SC", var(--font-sans);
}

html[data-lang="zh"] .brand,
html[data-lang="zh"] .nav-links a,
html[data-lang="zh"] .icon-btn,
html[data-lang="zh"] .lang-btn,
html[data-lang="zh"] .network-pill,
html[data-lang="zh"] .connect-btn,
html[data-lang="zh"] .primary-btn,
html[data-lang="zh"] .secondary-btn,
html[data-lang="zh"] .ghost-btn,
html[data-lang="zh"] .kicker,
html[data-lang="zh"] .field span,
html[data-lang="zh"] .field input,
html[data-lang="zh"] .field textarea,
html[data-lang="zh"] .field select,
html[data-lang="zh"] .search-box,
html[data-lang="zh"] .status-line {
  font-family: "IBM Plex Mono", "Microsoft YaHei", "PingFang SC", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-sans);
  letter-spacing: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 55% at 50% -8%, rgba(0, 255, 224, 0.16), transparent 58%),
    radial-gradient(ellipse 50% 35% at 85% 15%, rgba(212, 252, 80, 0.07), transparent 55%),
    radial-gradient(circle at 1px 1px, rgba(0, 255, 224, 0.28) 1px, transparent 0),
    linear-gradient(rgba(0, 255, 224, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 224, 0.045) 1px, transparent 1px),
    radial-gradient(ellipse at center, var(--bg) 0%, var(--bg-deep) 100%);
  background-size:
    100% 100%,
    100% 100%,
    28px 28px,
    56px 56px,
    56px 56px,
    100% 100%;
  background-attachment: fixed;
}

html[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse 90% 55% at 50% -8%, rgba(0, 200, 176, 0.14), transparent 58%),
    radial-gradient(circle at 1px 1px, rgba(0, 140, 128, 0.18) 1px, transparent 0),
    linear-gradient(rgba(0, 140, 128, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 140, 128, 0.06) 1px, transparent 1px),
    var(--bg);
  background-size:
    100% 100%,
    28px 28px,
    56px 56px,
    56px 56px,
    100% 100%;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .56; }

.app-shell { min-height: 100vh; }

.nav {
  height: var(--nav-h);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg-deep) 72%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 1px 0 rgba(0, 255, 224, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 154px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.brand img, .logo-mark {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--accent);
  box-shadow: 0 0 16px rgba(0, 255, 224, 0.35);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-solid) 70%, transparent);
  box-shadow: inset 0 0 0 1px rgba(0, 255, 224, 0.04);
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a.is-active {
  color: var(--accent);
  border-color: var(--line-strong);
  background: rgba(0, 255, 224, 0.08);
  box-shadow: 0 0 14px rgba(0, 255, 224, 0.2);
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 250px;
}

.icon-btn,
.lang-btn,
.network-pill,
.connect-btn,
.primary-btn,
.secondary-btn,
.ghost-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.icon-btn {
  width: 40px;
  padding: 0;
  display: grid;
  place-items: center;
}

.lang-btn {
  min-width: 52px;
  font-weight: 800;
}

.network-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
  font-size: 12px;
}

.network-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 255, 224, 0.18), 0 0 10px rgba(0, 255, 224, 0.55);
}

.connect-btn,
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-color: transparent;
  background: linear-gradient(105deg, var(--accent-3) 0%, var(--accent) 55%, #00d4c8 100%);
  color: var(--accent-ink);
  font-weight: 800;
  box-shadow: 0 0 18px rgba(0, 255, 224, 0.35), 0 0 40px rgba(212, 252, 80, 0.12);
  text-shadow: none;
}

.connect-btn:hover,
.primary-btn:hover {
  filter: brightness(1.06);
}

.secondary-btn { background: var(--surface-2); }
.ghost-btn { background: transparent; }

.toolbar,
.panel,
.side-panel,
.token-card,
.stat-card,
.form-panel,
.preview-panel,
.legal-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--glow), var(--shadow);
  backdrop-filter: blur(14px) saturate(130%);
}

.panel {
  box-shadow: var(--glow), inset 0 0 0 1px rgba(0, 255, 224, 0.04), var(--shadow);
}

.token-card {
  background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
  box-shadow: inset 0 0 0 1px rgba(0, 255, 224, 0.05), 0 0 20px rgba(0, 255, 224, 0.06);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.token-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 0 24px rgba(0, 255, 224, 0.18);
  transform: translateY(-1px);
}

.layout {
  width: min(1220px, calc(100% - 32px));
  margin: 24px auto 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.single-layout {
  width: min(1040px, calc(100% - 32px));
  margin: 24px auto 40px;
}

.workspace,
.side-stack {
  display: grid;
  gap: 14px;
}

.toolbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.search-box {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  padding: 0 14px;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
}

.segmented {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.segmented button.is-active {
  color: var(--accent);
  background: rgba(0, 255, 224, 0.1);
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 12px rgba(0, 255, 224, 0.15);
}

.panel { padding: 22px; }

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 20px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px rgba(0, 255, 224, 0.35);
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 8px;
  font-size: 42px;
  line-height: 1.05;
  font-weight: 780;
  letter-spacing: -0.03em;
  text-shadow: 0 0 30px rgba(0, 255, 224, 0.12);
}

h2 {
  margin-bottom: 8px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 760;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
}

.copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  max-width: 760px;
}

.protocol-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.code-chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 255, 224, 0.06);
  color: var(--accent);
  padding: 0 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 0 12px rgba(0, 255, 224, 0.04);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 110px);
  gap: 8px;
}

.metric {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 255, 224, 0.04);
}

.metric span {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 18px;
}

.token-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.token-card {
  min-height: 224px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  padding: 14px;
}

.token-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.token-id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.token-id img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 12px rgba(0, 255, 224, 0.25);
}

.token-id strong,
.token-id span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-id strong {
  font-family: var(--font-mono);
}

.token-id span {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  align-self: start;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--accent-3) 45%, transparent);
  background: color-mix(in srgb, var(--accent-3) 18%, transparent);
  color: var(--accent-3);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.token-stats {
  display: grid;
  gap: 8px;
  align-content: end;
}

.bar {
  height: 9px;
  border-radius: 5px;
  background: rgba(0, 255, 224, 0.08);
  border: 1px solid rgba(0, 255, 224, 0.12);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-3), var(--accent));
  box-shadow: 0 0 12px rgba(0, 255, 224, 0.45);
}

.token-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.token-action {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.token-action:hover {
  border-color: var(--line-strong);
  box-shadow: 0 0 14px rgba(0, 255, 224, 0.18);
}

.side-panel {
  padding: 16px;
}

.side-panel img {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  object-fit: cover;
  margin-bottom: 12px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 18px rgba(0, 255, 224, 0.25);
}

.fact-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}

.fact {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.fact strong {
  color: var(--ink);
  text-align: right;
  overflow-wrap: anywhere;
}

.queue-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(0, 255, 224, 0.04);
  font-family: var(--font-mono);
}

.queue-item span {
  color: var(--accent);
  font-size: 12px;
}

.status-line {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.status-line[data-tone="ok"] { color: var(--ok); }
.status-line[data-tone="warn"] { color: var(--warn); }
.status-line[data-tone="danger"] { color: var(--danger); }

.create-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.form-panel,
.preview-panel,
.legal-panel {
  padding: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field.wide { grid-column: 1 / -1; }

.field span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.search-box:focus {
  border-color: var(--accent);
  outline: 3px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.preview-token {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  margin: 12px 0;
  overflow: hidden;
}

.preview-token img {
  width: 110px;
  height: 110px;
  border-radius: 8px;
  object-fit: cover;
}

.config-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 13px;
}

.config-row span { color: var(--muted); }
.config-row strong { color: var(--ink); overflow-wrap: anywhere; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  padding: 16px;
  box-shadow: none;
}

.stat-card span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 26px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.chart {
  min-height: 260px;
  display: grid;
  align-items: end;
  grid-template-columns: repeat(12, 1fr);
  gap: 7px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.chart span {
  display: block;
  min-height: 18px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-3));
}

.profile-box {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.profile-box img {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
}

.legal-panel {
  line-height: 1.7;
}

.legal-panel section {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.legal-panel ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.footer {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto 40px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.footer a { color: var(--ink); }

@media (max-width: 1020px) {
  .layout,
  .create-grid {
    grid-template-columns: 1fr;
  }

  .side-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .token-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-row,
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .nav {
    height: auto;
    min-height: var(--nav-h);
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .brand,
  .nav-actions {
    min-width: 0;
  }

  .nav-links {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .nav-links a {
    flex: 1;
    justify-content: center;
  }

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

  .panel-head {
    display: grid;
    align-items: start;
  }

  h1 {
    font-size: 32px;
  }

  .token-grid,
  .side-stack,
  .form-grid,
  .chart-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    display: grid;
  }
}
