/* Legacy interface. Beta-only decorations stay out of this layout. */
.beta-only { display: none !important; }

/* Pigeon design system — no external fonts or assets */

:root {
  /* 8px spacing grid */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;

  /* Type scale (system stack, tabular nums for metrics) */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 15px;
  --text-lg: 18px;
  --text-xl: 22px;
  --leading: 1.45;
  --tracking-tight: -0.02em;

  /* Dark (default) surfaces + one restrained accent */
  --bg: #0c0d0f;
  --bg-elevated: #14161a;
  --bg-subtle: #1a1d23;
  --bg-hover: #22262e;
  --border: #2a2f38;
  --border-strong: #3a4150;
  --text: #e8eaed;
  --text-muted: #8b93a7;
  --text-faint: #c5ccd6;
  --accent: #3cb8a0;
  --accent-hover: #48c9af;
  --accent-muted: rgba(60, 184, 160, 0.14);
  --accent-fg: #04241e;

  /* Semantic — status only */
  --ok: #3cb8a0;
  --warn: #d4a017;
  --danger: #e06c75;
  --info: #6b9fd4;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
  --sidebar-w: 220px;
  --touch: 44px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur: 180ms;
  --icon: 24px;
  --stroke: 1.5px;

  /* Fixed chrome heights — keep content scrollable and fully reachable */
  --chrome-bottom-nav: 56px;
  --chrome-devlog: 36px;
  --chrome-safe: env(safe-area-inset-bottom, 0px);
  --chrome-top: env(safe-area-inset-top, 0px);
  --chrome-bottom: calc(
    var(--chrome-bottom-nav) + var(--chrome-devlog) + var(--chrome-safe) + 24px
  );
}

@media (min-width: 860px) {
  :root {
    /* Desktop: no bottom nav, only collapsed Dev Log bar */
    --chrome-bottom: calc(var(--chrome-devlog) + 32px);
  }
}

/* Dev Log slid aside — free the space it was reserving */
html.devlog-docked {
  --chrome-devlog: 0px;
  --chrome-bottom: calc(var(--chrome-bottom-nav) + var(--chrome-safe) + 12px);
}

@media (min-width: 860px) {
  html.devlog-docked {
    --chrome-bottom: 12px;
  }
}

/* Light theme via system preference when theme=system */
@media (prefers-color-scheme: light) {
  :root[data-theme="system"],
  :root:not([data-theme]) {
    --bg: #f4f5f7;
    --bg-elevated: #ffffff;
    --bg-subtle: #eef0f3;
    --bg-hover: #e6e8ec;
    --border: #d8dce3;
    --border-strong: #c0c6d0;
    --text: #12141a;
    --text-muted: #5a6272;
    --text-faint: #3e4654;
    --accent: #1f8f7a;
    --accent-hover: #187a68;
    --accent-muted: rgba(31, 143, 122, 0.12);
    --accent-fg: #ffffff;
    --ok: #1f8f7a;
    --warn: #a67c00;
    --danger: #c9444f;
    --info: #3d6fa8;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 20px rgba(16, 24, 40, 0.06);
  }
}

:root[data-theme="light"] {
  --bg: #f4f5f7;
  --bg-elevated: #ffffff;
  --bg-subtle: #eef0f3;
  --bg-hover: #e6e8ec;
  --border: #d8dce3;
  --border-strong: #c0c6d0;
  --text: #12141a;
  --text-muted: #5a6272;
  --text-faint: #3e4654;
  --accent: #1f8f7a;
  --accent-hover: #187a68;
  --accent-muted: rgba(31, 143, 122, 0.12);
  --accent-fg: #ffffff;
  --ok: #1f8f7a;
  --warn: #a67c00;
  --danger: #c9444f;
  --info: #3d6fa8;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 20px rgba(16, 24, 40, 0.06);
}

:root[data-theme="dark"] {
  /* keep dark tokens from :root */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

html {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  padding-top: var(--chrome-top);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--bg);
  background-image: url("bg-atmosphere.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.55;
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] body::before,
  :root:not([data-theme]) body::before {
    background-image: url("bg-atmosphere-light.jpg");
    opacity: 0.7;
  }
}

:root[data-theme="light"] body::before {
  background-image: url("bg-atmosphere-light.jpg");
  opacity: 0.7;
}

:root[data-theme="dark"] body::before {
  background-image: url("bg-atmosphere.jpg");
  opacity: 0.55;
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    opacity: 0.35;
  }
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* ---- Icons ---- */
.icon {
  width: var(--icon);
  height: var(--icon);
  stroke: currentColor;
  stroke-width: var(--stroke);
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.icon-sm {
  width: 18px;
  height: 18px;
}

/* ---- Shell ---- */
.app-shell {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.sidebar {
  display: none;
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: var(--space-3) var(--space-2);
  padding-bottom: calc(var(--space-3) + var(--chrome-devlog) + 8px);
  flex-direction: column;
  gap: var(--space-3);
  overflow-x: hidden;
  overflow-y: auto;
}

@media (min-width: 860px) {
  .sidebar {
    display: flex;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-1);
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
}

.brand-mark img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.brand-name {
  font-size: var(--text-lg);
  font-weight: 650;
  letter-spacing: var(--tracking-tight);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--touch);
  padding: 0 var(--space-1);
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.nav-item:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-item:active:not(:disabled) {
  transform: scale(0.98);
}

.nav-item.is-active {
  background: var(--accent-muted);
  color: var(--accent);
}

.nav-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tag-soon {
  margin-left: auto;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}

.sidebar-foot {
  margin-top: auto;
  padding: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Top/sides fluid; bottom clears fixed Dev Log (+ mobile nav) */
  padding:
    clamp(8px, 1.5vh, 28px)
    clamp(16px, 2.5vw, 48px)
    calc(var(--chrome-bottom) + 12px);
}

.view.is-active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100%;
}

/* Wide screens: identity and connect sit side by side.
   Once a share session is open, stop stretching those cards so
   Send and Progress stay in their own rows instead of sliding underneath. */
@media (min-width: 1080px) and (min-height: 761px) {
  #view-transfer.is-active {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: var(--space-3);
    row-gap: var(--space-2);
    align-content: start;
    flex: 1;
    min-height: 0;
  }

  #view-transfer > .page-header,
  #view-transfer > #server-meter,
  #view-transfer > #identity-banner,
  #view-transfer > #session-profiles,
  #view-transfer > #prompt-area,
  #view-transfer > #send-area,
  #view-transfer > #progress-wrap,
  #view-transfer > #memory-warning,
  #view-transfer > #download-area {
    grid-column: 1 / -1;
  }

  #view-transfer > .panel {
    margin-top: 0;
    min-height: 0;
    overflow: hidden;
  }

  #view-transfer.is-active:not(:has(#send-area:not(.hidden))) > .panel:not(#send-area):not(#progress-wrap) {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: clamp(24px, 3vh, 40px);
  }

  #view-transfer.is-active:not(:has(#send-area:not(.hidden))) > .panel > .stack-gap,
  #view-transfer.is-active:not(:has(#send-area:not(.hidden))) > .panel > .btn-block {
    margin-top: auto;
  }

  .page-header h1 {
    font-size: 28px;
  }

  input[type="text"],
input[type="password"],
  select,
  .btn,
  .mono-box {
    min-height: 52px;
  }
}

#view-settings .panel {
  max-width: 720px;
}

.view {
  display: none;
  animation: view-in var(--dur) var(--ease);
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---- Bottom nav (mobile) ---- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 860px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav .nav-item {
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  padding: 6px 4px;
}

/* ---- Surfaces ---- */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: var(--space-2);
}

.server-meter {
  margin: 0 0 16px;
  padding: 14px 16px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.server-meter-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.server-meter-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

.server-meter-used {
  font-size: 13px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.server-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
}

#server-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 240ms var(--ease);
}

.server-meter.is-full #server-fill,
.server-meter.is-warn #server-fill {
  background: var(--warn);
}

.server-meter-note {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.file-limit {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text);
}

.file-limit.is-warn {
  color: var(--warn);
}

.server-meter.is-warn .server-meter-note {
  color: var(--warn);
}

@media (min-width: 1080px) and (min-height: 761px) {
  #view-transfer > #server-meter {
    margin: 0;
  }
}

.panel-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  /* Keep clear of the fixed version badge */
  padding-right: 188px;
}

@media (max-width: 420px) {
  .page-header {
    padding-right: 0;
    padding-top: 28px;
  }

  .panel {
    padding: var(--space-2);
  }

  .row {
    flex-wrap: wrap;
  }

  .row > .btn {
    flex: 1 1 auto;
  }
}

/* Short desktop windows: tighten so Transfer fits without a page scrollbar */
@media (max-height: 760px) and (min-width: 860px) {
  .page-header {
    margin-bottom: var(--space-2);
  }

  .page-sub {
    display: none;
  }

  .panel {
    padding: var(--space-2);
  }

  .panel + .panel {
    margin-top: var(--space-1);
  }

  .panel-title {
    margin-bottom: var(--space-1);
  }
}

@media (max-height: 620px) and (min-width: 860px) {
  .main {
    padding-top: 6px;
  }

  .page-header h1 {
    font-size: var(--text-lg);
  }

  .hint {
    display: none;
  }
}

.page-header h1 {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 650;
  letter-spacing: var(--tracking-tight);
}

.page-sub {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.corner-chrome {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 8px;
}

#app-version,
#bgm-toggle {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-decoration: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

#app-version:hover,
#bgm-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

#bgm-toggle[aria-pressed="true"] {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

/* ---- Profile / status ---- */
.profile-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--text-md);
  color: #fff;
  flex-shrink: 0;
}

.profile-meta {
  min-width: 0;
}

.profile-name {
  font-weight: 650;
  margin: 0;
}

.profile-id {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-faint);
  word-break: break-all;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
}

.peer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 220px;
  min-height: 32px;
  padding: 0 10px 0 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 650;
}

.peer-badge.hidden {
  display: none;
}

.peer-device {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--accent-muted);
  color: var(--accent);
  flex-shrink: 0;
}

.peer-badge .peer-icon-phone,
.peer-badge .peer-icon-pc,
.header-you .peer-icon-phone,
.header-you .peer-icon-pc,
.session-card .peer-icon-phone,
.session-card .peer-icon-pc {
  display: none;
}

.peer-badge[data-device="phone"] .peer-icon-phone,
.header-you[data-device="phone"] .peer-icon-phone,
.session-card[data-device="phone"] .peer-icon-phone,
.peer-badge[data-device="pc"] .peer-icon-pc,
.header-you[data-device="pc"] .peer-icon-pc,
.session-card[data-device="pc"] .peer-icon-pc {
  display: block;
}

.peer-online-dot,
.header-you-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 32%, transparent);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 13px;
  font-weight: 600;
}

.status-chip[data-state="Waiting"] {
  display: none;
}

.peer-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
}

.status-chip[data-state="Waiting"] .status-dot { background: var(--text-faint); }
.status-chip[data-state="Connecting"] .status-dot {
  background: var(--warn);
  animation: pulse-dot 1.1s var(--ease) infinite;
}
.status-chip[data-state="Connected"] .status-dot { background: var(--ok); }
.status-chip[data-state="Sending"] .status-dot { background: var(--info); }
.status-chip[data-state="Done"] .status-dot { background: var(--ok); }
.status-chip[data-state="Declined"],
.status-chip[data-state="Aborted"] .status-dot { background: var(--danger); }

.status-dot.peer-online-dot,
.status-dot.header-you-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 32%, transparent);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* Hide raw status text node but keep ID for JS */
#status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Forms / controls ---- */
.field-label {
  display: block;
  margin: 0 0 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
}

.row {
  display: flex;
  gap: var(--space-1);
  align-items: stretch;
}

.row > .grow {
  flex: 1;
  min-width: 0;
}

.mono-box {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  word-break: break-all;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  color: var(--text);
  min-height: var(--touch);
  display: flex;
  align-items: center;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  min-height: var(--touch);
  padding: 0 12px;
  font: inherit;
  font-size: var(--text-md);
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
button:focus-visible,
.nav-item:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: var(--text-faint);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 0 16px;
  font: inherit;
  font-weight: 650;
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease), transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--border);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(224, 108, 117, 0.12);
}

.btn-block {
  width: 100%;
  margin-top: var(--space-1);
}

.stack-gap {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.muted {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: 0;
}

html.session-live #connect-panel,
html.session-live #share-details,
html.session-live #identity-panel {
  display: none !important;
}

html.session-live #identity-panel #my-id,
html.session-live #identity-panel #copy-code-btn {
  display: none !important;
}

/* ---- Share link hidden by default ---- */
.share-mask {
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

#qrcode {
  display: none;
  margin-top: var(--space-2);
  padding: var(--space-2);
  background: #fff;
  border-radius: var(--radius-md);
  width: fit-content;
}

#qrcode.is-visible {
  display: flex;
}

/* ---- Drop zone ---- */
#drop-zone {
  position: relative;
  margin-top: var(--space-1);
  padding: 28px var(--space-2) 22px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.04), transparent 62%),
    var(--bg-subtle);
  text-align: center;
  color: var(--text-muted);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

#drop-zone.dragover,
#drop-zone.is-folder-target {
  border-color: var(--accent);
  background: var(--accent-muted);
  color: var(--text);
}

#drop-zone.is-folder-target {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
}

#drop-zone .hint {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
}

#file-input,
.file-input-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.file-picks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.file-pick {
  position: relative;
  z-index: 1;
  min-width: 140px;
}

.sign-mark {
  display: block;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45));
}

.sign-mark-side {
  width: 100%;
  max-width: 176px;
  max-height: 72px;
  margin: 0;
  object-fit: contain;
  object-position: left center;
  opacity: 0.95;
}

:root[data-theme="light"] .brand-mark img {
  filter: drop-shadow(0 1px 2px rgba(16, 24, 40, 0.2)) brightness(0.62) contrast(1.35);
}

:root[data-theme="light"] .sign-mark {
  filter: drop-shadow(0 1px 2px rgba(16, 24, 40, 0.2)) brightness(0.62) contrast(1.35);
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .brand-mark img {
    filter: drop-shadow(0 1px 2px rgba(16, 24, 40, 0.2)) brightness(0.62) contrast(1.35);
  }

  :root[data-theme="system"] .sign-mark {
    filter: drop-shadow(0 1px 2px rgba(16, 24, 40, 0.2)) brightness(0.62) contrast(1.35);
  }
}

.connect-hint {
  margin: 8px 0 0;
}

.connect-hint:not(.hidden) {
  color: var(--warn);
}

.connect-actions {
  display: flex;
  gap: 8px;
  margin-top: var(--space-1);
}

.connect-actions .btn {
  flex: 1;
  min-height: 48px;
}

.scanner {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
}

.scanner.hidden {
  display: none !important;
}

#scanner-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.scanner-shade {
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(68vw, 280px);
  height: min(68vw, 280px);
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 24px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.scanner-status {
  position: relative;
  z-index: 1;
  margin: 0 0 16px;
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

#scanner-close {
  position: relative;
  z-index: 1;
  min-width: 140px;
  background: #fff;
  color: #12141a;
}

.send-sheet {
  display: contents;
}

/* Desktop: send files opens over a blurred page */
@media (min-width: 1080px) {
  #send-area:not(.hidden) {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    max-width: none;
    margin: 0 !important;
    padding: 32px 24px;
    border: none;
    border-radius: 0;
    background: rgba(6, 8, 12, 0.42);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: none;
    overflow: auto;
  }

  #send-area:not(.hidden) .send-sheet {
    display: flex;
    flex-direction: column;
    width: min(560px, 100%);
    padding: 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
  }

  #view-transfer:has(#send-area:not(.hidden)) #progress-wrap.is-visible {
    position: fixed;
    z-index: 1210;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    width: min(560px, calc(100% - 48px));
    margin: 0;
  }
}

.sign-mark-drop {
  width: min(280px, 78%);
  margin: 0 auto 14px;
}

#send-area.hidden,
.hidden {
  display: none !important;
}

/* ---- Progress ---- */
#progress-wrap {
  display: none !important;
  margin-top: 0;
}

#progress-wrap.is-visible {
  display: block !important;
}

.stay-pin {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(212, 160, 23, 0.14);
  border: 1px solid rgba(212, 160, 23, 0.35);
  color: var(--warn);
  font-size: var(--text-sm);
  font-weight: 650;
}

.stay-pin.is-warn {
  background: rgba(212, 160, 23, 0.14);
  border-color: rgba(212, 160, 23, 0.35);
  color: var(--warn);
}

.stay-pin.is-clear {
  background: var(--accent-muted);
  border-color: transparent;
  color: var(--ok);
}

#progress-file {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 8px;
  word-break: break-word;
}

progress {
  width: 100%;
  height: 10px;
  border: none;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-subtle);
  transition: opacity var(--dur) var(--ease);
}

progress::-webkit-progress-bar {
  background: var(--bg-subtle);
  border-radius: 999px;
}

progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
  transition: width 200ms var(--ease);
}

progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 999px;
}

#progress-text {
  margin-top: 6px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.progress-actions {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.progress-actions .btn {
  flex: 1;
}

/* ---- Prompt (unmissable) ---- */
#prompt-area {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow);
  animation: prompt-in var(--dur) var(--ease);
}

#prompt-area.hidden {
  display: none !important;
}

@keyframes prompt-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

#prompt-text {
  font-weight: 650;
  font-size: var(--text-md);
  margin-bottom: var(--space-1);
}

#prompt-warn {
  color: var(--warn);
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}

#prompt-warn.hidden {
  display: none !important;
}

.prompt-actions {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

#memory-warning {
  margin-top: var(--space-2);
  padding: 12px;
  background: rgba(212, 160, 23, 0.12);
  color: var(--warn);
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  border: 1px solid rgba(212, 160, 23, 0.35);
}

#download-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: var(--space-2);
}

#download-area:not(:empty)::before {
  content: "This session";
  margin: 4px 2px 0;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.download-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.download-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.download-side {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.download-name {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 650;
  word-break: break-word;
}

.download-card a,
.download-saved {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-weight: 650;
  text-decoration: none;
}

.download-card a {
  background: var(--accent);
  color: var(--accent-fg);
}

.download-saved {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
}

/* ---- Settings ---- */
.settings-block + .settings-block {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.settings-block h2 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-md);
  font-weight: 650;
}

/* ---- Confirm dialog ---- */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: var(--space-2);
  animation: view-in var(--dur) var(--ease);
}

.dialog-backdrop.hidden {
  display: none !important;
}

.dialog {
  width: min(400px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow);
}

.dialog h2 {
  margin: 0 0 8px;
  font-size: var(--text-lg);
}

.dialog p {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-1);
}

/* ---- Dev Log ---- */
#dev-log {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  z-index: 1000;
  background: #12141a;
  color: #d7dbe3;
  font-family: var(--font-mono);
  font-size: 12px;
  border-top: 1px solid #2a2f38;
  transition: width var(--dur) var(--ease);
}

/* Tucked to the corner: only the < tab stays */
#dev-log.is-docked {
  left: auto;
  width: 36px;
}

#dev-log.is-docked #dev-log-toggle,
#dev-log.is-docked #dev-log-panel {
  display: none !important;
}

#dev-log-bar {
  display: flex;
  align-items: stretch;
}

@media (max-width: 859px) {
  #dev-log {
    bottom: calc(var(--chrome-bottom-nav) + var(--chrome-safe) + 4px);
  }
}

#dev-log-toggle {
  margin: 0;
  flex: 1;
  min-width: 0;
  text-align: left;
  background: #1a1d23;
  color: #e8eaed;
  border: none;
  border-radius: 0;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 650;
  font-family: var(--font);
  cursor: pointer;
  min-height: 36px;
}

#dev-log-dock {
  flex: 0 0 36px;
  width: 36px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  border-left: 1px solid #2a2f38;
  background: #1a1d23;
  color: #e8eaed;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
}

#dev-log.is-docked #dev-log-dock {
  border-left: none;
  width: 36px;
  flex-basis: 36px;
}

#dev-log-panel {
  display: none;
  flex-direction: column;
  max-height: 220px;
  padding: 0 8px 8px;
}

#dev-log-panel.is-open {
  display: flex !important;
}

#dev-log-stats {
  padding: 6px 4px;
  color: #8eb6d9;
  border-bottom: 1px solid #2a2f38;
  font-variant-numeric: tabular-nums;
}

#dev-log-entries {
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
  max-height: 140px;
  padding: 4px;
}

#dev-log-entries .info { color: #c8ced8; }
#dev-log-entries .warn { color: #e0c36a; }
#dev-log-entries .error { color: #e06c75; }

#dev-log-actions {
  display: flex;
  gap: 8px;
}

#dev-log-actions button {
  margin-top: 6px;
  padding: 8px 12px;
  min-height: 36px;
  font-size: 12px;
  background: #22262e;
  color: #e8eaed;
  border: 1px solid #3a4150;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
}

.identity-banner {
  display: none;
  margin-bottom: var(--space-2);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(224, 108, 117, 0.4);
  background: rgba(224, 108, 117, 0.1);
  color: var(--danger);
  font-size: var(--text-sm);
}

.identity-banner.is-visible {
  display: block;
}

.mobile-top,
.hint-mobile {
  display: none;
}

/* ---- Phone layout (desktop rules above stay put) ---- */
@media (max-width: 859px) {
  :root {
    --chrome-bottom-nav: 72px;
  }
  .mobile-top {
    display: flex;
    align-items: center;
    min-height: 48px;
    margin: 0 0 4px;
    padding-right: 168px;
  }

  .mobile-top .brand-name {
    font-size: 17px;
  }

  .main {
    padding: 8px 16px calc(var(--chrome-bottom) + 16px);
  }

  body.mobile-pan .main {
    padding-bottom: calc(var(--chrome-bottom) + 46vh);
  }

  .view.is-active {
    min-height: 0;
    flex: 0 0 auto;
  }

  .page-header {
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
    padding-top: 0;
    padding-right: 0;
  }

  .header-meta {
    width: 100%;
    margin-left: 0;
  }

  .page-header h1 {
    font-size: 22px;
  }

  .page-sub {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.35;
  }

  .corner-chrome {
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: 12px;
  }

  .panel {
    padding: 16px;
    border-radius: 16px;
  }

  .panel + .panel {
    margin-top: 12px;
  }

  .panel-title {
    margin-bottom: 12px;
    font-size: 11px;
  }

  .profile-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 12px;
  }

  .profile-meta {
    overflow: hidden;
  }

  .profile-id {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
  }

  #copy-code-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 0;
    gap: 0;
  }

  .share-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .share-row > .mono-box {
    grid-column: 1 / -1;
    min-height: 48px;
  }

  .share-row > .btn {
    width: 100%;
    min-height: 48px;
    flex: none;
  }

  .muted {
    line-height: 1.4;
  }

  input[type="text"],
input[type="password"],
  select,
  .btn-block {
    min-height: 48px;
    font-size: 16px;
  }

  #qrcode.is-visible {
    margin-left: auto;
    margin-right: auto;
  }

  .hint-desktop {
    display: none;
  }

  .hint-mobile {
    display: inline;
  }

  #drop-zone {
    padding: 20px 16px;
  }

  #file-input {
    max-width: none;
    font-size: 16px;
  }

  .prompt-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .prompt-actions .btn {
    min-height: 48px;
  }

  .dialog {
    border-radius: 16px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .btn {
    width: 100%;
    min-height: 48px;
  }

  .bottom-nav {
    padding: 6px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
    backdrop-filter: blur(16px);
  }

  .bottom-nav .nav-item {
    min-height: 52px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 650;
    gap: 3px;
  }

  .bottom-nav .nav-item.is-active {
    background: var(--accent-muted);
    color: var(--accent);
  }

  .bottom-nav .tag-soon {
    margin-left: 3px;
    padding: 0;
    border: none;
    font-size: 8px;
    letter-spacing: 0.04em;
    line-height: 1;
  }

  .bottom-nav .nav-label {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    white-space: nowrap;
  }
}

.avatar img,
.mini-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.mini-avatar {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.avatar img[hidden],
.mini-avatar[hidden] {
  display: none;
}

.prompt-who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 650;
}

.prompt-who .peer-icon-phone,
.prompt-who .peer-icon-pc {
  display: none;
}

.prompt-who[data-device="phone"] .peer-icon-phone,
.prompt-who[data-device="pc"] .peer-icon-pc {
  display: block;
}

html.needs-welcome #welcome {
  display: grid;
}

.welcome {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1400;
  place-items: center;
  padding: 20px;
  background: rgba(6, 7, 9, 0.72);
}

.welcome-card {
  width: min(440px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px 22px;
  box-shadow: var(--shadow);
}

.welcome-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  margin-bottom: 12px;
}

.welcome-card h2 {
  margin: 0 0 6px;
}

#welcome-lead {
  margin: 0 0 8px;
  color: var(--text);
}

.welcome-error {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: var(--text-sm);
}

.welcome-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.welcome-actions .btn {
  flex: 1;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.avatar-choice {
  aspect-ratio: 1;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--bg-subtle);
  overflow: hidden;
  cursor: pointer;
}

.avatar-choice img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-choice.is-selected {
  border-color: var(--accent);
}

#welcome-grid {
  max-height: min(46vh, 420px);
  overflow: auto;
  padding-right: 4px;
}

#settings-avatar-grid {
  max-height: 280px;
  overflow: auto;
}

#view-about.is-active {
  height: auto;
  overflow: visible;
}

.main:has(#view-about.is-active) {
  overflow-x: hidden;
  overflow-y: auto;
}

#view-about .about-panel {
  max-width: 720px;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-row progress {
  flex: 1;
  min-width: 0;
  width: auto;
}

.progress-row #progress-text {
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

.progress-actions .btn {
  flex: 0 0 auto;
  min-width: 112px;
}

a.btn {
  text-decoration: none;
}

.tip-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  width: min(720px, 100%);
  height: 280px;
  margin-top: 16px;
  pointer-events: none;
}

.tip-art {
  position: relative;
  order: 2;
  right: auto;
  bottom: auto;
  height: 100%;
  width: auto;
  max-width: 42%;
  margin-left: auto;
  object-fit: contain;
  object-position: right bottom;
  pointer-events: none;
}

.tip-copy {
  position: relative;
  order: 1;
  left: auto;
  top: auto;
  align-self: center;
  width: min(240px, 56%);
  padding: 12px 12px 14px;
  text-align: left;
  pointer-events: auto;
  color: #1a1e24;
  background: #f3efe6;
  border-radius: 16px;
}

.tip-copy::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 26px;
  border-width: 7px 0 7px 8px;
  border-style: solid;
  border-color: transparent transparent transparent #f3efe6;
}

.tip-copy h2,
.tip-copy p,
#tip-raised {
  color: #1a1e24;
}

.tip-track {
  height: 8px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: rgba(26, 30, 36, 0.16);
  overflow: hidden;
}

#tip-fill {
  height: 100%;
  width: 0%;
  background: #1a1e24;
}

@media (max-width: 859px) {
  .tip-stage {
    height: 260px;
    width: 100%;
  }

  .tip-copy {
    width: min(190px, 54%);
  }
}

.friend-add {
  display: flex;
  gap: 8px;
  align-items: center;
}

.friend-add input {
  flex: 1;
  min-width: 0;
}

.friend-hint:not(.hidden) {
  margin-top: 8px;
  color: var(--warn);
}

.friend-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.friend-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.friend-open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.friend-open:hover {
  background: var(--bg-hover);
}

.friend-letter {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.friend-name {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-note:empty {
  display: none;
}

.friend-note {
  color: var(--text-faint);
  font-size: 12px;
  white-space: nowrap;
}

.friend-go {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
}

.friend-remove {
  border: none;
  background: transparent;
  color: var(--text-faint);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
}

.friend-row .peer-online-dot,
.friend-row .peer-device {
  display: none;
}

.friend-row.is-online .status-dot.peer-online-dot {
  display: inline-block;
}

.friend-row[data-device="phone"] .peer-device,
.friend-row[data-device="pc"] .peer-device {
  display: grid;
}

.friend-row .peer-icon-phone,
.friend-row .peer-icon-pc {
  display: none;
}

.friend-row[data-device="phone"] .peer-icon-phone,
.friend-row[data-device="pc"] .peer-icon-pc {
  display: block;
}

@media (max-width: 520px) {
  .friend-add {
    flex-direction: column;
    align-items: stretch;
  }
}

.pfp {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
}

.pfp img,
.pfp .pfp-letter {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  grid-area: 1 / 1;
}

.pfp .pfp-letter {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.pfp img[hidden],
.pfp .pfp-letter[hidden] {
  display: none;
}

.pfp > .status-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  z-index: 1;
  width: 9px;
  height: 9px;
  box-shadow: 0 0 0 2px var(--bg-subtle);
}

.avatar.pfp {
  width: 40px;
  height: 40px;
}

.pfp[data-frame="ring"] img,
.pfp[data-frame="ring"] .pfp-letter,
.frame-choice[data-frame="ring"] .frame-swatch {
  box-shadow: 0 0 0 2px #7dbea0;
}

.pfp[data-frame="gold"] img,
.pfp[data-frame="gold"] .pfp-letter,
.frame-choice[data-frame="gold"] .frame-swatch {
  box-shadow: 0 0 0 2px #e6c36a;
}

.pfp[data-frame="glow"] img,
.pfp[data-frame="glow"] .pfp-letter,
.frame-choice[data-frame="glow"] .frame-swatch {
  box-shadow: 0 0 0 2px #b794f6, 0 0 10px #b794f6;
}

.pfp[data-frame="dash"] img,
.pfp[data-frame="dash"] .pfp-letter,
.frame-choice[data-frame="dash"] .frame-swatch {
  outline: 2px dashed #f4f1ea;
  outline-offset: 2px;
}

.frame-row,
.banner-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px;
}

.frame-choice,
.banner-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 72px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: inherit;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.frame-choice.is-selected,
.banner-choice.is-selected {
  border-color: var(--accent);
}

.frame-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #7f8ea3;
}

.banner-choice img {
  width: 108px;
  height: 42px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

label.btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

.friend-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-subtle) 72%, transparent);
}

.friend-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.friend-banner {
  height: 140px;
  background: #243044 center / cover no-repeat;
}

.friend-card .friend-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  padding: 4px 10px;
}

.friend-body {
  display: flex;
  padding: 0 12px 12px;
  margin-top: -30px;
}

.friend-card .friend-open {
  width: 100%;
  align-items: flex-end;
  gap: 12px;
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.friend-card .friend-open:hover {
  background: transparent;
}

.friend-card .pfp {
  width: 68px;
  height: 68px;
  border: 3px solid var(--bg-elevated);
  background: var(--bg-elevated);
}

.friend-card .pfp .pfp-letter {
  font-size: 22px;
}

.friend-copy {
  min-width: 0;
  flex: 1;
  padding-bottom: 6px;
}

.friend-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.friend-card .peer-online-dot,
.friend-card .peer-device {
  display: none;
}

.friend-card.is-online .status-dot.peer-online-dot {
  display: block;
}

.friend-card[data-device="phone"] .peer-device,
.friend-card[data-device="pc"] .peer-device {
  display: grid;
}

.friend-card .peer-icon-phone,
.friend-card .peer-icon-pc {
  display: none;
}

.friend-card[data-device="phone"] .peer-icon-phone,
.friend-card[data-device="pc"] .peer-icon-pc {
  display: block;
}

button.header-you {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 236px;
  height: 82px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #243044;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.you-banner {
  position: absolute;
  inset: 0;
  background: #243044 center / cover no-repeat;
}

.you-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7, 8, 11, 0.78), rgba(7, 8, 11, 0.12));
}

.header-you .pfp,
.header-you .you-id,
.profile-hero-foot {
  position: relative;
  z-index: 1;
}

.you-id {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #fff;
}

#header-name,
#profile-hero-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-hero {
  position: relative;
  height: 180px;
  margin-bottom: 18px;
  border-radius: 16px;
  overflow: hidden;
  background: #243044;
}

.profile-hero-foot {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.profile-hero .pfp {
  width: 76px;
  height: 76px;
  border: 3px solid var(--bg-elevated);
  background: var(--bg-elevated);
}

.profile-hero .you-id {
  padding-bottom: 8px;
  font-size: 22px;
  font-weight: 700;
}

.profile-hero .peer-icon-phone,
.profile-hero .peer-icon-pc {
  display: none;
}

.profile-hero[data-device="phone"] .peer-icon-phone,
.profile-hero[data-device="pc"] .peer-icon-pc {
  display: block;
}

@media (max-width: 859px) {
  button.header-you {
    width: min(210px, 58vw);
    height: 72px;
  }
}

.update-note {
  position: fixed;
  left: 16px;
  bottom: 56px;
  z-index: 1200;
  width: min(320px, calc(100% - 32px));
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow);
}

.update-note[hidden] {
  display: none;
}

.update-note-kicker {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#update-note-copy {
  margin: 0 0 12px;
  line-height: 1.4;
}

.update-note .btn {
  width: 100%;
}

@media (max-width: 859px) {
  .update-note {
    bottom: 84px;
  }
}

.session-profiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.session-profiles.hidden {
  display: none;
}

.session-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  min-height: 176px;
}

.session-banner {
  height: 112px;
  background-color: #242424;
  background-size: cover;
  background-position: center;
}

.session-foot {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: -32px;
  padding: 0 12px 14px;
}

.session-card .pfp {
  width: 72px;
  height: 72px;
  border: 3px solid var(--surface);
  box-sizing: content-box;
}

.session-kicker {
  display: block;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.session-id {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.session-name {
  font-size: 16px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-requests {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.friend-request {
  display: flex;
  align-items: center;
  gap: 8px;
}

.friend-request-name {
  flex: 1;
  min-width: 0;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  margin-left: 8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #c45c5c;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

@media (max-width: 859px) {
  .session-profiles {
    grid-template-columns: 1fr;
  }
}

.friend-toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(320px, calc(100% - 32px));
  pointer-events: none;
}

.friend-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow);
}

.friend-toast p {
  margin: 0;
  flex: 1;
  line-height: 1.4;
}

.friend-toast-x {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

@media (max-width: 859px) {
  .friend-toasts {
    top: auto;
    right: 16px;
    bottom: 148px;
    left: 16px;
  }
}

.welcome-card .field-label {
  margin-top: 12px;
}

#welcome-switch {
  margin-top: 8px;
}

.account-row {
  margin: 0 0 6px;
}
