:root {
  --bg: #f5f5f7;
  --surface: rgba(255,255,255,0.82);
  --surface-solid: #ffffff;
  --surface-hover: rgba(0,0,0,0.04);
  --border: rgba(0,0,0,0.08);
  --border-hover: rgba(0,0,0,0.15);
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --accent: #007AFF;
  --accent-hover: #0066D6;
  --accent-subtle: rgba(0,122,255,0.1);
  --green: #34C759;
  --red: #FF3B30;
  --yellow: #FF9500;
  --shadow-sm: 0 0 0 0.5px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 0 0 0.5px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 0 0 0.5px rgba(0,0,0,0.04), 0 12px 40px rgba(0,0,0,0.08);
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 13px;
  line-height: 1.5;
  transition: background 0.3s var(--ease);
  letter-spacing: -0.006em;
}

/* ── Toast ── */

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 500;
  background: var(--text);
  color: white;
  border-radius: 100px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transition: transform 0.4s var(--ease), opacity 0.25s;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--accent); }

/* ── Modal ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(30px) saturate(1.2);
  -webkit-backdrop-filter: blur(30px) saturate(1.2);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface-solid);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.18);
  overflow: hidden;
  animation: modalIn 0.35s var(--ease);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 22px 14px;
}

.modal-header h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal-close {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--surface-hover);
  font-size: 18px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.15s;
}

.modal-close:hover {
  background: rgba(0,0,0,0.1);
  color: var(--text);
}

.modal-body {
  padding: 0 22px 22px;
}

.modal video {
  width: 100%;
  border-radius: var(--radius);
  background: #000;
  display: block;
}

.scan-status {
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ── Window ── */

.window {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  border: 0.5px solid var(--border);
  transition: all 0.3s var(--ease);
}

.window-body {
  position: relative;
}

/* ── Header ── */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
}

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

.brand-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #007AFF, #5856D6);
  border-radius: 8px;
  color: white;
  box-shadow: 0 2px 8px rgba(0,122,255,0.3);
}

.brand-icon svg {
  width: 18px;
  height: 18px;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  line-height: 1.2;
}

.theme-btn {
  width: 32px;
  height: 32px;
  border: 0.5px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
}

.theme-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  color: var(--text-secondary);
  transform: scale(1.05);
}

.theme-btn:active {
  transform: scale(0.92);
}

.theme-btn svg {
  width: 15px;
  height: 15px;
}

/* ── Main ── */

main {
  padding: 24px 24px 20px;
}

/* ── Preview Section ── */

.preview-section {
  text-align: center;
  padding: 16px 0 12px;
  display: none;
}

.preview-section.show {
  display: block;
}

.preview-section .code-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  user-select: all;
  -webkit-user-select: all;
}

.preview-section .code-value {
  font-size: 64px;
  font-weight: 700;
  font-family: 'SF Mono', 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 16px;
  color: var(--text);
  line-height: 1;
  transition: opacity 0.25s, filter 0.25s;
}

.preview-section .code-value.blur {
  opacity: 0.08;
  filter: blur(8px);
  user-select: none;
  -webkit-user-select: none;
}

.preview-section .copy-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.preview-section .code-display:hover .copy-hint {
  opacity: 1;
}

.preview-section .code-issuer {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  min-height: 20px;
  margin-top: 2px;
}

.timer-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
}

.timer-ring-preview {
  position: relative;
  width: 32px;
  height: 32px;
}

.timer-ring-preview svg {
  transform: rotate(-90deg);
  width: 32px;
  height: 32px;
}

.tp-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 2.5;
}

.tp-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s linear, stroke 0.25s;
}

.tp-fill.warning {
  stroke: var(--yellow);
}

.tp-fill.danger {
  stroke: var(--red);
}

.tp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .preview-section .code-value { font-size: 44px; letter-spacing: 11px; }
}

@media (max-width: 380px) {
  .preview-section .code-value { font-size: 34px; letter-spacing: 8px; }
}

/* ── Search ── */

.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
  backdrop-filter: blur(8px);
}

.search-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.search-icon {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.search-row input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  min-width: 0;
}

.search-row input::placeholder {
  color: var(--text-tertiary);
}

/* ── Account List ── */

.account-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 60px;
  margin-bottom: 4px;
}

/* ── Empty State ── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 20px 28px;
  text-align: center;
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-tertiary);
  opacity: 0.4;
  margin-bottom: 12px;
}

.empty-icon svg {
  width: 100%;
  height: 100%;
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.empty-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ── Account Row ── */

.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  border-radius: var(--radius);
  border: 0.5px solid transparent;
  background: var(--surface);
  transition: all 0.2s;
  backdrop-filter: blur(8px);
  cursor: default;
}

.account-row:hover {
  border-color: var(--border);
  background: var(--surface-hover);
}

.account-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #5856D6);
  color: white;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.account-avatar:nth-of-type(2n) { background: linear-gradient(135deg, #FF9500, #FF3B30); }
.account-avatar:nth-of-type(3n) { background: linear-gradient(135deg, #34C759, #30B0C7); }
.account-avatar:nth-of-type(4n) { background: linear-gradient(135deg, #AF52DE, #5856D6); }
.account-avatar:nth-of-type(5n) { background: linear-gradient(135deg, #FF2D55, #FF9500); }

.account-info {
  flex: 1;
  min-width: 0;
}

.account-issuer {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-code {
  font-size: 18px;
  font-weight: 700;
  font-family: 'SF Mono', 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 4px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: opacity 0.15s;
}

.account-code:hover {
  opacity: 0.6;
}

/* ── Account Timer ── */

.account-timer {
  position: relative;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.tm-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* ── Account Buttons ── */

.account-copy,
.account-delete {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s;
  flex-shrink: 0;
  opacity: 0;
}

.account-row:hover .account-copy,
.account-row:hover .account-delete {
  opacity: 1;
}

.account-copy svg,
.account-delete svg {
  width: 15px;
  height: 15px;
}

.account-copy:hover {
  background: var(--accent-subtle);
  color: var(--accent);
}

.account-delete:hover {
  background: rgba(255,59,48,0.1);
  color: var(--red);
}

/* ── Divider ── */

.section-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0 16px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 0.5px;
  background: var(--border);
}

/* ── Add Grid ── */

.add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.add-card {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 16px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface);
  backdrop-filter: blur(8px);
}

.add-card:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.add-card:active {
  transform: translateY(0);
}

.card-manual {
  cursor: default;
}

.card-manual:hover {
  border-color: var(--border);
  background: var(--surface);
  transform: none;
  box-shadow: none;
}

.card-manual:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  transform: none;
}

.add-card-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 10px;
  color: var(--text-tertiary);
  transition: color 0.2s;
}

.add-card-icon svg {
  width: 100%;
  height: 100%;
}

.add-card:hover .add-card-icon {
  color: var(--accent);
}

.card-manual:hover .add-card-icon {
  color: var(--text-tertiary);
}

.add-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.add-card-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.4;
}

.add-card-actions {
  margin-top: 12px;
}

.btn-small {
  padding: 5px 14px;
  font-size: 12px;
  gap: 5px;
}

.add-card-foot {
  margin-top: 10px;
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.add-card input[type="file"] {
  display: none;
}

/* ── Input ── */

.input-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.input-row input {
  width: 100%;
  padding: 7px 10px;
  border: 0.5px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-family: 'SF Mono', 'JetBrains Mono', ui-monospace, monospace;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.input-row input::placeholder {
  font-family: -apple-system, 'SF Pro Text', sans-serif;
  color: var(--text-tertiary);
  font-size: 12px;
}

.input-row .btn {
  width: 100%;
  justify-content: center;
  margin-top: 2px;
}

kbd {
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  background: var(--surface-hover);
  border: 0.5px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-tertiary);
}

/* ── Modal Backup Body ── */

.bp-body {
  padding: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bp-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.bp-actions {
  display: flex;
  gap: 4px;
}

.bp-actions .btn {
  font-size: 10px;
  padding: 4px 10px;
}

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

.bp-status {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.bp-note {
  font-size: 10px;
  color: var(--text-tertiary);
  line-height: 1.4;
}

.bp-note a {
  color: var(--accent);
  text-decoration: none;
}

.bp-input-row {
  display: flex;
  gap: 4px;
}

.bp-input-row input {
  flex: 1;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 11px;
  color: var(--text);
  outline: none;
  font-family: 'SF Mono', 'JetBrains Mono', ui-monospace, monospace;
  transition: border-color 0.2s var(--ease);
}

.bp-input-row input:focus {
  border-color: var(--accent);
}

.dark .btn-wallet.connected {
  background: rgba(48,209,88,0.12);
  border-color: rgba(48,209,88,0.25);
  color: var(--green);
}

.dark .btn-wallet.connected:hover {
  background: rgba(255,69,58,0.12);
  border-color: rgba(255,69,58,0.25);
  color: var(--red);
}

/* ── Footer ── */

footer {
  padding: 16px 24px;
  border-top: 0.5px solid var(--border);
  text-align: center;
}

footer p {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ── Dark Mode ── */

.dark {
  --bg: #1c1c1e;
  --surface: rgba(44,44,46,0.85);
  --surface-solid: #2c2c2e;
  --surface-hover: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.25);
  --border-hover: rgba(255,255,255,0.4);
  --text: #f5f5f7;
  --text-secondary: #98989d;
  --text-tertiary: #636366;
  --accent: #0A84FF;
  --accent-hover: #409CFF;
  --accent-subtle: rgba(10,132,255,0.15);
  --green: #30D158;
  --red: #FF453A;
  --yellow: #FF9F0A;
  --shadow-sm: 0 0 0 0.5px rgba(255,255,255,0.04), 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 0 0 0.5px rgba(255,255,255,0.04), 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 0 0 0.5px rgba(255,255,255,0.04), 0 12px 40px rgba(0,0,0,0.4);
}

.dark .window { border-color: var(--border); }

.dark .brand-icon {
  background: linear-gradient(135deg, #0A84FF, #5E5CE6);
  box-shadow: 0 2px 8px rgba(10,132,255,0.3);
}

.dark .modal { background: var(--surface-solid); }

.dark .toast {
  background: rgba(255,255,255,0.15);
  color: white;
  backdrop-filter: blur(20px);
}

.dark .toast.success { background: var(--green); }
.dark .toast.error { background: var(--red); }
.dark .toast.info { background: var(--accent); }

.dark .btn-primary {
  box-shadow: 0 2px 8px rgba(10,132,255,0.25);
}

.dark .btn-primary:hover {
  box-shadow: 0 4px 14px rgba(10,132,255,0.35);
}

.dark .account-row {
  border-color: transparent;
}

.dark .account-row:hover {
  border-color: var(--border);
  background: var(--surface-hover);
}

.dark .account-code {
  color: var(--text);
}

.dark .search-row,
.dark .add-card {
  background: var(--surface);
}

.dark .card-manual {
  background: transparent;
}

.dark .card-manual:hover {
  background: transparent;
}

.dark .input-row input {
  background: rgba(255,255,255,0.05);
}

.dark .input-row input:focus {
  background: rgba(255,255,255,0.08);
}

.dark kbd {
  background: rgba(255,255,255,0.06);
}

/* ── Responsive ── */

@media (max-width: 640px) {
  body { padding: 0; align-items: flex-start; }
  .window { max-width: 100%; border-radius: 0; box-shadow: none; min-height: 100vh; border: none; }
  .window-body { min-height: 100vh; display: flex; flex-direction: column; }
  main { flex: 1; padding: 20px 16px; }
  header { padding: 20px 16px 0; }
  footer { padding: 14px 16px; }
  .add-grid { grid-template-columns: 1fr; }
  .account-code { font-size: 16px; letter-spacing: 3px; }
}

@media (max-width: 480px) {
  header { padding: 16px 16px 0; }
  .brand-name { font-size: 14px; }
  .brand-icon { width: 28px; height: 28px; }
  .brand-icon svg { width: 16px; height: 16px; }
  footer { padding: 12px 16px; }
  .toast { top: 14px; left: 14px; right: 14px; transform: translateY(-60px); white-space: normal; border-radius: var(--radius); }
  .toast.show { transform: translateY(0); }
  .account-row { padding: 8px 8px 8px 10px; }
  .account-code { font-size: 15px; }
  .account-copy, .account-delete { opacity: 1; }
}

@media (max-width: 380px) {
  .brand-name { font-size: 13px; }
  .brand-icon { width: 26px; height: 26px; }
  .brand-icon svg { width: 14px; height: 14px; }
  .account-code { font-size: 14px; letter-spacing: 2px; }
}

/* ── Header Actions ── */

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-icon {
  background: none;
  border: none;
  padding: 6px;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
}

.btn-icon:hover {
  color: var(--text);
  background: var(--surface-hover);
}

/* ── Modal Big / Backup Modal ── */

.modal-big {
  max-width: 480px;
}

.bp-account {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  font-family: 'SF Mono', 'JetBrains Mono', ui-monospace, monospace;
}

.bp-oauth-btn {
  margin: 4px 0;
}

.bp-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
  text-align: center;
}

.bp-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.bp-tab.active {
  color: var(--accent);
}

.bp-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 15%;
  right: 15%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* ── Footer / GitHub Link ── */

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-top: 0.5px solid var(--border);
  font-size: 11px;
  color: var(--text-tertiary);
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-tertiary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s var(--ease);
}

.github-link:hover {
  color: var(--accent);
}

.dark footer {
  border-top-color: var(--border);
}

/* ETH & BTC colored nodes */
.arch-eth {
  border-color: rgba(98,126,234,0.35);
  background: rgba(98,126,234,0.05);
}

.arch-eth .arch-icon { color: #627EEA; }

.arch-btc {
  border-color: rgba(247,147,26,0.35);
  background: rgba(247,147,26,0.05);
}

.arch-btc .arch-icon { color: #F7931A; }

.arch-tag {
  display: block;
  font-size: 7px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-top: 1px;
}

.arch-method {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 12px;
  gap: 2px;
  min-width: 68px;
}

.arch-method strong {
  font-weight: 700;
  font-size: 10px;
}

.arch-method span:not(.arch-tag) {
  font-size: 10px;
  line-height: 1.2;
}

.dark .arch-eth {
  background: rgba(98,126,234,0.08);
}

.dark .arch-btc {
  background: rgba(247,147,26,0.08);
}

/* ── Live Crypto Proof (BTC SHA-256 / ETH Keccak-256) ── */

.arch-proof {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
}

.arch-proof-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.arch-proof-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.arch-proof-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
  width: 90px;
  flex-shrink: 0;
}

.arch-proof-hash {
  font-family: 'SF Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 8px;
  color: var(--text-tertiary);
  word-break: break-all;
  line-height: 1.3;
  max-height: 28px;
  overflow: hidden;
}

.dark .arch-proof {
  background: rgba(255,255,255,0.03);
}

/* ── Architecture Diagram ── */

.modal-arch {
  max-width: 600px;
}

.arch-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 8px 0 4px;
}

.arch-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.arch-node {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.3s var(--ease);
  position: relative;
}

.arch-node:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-subtle);
}

.arch-lg {
  padding: 10px 20px;
}

.arch-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.arch-icon svg {
  width: 18px;
  height: 18px;
}

.arch-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.arch-sub {
  display: block;
  font-size: 9px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-top: 1px;
  white-space: nowrap;
}

/* Input nodes */
.arch-input {
  padding: 6px 12px;
  font-size: 10px;
  border-color: var(--border);
}

.arch-input .arch-icon {
  width: 20px;
  height: 20px;
}

.arch-input .arch-icon svg {
  width: 15px;
  height: 15px;
}

/* Primary (storage) */
.arch-primary {
  background: var(--accent-subtle);
  border-color: rgba(0,122,255,0.25);
}

.arch-primary .arch-icon {
  color: var(--accent);
}

.arch-primary .arch-label {
  color: var(--accent);
}

/* Method nodes */
.arch-method {
  padding: 6px 12px;
  font-size: 10px;
  border-color: var(--border);
}

.arch-method .arch-icon {
  width: 20px;
  height: 20px;
}

.arch-method .arch-icon svg {
  width: 15px;
  height: 15px;
}

/* Crypto nodes */
.arch-crypto {
  padding: 8px 16px;
  border-width: 1.5px;
}

.arch-kdf {
  border-color: rgba(255,149,0,0.35);
  background: rgba(255,149,0,0.05);
}

.arch-kdf .arch-icon {
  color: var(--yellow);
}

.arch-kdf .arch-label {
  color: var(--yellow);
}

.arch-aes {
  border-color: rgba(52,199,89,0.35);
  background: rgba(52,199,89,0.05);
}

.arch-aes .arch-icon {
  color: var(--green);
}

.arch-aes .arch-label {
  color: var(--green);
}

.arch-crypto-row {
  gap: 6px;
}

.arch-plus {
  display: flex;
  align-items: center;
  color: var(--text-tertiary);
  width: 18px;
  flex-shrink: 0;
}

.arch-plus svg {
  width: 14px;
  height: 14px;
}

/* Output node */
.arch-output {
  background: linear-gradient(135deg, rgba(10,132,255,0.08), rgba(94,92,230,0.08));
  border-color: rgba(94,92,230,0.3);
}

.arch-output .arch-icon {
  color: #5E5CE6;
}

.arch-output .arch-label {
  color: #5E5CE6;
}

/* Animated arrows */
.arch-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0 4px;
  position: relative;
}

.arch-arrow-down .arch-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: archFlow 1.5s ease-in-out infinite;
}

.arch-arrow-down .arch-dot:nth-child(2) {
  animation-delay: 0.3s;
}

.arch-arrow-down .arch-dot:nth-child(3) {
  animation-delay: 0.6s;
}

@keyframes archFlow {
  0%, 100% { opacity: 0.2; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(2px); background: var(--accent); }
}

/* Features row */
.arch-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 0.5px solid var(--border);
  width: 100%;
}

.arch-feature {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 500;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.arch-feature svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* Pulse glow on primary nodes */
.arch-node.arch-primary::after,
.arch-node.arch-output::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: inherit;
  border: inherit;
  z-index: -1;
  animation: archPulse 3s ease-in-out infinite;
  opacity: 0.3;
}

@keyframes archPulse {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.02); }
}

.dark .arch-node {
  background: rgba(255,255,255,0.03);
}

.dark .arch-primary {
  background: rgba(0,122,255,0.08);
}

.dark .arch-output {
  background: linear-gradient(135deg, rgba(10,132,255,0.06), rgba(94,92,230,0.06));
}

/* ── Language Tags ── */

.arch-langs {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
  width: 100%;
}

.arch-lang {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-tertiary);
}

.arch-lang-wasm {
  border-color: rgba(101,84,192,0.4);
  color: #6554C0;
  background: rgba(101,84,192,0.06);
}

.arch-lang-rust {
  border-color: rgba(239,78,39,0.4);
  color: #EF4E27;
  background: rgba(239,78,39,0.06);
}

.arch-lang-as {
  border-color: rgba(52,168,83,0.4);
  color: #34A853;
  background: rgba(52,168,83,0.06);
}

.arch-lang-js {
  border-color: rgba(247,223,30,0.4);
  color: #F7DF1E;
  background: rgba(247,223,30,0.08);
}

.arch-lang-py {
  border-color: rgba(55,118,172,0.4);
  color: #3776AB;
  background: rgba(55,118,172,0.06);
}

.arch-lang-html {
  border-color: rgba(227,76,38,0.4);
  color: #E34C26;
  background: rgba(227,76,38,0.06);
}

.dark .arch-lang {
  background: rgba(255,255,255,0.03);
}
