:root {
  --paper: #fbf5ea;
  --paper-2: #f3e9d6;
  --ink: #3b2a20;
  --muted: #7a6656;
  --son: #a8372b;
  --son-dark: #7c241c;
  --gold: #d6a53a;
  --line: rgba(59, 42, 32, 0.14);
  --shadow: 0 6px 24px rgba(40, 25, 15, 0.18);
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Noto Serif', Georgia, serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #7f9468; color: var(--ink); font-family: var(--font); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }

.card { background: rgba(251, 245, 234, 0.92); backdrop-filter: blur(6px); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 14px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }

.labels3d { position: fixed !important; inset: 0; pointer-events: none; z-index: 1; }
.label3d { font: 600 11px var(--font); color: #4b392b; background: rgba(255, 248, 228, .92); padding: 3px 9px; border: 1px solid rgba(143, 107, 62, .22); border-radius: 999px; white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; transform: translateY(14px); box-shadow: 0 2px 6px rgba(45, 31, 20, .14); }
.label3d.me { color: #fff2cc; background: rgba(126, 53, 39, .94); border-color: rgba(244, 205, 125, .7); }
.label3d.npc { color: #5a3410; background: rgba(243, 196, 104, .95); border-color: rgba(176, 112, 30, .45); }
.bubble3d { font: 500 15px/1.4 var(--font); color: #503c2d; background: rgba(255, 251, 239, .97); padding: 7px 11px; border: 1px solid rgba(174, 135, 77, .3); border-radius: 14px 14px 14px 4px; max-width: 190px; overflow-wrap: anywhere; text-align: center; box-shadow: 0 4px 14px rgba(52, 34, 20, .17); }
.hud, .bar-actions, .toasts, .festival, .conn { z-index: 2; }
.hud { position: fixed; top: 12px; left: 12px; right: 12px; display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-temple h1 { font-family: var(--serif); font-size: 18px; color: var(--son-dark); }
.hud-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hud-progress { min-width: 230px; max-width: 300px; }
.hud-progress strong { font-size: 14px; }
.bar { height: 8px; border-radius: 4px; background: var(--paper-2); margin: 6px 0 4px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--son)); border-radius: 4px; transition: width 0.8s ease; }
.icon-btn { background: none; border: 0; font-size: 18px; padding: 2px 4px; }

.festival { position: fixed; top: 112px; left: 50%; transform: translateX(-50%); background: var(--son); color: #fff6e0; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap; }
.conn { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(59, 42, 32, 0.85); color: #fff; padding: 10px 16px; border-radius: 10px; }

.bar-actions { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); display: flex; gap: 4px; background: rgba(251, 245, 234, 0.94); padding: 6px; border-radius: 18px; box-shadow: var(--shadow); max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; }
.bar-actions button { border: 0; background: transparent; border-radius: 12px; padding: 6px 8px; min-width: 58px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.bar-actions button span { font-size: 22px; line-height: 1; }
.bar-actions button:hover, .bar-actions button:focus-visible { background: var(--paper-2); outline: none; }
.bar-actions button.primary { background: var(--son); color: #fff6e0; }
.bar-actions button.cool { opacity: 0.45; }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b)); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { background: rgba(59, 42, 32, 0.9); color: #fff8ea; padding: 8px 14px; border-radius: 12px; font-size: 14px; text-align: center; animation: rise 0.3s ease; pointer-events: auto; }
.toast button { margin-left: 8px; background: var(--gold); border: 0; color: var(--ink); border-radius: 8px; padding: 2px 8px; font-weight: 600; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Bảng trượt */
.sheet { position: fixed; inset: 0; display: none; align-items: flex-end; justify-content: center; background: rgba(30, 20, 12, 0.35); z-index: 10; }
.sheet.open { display: flex; }
.sheet-body { position: relative; background: var(--paper); width: min(100%, 520px); max-height: 88vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 22px 20px calc(22px + var(--safe-b)); box-shadow: var(--shadow); animation: up 0.25s ease; }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-body { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet h3 { font-family: var(--serif); color: var(--son-dark); font-size: 20px; margin-bottom: 6px; }
.close { position: absolute; top: 12px; right: 14px; border: 0; background: var(--paper-2); width: 32px; height: 32px; border-radius: 50%; }

.welcome { text-align: center; background: radial-gradient(circle at 50% 0%, #fff8ea, var(--paper) 60%); }
#welcome { background: linear-gradient(rgba(30, 20, 12, 0.25), rgba(30, 20, 12, 0.55)); }
.logo { font-size: 46px; }
.display { font-family: var(--serif); font-size: 34px; color: var(--son-dark); letter-spacing: 0.5px; }
.lead { margin: 8px 0 14px; line-height: 1.5; }
.invite { background: var(--paper-2); border-radius: 10px; padding: 8px; font-weight: 600; }
.name-pick { margin: 6px 0 12px; }
.name-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 4px; }
.name-show { font-family: var(--serif); font-size: 26px; font-weight: 700; }
.robe-pick { display: flex; justify-content: center; gap: 10px; margin-bottom: 16px; }
.robe-pick button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5); }
.robe-pick button.sel { border-color: var(--ink); }
.promise { list-style: none; padding: 0; margin: 16px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.8; }
.promise li::before { content: '· '; }

.big-btn { display: block; width: 100%; border: 0; background: var(--son); color: #fff6e0; font-weight: 700; font-size: 16px; padding: 13px; border-radius: 14px; margin-top: 12px; }
.big-btn:active { background: var(--son-dark); }
.big-btn:disabled { opacity: 0.5; }
.ghost-btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 12px; font-weight: 600; }
.ghost-btn.light { background: rgba(255, 255, 255, 0.1); color: #fff6e0; border-color: rgba(255, 255, 255, 0.3); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chips button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-size: 13.5px; }
.chips button.sel { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 6px 0; }

.wishes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.wishes button { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 14px 10px; font-size: 14px; font-weight: 600; text-align: left; }
.wishes button::before { content: '🪷 '; }
.wishes button:hover { background: var(--paper-2); }

.stages { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.stages li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-size: 14px; }
.stages li .st { width: 22px; text-align: center; }
.stages li.done { background: #f1ead9; }
.stages li.cur { border-color: var(--son); }
.stages li .sub { margin-left: auto; color: var(--muted); font-size: 12px; text-align: right; }
.stages li.lock { opacity: 0.55; }

.share { display: flex; gap: 6px; margin: 10px 0; }
.share input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13px; background: #fff; }
.link { display: inline-block; margin: 4px 0 10px; color: var(--son-dark); font-weight: 600; font-size: 14px; }
.create { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.create summary { cursor: pointer; font-weight: 600; }
.preview { font-size: 15px; }
#pcStats { white-space: pre-line; }

/* Tĩnh tâm */
.focus { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: radial-gradient(circle at 50% 40%, rgba(60, 44, 30, 0.92), rgba(18, 14, 10, 0.97)); color: #fff3dc; transition: background 0.6s; }
.focus[hidden] { display: none; }
.focus.peek { background: transparent; pointer-events: none; }
.focus.peek .breath, .focus.peek .focus-timer, .focus.peek .focus-sub { opacity: 0; }
.focus.peek .focus-actions { pointer-events: auto; position: fixed; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(59, 42, 32, 0.9); padding: 8px; border-radius: 14px; }
.breath { position: relative; width: 220px; height: 220px; display: grid; place-items: center; }
.breath-ring { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(243, 214, 132, 0.55), rgba(214, 165, 58, 0.08) 70%); box-shadow: 0 0 60px rgba(243, 214, 132, 0.25); transform: scale(0.55); transition: transform 4s ease-in-out; }
.breath-text { position: relative; font-family: var(--serif); font-size: 20px; }
.focus-timer { font-family: var(--serif); font-size: 44px; font-variant-numeric: tabular-nums; }
.focus-sub { opacity: 0.75; font-size: 14px; text-align: center; padding: 0 16px; }
.focus-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

@media (max-width: 600px) {
  .hud { top: 8px; left: 8px; right: 8px; gap: 6px; }
  .card { padding: 7px 10px; border-radius: 12px; }
  .hud-temple, .hud-progress { flex: 1 1 0; min-width: 0; max-width: none; }
  .hud-temple h1 { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hud-progress strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .hud-row { gap: 4px; }
  .hud .muted { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .icon-btn { font-size: 15px; padding: 0; }
  #lunarLine, #mineLine, #stageNums { display: none; }
  .bar { margin: 5px 0 1px; height: 6px; }
  .bar-actions { gap: 0; padding: 4px; left: 8px; right: 8px; transform: none; max-width: none; justify-content: space-between; }
  .bar-actions button { min-width: 0; flex: 1 1 0; padding: 5px 1px; font-size: 10px; letter-spacing: -0.2px; }
  .bar-actions button span { font-size: 20px; }
  .festival { top: auto; bottom: calc(80px + var(--safe-b)); font-size: 12px; }
  .toasts { bottom: calc(80px + var(--safe-b)); }
}
@media (prefers-reduced-motion: reduce) { .breath-ring { transition: none; } }

/* ---------- Ngắm cảnh ---------- */
.tour { position: fixed; inset: 0; z-index: 60; cursor: pointer; }
.tour-fade { position: absolute; inset: 0; background: #0d0b09; opacity: 1; pointer-events: none; }
.tour-name {
  position: absolute; left: 50%; bottom: max(48px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  color: #fff8ea; font-family: var(--serif, Georgia, serif); font-size: clamp(18px, 3.2vw, 28px); letter-spacing: .04em;
  text-shadow: 0 1px 12px rgba(0,0,0,.55); opacity: 0; transition: opacity 2.4s ease; white-space: nowrap; pointer-events: none;
}
.tour-name.show { opacity: .92; }
.tour-hint {
  position: absolute; top: max(18px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  color: #fff8ea; font-size: 13px; padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.28);
  opacity: 1; transition: opacity 1.5s ease 3s; pointer-events: none;
}
.tour-hint.gone { opacity: 0; }
body.touring .hud, body.touring .bar-actions, body.touring #joy, body.touring #ctxBtn, body.touring .toasts,
body.touring .labels3d, body.touring #focus, body.touring #coach, body.touring .cp-banner, body.touring #festival,
body.touring #kinhBar, body.touring .sheet { visibility: hidden !important; }

/* ---------- hồi hướng & giờ ngồi chung ---------- */
.wishes.hh button::before { content: none; }
.hh-feed { list-style: none; margin: 10px 0 0; padding: 0; max-height: 46vh; overflow: auto; }
.hh-feed li { padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 14px; display: flex; justify-content: space-between; gap: 10px; }
.hh-feed li span { color: var(--muted, #7a6656); font-size: 12px; white-space: nowrap; }
.next-sit { font-weight: 600; }

/* thiền có hướng dẫn */
.small-label { margin: 10px 0 4px; font-size: 13px; }
.focus-guide { max-width: 520px; padding: 0 22px; text-align: center; font-family: var(--serif); font-size: 19px; line-height: 1.5; color: #fbe9c8; opacity: 0; transition: opacity 1.2s ease; min-height: 3em; }
.focus-guide.on { opacity: 0.95; }
.focus.peek .focus-guide { opacity: 0; }
.wide-btn { width: 100%; margin-top: 8px; }
/* kinh hành */
.walk-bar { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 68px); transform: translateX(-50%); z-index: 15; display: flex; align-items: center; gap: 12px; background: rgba(42, 30, 22, 0.86); color: #fff3dc; padding: 8px 10px 8px 16px; border-radius: 16px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); max-width: calc(100vw - 32px); }
.walk-bar[hidden] { display: none; }
.walk-cue { font-family: var(--serif); font-size: 16px; white-space: nowrap; }
.walk-meta { font-size: 12px; opacity: 0.75; font-variant-numeric: tabular-nums; white-space: nowrap; }
body.walking .bar-actions, body.walking #joy, body.walking #ctxBtn { opacity: 0.35; }

/* thời khoá hôm nay */
.tk-line { display: block; width: 100%; margin-top: 6px; border: 1px dashed rgba(168, 55, 43, 0.35); background: rgba(255, 250, 238, 0.7); color: var(--son-dark); border-radius: 9px; padding: 4px 8px; font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-line.done { border-style: solid; border-color: rgba(214, 165, 58, 0.6); color: #7a5a14; background: rgba(250, 233, 190, 0.8); }
.tk-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.tk-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--paper-2); }
.tk-item.go { cursor: pointer; }
.tk-item i { font-style: normal; font-size: 20px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.7); flex: none; }
.tk-item.ok i { background: var(--gold); color: #fff; font-weight: 700; }
.tk-item div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tk-item b { font-size: 14px; font-weight: 600; }
.tk-item.ok b { text-decoration: line-through; text-decoration-color: rgba(59, 42, 32, 0.35); }
.tk-item span { font-size: 12px; color: var(--muted); }
.tk-item .ghost-btn { flex: none; padding: 6px 10px; }

/* vườn rau */
.beds { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.bed { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border-radius: 12px; background: var(--paper-2); }
.bed.mine { background: #eef3dc; box-shadow: inset 0 0 0 1px rgba(95, 122, 78, 0.35); }
.bed > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bed b { font-size: 14px; font-weight: 600; }
.bed span { font-size: 12px; color: var(--muted); }
.bed > button { flex: none; }
.bed .big-btn.small { width: auto; margin: 0; padding: 8px 14px; font-size: 14px; }
.bed > .crop-pick { flex: 1 1 100%; margin: 0; }

/* sổ cầu an */
.ca-row { display: flex; gap: 6px; margin: 10px 0 12px; }
.ca-row select, .ca-row input { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); min-width: 0; }
.ca-row input { flex: 1; }
.ca-list { list-style: none; padding: 0; margin: 6px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.ca-list li { display: flex; align-items: center; gap: 4px; background: var(--paper-2); border-radius: 999px; padding: 3px 4px 3px 12px; font-size: 14px; }
.ca-list .icon-btn { width: 26px; height: 26px; font-size: 12px; }
.focus-cauan { max-width: 520px; padding: 0 22px; text-align: center; font-size: 14px; line-height: 1.5; color: #f6dca0; opacity: 0.85; }

/* chuông chánh niệm */
.cn-overlay { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(30, 22, 16, 0.62); backdrop-filter: blur(3px); color: #fff3dc; animation: fadein 0.8s ease; cursor: pointer; }
.cn-ring { width: 120px; height: 120px; border-radius: 50%; border: 2px solid rgba(246, 220, 160, 0.8); box-shadow: 0 0 40px rgba(246, 220, 160, 0.25); transform: scale(0.75); transition: transform 4s ease-in-out; }
.cn-overlay.in .cn-ring { transform: scale(1.1); }
.cn-title { font-size: 13px; letter-spacing: 0.04em; opacity: 0.8; }
.cn-text { font-family: var(--serif); font-size: 22px; }
.cn-hint { font-size: 12px; opacity: 0.6; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.sync-row.ca-row input { text-transform: none; letter-spacing: 0; }

/* xin chữ, hái lộc */
.chu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 4px; }
.chu-grid button { border: 1px solid var(--line); background: #fbf3e2; border-radius: 12px; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.chu-grid b { font-family: 'Water Brush', var(--serif); font-weight: 400; font-size: 30px; line-height: 1.1; color: #1b120c; }
.chu-grid span { font-size: 10.5px; color: var(--muted); line-height: 1.2; text-align: center; }
.card-view { margin-top: 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.card-view canvas { width: min(100%, 360px); aspect-ratio: 4 / 5; border-radius: 10px; box-shadow: 0 8px 26px rgba(60, 35, 15, 0.25); background: #efe1bf; }
.card-row { display: flex; gap: 8px; width: min(100%, 360px); align-items: center; }
.card-row .big-btn { margin: 0; flex: 1; }
.card-row .ghost-btn { flex: none; }

/* thiền trà, thọ trai: nghi thức toàn màn hình */
.ritual { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; background: radial-gradient(ellipse at 50% 40%, rgb(66, 45, 29), rgb(22, 15, 10)); color: #fff3dc; animation: fadein 0.6s ease; cursor: pointer; }
.ritual-title { position: absolute; top: calc(env(safe-area-inset-top) + 22px); font-size: 14px; letter-spacing: 0.05em; opacity: 0.8; }
.tea-svg { width: min(86vw, 360px); height: auto; }
.ritual-text { font-family: var(--serif); font-size: 25px; line-height: 1.35; max-width: 520px; min-height: 1.4em; transition: opacity 0.6s; }
.ritual-sub { font-size: 15.5px; line-height: 1.5; opacity: 0.85; max-width: 460px; min-height: 3em; transition: opacity 0.6s; }
.ritual.fade .ritual-text, .ritual.fade .ritual-sub { opacity: 0; }
.ritual-hint { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 70px); font-size: 12px; opacity: 0.5; }
.ritual-x { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 22px); border: 1px solid rgba(255, 243, 220, 0.35); background: none; color: #fff3dc; border-radius: 999px; padding: 7px 18px; font-size: 14px; }
.tea-svg .steam path { fill: none; stroke: rgba(255, 248, 235, 0.55); stroke-width: 3; stroke-linecap: round; opacity: 0; }
.tea-svg .tea, .tea-svg .pourline, .tea-svg .leaves { opacity: 0; transition: opacity 1s; }
.tea-svg .pot, .tea-svg .cup { transition: transform 1.4s ease; transform-box: fill-box; transform-origin: center; }
#tra.boil .pot .steam path, #tra.rinse .pot .steam path { animation: steam 2.6s ease-in-out infinite; }
#tra.rinse .cup { transform: rotate(-6deg); }
#tra.leaves .leaves { opacity: 1; }
#tra.pour .pot { transform: rotate(-16deg) translate(14px, -6px); }
#tra.pour .pourline, #tra.pour .tea, #tra.lift .tea, #tra.sip .tea, #tra.done .tea { opacity: 1; }
#tra.lift .cup, #tra.sip .cup { transform: translateY(-34px); }
#tra.lift .cupsteam path, #tra.sip .cupsteam path, #tra.pour .cupsteam path { animation: steam 3s ease-in-out infinite; }
#tra.sip .cup { animation: sip 8s ease-in-out infinite; }
#trai .soup .steam path { animation: steam 3s ease-in-out infinite; }
#trai.eat .riceTop { transition: transform 2s; transform: scaleY(0.6); transform-box: fill-box; transform-origin: bottom; }
@keyframes steam { 0% { opacity: 0; transform: translateY(6px); } 40% { opacity: 0.8; } 100% { opacity: 0; transform: translateY(-14px); } }
@keyframes sip { 0%, 100% { transform: translateY(-34px); } 45%, 60% { transform: translateY(-58px) rotate(-8deg); } }
.trai-banner { background: rgba(95, 122, 78, 0.95); }
.cp-banner { top: calc(var(--hud-b, 118px) + 8px) !important; }
.fade-cut { position: fixed; inset: 0; z-index: 25; background: #120c08; opacity: 0; transition: opacity 0.5s; pointer-events: none; }
.fade-cut.on { opacity: 1; }

/* lần đầu lên chùa */
.first-body { text-align: center; }
.first-body .first-lotus { font-size: 46px; margin-bottom: 4px; }
.first-body h3 { font-family: var(--serif); color: var(--son-dark); font-size: 23px; }
.first-body p { color: var(--ink); font-size: 15.5px; line-height: 1.55; margin: 10px 0 14px; }
.first-body .wide-btn { margin-top: 8px; }
.builtby { text-align: center; margin: 16px 0 4px; } .builtby a { color: var(--son); font-weight: 700; text-decoration: none; }

/* hàng nút chọn trong bảng Thiền: vuốt ngang thay vì xuống nhiều dòng */
#durations, #guides { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; scroll-snap-type: x proximity; }
#durations::-webkit-scrollbar, #guides::-webkit-scrollbar { display: none; }
#durations button, #guides button { flex: none; white-space: nowrap; scroll-snap-align: start; }

/* sổ chủ chùa */
.cc-nums { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0 14px; }
.cc-nums div { background: rgba(214, 165, 58, .12); border-radius: 12px; padding: 8px 10px; }
.cc-nums b { display: block; font-size: 22px; }
.cc-nums span { font-size: 13px; opacity: .75; }
.cc-bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; margin: 6px 0 4px; }
.cc-bars i { flex: 1; background: #d6a53a; border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.cc-bars i.today { background: #a8372b; }
#ccNotice { width: 100%; font: inherit; border-radius: 12px; border: 1px solid rgba(120, 90, 60, .35); padding: 10px; background: rgba(255, 255, 255, .85); color: #3b2a20; resize: vertical; }
.cc-pro { margin-top: 16px; padding: 12px; border-radius: 12px; border: 1px dashed rgba(168, 55, 43, .5); }
.cc-pro p { margin: 6px 0 10px; }
.loinhan-box { background: rgba(214, 165, 58, .15); border-left: 4px solid #d6a53a; border-radius: 10px; padding: 8px 12px; white-space: pre-wrap; }
.chu-in { display: grid; gap: 8px; margin-top: 10px; }
.chu-in .ghost-btn { width: 100%; }

/* quà theo số ngày lên chùa (sổ tĩnh tâm) */
.log-rewards { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.log-rewards .rw-cap { flex-basis: 100%; font-size: 12.5px; color: var(--muted, #7a6a58); }
.log-rewards .rw { flex: 1 1 22%; min-width: 64px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px; border-radius: 12px; border: 1px solid rgba(143, 107, 62, .25); background: rgba(255, 250, 238, .7); font-size: 11.5px; color: #8d7c69; }
.log-rewards .rw i { font-style: normal; font-size: 20px; filter: grayscale(1); opacity: .55; }
.log-rewards .rw.got { color: #4b392b; }
.log-rewards .rw.got i { filter: none; opacity: 1; }
.log-rewards .rw.worn { border-color: #b8862f; background: #fff3d6; box-shadow: 0 0 0 2px rgba(214, 165, 58, .35); }
.robe-pick button.locked { font-size: 13px; filter: saturate(.55); opacity: .7; }

/* nhật ký biết ơn (sổ tĩnh tâm) */
.nhatky { margin-top: 10px; padding: 10px; border-radius: 12px; background: rgba(255, 250, 238, .7); border: 1px solid rgba(143, 107, 62, .2); }
.nhatky .nk-q { font-size: 13.5px; color: #4b392b; margin-bottom: 6px; }
.nhatky textarea { width: 100%; box-sizing: border-box; resize: vertical; border-radius: 10px; border: 1px solid rgba(143, 107, 62, .3); padding: 8px; font: inherit; font-size: 14px; background: #fffdf7; color: #3b2c20; }
.nhatky .nk-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; color: #8d7c69; }

/* nút ngay trên từng luống rau */
.bed-btns { position: fixed; inset: 0; pointer-events: none; z-index: 15; }
.bed-btn { position: absolute; left: 0; top: 0; display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; max-width: 180px; pointer-events: auto; will-change: transform; }
.bed-btn button { font: 600 12.5px var(--font); padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(143, 107, 62, .35); background: rgba(255, 249, 234, .95); color: #4b392b; box-shadow: 0 3px 10px rgba(45, 31, 20, .2); white-space: nowrap; }
.bed-btn button.main.water { background: #e9f5ff; border-color: #8ab8e0; color: #1f4f78; }
.bed-btn button.main.harvest { background: #fff1c9; border-color: #d6a53a; color: #6b4a0f; }
.bed-btn button.main.plant { background: #eef8e4; border-color: #8fbf6a; color: #2f5a1c; }

/* ===== giao diện gọn: nhỏ, kính mờ, nhường chỗ cho không gian chùa ===== */
.hud { top: calc(8px + env(safe-area-inset-top, 0px)); left: 8px; right: 8px; gap: 8px; align-items: flex-start; }
.hud .card { background: rgba(251, 245, 234, .62); backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2); border: 1px solid rgba(255, 255, 255, .45); box-shadow: 0 2px 10px rgba(45, 31, 20, .12); border-radius: 14px; padding: 5px 10px; }
.hud-temple { flex: 0 1 auto; min-width: 0; max-width: 52%; }
.hud-temple h1 { font-size: 13.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-temple .icon-btn { font-size: 13px; padding: 0 1px; opacity: .8; }
.hud .muted { font-size: 11px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lunarLine, #mineLine, #stageNums { display: none; }
.hud-progress { flex: 0 1 auto; min-width: 0; max-width: 46%; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: center; }
.hud-progress .hud-row { grid-column: 1; grid-row: 1; min-width: 0; }
.hud-progress strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hud-progress .bar { grid-column: 1 / 3; grid-row: 2; height: 3px; margin: 4px 0 1px; background: rgba(120, 90, 60, .18); }
.hud-progress .tk-line { grid-column: 2; grid-row: 1; width: auto; margin: 0; padding: 1px 7px; font-size: 11px; border-radius: 999px; border-style: solid; border-color: rgba(168, 55, 43, .25); background: rgba(255, 250, 238, .55); }
.festival { top: calc(56px + env(safe-area-inset-top, 0px)); bottom: auto; padding: 3px 11px; font-size: 11.5px; font-weight: 600; background: rgba(126, 53, 39, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: none; }
.bar-actions { left: 50%; right: auto; transform: translateX(-50%); width: min(420px, calc(100vw - 16px)); justify-content: space-between; gap: 0; padding: 3px; border-radius: 18px; background: rgba(251, 245, 234, .66); backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2); border: 1px solid rgba(255, 255, 255, .45); box-shadow: 0 2px 12px rgba(45, 31, 20, .14); overflow: visible; }
.bar-actions > button { flex: 1 1 0; min-width: 0; padding: 4px 2px 3px; font-size: 10px; gap: 1px; border-radius: 14px; color: #4b392b; }
.bar-actions > button span { font-size: 19px; }
.bar-actions > button.primary { background: rgba(168, 55, 43, .9); }
.bar-actions > button.on { background: rgba(120, 90, 60, .15); }
.more-pop { position: absolute; right: 22%; bottom: calc(100% + 8px); display: flex; gap: 2px; padding: 4px; border-radius: 16px; background: rgba(251, 245, 234, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, .5); box-shadow: 0 4px 16px rgba(45, 31, 20, .2); }
.more-pop[hidden] { display: none; }
.more-pop button { border: 0; background: transparent; border-radius: 12px; padding: 5px 10px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 10.5px; font-weight: 600; color: #4b392b; }
.more-pop button span { font-size: 19px; line-height: 1; }
.toasts { bottom: calc(70px + var(--safe-b)); }
.label3d { font-size: 10px; padding: 2px 7px; background: rgba(255, 248, 228, .72); box-shadow: none; }
.label3d.me { background: rgba(126, 53, 39, .78); }
.label3d.npc { background: rgba(243, 196, 104, .78); }

/* hai ô trên cùng: cao bằng nhau, rộng bằng nhau, nội dung canh giữa theo chiều dọc */
.hud { align-items: stretch; }
.hud-temple, .hud-progress { flex: 1 1 0; max-width: none; min-width: 0; }
.hud-temple { display: flex; flex-direction: column; justify-content: center; }
.hud-progress { align-content: center; }
.hud-progress .hud-row { justify-content: flex-start; }
.hud-progress strong { font-size: 13px; }
.hud-progress .bar { margin: 6px 0 2px; }

.more-pop button i { font-style: normal; }
