/* เล้งซัวไฮ่ 海山龍 — แอปเทพประจำวัน (ดำด้าน / ทอง / แดงตราประทับ) */
:root {
  --bg: #0b0907; --surface: #15120d; --gold: #D4AF37; --gold-2: #f1dc8a;
  --gold-soft: rgba(212,175,55,.35); --gold-faint: rgba(212,175,55,.1);
  --red: #a4161a; --text: #e6dfcf; --muted: #948d7d; --dim: #5e584c;
  --day: #4aa3ff; --radius: 16px;
  --serif: "Noto Serif Thai", serif; --sans: "Sarabun", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-weight: 300; line-height: 1.6; -webkit-tap-highlight-color: transparent; padding-bottom: 84px; }
img { display: block; max-width: 100%; }
a { color: var(--gold); text-decoration: none; }
h1, h2, h3 { font-family: var(--serif); margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--dim); font-size: 12px; text-align: center; margin: 8px 0 0; }
.gold-text { background: linear-gradient(135deg, #f5e6a8, #D4AF37 45%, #a8861a); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.card { background: linear-gradient(145deg, var(--gold-faint), var(--surface) 45%); border: 1px solid var(--gold-soft); border-radius: var(--radius); padding: 16px; }

/* ปุ่ม */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 13px 20px; border-radius: 12px; font-family: var(--serif); font-weight: 700; font-size: 15px; line-height: 1.2; border: 1px solid transparent; transition: transform .15s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-gold { color: #0b0907; background: linear-gradient(135deg, #e8c547, #D4AF37 50%, #b8942e); box-shadow: 0 4px 24px rgba(212,175,55,.3), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-outline { color: var(--gold); border-color: var(--gold-soft); background: rgba(0,0,0,.3); }
.btn-block { width: 100%; }

/* แถบบน */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgba(11,9,7,.88); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(212,175,55,.15); }
.brand-logo { height: 34px; border-radius: 6px; }
.topbar-text { display: flex; flex-direction: column; line-height: 1.2; flex: 1; }
.topbar-text strong { font-family: var(--serif); color: var(--gold); font-size: 14px; }
.topbar-text span { color: var(--muted); font-size: 11px; }
.pill { font-size: 12px; font-weight: 600; color: #0b0907; background: var(--gold); border-radius: 999px; padding: 3px 10px; }

/* หน้าจอ */
main { max-width: 32rem; margin: 0 auto; padding: 0 16px; }
@media (min-width: 900px) { main { max-width: 56rem; } }
.screen { display: none; padding: 20px 0 24px; animation: fade .25s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.screen h2 { font-size: 24px; text-align: center; margin-bottom: 4px; }
.screen > .muted { text-align: center; margin: 0 0 16px; font-size: 14px; }

/* วันนี้ */
.today-head { text-align: center; margin-bottom: 14px; }
.today-head .date { font-family: var(--serif); color: var(--gold); margin: 0 0 4px; font-size: 15px; }
.today-head h1 { font-size: 30px; line-height: 1.2; }
.today-head .muted { margin: 4px 0 0; font-size: 13px; }
.special { display: inline-block; margin: 0 0 6px; padding: 3px 12px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px; font-weight: 500; }
.wall-wrap { position: relative; width: min(100%, 360px); margin: 0 auto; border-radius: 22px; overflow: hidden; box-shadow: 0 0 60px rgba(212,175,55,.12), 0 20px 50px rgba(0,0,0,.6); border: 1px solid var(--gold-soft); }
@media (min-width: 900px) { .today-head { margin-top: 10px; } #today { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; } #today .today-head, #today .birthday, #today .actions, #today .hint, #today .blessing { grid-column: 2; } #today .wall-wrap { grid-column: 1; grid-row: 1 / span 6; } }
#wall { width: 100%; height: auto; display: block; aspect-ratio: 9/16; background: #0b0907; }
.wall-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--gold); font-family: var(--serif); background: #0b0907; }
.wall-loading.hidden { display: none; }
.birthday { text-align: center; margin: 16px 0 12px; }
.birthday .muted { margin: 0 0 8px; }
.chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.chip { border: 1px solid var(--gold-soft); background: rgba(0,0,0,.35); color: var(--text); border-radius: 999px; padding: 6px 12px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.chip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chip.active { border-color: var(--gold); background: var(--gold-faint); color: var(--gold-2); }
.actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.blessing { margin-top: 16px; text-align: center; }
.blessing .zh { font-family: "Ma Shan Zheng", var(--serif); font-size: 34px; color: var(--gold); line-height: 1.1; }
.blessing .name { font-family: var(--serif); font-size: 16px; color: var(--gold-2); margin: 4px 0 2px; }
.blessing .power { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.blessing .text { font-family: var(--serif); font-size: 15px; color: var(--text); margin: 0; }
.blessing .gem { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

/* สมุดสะสม */
.progress { height: 8px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; margin: 0 0 16px; }
#progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #a8861a, #f1dc8a); transition: width .5s; }
.book-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 600px) { .book-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px) { .book-grid { grid-template-columns: repeat(6, 1fr); } }
.slot { position: relative; aspect-ratio: 3/4; border-radius: 14px; border: 1px solid rgba(212,175,55,.2); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px; text-align: center; color: var(--dim); cursor: pointer; transition: transform .15s; }
.slot:active { transform: scale(.97); }
.slot .zh { font-family: "Ma Shan Zheng", serif; font-size: 26px; line-height: 1; }
.slot .th { font-size: 10px; line-height: 1.25; }
.slot .num { position: absolute; top: 6px; left: 8px; font-size: 10px; }
.slot.got { color: var(--gold); border-color: var(--gold); background: radial-gradient(circle at 50% 30%, rgba(212,175,55,.25), var(--surface) 70%); box-shadow: 0 0 18px rgba(212,175,55,.2); }
.slot.today { outline: 2px solid var(--day); outline-offset: 2px; }
.slot.today::after { content: "วันนี้"; position: absolute; bottom: 6px; font-size: 9px; color: var(--day); }
.reward { margin-top: 16px; text-align: center; }
.reward h3 { color: var(--gold); font-size: 18px; margin-bottom: 4px; }
.reward .muted { margin: 0 0 12px; font-size: 13px; }
.unlock { margin-top: 12px; }
.unlock h3 { color: var(--gold); font-size: 16px; margin-bottom: 2px; }
.unlock .muted { margin: 0 0 10px; }
.unlock-form { display: flex; gap: 8px; }
.unlock-form input { flex: 1; min-width: 0; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--gold-soft); background: rgba(0,0,0,.35); color: var(--text); letter-spacing: .08em; }
#unlock-msg { margin: 8px 0 0; color: var(--gold); min-height: 1em; }

/* สนับสนุน */
.qr-card { text-align: center; }
.qr-img { width: 230px; margin: 0 auto 8px; border-radius: 10px; }
.qr-card .small { margin: 0 0 10px; }
.tiers-title { color: var(--gold); text-align: center; font-size: 19px; margin: 22px 0 12px; }
.tiers { display: grid; gap: 10px; }
@media (min-width: 900px) { .tiers { grid-template-columns: 1fr 1fr 1fr; } }
.tier { position: relative; display: flex; flex-direction: column; gap: 6px; }
.tier.highlight { border-color: var(--gold); box-shadow: 0 0 30px rgba(212,175,55,.15); }
.tier.soon { opacity: .7; border-style: dashed; }
.tier .amount { font-family: var(--serif); font-size: 30px; font-weight: 700; color: var(--gold); line-height: 1; }
.tier .amount small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.tier .title { font-family: var(--serif); font-size: 16px; font-weight: 700; color: #f0e6c8; }
.tier .desc { color: var(--muted); font-size: 13px; margin: 0; }
.tier .tag { position: absolute; top: 12px; right: 12px; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--gold); color: #0b0907; font-weight: 600; }
.tier.soon .tag { background: transparent; color: var(--muted); border: 1px solid var(--gold-soft); }
.tier .btn { margin-top: 6px; }
.steps { margin-top: 14px; }
.steps h3 { color: var(--gold); font-size: 16px; margin-bottom: 6px; }
.steps ol { margin: 0 0 12px; padding-left: 20px; font-size: 14px; }

/* ศาลเจ้า */
.seal { width: 80px; margin: 0 auto 8px; filter: drop-shadow(0 0 12px rgba(164,22,26,.5)); }
#about p { font-size: 15px; }
#about strong { color: var(--gold); font-weight: 500; }
.photo-grid { display: grid; gap: 12px; margin-top: 16px; }
@media (min-width: 700px) { .photo-grid { grid-template-columns: 1fr 1fr; } }
.photo-grid figure { margin: 0; padding: 0; overflow: hidden; }
.photo-grid img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.photo-grid figcaption { padding: 10px 12px; color: var(--muted); font-size: 13px; }
.footer { text-align: center; margin-top: 24px; font-size: 14px; }
.footer .small { margin: 8px 0 0; }

/* แท็บล่าง */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; display: flex; background: rgba(11,9,7,.95); backdrop-filter: blur(10px); border-top: 1px solid rgba(212,175,55,.18); padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { flex: 1; background: none; border: 0; color: var(--muted); padding: 8px 4px 9px; font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabbar button span { font-size: 20px; line-height: 1; }
.tabbar button.active { color: var(--gold); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); opacity: 0; background: var(--gold); color: #0b0907; padding: 10px 16px; border-radius: 999px; font-weight: 500; font-size: 14px; z-index: 60; transition: all .3s; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
