@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── RESET & ROOT ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  --bg: #080b10;
  --surface: #0f1318;
  --surface2: #141920;
  --border: #1e2630;
  --border2: #2a3340;
  --text: #e8edf2;
  --muted: #8896a3;
  --hint: #5e6d7a;
  --accent: #a6e55f;
  --accent-dim: #a6e55f1a;
  --accent-dark: #7cb83e;
  --green-glow: #a6e55f33;
  --red: #ff5e5e;
  --red-bg: #2a1515;
  --red-border: #6b2020;
  --amber: #f5b942;
  --amber-bg: #251d0e;
  --card-radius: 16px;
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
html { background: var(--bg); color: var(--text); font-synthesis: none; }
body { margin: 0; min-width: 320px; }
h1, h2, h3, p { margin-top: 0; }

/* ─── TOPBAR ────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: 64px; display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.brand {
  color: var(--text); font: 500 13px 'DM Mono', monospace;
  letter-spacing: .10em; text-decoration: none;
}
.brand span { color: var(--muted); }

/* ─── SHELL ─────────────────────────────────────────────────── */
.shell { width: min(1040px, calc(100% - 40px)); margin: 0 auto 100px; }

/* ─── WIZARD HEADER ─────────────────────────────────────────── */
.wizard-header { padding: 52px 0 36px; }
.wizard-header h1 {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800; letter-spacing: -.055em;
  line-height: 1.05; margin-bottom: 14px;
  background: linear-gradient(135deg, #e8edf2 30%, #a6e55f);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.muted { color: var(--muted); line-height: 1.65; }
.small { font-size: 12px; }

/* ─── STEP PROGRESS NAV ─────────────────────────────────────── */
.steps {
  display: flex; align-items: center; gap: 0;
  margin-top: 36px; flex-wrap: wrap; gap: 4px 0;
}
.step {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border: none; background: transparent;
  cursor: pointer; border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}
.step:hover { background: var(--accent-dim); }
.step-num {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font: 600 11px 'DM Mono', monospace;
  color: var(--muted); flex-shrink: 0;
  transition: all var(--transition);
}
.step-label { font-size: 13px; font-weight: 500; color: var(--muted); transition: color var(--transition); }
.step.active .step-num { border-color: var(--accent); background: var(--accent); color: #0f1a00; }
.step.active .step-label { color: var(--text); }
.step.done .step-num { border-color: var(--accent-dark); background: var(--accent-dim); color: var(--accent); }
.step-connector { flex: 1; min-width: 20px; height: 1px; background: var(--border2); }

/* ─── WIZARD STEP CARD ──────────────────────────────────────── */
.wizard-step { animation: fadeIn 280ms ease; }
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: clamp(24px, 4vw, 48px);
  margin-bottom: 20px;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.eyebrow {
  color: var(--accent); font: 500 11px 'DM Mono', monospace;
  letter-spacing: .15em; margin-bottom: 10px;
}
h2 { font-size: 26px; font-weight: 700; letter-spacing: -.04em; margin-bottom: 10px; }

/* ─── STEP ACTIONS ──────────────────────────────────────────── */
.step-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 36px; gap: 12px;
}

/* ─── BUTTONS ───────────────────────────────────────────────── */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 18px;
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  background: var(--surface2); color: var(--text);
  font: 600 13px Inter, sans-serif; cursor: pointer; white-space: nowrap;
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition), transform 80ms;
}
.button:hover { border-color: var(--accent); }
.button:active { transform: scale(0.98); }
.button.primary {
  border-color: var(--accent); background: var(--accent); color: #0f1a00;
}
.button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.button.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.button.quiet:hover { color: var(--text); border-color: transparent; }
.button.small { min-height: 32px; padding: 0 12px; font-size: 12px; }
.faucet-btn { border-color: #f5b94240; background: var(--amber-bg); color: var(--amber); }
.faucet-btn:hover { border-color: var(--amber); }

/* ─── HIDDEN ────────────────────────────────────────────────── */
.hidden, [hidden] { display: none !important; }

/* ─── INPUTS / FORMS ────────────────────────────────────────── */
label { display: grid; gap: 7px; font-size: 12px; font-weight: 600; color: #c8d0d8; }
input, textarea, select {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  background: #0a0d12; color: var(--text);
  font: 400 13px Inter, sans-serif;
  outline: none; transition: border-color var(--transition), box-shadow var(--transition);
}
textarea { resize: vertical; font-family: 'DM Mono', monospace; font-size: 12px; line-height: 1.6; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--green-glow);
}
.hint { color: var(--hint); font-size: 11px; font-weight: 400; margin: 4px 0 0; }
.req { color: var(--red); }

/* ─── FORM GRID ─────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
.form-field { display: grid; gap: 7px; }
.form-field.full { grid-column: 1 / -1; }
.form-field.half { grid-column: span 1; }
.form-field.third { grid-column: span 1; }

/* ─── PASSWORD FIELD ────────────────────────────────────────── */
.password-field { position: relative; }
.password-field input { padding-right: 44px; }
.btn-eye {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 40px; background: transparent; border: none;
  cursor: pointer; color: var(--muted); display: flex;
  align-items: center; justify-content: center;
}
.btn-eye:hover { color: var(--text); }

/* ─── DROPZONE ──────────────────────────────────────────────── */
.provider-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 24px;
}
.provider-tile {
  min-height: 132px; padding: 18px 14px; border: 1px solid var(--border); border-radius: var(--card-radius);
  background: var(--surface2); color: var(--text); cursor: pointer; text-align: left;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; transition: border-color var(--transition), transform var(--transition), background var(--transition);
}
.provider-tile:hover, .provider-tile.selected { border-color: var(--accent); background: #10180c; transform: translateY(-2px); }
.provider-tile span:last-child { color: var(--muted); font-size: 11px; line-height: 1.4; }
.provider-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--border2); border-radius: 9px;
  color: var(--accent); font: 600 13px var(--mono);
}
.preset-key-panel { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(260px, 1.2fr); gap: 24px; align-items: end; margin-top: 20px; }
.preset-key-panel h3, .custom-flow-heading h3 { margin: 4px 0 7px; }
.custom-flow-heading { margin-top: 28px; }
.dropzone {
  border: 2px dashed var(--border2); border-radius: var(--card-radius);
  background: linear-gradient(135deg, var(--surface2) 0%, #0a0e15 100%);
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer; margin-top: 24px;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: linear-gradient(135deg, #0f1a0a 0%, #0c1108 100%);
}
.dropzone-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 52px 24px; text-align: center;
}
.dropzone-icon { color: var(--muted); opacity: .7; }
.dropzone:hover .dropzone-icon, .dropzone.drag-over .dropzone-icon { color: var(--accent); opacity: 1; }
.dropzone-title { font-size: 16px; font-weight: 600; margin: 0; }
#spec-file-input { display: none; }

/* ─── DIVIDER OR ────────────────────────────────────────────── */
.divider-or {
  display: flex; align-items: center; gap: 16px;
  margin: 24px 0; color: var(--hint); font-size: 12px;
}
.divider-or::before, .divider-or::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ─── URL INPUT ROW ─────────────────────────────────────────── */
.url-input-row { display: flex; gap: 10px; }
.url-input-row input { flex: 1; }

/* ─── PARSE RESULT ──────────────────────────────────────────── */
.parse-result {
  margin-top: 20px;
  background: #0b150a;
  border-color: #3a5e2a;
}
.parse-result-header { display: flex; align-items: flex-start; gap: 14px; }
.parse-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.parse-icon.success { background: #1d3d14; color: var(--accent); }
.parse-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag {
  padding: 3px 10px; border-radius: 99px;
  font: 500 11px 'DM Mono', monospace;
  border: 1px solid;
}
.tag.get { border-color: #2a5e4e; background: #0d221a; color: #6bcaae; }
.tag.post { border-color: #2e4f72; background: #0d1e35; color: #7ab4f0; }
.tag.put { border-color: #5e4e1a; background: #211a06; color: #d4a84b; }
.tag.patch { border-color: #553a72; background: #1c1228; color: #b58ef0; }
.tag.delete { border-color: #6b2020; background: #250c0c; color: #f08080; }

/* ─── OPERATIONS TABLE ──────────────────────────────────────── */
.ops-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin: 24px 0 14px;
}
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: #0a0d12; border: 1px solid var(--border2);
  border-radius: var(--radius-sm); padding: 0 12px;
  flex: 1; max-width: 340px;
}
.search-box svg { flex-shrink: 0; color: var(--muted); }
.search-box input {
  border: none; background: transparent; padding: 9px 0;
  box-shadow: none;
}
.search-box input:focus { box-shadow: none; }
.ops-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bulk-price-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
}
.ops-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ops-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.ops-table th {
  padding: 12px 14px; background: var(--surface2);
  font: 600 11px 'DM Mono', monospace; color: var(--muted);
  letter-spacing: .06em; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.ops-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ops-table tr:last-child td { border-bottom: none; }
.ops-table tr:hover td { background: var(--surface2); }
.ops-table input[type="number"] {
  width: 88px; padding: 6px 8px; font-size: 12px;
}
.ops-table input[type="number"]:focus { box-shadow: 0 0 0 2px var(--green-glow); }
.method-badge {
  padding: 3px 8px; border-radius: 4px;
  font: 600 10px 'DM Mono', monospace;
  display: inline-block;
}
.method-GET    { background: #0d221a; color: #6bcaae; border: 1px solid #2a5e4e; }
.method-POST   { background: #0d1e35; color: #7ab4f0; border: 1px solid #2e4f72; }
.method-PUT    { background: #211a06; color: #d4a84b; border: 1px solid #5e4e1a; }
.method-PATCH  { background: #1c1228; color: #b58ef0; border: 1px solid #553a72; }
.method-DELETE { background: #250c0c; color: #f08080; border: 1px solid #6b2020; }
.path-cell { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--muted); }
.ops-count { margin-top: 10px; }
/* Toggle switch */
.toggle-switch { display: flex; align-items: center; }
.toggle-switch input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 36px; height: 20px; border-radius: 99px;
  background: var(--border2); border: none;
  cursor: pointer; position: relative; flex-shrink: 0;
  transition: background var(--transition);
  padding: 0;
}
.toggle-switch input[type="checkbox"]::before {
  content: ''; position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: white; transition: transform var(--transition);
}
.toggle-switch input[type="checkbox"]:checked {
  background: var(--accent);
}
.toggle-switch input[type="checkbox"]:checked::before {
  transform: translateX(16px);
}

/* ─── PANEL ─────────────────────────────────────────────────── */
.panel {
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* ─── BADGE ─────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 4px 10px;
  border: 1px solid var(--border2); border-radius: 99px;
  color: var(--muted); font: 500 11px 'DM Mono', monospace;
}
.badge.active { border-color: #556d3c; background: #14260e; color: #c9f49f; }

/* ─── WALLET TABS ───────────────────────────────────────────── */
.wallet-tabs {
  display: flex; gap: 2px; margin: 24px 0 0;
  background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 4px;
}
.wallet-tab {
  flex: 1; padding: 9px 16px; border: none;
  border-radius: calc(var(--radius) - 3px);
  background: transparent; color: var(--muted);
  font: 600 13px Inter, sans-serif; cursor: pointer;
  transition: all var(--transition);
}
.wallet-tab.active { background: var(--accent); color: #0f1a00; }
.wallet-tab:not(.active):hover { background: var(--accent-dim); color: var(--text); }
.wallet-tab-panel { margin-top: 20px; }

/* ─── WALLET GENERATE BOX ───────────────────────────────────── */
.wallet-generate-box {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 40px; text-align: center;
  border: 2px dashed var(--border2); border-radius: var(--card-radius);
  background: linear-gradient(135deg, var(--surface2), #0a0e15);
}
.wallet-gen-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.wallet-gen-title { font-size: 16px; font-weight: 700; margin: 0; }

/* ─── WALLET RESULT ─────────────────────────────────────────── */
.wallet-result { margin-top: 20px; }
.wallet-addr-row {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px;
  margin-bottom: 20px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.wallet-addr {
  font: 14px 'DM Mono', monospace;
  word-break: break-all; color: var(--text); margin: 6px 0 0;
}
.wallet-balance-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}
.wallet-balance { font-size: 22px; font-weight: 700; color: var(--accent); margin: 4px 0 0; }
.wallet-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── MNEMONIC BOX ──────────────────────────────────────────── */
.mnemonic-box {
  margin-top: 20px; padding-top: 20px;
  border-top: 1px solid var(--border);
}
.mnemonic-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 12px;
}
.mnemonic-words {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-bottom: 14px;
}
.mnemonic-word {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: #0a0d12; border: 1px solid var(--border);
  font: 13px 'DM Mono', monospace;
}
.mnemonic-word .word-num {
  font-size: 10px; color: var(--hint); min-width: 14px;
}
.mnemonic-warning {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--amber-bg); border: 1px solid #f5b94230;
  color: var(--amber); font-size: 12px; line-height: 1.5;
  margin-bottom: 14px;
}
.mnemonic-warning svg { flex-shrink: 0; margin-top: 1px; }

/* ─── CIP-30 WALLET LIST ────────────────────────────────────── */
.cip30-wallets { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.cip30-wallet-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border: 1px solid var(--border2);
  border-radius: var(--radius); background: var(--surface2);
  cursor: pointer; font: 600 14px Inter, sans-serif;
  color: var(--text); transition: all var(--transition);
}
.cip30-wallet-btn:hover { border-color: var(--accent); background: var(--accent-dim); }
.cip30-wallet-btn img { width: 24px; height: 24px; border-radius: 4px; }

/* ─── REVIEW GRID ───────────────────────────────────────────── */
.review-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.review-card {
  padding: 20px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface2);
}
.review-card.full-width { grid-column: 1 / -1; }
.review-rows { display: grid; gap: 10px; margin-top: 12px; }
.review-row {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.review-row:last-child { border-bottom: none; padding-bottom: 0; }
.review-row > span:first-child { color: var(--muted); flex-shrink: 0; }
.review-row > span:last-child, .review-row > code { text-align: right; font-family: 'DM Mono', monospace; font-size: 12px; word-break: break-all; }
.review-ops-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.review-ops-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.review-ops-table th {
  padding: 8px 12px; background: #0a0d12;
  font: 600 11px 'DM Mono', monospace; color: var(--muted);
  text-align: left; border-bottom: 1px solid var(--border);
}
.review-ops-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-family: 'DM Mono', monospace; }
.review-ops-table tr:last-child td { border-bottom: none; }

/* ─── PUBLISH ACTIONS ───────────────────────────────────────── */
.publish-actions {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 20px; margin-top: 28px; flex-wrap: wrap;
}
.publish-right { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.publish-btn { min-height: 46px; padding: 0 28px; font-size: 14px; }

/* ─── SUCCESS ───────────────────────────────────────────────── */
.success-card { text-align: center; padding: 64px clamp(24px, 6vw, 80px); }
.success-icon {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 28px;
  animation: pulse 2.5s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--green-glow); }
  50% { box-shadow: 0 0 0 14px transparent; }
}
.success-info { text-align: left; margin: 28px auto; max-width: 620px; }
.success-actions { display: flex; justify-content: center; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

/* ─── SPINNER ───────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── MONO ──────────────────────────────────────────────────── */
.mono { font-family: 'DM Mono', monospace; font-size: 13px; }
code { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--accent); }

/* ─── TOAST ─────────────────────────────────────────────────── */
#toast {
  position: fixed; right: 24px; bottom: 28px;
  max-width: 440px; padding: 14px 20px;
  border-radius: var(--radius);
  border: 1px solid #3a5e2a;
  background: #0f1f0c; color: #e5f8d6;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 16px 60px #0009;
  z-index: 9999;
  animation: slideIn 250ms cubic-bezier(0.4, 0, 0.2, 1);
}
#toast.error { border-color: var(--red-border); background: var(--red-bg); color: #ffb4ae; }
@keyframes slideIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ─── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .provider-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .preset-key-panel { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.third, .form-field.half { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .provider-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { gap: 2px; }
  .step-label { display: none; }
  .step-connector { min-width: 12px; }
  .wallet-tabs { flex-direction: column; }
  .mnemonic-words { grid-template-columns: repeat(3, 1fr); }
  .publish-actions { flex-direction: column; align-items: stretch; }
  .publish-right { flex-direction: column; }
  .ops-toolbar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
}
@media (max-width: 480px) {
  .shell { width: min(100% - 20px, 1040px); }
  .step-card { padding: 20px; }
  .mnemonic-words { grid-template-columns: repeat(2, 1fr); }
  .wallet-balance-row { flex-direction: column; align-items: flex-start; }
}
