/* Cổng Chúa — L0–L1. UI chậm, ấm, không hối. */
:root {
  --ink: #2c261e;
  --ink-soft: #5a5146;
  --cream: #f6efe3;
  --paper: rgba(246, 239, 227, 0.92);
  --gold: #b8934a;
  --gold-dim: #8a6d35;
  --wood: #4a3428;
  --veil: rgba(18, 14, 10, 0.55);
  --veil-deep: rgba(12, 9, 7, 0.78);
  --line: rgba(184, 147, 74, 0.35);
  --safe: #6b8f71;
  --shadow: 0 18px 50px rgba(12, 9, 7, 0.35);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI", "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a1410; color: var(--cream); font-family: var(--sans); }
button, input, textarea, select { font: inherit; }

#canvas-wrap { position: fixed; inset: 0; }
#canvas-wrap canvas { display: block; width: 100%; height: 100%; }

/* —— Light / chỉ-audio still (no WebGL) —— */
#still-sanctuary {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  background:
    radial-gradient(ellipse at 50% 28%, rgba(232, 184, 109, 0.22), transparent 52%),
    radial-gradient(ellipse at 50% 100%, rgba(20, 14, 10, 0.55), transparent 48%),
    linear-gradient(180deg, #2a2118 0%, #14110e 55%, #0e0c0a 100%);
  pointer-events: none;
}
#still-sanctuary[hidden] { display: none !important; }
/* Play-polish #43: cover blank WebGL while first frame builds */
#still-sanctuary.boot-shell {
  z-index: 2;
  pointer-events: none;
}

#still-sanctuary .still-glow {
  position: absolute; inset: 12% 18% 28%;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 214, 150, 0.14), transparent 70%);
}
#still-sanctuary .still-nave {
  position: absolute; left: 8%; right: 8%; bottom: 0; height: 38%;
  background: linear-gradient(180deg, transparent, rgba(42, 32, 24, 0.55) 40%, rgba(18, 14, 10, 0.85));
  border-top: 1px solid rgba(184, 147, 74, 0.12);
}
#still-sanctuary .still-corpus {
  position: relative; z-index: 1;
  width: min(42vw, 220px); height: auto;
  max-height: 46vh;
  object-fit: contain;
  filter: drop-shadow(0 12px 28px rgba(0,0,0,0.45));
  opacity: 0.92;
}
#still-sanctuary .still-caption {
  position: relative; z-index: 1;
  margin: 0; padding: 0 20px;
  max-width: 28rem;
  text-align: center;
  font-size: 13px; line-height: 1.45;
  color: rgba(246, 239, 227, 0.72);
  text-shadow: 0 1px 8px rgba(0,0,0,0.55);
}
/* Play-polish #12: solemn warm pool + soft nave dim (audio-only / reduce-motion) */
#still-sanctuary.has-candles {
  background:
    radial-gradient(ellipse at 50% 26%, rgba(255, 200, 130, 0.34), transparent 48%),
    radial-gradient(ellipse at 50% 100%, rgba(12, 8, 6, 0.72), transparent 52%),
    linear-gradient(180deg, #221910 0%, #100e0b 55%, #0a0908 100%);
}
#still-sanctuary.has-candles .still-glow {
  background: radial-gradient(ellipse at 50% 38%, rgba(255, 210, 150, 0.32), rgba(255, 180, 100, 0.08) 55%, transparent 72%);
}
#still-sanctuary.has-candles .still-nave {
  background: linear-gradient(180deg, transparent, rgba(28, 20, 14, 0.7) 40%, rgba(10, 8, 6, 0.92));
}
#still-sanctuary.has-candles .still-corpus {
  filter: drop-shadow(0 10px 26px rgba(40, 22, 8, 0.55)) drop-shadow(0 0 28px rgba(255, 190, 120, 0.18));
  opacity: 0.96;
}
body.audio-only #view { display: none !important; }
body.audio-only #mixer label:has(#quality),
body.audio-only #quality { display: none; }
body.audio-only-pending #gate-light-note { color: var(--gold-dim); }
@media (prefers-reduced-motion: reduce) {
  #still-sanctuary .still-corpus { filter: drop-shadow(0 8px 16px rgba(0,0,0,0.4)); }
}

/* —— Cổng vào —— */
#gate {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  /* #20 safe-area — Chạm để vào clear of notch/home */
  padding: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(232, 184, 109, 0.18), transparent 55%),
    linear-gradient(180deg, #2a2118 0%, #12100c 100%);
  transition: opacity 1.1s ease, visibility 1.1s ease;
}
#gate.hide {
  opacity: 0; visibility: hidden; pointer-events: none;
  z-index: 0; /* #47: stay below intro/modals after dismiss */
}
.gate-card {
  width: min(440px, calc(100vw - 32px));
  padding: 36px 32px 28px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 6px;
  box-shadow: var(--shadow);
  text-align: center;
}
.gate-kicker {
  letter-spacing: 0.22em; text-transform: uppercase;
  font-size: 11px; color: var(--gold-dim); margin: 0 0 10px;
}
.gate-card h1 {
  font-family: var(--serif); font-weight: 600; font-size: 34px;
  margin: 0 0 8px; letter-spacing: 0.02em;
}
.gate-card .lead {
  margin: 0 0 22px; color: var(--ink-soft); line-height: 1.55; font-size: 15.5px;
}
.gate-card .lead em { font-style: italic; color: var(--ink); }
.disclaimer-box {
  text-align: left; font-size: 13px; line-height: 1.5;
  color: var(--ink-soft); background: rgba(74, 52, 40, 0.06);
  border-left: 3px solid var(--gold); padding: 10px 12px; margin: 0 0 20px;
}
label.quiet {
  display: flex; gap: 10px; align-items: flex-start;
  text-align: left; font-size: 14px; color: var(--ink);
  margin: 0 0 18px; cursor: pointer; line-height: 1.4;
}
label.quiet input { margin-top: 3px; accent-color: var(--gold-dim); }
.btn-enter {
  width: 100%; border: 0; cursor: pointer;
  background: var(--wood); color: var(--cream);
  padding: 14px 18px; border-radius: 4px;
  font-size: 16px; letter-spacing: 0.04em;
  transition: background 0.35s ease, transform 0.35s ease;
}
.btn-enter:hover { background: #3a281e; }
.btn-enter:active { transform: scale(0.99); }
.gate-note { margin: 16px 0 0; font-size: 12px; color: var(--ink-soft); }

/* —— HUD —— */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }

.top-bar {
  position: absolute;
  top: max(16px, env(safe-area-inset-top, 0px));
  left: max(16px, env(safe-area-inset-left, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; justify-content: flex-start; align-items: flex-start; gap: 12px;
}
.chip, .panel {
  background: var(--veil); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 4px;
  color: var(--cream);
}
.chip {
  padding: 8px 12px; font-size: 13px; line-height: 1.35;
  max-width: min(360px, 70vw);
}
.chip strong { font-weight: 600; display: block; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: #e8c27a; margin-bottom: 2px; }
 .today-chip {
  text-align: left; cursor: pointer;
  background: rgba(18, 14, 10, 0.82);
  color: var(--cream);
  transition: opacity 0.7s ease;
}
.today-chip.faded { opacity: 0; }
.today-chip.faded:focus { opacity: 1; }

.hint {
  position: absolute; left: 50%; top: auto; bottom: 96px;
  transform: translateX(-50%);
  /* Lavish v10-nhanh: warm translucent, rounded, larger serif */
  background: rgba(48, 34, 22, 0.58);
  border: 1px solid rgba(184, 147, 74, 0.32);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 11px 18px; border-radius: 12px; text-align: center;
  font-family: var(--serif); font-size: 19px; line-height: 1.5;
  color: #f3e6cf;
  max-width: min(420px, 82vw);
  opacity: 0; transition: opacity 1s ease; pointer-events: none;
  box-shadow: 0 8px 28px rgba(12, 9, 7, 0.28);
}
.hint.show { opacity: 1; }
#hud .hint, #hud .look-label { pointer-events: none; }

.dock {
  position: absolute; left: 50%;
  /* Play-polish #20: home indicator — dock above unsafe bottom */
  bottom: max(22px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  max-width: min(640px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  box-sizing: border-box;
  /* Lavish v11 shot nit: idle was 0.4 → cream #f3e6cf washed out; align ~stand-corner warmth */
  opacity: 0.82;
  transition: opacity 0.35s ease;
}
.dock:hover, .dock:focus-within { opacity: 1; }
.dock button, .icon-btn {
  pointer-events: auto;
  /* Lavish v10-nhanh: cream text #f3e6cf, 17px, warmer darker bg */
  background: rgba(42, 28, 18, 0.94);
  color: #f3e6cf;
  border: 1px solid rgba(184, 147, 74, 0.42);
  border-radius: 4px;
  padding: 11px 15px; cursor: pointer; font-size: 17px;
  min-height: 48px;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.dock button:hover, .icon-btn:hover { background: rgba(52, 36, 24, 0.96); border-color: var(--gold); }
.dock button.primary { background: #3a281c; color: #f3e6cf; }
.dock button:disabled { opacity: 0.45; cursor: default; }

.more-wrap { position: relative; }
.more-menu {
  display: none;
  position: absolute; bottom: calc(100% + 8px); right: 0;
  min-width: 188px;
  padding: 6px;
  background: var(--veil-deep);
  border: 1px solid var(--line);
  border-radius: 4px;
  flex-direction: column; gap: 4px;
}
.more-menu.open { display: flex; }
.more-menu button, .more-menu .icon-btn {
  width: 100%; justify-content: flex-start;
  text-decoration: none; display: inline-flex; align-items: center;
}
/* Sit / optional kneel / stand — posture bar; hide under overlay via JS+CSS */
.posture-bar {
  position: absolute;
  /* Play-polish #20: Quỳ/Đứng clear of home indicator + right inset */
  right: max(14px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  align-items: stretch;
  pointer-events: none;
  z-index: 12;
  max-width: min(92vw, 280px);
}
.posture-bar .stand-corner {
  pointer-events: auto;
  position: static;
  right: auto;
  bottom: auto;
}
.stand-corner {
  /* Lavish v10-nhanh: same dock style, ≥48px tap */
  position: absolute; right: 14px; bottom: 16px;
  background: rgba(42, 28, 18, 0.94);
  color: #f3e6cf;
  border: 1px solid rgba(184, 147, 74, 0.42);
  border-radius: 4px;
  padding: 11px 15px; cursor: pointer; font-size: 17px;
  min-height: 48px; min-width: 48px;
  opacity: 0.88; transition: opacity 0.3s ease, border-color 0.3s ease, background 0.3s ease;
  font-family: var(--serif);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.stand-corner:hover, .stand-corner:focus,
.stand-corner:focus-visible {
  opacity: 1; border-color: var(--gold); background: rgba(52, 36, 24, 0.96);
}
.stand-corner[hidden] { display: none; }
.stand-corner[aria-pressed="true"] {
  border-color: var(--gold);
  background: rgba(58, 40, 28, 0.98);
  color: #fff8ec;
}
body.overlay-open .posture-bar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.mixer {
  position: absolute; top: 58px; right: 16px;
  width: 220px; padding: 12px 14px 10px;
  display: none;
}
.mixer.open { display: block; }
.mixer h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: #e8c27a; font-weight: 600; }
.mixer label { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; font-size: 12px; margin: 6px 0; }
.mixer input[type="range"] { width: 100%; accent-color: var(--gold); }

/* —— Overlay giáo lý —— */
.modal-root {
  position: fixed; inset: 0; z-index: 30;
  display: none; align-items: center; justify-content: center;
  background: rgba(10, 8, 6, 0.45);
  /* #20 safe-area — sticky Đóng/Tiếp/Amen */
  padding: max(20px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(20px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
}
.modal-root.open { display: flex; }
.modal {
  width: min(480px, 100%);
  background: var(--cream); color: var(--ink);
  border-radius: 6px; box-shadow: var(--shadow);
  padding: 26px 24px 20px; max-height: min(86vh, 720px); overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.modal h2 { font-family: var(--serif); margin: 0 0 6px; font-size: 26px; font-weight: 600; }
.modal .sub { margin: 0 0 16px; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
.intentions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.intentions button {
  text-align: left; background: #fff; border: 1px solid rgba(74, 52, 40, 0.18);
  border-radius: 4px; padding: 10px 12px; cursor: pointer; color: var(--ink);
  transition: border-color 0.25s ease, background 0.25s ease;
}
.intentions button small { display: block; color: var(--ink-soft); font-size: 11.5px; margin-top: 2px; }
.intentions button.selected { border-color: var(--gold); background: #f3e6c8; box-shadow: 0 0 0 1px rgba(184, 147, 74, 0.35); }
.modal textarea {
  width: 100%; min-height: 72px; resize: vertical;
  border: 1px solid rgba(74, 52, 40, 0.2); border-radius: 4px;
  padding: 10px; background: #fff; color: var(--ink); margin: 0 0 8px;
}
.candle-name-wrap { margin: 0 0 10px; }
.candle-name-wrap label {
  display: block; font-size: 13px; color: var(--ink-soft); margin: 0 0 4px;
}
.candle-name-wrap input[type="text"] {
  width: 100%; border: 1px solid rgba(74, 52, 40, 0.2); border-radius: 4px;
  padding: 10px; background: #fff; color: var(--ink); margin: 0 0 4px;
}
.candle-name-hint { font-size: 11.5px; color: var(--ink-soft); margin: 0 0 4px; line-height: 1.45; }
body.large-text .candle-name-wrap label { font-size: 15px; }
body.large-text .candle-name-wrap input[type="text"] { font-size: 17px; padding: 12px; }
body.large-text .candle-name-hint { font-size: 14px; }
.privacy { font-size: 12px; color: var(--ink-soft); margin: 0 0 14px; }
.catechesis {
  background: rgba(74, 52, 40, 0.06); border-left: 3px solid var(--gold);
  padding: 12px 14px; margin: 0 0 16px; font-size: 14.5px; line-height: 1.6;
}
.catechesis p { margin: 0 0 8px; }
.catechesis p:last-child { margin: 0; }
.catechesis .src { font-size: 11.5px; color: var(--ink-soft); margin-top: 8px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-actions button {
  border: 0; border-radius: 4px; padding: 12px 16px; cursor: pointer;
  min-height: 48px; min-width: 48px; /* a11y — intro / pick / candle «Để sau» */
}
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-solid { background: var(--wood); color: var(--cream); }

.sign-cross {
  width: 90px; height: 110px; margin: 12px auto 18px; position: relative;
}
.sign-cross .beam, .sign-cross .post {
  position: absolute; background: var(--gold-dim); border-radius: 2px;
  transform-origin: center; opacity: 0.25;
}
.sign-cross .post { width: 8px; height: 110px; left: 41px; top: 0; }
.sign-cross .beam { width: 90px; height: 8px; left: 0; top: 32px; }
.sign-cross.play .post, .sign-cross.play .beam {
  animation: draw-soft 1.8s ease forwards;
}
@keyframes draw-soft {
  0% { opacity: 0.2; }
  40% { opacity: 1; }
  100% { opacity: 0.85; }
}
.sign-words {
  font-family: var(--serif); font-size: 20px; line-height: 1.55; margin: 0 0 8px;
  max-width: min(100%, 390px);
  margin-left: auto;
  margin-right: auto;
  overflow-wrap: anywhere;
}
.sign-progress {
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 4px;
  text-align: center;
  max-width: min(100%, 390px);
  margin-left: auto;
  margin-right: auto;
}
.sign-step {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 6px;
  text-align: center;
  max-width: min(100%, 390px);
  margin-left: auto;
  margin-right: auto;
}
body.large-text .sign-progress { font-size: 14px; }
body.large-text .sign-step { font-size: 19px; }
#sign-modal .sign-overlay.modal,
#sign-modal .modal.sign-overlay {
  text-align: center;
  max-height: min(88vh, calc(100dvh - 16px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 12px;
}
#sign-modal .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -4px;
  padding: 10px 4px max(4px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, var(--cream) 28%);
  justify-content: center;
}
#sign-modal .modal-actions .btn-ghost,
#sign-modal .modal-actions .btn-solid {
  min-height: 48px;
  min-width: 48px;
  padding: 12px 16px;
}
#sign-modal .sub,
#sign-modal .catechesis.src {
  max-width: min(100%, 390px);
  margin-left: auto;
  margin-right: auto;
  overflow-wrap: anywhere;
}
@media (max-width: 390px) {
  #sign-modal .modal-actions { gap: 6px; }
  #sign-modal .modal-actions .btn-ghost,
  #sign-modal .modal-actions .btn-solid {
    padding: 11px 12px;
    font-size: 15px;
  }
}

.look-label {
  position: absolute; left: 50%; bottom: 148px; transform: translateX(-50%);
  background: var(--veil); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 3px;
  font-family: var(--serif); font-size: 18px; line-height: 1.4;
  opacity: 0; transition: opacity 0.35s ease; pointer-events: none;
  max-width: min(420px, 86vw); text-align: center;
}
.look-label.show { opacity: 1; }

#toast {
  position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%);
  background: var(--veil-deep); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 4px; z-index: 25;
  opacity: 0; pointer-events: none; transition: opacity 0.6s ease;
  font-family: var(--serif); font-size: 18px;
  /* Play-polish #20: ~390px wrap + side insets on notched landscape */
  max-width: min(86vw, 390px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  text-align: center;
  white-space: pre-line; line-height: 1.45;
  box-sizing: border-box;
}
#toast.show { opacity: 1; }
#toast.show.dismissible {
  pointer-events: auto;
  cursor: pointer;
}
/* Soft D1/D7 structured toast (Lavish): serif bold title + body, no middle «·» */
#toast .toast-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: inherit;
  line-height: 1.35;
  margin: 0 0 4px;
}
#toast .toast-body {
  font-family: var(--serif);
  font-weight: 400;
  font-size: inherit;
  line-height: 1.45;
  opacity: 0.96;
}

#toast .toast-actions {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 8px;
}
#toast .toast-action {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.2;
  padding: 6px 14px;
  min-height: 36px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(243, 230, 207, 0.14);
  color: #f3e6cf;
  cursor: pointer;
}
#toast .toast-action:active {
  background: rgba(243, 230, 207, 0.28);
}
#toast.has-action.dismissible {
  cursor: default;
}
#toast.has-action .toast-title,
#toast.has-action .toast-body {
  cursor: pointer;
}


@media (max-width: 560px) {
  .intentions { grid-template-columns: 1fr; }
  .gate-card h1 { font-size: 28px; }
  .dock button { font-size: 16px; padding: 10px 13px; min-height: 48px; color: #f3e6cf; }
  .stand-corner { font-size: 16px; min-height: 48px; padding: 10px 13px; }
  .hint, .look-label, .rosary .prayer, .sign-words, #toast { font-size: 18px; }
  /* Mân Côi + Đàng Thánh Giá — mobile */
  .rosary-root {
    align-items: stretch;
    padding: max(12px, env(safe-area-inset-top)) 10px max(96px, calc(80px + env(safe-area-inset-bottom)));
  }
  .rosary, .stations-panel {
    width: 100%;
    max-height: min(78vh, calc(100dvh - 110px));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 16px 14px 12px;
  }
  .rosary h2 { font-size: 20px; }
  .rosary .mystery { font-size: 14px; }
  .rosary .prayer { font-size: 18px; }
  .rosary-actions { position: sticky; bottom: 0; z-index: 2; padding-top: 8px; background: linear-gradient(180deg, transparent, var(--cream) 35%); }
  .rosary-actions button { min-height: 48px; min-width: 48px; padding: 12px 16px; }
  .beads { gap: 4px; }
  .beads i { width: 11px; height: 11px; }
  .stations-dots i { width: 9px; height: 9px; }
  .mixer { right: 10px; left: 10px; width: auto; }
  .posture-bar {
    right: 10px;
    bottom: max(12px, env(safe-area-inset-bottom));
    max-width: min(96vw, 320px);
  }
  .stand-corner, .kneel-corner {
    font-size: 16px;
    min-height: 48px;
    min-width: 48px;
    padding: 10px 13px;
  }
  /* Candle + rosary-pick + thẻ ngày / thư viện: sticky CTAs on ~390px (dock must not cover Đóng) */
  #candle-modal .modal,
  #rosary-pick-modal .modal,
  #learn-modal .modal,
  #library-modal .modal,
  #keeper-modal .modal,
  #checkin-modal .modal,
  #wardrobe-modal .modal,
  #intro-modal .modal {
    max-height: min(88vh, calc(100dvh - 16px));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 12px;
  }
  #candle-modal .modal-actions,
  #rosary-pick-modal .modal-actions,
  #learn-modal .modal-actions,
  #library-modal .modal-actions,
  #keeper-modal .modal-actions,
  #checkin-modal .modal-actions,
  #wardrobe-modal .modal-actions,
  #intro-modal .modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: 0 -4px;
    padding: 10px 4px max(4px, env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, transparent, var(--cream) 28%);
  }
  /* Line-reader CTAs stay above sticky Đóng on short phones */
  #library-modal #library-detail .lib-line-actions {
    position: sticky;
    bottom: 56px;
    z-index: 1;
    margin: 8px 0 4px;
    padding: 8px 0 6px;
    background: linear-gradient(180deg, transparent, var(--cream) 32%);
  }
  .coach-tip, .hint {
    bottom: max(108px, calc(92px + env(safe-area-inset-bottom, 0px)));
    max-width: min(420px, 94vw);
  }
  /* Coach «Để sau» sticky — one dismiss path, readable on short phones */
  .coach-tip {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    gap: 10px;
  }
  .coach-tip .coach-skip {
    position: sticky;
    bottom: 0;
    align-self: stretch;
    width: 100%;
    text-align: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  #gate, .hint, #toast, .btn-enter, .today-chip, .dock { transition: none; }
  .sign-cross.play .post, .sign-cross.play .beam { animation: none; opacity: 1; }
}

/* Mân Côi overlay — chậm, chữ lớn, không combo */
.rosary-root {
  position: fixed; inset: 0; z-index: 28;
  display: none; align-items: flex-end; justify-content: center;
  background: linear-gradient(180deg, rgba(10,8,6,0.15), rgba(10,8,6,0.5));
  /* #20 safe-area — panel above dock + home indicator */
  padding: max(20px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(92px, calc(80px + env(safe-area-inset-bottom, 0px))) max(16px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
}
.rosary-root.open { display: flex; }
.rosary {
  width: min(560px, 100%);
  background: var(--cream); color: var(--ink);
  border-radius: 6px; box-shadow: var(--shadow);
  padding: 22px 22px 16px;
}
.rosary .count {
  font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gold-dim); margin: 0 0 6px;
}
.rosary h2 { font-family: var(--serif); font-size: 22px; margin: 0 0 8px; }
.rosary .mystery { font-size: 14.5px; color: var(--ink-soft); margin: 0 0 12px; line-height: 1.45; }
.rosary .prayer {
  font-family: var(--serif); font-size: 19px; line-height: 1.55; margin: 0 0 12px;
}
.rosary .src { font-size: 11.5px; color: var(--ink-soft); margin: 0 0 14px; }
.beads {
  display: flex; gap: 5px; flex-wrap: wrap; margin: 0 0 14px;
}
.beads i {
  width: 12px; height: 12px; border-radius: 50%;
  background: #c4b39a; display: inline-block;
}
.beads i.on { background: var(--gold-dim); }

/* WIN-GAP P0: highlight từng dòng lời kinh (parity niemphat, không TTS) */
.rosary .prayer { display: flex; flex-direction: column; gap: 0.35em; }
.rosary .prayer-line {
  margin: 0;
  color: var(--ink-soft);
  transition: color 0.15s ease, background 0.15s ease;
  border-radius: 3px;
  padding: 1px 2px;
}
.rosary .prayer-line.current {
  color: var(--ink);
  background: rgba(184, 147, 74, 0.16);
  font-weight: 600;
}
.rosary-tempo {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-soft);
  margin: 0 0 10px; cursor: pointer; user-select: none;
}
.rosary-tempo input { width: 18px; height: 18px; accent-color: var(--gold-dim); }
body.large-text .rosary-tempo { font-size: 15px; }
body.large-text .rosary-tempo input { width: 20px; height: 20px; }
.rosary-actions { display: flex; gap: 8px; justify-content: flex-end; }
/* Play-polish #8: sticky CTAs always so Đóng/Tiếp stay clear of dock (mirror stations) */
#rosary-root .rosary {
  max-height: min(82vh, calc(100dvh - 100px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
#rosary-root .rosary-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  flex-wrap: wrap;
  margin: 0 -4px;
  padding: 10px 4px max(4px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, var(--cream) 32%);
}
#rosary-root .rosary-actions button {
  min-height: 48px;
  min-width: 48px;
  padding: 12px 14px;
}
.beads i.current { outline: 1.5px solid var(--gold-dim); outline-offset: 1px; }
.rosary .count {
  word-break: break-word;
  overflow-wrap: anywhere;
}
.rosary .mystery {
  word-break: break-word;
  overflow-wrap: anywhere;
}
.tooltip-pop {
  position: absolute; left: 16px; bottom: 118px;
  max-width: min(340px, 80vw);
  padding: 12px 14px; display: none;
}
.tooltip-pop.show { display: block; }
.tooltip-pop strong { display: block; color: #e8c27a; margin-bottom: 4px; font-family: var(--serif); font-size: 18px; }
.tooltip-pop p { margin: 0; font-family: var(--serif); font-size: 18px; line-height: 1.45; }

.tooltip-pop { max-width: min(420px, 86vw); }
.tooltip-pop .src {
  margin: 8px 0 0;
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.4;
  color: rgba(246, 239, 227, 0.72);
}
.sign-words, .rosary .prayer { font-size: 20px; }
.learn-modal { width: min(540px, 100%); }
.learn-modal h3 {
  font-family: var(--serif);
  font-size: 18px;
  margin: 18px 0 8px;
}
.learn-kicker {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--gold-dim);
  margin: 0 0 6px;
}
.learn-lead {
  font-family: var(--serif);
  font-size: 20px;
  margin: 0 0 12px;
  line-height: 1.4;
}
.learn-text {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  margin: 0 0 10px;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: min(100%, 390px);
}
.learn-lead {
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: min(100%, 390px);
}
.learn-refs {
  font-size: 17px;
  color: var(--ink-soft);
}
/* Featured feast / Sunday — solemn badge, not gamey chip */
.learn-feast {
  max-width: min(100%, 390px);
}
.learn-feast-rank {
  display: inline-block;
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-right: 4px;
  vertical-align: 0.12em;
}
.learn-feast-title {
  font-family: var(--serif);
  font-size: 18.5px;
  color: var(--ink);
}
.learn-feast-note {
  font-size: 16.5px;
  color: var(--ink-soft);
  max-width: min(100%, 390px);
}
.learn-empty {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink-soft);
  font-style: italic;
  max-width: min(100%, 390px);
  padding: 8px 0 4px;
}

/* Play-polish #9: sticky Đóng / CGKPV always (mirror rosary/stations) */
#learn-modal .modal {
  max-height: min(88vh, calc(100dvh - 16px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 12px;
}
#learn-modal .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -4px;
  padding: 10px 4px max(4px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, var(--cream) 28%);
}
#learn-modal .modal-actions .btn-ghost,
#learn-modal .modal-actions .btn-solid,
#learn-modal .modal-actions a.btn-solid {
  min-height: 48px;
  min-width: 48px;
  padding: 12px 16px;
}
@media (max-width: 390px) {
  #learn-modal .modal-actions {
    gap: 6px;
  }
  #learn-modal .modal-actions .btn-ghost,
  #learn-modal .modal-actions .btn-solid,
  #learn-modal .modal-actions a.btn-solid {
    padding: 11px 12px;
    font-size: 15px;
  }
  .learn-text, .learn-lead, .learn-feast, .learn-feast-note, .learn-empty {
    max-width: 100%;
  }
}

.learn-uncertain {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 12px;
  padding: 8px 12px;
  color: var(--ink-soft);
  background: rgba(74, 52, 40, 0.05);
  border-left: 3px solid var(--gold-dim);
  border-radius: 0 4px 4px 0;
}
.learn-modal .src { font-size: 12.5px; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.45; }
.learn-index { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.learn-index button {
  background: #fff;
  border: 1px solid rgba(74, 52, 40, 0.18);
  border-radius: 4px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13.5px;
}
.learn-index button:hover { border-color: var(--gold-dim); background: #f3e6c8; }
#learn-detail strong { font-family: var(--serif); font-size: 18px; }
#learn-detail p { font-family: var(--serif); font-size: 18px; line-height: 1.5; margin: 0 0 8px; }
#learn-detail .src { font-family: var(--sans); font-size: 12.5px; }
a.btn-solid {
  display: inline-flex; align-items: center;
  text-decoration: none; background: var(--wood); color: var(--cream);
  border-radius: 4px; padding: 10px 16px;
}


/* Chọn chế độ Mân Côi + thư viện kinh/giáo lý */
.pick-btn {
  display: block; width: 100%; text-align: left;
  background: #fff; border: 1px solid rgba(74, 52, 40, 0.18);
  border-radius: 4px; padding: 12px 14px; margin: 0 0 8px;
  cursor: pointer; color: var(--ink); font-size: 14.5px; line-height: 1.4;
  min-height: 48px; /* a11y tap — rosary picker / library */
}
.pick-btn:hover { border-color: var(--gold-dim); background: #f3e6c8; }
.pick-btn-primary {
  background: var(--wood);
  color: var(--cream);
  border-color: var(--wood);
  font-family: var(--serif);
  font-size: 15.5px;
  padding: 12px 14px;
  min-height: 48px;
  /* Stay visible while scrolling other ngắm on ~390px */
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 8px 12px -6px rgba(42, 28, 18, 0.35);
}
.pick-btn-primary:hover {
  background: #5a4032;
  border-color: var(--gold-dim);
  color: var(--cream);
}
.pick-btn-resume {
  border-color: rgba(232, 194, 122, 0.55);
  background: #faf3e4;
}
.pick-or {
  margin: 4px 0 10px;
  letter-spacing: 0.02em;
}
body.large-text .pick-btn-primary { font-size: 17px; min-height: 52px; padding: 14px 16px; }
.lib-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px;
}
.lib-tabs button {
  background: #fff; border: 1px solid rgba(74, 52, 40, 0.18);
  border-radius: 4px; padding: 8px 12px; cursor: pointer;
  color: var(--ink); font-size: 13.5px;
}
.lib-tabs button.on {
  background: var(--wood); color: var(--cream); border-color: var(--wood);
}
#library-body h3 {
  font-family: var(--serif); font-size: 18px; margin: 4px 0 10px;
}
#library-detail a { color: var(--gold-dim); }


/* WIN-GAP P2 #7: thư viện đọc theo dòng (reuse prayer-line + tempo) */
#library-detail.lib-line-reader .prayer-lines {
  display: flex; flex-direction: column; gap: 0.35em;
  font-family: var(--serif); font-size: 20px; line-height: 1.5;
  margin: 10px 0 12px;
}
#library-detail .prayer-line {
  margin: 0;
  color: var(--ink-soft);
  transition: color 0.15s ease, background 0.15s ease;
  border-radius: 3px;
  padding: 1px 2px;
}
#library-detail .prayer-line.current {
  color: var(--ink);
  background: rgba(184, 147, 74, 0.16);
  font-weight: 600;
}
#library-detail .lib-line-actions {
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  margin: 8px 0 4px;
}
#library-detail .lib-line-actions .btn-ghost,
#library-detail .lib-line-actions .btn-solid {
  min-height: 44px;
}
/* Play-polish #11: progress clear ~390px (mirror rosary/stations) */
#library-detail .lib-line-progress {
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 2px 0 6px;
  max-width: min(100%, 390px);
  word-break: break-word;
  overflow-wrap: anywhere;
}
body.large-text #library-detail .lib-line-progress { font-size: 14px; }
/* Play-polish #11: sticky Đóng + short/line CTAs always (mirror learn/rosary) */
#library-modal .modal {
  max-height: min(88vh, calc(100dvh - 16px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 12px;
}
#library-modal .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -4px;
  padding: 10px 4px max(4px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, var(--cream) 28%);
}
#library-modal .modal-actions .btn-ghost,
#library-modal .modal-actions .btn-solid {
  min-height: 48px;
  min-width: 48px;
  padding: 12px 16px;
}
#library-modal #library-detail .lib-line-actions {
  position: sticky;
  bottom: 56px;
  z-index: 1;
  margin: 8px 0 4px;
  padding: 8px 0 6px;
  background: linear-gradient(180deg, transparent, var(--cream) 32%);
}
#library-modal #library-detail .lib-line-actions .btn-ghost,
#library-modal #library-detail .lib-line-actions .btn-solid {
  min-height: 48px;
  min-width: 48px;
  padding: 12px 14px;
}
@media (max-width: 390px) {
  #library-modal .modal-actions { gap: 6px; }
  #library-modal #library-detail .lib-line-actions { gap: 6px; bottom: 52px; }
  #library-modal #library-detail .lib-line-actions .btn-ghost,
  #library-modal #library-detail .lib-line-actions .btn-solid {
    padding: 11px 12px;
    font-size: 15px;
  }
  #library-detail .lib-line-progress { font-size: 12px; }
}
body.large-text #library-detail.lib-line-reader .prayer-lines { font-size: 22px; }
#library-body > .pick-btn { margin-bottom: 12px; }

/* Play-polish #16: kho / học giáo lý — cards + detail wrap ~390px; empty solemn */
#library-body .learn-index {
  max-width: min(100%, 390px);
}
#library-body .lib-card {
  min-height: 48px;
  max-width: min(100%, 390px);
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: left;
}
#library-body .lib-card[aria-current="true"] {
  border-color: var(--gold-dim);
  background: #f3e6c8;
  box-shadow: inset 0 0 0 1px rgba(184, 147, 74, 0.35);
}
#library-detail.catechesis,
#library-detail .lib-detail-empty,
#library-body .lib-empty {
  max-width: min(100%, 390px);
  word-break: break-word;
  overflow-wrap: anywhere;
}
#library-body .lib-empty,
#library-detail .lib-detail-empty {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 8px 0 12px;
  padding: 10px 12px;
  background: rgba(74, 52, 40, 0.04);
  border-left: 3px solid var(--gold-dim);
  border-radius: 0 4px 4px 0;
}
@media (max-width: 390px) {
  #library-body .lib-card {
    min-height: 48px;
    padding: 10px 12px;
    font-size: 13px;
  }
  #library-body .lib-empty,
  #library-detail .lib-detail-empty {
    font-size: 14.5px;
    padding: 8px 10px;
  }
}


/* Play-polish #91: doctrine long-list UX — sticky group chips · filter · 48px taps (~390px) */
#library-body .lib-doctrine-tools {
  position: sticky;
  top: 0;
  z-index: 3;
  max-width: min(100%, 390px);
  margin: 0 0 8px;
  padding: 6px 0 8px;
  background: linear-gradient(180deg, var(--cream) 70%, transparent);
}
#library-body .lib-doctrine-filter {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  margin: 0 0 8px;
  padding: 10px 12px;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  background: #fffdf6;
  border: 1px solid rgba(184, 147, 74, 0.45);
  border-radius: 8px;
}
#library-body .lib-doctrine-filter:focus {
  outline: 2px solid var(--gold-dim);
  outline-offset: 1px;
}
/* Play-polish #116: 9 group chips — horizontal scroll on ~360px; chips ≥48px tap */
#library-body .lib-group-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  max-width: min(100%, 390px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 4px;
}
#library-body .lib-group-chip {
  flex: 0 0 auto;
  min-height: 48px;
  min-width: 48px;
  padding: 8px 12px;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.2;
  color: var(--ink-soft);
  background: #f7efdc;
  border: 1px solid rgba(184, 147, 74, 0.4);
  border-radius: 999px;
  cursor: pointer;
}
#library-body .lib-group-chip.on,
#library-body .lib-group-chip:hover {
  color: var(--ink);
  border-color: var(--gold-dim);
  background: #f3e6c8;
}
#library-body .lib-card {
  min-height: 48px;
}
@media (max-width: 390px) {
  #library-body .lib-doctrine-filter {
    min-height: 48px;
    font-size: 14px;
  }
  #library-body .lib-group-chip {
    min-height: 48px;
    padding: 9px 11px;
    font-size: 12.5px;
  }
}

/* Play-polish #32: doctrine groups — Mùa · Bí tích · Kinh nguyện (solemn, ~390px) */
#library-body .lib-doctrine-browse {
  max-width: min(100%, 390px);
}
#library-body .lib-group {
  max-width: min(100%, 390px);
  margin: 0 0 12px;
}
#library-body .lib-group-label {
  font-family: var(--serif);
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 12px 0 6px;
  padding: 0 2px;
  letter-spacing: 0.02em;
}
#library-body .lib-group:first-child .lib-group-label {
  margin-top: 4px;
}
@media (max-width: 390px) {
  #library-body .lib-group-label {
    font-size: 13px;
    margin: 10px 0 5px;
  }
}




/* Chữ lớn (người lớn tuổi / mobile) */
body.large-text .rosary .prayer,
body.large-text .sign-words,
body.large-text .learn-text,
body.large-text .hint,
body.large-text .look-label,
body.large-text #toast,
body.large-text .tooltip-pop p,
body.large-text .tooltip-pop strong { font-size: 22px; }
body.large-text .dock button,
body.large-text .more-menu button { font-size: 17px; padding: 14px 18px; min-height: 48px; min-width: 48px; }
body.large-text .chip { font-size: 14.5px; }
body.large-text .gate-card h1 { font-size: 36px; }
body.large-text .catechesis { font-size: 16.5px; }


/* Đàng Thánh Giá — tái dùng overlay rosary */
.stations-dots i { border-radius: 2px; width: 10px; height: 10px; }
.stations-dots i.current { outline: 1.5px solid var(--gold-dim); outline-offset: 1px; }
.stations-panel .prayer { word-break: break-word; }
body.large-text .stations-panel .prayer { font-size: 22px; }
/* Gospel-ref own line — readable ~390px; wrap long refs / truyền thống label */
.stations-panel .stations-gospel {
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-soft);
  margin: -4px 0 12px;
  padding: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.stations-panel .stations-gospel.biblical { color: var(--ink); }
.stations-panel .stations-gospel.trad { font-style: italic; }
body.large-text .stations-panel .stations-gospel { font-size: 15.5px; }
/* Sticky CTAs always (not only ≤560px) so next/prev stay clear of dock */
.stations-panel .stations-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 -4px;
  padding: 10px 4px max(4px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, var(--cream) 32%);
}
.stations-panel .stations-actions button {
  min-height: 48px;
  min-width: 48px;
  padding: 12px 14px;
}
.stations-panel .stations-actions #stations-prev:disabled {
  opacity: 0.4;
  cursor: default;
}
@media (max-width: 380px) {
  .rosary h2 { font-size: 18px; }
  .rosary .prayer, .stations-panel .prayer { font-size: 17px; }
  .rosary .count { font-size: 12px; letter-spacing: 0.04em; }
  .rosary .mystery { font-size: 13px; }
  .stations-panel .stations-gospel { font-size: 12.5px; }
  .stations-panel .mystery { font-size: 13px; }
  .stations-panel .stations-actions { gap: 6px; }
  .stations-panel .stations-actions button { padding: 11px 12px; font-size: 15px; }
  #rosary-root .rosary-actions { gap: 6px; }
  #rosary-root .rosary-actions button { padding: 11px 12px; font-size: 15px; }
  .pick-btn-primary { font-size: 14.5px; padding: 11px 12px; }
}

/* —— Hạt chip + check-in / wardrobe stubs (Lavish QC 0611) —— */
.hat-chip {
  margin-left: auto;
  text-align: right;
  cursor: pointer;
  background: rgba(18, 14, 10, 0.78);
  max-width: min(200px, 42vw);
  opacity: 0.6;
  transition: opacity 0.8s ease, visibility 0.8s ease;
  pointer-events: auto;
}
.hat-chip.hat-hidden {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none;
}
.hat-chip.claimable { border-color: rgba(232, 194, 122, 0.65); opacity: 0.72; }
.hat-chip:hover, .hat-chip:focus { opacity: 1; }
.hat-chip strong {
  /* Lavish v11 shot nit: «Hạt» label ~11–12px → ≥15px */
  font-size: 15px;
  letter-spacing: 0.05em;
}
.hat-chip #hat-chip-line { font-size: 15px; color: #f3e6cf; }
.disclaimer-inline {
  font-size: 15px; line-height: 1.45; color: var(--ink-soft);
  border-left: 3px solid var(--gold); padding: 8px 10px;
  background: rgba(74, 52, 40, 0.06); margin: 0 0 14px;
}
.progress-stats p { margin: 0 0 6px; font-size: 15px; color: var(--ink); }
.wardrobe-list { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; }
.wardrobe-item {
  display: block; width: 100%; text-align: left;
  background: #fff; border: 1px solid rgba(74, 52, 40, 0.18);
  border-radius: 4px; padding: 12px 14px; cursor: pointer; color: var(--ink);
  font-size: 15px; min-height: 48px;
}
.wardrobe-item .w-name {
  display: block; font-family: var(--serif); font-weight: 600;
  font-size: 17px; line-height: 1.3; color: var(--ink);
}
.wardrobe-item .w-meta {
  display: block; font-size: 15px; color: var(--ink-soft); margin-top: 3px; line-height: 1.4;
}
.wardrobe-item .w-lock {
  display: block; font-size: 13px; color: var(--ink-soft); margin-top: 6px;
  letter-spacing: 0.02em;
}
.wardrobe-item .w-lock::before { content: "🔒 "; font-size: 11px; }
.wardrobe-item .w-soon {
  display: inline-block; margin-top: 6px; font-size: 14px;
  color: var(--gold-dim); letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid rgba(184, 147, 74, 0.45); border-radius: 3px;
  padding: 2px 7px; background: rgba(246, 239, 227, 0.85);
}
.wardrobe-item .w-eq { display: block; font-size: 14px; color: var(--gold-dim); margin-top: 4px; }
.wardrobe-item.equipped { border-color: var(--gold-dim); background: #f3e6c8; }
.wardrobe-item.greyed {
  opacity: 1; cursor: default;
  background: var(--cream); /* cream, not cold grey */
  border-color: rgba(74, 52, 40, 0.12);
  color: var(--ink-soft);
}
.wardrobe-item.greyed .w-name { color: var(--ink-soft); font-weight: 550; }
.wardrobe-item.greyed .w-meta { color: #7a7166; }
.wardrobe-item:disabled { cursor: default; }
.wardrobe-item:not(:disabled):hover { border-color: var(--gold-dim); background: #f3e6c8; }
#wardrobe-modal .sub { font-size: 15px; }
@media (max-width: 520px) {
  .top-bar { flex-wrap: wrap; }
  .hat-chip { margin-left: 0; max-width: 100%; }
}

/* —— Share stub + first-visit intro —— */
.share-stub { width: 100%; margin: 8px 0 4px; }
.share-note { margin: 0 0 10px; font-size: 12px; color: var(--ink-soft); }
#intro-modal .gate-kicker {
  margin: 0 0 6px; font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--gold-dim);
}
#intro-modal h2 { margin: 0 0 10px; font-size: 22px; }

/* lavish-min-15 — wardrobe / check-in readable floor */
#wardrobe-modal .modal,
#checkin-modal .modal { font-size: 15px; }
#wardrobe-modal .modal .src { font-size: 15px; }


/* —— Lavish wardrobe groups + overlay chrome (0611) —— */
.wardrobe-section { margin: 0 0 12px; }
.wardrobe-sec-title {
  margin: 0 0 8px; font-size: 15px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--gold-dim);
}
.wardrobe-sec-toggle {
  display: flex; width: 100%; align-items: center; justify-content: space-between;
  background: transparent; border: 1px dashed rgba(74, 52, 40, 0.28);
  border-radius: 4px; padding: 10px 12px; cursor: pointer;
  font-size: 15px; color: var(--ink-soft); margin: 0 0 8px;
}
.wardrobe-sec-toggle .w-count { color: var(--gold-dim); font-size: 14px; }
.wardrobe-soon-sec.open .wardrobe-sec-toggle {
  border-style: solid; border-color: rgba(184, 147, 74, 0.45); color: var(--ink);
}
.wardrobe-sec-body { display: flex; flex-direction: column; gap: 8px; }
.wardrobe-sec-body.collapsed { display: none; }

.today-chip.overlay-hidden,
.hat-chip.overlay-hidden {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none;
}

/* Play-polish #6/#8/#9/#10: dock muted under devotion overlay — no tap/focus steal */
body.overlay-open .dock {
  opacity: 0.28;
  pointer-events: none;
}
body.overlay-open .dock[aria-hidden="true"],
body.overlay-open .dock[aria-hidden="true"] * {
  /* keep muted; JS sets aria-hidden while anyModalOpen */
  pointer-events: none;
}

/* Toast sits clear of dock; when modal open, keep under scrim but readable if any leak */
#toast {
  bottom: max(168px, calc(22px + 56px + env(safe-area-inset-bottom, 0px)));
  z-index: 28;
  line-height: 1.4;
  padding: 12px 18px;
}
body.large-text #toast {
  font-size: 20px;
  max-width: min(92vw, 440px);
  bottom: max(188px, calc(28px + 64px + env(safe-area-inset-bottom, 0px)));
}
body.overlay-open #toast.toast-above-modal.show {
  /* Feedback (mặc trang phục / điểm danh) sits above modal scrim */
  z-index: 40;
  bottom: max(28px, calc(12px + env(safe-area-inset-bottom, 0px)));
}

/* —— Wardrobe 2D silhouette try-preview (0611) — no images / no Xu —— */
.wardrobe-preview {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 14px; padding: 12px 14px;
  background: #f6efe3; border: 1px solid rgba(74, 52, 40, 0.16);
  border-radius: 6px;
}
.wp-figure {
  flex: 0 0 auto; width: 120px; min-height: 210px;
  display: flex; align-items: flex-end; justify-content: center;
  position: relative;
  /* Soft warm brown/cream halo behind silhouette (Lavish QC) — no black border */
  background:
    radial-gradient(ellipse 72% 58% at 50% 58%,
      rgba(232, 194, 122, 0.38) 0%,
      rgba(246, 239, 227, 0.55) 42%,
      rgba(246, 239, 227, 0) 74%);
  border-radius: 48% 48% 40% 40%;
}
.wp-svg { display: block; max-width: 100%; height: auto; position: relative; z-index: 1; }
.wp-meta { flex: 1 1 auto; min-width: 0; }
.wp-name {
  margin: 0 0 4px; font-family: var(--serif); font-weight: 600;
  font-size: 17px; line-height: 1.3; color: var(--ink);
}
.wp-note {
  margin: 0 0 10px; font-size: 15px; line-height: 1.4; color: var(--ink-soft);
}
.wp-lock-badge {
  display: inline-block; margin: 0 0 8px; font-size: 15px;
  color: var(--gold-dim); letter-spacing: 0.04em;
  border: 1px solid rgba(184, 147, 74, 0.5); border-radius: 3px;
  padding: 6px 10px; background: rgba(246, 239, 227, 0.95);
  min-height: 40px; line-height: 1.3;
}
.wp-lock-badge::before { content: "🔒 "; font-size: 15px; }
#wardrobe-wear {
  min-height: 48px; min-width: 120px; padding: 12px 18px;
  font-size: 16px;
}
.wardrobe-item.previewing {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 2px rgba(184, 147, 74, 0.28);
}
.wardrobe-item.greyed.previewing { background: #efe6d4; }
body.large-text .wp-name { font-size: 19px; }
body.large-text .wp-note, body.large-text .wp-lock-badge { font-size: 17px; }
body.large-text .wp-lock-badge::before { font-size: 17px; }
body.large-text #wardrobe-wear { font-size: 18px; min-height: 52px; }

body.large-text .wardrobe-item .w-name { font-size: 19px; }
body.large-text .wardrobe-item .w-meta,
body.large-text .wardrobe-sec-toggle,
body.large-text .disclaimer-inline { font-size: 16.5px; }
body.large-text .coach-tip { font-size: 18px; }

/* 3-tap coach — soft skip «Để sau» (pointer-events only on skip) */
.coach-tip {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: rgba(18, 14, 10, 0.88); border: 1px solid rgba(232, 194, 122, 0.55);
  color: var(--cream); padding: 10px 14px; border-radius: 4px;
  font-family: var(--serif); font-size: 16px; line-height: 1.4;
  max-width: min(420px, 86vw); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.5s ease; z-index: 12;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px;
}
.coach-tip.show { opacity: 1; }
.coach-tip .coach-msg { flex: 1 1 auto; min-width: 0; }
.coach-tip .coach-skip {
  pointer-events: auto;
  flex: 0 0 auto;
  min-height: 48px;
  min-width: 48px;
  padding: 8px 14px;
  margin: 0;
  border-radius: 4px;
  border: 1px solid rgba(232, 194, 122, 0.55);
  background: rgba(12, 9, 7, 0.55);
  color: #fff8ec;
  font-family: var(--serif);
  font-size: 15px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.coach-tip .coach-skip:hover,
.coach-tip .coach-skip:focus-visible {
  border-color: var(--gold);
  background: rgba(42, 32, 22, 0.9);
}
body.large-text .coach-tip .coach-skip {
  min-height: 52px;
  min-width: 52px;
  font-size: 17px;
  padding: 10px 16px;
}
.dock button.coach-pulse {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(232, 194, 122, 0.35);
  opacity: 1 !important;
  animation: coach-glow 1.8s ease-in-out infinite;
}
@keyframes coach-glow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(232, 194, 122, 0.25); }
  50% { box-shadow: 0 0 0 4px rgba(232, 194, 122, 0.45); }
}
@media (prefers-reduced-motion: reduce) {
  .dock button.coach-pulse { animation: none; }
}


/* —— First-visit retention tip strip (sit → candle → rosary → today) —— */
.first-tips {
  position: absolute;
  left: 50%;
  top: max(72px, calc(56px + env(safe-area-inset-top, 0px)));
  transform: translateX(-50%);
  z-index: 11;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  max-width: min(520px, 92vw);
  padding: 8px 10px 8px 14px;
  background: rgba(18, 14, 10, 0.82);
  border: 1px solid rgba(232, 194, 122, 0.42);
  border-radius: 6px;
  color: var(--cream);
  font-family: var(--serif);
  pointer-events: none; /* never block prayer / dock / chips */
  opacity: 0;
  transition: opacity 0.45s ease;
}
.first-tips.show {
  opacity: 1;
  pointer-events: none;
}
.first-tips[hidden] { display: none !important; }
.first-tips-label {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: rgba(232, 194, 122, 0.78);
}
.first-tips-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: tipstep;
}
.first-tips-steps li {
  counter-increment: tipstep;
  font-size: 15px;
  line-height: 1.35;
  color: #f6efe3;
  white-space: normal; /* Lavish: wrap on small screens, no nowrap overflow */
}
.first-tips-steps li::before {
  content: counter(tipstep) " · ";
  color: rgba(232, 194, 122, 0.85);
  font-weight: 600;
}
.first-tips-dismiss {
  pointer-events: auto; /* only dismiss is tappable */
  min-height: 48px;
  min-width: 48px;
  padding: 10px 16px;
  margin: 0;
  border-radius: 4px;
  border: 1px solid rgba(232, 194, 122, 0.55);
  background: rgba(12, 9, 7, 0.55);
  color: #fff8ec;
  font-family: var(--serif);
  font-size: 15px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.first-tips-dismiss:hover,
.first-tips-dismiss:focus-visible {
  border-color: var(--gold);
  background: rgba(42, 32, 22, 0.9);
}
body.large-text .first-tips-label { font-size: 17px; }
body.large-text .first-tips-steps li { font-size: 17px; }
body.large-text .first-tips-dismiss {
  min-height: 52px;
  min-width: 52px;
  font-size: 17px;
  padding: 12px 18px;
}
body.overlay-open .first-tips.show {
  opacity: 0;
  pointer-events: none;
}
@media (max-width: 420px) {
  .first-tips {
    top: max(96px, calc(78px + env(safe-area-inset-top, 0px)));
    gap: 6px 8px;
    padding: 8px 10px;
  }
  .first-tips-steps li { font-size: 15px; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .first-tips { transition: none; }
}


/* Soft sitters — no nametag, no interact */
.soft-sitter { pointer-events: none; }


/* —— Ambient mute / mixer note (0611 polish-b) —— */
.mixer-check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  margin: 4px 0 2px;
  color: #f0e6d4;
  cursor: pointer;
}
.mixer-check input { width: auto; accent-color: var(--gold); }
.mixer-note {
  margin: 0 0 8px;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(232, 194, 122, 0.75);
}
.mixer label:has(input[type="range"]) { opacity: 0.55; }
body.ambient-on .mixer label:has(input[type="range"]) { opacity: 1; }

/* focus rings: see A11y thin polish below */

/* Nến TTL 24h — trạng thái trên máy */
.candle-ttl {
  white-space: pre-line;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-soft);
  background: rgba(232, 194, 122, 0.12);
  border: 1px solid rgba(184, 147, 74, 0.35);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0 0 12px;
}
body.large-text .candle-ttl { font-size: 17px; }

/* —— Advent week prep stub (2026) —— */
.advent-prep {
  margin: 14px 0 16px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid rgba(107, 76, 122, 0.45);
  background: rgba(107, 76, 122, 0.08);
}
.advent-prep h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 20px;
  color: #5a3d68;
  font-weight: 600;
}
.advent-weeks {
  list-style: none;
  margin: 8px 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.advent-weeks li {
  padding: 8px 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(107, 76, 122, 0.22);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
}
/* Current week: dark purple + purple dot (not pink). Pink reserved for Gaudete (week 3). */
.advent-weeks li.current {
  position: relative;
  padding-left: 22px;
  border-color: #4a3558;
  background: rgba(107, 76, 122, 0.12);
}
.advent-weeks li.current::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b4c7a;
}
.advent-weeks li.current.gaudete {
  border-color: rgba(180, 100, 120, 0.85);
  background: rgba(196, 138, 154, 0.22);
}
.advent-weeks li.current.gaudete::before {
  background: #c48a9a;
}
.advent-weeks .advent-date {
  color: var(--gold-dim);
  font-size: 15px;
  margin-left: 4px;
}
.advent-weeks .advent-note {
  color: var(--ink-soft);
  font-size: 15px;
}
body.large-text .advent-prep h3 { font-size: 24px; }
body.large-text .advent-weeks li { font-size: 17px; padding: 10px 12px; min-height: 48px; }
body.large-text .advent-weeks .advent-note,
body.large-text .advent-weeks .advent-date { font-size: 15px; }

/* P1-3 season path card (readings) — soft 4-week checkboxes */
.season-path {
  margin: 14px 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(107, 76, 122, 0.35);
  border-radius: 8px;
  background: rgba(107, 76, 122, 0.06);
}
.season-path-soft {
  border-color: rgba(107, 143, 113, 0.4);
  background: rgba(107, 143, 113, 0.07);
}
.season-path h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: #4a3558;
}
.season-path-soft h3 { color: #3d5a44; }
.season-path-weeks {
  list-style: none;
  margin: 8px 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.season-path-weeks li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.45);
  min-height: 44px;
}
.season-path-weeks li.current {
  outline: 2px solid rgba(107, 76, 122, 0.45);
  background: rgba(255, 255, 255, 0.7);
}
.season-path-soft .season-path-weeks li.current {
  outline-color: rgba(107, 143, 113, 0.5);
}
.season-path-weeks li.done {
  opacity: 0.78;
}
.season-path-weeks input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #6b4c7a;
  flex: 0 0 auto;
}
.season-path-soft .season-path-weeks input[type="checkbox"] {
  accent-color: #6b8f71;
}
.season-path-weeks label {
  flex: 1 1 140px;
  font-size: 15px;
  line-height: 1.35;
  cursor: pointer;
}
.season-path-go {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(107, 76, 122, 0.4);
  background: #f7f1fa;
  color: #4a3558;
  font-size: 14px;
  cursor: pointer;
}
.season-path-soft .season-path-go {
  border-color: rgba(107, 143, 113, 0.45);
  background: #f1f7f2;
  color: #3d5a44;
}
body.large-text .season-path h3 { font-size: 22px; }
body.large-text .season-path-weeks label { font-size: 17px; }
body.large-text .season-path-go { font-size: 16px; min-height: 44px; }



/* —— Elderly / large-control polish (0611) —— */
/* Baseline 48px tap on ritual actions (rosary / stations / candle) */
.rosary-actions button,
#candle-modal .modal-actions button,
#candle-modal .intentions button,
#candle-modal .share-stub,
#sign-modal .modal-actions button {
  min-height: 48px;
  min-width: 48px;
}
#candle-modal .intentions button {
  padding: 12px 14px;
}
#candle-modal .modal-actions button,
.rosary-actions button {
  padding: 12px 18px;
  font-size: 15px;
}

/* High-contrast dock when Chữ lớn (opt-large) */
body.large-text .dock {
  opacity: 0.92;
  gap: 10px;
  bottom: max(22px, env(safe-area-inset-bottom, 0px));
}
body.large-text .dock:hover,
body.large-text .dock:focus-within { opacity: 1; }
body.large-text .dock button,
body.large-text .more-menu button {
  background: rgba(12, 9, 7, 0.94);
  color: #fff8ec;
  border: 2px solid rgba(232, 194, 122, 0.78);
  font-weight: 600;
  letter-spacing: 0.01em;
}
body.large-text .dock button.primary {
  background: #4a3428;
  border-color: #e8c27a;
}
body.large-text .dock button:hover,
body.large-text .more-menu button:hover {
  background: #2a2016;
  border-color: #f0d48a;
}
body.large-text .stand-corner {
  min-height: 48px;
  min-width: 48px;
  padding: 10px 14px;
  font-size: 17px;
  opacity: 0.9;
  background: rgba(12, 9, 7, 0.94);
  color: #fff8ec;
  border: 2px solid rgba(232, 194, 122, 0.78);
}
body.large-text .more-menu {
  background: rgba(12, 9, 7, 0.96);
  border: 2px solid rgba(232, 194, 122, 0.65);
}
body.large-text .rosary-actions button {
  min-height: 52px;
  font-size: 17px;
  padding: 14px 20px;
}
body.large-text #candle-modal .modal-actions button,
body.large-text #candle-modal .intentions button,
body.large-text #sign-modal .modal-actions button {
  min-height: 52px;
  font-size: 17px;
}
body.large-text #candle-modal .intentions button small { font-size: 14px; }

/* —— Soft FPS HUD (debug: ?fps=1 / localStorage cong-chua-debug-fps) —— */
#fps-badge {
  position: fixed;
  right: max(10px, env(safe-area-inset-right, 0px));
  bottom: max(10px, env(safe-area-inset-bottom, 0px));
  z-index: 22;
  padding: 4px 8px;
  border-radius: 3px;
  font: 11px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
  color: rgba(246, 239, 227, 0.88);
  background: rgba(12, 9, 7, 0.55);
  border: 1px solid rgba(184, 147, 74, 0.28);
  pointer-events: none;
  user-select: none;
}
#fps-badge[hidden] { display: none !important; }
#hud #fps-badge { pointer-events: none; }

/* —— Cohort stats (dev: ?stats=1) —— */
#cohort-stats {
  position: fixed;
  left: max(10px, env(safe-area-inset-left, 0px));
  bottom: max(10px, env(safe-area-inset-bottom, 0px));
  z-index: 22;
  max-width: min(92vw, 420px);
  padding: 4px 8px;
  border-radius: 3px;
  font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
  color: rgba(246, 239, 227, 0.88);
  background: rgba(12, 9, 7, 0.55);
  border: 1px solid rgba(184, 147, 74, 0.28);
  pointer-events: none;
  user-select: none;
}
#cohort-stats[hidden] { display: none !important; }

/* —— A11y thin polish (0611) —— */
.skip-link {
  position: fixed;
  left: max(12px, env(safe-area-inset-left, 0px));
  top: max(12px, env(safe-area-inset-top, 0px));
  z-index: 100;
  padding: 10px 14px;
  background: var(--cream);
  color: var(--ink);
  border: 2px solid var(--gold);
  border-radius: 4px;
  font-size: 17px; /* Lavish a11y: chữ lớn 17px */
  min-height: 48px; /* Lavish a11y: hit target ≥48px when revealed */
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  line-height: 1.3;
  text-decoration: none;
  box-shadow: var(--shadow);
  /* hidden until keyboard focus */
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
}
.skip-link:focus,
.skip-link:focus-visible {
  clip: auto;
  clip-path: none;
  width: auto;
  height: auto;
  overflow: visible;
  white-space: normal;
  outline: 2px solid var(--gold-dim);
  outline-offset: 3px;
}

.today-aside {
  /* flex child in .top-bar — keep complementary landmark (avoid display:contents) */
  max-width: min(360px, 70vw);
}
.today-aside .today-chip { max-width: 100%; }

#dock:focus {
  outline: none; /* landing target from skip; children take focus ring */
}

/* Calm gold focus for keyboard / elderly — Lavish, not neon */
:where(a, button, input, textarea, select, [role="button"], [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 2px solid rgba(232, 194, 122, 0.9);
  outline-offset: 2px;
}
.modal-root.open .modal :focus-visible,
.rosary-root.open .rosary :focus-visible {
  /* Lavish a11y: wood brown on cream modal (gold too faint) */
  outline: 2px solid #4a3428;
  outline-offset: 2px;
}
body.large-text .modal-root.open .modal :focus-visible,
body.large-text .rosary-root.open .rosary :focus-visible {
  outline: 3px solid #4a3428;
  outline-offset: 3px;
}
body.large-text :where(a, button, input, textarea, select, [role="button"], [tabindex]:not([tabindex="-1"])):focus-visible {
  outline-width: 3px;
  outline-offset: 3px;
}

/* WIN-GAP #8 — người giữ nhà thờ (4 câu cố định) */
#keeper-modal .keeper-qs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 14px;
}
#keeper-modal .keeper-qs button {
  background: #fff;
  border: 1px solid rgba(74, 52, 40, 0.18);
  border-radius: 4px;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.35;
  text-align: left;
  min-height: 48px;
}
#keeper-modal .keeper-qs button:hover,
#keeper-modal .keeper-qs button.selected {
  border-color: var(--gold-dim);
  background: #f3e6c8;
}
#keeper-modal #keeper-answer {
  margin: 0 0 12px;
}
#keeper-modal #keeper-answer strong {
  display: block;
  font-family: var(--serif);
  font-size: 18px;
  margin-bottom: 6px;
  color: var(--ink);
}
#keeper-modal #keeper-answer p {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  margin: 0 0 8px;
  color: var(--ink);
}
#keeper-modal #keeper-answer .src {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 8px 0 0;
  line-height: 1.45;
}
@media (max-width: 420px) {
  #keeper-modal .keeper-qs { grid-template-columns: 1fr; }
}
body.large-text #keeper-modal .keeper-qs button { font-size: 18px; padding: 14px 16px; }
body.large-text #keeper-modal #keeper-answer strong { font-size: 22px; }
body.large-text #keeper-modal #keeper-answer p { font-size: 20px; }

/* —— Play-polish #21: sticky Đóng secondary modals (keeper/checkin/wardrobe/intro) —— */
#keeper-modal .modal-actions,
#checkin-modal .modal-actions,
#wardrobe-modal .modal-actions,
#intro-modal .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -4px;
  padding: 10px 4px max(4px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, var(--cream) 28%);
}
#keeper-modal .modal-actions .btn-ghost,
#keeper-modal .modal-actions .btn-solid,
#checkin-modal .modal-actions .btn-ghost,
#checkin-modal .modal-actions .btn-solid,
#wardrobe-modal .modal-actions .btn-ghost,
#wardrobe-modal .modal-actions .btn-solid,
#intro-modal .modal-actions .btn-ghost,
#intro-modal .modal-actions .btn-solid {
  min-height: 48px;
  min-width: 48px;
}

/* —— Play-polish #20: mobile safe-area (notch / home indicator / status) ——
 * Gate · #dock · posture-bar · modal-root · rosary-root · sticky CTAs · toast
 * use env(safe-area-inset-*); viewport-fit=cover already on index/offline.
 * Desktop preview unchanged (env insets resolve to 0). */


/* —— Play-polish #47: first-visit dismiss reliable —— */
#intro-modal.modal-root {
  z-index: 50; /* above #gate(40) + toast-above-modal(40) */
  pointer-events: auto;
}
#intro-modal.modal-root.open {
  display: flex;
}
#intro-modal .modal {
  position: relative;
  z-index: 1;
  transform: none;
  animation: none;
}
#intro-modal .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  pointer-events: auto;
}
#intro-modal #intro-ok {
  position: relative;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 48px;
  padding: 14px 20px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transform: none !important;
  animation: none !important;
  pointer-events: auto;
  cursor: pointer;
}
@media (max-width: 420px) {
  #intro-modal #intro-ok {
    width: 100%;
    min-height: 52px;
  }
}
/* While first-visit open, keep toast under intro (not over the CTA) */
body.overlay-open.intro-open #toast.toast-above-modal.show {
  z-index: 35;
}


/* P1-2 check-in gratitude edit — quiet text button */
button.linkish {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  opacity: 0.85;
}
button.linkish:focus-visible {
  outline: 2px solid rgba(106, 32, 24, 0.45);
  outline-offset: 2px;
}


/* Play-polish #126 / deploy #125: privacy links */
#gate .gate-privacy-link {
  color: #e8d4b0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#gate .gate-privacy-link:focus-visible {
  outline: 2px solid #e8d4b0;
  outline-offset: 3px;
}
.more-menu a.more-menu-link {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 14px;
  color: #f3e6cf;
  text-decoration: none;
  font: inherit;
  border-radius: 8px;
}
.more-menu a.more-menu-link:hover,
.more-menu a.more-menu-link:focus-visible {
  background: rgba(243, 230, 207, 0.08);
  outline: none;
}
