/* 同步状态与面板：视觉沿用站内的 status-chip，字阶按可读下限走。 */

.sync-mount {
  position: relative;
  display: inline-flex;
}

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  color: var(--ink-soft, #62645a);
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid var(--line-strong, rgba(29, 32, 26, 0.22));
  border-radius: 999px;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
}

.sync-chip:hover {
  color: var(--ink, #1c1f18);
  border-color: var(--accent, #c65e38);
}

.sync-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ink-faint, #86887c);
}

.sync-mount[data-status="synced"] .sync-dot { background: var(--sage, #5f7d63); }
.sync-mount[data-status="error"] .sync-dot { background: #a8322c; }

.sync-mount[data-status="syncing"] .sync-dot,
.sync-mount[data-status="pulling"] .sync-dot {
  background: var(--accent, #c65e38);
  animation: sync-pulse 1.1s ease-in-out infinite;
}

@keyframes sync-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.72); }
}

@media (prefers-reduced-motion: reduce) {
  .sync-mount[data-status="syncing"] .sync-dot,
  .sync-mount[data-status="pulling"] .sync-dot { animation: none; }
}

.sync-pop {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 80;
  width: min(340px, calc(100vw - 32px));
  padding: 12px 14px 13px;
  color: var(--ink-soft, #62645a);
  background: var(--bg, #f8f5ed);
  border: 1px solid var(--line-strong, rgba(29, 32, 26, 0.22));
  border-radius: 4px;
  box-shadow: 0 22px 44px -26px rgba(22, 25, 19, 0.5);
  text-align: left;
  font-family: var(--sans, system-ui, sans-serif);
}

.site-footer .sync-pop {
  top: auto;
  bottom: calc(100% + 9px);
}

/* 手机上贴边会溢出屏幕，改成底部抽屉。
   选择器要盖过 .site-footer .sync-pop 的 bottom: calc(100% + 9px)，所以带上父级。 */
@media (max-width: 680px) {
  .sync-mount .sync-pop,
  .site-footer .sync-pop,
  .topbar-status .sync-pop {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    width: auto;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    box-shadow: 0 -18px 44px -22px rgba(22, 25, 19, 0.55);
  }
}

.sync-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line, rgba(29, 32, 26, 0.13));
}

.sync-status-text {
  color: var(--ink, #1c1f18);
  font-size: 12.5px;
  font-weight: 650;
}

.sync-status-hint {
  color: var(--ink-faint, #86887c);
  font-size: 11px;
  line-height: 1.6;
}

.sync-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 11px;
}

.sync-code-value {
  color: var(--ink, #1c1f18);
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.sync-pop button,
.sync-join button {
  padding: 5px 9px;
  color: var(--ink-soft, #62645a);
  background: transparent;
  border: 1px solid var(--line-strong, rgba(29, 32, 26, 0.22));
  border-radius: 3px;
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}

.sync-pop button:hover,
.sync-join button:hover {
  color: var(--accent-deep, #a84a28);
  border-color: var(--accent, #c65e38);
}

.sync-note {
  margin: 10px 0 0;
  color: var(--ink-faint, #86887c);
  font-size: 11px;
  line-height: 1.7;
}

.sync-join {
  display: grid;
  gap: 6px;
  margin-top: 11px;
  font-size: 11.5px;
}

.sync-join input {
  padding: 6px 8px;
  color: var(--ink, #1c1f18);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line-strong, rgba(29, 32, 26, 0.22));
  border-radius: 3px;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 12px;
}

.sync-list {
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px solid var(--line, rgba(29, 32, 26, 0.13));
}

.sync-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  cursor: pointer;
}

.sync-item input {
  margin: 0;
  accent-color: var(--accent, #c65e38);
}

.sync-item em {
  color: var(--ink-faint, #86887c);
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 10.5px;
  font-style: normal;
  white-space: nowrap;
}
