/* KC Auth — minimal dark theme aligned with web/index.html visual language */
:root {
  --bg-0: #050507;
  --bg-1: #0C0D12;
  --bg-2: #12141B;
  --bg-3: #1A1D28;

  --gold: #F5A623;
  --gold-bright: #FFC857;
  --violet: #8B5CF6;
  --emerald: #34D399;
  --rose: #FB7185;

  --text-0: #F0F0F5;
  --text-1: #A0A3B5;
  --text-2: #636880;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-gold: rgba(245, 166, 35, 0.30);

  --font-body: 'Inter', 'Exo 2', 'Noto Sans SC', 'PingFang SC', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 50% -20%, rgba(245, 166, 35, 0.06), transparent 60%),
    radial-gradient(900px 500px at 80% 110%, rgba(139, 92, 246, 0.05), transparent 60%),
    var(--bg-0);
  color: var(--text-0);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

code, pre, textarea {
  font-family: var(--font-mono);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* === Hero === */
.hero {
  text-align: center;
  margin-bottom: 36px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--border-gold);
  border-radius: 999px;
  background: rgba(245, 166, 35, 0.04);
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  color: var(--bg-0);
  font-weight: 800;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.5px;
}

.brand-name {
  font-weight: 600;
  color: var(--gold-bright);
  font-size: 14px;
  letter-spacing: 0.3px;
}

.hero h1 {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, var(--text-0), var(--text-1));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  color: var(--text-1);
  font-size: 15px;
  margin: 0 auto;
  max-width: 540px;
}

.subtitle code {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--gold-bright);
}

/* === Cards === */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
  transition: border-color 0.2s ease;
}

.card:hover {
  border-color: var(--border-strong);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(245, 166, 35, 0.10);
  border: 1px solid var(--border-gold);
  color: var(--gold-bright);
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-0);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-2);
  color: var(--text-0);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--gold);
  background: var(--bg-3);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  color: var(--bg-0);
  border-color: transparent;
  font-weight: 700;
  padding: 14px 18px;
  font-size: 15px;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 4px 16px rgba(245, 166, 35, 0.25);
}

.btn-copy {
  font-size: 12px;
  padding: 6px 12px;
  white-space: nowrap;
}

.btn-link {
  background: none;
  border: none;
  color: var(--violet);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  padding: 0;
  margin-left: 6px;
}

.btn-link:hover {
  color: var(--gold-bright);
}

/* === Wallet buttons === */
.wallet-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 520px) {
  .wallet-buttons { grid-template-columns: 1fr; }
}

.btn-wallet {
  padding: 14px;
  justify-content: flex-start;
  text-align: left;
}

.wallet-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--gold-bright);
  flex-shrink: 0;
}

.wallet-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wallet-name {
  font-weight: 600;
  font-size: 14px;
}

.wallet-chain {
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* === Wallet status === */
.wallet-status {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
}

.wallet-status code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--gold-bright);
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-ok {
  background: var(--emerald);
  box-shadow: 0 0 6px var(--emerald);
}

.chain-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.10);
  border: 1px solid rgba(139, 92, 246, 0.30);
  color: var(--violet);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-weight: 600;
}

.wallet-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-2);
  text-align: center;
}

.wallet-hint a {
  color: var(--violet);
  text-decoration: none;
}

.wallet-hint a:hover {
  color: var(--gold-bright);
}

/* === Form fields === */
.field {
  margin-bottom: 16px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-0);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
  word-break: break-all;
  line-height: 1.4;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.15);
}

.field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-2);
}

.field-hint code {
  background: var(--bg-2);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--gold-bright);
}

/* === Output === */
.output-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.output-row textarea,
.output-row pre {
  flex: 1;
  margin: 0;
}

.env-line {
  background: var(--bg-0);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--emerald);
  word-break: break-all;
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.4;
}

/* 历史 Token 卡片 (本地浏览器持久化) — 比主步骤更紧凑 */
.history-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.04), transparent 60%);
}

.history-count {
  margin-left: auto;
  padding: 2px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-1);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--bg-0);
  transition: border-color 0.15s ease;
}

.history-item:hover {
  border-color: var(--border-strong);
}

.history-item.history-expired {
  opacity: 0.6;
  border-style: dashed;
}

.history-row1 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.history-name {
  color: var(--text-0);
  font-size: 14px;
}

.history-badge {
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 10px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-badge-eth {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.history-badge-cosmos {
  background: rgba(244, 114, 182, 0.15);
  color: #f9a8d4;
  border: 1px solid rgba(244, 114, 182, 0.3);
}

.history-expires {
  margin-left: auto;
  font-size: 11px;
  color: var(--emerald);
  font-family: var(--mono);
}

.history-item.history-expired .history-expires {
  color: var(--text-2);
}

.history-row2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-2);
}

.history-wallet {
  font-family: var(--mono);
  background: var(--bg-2);
  padding: 2px 6px;
  border-radius: 4px;
}

.history-row3 {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.history-row3 .btn-link {
  font-size: 11px;
}

.history-delete {
  margin-left: auto;
  color: var(--text-2) !important;
}

.history-delete:hover {
  color: #ef4444 !important;
}

.history-actions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: flex-end;
}

/* Phase 1 接入提示词块 — 视觉上比 token/env 更突出，因为是用户主动复制给 Agent 的核心交付物 */
.agent-prompt-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}

.agent-prompt-block label {
  color: var(--emerald);
  font-weight: 600;
}

.agent-prompt-block textarea {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  background: var(--bg-0);
  border: 1px solid var(--emerald);
  color: var(--text-0);
}

/* 启用自动上传 section — 营销区块，比 prompt block 更亮眼 */
.auto-upload-block {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--emerald);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.02));
}

.auto-upload-block > label {
  color: var(--emerald);
  font-weight: 600;
  font-size: 15px;
}

.auto-upload-narrative {
  margin: 10px 0 14px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-1);
}

.auto-upload-narrative p {
  margin: 6px 0;
}

.auto-upload-narrative strong {
  color: var(--text-0);
}

.auto-upload-privacy {
  margin-top: 10px !important;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-2);
}

.auto-upload-install {
  margin-top: 12px;
}

.auto-upload-sublabel {
  display: block;
  font-size: 12px;
  color: var(--text-1);
  margin-bottom: 6px;
}

.auto-upload-detail {
  margin-top: 12px;
  padding: 10px;
  background: var(--bg-2);
  border-radius: 8px;
  font-size: 12px;
}

.auto-upload-detail summary {
  cursor: pointer;
  color: var(--text-1);
  user-select: none;
}

.auto-upload-detail summary:hover {
  color: var(--emerald);
}

.auto-upload-list {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--text-2);
}

.auto-upload-list li {
  margin-bottom: 6px;
  line-height: 1.5;
}

.auto-upload-list code {
  font-size: 11px;
  background: var(--bg-0);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--text-1);
}

.decode {
  margin-top: 14px;
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.decode summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-1);
  user-select: none;
}

.decode summary:hover {
  color: var(--gold-bright);
}

.decode pre {
  margin: 12px 0 0;
  padding: 10px;
  background: var(--bg-0);
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-1);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 320px;
  overflow: auto;
}

.agent-id {
  display: inline-block;
  padding: 8px 12px;
  background: var(--bg-0);
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  color: var(--gold-bright);
  font-size: 13px;
  word-break: break-all;
}

.sign-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-2);
  text-align: center;
}

.sign-hint code {
  background: var(--bg-2);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--gold-bright);
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-3);
  border: 1px solid var(--rose);
  color: var(--text-0);
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
  max-width: calc(100% - 32px);
}

.toast.toast-ok {
  border-color: var(--emerald);
}

/* === Misc === */
.hidden { display: none !important; }

.footer {
  margin-top: 40px;
  text-align: center;
  color: var(--text-2);
  font-size: 12px;
}

.footer p { margin: 4px 0; }
.footer .small { font-size: 11px; color: var(--text-2); opacity: 0.7; }
