/* ==========================================================================
   Divine Chat — styles (Light theme · 晨曦白金 Dawn White-Gold)
   Cream paper background, deep cocoa text, warm gold accent.
   Like opening a leather-bound Bible in morning light.
   ========================================================================== */

:root {
  --bg:            #faf6ed;
  --bg-panel:      rgba(255, 250, 240, 0.92);
  --bg-panel-2:    rgba(255, 247, 230, 0.92);
  --ink:           #2d2418;
  --ink-dim:       #6b5a45;
  --accent:        #c89849;
  --accent-dim:    #a67b32;
  --accent-light:  #e7c478;
  --ruby:          #8c2a3c;
  --sapphire:      #2a4d8c;
  --emerald:       #2f6b4f;
  --amethyst:      #5a3d7a;
  --line:          rgba(200, 152, 73, 0.32);
  --line-soft:     rgba(45, 36, 24, 0.10);
  --radius:        14px;
  --shadow-soft:   0 6px 24px rgba(60, 40, 0, 0.10);
  --shadow-inner:  inset 0 0 40px rgba(200, 152, 73, 0.05);
  --font-serif:    "Noto Serif TC", "Noto Serif JP", "Noto Serif KR", "Source Han Serif TC", "Georgia", "Times New Roman", serif;
  --font-sans:     "Noto Sans TC", "Noto Sans JP", "Noto Sans KR", "Source Han Sans TC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #fffaf0 0%, var(--bg) 60%) fixed;
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; }

.sr-only { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.stained-glass {
  position: fixed; inset: 0; z-index: -1;
  /* Soft radial glow — radial-gradient itself is cheap. We dropped the 28px
     `filter: blur(28px)` and the 24s infinite `glassShift` transform: keeping
     them forced the browser to repaint a full-viewport blurred composite layer
     on every animation frame and was the dominant cause of global jank on
     mobile. Slightly widened the gradient falloff so the look is still soft. */
  background:
    radial-gradient(circle at 12% 18%, rgba(140, 42, 60, 0.10), transparent 55%),
    radial-gradient(circle at 85% 22%, rgba(42, 77, 140, 0.10), transparent 55%),
    radial-gradient(circle at 30% 85%, rgba(47, 107, 79, 0.09), transparent 55%),
    radial-gradient(circle at 80% 90%, rgba(90, 61, 122, 0.10), transparent 55%);
  opacity: 0.85;
  pointer-events: none;
}

.chapel-header {
  display: flex; align-items: center; gap: 18px;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--line);
  /* Dropped `backdrop-filter: blur(4px)` — it forced a GPU composite layer and
     added a paint cost on every scroll/tap. The header sits over the page
     background anyway; an opaque cream tint reads the same. */
  background: rgba(255, 250, 240, 0.92);
  position: relative;     /* establish stacking context */
  z-index: 100;           /* keep header (and the account dropdown inside) above .app-views content */
}
.account-wrap { z-index: 101; }   /* dropdown's parent — must be above neighboring header children */
.cross {
  font-size: 34px; color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(200, 152, 73, 0.35));
  line-height: 1;
}
.titles h1 { font-family: var(--font-serif); font-size: 26px; margin: 0; letter-spacing: 4px; color: var(--ink); }
.titles .subtitle { margin: 0; font-size: 13px; color: var(--ink-dim); letter-spacing: 1.5px; }
.header-actions { margin-left: auto; }

/* Language picker — minimal, gold-toned (no blue globe emoji, no harsh borders) */
.lang-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.lang-select-wrap:hover {
  background: rgba(200, 152, 73, 0.10);
  border-color: var(--line);
  color: var(--ink);
}
.lang-icon {
  display: inline-grid;
  place-items: center;
  color: var(--accent-dim);   /* gold, not blue */
  width: 16px; height: 16px;
  flex-shrink: 0;
}
.lang-icon svg { display: block; }
.lang-select {
  background: transparent;
  color: var(--ink);
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 0;
  cursor: pointer;
  letter-spacing: 0.3px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 16px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%23a67b32' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right center;
}
.lang-select option {
  background: #fffaf0;
  color: var(--ink);
  font-family: var(--font-sans);
}

.chapel-main {
  flex: 1;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  padding: 24px 28px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}
@media (max-width: 900px) {
  .chapel-main { grid-template-columns: 1fr; padding: 16px; }
}

.rail { display: flex; flex-direction: column; gap: 14px; }

.candles { display: flex; justify-content: center; gap: 14px; padding: 4px 0 2px; }
.candle  { width: 8px; height: 36px; background: linear-gradient(#f5ecd2, #d4c39a); border-radius: 3px; position: relative; }
.candle .flame {
  position: absolute; top: -14px; left: 50%;
  width: 10px; height: 16px;
  background: radial-gradient(circle at 50% 65%, #fff5c2 0%, #ffb347 55%, rgba(255,100,0,0) 80%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  transform: translateX(-50%);
  filter: blur(0.4px);
  animation: flicker 2.3s ease-in-out infinite alternate;
  box-shadow: 0 0 14px rgba(255, 170, 70, 0.55);
}
.candle:nth-child(2) .flame { animation-duration: 1.7s; }
.candle:nth-child(3) .flame { animation-duration: 2.9s; }
@keyframes flicker {
  0%   { transform: translateX(-50%) scale(1, 1);      opacity: 0.95; }
  50%  { transform: translateX(-50%) scale(1.05, 0.9); opacity: 1;    }
  100% { transform: translateX(-50%) scale(0.95, 1.1); opacity: 0.85; }
}

.picker {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 10px;
}
.picker-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-family: var(--font-serif);
}
.picker-title { font-size: 14px; letter-spacing: 1.5px; color: var(--accent-dim); }
.picker-count { font-size: 11px; color: var(--ink-dim); letter-spacing: 1px; }

.picker-tabs { display: flex; gap: 6px; }
.picker-tab {
  flex: 1;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--ink-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: var(--font-sans);
}
.picker-tab:hover { color: var(--ink); background: rgba(200, 152, 73, 0.06); }
.picker-tab.is-active {
  background: linear-gradient(180deg, rgba(200, 152, 73, 0.22), rgba(200, 152, 73, 0.08));
  color: var(--accent-dim);
  border-color: rgba(200, 152, 73, 0.55);
  font-weight: 600;
}

.picker-search {
  width: 100%;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 7px 10px;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
}
.picker-search::placeholder { color: var(--ink-dim); font-style: italic; }
.picker-search:focus { border-color: var(--accent-dim); background: #fff; }

.picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}
.picker-grid::-webkit-scrollbar { width: 6px; }
.picker-grid::-webkit-scrollbar-thumb { background: rgba(200, 152, 73, 0.4); border-radius: 3px; }

.picker-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
  transition: border-color 0.15s, background 0.15s;
  font-family: var(--font-sans);
  text-align: left;
  color: var(--ink);
}
.picker-card:hover { background: rgba(200, 152, 73, 0.12); }
.picker-card.is-active {
  border-color: rgba(200, 152, 73, 0.55);
  background: linear-gradient(180deg, rgba(200, 152, 73, 0.22), rgba(200, 152, 73, 0.08));
  box-shadow: inset 0 0 0 1px rgba(200, 152, 73, 0.20);
  color: var(--accent-dim);
  font-weight: 600;
}
.picker-card .pc-icon { font-size: 18px; line-height: 1; flex-shrink: 0; }
.picker-card .pc-name {
  font-size: 13px;
  letter-spacing: 0.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow-soft);
}
.mode-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-dim);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-family: var(--font-sans);
}
.mode-btn .mode-icon { font-size: 18px; }
.mode-btn .mode-label { font-size: 12px; letter-spacing: 1px; }
.mode-btn:hover { color: var(--ink); background: rgba(200, 152, 73, 0.06); }
.mode-btn.is-active {
  color: var(--accent-dim);
  font-weight: 600;
  border-color: rgba(200, 152, 73, 0.55);
  background: linear-gradient(180deg, rgba(200, 152, 73, 0.22), rgba(200, 152, 73, 0.06));
}

.ghost-btn {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--ink-dim);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  font-family: var(--font-sans);
}
.ghost-btn:hover { color: var(--accent-dim); border-color: var(--accent-dim); background: rgba(200, 152, 73, 0.06); }

.donate-card {
  margin-top: auto;
  padding: 14px 14px 16px;
  background: linear-gradient(180deg, rgba(212, 162, 76, 0.18), rgba(140, 42, 60, 0.08));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.donate-title { font-family: var(--font-serif); font-size: 15px; letter-spacing: 2px; margin: 0 0 6px; color: var(--ruby); }
.donate-text  { font-size: 12px; color: var(--ink-dim); margin: 0 0 12px; line-height: 1.55; }
.donate-btn {
  width: 100%;
  font-family: var(--font-serif);
  background: linear-gradient(180deg, #e7b55c, var(--accent-dim));
  color: #2a1d0a;
  border: none;
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px; letter-spacing: 2px;
  box-shadow: 0 4px 14px rgba(200, 152, 73, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
}
.donate-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(200, 152, 73, 0.5); }

.dialogue {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  min-height: 70vh;
  box-shadow: var(--shadow-soft), var(--shadow-inner);
}

.priest-banner {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(200, 152, 73, 0.14), rgba(200, 152, 73, 0.02));
  border: 1px solid var(--line);
  border-radius: 12px;
}
.halo {
  flex: 0 0 64px;
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 28px;
  background: radial-gradient(circle at 50% 40%, #fff5c2 0%, #e7b55c 50%, rgba(212, 162, 76, 0) 80%);
  box-shadow: 0 0 24px rgba(231, 181, 92, 0.55);
  color: #3a2a0a;
  font-family: var(--font-serif);
}
.priest-text { flex: 1; min-width: 0; }
.priest-name  { margin: 0 0 2px; font-family: var(--font-serif); font-size: 19px; letter-spacing: 2px; color: var(--ink); }
.priest-era   { margin: 0 0 6px; font-size: 12px; color: var(--ink-dim); letter-spacing: 1px; }
.priest-blurb { margin: 0 0 8px; font-size: 13px; color: var(--ink-dim); line-height: 1.55; }
.priest-line  { margin: 0; font-family: var(--font-serif); font-size: 14px; color: var(--ink); }

.scenarios { display: flex; flex-wrap: wrap; gap: 8px; }
.scenario-chip {
  font-family: var(--font-sans);
  font-size: 12.5px;
  background: rgba(200, 152, 73, 0.10);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
  letter-spacing: 0.3px;
}
.scenario-chip:hover { background: rgba(200, 152, 73, 0.22); border-color: rgba(200, 152, 73, 0.55); }
.scenario-chip:active { transform: translateY(1px); }
.scenario-chip:disabled { opacity: 0.5; cursor: not-allowed; }

.messages {
  flex: 1;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
  padding: 4px 2px;
  scroll-behavior: smooth;
}
.msg {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(180deg, rgba(42, 77, 140, 0.14), rgba(42, 77, 140, 0.05));
  border-color: rgba(42, 77, 140, 0.30);
  color: var(--ink);
}
.msg.priest {
  align-self: flex-start;
  background: linear-gradient(180deg, rgba(200, 152, 73, 0.12), rgba(200, 152, 73, 0.03));
  border-color: rgba(200, 152, 73, 0.35);
  font-family: var(--font-serif);
  line-height: 1.85;
  position: relative;
  color: var(--ink);
}
.msg.priest::before {
  content: attr(data-icon);
  position: absolute;
  top: -10px; left: -10px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fffaf0;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(200, 152, 73, 0.55);
}
.msg.error {
  align-self: center;
  color: var(--ruby);
  background: rgba(140, 42, 60, 0.08);
  border-color: rgba(140, 42, 60, 0.30);
  font-size: 13px;
}
/* Cursor blink: animate opacity (compositor-only, no repaint each frame) instead
   of visibility (which forced a paint every 500ms during streaming). */
.msg .cursor {
  display: inline-block;
  width: 8px;
  margin-left: 2px;
  color: var(--accent-dim);
  animation: blink 1s steps(2, start) infinite;
  will-change: opacity;
}
@keyframes blink { 50% { opacity: 0; } }

.composer {
  display: flex; gap: 10px; align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
}
.composer textarea {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  outline: none;
  max-height: 40vh;
  padding: 8px 10px;
}
.composer textarea::placeholder { color: var(--ink-dim); font-style: italic; }
.send-btn {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  flex-shrink: 0;
  border: none; border-radius: 50%;
  background: linear-gradient(180deg, #e7b55c, var(--accent-dim));
  color: #2a1d0a;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 14px rgba(200, 152, 73, 0.30);
}
.send-btn:hover { transform: translateY(-1px); }
.send-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.send-icon { font-size: 20px; line-height: 1; }

.disclaimer {
  font-size: 11.5px;
  color: var(--ink-dim);
  text-align: center;
  margin: 6px 0 0;
  line-height: 1.5;
}

.chapel-footer {
  padding: 14px 28px 22px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 2px;
}

/* ==========================================================================
   Auth: 登入按鈕、帳戶下拉、登入 modal
   ========================================================================== */

/* -- 登入按鈕 ------------------------------------------------------------- */
.auth-btn {
  font-family: var(--font-serif);
  background: linear-gradient(180deg, #e7b55c, var(--accent-dim));
  color: #2a1d0a;
  border: none;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(200, 152, 73, 0.30);
  transition: transform 0.15s, box-shadow 0.2s;
  font-weight: 600;
}
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(200, 152, 73, 0.45); }

/* -- 帳戶下拉 ------------------------------------------------------------- */
.account-wrap { position: relative; }
.account-btn {
  display: inline-grid;
  place-items: center;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s, border-color 0.15s;
}
.account-btn:hover { background: rgba(200, 152, 73, 0.10); border-color: var(--accent-dim); }
.account-avatar {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(180deg, #e7b55c, var(--accent-dim));
  color: #fffaf0;
  font-size: 16px;
  font-weight: 700;
  overflow: hidden;
}
/* Username + caret hidden in the header button — full email/name still shown
   inside the dropdown menu (.account-menu-header). */
.account-name,
.account-caret { display: none; }

.account-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 260px;
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(60, 40, 0, 0.18);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
  z-index: 2000;  /* above everything except modals (which use 1000+ but rendered fixed/inset:0) */
}
.account-menu.is-open { opacity: 1; visibility: visible; transform: none; }

/* User info header inside the dropdown */
.account-menu-header {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 10px 12px;
}
.account-menu-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border: 1px solid rgba(200, 152, 73, 0.55);
  font-size: 24px;
  box-shadow: 0 2px 6px rgba(200, 152, 73, 0.30);
}
.account-menu-info { min-width: 0; }
.account-menu-display-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-menu-email {
  font-size: 11.5px;
  color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-menu-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 6px;
}

.account-menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.account-menu-item:hover { background: rgba(200, 152, 73, 0.12); color: var(--accent-dim); }
.account-menu-icon { font-size: 16px; width: 20px; text-align: center; }
.account-menu-item-danger:hover { color: var(--ruby); background: rgba(140, 42, 60, 0.08); }

/* ---- Profile modal — edit avatar + display name + bio ---- */
.profile-dialog {
  max-width: 480px;
}
.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0 16px;
}
.profile-avatar-current {
  width: 88px; height: 88px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 44px;
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border: 2px solid rgba(200, 152, 73, 0.55);
  box-shadow: 0 4px 14px rgba(200, 152, 73, 0.35);
}
.profile-avatar-change {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--accent-dim);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.profile-avatar-change:hover {
  background: rgba(200, 152, 73, 0.12);
  color: var(--ink);
  border-color: var(--accent-dim);
}

/* Upload photo button next to "choose emoji" */
.profile-avatar-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.profile-avatar-upload {
  background: linear-gradient(180deg, #fff5d8, #e7c478);
  border: 1px solid var(--accent);
  color: var(--ink);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.profile-avatar-upload:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200, 152, 73, 0.40);
}
.profile-avatar-hint {
  font-size: 11px;
  color: var(--ink-dim);
  margin: 8px 0 0;
  text-align: center;
}

/* Avatar circle: support both emoji (text) and uploaded image.
   Universal rule: any avatar slot that has an <img> must clip it to a circle. */
.profile-avatar-current,
.home-profile-avatar,
.account-menu-avatar,
.account-avatar,
.pc-icon,
.friend-card-incoming .pc-icon,
.friend-card-outgoing .pc-icon {
  overflow: hidden;
}
.profile-avatar-current img,
.home-profile-avatar img,
.account-menu-avatar img,
.account-avatar img,
.pc-icon img,
.friend-card-incoming .pc-icon img,
.friend-card-outgoing .pc-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
/* When showing an image, remove emoji's text font sizing & padding to avoid clipping */
.profile-avatar-current:has(img),
.home-profile-avatar:has(img),
.account-menu-avatar:has(img),
.account-avatar:has(img),
.pc-icon:has(img) {
  font-size: 0;
  padding: 0;
}

/* Language select inside profile modal (replaces old top-header picker) */
.modal-lang-select {
  width: 100%;
  background: linear-gradient(180deg, #fff7e2, #fffaf0);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%23a67b32' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.15s;
}
.modal-lang-select:focus { border-color: var(--accent-dim); }
.modal-lang-select option {
  background: #fffaf0;
  color: var(--ink);
}

/* ============================================================================
   Phase B1.3: real-user friends list (真人好友 tab)
   ============================================================================ */

.friends-section-header {
  font-family: var(--font-serif);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--accent-dim);
  padding: 12px 8px 6px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 4px;
}
.friends-section-header:first-child { padding-top: 4px; }

/* Friends empty state */
.friends-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--ink-dim);
}
.friends-empty p { margin: 4px 0; font-size: 14px; }
.friends-empty-hint { font-size: 12.5px; color: var(--ink-dim); line-height: 1.65; }

/* Incoming friend request card — needs space for accept/reject buttons */
.friend-card-incoming {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  padding: 10px;
  align-items: center;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(200, 152, 73, 0.10), transparent);
  border: 1px solid rgba(200, 152, 73, 0.35);
  margin-bottom: 4px;
}
.friend-card-incoming .pc-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border: 1px solid rgba(200, 152, 73, 0.5);
  font-size: 22px;
  flex-shrink: 0;
}
.friend-card-body { min-width: 0; }
.friend-card-body .pc-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.friend-card-body .pc-era {
  font-size: 11px;
  color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.friend-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.friend-action {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  transition: background 0.15s, transform 0.15s;
}
.friend-accept {
  background: linear-gradient(180deg, #e7b55c, var(--accent-dim));
  color: #2a1d0a;
  box-shadow: 0 2px 6px rgba(200, 152, 73, 0.30);
}
.friend-accept:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(200, 152, 73, 0.45); }
.friend-reject {
  background: transparent;
  color: var(--ink-dim);
  border-color: var(--line);
}
.friend-reject:hover {
  background: rgba(140, 42, 60, 0.10);
  color: var(--ruby);
  border-color: rgba(140, 42, 60, 0.40);
}

/* Outgoing (waiting on them) card — same row layout as friend but greyed out */
.friend-card-outgoing {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  padding: 10px;
  align-items: center;
  border-radius: 12px;
  opacity: 0.72;
  margin-bottom: 2px;
}
.friend-card-outgoing .pc-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border: 1px solid rgba(200, 152, 73, 0.4);
  font-size: 22px;
}
.friend-card-outgoing .pc-era {
  color: var(--accent-dim);
  font-style: italic;
}
.profile-avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 12px;
  background: rgba(255, 247, 226, 0.6);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 14px;
}
.profile-avatar-picker[hidden] { display: none; }
.profile-avatar-option {
  width: 100%;
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid transparent;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.profile-avatar-option:hover {
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border-color: var(--accent);
  transform: scale(1.08);
}
.profile-avatar-option.is-active {
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px #fffaf0;
}
.profile-form .auth-field { margin-bottom: 12px; }
.profile-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  background: #fffaf0;
  resize: vertical;
  min-height: 50px;
  outline: none;
}
.profile-form textarea:focus { border-color: var(--accent-dim); }
.profile-form input[readonly],
.profile-form input[disabled],
.profile-dialog input[readonly],
.profile-dialog input[disabled] {
  background: rgba(0, 0, 0, 0.03);
  color: var(--ink-dim);
  cursor: not-allowed;
}

/* Profile modal: make scrollable inside, since it's tall */
.profile-dialog {
  max-height: 88vh;
  overflow-y: auto;
}
.profile-dialog::-webkit-scrollbar { width: 6px; }
.profile-dialog::-webkit-scrollbar-thumb { background: rgba(200, 152, 73, 0.45); border-radius: 3px; }

.profile-section {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}
.profile-section:last-of-type { border-bottom: none; }
.profile-section-title {
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--accent-dim);
  margin: 0 0 12px;
}

/* Friend code field with copy button */
.profile-friend-code-wrap {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.profile-friend-code-wrap input {
  flex: 1;
  background: linear-gradient(180deg, #fff7e2, #fffaf0);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--ink);
  text-align: center;
}
.profile-copy-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 14px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s, border-color 0.15s;
}
.profile-copy-btn:hover { background: rgba(200, 152, 73, 0.10); border-color: var(--accent-dim); }
.profile-copy-btn.is-copied { background: rgba(47, 107, 79, 0.15); border-color: var(--emerald); }

/* Privacy toggle switch */
.profile-toggle-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
}
.profile-toggle {
  position: relative;
  display: inline-block;
  width: 42px; height: 22px;
  flex-shrink: 0;
}
.profile-toggle input {
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  cursor: pointer;
  z-index: 1;
}
.profile-toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  transition: background 0.2s;
}
.profile-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fffaf0;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.profile-toggle input:checked + .profile-toggle-slider {
  background: linear-gradient(180deg, #e7b55c, var(--accent-dim));
}
.profile-toggle input:checked + .profile-toggle-slider::before {
  transform: translateX(20px);
}

/* Subscription plan card */
.profile-plan {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #fff7e2, rgba(255, 250, 240, 0.5));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.profile-plan-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-plan-badge {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 2px 10px;
  border-radius: 999px;
  width: max-content;
  background: rgba(200, 152, 73, 0.18);
  color: var(--accent-dim);
}
.profile-plan-badge[data-plan="monthly"]  { background: rgba(42, 77, 140, 0.18); color: var(--sapphire); }
.profile-plan-badge[data-plan="yearly"]   { background: rgba(47, 107, 79, 0.18); color: var(--emerald); }
.profile-plan-badge[data-plan="lifetime"] { background: rgba(90, 61, 122, 0.18); color: var(--amethyst); }
.profile-plan-detail { font-size: 12px; color: var(--ink-dim); }
.profile-upgrade-btn {
  background: linear-gradient(180deg, #e7b55c, var(--accent-dim));
  border: none;
  color: #2a1d0a;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 1px;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(200, 152, 73, 0.35);
}
.profile-upgrade-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(200, 152, 73, 0.50); }

/* Danger zone */
.profile-danger-zone {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  text-align: center;
}
.profile-danger-btn {
  background: transparent;
  border: 1px solid rgba(140, 42, 60, 0.45);
  color: var(--ruby);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.profile-danger-btn:hover {
  background: rgba(140, 42, 60, 0.10);
  border-color: var(--ruby);
}

/* ============================================================================
   Phase A4: LINE-style bottom tab navigation + full-page views
   ============================================================================ */

body {
  padding-bottom: 70px;  /* space for bottom tab bar */
}

.app-views {
  flex: 1;
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 14px;
}
.app-view {
  display: none;
  flex-direction: column;
}
.app-view.is-active { display: flex; }
.view-scroll {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 4px;
}

/* Bottom tab bar (LINE-style) */
.bottom-tabs {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fffaf0;
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgba(60, 40, 0, 0.06);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px 4px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--ink-dim);
  font-family: var(--font-sans);
  transition: color 0.15s;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.is-active { color: var(--accent-dim); }
.tab-icon {
  font-size: 22px;
  filter: grayscale(0.4);
  transition: filter 0.15s, transform 0.15s;
}
.tab-btn.is-active .tab-icon {
  filter: none;
  transform: translateY(-1px);
}
.tab-label {
  font-size: 11px;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Home view */
.home-profile-card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  background: linear-gradient(135deg, #fff7e2, var(--bg-panel));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
}
.home-profile-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 32px;
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border: 1px solid rgba(200, 152, 73, 0.5);
  box-shadow: 0 2px 8px rgba(200, 152, 73, 0.30);
}
.home-profile-info { min-width: 0; }
.home-profile-name {
  font-family: var(--font-serif);
  font-size: 18px;
  letter-spacing: 1.5px;
  color: var(--ink);
  margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.home-profile-status {
  font-size: 12px;
  color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.home-profile-edit {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--accent-dim);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 1px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.home-profile-edit:hover {
  background: rgba(200, 152, 73, 0.10);
  color: var(--ink);
  border-color: var(--accent-dim);
}

.home-section {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow-soft);
}
.home-section-title {
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--accent-dim);
  margin: 0 0 10px 4px;
}

.home-services {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.home-service-item {
  background: transparent;
  border: 1px solid transparent;
  padding: 14px 8px;
  border-radius: 12px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-family: var(--font-sans);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.home-service-item:hover {
  background: rgba(200, 152, 73, 0.10);
  border-color: var(--line);
  transform: translateY(-1px);
}
.home-service-icon {
  font-size: 22px;
}
.home-service-label {
  font-size: 11.5px;
  color: var(--ink);
  letter-spacing: 0.5px;
  text-align: center;
}

/* Chat view: use full available space */
.view-chat .chat-panel {
  margin: 0;
  max-height: calc(100vh - 160px);
}

/* ============ Chat list (LINE-style) ============ */
/* The chat view has two panes that swap based on data-pane on the view section.
   When entering a conversation we slide it in from the right to give an
   instant-feeling tap response — even though display:none → flex itself takes
   some layout work, the GPU-composited slide masks the latency. */
.view-chat { overflow-x: hidden; }
.view-chat .chat-list-pane,
.view-chat .chat-conversation-pane { display: none; }
.view-chat[data-pane="list"]         .chat-list-pane {
  display: flex; flex-direction: column; gap: 8px;
  animation: pane-slide-in-left 0.14s cubic-bezier(.2,.8,.2,1);
}
.view-chat[data-pane="conversation"] .chat-conversation-pane {
  display: flex; flex-direction: column;
  animation: pane-slide-in-right 0.16s cubic-bezier(.2,.8,.2,1);
}
@keyframes pane-slide-in-right {
  from { transform: translateX(14%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes pane-slide-in-left {
  from { transform: translateX(-10%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

.chat-list-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 6px 12px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
}
.chat-list-header h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  letter-spacing: 3px;
  margin: 0;
  color: var(--ink);
}

.chat-list {
  display: flex; flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.chat-list-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-panel);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  text-align: left;
  font-family: inherit;
  color: inherit;
  width: 100%;
  /* Tell the browser this row is independent — paint/layout of one row
     cannot affect siblings. Big win when there are many rows. */
  contain: layout style paint;
}
.chat-list-row:hover,
.chat-list-row:focus-visible {
  background: rgba(200, 152, 73, 0.10);
  border-color: var(--line);
  outline: none;
}
.chat-list-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 26px;
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border: 1px solid rgba(200, 152, 73, 0.45);
  box-shadow: 0 2px 6px rgba(200, 152, 73, 0.20);
  flex-shrink: 0;
  overflow: hidden;
}
/* DM avatars carry a real-photo or letter avatar — drop the gold tint */
.chat-list-avatar-dm {
  background: linear-gradient(135deg, #efe7d3, #d8c69a);
  border-color: rgba(120, 96, 64, 0.35);
}
.chat-list-avatar-dm img,
.chat-list-avatar-dm > * {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  display: grid; place-items: center;
}

/* LINE-style unread pill (green) */
.chat-list-unread {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #2f6b4f;        /* emerald — readable on cream */
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 3px rgba(47, 107, 79, 0.4);
}
.chat-list-body { min-width: 0; }
.chat-list-name {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--ink);
  letter-spacing: 1px;
  margin: 0 0 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-list-preview {
  font-size: 12.5px;
  color: var(--ink-dim);
  margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-list-preview.is-self::before {
  content: "✓ ";
  color: var(--accent-dim);
  font-size: 11px;
}
.chat-list-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  min-width: 48px;
}
.chat-list-time {
  font-size: 11px;
  color: var(--ink-dim);
  white-space: nowrap;
}

.chat-list-empty,
.chat-list-needs-login {
  display: grid; place-items: center;
  text-align: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--ink-dim);
}
.chat-list-empty[hidden],
.chat-list-needs-login[hidden] { display: none; }
.chat-list-empty-icon { font-size: 44px; opacity: 0.7; }
.chat-list-empty h3,
.chat-list-needs-login h3 {
  font-family: var(--font-serif);
  font-size: 17px;
  margin: 0;
  color: var(--ink);
  letter-spacing: 1.5px;
}
.chat-list-empty p,
.chat-list-needs-login p {
  margin: 0 0 4px;
  font-size: 13px;
  max-width: 320px;
  line-height: 1.5;
}
.chat-list-empty-cta {
  margin-top: 6px;
  background: var(--accent);
  color: #fffaf0;
  border: none;
  padding: 9px 22px;
  border-radius: 999px;
  font-family: var(--font-sans);
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(200, 152, 73, 0.35);
  transition: background 0.15s, transform 0.15s;
}
.chat-list-empty-cta:hover { background: var(--accent-dim); transform: translateY(-1px); }

/* "Delete this conversation" sibling of "begin new" — quieter, ruby-tinted */
.chat-header-actions {
  display: inline-flex; gap: 8px; align-items: center;
  margin-left: auto;
}
.ghost-btn-danger {
  color: var(--ruby);
  border-color: rgba(140, 42, 60, 0.25);
}
.ghost-btn-danger:hover {
  background: rgba(140, 42, 60, 0.08);
  border-color: var(--ruby);
  color: var(--ruby);
}

/* ============ DM-mode conversation pane tweaks ============ */
/* When the conversation pane is rendering a 1-on-1 DM, hide the biblical chrome:
   mode tabs, character era/blurb/greeting, scenarios, "begin new"/"delete" buttons,
   and the AI disclaimer. Keep the avatar + name + back button + composer. */
.chat-conversation-pane[data-conv-type="dm"] .modes,
.chat-conversation-pane[data-conv-type="dm"] .priest-era,
.chat-conversation-pane[data-conv-type="dm"] .priest-blurb,
.chat-conversation-pane[data-conv-type="dm"] .priest-line,
.chat-conversation-pane[data-conv-type="dm"] .scenarios,
.chat-conversation-pane[data-conv-type="dm"] #new-session,
.chat-conversation-pane[data-conv-type="dm"] #delete-conversation,
.chat-conversation-pane[data-conv-type="dm"] .disclaimer {
  display: none !important;
}

/* In DM mode the peer's avatar replaces the gold halo — soften the tint */
.chat-conversation-pane[data-conv-type="dm"] .halo {
  background: linear-gradient(135deg, #efe7d3, #d8c69a);
  border-color: rgba(120, 96, 64, 0.35);
  overflow: hidden;
}
.chat-conversation-pane[data-conv-type="dm"] .halo img,
.chat-conversation-pane[data-conv-type="dm"] .halo > * {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  display: grid; place-items: center;
}

/* In DM mode, the "priest" bubble is the peer's reply — drop the gilded ::before icon */
.chat-conversation-pane[data-conv-type="dm"] .dialogue.chat-panel .msg.priest::before {
  display: none;
}
.chat-conversation-pane[data-conv-type="dm"] .dialogue.chat-panel .msg.priest {
  padding-left: 14px;
}

/* ============ Pricing page (燭光殿 · Phase E2.2.x) ============ */
.pricing-header {
  text-align: center;
  padding: 8px 8px 12px;
}
.pricing-header-icon {
  display: block;
  font-size: 40px;
  filter: drop-shadow(0 0 10px rgba(200, 152, 73, 0.45));
  margin-bottom: 8px;
}
.pricing-header h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  letter-spacing: 4px;
  margin: 0 0 6px;
  color: var(--ink);
}
.pricing-header-sub {
  font-size: 13px;
  color: var(--ink-dim);
  line-height: 1.7;
  max-width: 500px;
  margin: 0 auto;
}

.pricing-section {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 14px 0;
  box-shadow: var(--shadow-soft);
}
.pricing-section-title {
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: 2.5px;
  color: var(--accent-dim);
  margin: 0 0 6px;
}
.pricing-section-sub {
  font-size: 12.5px;
  color: var(--ink-dim);
  margin: 0 0 14px;
  line-height: 1.6;
}

/* My status card */
.pricing-status-card { padding: 14px 16px; }
.pricing-status-body { display: flex; flex-direction: column; gap: 4px; }
.pricing-status-line { margin: 0; font-size: 13.5px; color: var(--ink); }
.pricing-status-line.is-balance {
  font-family: var(--font-serif);
  font-size: 18px;
  letter-spacing: 1.5px;
}
.pricing-status-line.is-secondary {
  font-size: 12px;
  color: var(--ink-dim);
}

/* Subscription plan cards */
.pricing-plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 540px) {
  .pricing-plans { grid-template-columns: 1fr; }
}
.pricing-plan-card {
  position: relative;
  background: linear-gradient(180deg, #fff7e2, var(--bg-panel-2));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pricing-plan-card.pricing-plan-featured {
  border-color: var(--accent);
  box-shadow: 0 4px 18px rgba(200, 152, 73, 0.30);
}
.pricing-plan-badge {
  position: absolute;
  top: -10px; right: 14px;
  background: var(--accent);
  color: #2a1d0a;
  font-size: 10.5px;
  letter-spacing: 1.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(200, 152, 73, 0.40);
}
.pricing-plan-name {
  font-family: var(--font-serif);
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--ink);
}
.pricing-plan-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 4px 0 0;
}
.pricing-plan-amount {
  font-family: var(--font-serif);
  font-size: 24px;
  letter-spacing: 1px;
  color: var(--accent-dim);
}
.pricing-plan-period {
  font-size: 12.5px;
  color: var(--ink-dim);
}
.pricing-plan-usd {
  font-size: 11.5px;
  color: var(--ink-dim);
  margin-bottom: 4px;
}
.pricing-plan-features {
  list-style: none;
  padding: 0;
  margin: 6px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pricing-plan-features li {
  font-size: 12px;
  color: var(--ink);
  padding-left: 16px;
  position: relative;
  line-height: 1.5;
}
.pricing-plan-features li::before {
  content: '✓';
  position: absolute;
  left: 2px;
  color: var(--accent-dim);
}
.pricing-plan-cta,
.pricing-pack-cta {
  margin-top: auto;
  background: var(--accent);
  color: #fffaf0;
  border: none;
  padding: 9px 16px;
  border-radius: 999px;
  font-family: var(--font-sans);
  letter-spacing: 1.5px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(200, 152, 73, 0.30);
  transition: background 0.15s, transform 0.15s;
}
.pricing-plan-cta:hover,
.pricing-pack-cta:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
}
.pricing-plan-cta:disabled,
.pricing-pack-cta:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* Candle packs */
.pricing-packs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 540px) {
  .pricing-packs { grid-template-columns: 1fr; }
}
.pricing-pack-card {
  position: relative;
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 10px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.pricing-pack-card.pricing-pack-featured {
  border-color: var(--accent);
  background: linear-gradient(180deg, #fff7e2, var(--bg-panel-2));
}
.pricing-pack-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #2a1d0a;
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.pricing-pack-badge-value { background: var(--emerald); color: #fffaf0; }
.pricing-pack-emoji {
  font-size: 22px;
  letter-spacing: -2px;
}
.pricing-pack-name {
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 1.5px;
  color: var(--ink);
}
.pricing-pack-count {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--accent-dim);
  letter-spacing: 1px;
}
.pricing-pack-price {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--ink);
}
.pricing-pack-usd {
  font-size: 11px;
  color: var(--ink-dim);
  margin-bottom: 6px;
}
.pricing-pack-cta { padding: 7px 14px; font-size: 12px; width: 100%; }

/* FAQ */
.pricing-faq {
  border-top: 1px solid var(--line-soft);
  padding: 10px 0;
}
.pricing-faq:first-of-type { border-top: none; padding-top: 0; }
.pricing-faq summary {
  font-family: var(--font-serif);
  font-size: 13.5px;
  letter-spacing: 1px;
  color: var(--ink);
  cursor: pointer;
  padding: 4px 0;
  list-style: none;
  position: relative;
  padding-left: 20px;
}
.pricing-faq summary::-webkit-details-marker { display: none; }
.pricing-faq summary::before {
  content: '+';
  position: absolute;
  left: 2px;
  color: var(--accent-dim);
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  transition: transform 0.15s;
}
.pricing-faq[open] summary::before { content: '−'; }
.pricing-faq p {
  margin: 6px 0 4px 20px;
  font-size: 12.5px;
  color: var(--ink-dim);
  line-height: 1.7;
}

.pricing-fineprint {
  text-align: center;
  font-size: 11px;
  color: var(--ink-dim);
  margin: 16px 8px 8px;
  line-height: 1.6;
}

/* ============ Candle status card on Home (Phase E2.2) ============ */
.home-candle-card { padding: 14px 14px; }
.home-candle-body {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
}
.home-candle-icon {
  font-size: 26px;
  filter: drop-shadow(0 0 6px rgba(200, 152, 73, 0.35));
}
.home-candle-info { min-width: 0; }
.home-candle-balance {
  font-family: var(--font-serif);
  font-size: 16px;
  letter-spacing: 1.5px;
  color: var(--ink);
  margin-bottom: 2px;
}
.home-candle-sub {
  font-size: 11.5px;
  color: var(--ink-dim);
  letter-spacing: 0.5px;
}
.home-candle-card.is-low .home-candle-balance { color: var(--accent-dim); }
.home-candle-card.is-empty .home-candle-balance { color: var(--ruby); }
.home-candle-cta {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--accent-dim);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.home-candle-cta:hover {
  background: rgba(200, 152, 73, 0.10);
  color: var(--ink);
  border-color: var(--accent-dim);
}
.home-candle-cta[hidden] { display: none; }

/* ============ Groups view (Phase E2.1) ============ */
.view-groups { overflow-x: hidden; }
.view-groups .group-list-pane,
.view-groups .group-conversation-pane { display: none; }
.view-groups[data-pane="list"]         .group-list-pane {
  display: flex; flex-direction: column; gap: 8px;
  animation: pane-slide-in-left 0.14s cubic-bezier(.2,.8,.2,1);
}
.view-groups[data-pane="conversation"] .group-conversation-pane {
  display: flex; flex-direction: column;
  animation: pane-slide-in-right 0.16s cubic-bezier(.2,.8,.2,1);
}

/* Group list rows reuse chat-list row styling for visual consistency.
   The list container itself reuses #group-list which has class .chat-list. */
#group-list .chat-list-avatar.group-icon {
  background: linear-gradient(135deg, #f3e8d0, #d4b88c);
  border-color: rgba(120, 96, 64, 0.4);
}
.chat-list-row-group .chat-list-avatar { font-size: 22px; }

/* Group conversation panel: members strip just under banner */
.group-members-strip {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 14px 0;
  font-size: 11px;
  color: var(--ink-dim);
}
.group-member-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 4px;
  background: var(--bg-panel);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
}
.group-member-chip-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px;
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  flex-shrink: 0;
  overflow: hidden;
}
.group-member-chip-avatar img,
.group-member-chip-avatar > * { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: grid; place-items: center; }
.group-member-chip.is-ai { border-color: rgba(200, 152, 73, 0.4); }
.group-member-chip-name {
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* Group composer with @ button on the left */
.group-mention-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 50%;
  color: var(--accent-dim);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.group-mention-btn:hover {
  background: rgba(200, 152, 73, 0.12);
  color: var(--ink);
}

/* Group messages — render with sender label/avatar above the bubble */
.group-msg-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 8px;
  margin: 8px 0;
  align-items: flex-start;
  contain: layout style;
}
.group-msg-row.is-self {
  grid-template-columns: 1fr 32px;
}
.group-msg-row.is-self .group-msg-avatar { order: 2; }
.group-msg-row.is-self .group-msg-body   { order: 1; align-items: flex-end; }
.group-msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 16px;
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border: 1px solid rgba(200, 152, 73, 0.40);
  overflow: hidden;
  flex-shrink: 0;
}
.group-msg-avatar img,
.group-msg-avatar > * {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  display: grid; place-items: center;
}
.group-msg-body {
  display: flex; flex-direction: column; align-items: flex-start;
  min-width: 0;
}
.group-msg-sender {
  font-size: 11px;
  color: var(--ink-dim);
  margin-bottom: 2px;
  letter-spacing: 0.5px;
}
.group-msg-sender.is-ai {
  color: var(--accent-dim);
  font-weight: 600;
}
.group-msg-bubble {
  max-width: 78%;
  padding: 8px 13px;
  border-radius: 14px;
  background: var(--bg-panel);
  border: 1px solid var(--line-soft);
  word-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.55;
}
.group-msg-row.is-self .group-msg-bubble {
  background: linear-gradient(135deg, #e7c478, #d4a85c);
  color: #2a1d0a;
  border-color: rgba(200, 152, 73, 0.45);
}
.group-msg-row.is-ai .group-msg-bubble {
  background: rgba(255, 247, 230, 0.95);
  border-color: rgba(200, 152, 73, 0.30);
}

/* ---- Swipe-to-reveal action buttons on group list rows ---- */
.group-row-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  touch-action: pan-y;   /* allow vertical scroll, horizontal pan handled by JS */
  contain: layout style paint;
}
.group-row-actions {
  position: absolute;
  inset: 0 0 0 auto;
  display: flex;
  align-items: stretch;
  z-index: 0;
}
.group-row-action {
  width: 64px;
  border: none;
  cursor: pointer;
  color: #fffaf0;
  font-size: 12px;
  letter-spacing: 1.5px;
  display: grid;
  place-items: center;
  font-family: var(--font-sans);
  font-weight: 600;
}
.group-row-action[hidden] { display: none; }
.group-row-action-hide   { background: #6b5a45; }   /* cocoa */
.group-row-action-leave  { background: var(--accent-dim); }
.group-row-action-delete { background: var(--ruby); }
.group-row-front {
  position: relative;
  z-index: 1;
  background: var(--bg-panel);
  transition: transform 0.22s ease-out;
  width: 100%;
  /* Stay the same shape as a normal chat-list-row — let the .chat-list-row
     classes handle layout; we just need positioning + bg. */
}

/* ---- Group members modal ---- */
.group-members-dialog { max-width: 440px; }
.group-members-list {
  display: flex; flex-direction: column;
  gap: 4px;
  margin-top: 14px;
  max-height: 60vh;
  overflow-y: auto;
}
.group-members-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 10px;
  transition: background 0.12s;
}
.group-members-row:hover { background: rgba(200, 152, 73, 0.06); }
.group-members-row.is-ai .group-members-row-role { color: var(--accent-dim); }
.group-members-row-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 20px;
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border: 1px solid rgba(200, 152, 73, 0.45);
  overflow: hidden;
}
.group-members-row-avatar img,
.group-members-row-avatar > * { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: grid; place-items: center; }
.group-members-row-body { display: flex; flex-direction: column; min-width: 0; }
.group-members-row-name {
  font-size: 14px;
  color: var(--ink);
  letter-spacing: 0.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.group-members-row-role {
  font-size: 11px;
  color: var(--ink-dim);
}
.group-members-row-kick {
  background: transparent;
  border: 1px solid rgba(140, 42, 60, 0.4);
  color: var(--ruby);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.group-members-row-kick:hover { background: rgba(140, 42, 60, 0.1); }
.group-members-add-btn {
  display: block;
  margin: 10px auto 0;
  padding: 6px 16px;
  background: transparent;
  border: 1px dashed rgba(200, 152, 73, 0.55);
  border-radius: 999px;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.group-members-add-btn:hover { background: rgba(200, 152, 73, 0.08); }

/* Quota exceeded banner that briefly appears below the composer */
.group-quota-banner {
  margin: 6px 14px 0;
  padding: 8px 12px;
  background: rgba(140, 42, 60, 0.10);
  border: 1px solid rgba(140, 42, 60, 0.25);
  border-radius: 10px;
  color: var(--ruby);
  font-size: 12px;
  text-align: center;
}

/* Create-group modal */
.group-create-dialog { max-width: 480px; }
.group-create-section { margin: 16px 0 8px; }
.group-create-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}
.group-create-picker-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--ink-dim);
  font-size: 12.5px;
  padding: 14px 6px;
}
.group-create-tile {
  background: transparent;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: background 0.15s, border-color 0.15s;
}
.group-create-tile:hover {
  background: rgba(200, 152, 73, 0.08);
}
.group-create-tile.is-selected {
  border-color: var(--accent);
  background: rgba(200, 152, 73, 0.14);
}
.group-create-tile-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 22px;
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border: 1px solid rgba(200, 152, 73, 0.4);
  overflow: hidden;
}
.group-create-tile-avatar img,
.group-create-tile-avatar > * { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: grid; place-items: center; }
.group-create-tile-name {
  font-size: 11px;
  color: var(--ink);
  text-align: center;
  letter-spacing: 0.5px;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* @-mention popover */
.group-mention-popover {
  position: fixed;
  z-index: 200;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  max-width: 280px;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
}
.group-mention-popover[hidden] { display: none; }
.group-mention-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: inherit;
}
.group-mention-option:hover {
  background: rgba(200, 152, 73, 0.12);
}
.group-mention-option-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 16px;
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border: 1px solid rgba(200, 152, 73, 0.4);
  flex-shrink: 0;
}
.group-mention-option-name {
  font-size: 13px;
  letter-spacing: 0.5px;
}

/* ============ User-uploaded chat background (Phase A5) ============ */
/* JS sets `--chat-bg-url: url("https://...")` on <body> and toggles .has-chat-bg.
   We layer a 30% white mask above the image (via linear-gradient as a second
   background) so messages stay legible over busy photos. The mask + image are
   placed only on the scrollable .messages region so chat header / composer
   keep the chrome's solid look. */
:root { --chat-bg-url: none; }
body.has-chat-bg .dialogue.chat-panel .messages {
  background-image:
    linear-gradient(rgba(255, 250, 240, 0.3), rgba(255, 250, 240, 0.3)),
    var(--chat-bg-url);
  background-size: cover, cover;
  background-position: center center, center center;
  background-repeat: no-repeat, no-repeat;
}

/* Profile-modal preview tile + actions */
.profile-bg-label { margin-top: 14px; }
.profile-bg-section {
  margin-top: 6px;
}
.profile-bg-preview {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 220px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #fff5d8, #efe7d3);
  background-size: cover;
  background-position: center;
  margin-bottom: 10px;
  display: grid; place-items: center;
  overflow: hidden;
}
.profile-bg-preview-empty {
  color: var(--ink-dim);
  font-size: 12px;
  letter-spacing: 1.5px;
  background: rgba(255, 250, 240, 0.85);
  padding: 4px 10px;
  border-radius: 999px;
}
.profile-bg-preview.has-image .profile-bg-preview-empty { display: none; }
.profile-bg-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 6px;
}

/* Empty placeholder for videos / news */
.view-empty {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 60px 30px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  min-height: 50vh;
}
.view-empty-icon {
  font-size: 64px;
  filter: grayscale(0.3);
  margin-bottom: 12px;
  opacity: 0.8;
}
.view-empty h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  letter-spacing: 3px;
  color: var(--ink);
  margin: 0 0 10px;
}
.view-empty p {
  font-size: 14px;
  color: var(--ink-dim);
  max-width: 420px;
  line-height: 1.75;
  margin: 0 0 14px;
}
.view-empty-tag {
  font-size: 11.5px;
  color: var(--accent-dim);
  letter-spacing: 2px;
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 247, 226, 0.5);
}

/* Theme picker inside profile modal */
.profile-field-hint {
  font-size: 12.5px;
  color: var(--ink-dim);
  margin: 0 0 12px;
}
.theme-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.theme-option {
  background: transparent;
  border: 2px solid transparent;
  padding: 6px 4px;
  border-radius: 10px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: border-color 0.15s, background 0.15s;
}
.theme-option:hover { background: rgba(200, 152, 73, 0.08); }
.theme-option.is-active {
  border-color: var(--accent);
  background: rgba(200, 152, 73, 0.10);
}
.theme-swatch {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.10);
  display: block;
}
.theme-swatch-dawn   { background: linear-gradient(135deg, #fff5d8 0%, #c89849 100%); }
.theme-swatch-night  { background: linear-gradient(135deg, #c4b5fd 0%, #5a3d7a 100%); }
.theme-swatch-dusk   { background: linear-gradient(135deg, #fcd5ce 0%, #c1666b 100%); }
.theme-swatch-meadow { background: linear-gradient(135deg, #d4e7c5 0%, #4a7c59 100%); }
.theme-swatch-ocean  { background: linear-gradient(135deg, #b8dde4 0%, #2a4d8c 100%); }
.theme-name {
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.5px;
}

/* ----- Theme variants (applied via data-theme attr on <html>) ----- */
html[data-theme="night"] {
  --bg:            #1a1530;
  --bg-panel:      rgba(38, 30, 65, 0.92);
  --bg-panel-2:    rgba(50, 38, 80, 0.85);
  --ink:           #ede9f8;
  --ink-dim:       #9a92b8;
  --accent:        #b8a4e8;
  --accent-dim:    #8a73c5;
  --accent-light:  #d4c4f5;
  --line:          rgba(184, 164, 232, 0.32);
  --line-soft:     rgba(237, 233, 248, 0.10);
}
html[data-theme="night"] body { background: radial-gradient(ellipse at top, #2a204a 0%, #1a1530 60%) fixed; }
html[data-theme="night"] .bottom-tabs { background: #211a3c; }
html[data-theme="night"] .auth-dialog { background: #2a2050; }

html[data-theme="dusk"] {
  --bg:            #fff5f3;
  --bg-panel:      rgba(255, 245, 240, 0.92);
  --bg-panel-2:    rgba(255, 235, 230, 0.85);
  --ink:           #3a1f1c;
  --ink-dim:       #82594f;
  --accent:        #d97970;
  --accent-dim:    #b04a4f;
  --accent-light:  #f4a09a;
  --line:          rgba(217, 121, 112, 0.32);
  --line-soft:     rgba(58, 31, 28, 0.10);
}
html[data-theme="dusk"] body { background: radial-gradient(ellipse at top, #fff0eb 0%, #fff5f3 60%) fixed; }

html[data-theme="meadow"] {
  --bg:            #f4f8ed;
  --bg-panel:      rgba(244, 248, 237, 0.92);
  --bg-panel-2:    rgba(228, 240, 215, 0.85);
  --ink:           #1f3024;
  --ink-dim:       #5a705f;
  --accent:        #6b9a5f;
  --accent-dim:    #4a7c59;
  --accent-light:  #a4c596;
  --line:          rgba(107, 154, 95, 0.32);
  --line-soft:     rgba(31, 48, 36, 0.10);
}
html[data-theme="meadow"] body { background: radial-gradient(ellipse at top, #eaf3dc 0%, #f4f8ed 60%) fixed; }

html[data-theme="ocean"] {
  --bg:            #eef5fa;
  --bg-panel:      rgba(238, 245, 250, 0.92);
  --bg-panel-2:    rgba(220, 235, 245, 0.85);
  --ink:           #1a2a3c;
  --ink-dim:       #5a6e82;
  --accent:        #4a7cb8;
  --accent-dim:    #2a4d8c;
  --accent-light:  #88b3d8;
  --line:          rgba(74, 124, 184, 0.32);
  --line-soft:     rgba(26, 42, 60, 0.10);
}
html[data-theme="ocean"] body { background: radial-gradient(ellipse at top, #e2efff 0%, #eef5fa 60%) fixed; }

/* Mobile tweaks: hide subtitle/header refinements when bottom-tab is present */
@media (max-width: 768px) {
  .chapel-header {
    padding: 10px 14px;
  }
  .chapel-header .titles .subtitle { display: none; }
  .home-services { grid-template-columns: repeat(2, 1fr); }
  .view-scroll { max-height: calc(100vh - 200px); }
  .view-chat .chat-panel { max-height: calc(100vh - 160px); }
  .theme-picker { grid-template-columns: repeat(3, 1fr); }
  .app-views { padding: 8px; }
}

/* Override old chapel-main grid (legacy) — no longer used after view restructure */
.chapel-main { display: block; padding: 0; gap: 0; }
.rail { display: none; }    /* old rail no longer rendered (content moved to home view) */
.chapel-footer { display: none; }   /* footer hidden — bottom tab bar takes its place */

/* -- 登入 / 註冊 Modal --------------------------------------------------- */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.auth-modal.is-open { display: flex; }

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 36, 24, 0.45);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.auth-dialog {
  position: relative;
  width: 360px;
  max-width: calc(100vw - 32px);
  /* Cap dialog height so tall content (profile / create-group with many
     friends + 34 biblical characters) doesn't push the submit button off the
     bottom of the viewport. Internal scroll instead. */
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(60, 40, 0, 0.25);
  padding: 32px 28px 24px;
  animation: rise 0.25s ease-out;
}
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.auth-close {
  position: absolute;
  top: 10px; right: 12px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-dim);
  transition: background 0.15s, color 0.15s;
}
.auth-close:hover { background: rgba(200, 152, 73, 0.12); color: var(--ink); }

.auth-title {
  margin: 0 0 18px;
  font-family: var(--font-serif);
  font-size: 22px;
  letter-spacing: 2px;
  text-align: center;
  color: var(--ink);
}

.auth-google {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0.5px;
  transition: background 0.15s, border-color 0.15s;
}
.auth-google::before {
  content: "G ";
  color: #4285F4;
  font-weight: 800;
  margin-right: 6px;
}
.auth-google:hover { background: rgba(200, 152, 73, 0.08); border-color: var(--accent-dim); }

.auth-divider {
  position: relative;
  text-align: center;
  margin: 18px 0;
}
.auth-divider::before {
  content: "";
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: var(--line);
}
.auth-or {
  position: relative;
  background: #fffaf0;
  padding: 0 12px;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 1px;
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field > span {
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 1px;
}
.auth-field > input {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.auth-field > input:focus { border-color: var(--accent-dim); }
.auth-field > input::placeholder { color: var(--ink-dim); font-style: italic; }

.auth-error {
  margin: 0;
  min-height: 18px;
  font-size: 12.5px;
  text-align: center;
  line-height: 1.4;
}

.auth-submit {
  width: 100%;
  background: linear-gradient(180deg, #e7b55c, var(--accent-dim));
  color: #2a1d0a;
  border: none;
  padding: 11px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: 2px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(200, 152, 73, 0.30);
  margin-top: 4px;
  transition: transform 0.15s;
}
.auth-submit:hover { transform: translateY(-1px); }

.auth-toggle {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--accent-dim);
  text-decoration: none;
  letter-spacing: 0.5px;
}
.auth-toggle:hover { text-decoration: underline; }

/* ============================================================================
   Phase A1: LINE-style overrides (晨曦金調 + LINE 結構)
   Keep chapel-gold aesthetic, adopt LINE layout patterns:
   - vertical friends list (instead of 2-col grid)
   - asymmetric chat bubbles with avatar (LINE-style)
   - chat header with mode tabs inline
   - mobile: friend-list vs chat-panel toggle view
   ============================================================================ */

/* ---- People-type tabs at top of sidebar (聖經人物 / 真人好友) ---- */
.people-tabs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px 0;
}
.people-tabs {
  display: flex;
  gap: 6px;
  flex: 1;
}
.add-friend-btn {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff7e2, #fffaf0);
  color: var(--accent-dim);
  font-size: 22px;
  font-weight: 300;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
  box-shadow: 0 2px 6px rgba(200, 152, 73, 0.25);
}
.add-friend-btn:hover {
  background: linear-gradient(180deg, #fff5d8, #e7c478);
  border-color: var(--accent);
  color: var(--ink);
  transform: rotate(90deg);
}

.add-friend-hint {
  font-size: 12.5px;
  color: var(--ink-dim);
  line-height: 1.65;
  margin: 4px 0 16px;
  text-align: center;
}
.people-tab {
  flex: 1;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 10px 10px 4px 4px;
  padding: 8px 10px;
  font-size: 12.5px;
  letter-spacing: 1.5px;
  color: var(--ink-dim);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.people-tab:hover:not(.is-disabled) { color: var(--ink); background: rgba(200, 152, 73, 0.10); }
.people-tab.is-active {
  background: linear-gradient(180deg, #fff7e2, rgba(255, 250, 240, 0.92));
  color: var(--accent-dim);
  border-color: rgba(200, 152, 73, 0.55);
  border-bottom-color: transparent;
}
.people-tab.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  font-style: italic;
}

/* ---- Friends list: vertical LINE-style instead of 2-col grid ---- */
.picker-grid.friends-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: none; /* let parent control */
  padding-right: 2px;
}
.picker-grid.friends-list .picker-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  padding: 10px 10px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  align-items: center;
  transition: background 0.12s;
}
.picker-grid.friends-list .picker-card:hover {
  background: rgba(200, 152, 73, 0.10);
  border-color: transparent;
}
.picker-grid.friends-list .picker-card.is-active {
  background: linear-gradient(90deg, rgba(200, 152, 73, 0.22), rgba(200, 152, 73, 0.08));
  border-color: transparent;
  box-shadow: inset 3px 0 0 var(--accent);
}
.picker-grid.friends-list .pc-icon {
  grid-row: 1 / 3;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border: 1px solid rgba(200, 152, 73, 0.5);
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(200, 152, 73, 0.25);
}
.picker-grid.friends-list .pc-name {
  grid-row: 1;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* When app.js renders `.pc-era` (subtitle), it shows under the name LINE-style */
.picker-grid.friends-list .pc-era {
  grid-row: 2;
  grid-column: 2;
  font-size: 11.5px;
  color: var(--ink-dim);
  letter-spacing: 0.8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Adjust sidebar overall layout */
.chapel-main {
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 22px;
}
.rail {
  gap: 10px;
  max-height: calc(100vh - 140px);
}
.picker {
  flex: 1;
  min-height: 0;       /* allow inner scroll */
  display: flex;
  flex-direction: column;
}
.picker-grid.friends-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* ---- Chat panel: LINE-style chat layout ---- */
.dialogue.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  max-height: calc(100vh - 140px);
}

/* Chat header — built on existing .priest-banner */
.chat-header {
  display: grid;
  grid-template-columns: auto 60px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(180deg, #fff7e2, rgba(255, 247, 226, 0.6));
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.chat-header .halo {
  width: 56px; height: 56px;
  font-size: 28px;
}
.chat-header .priest-text { min-width: 0; }
.chat-header .priest-name { font-size: 18px; letter-spacing: 1.5px; margin: 0 0 1px; }
.chat-header .priest-era { font-size: 11.5px; margin: 0 0 2px; }
.chat-header .priest-blurb { display: none; }  /* keep DOM, hide visually for compact LINE feel */
.chat-header .priest-line { font-size: 12.5px; font-style: italic; margin: 4px 0 0; opacity: 0.75; }

/* Back button (only shown on mobile when chat-panel is the active view) */
.back-btn {
  display: none;     /* hidden on desktop */
  background: transparent;
  border: none;
  color: var(--accent-dim);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.back-btn:hover { color: var(--ink); }

/* Modes (3 buttons) inside chat header — compact horizontal pill set */
.chat-header .modes {
  display: flex;
  flex-direction: row;
  gap: 4px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  box-shadow: none;
}
.chat-header .mode-btn {
  background: transparent;
  border: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-dim);
  display: inline-flex;
  flex-direction: row;       /* override old .mode-btn { flex-direction: column } */
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.chat-header .mode-btn .mode-icon { font-size: 14px; }
.chat-header .mode-btn:hover { color: var(--ink); }
.chat-header .mode-btn.is-active {
  background: linear-gradient(180deg, #fff5d8, #e7c478);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(200, 152, 73, 0.4);
}

/* "New conversation" button in chat header */
.chat-header #new-session {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 0.8px;
  font-family: var(--font-sans);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.chat-header #new-session:hover {
  color: var(--ink);
  background: rgba(200, 152, 73, 0.10);
  border-color: var(--accent-dim);
}

/* Scenarios sit between header and messages, no extra padding clash */
.dialogue.chat-panel .scenarios { padding: 8px 16px 0; margin: 0; }

/* Messages area: LINE-style, scrollable */
.dialogue.chat-panel .messages {
  flex: 1;
  padding: 14px 16px;
  background: var(--bg);   /* slightly darker than panel to feel like LINE chat bg */
  min-height: 0;
}

/* ---- LINE-style chat bubbles ---- */
.dialogue.chat-panel .msg {
  max-width: 75%;
  padding: 10px 14px;
  font-size: 14.5px;
  line-height: 1.55;
  border: none;       /* LINE bubbles don't have borders */
  box-shadow: 0 1px 2px rgba(60, 40, 0, 0.10);
}

/* User: right-aligned, gold gradient with sharper bottom-right corner (LINE tail effect) */
.dialogue.chat-panel .msg.user {
  align-self: flex-end;
  background: linear-gradient(180deg, #f5d889, #e7b55c);
  color: #2a1d0a;
  border-radius: 18px 18px 4px 18px;
}

/* Character (priest): left-aligned, cream bubble with avatar floating to its left.
   Outer wrapper trick: we use ::before to render the avatar at the same row as the bubble. */
.dialogue.chat-panel .msg.priest {
  align-self: flex-start;
  background: #fffaf0;
  color: var(--ink);
  font-family: var(--font-serif);
  line-height: 1.75;
  border-radius: 4px 18px 18px 18px;
  margin-left: 48px;       /* leave room for avatar */
  position: relative;
}
.dialogue.chat-panel .msg.priest::before {
  content: attr(data-icon);
  position: absolute;
  top: 0; left: -44px;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #fff5d8, #e7c478);
  border: 1px solid rgba(200, 152, 73, 0.5);
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(200, 152, 73, 0.35);
}

.dialogue.chat-panel .msg.error {
  align-self: center;
  font-size: 12.5px;
  background: rgba(140, 42, 60, 0.10);
  color: var(--ruby);
  border-radius: 12px;
  padding: 6px 12px;
  margin-left: 0;       /* override priest's margin */
}

/* Composer at bottom — sit flush with panel edge */
.dialogue.chat-panel .composer {
  margin: 0 16px 14px;
  flex-shrink: 0;
}
.dialogue.chat-panel .disclaimer {
  margin: 0 16px 12px;
  font-size: 10.5px;
}

/* ---- Mobile responsive: friend-list / chat-panel toggle view (<768px) ---- */
@media (max-width: 768px) {
  .chapel-main {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 0;
    position: relative;
  }

  /* Legacy two-column rail+chat layout is gone — chat is its own bottom-tab view.
     The old `body:not(.in-chat) .chat-panel { display: none }` rule used to live here
     and was hiding the conversation pane on mobile whenever in-chat wasn't set,
     which broke the new LINE-style flow. Now the chat-conversation-pane visibility
     is driven entirely by .view-chat[data-pane="conversation"] in the main stylesheet. */

  .rail {
    max-height: calc(100vh - 130px);
  }
  .chat-panel {
    max-height: calc(100vh - 130px);
  }

  .back-btn { display: inline-block; }    /* show back button on mobile */

  /* Chat header gets tighter on mobile — the original layout stacked era +
     two full-width action buttons (開始新的對話 / 刪除這段對話), eating ~⅓ of
     the viewport. We compress to: row 1 = back+avatar+name+icon-actions, row 2
     = mode tabs icon-only. */
  .chat-header {
    grid-template-columns: auto 40px 1fr auto;
    gap: 8px;
    padding: 8px 12px;
  }
  .chat-header .halo { width: 40px; height: 40px; font-size: 20px; }
  .chat-header .priest-name { font-size: 15.5px; margin: 0; letter-spacing: 1px; }
  .chat-header .priest-era,
  .chat-header .priest-blurb,
  .chat-header .priest-line { display: none; }   /* drop era/blurb/greeting on mobile */

  /* Action buttons → icon-only circles, stay on row 1 */
  .chat-header-actions { gap: 4px; margin-left: 0; }
  .chat-header #new-session,
  .chat-header #delete-conversation {
    font-size: 0;            /* hide the i18n label text */
    letter-spacing: 0;
    width: 34px; height: 34px;
    padding: 0;
    border-radius: 50%;
    display: inline-grid; place-items: center;
    line-height: 1;
  }
  .chat-header #new-session::before {
    content: '⟳';
    font-size: 18px;
    color: var(--accent-dim);
    line-height: 1;
  }
  .chat-header #delete-conversation::before {
    content: '🗑';
    font-size: 14px;
    line-height: 1;
  }

  /* Mode tabs → icon-only on row 2, full-width centered. Explicit grid-row so
     auto-placement keeps chat-header-actions on row 1 col 4. */
  .chat-header .modes {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 4px 0 0;
    justify-content: center;
    gap: 4px;
  }
  .chat-header .mode-btn { padding: 4px 10px; }
  .chat-header .mode-btn .mode-label { display: none; }
  .chat-header .mode-btn .mode-icon { font-size: 18px; }

  /* Tighter scenarios + messages area = more room for actual chat */
  .dialogue.chat-panel .scenarios { padding: 4px 12px 0; }
  .dialogue.chat-panel .disclaimer {
    font-size: 10.5px;
    padding: 4px 12px;
    margin: 2px 0 0;
    line-height: 1.4;
  }
}

/* Hide candles entirely now (LINE-style sidebar is clean) */
.candles { display: none; }

/* ===========================================================================
   Accumulation model UI (E2.2.x — lifetime + milestones + donation + badges)
   =========================================================================== */

/* ---- Status card (lifetime + milestone progress + month quota) ---- */
.acc-status {
  display: flex; flex-direction: column;
  gap: 14px;
}
.acc-lifetime {
  display: flex; align-items: baseline; gap: 8px;
}
.acc-lifetime-icon { font-size: 24px; }
.acc-lifetime-number {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}
.acc-lifetime-label {
  font-size: 12px;
  color: var(--ink-dim);
}
.acc-milestone-name {
  font-size: 16px;
  color: var(--ink);
  font-weight: 600;
}
.acc-milestone-name .acc-lv {
  color: var(--accent);
  margin-right: 6px;
  font-weight: 700;
}
.acc-progress {
  display: flex; flex-direction: column; gap: 4px;
}
.acc-progress-label {
  font-size: 12px;
  color: var(--ink-dim);
  display: flex; justify-content: space-between;
}
.acc-progress-bar {
  height: 10px;
  background: rgba(45, 36, 24, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.acc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #fff5d8, #c89849);
  border-radius: 999px;
  transition: width 0.5s ease-out;
}
.acc-progress-fill.is-month {
  background: linear-gradient(90deg, #c89849, #8c2a3c);
}
.acc-progress-fill.is-full {
  background: linear-gradient(90deg, #8c2a3c, #8c2a3c);
}
.acc-divider {
  height: 1px;
  background: var(--line-soft);
  margin: 4px 0;
}

/* ---- Milestone ladder ---- */
.pricing-milestones-ladder {
  display: flex; flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.milestone-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(200, 152, 73, 0.04);
  border: 1px solid var(--line-soft);
}
.milestone-row.is-current {
  background: linear-gradient(135deg, #fff5d8, var(--bg-panel));
  border-color: rgba(200, 152, 73, 0.45);
  box-shadow: 0 1px 4px rgba(200, 152, 73, 0.15);
}
.milestone-row.is-achieved .milestone-row-icon {
  filter: none;
}
.milestone-row.is-locked .milestone-row-icon {
  filter: grayscale(1) opacity(0.4);
}
.milestone-row.is-locked .milestone-row-name {
  color: var(--ink-dim);
}
.milestone-row-icon {
  font-size: 22px;
  text-align: center;
}
.milestone-row-body {
  display: flex; flex-direction: column;
  min-width: 0;
}
.milestone-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.milestone-row-name .milestone-lv {
  color: var(--accent);
  margin-right: 4px;
}
.milestone-row-threshold {
  font-size: 11px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.milestone-row-state {
  font-size: 11px;
  color: var(--ink-dim);
}
.milestone-row.is-current .milestone-row-state {
  color: var(--accent);
  font-weight: 600;
}
.milestone-row.is-achieved .milestone-row-state {
  color: #4a8a3a;
  font-weight: 600;
}

/* ---- Badges grid ---- */
.pricing-badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.badge-tile {
  display: flex; flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 247, 226, 0.5);
  text-align: center;
}
.badge-tile.is-locked {
  opacity: 0.4;
  filter: grayscale(0.6);
}
.badge-tile-icon {
  font-size: 36px;
  filter: drop-shadow(0 2px 4px rgba(200, 152, 73, 0.3));
}
.badge-tile-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.badge-tile-threshold {
  font-size: 11px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

/* ---- Donation grid (6 SKUs) ---- */
.pricing-donation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.donation-tile {
  display: flex; flex-direction: column;
  gap: 6px;
  padding: 14px 12px;
  border-radius: 12px;
  border: 1px solid rgba(200, 152, 73, 0.35);
  background: linear-gradient(135deg, #fff8e7, var(--bg-panel));
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.donation-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(200, 152, 73, 0.2);
}
.donation-tile-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.donation-tile-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.donation-tile-candles {
  font-size: 12px;
  color: var(--ink-dim);
}
.donation-tile-pct {
  font-size: 11px;
  color: #4a8a3a;
  font-weight: 600;
}
.pricing-donation-fineprint {
  font-size: 11px;
  color: var(--ink-dim);
  margin-top: 12px;
  line-height: 1.5;
}

/* ---- Blessing card display ---- */
.pricing-blessing-cards {
  display: flex; flex-direction: column;
  gap: 12px;
}
.blessing-card-display {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(200, 152, 73, 0.5);
  background: linear-gradient(135deg, #fff8e7, #faf6ed);
}
.blessing-card-image {
  width: 80px; height: 80px;
  border-radius: 8px;
  background: rgba(45, 36, 24, 0.05);
  display: grid; place-items: center;
  overflow: hidden;
}
.blessing-card-image img { width: 100%; height: 100%; object-fit: cover; }
.blessing-card-image-placeholder { font-size: 32px; opacity: 0.4; }
.blessing-card-info {
  display: flex; flex-direction: column;
  gap: 4px;
}
.blessing-card-status {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.blessing-card-message {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}
.blessing-card-location {
  font-size: 11px;
  color: var(--ink-dim);
}

/* ---- Blessing card threshold modal ---- */
.blessing-card-dialog {
  max-width: 420px;
  text-align: center;
}
.blessing-card-icon {
  font-size: 48px;
  margin: 6px 0 2px;
  filter: drop-shadow(0 2px 6px rgba(200, 152, 73, 0.5));
  animation: blessingPulse 2s ease-in-out infinite;
}
@keyframes blessingPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}
.blessing-card-body {
  font-size: 14px;
  color: var(--ink);
  margin: 10px 0 0;
}
.blessing-card-explainer {
  font-size: 13px;
  color: var(--ink-dim);
  line-height: 1.5;
  margin: 12px 0 18px;
}
.blessing-card-choice {
  display: flex; flex-direction: column;
  gap: 8px;
}
.blessing-card-choice .auth-submit { margin: 0; }
.blessing-card-later {
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font-size: 13px;
  cursor: pointer;
  margin-top: 4px;
}
.blessing-card-later:hover { color: var(--accent); }
.blessing-card-form {
  display: flex; flex-direction: column;
  gap: 10px;
  text-align: left;
  margin-top: 12px;
}
.blessing-card-privacy {
  font-size: 11px;
  color: var(--ink-dim);
  margin: 0;
  line-height: 1.4;
}

/* ---- Milestone level-up toast ---- */
/* IMPORTANT: [hidden] override comes BEFORE the main rule so that the
   class's display: grid doesn't override the hidden-attribute on page load.
   Without this, the toast was sticking visible because [hidden] from HTML
   sets display:none via user-agent CSS but a class selector wins on tie. */
.milestone-toast[hidden] { display: none !important; }
.milestone-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  background: linear-gradient(135deg, #fff5d8, #c89849);
  color: #2d2418;
  padding: 14px 20px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: center;
  min-width: 280px;
  max-width: 90vw;
  animation: milestoneToastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.milestone-toast.is-leaving {
  animation: milestoneToastOut 0.3s ease-in forwards;
}
@keyframes milestoneToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes milestoneToastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}
.milestone-toast-icon { font-size: 32px; text-align: center; }
.milestone-toast-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.milestone-toast-sub {
  font-size: 12px;
  opacity: 0.85;
}

/* =============================================================
   Paywall (E2.2 — locked biblical characters require subscription)
   ============================================================= */
.picker-card.is-locked {
  opacity: 0.55;
  position: relative;
  cursor: pointer;     /* still tappable → opens paywall modal */
}
.picker-card.is-locked::after {
  content: '🔒';
  position: absolute;
  top: 6px; right: 8px;
  font-size: 14px;
  background: rgba(45, 36, 24, 0.75);
  color: #fff7e2;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.picker-card.is-locked:hover { opacity: 0.7; }

/* Locked AI tile inside the group-create / group-add-members pickers */
.group-create-tile.is-locked {
  opacity: 0.5;
  position: relative;
}
.group-create-tile.is-locked::after {
  content: '🔒';
  position: absolute;
  top: 4px; right: 6px;
  font-size: 12px;
  background: rgba(45, 36, 24, 0.7);
  color: #fff7e2;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid; place-items: center;
}
.group-create-tile.is-locked.is-selected { box-shadow: 0 0 0 2px var(--ruby); }

/* Paywall modal dialog */
.paywall-dialog {
  max-width: 380px;
  text-align: center;
}
.paywall-icon {
  font-size: 48px;
  margin: 6px 0 2px;
  filter: drop-shadow(0 2px 4px rgba(200, 152, 73, 0.35));
}
.paywall-body {
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1.5;
  margin: 8px 0 18px;
}
.paywall-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.paywall-actions .auth-submit { margin: 0; }
.paywall-cancel {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
}
.paywall-cancel:hover { background: rgba(200, 152, 73, 0.08); }
