/* ── Design tokens ─────────────────────────────────────── */
:root {
  --color-bg: #0a0a0a;
  --color-surface: #141414;
  --color-surface-2: #1c1c1c;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-text: #f0ede8;
  --color-text-muted: #8a8680;
  --color-text-dim: #5a5854;
  --color-bitcoin: #f7931a;
  --color-bitcoin-dim: rgba(247, 147, 26, 0.12);
  --color-live: #4ade80;
  --color-cached: #fbbf24;
  --color-error: #f87171;
  --font:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --max-width: 420px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

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

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────── */
.screen {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Typography ─────────────────────────────────────────── */
.balance-primary {
  font-size: clamp(32px, 8vw, 48px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
  line-height: 1.1;
}

.balance-secondary {
  font-size: 16px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 18px;
  font-weight: 500;
}
p {
  font-size: 15px;
  color: var(--color-text-muted);
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
}

.card-sm {
  padding: 14px 16px;
  border-radius: var(--radius-md);
}

/* ── Inputs ─────────────────────────────────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.input-group label {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 500;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px; /* 16px prevents iOS zoom on focus */
  font-family: var(--font);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s;
}

input:focus {
  border-color: rgba(255, 255, 255, 0.2);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 500;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    opacity 0.15s,
    transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
  opacity: 0.8;
}
.btn-primary {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Status indicators ──────────────────────────────────── */
.status-live {
  color: var(--color-live);
  font-size: 12px;
}

.status-cache {
  color: var(--color-cached);
  font-size: 12px;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 5px;
}

.dot-live {
  background: var(--color-live);
}

.dot-cache {
  background: var(--color-cached);
}

/* ── Node attribution (spec requirement) ────────────────── */
.node-attribution {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-dim);
  padding: 10px 0;
}

/* ── Transaction items ──────────────────────────────────── */
.tx-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}

.tx-item:last-child {
  border-bottom: none;
}

.tx-status {
  font-size: 13px;
}
.tx-block {
  font-size: 12px;
  color: var(--color-text-dim);
  margin-top: 2px;
}
.tx-date {
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: right;
}

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.alert-cached {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: var(--color-cached);
}
.alert-error {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--color-error);
}

/* ── Loading ─────────────────────────────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 12px;
  color: var(--color-text-muted);
  font-size: 14px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-bitcoin);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Bitcoin amount display ──────────────────────────────── */
.btc-amount {
  color: var(--color-bitcoin);
  font-weight: 600;
}
.sats-label {
  font-size: 12px;
  color: var(--color-text-dim);
}

/* ── Utilities ──────────────────────────────────────────── */
.mt-auto {
  margin-top: auto;
}
.mb-20 {
  margin-bottom: 20px;
}
.mb-8 {
  margin-bottom: 8px;
}
.text-center {
  text-align: center;
}
.hidden {
  display: none !important;
}
.flex {
  display: flex;
}
.items-center {
  align-items: center;
}
.gap-8 {
  gap: 8px;
}
