:root {
  --bg: #0b1020;
  --surface: #131a2e;
  --surface-2: #19223c;
  --border: #273254;
  --text: #eef2ff;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.hidden {
  display: none !important;
}

.app-container {
  max-width: 540px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Install Banner */
.install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.banner-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  padding: 4px 6px;
  cursor: pointer;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #38bdf8);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}

.brand h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 3px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status-pill.connected {
  color: #86efac;
}

.status-pill.connected .dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.status-pill.waiting {
  color: #fde68a;
}

.status-pill.waiting .dot {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

.status-pill.error {
  color: #fca5a5;
}

.status-pill.error .dot {
  background: var(--red);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

/* Forms (16px prevents iOS Safari zoom on focus) */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  color: var(--muted);
}

.form-group input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 12px;
  font-size: 16px;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
}

/* Buttons */
.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-success {
  background: #16a34a;
  color: #fff;
}

.btn-lg {
  padding: 15px 18px;
  font-size: 16px;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 9px;
}

.btn-full {
  width: 100%;
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

/* Peers */
.peer-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.peer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}

.peer-chip.ready {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.12);
}

.peer-chip.connecting {
  border-color: rgba(245, 158, 11, 0.45);
}

.empty-text {
  font-size: 13px;
  color: var(--muted);
}

/* Send Card */
.send-card {
  gap: 10px;
}

.send-hint {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.wake-note {
  text-align: center;
  font-size: 12px;
  color: #fde68a;
}

/* Transfers */
.transfer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transfer-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.transfer-top {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.transfer-name {
  font-size: 14px;
  font-weight: 600;
  word-break: break-word;
}

.transfer-meta {
  font-size: 12px;
  color: var(--muted);
}

.progress-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #38bdf8);
  transition: width 0.1s linear;
}

.progress-fill.done {
  background: var(--green);
}

.progress-fill.error {
  background: var(--red);
}

.transfer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 2px;
}