/* ============================================================================
   Adventures in Mousington — Reader paywall styles (additive, host page)
   Reuses the .lgm shared modal shell tokens defined in legendary.css so the
   paywall matches the Passport / Publisher Demo modals visually.
   ============================================================================ */

/* Belt-and-suspenders: the app loading overlay (#loading-screen) is z-index 999
   in styles.css, above the shared modal shell (.lgm, z-index 120). paywall.js
   force-dismisses that overlay when the modal opens, but scope a higher z-index
   to THIS modal only (not the shared .lgm, which other modals reuse) so the
   paywall still sits cleanly above the loader during any fade window. */
#paywall-modal.lgm { z-index: 1000; }

.paywall__panel { width: min(560px, 100%); }

.paywall__body { display: flex; flex-direction: column; gap: 16px; }

.paywall__lede {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--text);
}

.paywall__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.paywall__list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-family: var(--font-ui);
  font-size: 0.96rem;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.paywall__list li span { flex: 0 0 auto; font-size: 1.15rem; line-height: 1; }

.paywall__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}
.paywall__actions .primary.lg,
.paywall__actions .ghost.lg {
  flex: 1 1 220px;
}

.paywall__mock {
  background: var(--surface-2);
  border: 1px dashed var(--candle-2);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.paywall__mock-badge {
  margin: 0;
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--candle);
  border-radius: 999px;
  padding: 4px 10px;
}
.paywall__mock-copy {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.paywall__fineprint {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-faint);
}

@media (max-width: 560px) {
  .paywall__actions .primary.lg,
  .paywall__actions .ghost.lg { flex: 1 1 100%; }
}

/* ----------------------------------------------------------------------------
   Gift / access code (GRAMPY-GIFT-2026 and friends). Sits under the primary
   unlock actions in the default paywall panel. */
.paywall__gift {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule-soft, rgba(217, 199, 154, 0.38));
}
.paywall__gift-label {
  margin: 0 0 8px;
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-3, #0f1730);
}
.paywall__gift-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.paywall__gift-input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--rule-soft, rgba(217, 199, 154, 0.55));
  background: var(--surface, #fff);
  color: var(--text, #2a2418);
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.paywall__gift-input::placeholder { text-transform: none; letter-spacing: normal; opacity: 0.6; }
.paywall__gift-input:focus-visible {
  outline: 2px solid var(--candle-2, #d99a2b);
  outline-offset: 1px;
}
.paywall__gift-msg {
  margin: 8px 0 0;
  min-height: 1.1em;
  font-size: 0.85rem;
  line-height: 1.4;
}
.paywall__gift-msg[data-state="ok"] { color: #1e7d4f; font-weight: 700; }
.paywall__gift-msg[data-state="err"] { color: #b23b3b; }
@media (max-width: 560px) {
  .paywall__gift-row .ghost.lg { flex: 1 1 100%; }
}

/* ----------------------------------------------------------------------------
   Account sign-in / create (shown only when the Node backend reports
   accountsEnabled). Lets a paid buyer or gift-code holder make a username +
   password so they can re-access the app in a later session. */
.paywall__account {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule-soft, rgba(217, 199, 154, 0.38));
}
.paywall__account-label {
  margin: 0 0 4px;
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-3, #0f1730);
}
.paywall__account-hint {
  margin: 0 0 10px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted, #5c5647);
}
.paywall__account-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.paywall__account-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--rule-soft, rgba(217, 199, 154, 0.55));
  background: var(--surface, #fff);
  color: var(--text, #2a2418);
  font: inherit;
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: normal;
}
.paywall__account-input:focus-visible {
  outline: 2px solid var(--candle-2, #d99a2b);
  outline-offset: 1px;
}
.paywall__account-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.paywall__account-msg {
  margin: 8px 0 0;
  min-height: 1.1em;
  font-size: 0.85rem;
  line-height: 1.4;
}
.paywall__account-msg[data-state="ok"] { color: #1e7d4f; font-weight: 700; }
.paywall__account-msg[data-state="err"] { color: #b23b3b; }
@media (max-width: 560px) {
  .paywall__account-actions .lg { flex: 1 1 100%; }
}

/* ----------------------------------------------------------------------------
   Restore access (parent-facing "Already purchased?" recovery). A quiet toggle
   that reveals an email lookup form; reuses the gift-input styling. */
.paywall__restore {
  border-top: 1px solid var(--rule-soft, rgba(60, 50, 40, 0.16));
  padding-top: 12px;
  margin-top: 2px;
}
.paywall__restore-toggle {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--candle-2, #b8791a);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.paywall__restore-toggle:focus-visible {
  outline: 2px solid var(--candle-2, #d99a2b);
  outline-offset: 2px;
  border-radius: 3px;
}
.paywall__restore-panel { margin-top: 10px; }
.paywall__restore-hint {
  margin: 0 0 8px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink-3, #5c5347);
}
.paywall__restore-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.paywall__restore-form .paywall__gift-input { flex: 1 1 200px; text-transform: none; letter-spacing: normal; }
.paywall__restore-msg {
  margin: 8px 0 0;
  min-height: 1.1em;
  font-size: 0.85rem;
  line-height: 1.4;
}
.paywall__restore-msg[data-state="ok"] { color: #1e7d4f; font-weight: 700; }
.paywall__restore-msg[data-state="err"] { color: #b23b3b; }

/* ----------------------------------------------------------------------------
   Post-payment success / cancel panels (state.view = "success" | "cancel"). */
.paywall__success-status {
  margin: 0 0 4px;
  font-size: 0.95rem;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2, rgba(60, 50, 40, 0.05));
}
.paywall__success-status[data-state="ok"] { color: #1e7d4f; font-weight: 700; }
.paywall__success-status[data-state="pending"] { color: var(--ink-3, #5c5347); }
.paywall__success-status[data-state="err"] { color: #b23b3b; background: rgba(178, 59, 59, 0.08); }
.paywall__receipt {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--muted, #6b6255);
}

/* ----------------------------------------------------------------------------
   Character avatar picker (account create) — colored initial/emoji chips, no
   brittle hashed asset paths. Single-select via aria-pressed. */
.paywall__avatars { margin: 4px 0 2px; }
.paywall__avatars-label {
  margin: 0 0 6px;
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-3, #5c5347);
}
.paywall__avatars-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.paywall__avatar {
  --mh-avatar-color: var(--candle-2, #b8791a);
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px 6px 7px;
  border-radius: 999px;
  border: 1.5px solid var(--rule-soft, rgba(217, 199, 154, 0.55));
  background: var(--surface, #fff);
  color: var(--text, #2a2418);
  font: inherit;
  font-size: 0.85rem;
}
.paywall__avatar-face {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--mh-avatar-color) 22%, #fff);
  font-size: 1rem;
  line-height: 1;
}
.paywall__avatar-face .mh-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.paywall__avatar[aria-pressed="true"] {
  border-color: var(--mh-avatar-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mh-avatar-color) 40%, transparent);
  background: color-mix(in srgb, var(--mh-avatar-color) 10%, #fff);
  font-weight: 700;
}
.paywall__avatar:focus-visible {
  outline: 2px solid var(--candle-2, #d99a2b);
  outline-offset: 2px;
}

/* ----------------------------------------------------------------------------
   Top-right account / login control (built by paywall.js). A cozy chip when
   logged out; a circular character avatar + label when signed in. */
.mh-acct {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 90;
  font-family: var(--font-ui, system-ui, sans-serif);
}
/* Icon-only circular button: no visible label text (the purpose lives in the
   button's aria-label). Sized as a comfortable tap target. */
.mh-acct__btn {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(217, 199, 154, 0.5);
  background: rgba(27, 36, 64, 0.72);
  color: #f5e2a8;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.mh-acct__btn:focus-visible {
  outline: 2px solid #f5e2a8;
  outline-offset: 2px;
}
.mh-acct__avatar {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.15rem;
  line-height: 1;
  color: #fff;
}
.mh-acct__avatar--out { background: rgba(245, 226, 168, 0.16); }
/* Character portrait layered over the emoji fallback; if it fails to load the
   <img> removes itself (onerror in paywall.js) and the emoji shows through. */
.mh-acct__avatar .mh-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mh-acct__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  padding: 10px;
  border-radius: 14px;
  background: var(--surface, #fff);
  color: var(--text, #2a2418);
  border: 1px solid var(--rule-soft, rgba(217, 199, 154, 0.55));
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.24);
}
.mh-acct__who {
  margin: 2px 4px 8px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--muted, #5c5647);
}
.mh-acct__badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1e7d4f;
}
.mh-acct__item {
  appearance: none;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border-radius: 10px;
  border: none;
  background: none;
  color: var(--text, #2a2418);
  font: inherit;
  font-size: 0.9rem;
}
.mh-acct__item:hover,
.mh-acct__item:focus-visible {
  background: var(--surface-2, rgba(60, 50, 40, 0.06));
  outline: none;
}
/* Signed-in menu header: avatar + name/status, warm and premium. */
.mh-acct__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--rule-soft, rgba(217, 199, 154, 0.5));
}
.mh-acct__head-avatar {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  color: #fff;
}
.mh-acct__head-avatar .mh-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mh-acct__head-text { display: flex; flex-direction: column; min-width: 0; }
.mh-acct__head-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text, #2a2418);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 170px;
}
.mh-acct__head-sub { font-size: 0.76rem; color: var(--muted, #5c5647); }
.mh-acct__status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 4px 8px;
  font-size: 0.82rem;
  font-weight: 700;
}
.mh-acct__status--ok { color: #1e7d4f; }
.mh-acct__status--muted { color: var(--muted, #5c5647); font-weight: 600; }
.mh-acct__status-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(30, 125, 79, 0.14);
  font-size: 0.72rem;
}

/* ---- Member menu navigation group (added for mobile member-menu polish) ----
   The top nav hides most destinations on phones, so the signed-in account menu
   surfaces them here. Icon + label rows with comfortable tap targets. ------- */
.mh-acct__nav { display: flex; flex-direction: column; gap: 2px; }
.mh-acct__item--nav { display: flex; align-items: center; gap: 10px; }
.mh-acct__nav-ic {
  flex: none;
  width: 20px;
  text-align: center;
  font-size: 1rem;
  line-height: 1;
}
.mh-acct__sep {
  height: 1px;
  margin: 8px 4px;
  background: var(--rule-soft, rgba(217, 199, 154, 0.5));
}
/* Phones: comfortable 44px touch targets, and keep the (now taller) menu within
   the viewport with its own scroll instead of overflowing off-screen. */
@media (max-width: 480px) {
  .mh-acct__menu {
    min-width: min(268px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 84px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .mh-acct__item { min-height: 44px; }
}

/* ---- "Already purchased? Sign in" link + shared inline text button ---- */
.paywall__signin-row {
  margin: 4px 0 14px;
  font-size: 0.92rem;
  color: var(--muted, #5c5647);
}
.paywall__link {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  color: var(--link, #b8791a);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.paywall__link:hover,
.paywall__link:focus-visible { color: var(--candle-2, #8a5a12); outline: none; }
.paywall__link:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 4px; }

/* --------------------------------------------------- My Library panel body */
.paywall__lib-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2, rgba(60, 50, 40, 0.05));
  border: 1px solid var(--rule-soft, rgba(217, 199, 154, 0.5));
}
.paywall__lib-avatar {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 1.7rem;
  line-height: 1;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.paywall__lib-avatar .mh-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.paywall__lib-hello { margin: 0 0 4px; font-size: 1rem; }
.paywall__status { display: flex; align-items: center; gap: 7px; margin: 0; font-weight: 700; }
.paywall__status--ok { color: #1e7d4f; }
.paywall__status--muted { color: var(--muted, #5c5647); font-weight: 600; }
.paywall__status-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(30, 125, 79, 0.16);
  font-size: 0.78rem;
}
.paywall__lib-heading {
  margin: 16px 0 8px;
  font-weight: 800;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted, #5c5647);
}
.paywall__lib-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.paywall__lib-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface, #fff);
  border: 1px solid var(--rule-soft, rgba(217, 199, 154, 0.5));
}
.paywall__lib-ic { flex: 0 0 auto; font-size: 1.25rem; line-height: 1; }
.paywall__lib-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.paywall__lib-text strong { font-size: 0.95rem; color: var(--text, #2a2418); }
.paywall__lib-sub { font-size: 0.82rem; color: var(--muted, #5c5647); }
.paywall__lib-tick {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(30, 125, 79, 0.16);
  color: #1e7d4f;
  font-size: 0.8rem;
  font-weight: 800;
}
.paywall__lib-avatars { margin-top: 6px; }
.paywall__lib-foot { margin-top: 14px; text-align: center; }

/* Keep clear of the reading UI while the reader is open. */
body.reader-open .mh-acct,
body.secret-hunt-open .mh-acct { opacity: 0.6; }
body.reader-open .mh-acct:hover,
body.reader-open .mh-acct:focus-within { opacity: 1; }

/* ----------------------------------------------------------------------------
   Publisher preview badge — shown only in the fully-unlocked demo build
   (window.MOUSINGTON_UNLOCKED_DEMO === true, set via demo-config.js). Kept
   unobtrusive but polished: a small glass chip pinned to the corner. */
.mh-publisher-badge {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f5e2a8;
  background: rgba(27, 36, 64, 0.72);
  border: 1px solid rgba(217, 199, 154, 0.38);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  user-select: none;
}
.mh-publisher-badge span { font-size: 0.85em; }

@media print { .mh-publisher-badge { display: none; } }
