/* frappe cloud — account button, sign-in / sync dialog and the "two saves" question (js/core/cloud.js).
   Uses the theme tokens and the .g-modal / .g-dialog / .g-btn primitives of game-base.css; classes prefixed cl-. */

.cl-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
}
.cl-host {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}
.cl-host.cl-float {
  position: fixed;
  top: 0.6rem;
  right: 0.8rem;
  z-index: 150;
}

/* header button */
.cl-btn {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: var(--sub);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1;
  position: relative;
  padding: 0.4rem 0.5rem;
  border-radius: 0.5rem;
}
.cl-btn:hover,
.cl-btn:focus-visible {
  color: var(--text);
}
.cl-btn:focus-visible {
  outline: 2px solid var(--main);
  outline-offset: 1px;
}
.cl-ic {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
  flex: none;
}
.cl-signin {
  font-size: 0.78rem;
  white-space: nowrap;
}

/* avatar: Google picture over the initial (the initial shows if the picture cannot load) */
.cl-av {
  position: relative;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: var(--main);
  color: var(--bg);
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  flex: none;
  font-size: 0.8rem;
}
.cl-av b {
  font-weight: 500;
}
.cl-av img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cl-av.big {
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.15rem;
}

/* sync status dot */
.cl-dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--sub);
  flex: none;
}
.cl-btn .cl-dot {
  position: absolute;
  right: 0.3rem;
  bottom: 0.3rem;
  box-shadow: 0 0 0 2px var(--bg);
}
.cl-dot[data-s="synced"] {
  background: var(--g-ok, #5cc46b);
}
.cl-dot[data-s="syncing"] {
  background: var(--main);
  animation: cl-pulse 1s ease-in-out infinite alternate;
}
.cl-dot[data-s="dirty"] {
  background: var(--g-hp-mid, #e8b730);
}
.cl-dot[data-s="paused"],
.cl-dot[data-s="reload"] {
  background: var(--main);
}
.cl-dot[data-s="error"],
.cl-dot[data-s="offline"] {
  background: var(--error);
}
@keyframes cl-pulse {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.35;
  }
}

/* dialogs */
.cl-dialog {
  position: relative;
  max-width: 27rem;
}
.cl-x {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--sub);
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  cursor: pointer;
}
.cl-x:hover,
.cl-x:focus-visible {
  color: var(--text);
  background: var(--sub-alt);
  outline: none;
}
.cl-title {
  margin: 0 2rem 0.75rem 0;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text);
}
.cl-text {
  margin: 0 0 0.75rem;
  line-height: 1.5;
  color: var(--text);
  font-size: 0.92rem;
}
.cl-en {
  display: block;
  margin-top: 0.15rem;
  line-height: 1.4;
}
.cl-muted {
  color: var(--sub);
  font-size: 0.85rem;
}
.cl-msg {
  min-height: 1em;
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--sub);
}
.cl-err,
.cl-msg.cl-err {
  color: var(--error);
}
.cl-gbtn {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  margin: 1rem 0 0.25rem;
}
.cl-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.cl-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cl-who b,
.cl-who span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cl-who b {
  font-weight: 500;
  color: var(--text);
}
.cl-status {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
}
.cl-status .cl-dot {
  vertical-align: 0.05em;
  margin-right: 0.3rem;
}
.cl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.cl-privacy {
  margin: 1rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--sub-alt);
  color: var(--sub);
  font-size: 0.75rem;
  line-height: 1.5;
}
.cl-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--sub);
  text-decoration: underline;
  cursor: pointer;
}
.cl-link:hover,
.cl-link:focus-visible {
  color: var(--text);
}
.cl-link.cl-danger {
  color: var(--error);
}
.cl-link[disabled] {
  opacity: 0.5;
  cursor: default;
}

/* the "two saves" question */
.cl-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0 0 1rem;
}
.cl-side {
  background: var(--sub-alt);
  border-radius: var(--g-radius, 0.75rem);
  padding: 0.7rem 0.8rem;
  min-width: 0;
}
.cl-side-h {
  color: var(--main);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}
.cl-side ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text);
}
.cl-side b {
  font-weight: 500;
}
.cl-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.cl-choices .g-btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}
.cl-choices .g-btn.ghost {
  align-items: center;
}
.cl-choice .cl-en {
  margin-top: 0;
  font-size: 0.75rem;
  color: inherit;
  opacity: 0.75;
}
/* "cloud" / "local" replace one side: the first click arms the button, a second one confirms */
.cl-choice.cl-armed {
  outline: 2px solid var(--error);
  outline-offset: 1px;
}
.cl-confirm {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--error);
}
.cl-confirm[hidden] {
  display: none;
}
.cl-warn {
  display: block;
  margin-top: 0.35rem;
  font-weight: 500;
  color: var(--error);
}
.cl-rec {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 1rem;
  font-size: 0.68rem;
  background: var(--bg);
  color: var(--main);
  vertical-align: middle;
}

@media (max-width: 520px) {
  .cl-signin {
    display: none;
  }
}
@media (max-width: 400px) {
  .cl-sides {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cl-dot[data-s="syncing"] {
    animation: none;
  }
}
