/* ============================================================
 *  GOOD BOOK FUN — account overlay styles
 * ============================================================
 *  Scoped under .gbf-account-root. Reuses the theme tokens
 *  (--color-*, --radius-*, --shadow, --ring) from css/theme.css.
 * ============================================================ */

/* Right-side slide-in panel: the games stay visible behind it (no takeover). */
body.gbf-modal-open { overflow: hidden; }
.gbf-account-backdrop {
  position: fixed; inset: 0; z-index: 199; background: rgba(2, 6, 23, 0.5);
  animation: gbf-acct-fade .2s ease both;
}
.gbf-account-root {
  position: fixed; top: 0; right: 0; height: 100dvh; width: min(26rem, 100%);
  z-index: 200; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--color-bg);
  border-left: 1px solid var(--color-surface-2);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
  animation: gbf-acct-slide .28s cubic-bezier(.22, .61, .36, 1) both;
}
@keyframes gbf-acct-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gbf-acct-slide { from { transform: translateX(100%); } to { transform: translateX(0); } }
.acct-screen {
  width: 100%; min-height: 100dvh;
  padding: max(1rem, env(safe-area-inset-top)) 1.2rem max(1.4rem, env(safe-area-inset-bottom)) 1.2rem;
  display: flex; flex-direction: column;
}
.acct-screen.center { justify-content: center; text-align: center; align-items: center; }

.acct-top { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.6rem; }
.acct-h { font-size: 1.35rem; font-weight: 700; margin: 0; }
.acct-x {
  flex: none; width: 2.5rem; height: 2.5rem; border-radius: 50%; border: none;
  -webkit-appearance: none; appearance: none;
  background: none; color: var(--color-text-dim);
  font-family: inherit; cursor: pointer; display: grid; place-items: center;
}
.acct-x:hover { color: var(--color-text); background: var(--color-surface-2); }
.acct-x svg { width: 1.5rem; height: 1.5rem; }

/* standalone big close button pinned to the panel top-right (auth screen) */
.acct-close {
  position: absolute; top: 0.75rem; right: 0.9rem; z-index: 2;
  width: 2.75rem; height: 2.75rem; display: grid; place-items: center;
  border: none; -webkit-appearance: none; appearance: none; background: none;
  color: var(--color-text-dim); cursor: pointer; border-radius: 50%;
}
.acct-close svg { width: 1.75rem; height: 1.75rem; }
.acct-close:hover { color: var(--color-text); background: var(--color-surface-2); }

/* auth screen: content sits lower / vertically centered like a login sidebar */
.acct-screen.acct-auth { justify-content: center; padding-top: 3.5rem; }
.acct-auth-inner { width: 100%; }
.acct-auth-title { text-align: center; font-size: 1.5rem; font-weight: 800; margin: 0 0 1.5rem; }

.acct-body { display: flex; flex-direction: column; gap: 0.9rem; }

/* buttons */
.gbf-account-root .btn {
  font-family: inherit; font-weight: 700; font-size: 1.05rem; border: none; min-height: 2.75rem;
  border-radius: var(--radius-md); padding: 0.9rem 1.2rem; cursor: pointer; width: 100%;
  transition: transform .12s ease, filter .12s ease;
}
.gbf-account-root .btn:active { transform: scale(0.97); }
.gbf-account-root .btn.primary { background: var(--color-primary); color: var(--color-primary-ink); box-shadow: var(--shadow); }
.gbf-account-root .btn.primary:hover { filter: brightness(1.06); }
.gbf-account-root .btn.ghost { background: var(--color-surface-2); color: var(--color-text); }
.gbf-account-root :focus-visible { outline: none; box-shadow: var(--ring); }
.linkish { background: none; border: none; color: var(--color-text-dim); font-family: inherit; cursor: pointer; font-size: 1rem; padding: 0.3rem; }

/* Google button */
.gbf-account-root .btn.google {
  background: #fff; color: #1f2328; display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  border: 1px solid #dadce0;
}
.g-mark {
  display: grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%;
  background: conic-gradient(from -45deg, #ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0);
  color: #fff; font-weight: 800; font-size: 0.85rem; -webkit-text-stroke: 0.5px rgba(0,0,0,.2);
}

/* or divider */
.acct-or { display: flex; align-items: center; gap: 0.7rem; color: var(--color-text-dim); font-size: 0.8rem; }
.acct-or::before, .acct-or::after { content: ""; flex: 1; height: 1px; background: var(--color-surface-2); }

/* forms */
.acct-form { display: flex; flex-direction: column; gap: 0.7rem; }
.acct-field { display: flex; flex-direction: column; gap: 0.3rem; text-align: left; }
.acct-field > span { font-size: 0.8rem; color: var(--color-text-dim); font-weight: 600; }
.acct-field input {
  width: 100%; font-family: inherit; font-size: 1.02rem; padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md); border: 2px solid var(--color-surface-2);
  background: var(--color-bg); color: var(--color-text);
}
.acct-field input:focus { outline: none; border-color: var(--color-primary); }
.acct-two { display: flex; gap: 0.6rem; }
.acct-two .acct-field { flex: 1; }
.acct-swap { text-align: center; color: var(--color-text-dim); font-size: 0.92rem; margin: 0.2rem 0 0; }
.acct-private { display: flex; align-items: center; gap: 0.4rem; color: var(--color-text-dim); font-size: 0.8rem; margin: 0.2rem 0 -0.2rem; }

/* avatar badge (shared everywhere avatars render) */
.gbf-av {
  flex: none; display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem;
  border-radius: 50%; overflow: hidden; font-size: 1.1rem; line-height: 1;
  background: var(--color-surface-2); color: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
}
.gbf-av img { width: 100%; height: 100%; object-fit: cover; }
.gbf-av-initial { background: var(--color-primary); color: var(--color-primary-ink); font-weight: 800; font-size: 1rem; }

/* success bar pinned at the top of the panel */
.acct-flash-slot:empty { display: none; }
.acct-flash {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: #16a34a; color: #fff; font-weight: 700; font-size: 0.95rem;
  border-radius: var(--radius-md); padding: 0.75rem 1rem; margin: 0 0 0.9rem;
  animation: gbf-acct-fade .2s ease both;
}
.acct-flash.hide { opacity: 0; transition: opacity .4s ease; }

/* profile hero */
.acct-hero { display: flex; align-items: center; gap: 0.9rem; }
.acct-edit-btn {
  margin-left: auto; flex: none; width: 2.4rem; height: 2.4rem; display: grid; place-items: center;
  border: none; -webkit-appearance: none; appearance: none; background: var(--color-surface-2);
  color: var(--color-text-dim); border-radius: 50%; cursor: pointer;
}
.acct-edit-btn:hover { color: var(--color-text); filter: brightness(1.1); }
.acct-edit-btn svg { width: 1.15rem; height: 1.15rem; }

/* read-only profile view */
.acct-view { display: flex; flex-direction: column; }
.acct-vrow { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--color-surface-2); }
.acct-view .acct-vrow:last-child { border-bottom: none; }
.acct-vlabel { color: var(--color-text-dim); font-size: 0.82rem; font-weight: 600; flex: none; }
.acct-vval { color: var(--color-text); font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.acct-view .acct-private { margin: 0.7rem 0 0; }
.acct-av-btn { position: relative; border: none; background: none; padding: 0; cursor: pointer; }
.acct-av-btn .gbf-av { width: 4rem; height: 4rem; font-size: 2rem; }
.acct-av-edit {
  position: absolute; right: -2px; bottom: -2px; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--color-primary); color: var(--color-primary-ink); display: grid; place-items: center;
  font-size: 0.8rem; box-shadow: var(--shadow);
}
.acct-hero-name { font-size: 1.2rem; font-weight: 700; }

/* avatar picker grid */
.acct-pick-lbl { text-align: center; color: var(--color-text-dim); font-size: 0.85rem; margin: 0; }
.acct-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }
.acct-tile {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.6rem 0.2rem;
  background: var(--color-surface); border: 2px solid transparent; border-radius: var(--radius-md);
  cursor: pointer; font-family: inherit;
}
.acct-tile:hover { border-color: var(--color-primary); }
.acct-tile.on { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 18%, var(--color-surface)); }
.acct-tile .gbf-av { width: 2.6rem; height: 2.6rem; font-size: 1.35rem; }
.acct-tile-lbl { font-size: 0.72rem; color: var(--color-text-dim); }

/* sections */
.acct-section { border-top: 1px solid var(--color-surface-2); padding-top: 0.9rem; }
.acct-section h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-dim); margin: 0 0 0.6rem; }
.acct-soon { color: var(--color-text-dim); font-size: 0.9rem; margin: 0; }

.acct-score-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.acct-score-rows li { display: flex; align-items: center; gap: 0.7rem; background: var(--color-surface); border-radius: var(--radius-sm); padding: 0.55rem 0.8rem; }
.asr-icon { flex: none; font-size: 1.15rem; }
.asr-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asr-score { flex: none; font-weight: 700; color: var(--color-primary); }

/* claim + check-email + loading */
.acct-loading { flex: 1; display: flex; align-items: center; justify-content: center; padding: 3rem 0; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--color-surface-2); border-top-color: var(--color-primary); animation: spin .8s linear infinite; }
.spinner.sm { width: 26px; height: 26px; border-width: 3px; margin: 0.4rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.acct-err { color: var(--color-wrong, #ef4444); margin-bottom: 1rem; }
.acct-claim, .acct-check { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; max-width: 22rem; }
.acct-claim-em, .acct-check { font-size: 2.4rem; }
.acct-check { gap: 1rem; }
.acct-claim-body { font-size: 1.05rem; }
.acct-select {
  width: 100%; font-family: inherit; font-size: 1.02rem; padding: 0.7rem 2.2rem 0.7rem 0.85rem;
  border-radius: var(--radius-md); border: 2px solid var(--color-surface-2);
  background-color: var(--color-bg); color: var(--color-text); cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1rem;
}
.acct-select:focus { outline: none; border-color: var(--color-primary); }
.acct-year-select { max-width: 12rem; }

/* paywall */
.acct-pay { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; text-align: center; }
.acct-pay-em { font-size: 2.6rem; }
.acct-pay-body { font-size: 1.05rem; color: var(--color-text); }
.acct-pay-price { font-size: 1.6rem; font-weight: 800; color: var(--color-primary); }
.acct-pay .btn.primary, .acct-pay .linkish { width: 100%; max-width: 18rem; }
.acct-claim-list { width: 100%; max-height: 44vh; overflow-y: auto; -webkit-overflow-scrolling: touch; margin: 0.1rem 0 0.3rem; }
.asr-count { color: var(--color-text-dim); font-size: 0.8em; font-weight: 700; }

/* profile banner offering to claim leftover device scores */
.acct-claim-slot:empty { display: none; }
.acct-claim-banner {
  display: flex; flex-direction: column; gap: 0.6rem; text-align: center;
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--color-primary) 40%, transparent);
  border-radius: var(--radius-md); padding: 0.9rem;
}
.acct-claim-banner span { font-size: 0.95rem; }
.acct-claim .btn, .acct-check .btn { min-width: 12rem; }

/* toast (independent copy so the overlay never depends on daily.css) */
.gbf-toast { position: fixed; left: 50%; bottom: 2rem; transform: translate(-50%, 1rem); background: var(--color-primary); color: var(--color-primary-ink); padding: 0.7rem 1.2rem; border-radius: 999px; font-weight: 700; font-size: 0.9rem; opacity: 0; transition: all .3s; z-index: 300; box-shadow: var(--shadow); }
.gbf-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* topbar profile button on the hub (flat: no native button gloss, no emoji gradient) */
.profile-btn {
  flex: none; display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem;
  border-radius: 50%; border: none; -webkit-appearance: none; appearance: none;
  background: var(--color-surface-2); color: var(--color-text-dim);
  cursor: pointer; font-family: inherit; font-size: 1.1rem; padding: 0;
}
.profile-btn:hover { filter: brightness(1.08); }
.profile-btn .pb-ico { width: 1.35rem; height: 1.35rem; display: block; }
.profile-btn .gbf-av { width: 2.5rem; height: 2.5rem; }

/* ---- access-code redeem block (paywall + profile) ---- */
.acct-code { display: flex; flex-direction: column; gap: 0.5rem; text-align: left; width: 100%; }
.acct-code-label { font-size: 0.85rem; color: var(--color-text-dim); font-weight: 600; }
.acct-code-row { display: flex; flex-direction: column; gap: 0.6rem; }
.acct-code-input {
  flex: 1; min-width: 0; font-family: inherit; font-size: 1.02rem; padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md); border: 2px solid var(--color-surface-2);
  background: var(--color-bg); color: var(--color-text); text-transform: uppercase; letter-spacing: 0.04em;
}
.acct-code-input::placeholder { text-transform: none; letter-spacing: normal; }
.acct-code-input:focus { outline: none; border-color: var(--color-primary); }
/* Stacked layout: input on top, Apply full-width below (matches Subscribe). */
.acct-code-row .btn.acct-code-go { width: 100%; max-width: none; }
.acct-code-msg { font-size: 0.9rem; min-height: 1.1rem; margin: 0.1rem 0 0; }
.acct-code-msg.ok { color: #16a34a; }
.acct-code-msg.err { color: #dc2626; }
/* On the paywall the block sits under the CTA with a divider above it. */
.acct-pay .acct-code-slot { width: 100%; max-width: 18rem; margin-top: 0.4rem; padding-top: 0.9rem; border-top: 1px solid var(--color-surface-2); }
/* On the paywall, center the prompt and match the body copy (.acct-pay-body). */
.acct-pay .acct-code { text-align: center; }
.acct-pay .acct-code-label { font-size: 1.05rem; color: var(--color-text); font-weight: inherit; }

@media (prefers-reduced-motion: reduce) {
  .gbf-account-root *, .gbf-account-root *::before, .gbf-account-root *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
