/* ==========================================================================
   MyClipCloud — signed-in app + admin
   ========================================================================== */

.app-body {
  min-height: 100dvh;
}

.app-shell {
  display: grid;
  min-height: 100dvh;
}

@media (min-width: 900px) {
  .app-shell {
    grid-template-columns: 252px minmax(0, 1fr);
  }
}

/* ---------- Sidebar ---------- */
.sidebar {
  display: none;
}

@media (min-width: 900px) {
  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-5);
    height: 100dvh;
    padding: var(--s-5) var(--s-4);
    border-right: 1px solid var(--border);
    background: var(--surface);
  }
}

.sidebar .brand {
  padding: 0 var(--s-2);
}

.side-nav {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.side-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.side-nav__link .icon {
  color: var(--muted);
  transition: color var(--t-fast) var(--ease-out);
}

.side-nav__link:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.side-nav__link[aria-current="page"] {
  color: var(--purple-deep);
  background: var(--purple-50);
  font-weight: 600;
}

.side-nav__link[aria-current="page"] .icon {
  color: var(--purple);
}

.side-nav__link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gradient);
  animation: indicator-in var(--t-base) var(--ease-out);
}

@keyframes indicator-in {
  from {
    transform: scaleY(0.3);
    opacity: 0;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .side-nav__link[aria-current="page"] {
    color: #d4cbff;
  }
}

.side-nav__label {
  margin: var(--s-4) 0 var(--s-2);
  padding: 0 0.75rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar__foot {
  margin-top: auto;
  display: grid;
  gap: var(--s-3);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border);
}

/* Signed-out MyNotes: notes live in this browser; invite to sign in. */
.sidebar__foot--guest {
  gap: var(--s-2);
}

.sidebar__foot--guest p {
  margin: 0 0 var(--s-1);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
  padding: 0 var(--s-2);
}

.user-chip__text {
  min-width: 0;
  line-height: 1.3;
}

.user-chip__name {
  display: block;
  overflow: hidden;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip__email {
  display: block;
  overflow: hidden;
  font-size: var(--fs-xs);
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--lg {
  width: 64px;
  height: 64px;
  font-size: var(--fs-lg);
}

/* ---------- Main column ---------- */
.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 60px;
  padding: var(--s-2) var(--gutter);
  padding-top: calc(var(--s-2) + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--canvas) 85%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
}

.topbar__brand {
  display: inline-flex;
}

.topbar__brand .brand__mark {
  width: 30px;
  height: 30px;
}

@media (min-width: 900px) {
  .topbar__brand {
    display: none;
  }
}

.topbar__title {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar__end {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
}

.device-chip {
  display: none;
  align-items: center;
  gap: 0.35rem;
  max-width: 220px;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .device-chip {
    display: inline-flex;
  }
}

/* Sync status pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 32px;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  transition: border-color var(--t-base) var(--ease-out), background-color var(--t-base) var(--ease-out);
}

.status-pill__dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status-pill[data-state="synced"] .status-pill__dot {
  background: #12b76a;
}

.status-pill[data-state="syncing"] .status-pill__dot,
.status-pill[data-state="connecting"] .status-pill__dot {
  background: var(--purple);
}

.status-pill[data-state="syncing"] .status-pill__dot::after,
.status-pill[data-state="connecting"] .status-pill__dot::after,
.status-pill[data-state="reconnecting"] .status-pill__dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  color: inherit;
  opacity: 0.5;
  animation: pulse 1.2s var(--ease-out) infinite;
}

.status-pill[data-state="reconnecting"] .status-pill__dot,
.status-pill[data-state="paused"] .status-pill__dot {
  background: #f79009;
}

.status-pill[data-state="offline"] .status-pill__dot,
.status-pill[data-state="error"] .status-pill__dot,
.status-pill[data-state="expired"] .status-pill__dot {
  background: #f04438;
}

.status-pill[data-state="offline"],
.status-pill[data-state="error"],
.status-pill[data-state="expired"] {
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  background: var(--danger-bg);
  color: var(--danger);
}

@keyframes pulse {
  from {
    transform: scale(0.6);
    opacity: 0.6;
  }
  to {
    transform: scale(1.4);
    opacity: 0;
  }
}

.app-content {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--s-5) var(--gutter) var(--s-8);
}

@media (max-width: 899px) {
  .app-content {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}

.page-head h1 {
  margin: 0;
  font-size: var(--fs-2xl);
}

.page-head p {
  margin: var(--s-2) 0 0;
  color: var(--muted);
}

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
}

@media (min-width: 900px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav a {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 52px;
  padding: 6px 4px;
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  text-decoration: none;
  transition: color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}

.bottom-nav a .icon {
  width: 22px;
  height: 22px;
}

.bottom-nav a[aria-current="page"] {
  color: var(--purple-deep);
  background: var(--purple-50);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bottom-nav a[aria-current="page"] {
    color: #d4cbff;
  }
}

/* ---------- Banners ---------- */
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-4);
  margin-bottom: var(--s-5);
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--purple-100);
  border-radius: var(--r-xl);
  background: linear-gradient(120deg, var(--purple-50), var(--sky-50));
}

.banner > .icon {
  width: 24px;
  height: 24px;
  color: var(--purple);
}

.banner__text {
  flex: 1 1 260px;
  font-size: var(--fs-sm);
}

.banner__text strong {
  display: block;
  font-size: var(--fs-base);
}

.banner--warning {
  border-color: color-mix(in srgb, var(--warning) 30%, transparent);
  background: var(--warning-bg);
}

.banner--warning > .icon {
  color: var(--warning);
}

/* ---------- Dashboard ---------- */
.dash-grid {
  display: grid;
  gap: var(--s-5);
}

@media (min-width: 1100px) {
  .dash-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    align-items: start;
  }

  .dash-grid > .dash-main {
    display: grid;
    gap: var(--s-5);
  }
}

@media (min-width: 900px) and (max-width: 1099px) {
  .dash-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dash-grid > .dash-main {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-5);
  }
}

@media (max-width: 1099px) {
  .dash-main {
    display: grid;
    gap: var(--s-5);
  }
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.card-head h2 {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: 0;
  font-size: var(--fs-md);
}

.card-head h2 .icon {
  color: var(--purple);
}

.latest-card {
  overflow: hidden;
}

.latest-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--gradient);
}

.clip-content {
  max-height: 280px;
  margin: 0;
  padding: var(--s-4);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  user-select: text;
}

.clip-content.is-new {
  animation: clip-arrive 600ms var(--ease-out);
}

@keyframes clip-arrive {
  0% {
    background: var(--purple-100);
    transform: translateY(4px);
  }
  100% {
    background: var(--surface-2);
    transform: none;
  }
}

.clip-content a {
  word-break: break-all;
}

.clip-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-4);
  margin: var(--s-3) 0 0;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.clip-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.clip-meta .icon {
  width: 14px;
  height: 14px;
}

.clip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.capture-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}

.capture-row__state {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 600;
}

.capture-row__state .icon {
  color: var(--muted);
}

.capture-row[data-active="true"] .capture-row__state .icon {
  color: var(--success);
}

.scratch {
  min-height: 180px;
  font-size: var(--fs-base);
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.editor-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-2);
  margin-top: var(--s-3);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.counter[data-over="true"] {
  color: var(--danger);
  font-weight: 600;
}

/* ---------- Item list (history / recent) ---------- */
.item-list {
  display: grid;
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--s-3);
  align-items: start;
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-base) var(--ease-out);
}

.item:hover {
  border-color: var(--purple-200);
}

.item.is-new {
  animation: item-in var(--t-panel) var(--ease-out);
}

.item.is-pending {
  opacity: 0.7;
}

.item.is-leaving {
  animation: item-out var(--t-base) ease-in forwards;
}

@keyframes item-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes item-out {
  to {
    opacity: 0;
    transform: translateX(8px);
  }
}

.item__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--purple-50);
  color: var(--purple);
}

.item__icon--link {
  background: var(--sky-50);
  color: #0284c7;
}

.item__icon .icon {
  width: 18px;
  height: 18px;
}

.item__body {
  min-width: 0;
}

.item__text {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: var(--fs-sm);
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-3);
  margin-top: var(--s-1);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.item__actions {
  display: flex;
  gap: 2px;
}

.item__actions .btn[aria-pressed="true"] {
  color: var(--purple);
}

@media (max-width: 520px) {
  .item {
    grid-template-columns: minmax(0, 1fr);
  }

  .item__icon {
    display: none;
  }

  .item__actions {
    justify-content: flex-end;
  }
}

/* ---------- Toolbar / filters ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.search {
  position: relative;
  flex: 1 1 260px;
}

.search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search .input {
  padding-left: 2.4rem;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.segmented button {
  min-height: 36px;
  padding: 0.3rem 0.8rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-1);
}

.segmented button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* ---------- Settings rows ---------- */
.settings-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.setting {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-5);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--border);
}

.setting:first-child {
  padding-top: 0;
}

.setting:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.setting__text {
  min-width: 0;
}

.setting__title {
  display: block;
  margin-bottom: 2px;
  font-weight: 600;
}

.setting__desc {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  border: 0;
}

.radio-chip {
  position: relative;
}

.radio-chip input {
  position: absolute;
  z-index: 1;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.radio-chip span {
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: all var(--t-fast) var(--ease-out);
}

.radio-chip input:checked + span {
  border-color: var(--purple);
  background: var(--purple-50);
  color: var(--purple-deep);
  font-weight: 600;
}

.radio-chip input:focus-visible + span {
  box-shadow: var(--ring);
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--surface-2);
}

.meter__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--gradient);
  transition: width var(--t-panel) var(--ease-out);
}

/* ---------- Device rows ---------- */
.device-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-4);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.device-row__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-2);
}

.device-row.is-current .device-row__icon {
  background: var(--purple-50);
  color: var(--purple);
}

.device-row__body {
  flex: 1 1 220px;
  min-width: 0;
}

.device-row__name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin: 0;
  font-weight: 600;
}

.device-row__meta {
  margin: 2px 0 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.device-row__actions {
  display: flex;
  gap: var(--s-2);
}

.rename-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.rename-form .input {
  flex: 1 1 200px;
  min-height: 40px;
}

/* ---------- Activity ---------- */
.activity {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity li {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}

.activity li:last-child {
  border-bottom: 0;
}

.activity .icon {
  margin-top: 2px;
  color: var(--muted);
}

.activity time {
  display: block;
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* ---------- Empty, loading ---------- */
.empty-state {
  display: grid;
  justify-items: center;
  gap: var(--s-2);
  padding: var(--s-6) var(--s-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  color: var(--muted);
  text-align: center;
  font-size: var(--fs-sm);
}

.empty-state .icon {
  width: 28px;
  height: 28px;
  color: var(--purple-200);
}

.empty-state strong {
  color: var(--ink);
  font-size: var(--fs-base);
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

.skeleton--line {
  height: 14px;
  margin-bottom: var(--s-2);
}

.skeleton--block {
  height: 120px;
}

.skeleton--row {
  height: 64px;
  margin-bottom: var(--s-2);
}

/* ---------- Danger zone ---------- */
.danger-zone {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
}

.danger-zone h2 {
  color: var(--danger);
}

/* ---------- Manual copy dialog ---------- */
.manual-copy {
  width: 100%;
  min-height: 160px;
  font-size: var(--fs-sm);
}

/* ---------- Onboarding ---------- */
.onboard-list {
  display: grid;
  gap: var(--s-3);
  margin: var(--s-4) 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
}

.onboard-list li {
  display: flex;
  gap: var(--s-3);
}

.onboard-list .icon {
  margin-top: 2px;
  flex: none;
}

.onboard-list .ok {
  color: var(--success);
}

.onboard-list .no {
  color: var(--warning);
}

.consent-box {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--purple-100);
  border-radius: var(--r-md);
  background: var(--purple-50);
  font-size: var(--fs-sm);
}

.consent-box input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--purple);
  flex: none;
}

/* ---------- Admin ---------- */
.stat-grid {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: var(--s-6);
}

.stat {
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.stat__label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat__value {
  margin-top: var(--s-1);
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat__hint {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.admin-form {
  display: grid;
  gap: var(--s-4);
}

.admin-form .textarea--code {
  min-height: 420px;
  font-family: var(--mono);
  font-size: var(--fs-sm);
}

.form-row {
  display: grid;
  gap: var(--s-4);
}

@media (min-width: 720px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.inline-form {
  display: inline;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

/* Admin: compact section strip on phones (the sidebar covers desktop) */
.topbar--admin {
  flex-wrap: wrap;
}

.admin-compact-nav {
  display: flex;
  order: 3;
  width: 100%;
  gap: var(--s-1);
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.admin-compact-nav a {
  flex: none;
}

.admin-compact-nav a[aria-current="page"],
.segmented a[aria-current="page"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

@media (min-width: 900px) {
  .admin-compact-nav {
    display: none;
  }
}

.h3 {
  font-size: var(--fs-lg);
  margin-top: var(--s-5);
}

/* Password forms read better at a comfortable width than stretched across the card. */
[data-password-form] {
  max-width: 480px;
}

/* ---------- Photos and files ---------- */
.clip-image {
  margin: 0;
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-align: center;
}

.clip-image__img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  margin: 0 auto;
  border-radius: var(--r-sm);
  object-fit: contain;
}

.clip-image figcaption {
  margin-top: var(--s-2);
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-file {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.clip-file > .icon {
  flex: none;
  width: 36px;
  height: 36px;
  color: var(--purple);
}

.clip-file > div {
  display: grid;
  min-width: 0;
}

.clip-file__name {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-file__type {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.clip-image.is-new,
.clip-file.is-new {
  animation: clip-arrive 600ms var(--ease-out);
}

.item__thumb {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--purple-50);
  object-fit: cover;
}

[data-file-hint] .icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  color: var(--success);
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: var(--s-4);
  background: rgba(23, 33, 60, 0.45);
  pointer-events: none;
}

.drop-overlay[hidden] {
  display: none;
}

.drop-overlay__box {
  display: grid;
  justify-items: center;
  gap: var(--s-2);
  max-width: 420px;
  padding: var(--s-6) var(--s-5);
  border: 2px dashed var(--purple);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  color: var(--ink);
  text-align: center;
}

.drop-overlay__box .icon {
  width: 36px;
  height: 36px;
  color: var(--purple);
}

.drop-overlay__box span {
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* ---------- "Allow MyClipCloud" banner ---------- */
.perm-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--s-3) var(--s-4);
  margin-bottom: var(--s-5);
  padding: var(--s-4);
  border: 1px solid var(--purple-200);
  border-radius: var(--r-lg);
  background: var(--purple-50);
  color: var(--ink);
}

.perm-banner[hidden] {
  display: none;
}

.perm-banner__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--purple);
  color: var(--white);
}

.perm-banner__text {
  display: grid;
  flex: 1 1 260px;
  gap: var(--s-1);
  min-width: 0;
  font-size: var(--fs-sm);
}

.perm-banner__text strong {
  font-size: var(--fs-base);
}

.perm-banner__list {
  display: grid;
  gap: var(--s-1);
  margin: var(--s-2) 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
}

.perm-banner__list li {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
}

.perm-banner__list .icon {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--purple);
}

.perm-banner__actions {
  display: flex;
  gap: var(--s-2);
  align-self: center;
}

.perm-pointer {
  position: fixed;
  /* Just below the browser's permission box, which hangs from the address bar at the top-left. */
  top: 180px;
  left: clamp(16px, 22vw, 320px);
  max-width: calc(100vw - 32px);
  z-index: 95;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-pill);
  background: var(--purple);
  box-shadow: var(--shadow-3);
  color: var(--white);
  font-size: var(--fs-sm);
  animation: perm-nudge 1s var(--ease-out) infinite alternate;
}

.perm-pointer[hidden] {
  display: none;
}

.perm-pointer span {
  font-size: var(--fs-md);
}

@keyframes perm-nudge {
  to {
    transform: translateY(-6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .perm-pointer {
    animation: none;
  }
}

/* ---------- "Paste & send" bar (phones, browsers without silent clipboard access) ---------- */
.quick-send {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s-4) + env(safe-area-inset-bottom));
  z-index: 85;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: min(520px, calc(100vw - 2 * var(--s-3)));
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4);
  transform: translateX(-50%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-3);
}

.quick-send[hidden] {
  display: none;
}

.quick-send__text {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.quick-send__close {
  padding-inline: var(--s-2);
}

@media (max-width: 899px) {
  .has-bottom-nav .quick-send {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
}

/* ---------- "Send via…" menu ---------- */
.send-via {
  display: grid;
  gap: var(--s-2);
}

.send-via__option {
  justify-content: flex-start;
  width: 100%;
}

.send-via__preview {
  overflow-wrap: anywhere;
}

/* ---------- Nearby (guest mode on the same network) ---------- */
.nearby__wrap {
  display: grid;
  gap: var(--s-5);
  padding-block: var(--s-6) var(--s-8);
}

.nearby__head h1 {
  margin: var(--s-2) 0;
}

.nearby__me {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

/* The name arrives after load; giving it its own line keeps the buttons from jumping. */
.nearby__me > span:first-child {
  flex: 1 0 100%;
}

.nearby__code {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--s-5);
  align-items: start;
}

.nearby__code-value {
  margin: var(--s-3) 0 var(--s-1);
  color: var(--purple-deep);
  font-family: var(--mono);
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.nearby__code-row {
  display: flex;
  gap: var(--s-2);
}

.nearby__code-row .input {
  min-width: 0;
  max-width: 10rem;
  font-family: var(--mono);
  letter-spacing: 0.1em;
}

.nearby__allow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin: var(--s-3) 0 0;
}

.nearby__allow:has([data-allow-clipboard][hidden]) {
  display: none;
}

[data-send-card].is-disabled .editor-toolbar .btn--primary {
  opacity: 0.6;
}

/* ---------- Nearby panel (shared by the home page and /nearby) ---------- */
.nearby__panel {
  display: grid;
  gap: var(--s-4);
}

.nearby__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: var(--s-4);
  align-items: start;
}

.nearby__panel .h-card {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: 0;
  font-size: var(--fs-md);
}

.nearby__panel .h-card .icon {
  color: var(--purple);
}

.nearby__pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(2, 122, 72, 0.45);
  animation: nearby-pulse 1.8s ease-out infinite;
}

@keyframes nearby-pulse {
  70% {
    box-shadow: 0 0 0 8px rgba(2, 122, 72, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(2, 122, 72, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .nearby__pulse {
    animation: none;
  }
}

/* First-visit tip under "This device is called …", pointing up at "Change name".
   Amber (the warning colours, light and dark) so it stands apart from the purple UI. */
.nearby-namehint {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  margin-top: var(--s-2);
  padding: var(--s-4);
  border: 2px solid var(--warning);
  border-radius: var(--r-md);
  background: var(--warning-bg);
  font-size: var(--fs-sm);
  animation: namehint-glow 1.6s ease-in-out infinite;
}

.nearby-namehint__body {
  flex: 1;
}

.nearby-namehint__body p {
  margin: 0 0 var(--s-2);
}

.nearby-namehint__title {
  color: var(--warning);
  font-size: var(--fs-md);
  font-weight: 700;
}

.nearby-namehint__body ul {
  margin: 0 0 var(--s-2);
  padding-left: 1.1rem;
}

.nearby-namehint__body li + li {
  margin-top: var(--s-1);
}

.nearby-namehint__ideas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin: 0 0 var(--s-2);
}

.nearby-namehint__chips {
  display: contents;
}

.nearby-namehint__idea,
.nearby-namehint__shuffle {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--warning);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--warning);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.nearby-namehint__idea:hover,
.nearby-namehint__idea:focus-visible {
  background: var(--warning);
  color: var(--warning-bg);
}

.nearby-namehint__shuffle {
  border-style: dashed;
}

.nearby-namehint__cta {
  margin-top: var(--s-1);
  border-color: var(--warning);
  background: var(--warning);
  color: var(--warning-bg);
}

.nearby-namehint__arrow {
  display: inline-flex;
  color: var(--warning);
  transform: rotate(-90deg);
  animation: namehint-bob 1s ease-in-out infinite;
}

/* The button the tip points at: filled amber and blinking until the device is renamed. */
[data-rename].is-hinted {
  border-color: var(--warning);
  background: var(--warning);
  color: var(--warning-bg);
  animation: namehint-blink 1.2s ease-in-out infinite;
}

@keyframes namehint-bob {
  50% {
    transform: rotate(-90deg) translateX(4px);
  }
}

@keyframes namehint-blink {
  50% {
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--warning) 35%, transparent);
    filter: brightness(1.12);
  }
}

@keyframes namehint-glow {
  50% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 25%, transparent);
  }
}

/* Motion off: no blinking; the colour, border and arrow still carry the message. */
@media (prefers-reduced-motion: reduce) {
  .nearby-namehint,
  .nearby-namehint__arrow,
  [data-rename].is-hinted {
    animation: none;
  }
}

.nearby__code-details > summary {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.nearby__code-details > summary::-webkit-details-marker {
  display: none;
}

.nearby__code-details[open] > summary {
  margin-bottom: var(--s-4);
}

.nearby__code-details > summary .icon {
  color: var(--purple);
}

.nearby-home {
  padding-block: var(--s-6);
}

.nearby-home__head {
  max-width: 720px;
  margin-bottom: var(--s-5);
}

.nearby-home__head h2 {
  margin: var(--s-2) 0;
}

.nearby-home__more {
  margin-top: var(--s-4);
}

/* ---------- Account menu (phones: the sidebar with Sign out is hidden) ---------- */
.account-menu {
  position: relative;
}

@media (min-width: 900px) {
  .account-menu {
    display: none;
  }
}

.account-menu__button {
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  list-style: none;
}

.account-menu__button::-webkit-details-marker {
  display: none;
}

.account-menu__button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.avatar--sm {
  width: 32px;
  height: 32px;
  font-size: var(--fs-xs);
}

.account-menu__panel {
  position: absolute;
  top: calc(100% + var(--s-2));
  right: 0;
  z-index: 80;
  display: grid;
  gap: var(--s-2);
  width: min(280px, calc(100vw - 24px));
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-3);
}

.account-menu__who {
  display: grid;
  gap: 2px;
  padding: var(--s-1) var(--s-2) var(--s-2);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.account-menu__who strong,
.account-menu__who span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu__who span {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.account-menu__panel nav {
  display: grid;
}

.account-menu__panel nav a {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-2);
  border-radius: var(--r-sm);
  color: var(--ink);
  text-decoration: none;
}

.account-menu__panel nav a:hover,
.account-menu__panel nav a:focus-visible {
  background: var(--purple-50);
}

.account-menu__panel nav .icon {
  width: 18px;
  height: 18px;
  color: var(--purple);
}

.account-menu__signout {
  width: 100%;
  min-height: 44px;
  justify-content: center;
  color: var(--danger);
}

/* ---------- Nearby: simple three-step layout ---------- */
.nearby-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-3);
}

.nearby-step__title {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0;
  font-size: var(--fs-lg);
}

.nearby-step__title > .icon {
  color: var(--purple);
}

.nearby-step__num {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--purple);
  color: var(--white);
  font-size: var(--fs-md);
  font-weight: 700;
}

.nearby-step__help {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--fs-base);
}

.nearby-step__help--small {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.nearby-devices {
  display: grid;
  gap: var(--s-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nearby-devices__searching,
.nearby-devices__empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  color: var(--muted);
}

.nearby-devices__searching .nearby__pulse {
  flex: none;
}

.nearby-device {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.nearby-device__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--purple-50);
  color: var(--purple);
}

.nearby-device__icon .icon {
  width: 26px;
  height: 26px;
}

.nearby-device .item__body {
  flex: 1 1 160px;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.nearby-device__name {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: 700;
}

.nearby-device__kind {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.nearby-device__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.nearby-device__actions .btn {
  min-height: 44px;
}

.nearby-status {
  justify-self: start;
  margin-top: var(--s-1);
}

.nearby-status--ok {
  background: var(--success-bg);
  color: var(--success);
}

.nearby-status--wait {
  background: var(--warning-bg);
  color: var(--warning);
}

.nearby-status--paused {
  background: var(--surface-2);
  color: var(--ink-2);
}

.nearby-status--off {
  background: var(--danger-bg);
  color: var(--danger);
}

.nearby-send__box {
  min-height: 120px;
  font-size: var(--fs-md);
}

.nearby-send__box.is-filled {
  animation: nearby-filled 900ms var(--ease-out);
}

@keyframes nearby-filled {
  0% {
    background: var(--purple-100);
  }
}

.nearby-send__status {
  margin: 0;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.nearby-send__status[data-tone="ok"] {
  background: var(--success-bg);
  color: var(--success);
}

.nearby-send__status[data-tone="wait"] {
  background: var(--warning-bg);
  color: var(--warning);
}

.nearby-send__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.nearby-send__actions .btn--primary {
  flex: 1 1 220px;
  justify-content: center;
}

.nearby-drop {
  display: grid;
  justify-items: center;
  gap: var(--s-1);
  width: 100%;
  padding: var(--s-5) var(--s-4);
  border: 2px dashed var(--purple-200);
  border-radius: var(--r-lg);
  background: var(--purple-50);
  color: var(--ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}

.nearby-drop .icon {
  width: 32px;
  height: 32px;
  color: var(--purple);
}

.nearby-drop span {
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.nearby-drop:hover,
.nearby-drop:focus-visible,
.nearby-drop.is-over {
  border-color: var(--purple);
  background: var(--purple-100);
}

.nearby-drop:focus-visible {
  outline: 3px solid var(--purple-200);
  outline-offset: 2px;
}

.nearby-code > summary {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) 0;
  color: var(--purple-deep);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.nearby-code > summary::-webkit-details-marker {
  display: none;
}

.nearby-code[open] > summary {
  margin-bottom: var(--s-3);
}

.nearby-code__step {
  margin: 0 0 var(--s-2);
  font-size: var(--fs-sm);
}

.nearby-ask__who {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--purple-50);
}

.nearby-ask__who .icon {
  width: 28px;
  height: 28px;
  color: var(--purple);
}

.nearby__pulse--inline {
  display: inline-block;
  margin-right: 0.35rem;
  vertical-align: middle;
}

/* ---------- Admin analytics ---------- */
.an-bar-cell {
  width: 45%;
}

.an-bar {
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  appearance: none;
  overflow: hidden;
}

.an-bar::-webkit-progress-bar {
  background: var(--surface-2);
}

.an-bar::-webkit-progress-value {
  border-radius: var(--r-pill);
  background: var(--purple);
}

.an-bar::-moz-progress-bar {
  border-radius: var(--r-pill);
  background: var(--purple);
}

.an-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--s-5);
}

.an-list {
  display: grid;
  gap: var(--s-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.an-list li {
  display: flex;
  justify-content: space-between;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

/* ---------- Nearby: "Change name" dialog ---------- */
dialog.nearby-rename {
  width: min(460px, calc(100vw - 2rem));
}

.nearby-rename__preview {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: var(--s-1) var(--s-3);
  margin: var(--s-4) 0;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: linear-gradient(135deg, color-mix(in srgb, var(--purple) 10%, var(--surface)), var(--surface));
}

.nearby-rename__avatar {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--gradient);
  color: var(--white);
  font-weight: 700;
  font-size: 1.2rem;
  transition: transform var(--t-fast) var(--ease-out);
}

.nearby-rename__who {
  display: grid;
  min-width: 0;
}

.nearby-rename__who strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease-out);
}

.nearby-rename__seen {
  grid-column: 2;
  color: var(--muted);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nearby-rename__input {
  position: relative;
}

.nearby-rename__input .input {
  padding-right: 3.5rem;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}

.nearby-rename__count {
  position: absolute;
  top: 50%;
  right: var(--s-3);
  transform: translateY(-50%);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  transition: color var(--t-fast) var(--ease-out);
}

.nearby-rename__count.is-near {
  color: var(--warning);
}

.nearby-rename__ideas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.nearby-rename__chips {
  display: contents;
}

.nearby-rename__chip,
.nearby-rename__shuffle {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.nearby-rename__chip {
  animation: rename-chip-in 0.32s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.nearby-rename__chip:hover,
.nearby-rename__chip:focus-visible {
  border-color: var(--purple);
  background: color-mix(in srgb, var(--purple) 10%, var(--surface));
  transform: translateY(-1px);
}

.nearby-rename__shuffle.is-rolling span {
  display: inline-block;
  animation: rename-roll 0.45s var(--ease-out);
}

@keyframes rename-chip-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
}

@keyframes rename-roll {
  to {
    transform: rotate(360deg);
  }
}

/* The new name glows briefly after saving. */
[data-me-name].is-renamed {
  animation: rename-flash 1.2s var(--ease-out);
}

@keyframes rename-flash {
  0% {
    background: color-mix(in srgb, var(--purple) 30%, transparent);
    border-radius: 4px;
  }
}
