.reader-sync-ui {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + var(--reader-sync-viewport-bottom, 0px));
  z-index: 2147483000;
  color: #2f291f;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.reader-sync-ui__toggle {
  min-width: 58px;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid rgba(67, 48, 28, .25);
  border-radius: 999px;
  background: #fffaf0;
  color: #49351f;
  box-shadow: 0 5px 18px rgba(44, 30, 18, .22);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.reader-sync-ui__panel {
  box-sizing: border-box;
  position: absolute;
  right: 0;
  bottom: 52px;
  width: min(360px, calc(100vw - 28px));
  max-height: min(680px, calc(var(--reader-sync-viewport-height, 100vh) - 90px));
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(67, 48, 28, .24);
  border-radius: 18px;
  background: #fffdf8;
  box-shadow: 0 16px 44px rgba(36, 25, 16, .28);
}

.reader-sync-ui__panel[hidden],
.reader-sync-ui__section[hidden] {
  display: none !important;
}

.reader-sync-ui__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reader-sync-ui__header h2,
.reader-sync-ui__section h3 {
  margin: 0;
  color: #3d2e1d;
  font-size: 1rem;
}

.reader-sync-ui__close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #eee5d7;
  color: #49351f;
  font: inherit;
  font-size: 1.3rem;
  cursor: pointer;
}

.reader-sync-ui__status {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f2ebdf;
  font-size: .88rem;
  font-weight: 700;
}

.reader-sync-ui__last-sync {
  margin: -4px 0 12px;
  color: #675a49;
  font-size: .82rem;
  font-weight: 700;
}

.reader-sync-ui[data-phase="synced"] .reader-sync-ui__status {
  background: #e3f3e7;
  color: #245d35;
}

.reader-sync-ui[data-phase="error"] .reader-sync-ui__status,
.reader-sync-ui[data-phase="expired"] .reader-sync-ui__status {
  background: #fae4e2;
  color: #7a2d27;
}

.reader-sync-ui__section {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.reader-sync-ui__section p {
  margin: 0;
  font-size: .84rem;
  line-height: 1.55;
}

.reader-sync-ui__section label {
  display: grid;
  gap: 5px;
  font-size: .82rem;
  font-weight: 700;
}

.reader-sync-ui__section input {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #bcae9b;
  border-radius: 9px;
  background: #fff;
  color: #2f291f;
  font: inherit;
}

.reader-sync-ui__section button {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.reader-sync-ui__section button:disabled {
  cursor: wait;
  opacity: .62;
}

.reader-sync-ui__primary {
  border: 1px solid #73522d;
  background: #73522d;
  color: #fff;
}

.reader-sync-ui__secondary {
  border: 1px solid #a9977e;
  background: #fff;
  color: #49351f;
}

.reader-sync-ui__danger-link {
  border: 0;
  background: transparent;
  color: #8a2e2b;
  text-decoration: underline;
}

.reader-sync-ui__danger {
  border: 1px solid #9c2e2a;
  background: #9c2e2a;
  color: #fff;
}

.reader-sync-ui__choice,
.reader-sync-ui__delete {
  padding: 12px;
  border: 1px solid #d6c5aa;
  border-radius: 12px;
  background: #fff8e9;
}

.reader-sync-ui__note {
  color: #675a49;
}

.reader-sync-ui__settings-entry {
  display: grid;
}

.reader-sync-ui__settings-status,
.reader-sync-ui__settings-last-sync {
  margin: 6px 0 0;
  color: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.reader-sync-ui__settings-status {
  font-weight: 800;
}

.reader-sync-ui[data-has-settings-entry="true"] .reader-sync-ui__toggle,
.reader-sync-ui[data-has-guide-settings-entry="true"] .reader-sync-ui__toggle {
  display: none;
}

.reader-sync-ui__guide-settings-trigger {
  display: grid !important;
  gap: 3px;
}

.reader-sync-ui__guide-settings-trigger strong,
.reader-sync-ui__guide-settings-trigger span,
.reader-sync-ui__guide-settings-trigger small {
  display: block;
  color: inherit;
  -webkit-text-fill-color: currentColor;
}

.reader-sync-ui__guide-settings-trigger strong {
  font-size: 16px;
}

.reader-sync-ui__guide-settings-trigger span {
  font-size: 14px;
  font-weight: 800;
}

.reader-sync-ui__guide-settings-trigger small {
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 560px) {
  .reader-sync-ui__panel {
    position: fixed;
    top: auto;
    right: max(14px, env(safe-area-inset-right));
    bottom: 68px;
    left: max(14px, env(safe-area-inset-left));
    width: auto;
    max-height: calc(100vh - 96px);
    max-height: calc(100dvh - 96px);
  }

  .reader-sync-ui[data-has-settings-entry="true"] .reader-sync-ui__toggle {
    display: none;
  }

  .reader-sync-ui__settings-entry {
    display: grid;
  }

  .settingsPanel.mobileBottomSheet .settingsInline .reader-sync-ui__settings-trigger {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }

  .reader-sync-ui[data-has-settings-entry="true"] .reader-sync-ui__panel {
    bottom: calc(max(14px, env(safe-area-inset-bottom)) + var(--reader-sync-viewport-bottom, 0px));
    max-height: calc(100vh - 28px);
    max-height: calc(100dvh - 28px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reader-sync-ui * {
    scroll-behavior: auto !important;
  }
}

/* 20260731 tablet sync placement fix:
   move the collapsed control away from the tablet reader's Next/settings buttons. */
@media (min-width:561px) and (max-width:900px){
  .reader-sync-ui{
    top:max(14px, env(safe-area-inset-top));
    right:max(14px, env(safe-area-inset-right));
    bottom:auto;
  }
  .reader-sync-ui__panel{
    top:52px;
    right:0;
    bottom:auto;
    max-height:calc(100dvh - 84px);
  }
}

/* Keep iPhone input readable without automatic focus zoom. */
.reader-sync-ui__section input { font-size: 16px; }
.reader-sync-ui__input-help { color: #675a49; font-size: .82rem; }
.reader-sync-ui__input-help summary { cursor: pointer; padding: 4px 0; }
.reader-sync-ui__input-help p { margin-top: 6px; }
@media (max-width: 560px) {
  .reader-sync-ui__panel {
    bottom: calc(max(68px, env(safe-area-inset-bottom) + 54px) + var(--reader-sync-viewport-bottom, 0px));
    max-height: calc(var(--reader-sync-viewport-height, 100dvh) - 82px);
  }
  .reader-sync-ui[data-has-settings-entry="true"] .reader-sync-ui__panel,
  .reader-sync-ui[data-has-guide-settings-entry="true"] .reader-sync-ui__panel {
    bottom: calc(max(14px, env(safe-area-inset-bottom)) + var(--reader-sync-viewport-bottom, 0px));
    max-height: calc(var(--reader-sync-viewport-height, 100dvh) - 28px);
  }
}
