/* ==========================================================================
   COMPONENTS.CSS — shared Ink & Gold building blocks
   Every page uses these classes; a page stylesheet only adds what is
   genuinely different (width, a retuned glass alpha, page-only widgets).

   Page shell        .pp-page  > .pp-page-header (.pp-page-title, .pp-page-subtitle)
   Glass surfaces    .pp-card  > .pp-section (.pp-section-title)
   Forms             .pp-field (label, label small, input/select)
           .pp-input-wrap + .pp-toggle   (show/hide password)
   Actions           .pp-btn (gold pill), .pp-footnote (small centred line + link)
   Misc              .pp-badge, .pp-bilingual (.pp-bilingual-en / -zh)
   Overlays          .ink-modal-*, .context-helper-* (tooltips)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Page shell
   -------------------------------------------------------------------------- */
.pp-page {
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 56px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-sizing: border-box;
}

.pp-page-header {
  text-align: center;
  margin-bottom: 4px;
}

.pp-page-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--ink-dark);
  margin: 0 0 6px 0;
  text-transform: uppercase;
}

.pp-page-subtitle {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-mountain-wash);
  margin: 0 auto;
  max-width: 500px;
}

/* --------------------------------------------------------------------------
   Glass surfaces
   -------------------------------------------------------------------------- */
.pp-card {
  background: var(--glass-outer);
  border: 1px solid var(--ink-border-wash);
  border-radius: 16px;
  padding: 24px 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pp-section {
  background: var(--glass-section);
  border: 1px solid var(--ink-border-wash);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pp-section-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-gold);
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink-border-wash);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pp-section-title svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 480px) {
  .pp-card {
  padding: 18px 14px;
  }
}

/* --------------------------------------------------------------------------
   Form fields
   -------------------------------------------------------------------------- */
.pp-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pp-field > label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-mountain-wash);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.pp-field > label small {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-mountain-wash);
}

.pp-field input,
.pp-field select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--glass-input);
  border: 1px solid var(--ink-border-wash);
  color: var(--ink-dark);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.pp-field input::placeholder {
  color: var(--ink-mountain-wash);
  opacity: 0.7;
  font-weight: 500;
}

.pp-field input:focus,
.pp-field select:focus {
  border-color: var(--ink-gold);
  background: var(--glass-input-focus);
  box-shadow: 0 0 0 3px rgba(179, 136, 47, 0.16);
}

/* Password field with a show / hide button */
.pp-input-wrap {
  position: relative;
  width: 100%;
}

.pp-input-wrap input {
  padding-right: 46px;
  letter-spacing: 0.5px;
}

.pp-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink-mountain-wash);
  transition: color 0.2s ease, background 0.2s ease;
}

.pp-toggle:hover,
.pp-toggle[aria-pressed="true"] {
  color: var(--ink-gold);
  background: var(--ink-gold-light);
}

.pp-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(179, 136, 47, 0.35);
}

.pp-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   Actions
   -------------------------------------------------------------------------- */
.pp-btn {
  width: 100%;
  max-width: 320px;
  margin: 4px auto 0 auto;
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ink-gold);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(179, 136, 47, 0.35);
  transition: all 0.25s ease;
}

.pp-btn:hover {
  background: #996e1e;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(179, 136, 47, 0.45);
}

/* Small centred line under a form: "New here? Create an account" */
.pp-footnote {
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-mountain-wash);
  margin: 0;
}

.pp-footnote a {
  color: var(--ink-gold);
  font-weight: 800;
  text-decoration: none;
}

.pp-footnote a:hover {
  text-decoration: underline;
}

/* Superadmin "detailed breakdown" toggle on report pages (<details class="superadmin-breakdown">) */
.breakdown-summary {
  padding: 12px 0;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  color: var(--ink-gold);
  outline: none;
}

details[open] > .breakdown-summary {
  margin-bottom: 20px;
}

/* Score tier under a score: separator line + tier name from
   macros/_score_info.html, e.g.
     <span class="pp-tier-sep"></span>
     <span class="pp-tier is-{{ score_tier_key(score) }}">{{ score_tier('love', score) }}</span> */
.pp-tier-sep {
  display: block;
  width: 70%;
  max-width: 140px;
  height: 0;
  margin: 5px auto 4px;
  border-top: 1px solid var(--ink-border-gold);
}

.pp-tier {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-transform: none;
  text-align: center;
  color: var(--ink-gold-deep);
}

.pp-tier.is-miracle      { color: var(--ink-gold-deep); }
.pp-tier.is-breakthrough { color: var(--ink-gold-deep); }
.pp-tier.is-compatible   { color: var(--ink-jade); }
.pp-tier.is-challenges   { color: var(--ink-cinnabar); }

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
.pp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-gold);
  background: var(--ink-gold-light);
  border: 1px solid var(--ink-border-gold);
  padding: 0.35rem 1rem;
  border-radius: 9999px;
}

/* English line with its Chinese translation underneath */
.pp-bilingual {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pp-bilingual-en {
  color: inherit;
  line-height: 1.55;
  font-size: 0.9rem;
}

.pp-bilingual-zh {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--ink-mountain-wash);
  font-family: var(--font-zh);
}

/* The master switch shows one language at a time: Chinese takes the English line's place */
html[data-lang="zh"] .pp-bilingual-zh {
  font-size: 0.9rem;
  color: inherit;
}

/* ==========================================================================
   Ink Standard Modal & Dialog Architecture
   ========================================================================== */
.ink-modal-dialog {
  padding: 0;
  border: none;
  background: transparent;
  max-width: 520px;
  width: min(92vw, 500px);
  margin: auto;
  border-radius: 16px;
  overflow: visible;
}

.ink-modal-dialog::backdrop {
  background: rgba(15, 14, 12, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Header, intro and footer stay put; only the list scrolls (one scrollbar,
   inside the rounded box). */
.ink-modal-box {
  display: flex;
  flex-direction: column;
  background: var(--ink-card-bg);
  border: 1px solid var(--ink-border-wash);
  border-radius: 16px;
  padding: 22px 20px 18px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
  max-height: 85vh;
  max-height: 85dvh;
  overflow: hidden;
  color: var(--ink-dark);
  box-sizing: border-box;
}

.ink-modal-box > * {
  flex-shrink: 0;
}

.ink-modal-box > .tier-cards-list,
.ink-modal-box > .task-grid-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 8px;
  margin-right: -8px;              /* keep cards aligned with the header */
}

/* Firefox only: Chromium/Safari use the rounded ::-webkit-scrollbar below
   (setting scrollbar-width there would switch those styles off). */
@supports not selector(::-webkit-scrollbar) {
  .ink-modal-box > .tier-cards-list,
  .ink-modal-box > .task-grid-list {
    scrollbar-width: thin;
    scrollbar-color: var(--ink-gold) transparent;
  }
}

.ink-modal-box > .tier-cards-list::-webkit-scrollbar,
.ink-modal-box > .task-grid-list::-webkit-scrollbar {
  width: 6px;
}

.ink-modal-box > .tier-cards-list::-webkit-scrollbar-track,
.ink-modal-box > .task-grid-list::-webkit-scrollbar-track {
  background: rgba(179, 136, 47, 0.08);
  border-radius: 999px;
  margin: 4px 0;
}

.ink-modal-box > .tier-cards-list::-webkit-scrollbar-thumb,
.ink-modal-box > .task-grid-list::-webkit-scrollbar-thumb {
  background: var(--ink-gold);
  border-radius: 999px;
}

.ink-modal-box > .tier-cards-list::-webkit-scrollbar-button,
.ink-modal-box > .task-grid-list::-webkit-scrollbar-button {
  display: none;
}

.ink-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--ink-border-wash);
  padding-bottom: 10px;
}

.modal-badge-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-icon-badge {
  font-size: 1.25rem;
  line-height: 1;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink-dark);
  margin: 0;
  letter-spacing: 0.5px;
}

.modal-close-icon {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--ink-mountain-wash);
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.18s ease;
}

.modal-close-icon:hover {
  color: var(--ink-cinnabar);
  background: rgba(168, 50, 38, 0.08);
}

.modal-description {
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink-mountain-wash);
  margin: 8px 0 16px 0;
}

/* Tier cards list */
.tier-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.tier-card {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.02);
}

.tier-card.tier-miracle {
  border-color: rgba(179, 136, 47, 0.45);
  background: rgba(179, 136, 47, 0.08);
}

.tier-card.tier-breakthrough {
  border-color: rgba(179, 136, 47, 0.25);
  background: rgba(179, 136, 47, 0.04);
}

.tier-card.tier-compatible {
  border-color: rgba(0, 163, 133, 0.25);
  background: rgba(0, 163, 133, 0.04);
}

.tier-card.tier-challenges {
  border-color: rgba(168, 50, 38, 0.25);
  background: rgba(168, 50, 38, 0.04);
}

.tier-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.tier-range {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-gold);
}

.tier-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-dark);
}

.tier-body {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-mountain-wash);
}

/* Task grid list */
.task-grid-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.task-chip {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--ink-border-wash);
  background: var(--ink-gold-light);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.task-chip-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink-gold);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
}

.task-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-dark);
}

.task-affirmation {
  font-size: 0.76rem;
  font-style: italic;
  color: var(--ink-mountain-wash);
  padding-left: 24px;
}

.modal-footer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.btn-modal-close {
  background: var(--ink-gold);
  color: #ffffff;
  border: none;
  padding: 7px 18px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-modal-close:hover {
  background: #996e1e;
}

/* ==========================================================================
   Global Context Helper & Tooltip System
   ========================================================================== */
/* The ⓘ button sits inside score labels that are often uppercase, bold,
   letter-spaced or centred; these resets keep it (and its tooltip) neutral. */
.context-helper-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
  text-transform: none !important;
  font-style: normal !important;
  letter-spacing: normal !important;
  font-weight: 400 !important;
  text-align: center !important;
  text-shadow: none !important;
}

.context-helper-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  color: var(--ink-gold);
  transition: color 0.18s ease, transform 0.18s ease;
  text-transform: none !important;
  font-style: normal !important;
  letter-spacing: normal !important;
}

.context-helper-btn:hover {
  color: var(--ink-cinnabar);
  transform: scale(1.1);
}

.context-helper-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.context-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(220px, 80vw);
  padding: 6px 10px;
  background: #232220;
  color: #f7f3e8;
  font-size: 0.72rem;
  line-height: 1.35;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  white-space: normal;
  text-align: center !important;
  text-transform: none !important;
  font-style: normal !important;
  letter-spacing: normal !important;
  font-weight: 500 !important;
  text-shadow: none !important;
}

/* Popups are moved to the end of <body> on load (base.html), so they only
   inherit from <body>; this sets their own neutral type baseline. */
.ink-modal-dialog {
  color: var(--ink-dark);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.45;
  letter-spacing: normal;
  text-align: left;
  text-transform: none;
  text-shadow: none;
  white-space: normal;
}

.context-helper-wrap:hover .context-tooltip,
.context-helper-wrap:focus-within .context-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(-2px);
}

/* =====================================================================
   PP bullet — two-lobe feng huo lun mark for list items
   Use on a ::before (content: "") or an empty span; sized in em so it
   follows the text. Colour comes from background-color.
   ===================================================================== */
.pp-bullet,
.faq-list li::before,
.pp-legal-section li::before,
.about-not-list li::before {
    content: "";
    flex: none;
    width: 0.85em;
    height: 0.85em;
    background-color: var(--ink-gold);
    -webkit-mask: var(--pp-bullet) center / contain no-repeat;
    mask: var(--pp-bullet) center / contain no-repeat;
}

/* Inline SVG version (#icon-pp-bullet) — takes the text colour, so it
   works on gold or coloured backgrounds. Size it per context. */
.pp-bullet-icon {
    flex: none;
    display: block;
    width: 1em;
    height: 1em;
    stroke: currentColor;
}

.ink-menu-avatar .pp-bullet-icon { width: 22px; height: 22px; }
.pp-legal-num .pp-bullet-icon { width: 15px; height: 15px; }
.activate-icon-pulse .pp-bullet-icon { width: 1.15em; height: 1.15em; }

/* =====================================================================
   Language switch — EN | 中文 segmented control (data-pp-lang-set)
   ===================================================================== */
.pp-lang-switch {
    display: inline-flex;
    flex: none;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    border: 1px solid var(--ink-border-wash);
    background: var(--glass-tile);
}

.pp-lang-switch button {
    height: 28px;
    margin: 0;
    padding: 0 12px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--ink-mountain-wash);
    font: inherit;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 28px;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.pp-lang-switch button[aria-pressed="true"] {
    background: var(--ink-gold);
    color: #ffffff;
}

.pp-lang-switch button:focus-visible {
    outline: 2px solid var(--ink-gold);
    outline-offset: 2px;
}

/* Report start on the check pages: scrolled into view after a check,
   offset so the sticky header doesn't cover it */
.report-start { scroll-margin-top: calc(var(--pp-header-h, 60px) + 12px); }   /* header is ~60px */
