:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #dbe3ee;
  --line-strong: #3b82f6;
  --text: #152033;
  --muted: #64748b;
  --soft: #94a3b8;
  --blue: #2563eb;
  --cyan: #0891b2;
  --green: #059669;
  --amber: #b45309;
  --red: #dc2626;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background:
    linear-gradient(180deg, rgba(219, 234, 254, 0.7), rgba(245, 247, 251, 0) 260px),
    var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  appearance: none;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
}

.shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #fff;
  padding: 5px;
  border: 1px solid var(--line);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 16px;
  line-height: 1.2;
}

.brand-copy span,
.privacy-note,
.muted {
  color: var(--muted);
}

.brand-copy span,
.privacy-note,
.token-link {
  font-size: 12px;
}

.privacy-note,
.token-link {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  text-decoration: none;
}

button.token-link {
  color: #334155;
}

.page {
  padding: 28px 0 56px;
  display: grid;
  gap: 18px;
}

.panel,
.tabs {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 45px -34px rgba(15, 23, 42, 0.42);
}

.panel {
  border-radius: var(--radius);
  padding: 22px;
}

.flow {
  display: grid;
  gap: 20px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

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

textarea {
  width: 100%;
  height: 168px;
  margin-top: 16px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
  color: var(--text);
  padding: 14px;
  line-height: 1.55;
  font-family: "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  font-size: 13px;
  outline: none;
}

textarea:focus,
input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.token-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.token-status {
  min-height: 31px;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #334155;
  word-break: break-word;
}

.badge.good {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.badge.bad {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-radius: 14px;
}

.tab,
.choice,
.primary-action,
.secondary-action,
.copy-button,
.open-link {
  border: 0;
  color: inherit;
}

.tab {
  height: 44px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  color: #0f172a;
  background: #eef6ff;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

.choice-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-group legend,
label span {
  display: block;
  margin-bottom: 9px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.choice-grid {
  display: grid;
  gap: 12px;
}

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

.choice-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice {
  min-height: 86px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 16px;
  transition: 0.18s ease;
}

.choice:hover {
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.choice.active {
  border-color: #38bdf8;
  background: #f0f9ff;
}

.choice span {
  display: block;
  font-size: 15px;
  font-weight: 800;
}

.choice small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.4;
}

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

.proxy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 16px;
}

.proxy-panel .output {
  margin-top: 14px;
}

input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.primary-action {
  width: 100%;
  min-height: 48px;
  border-radius: 11px;
  background: linear-gradient(90deg, var(--blue), var(--cyan), var(--green));
  color: white;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 18px 32px -24px rgba(37, 99, 235, 0.75);
}

.primary-action.alt {
  background: linear-gradient(90deg, var(--green), var(--cyan), var(--blue));
}

.primary-action:disabled {
  opacity: 0.62;
}

.secondary-action {
  min-height: 44px;
  border-radius: 10px;
  background: #e0f2fe;
  color: #075985;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 800;
}

.output {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 16px;
}

.output.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.result-link {
  margin-top: 10px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: #0f766e;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  word-break: break-all;
}

.output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.copy-button,
.open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  text-decoration: none;
  background: #e2e8f0;
}

.open-link {
  background: #dbeafe;
  color: #1d4ed8;
}

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

.source-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.source-switch-button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.source-switch-button.active {
  background: #ecfeff;
  color: #0e7490;
  box-shadow: inset 0 0 0 1px #a5f3fc;
}

.stat-group {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.stat-group:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.source-panels .stat-group {
  display: none;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.source-panels .stat-group.active {
  display: grid;
}

.stat-group h3 {
  margin: 0;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.2;
}

.stat {
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 13px;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.stat-value {
  color: var(--text);
  font-weight: 800;
  word-break: break-word;
}

details {
  margin-top: 12px;
}

summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

pre {
  overflow: auto;
  max-height: 320px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  font-size: 12px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 980px);
  }

  .privacy-note {
    display: none;
  }

  .panel {
    padding: 18px;
  }

  .choice-grid.two,
  .choice-grid.four,
  .proxy-grid,
  .team-grid,
  .source-switch,
  .details-grid {
    grid-template-columns: 1fr;
  }

  textarea {
    height: 190px;
  }
}
