/* Sign-in chip and account page. Uses the site's cream / navy / coral. */

html.account-booting body { visibility: hidden; }

.profile-page {
  width: min(40rem, calc(100% - 2 * var(--margin, 1.25rem)));
  margin: 1.25rem auto 3rem;
}
body.account-page:has(.profile-page) {
  height: auto;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}
.profile-page h1 {
  font-family: var(--font-display, "Fredoka", sans-serif);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--navy, #243c6c);
  margin-bottom: 0.8rem;
}
.profile-tabs {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}
.profile-tabs button {
  min-height: 44px;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  background: var(--white, #fff);
  color: var(--navy, #243c6c);
  font-weight: 800;
}
.profile-tabs button[aria-selected="true"] {
  background: var(--navy, #243c6c);
  color: var(--cream, #fcf0d8);
}
.profile-logout { margin-top: 0.85rem; }
.settings-avatars button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.45rem 0.35rem 0.55rem;
  text-align: center;
}
.settings-avatars .settings-avatar-name,
.settings-avatars .settings-avatar-note {
  display: block;
  max-width: 100%;
  color: var(--navy, #243c6c);
  line-height: 1.25;
}
.settings-avatars .settings-avatar-name { font-weight: 800; }
.settings-avatars .settings-avatar-note { font-size: 0.75rem; font-weight: 650; }

.settings-avatars {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.55rem;
  margin: 0.4rem 0 1rem;
}
.settings-avatars button {
  min-height: 6.5rem;
  border-radius: 16px;
  background: var(--white, #fff);
  color: var(--navy, #243c6c);
  box-shadow: 0 8px 18px rgba(36, 60, 108, 0.1);
}
.settings-avatars button.is-on { outline: 3px solid var(--coral, #fc903c); }
.settings-avatars img {
  width: 56px;
  height: 56px;
  margin: 0.35rem auto 0.2rem;
  border-radius: 50%;
  object-fit: cover;
  background: transparent;
}
.settings-avatars button.is-locked { opacity: 0.55; }

.account-link-fab {
  position: fixed;
  z-index: 25;
  left: max(0.75rem, env(safe-area-inset-left));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 12rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--navy, #243c6c);
  color: var(--cream, #fcf0d8);
  font-family: var(--font-display, "Fredoka", sans-serif);
  font-weight: 650;
  font-size: 0.95rem;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-notice {
  max-width: var(--page-max, 1080px);
  width: calc(100% - 2 * var(--margin, 1.25rem));
  margin: 0.75rem auto 0;
  padding: 0.8rem 1rem;
  border-radius: 16px;
  background: var(--pale-yellow, #fcc03c);
  color: var(--navy, #243c6c);
  font-weight: 750;
}

body.account-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg, #fcf0d8);
}

body.account-page .topbar { position: relative; flex: none; }

.account-split {
  flex: 1;
  width: min(1120px, calc(100% - 2 * var(--margin, 1.25rem)));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(0.85rem, 2vw, 1.5rem);
  align-items: stretch;
  padding: clamp(0.75rem, 2vh, 1.35rem) 0;
  min-height: 0;
}

.account-aside,
.account-panel {
  min-width: 0;
  min-height: 0;
}

.account-aside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(0.5rem, 2vh, 1rem) 0;
  background: transparent;
  color: var(--navy, #243c6c);
}

.account-kicker,
.account-form-kicker {
  font-family: var(--font-display, "Fredoka", sans-serif);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.account-kicker { color: var(--navy, #243c6c); }

.account-aside h1 {
  margin-top: 0.35rem;
  font-family: var(--font-display, "Fredoka", sans-serif);
  font-weight: 650;
  font-size: clamp(2.4rem, 1.6rem + 2.4vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: inherit;
}

.account-aside .account-lead,
.account-aside .account-zh,
.account-aside-note {
  max-width: 34rem;
}

.account-lead,
.account-zh { margin-top: 0.75rem; }

.account-aside .account-lead { color: var(--navy, #243c6c); }

.account-aside .account-zh { color: var(--muted, #5a6570); }

.account-aside-note {
  margin-top: 1.25rem;
  font-weight: 750;
  color: var(--navy, #243c6c);
}

.account-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.account-form-kicker { color: var(--navy, #243c6c); }

#account-screen[data-mode="signup"] .account-kicker,
#account-screen[data-mode="signup"] .account-aside .account-lead,
#account-screen[data-mode="signup"] .account-aside .account-zh,
#account-screen[data-mode="signup"] .account-aside-note {
  color: var(--navy, #243c6c);
}

#account-screen[data-mode="signup"] .account-form-kicker { color: #9a3412; }

#account-screen[data-mode="signup"] .account-card {
  background: #fff8ee;
  box-shadow: inset 0 0 0 3px var(--navy, #243c6c);
}

.account-card {
  margin-top: 0;
  padding: clamp(1rem, 2vh, 1.35rem) 1.15rem;
  border-radius: var(--radius, 24px);
  background: var(--white, #fff);
}

.account-card h2 {
  font-family: var(--font-display, "Fredoka", sans-serif);
  font-weight: 650;
  font-size: clamp(1.6rem, 1.2rem + 1vw, 2.1rem);
  letter-spacing: -0.03em;
  color: var(--navy, #243c6c);
}

.account-card .account-lead { color: var(--navy, #243c6c); }

@media (max-width: 860px), (max-height: 680px) {
  body.account-page { height: auto; overflow: auto; }
  .account-split {
    grid-template-columns: 1fr;
    padding-bottom: 1.5rem;
  }
  .account-aside { min-height: 0; }
}

@media (min-width: 861px) and (min-height: 681px) {
  body.account-page:not(:has(.profile-page)) {
    height: 100dvh;
    overflow: hidden;
  }
}

.account-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.85rem;
  font-weight: 800;
  color: var(--navy, #243c6c);
}

.account-field-name {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
}

.account-field-name [lang="zh-Hant"] {
  font-weight: 700;
  color: var(--muted, #5a6570);
}

.account-field input {
  min-height: 52px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: var(--bg, #fcf0d8);
  padding: 0.65rem 0.8rem;
  font: inherit;
  color: var(--navy, #243c6c);
}

.account-hint {
  margin-top: 0.35rem;
  color: var(--muted, #5a6570);
  font-size: 0.92rem;
  font-weight: 650;
}

.account-error {
  margin-top: 0.85rem;
  color: #9a3412;
  font-weight: 800;
}

.account-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin-top: 0.95rem;
}

.account-actions .btn { border: 0; }

.account-text-btn {
  min-height: 44px;
  padding: 0.4rem 0.2rem;
  background: transparent;
  color: var(--navy, #243c6c);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.account-ask {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(36, 60, 108, 0.46);
}

.account-ask-panel {
  width: min(100%, 28rem);
  padding: 1.2rem 1.15rem 1.25rem;
  border-radius: 24px;
  background: var(--cream, #fcf0d8);
  color: var(--navy, #243c6c);
}

.account-ask-panel h2 {
  font-family: var(--font-display, "Fredoka", sans-serif);
  font-size: 1.7rem;
  font-weight: 650;
}

.account-ask-panel p { margin-top: 0.55rem; }

.account-ask-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}
.settings-avatars button.is-filtered img,
.profile-choice.is-filtered img { filter: grayscale(1); opacity: 0.72; }
.badge-meter {
  width: min(100%, 9rem);
  height: 0.55rem;
  margin: 0.45rem auto 0;
  border-radius: 999px;
  background: rgba(36, 60, 108, 0.12);
  overflow: hidden;
}
.badge-meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #fc903c;
}
.badge-popup {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.badge-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 60, 108, 0.55);
}
.badge-popup-panel {
  position: relative;
  width: min(28rem, 100%);
  max-height: min(88vh, 40rem);
  overflow: auto;
  padding: 1.15rem 1.1rem 1.2rem;
  border-radius: 28px;
  background: var(--cream, #fcf0d8);
  color: var(--navy, #243c6c);
  text-align: center;
}
.badge-popup-kicker,
.badge-popup-card h2,
.badge-popup-english,
.badge-popup-cheer {
  font-family: Fredoka, var(--font-display, sans-serif);
}
.badge-popup-kicker {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--coral, #fc903c);
}
.badge-popup-card { margin-top: 0.65rem; }
.badge-popup-card h2 { margin: 0.35rem 0 0; font-size: 1.45rem; }
.badge-popup-english,
.badge-popup-how,
.badge-popup-cheer,
.badge-fraction { margin: 0.2rem 0 0; font-weight: 700; }
.badge-popup-art {
  width: 8rem;
  height: 8rem;
  margin: 0 auto;
}
.badge-popup-art img { width: 100%; height: 100%; object-fit: contain; }
.badge-popup-art.is-filtered img { filter: grayscale(1); opacity: 0.72; }
.badge-popup .badge-meter { margin: 0.7rem auto 0; }
.badge-popup-close {
  margin-top: 0.9rem;
  min-height: 44px;
  padding: 0.4rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--navy, #243c6c);
  color: var(--cream, #fcf0d8);
  font: inherit;
  font-weight: 800;
}
.badge-confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 91;
}
