:root,
[data-theme="light"] {
  --stage-bg: #ececef;
  --stage-glow: radial-gradient(circle at 50% 20%, rgba(164, 166, 181, 0.28), transparent 60%);

  --header-top: #b6b7c5;
  --header-mid: #a4a6b5;
  --header-bot: #9497a8;
  --status-ink: #141416;
  --avatar-top: #9fa2b2;
  --avatar-bot: #868a9c;

  --surface-body: #f5f5f7;
  --card-bg: #ffffff;
  --card-hover: rgba(0, 0, 0, 0.025);
  --card-active: rgba(0, 0, 0, 0.055);
  --separator: rgba(60, 60, 67, 0.12);

  --ink-primary: #1c1c1e;
  --ink-secondary: #6e6e73;
  --ink-tertiary: #8e8e93;
  --ios-blue: #007aff;
  --badge-bg: #f0f0f5;

  --glass-bg: rgba(255, 255, 255, 0.22);
  --glass-bg-hover: rgba(255, 255, 255, 0.34);
  --glass-border: rgba(255, 255, 255, 0.25);

  --sheet-bg: #f2f2f7;
  --sheet-card: #ffffff;
  --sheet-backdrop: rgba(15, 16, 22, 0.36);

  --toast-bg: rgba(28, 28, 30, 0.92);
  --toast-ink: #ffffff;

  --screen-shadow:
    0 24px 60px rgba(24, 26, 40, 0.14),
    0 4px 14px rgba(24, 26, 40, 0.07),
    0 0 0 1px rgba(255, 255, 255, 0.65);
}

[data-theme="dark"] {
  --stage-bg: #0c0d11;
  --stage-glow: radial-gradient(circle at 50% 18%, rgba(90, 96, 130, 0.18), transparent 60%);

  --header-top: #323444;
  --header-mid: #262836;
  --header-bot: #1c1d28;
  --status-ink: #f5f5f7;
  --avatar-top: #4b4e63;
  --avatar-bot: #36394b;

  --surface-body: #000000;
  --card-bg: #1c1c1e;
  --card-hover: rgba(255, 255, 255, 0.04);
  --card-active: rgba(255, 255, 255, 0.08);
  --separator: rgba(255, 255, 255, 0.11);

  --ink-primary: #f5f5f7;
  --ink-secondary: #98989f;
  --ink-tertiary: #636366;
  --ios-blue: #0a84ff;
  --badge-bg: #2c2c2e;

  --glass-bg: rgba(255, 255, 255, 0.11);
  --glass-bg-hover: rgba(255, 255, 255, 0.19);
  --glass-border: rgba(255, 255, 255, 0.12);

  --sheet-bg: #1c1c1e;
  --sheet-card: #2c2c2e;
  --sheet-backdrop: rgba(0, 0, 0, 0.62);

  --toast-bg: rgba(44, 44, 46, 0.96);
  --toast-ink: #ffffff;

  --screen-shadow:
    0 28px 70px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

:root {
  --font-sf: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-editorial: "New York", "Iowan Old Style", "Georgia", serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  min-height: 100%;
  font-family: var(--font-sf);
  background-color: var(--stage-bg);
  background-image: var(--stage-glow);
  color: var(--ink-primary);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.28s ease, color 0.28s ease;
}

/* Minimalist desktop stage */
.stage {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

/* Floating iPhone screen card (no hardware bezel) */
.ios-screen {
  position: relative;
  width: 393px;
  max-width: 100%;
  min-height: 760px;
  max-height: calc(100dvh - 56px);
  background: var(--surface-body);
  border-radius: 38px;
  box-shadow: var(--screen-shadow);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  transition: background-color 0.28s ease, box-shadow 0.28s ease;
}

.ios-screen::-webkit-scrollbar {
  display: none;
}

/* Top iOS Toast Pill */
.ios-toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translate(-50%, -18px);
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 15px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 40;
  white-space: nowrap;
}

.ios-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #30d158;
  flex-shrink: 0;
}

/* Upper Contact Header */
.contact-header {
  background: linear-gradient(
    180deg,
    var(--header-top) 0%,
    var(--header-mid) 52%,
    var(--header-bot) 100%
  );
  padding: 14px 16px 20px;
  color: #ffffff;
  flex-shrink: 0;
  transition: background 0.28s ease;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 10px 10px;
  color: var(--status-ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  transition: color 0.25s ease;
}

.status-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-signal {
  width: 17px;
  height: 11px;
}

.icon-wifi {
  width: 15px;
  height: 11px;
}

.icon-battery {
  width: 24px;
  height: 12px;
}

.header-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

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

.nav-pill-btn,
.control-pill {
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.12s ease;
}

.nav-pill-btn {
  width: 32px;
}

.control-pill {
  padding: 0 11px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.nav-pill-btn:hover,
.control-pill:hover {
  background: var(--glass-bg-hover);
}

.nav-pill-btn:active,
.control-pill:active {
  transform: scale(0.94);
}

.nav-pill-btn svg {
  width: 13px;
  height: 13px;
}

.nav-pill-btn--icon svg {
  width: 15px;
  height: 15px;
}

/* Theme icon visibility */
[data-theme="light"] .icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

/* Avatar, Subtitle & Display Name */
.profile-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: -10px;
  margin-bottom: 20px;
}

.avatar {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--avatar-top) 0%, var(--avatar-bot) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 600;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(18, 20, 32, 0.14);
  margin-bottom: 12px;
  user-select: none;
}

.profile-subtitle {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 4px;
}

/* Art accent matching the reference's slightly editorial first letter */
.profile-name {
  font-size: 27px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.14;
  color: #ffffff;
  max-width: 300px;
  text-wrap: balance;
}

.profile-name::first-letter {
  font-family: var(--font-editorial);
  font-size: 31px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* 4 Quick Action Buttons */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 58px;
  border-radius: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #ffffff;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.12s ease;
}

.quick-btn:hover {
  background: var(--glass-bg-hover);
}

.quick-btn:active {
  transform: scale(0.96);
}

.quick-btn svg {
  width: 20px;
  height: 20px;
}

.quick-btn span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: lowercase;
}

/* Lower Contact Body */
.contact-body {
  padding: 14px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.ios-card,
.ios-section {
  background: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  transition: background-color 0.25s ease;
}

/* Reference-inspired "Today / Last update" easter egg */
.activity-card {
  padding: 14px 16px;
}

.activity-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-primary);
  margin-bottom: 10px;
}

.activity-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  padding: 4px 0;
  border-radius: 8px;
}

.activity-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.activity-time {
  font-size: 14px;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
}

.activity-meta-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-primary);
  line-height: 1.25;
}

.activity-meta-sub {
  font-size: 13px;
  color: var(--ink-secondary);
  margin-top: 2px;
}

.activity-arrow {
  color: var(--ink-tertiary);
  align-self: center;
}

/* Grouped iOS Resource Rows */
.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 10px 16px;
  position: relative;
  transition: background 0.14s ease;
}

.link-row:hover {
  background: var(--card-hover);
}

.link-row + .link-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  height: 1px;
  background: var(--separator);
}

.link-anchor {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  padding: 2px 0;
}

.link-label {
  font-size: 12px;
  color: var(--ink-secondary);
}

.link-value {
  font-size: 15px;
  color: var(--ios-blue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 10px;
}

.link-badge {
  font-size: 11px;
  color: var(--ink-secondary);
  background: var(--badge-bg);
  padding: 2px 7px;
  border-radius: 6px;
}

.copy-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ink-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, transform 0.12s ease;
}

.copy-icon-btn:hover {
  background: var(--badge-bg);
  color: var(--ios-blue);
}

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

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

.chevron {
  width: 7px;
  height: 12px;
  color: var(--ink-tertiary);
  opacity: 0.6;
}

/* Notes Card */
.note-card {
  padding: 12px 16px;
}

.note-label {
  font-size: 12px;
  color: var(--ink-secondary);
  margin-bottom: 4px;
}

.note-text {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-primary);
}

/* Home Indicator */
.home-indicator-wrap {
  position: sticky;
  bottom: 0;
  padding: 8px 0 8px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, var(--surface-body) 75%);
}

.home-indicator {
  width: 134px;
  height: 5px;
  border-radius: 999px;
  background: var(--ink-tertiary);
  opacity: 0.45;
}

/* Share + QR Sheet */
.ios-sheet-backdrop {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--sheet-backdrop);
  display: flex;
  align-items: flex-end;
  z-index: 50;
  overflow: hidden;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ios-sheet-backdrop[hidden] {
  display: none;
}

.ios-sheet {
  width: 100%;
  background: var(--sheet-bg);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 8px 18px 26px;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.22);
  animation: sheetUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sheetUp {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sheet-grabber {
  width: 36px;
  height: 5px;
  background: var(--ink-tertiary);
  opacity: 0.4;
  border-radius: 999px;
  margin: 0 auto 12px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sheet-header h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-primary);
}

.sheet-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--badge-bg);
  color: var(--ink-secondary);
  font-size: 13px;
  cursor: pointer;
}

.sheet-qr-card {
  background: var(--sheet-card);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.qr-box {
  width: 164px;
  height: 164px;
  background: #ffffff;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sheet-url {
  font-size: 12px;
  color: var(--ink-secondary);
  word-break: break-all;
  text-align: center;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sheet-action-btn {
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  background: var(--sheet-card);
  color: var(--ios-blue);
  cursor: pointer;
  transition: opacity 0.14s ease, transform 0.12s ease;
}

.sheet-action-btn--primary {
  background: var(--ios-blue);
  color: #ffffff;
}

.sheet-action-btn:active {
  transform: scale(0.97);
}

/* Mobile View: full-bleed screen */
@media (max-width: 480px) {
  .stage {
    padding: 0;
  }

  .ios-screen {
    width: 100%;
    min-height: 100dvh;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }
}
