/* Account styles: the top-bar sign-in button and avatar, the small panels, and the Challenge leaderboard. Classes use the ac- prefix. */

.ac-slot { position: relative; display: flex; align-items: center; }
.ac-slot[hidden] { display: none; }

.ac-signin-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px 0 10px;
  border: 1px solid var(--border); border-radius: 12px; background: transparent; color: var(--text-2);
  font: 500 14px/1 var(--font-ui); cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.ac-signin-btn:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); border-color: var(--border-strong); }
.ac-signin-btn:active { transform: scale(0.97); }
.ac-signin-ico { display: inline-flex; width: 20px; height: 20px; }
.ac-signin-ico svg { width: 100%; height: 100%; }

.ac-me-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 12px; background: transparent; cursor: pointer; transition: background var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out); }
.ac-me-btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.ac-me-btn:active { transform: scale(0.94); }
.ac-signin-btn:focus-visible, .ac-me-btn:focus-visible, .ac-provider:focus-visible, .ac-tab:focus-visible, .ac-x:focus-visible, .ac-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ac-avatar {
  --ac-size: 32px;
  position: relative; display: inline-grid; place-items: center; flex: none; width: var(--ac-size); height: var(--ac-size);
  border-radius: 50%; overflow: hidden; background: var(--accent-soft); color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}
.ac-avatar-letter { font: 600 calc(var(--ac-size) * 0.45)/1 var(--font-display); }
.ac-avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- panels ---------- */
.ac-pop {
  position: fixed; top: var(--ac-top, 70px); right: var(--ac-right, 16px); z-index: calc(var(--z-modal) - 1);
  width: min(336px, calc(100vw - 32px)); padding: 18px 20px 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-4); background: var(--surface-solid); color: var(--text);
  box-shadow: var(--shadow-3); font: 400 14px/1.45 var(--font-ui);
  transform-origin: top right; animation: ac-pop-in var(--dur-2) var(--ease-out) both;
}
.ac-pop, .ac-pop *, .ac-pop *::before, .ac-pop *::after { box-sizing: border-box; }
:where(.ac-pop) button, :where(.ac-pop) input, :where(.ac-pop) select { font: inherit; color: inherit; }
:where(.ac-pop) a { color: inherit; text-decoration: none; }
@keyframes ac-pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
:root[data-motion="reduce"] .ac-pop { animation: ac-fade 100ms linear both; }
@keyframes ac-fade { from { opacity: 0; } to { opacity: 1; } }
.ac-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.ac-pop-title { margin: 0; font: 600 17px/1.25 var(--font-display); overflow-wrap: anywhere; }
.ac-x { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); cursor: pointer; }
.ac-x:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.ac-text { margin: 0 0 14px; color: var(--text-2); }
.ac-fine { margin: 12px 0 0; font-size: 12.5px; color: var(--text-3); }
.ac-link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 500; text-decoration: none; border-radius: 6px; }
.ac-link:hover { text-decoration: underline; }
.ac-err { min-height: 0; margin: 8px 0 0; font-size: 13px; color: var(--bad); }
.ac-err:empty { display: none; }
.ac-mini { font-size: 12.5px; color: var(--text-3); }

.ac-providers { display: grid; gap: 10px; justify-items: stretch; }
.ac-gis { display: flex; justify-content: center; min-height: 44px; align-items: center; }
.ac-gis-wait { font-size: 13px; color: var(--text-3); }
.ac-provider {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-solid); color: var(--text);
  font: 500 14px/1.2 var(--font-ui); text-decoration: none; cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.ac-provider:hover { background: color-mix(in srgb, var(--text) 5%, var(--surface-solid)); border-color: color-mix(in srgb, var(--accent) 40%, var(--border-strong)); }
.ac-provider:active { transform: scale(0.985); }
.ac-provider:disabled { opacity: 0.5; cursor: progress; }
.ac-provider--test { border-style: dashed; color: var(--text-2); }
.ac-provider-ico { display: inline-flex; color: var(--text-2); }

.ac-menu { padding-top: 16px; }
.ac-me { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ac-me-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.ac-sync { margin: 0 0 12px; padding: 8px 10px; border-radius: 10px; font-size: 13px; color: var(--text-2); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.ac-sync[data-state="failed"] { background: color-mix(in srgb, var(--warn) 14%, transparent); }
.ac-rename { display: grid; gap: 6px; margin-bottom: 12px; }
.ac-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.ac-rename-row { display: flex; gap: 8px; }
.ac-input { flex: 1; min-width: 0; }
.ac-links { display: flex; flex-wrap: wrap; gap: 16px; margin: 4px 0 14px; font-size: 14px; }
.ac-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ac-danger { color: var(--bad); }
.ac-nudge .ac-text { margin-bottom: 12px; color: var(--text); }

/* ---------- leaderboard ---------- */
.ac-board[hidden] { display: none; }
.ac-board-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.ac-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: color-mix(in srgb, var(--text) 6%, transparent); }
.ac-tab { min-height: 32px; padding: 4px 12px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font: 500 13px/1 var(--font-ui); cursor: pointer; transition: background var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out); }
.ac-tab[aria-selected="true"] { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-1); }
.ac-select { width: 100%; margin-bottom: 10px; }
.ac-select[hidden] { display: none; }
.ac-board-note { padding: 10px 0; font-size: 14px; }
.ac-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 420px; overflow-y: auto; }
.ac-rows--you { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border-strong); max-height: none; }
.ac-row { display: grid; grid-template-columns: 2.2em auto minmax(0, 1fr) auto 3.2em auto 18px; align-items: center; gap: 10px; min-height: 40px; padding: 4px 8px; border-radius: 10px; font-size: 14px; }
.ac-row:nth-child(odd) { background: color-mix(in srgb, var(--text) 3%, transparent); }
.ac-report { font: inherit; font-size: 12px; color: var(--muted, inherit); opacity: .6; background: none; border: 0; padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.ac-report:hover, .ac-report:focus-visible { opacity: 1; text-decoration: underline; }
.ac-report:disabled { cursor: default; text-decoration: none; }
.ac-row.is-you { background: var(--accent-soft); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.ac-rank { text-align: right; color: var(--text-2); }
.ac-name { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-width: 0; }
.ac-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ac-name-text { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-you { flex: none; padding: 0 7px; border-radius: 999px; font-size: 10px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.ac-you--miss { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.ac-row-stars { display: inline-flex; gap: 1px; color: var(--warn); }
.ac-score { text-align: right; font-weight: 600; }
.ac-ver { display: inline-flex; color: var(--ok); }
.ac-ver--no { color: var(--text-3); font-size: 12px; justify-content: center; }
.ac-board-foot { display: grid; gap: 8px; justify-items: start; }
.ac-join { margin-top: 2px; }

@media (max-width: 520px) {
  .ac-signin-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ac-signin-btn { width: 40px; padding: 0; justify-content: center; border-color: transparent; }
  .ac-pop { right: 16px; left: 16px; width: auto; }
  .ac-row { grid-template-columns: 2em auto minmax(0, 1fr) 3em auto 16px; gap: 8px; }
  .ac-row-stars { display: none; }
}
@media (max-width: 380px) {
  .ac-signin-btn, .ac-me-btn { width: 36px; height: 36px; }
}
@media (pointer: coarse) {
  .ac-signin-btn, .ac-me-btn { min-width: 44px; min-height: 44px; }
  .ac-tab { min-height: 40px; }
  .ac-x { width: 44px; height: 44px; }
}
:root[data-fx="low"] .ac-pop { box-shadow: var(--shadow-2); }
