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

/* ── Theme tokens ─────────────────────────────── */
:root {
  --page-bg:    #f0f0f0;
  --title-clr:  #111;
  --sub-clr:    #888;
  --label-clr:  #555;
  --note-clr:   #999;
  --toggle-bg:  #fff;
  --toggle-bd:  #ccc;
  --toggle-clr: #444;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page-bg:    #111;
    --title-clr:  #eee;
    --sub-clr:    #555;
    --label-clr:  #888;
    --note-clr:   #555;
    --toggle-bg:  #1e1e1e;
    --toggle-bd:  #3a3a3a;
    --toggle-clr: #bbb;
  }
}

[data-theme="dark"] {
  --page-bg:    #111;
  --title-clr:  #eee;
  --sub-clr:    #555;
  --label-clr:  #888;
  --note-clr:   #555;
  --toggle-bg:  #1e1e1e;
  --toggle-bd:  #3a3a3a;
  --toggle-clr: #bbb;
}

body {
  background: var(--page-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  color: #222;
  padding: 40px 24px 80px;
  transition: background-color 0.25s;
}

h1 {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--title-clr);
}

.subtitle {
  text-align: center;
  font-size: 12px;
  color: var(--sub-clr);
  margin-bottom: 48px;
  letter-spacing: 0.03em;
}

.screens {
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  justify-content: center;
}

.screen-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.screen-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--label-clr);
}

/* Phone shell */
.phone {
  width: 260px;
  height: 520px;
  border: 3px solid #222;
  border-radius: 36px;
  background: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  display: flex;
  flex-direction: column;
}

/* Notch */
.phone::before {
  content: '';
  display: block;
  width: 80px;
  height: 18px;
  background: #222;
  border-radius: 0 0 12px 12px;
  margin: 0 auto;
  flex-shrink: 0;
}

/* Status bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 16px 6px;
  font-size: 9px;
  font-weight: 700;
  color: #444;
  flex-shrink: 0;
}

/* Screen body */
.screen-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Navigation bar (top) */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 2px solid #e0e0e0;
  flex-shrink: 0;
}

.nav-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-icon {
  width: 22px;
  height: 22px;
  border: 2px solid #aaa;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #888;
  cursor: pointer;
  background: #f7f7f7;
}

/* Scrollable content */
.content {
  flex: 1;
  overflow: hidden;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Bottom tab bar */
.tab-bar {
  display: flex;
  border-top: 2px solid #e0e0e0;
  flex-shrink: 0;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px 10px;
  font-size: 8px;
  color: #aaa;
  gap: 3px;
  cursor: pointer;
}

.tab.active {
  color: #111;
}

.tab-icon {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.tab-icon.circle { border-radius: 50%; }

/* 5-tab layout: tighten label so it fits */
.tab-bar:has(.tab:nth-child(5)) .tab {
  padding: 8px 2px 10px;
  font-size: 7px;
}

/* Shared blocks */
.block {
  background: #e8e8e8;
  border-radius: 6px;
}

.block-sm  { height: 10px; }
.block-md  { height: 14px; }
.block-lg  { height: 20px; }
.block-xl  { height: 32px; }
.block-2xl { height: 48px; }
.block-3xl { height: 64px; }

.block-w-80  { width: 80%; }
.block-w-60  { width: 60%; }
.block-w-40  { width: 40%; }
.block-w-full{ width: 100%; }

.block-dark { background: #bbb; }
.block-light { background: #f0f0f0; border: 2px solid #ddd; }

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ccc;
  border: 2px solid #aaa;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #666;
  font-weight: 700;
}

.avatar-sm {
  width: 22px;
  height: 22px;
  font-size: 9px;
}

.card {
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 8px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  background: #e8e8e8;
  color: #555;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill-dark {
  background: #222;
  color: #fff;
}

.divider {
  height: 1px;
  background: #eee;
  margin: 2px 0;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border-radius: 8px;
  border: 2px solid #222;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.btn-primary {
  background: #222;
  color: #fff;
}

.btn-outline {
  background: #fff;
  color: #222;
}

.btn-sm {
  height: 24px;
  font-size: 9px;
  border-radius: 6px;
}

.input-field {
  height: 32px;
  border: 2px solid #ccc;
  border-radius: 8px;
  background: #fafafa;
  padding: 0 10px;
  display: flex;
  align-items: center;
}

.input-label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin-bottom: 3px;
}

.section-title {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
  margin-bottom: 4px;
}

.hop-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aaa;
  display: inline-block;
}

.hop-dot.filled { background: #333; }

.annotation {
  font-size: 9px;
  color: var(--note-clr);
  text-align: center;
  font-style: italic;
  margin-top: 2px;
}

.badge {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #333;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.signal-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.signal-bar {
  width: 3px;
  background: #aaa;
  border-radius: 1px;
}

.signal-bar.active { background: #333; }

.checkbox {
  width: 14px;
  height: 14px;
  border: 2px solid #aaa;
  border-radius: 3px;
  flex-shrink: 0;
}

.checkbox.checked {
  background: #222;
  border-color: #222;
}

.radio {
  width: 14px;
  height: 14px;
  border: 2px solid #aaa;
  border-radius: 50%;
  flex-shrink: 0;
}

.radio.selected {
  border-color: #222;
  background: radial-gradient(circle, #222 40%, transparent 40%);
}

.toggle {
  width: 28px;
  height: 16px;
  border-radius: 8px;
  background: #ddd;
  position: relative;
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  border: 1px solid #ccc;
}

.toggle.on {
  background: #333;
}

.toggle.on::after {
  left: 14px;
  border-color: #555;
}

/* Bluetooth wave circles */
.bt-wave {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bt-wave-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px dashed #bbb;
}

.bt-center {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #222;
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.bt-device {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e0e0e0;
  border: 2px solid #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
}

.qr-placeholder {
  width: 64px;
  height: 64px;
  background: repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 0 0 / 8px 8px;
  border: 2px solid #aaa;
  border-radius: 4px;
}

.storage-bar {
  height: 8px;
  background: #e8e8e8;
  border-radius: 4px;
  overflow: hidden;
}

.storage-fill {
  height: 100%;
  background: #444;
  border-radius: 4px;
}

.fingerprint {
  font-family: monospace;
  font-size: 7px;
  color: #999;
  letter-spacing: 0.08em;
  word-break: break-all;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px 7px;
}

/* Modal overlay */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: flex-end;
}

.modal-sheet {
  width: 100%;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 12px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  margin: 0 auto 4px;
}

.modal-title {
  font-size: 12px;
  font-weight: 700;
}

/* ── Theme toggle button ──────────────────────── */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--toggle-bg);
  border: 2px solid var(--toggle-bd);
  border-radius: 20px;
  color: var(--toggle-clr);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: background 0.25s, color 0.25s, border-color 0.25s,
              opacity 0.25s, transform 0.25s;
  z-index: 100;
}

.theme-toggle.hidden {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.theme-toggle:hover {
  opacity: 0.8;
}

/* ── Dark mode: invert phone screens ─────────── */
/* All wireframe colors are grayscale, so invert() gives a clean dark result */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .phone {
    filter: invert(1);
    transition: filter 0.25s;
  }
}

[data-theme="dark"] .phone {
  filter: invert(1);
  transition: filter 0.25s;
}

[data-theme="light"] .phone
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .phone {
    filter: none;
  }
}
