/* ============ Tarot Huyền Bí ============
   Nền đen ấm, một màu nhấn đồng, chữ trắng ngà. Chia khu bằng đường kẻ mảnh,
   không gradient, không khung kính. Hai họ chữ: Cormorant Garamond (tiêu đề), Be Vietnam Pro (thân bài). */
:root {
  color-scheme: dark;
  --bg: #0c0b0a;
  --surface: #141210;
  --surface-2: #1b1814;
  --ink: #ece4d6;
  --ink-soft: #d6cebf; /* chữ đoạn văn dài: dịu hơn một chút để không chói trên nền đen */
  --muted: #a39a8b;
  --dim: #756d60;
  --accent: #b98a4a;
  --accent-lt: #d8b277;
  --accent-dk: #8a6431;
  --line: rgba(236, 228, 214, .12);
  --line-2: rgba(236, 228, 214, .24);
  --ok: #94bd9b;
  --bad: #dd9285;
  --radius: 3px;
  --f-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --f-body: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --f-read: var(--f-body);
  --f-title: var(--f-display);
  --ratio: 1.72; /* chiều cao / chiều rộng của lá bài */
  --pad: 16px;
  --bnav-h: 0px; /* chiều cao thanh điều hướng dưới (chỉ có giá trị trên điện thoại) */
  --card-back: none;
  --grain: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 600; line-height: 1.1; margin: 0; letter-spacing: .005em; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent-lt); }
img { max-width: 100%; }
::selection { background: rgba(185, 138, 74, .35); }

.gold-text { color: var(--ink); }
.dim { color: var(--muted); }

/* ---- nền: hạt nhiễu mịn + vài chấm sao tĩnh ---- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.sky::before { content: ""; position: absolute; inset: 0; background: var(--grain) 0 0 / 220px 220px; opacity: .06; }
.sky::after {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image:
    radial-gradient(1px 1px at 30px 40px, rgba(236, 228, 214, .5) 50%, transparent 51%),
    radial-gradient(1px 1px at 170px 110px, rgba(236, 228, 214, .35) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 290px 60px, rgba(216, 178, 119, .5) 50%, transparent 51%),
    radial-gradient(1px 1px at 90px 230px, rgba(236, 228, 214, .3) 50%, transparent 51%),
    radial-gradient(1px 1px at 340px 270px, rgba(236, 228, 214, .4) 50%, transparent 51%);
  background-size: 420px 330px;
}

/* ---- đường phân cách ---- */
.divider { display: flex; align-items: center; justify-content: center; gap: 12px; max-width: 280px; margin: 14px auto; }
.divider span { flex: 1; height: 1px; background: var(--line-2); }
.divider svg { flex: none; }

/* ---- thanh trên ---- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 60px; padding: 0 max(var(--pad), env(safe-area-inset-left));
  background: rgba(12, 11, 10, .93);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; text-decoration: none; white-space: nowrap; color: var(--accent); }
.brand-text { display: flex; align-items: baseline; gap: 10px; line-height: 1; }
.brand-main { font-family: var(--f-display); font-weight: 600; font-size: 1.3rem; letter-spacing: .34em; color: var(--ink); }
.brand-sub { font-family: var(--f-display); font-style: italic; font-size: 1rem; color: var(--muted); letter-spacing: .06em; }
.nav { display: flex; gap: 2px; }
.nav a { position: relative; white-space: nowrap; color: var(--muted); text-decoration: none; padding: 8px 14px; font-size: .74rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; transition: color .2s; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 1px; background: var(--accent); }

main { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 1060px; margin: 0 auto; padding: 0 var(--pad) 48px; overflow-x: clip; }
.footer { position: relative; z-index: 1; padding: 22px var(--pad) 30px; color: var(--muted); font-size: .8rem; line-height: 1.7; border-top: 1px solid var(--line); }

.view { animation: fadeIn .4s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- chữ nhỏ viết hoa, tiêu đề trang ---- */
.eyebrow { color: var(--accent); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .22em; }
.lead { color: var(--muted); max-width: 52ch; margin-top: 10px; }
.page-head { padding: 44px 0 22px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(2.2rem, 5.4vw, 3.4rem); font-weight: 500; margin-top: 8px; }

/* ---- trang chủ: chữ bên trái, ba lá bài thật bên phải ---- */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 28px; align-items: center; padding: 48px 0 44px; border-bottom: 1px solid var(--line); }
.hero h1 { font-size: clamp(2.7rem, 5.8vw, 4.6rem); font-weight: 500; line-height: 1.04; margin: 14px 0 18px; }
.persona-name { color: var(--ink); }
.hero-cta { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 24px; margin-top: 30px; }
.text-btn { padding: 8px 0; border: 0; background: none; color: var(--muted); font-size: .9rem; border-bottom: 1px solid var(--line-2); transition: color .2s, border-color .2s; }
.text-btn:hover { color: var(--accent-lt); border-color: var(--accent); }

.hero-cards { --hw: clamp(118px, 17vw, 184px); position: relative; height: calc(var(--hw) * 1.77 + 44px); }
.hc {
  --x: 0; --y: 0; --r: 0deg; --lift: 0px;
  position: absolute; left: 50%; top: 50%; width: var(--hw);
  transform: translate(-50%, -50%) translate(calc(var(--x) * var(--hw)), calc(var(--y) * var(--hw) + var(--lift))) rotate(var(--r));
  transition: transform .35s ease;
  animation: fanOut .9s cubic-bezier(.2, .7, .2, 1) both;
}
.hc img { display: block; width: 100%; height: auto; border-radius: 5px; box-shadow: 0 18px 40px rgba(0, 0, 0, .65), 0 0 0 1px rgba(236, 228, 214, .1); }
.hc-0 { --x: -.66; --y: .12; --r: -8deg; z-index: 1; }
.hc-1 { --x: 0; --y: -.06; --r: 0deg; z-index: 3; animation-delay: .08s; }
.hc-2 { --x: .66; --y: .12; --r: 8deg; z-index: 2; animation-delay: .16s; }
.hc-0 img, .hc-2 img { filter: brightness(.82); }
.hero-cards:hover .hc { --lift: -6px; }
@keyframes fanOut { from { opacity: 0; transform: translate(-50%, -50%) translateY(18px) rotate(0deg); } }

/* ---- form ---- */
textarea {
  width: 100%; resize: vertical; min-height: 72px; padding: 12px 14px;
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius); transition: border-color .2s, box-shadow .2s;
}
textarea::placeholder { color: var(--dim); }
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); outline: none; }
.btn:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible + .track, .spread-opt input:focus-visible + .opt-body { outline: 2px solid var(--accent-lt); outline-offset: 2px; }

.hints { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.hint { padding: 5px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: .82rem; transition: color .2s, border-color .2s; }
.hint:hover { color: var(--accent-lt); border-color: var(--accent); }

.mini { display: grid; gap: 3px; justify-content: start; align-content: start; min-height: 34px; }
.mini i { display: block; width: 9px; height: 15px; border-radius: 1px; border: 1px solid var(--accent); background: transparent; }
.mini i.x { transform: rotate(90deg); background: rgba(185, 138, 74, .5); }

.switch { display: inline-flex; align-items: flex-start; gap: 12px; cursor: pointer; font-size: .92rem; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { margin-top: 3px; width: 40px; height: 22px; border-radius: 11px; background: var(--surface-2); position: relative; transition: background .2s; flex: none; border: 1px solid var(--line-2); }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch input:checked + .track { background: rgba(185, 138, 74, .28); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--accent-lt); }
.switch-text { display: flex; flex-direction: column; line-height: 1.4; }
.switch-text small { color: var(--muted); font-size: .78rem; margin-top: 2px; }

/* ---- nút ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--radius); border: 1px solid var(--line-2);
  background: transparent; color: var(--ink); font-weight: 500; font-size: .92rem; letter-spacing: .02em;
  transition: background .2s, border-color .2s, color .2s, opacity .2s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-lt); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { color: #15100a; border-color: var(--accent); background: var(--accent); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-lt); border-color: var(--accent-lt); color: #15100a; }
.btn.big { padding: 14px 32px; font-size: 1rem; }
.btn.small { padding: 7px 14px; font-size: .84rem; }
.center { display: flex; justify-content: center; margin-top: 18px; }

/* ---- thanh "trải bài đang dở" ---- */
.resume { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 18px 0 0; padding: 12px 16px; border: 1px solid var(--accent-dk); border-radius: var(--radius); background: rgba(185, 138, 74, .08); }
.resume-text { font-size: .92rem; }
.resume-text b { color: var(--accent-lt); font-weight: 600; }
.resume-actions { display: flex; gap: 8px; }

/* ---- luồng 3 bước ---- */
.flow { display: block; }
.step { padding: 34px 0 32px; border-bottom: 1px solid var(--line); }
.step-title { display: flex; align-items: baseline; gap: 14px; font-size: clamp(1.5rem, 3.4vw, 1.9rem); font-weight: 500; margin-bottom: 20px; }
.step-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.step-title em { display: block; color: var(--muted); font-style: italic; font-weight: 500; font-size: .85rem; line-height: 1.3; }
.step-no { flex: none; font-family: var(--f-body); font-size: .72rem; font-weight: 600; letter-spacing: .16em; color: var(--accent); }

/* bước 1: lưới chữ, ngăn bằng đường kẻ mảnh */
.intent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.intent { position: relative; display: block; cursor: pointer; }
.intent input { position: absolute; opacity: 0; inset: 0; }
.intent-body { height: 100%; display: flex; flex-direction: column; gap: 4px; padding: 18px 18px 16px; min-height: 96px; background: var(--bg); transition: background .2s; }
.intent:hover .intent-body { background: var(--surface); }
.intent input:checked + .intent-body { background: rgba(185, 138, 74, .1); box-shadow: inset 0 0 0 1px var(--accent); }
.intent input:focus-visible + .intent-body { outline: 2px solid var(--accent-lt); outline-offset: -2px; }
.intent-ico { display: none; }
.intent-name { font-family: var(--f-display); font-weight: 600; font-size: 1.45rem; color: var(--ink); line-height: 1.1; }
.intent input:checked + .intent-body .intent-name { color: var(--accent-lt); }
.intent-sub { font-size: .8rem; color: var(--muted); line-height: 1.35; }

/* bước 2: danh sách dòng */
.spread-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); column-gap: 36px; }
.spread-opt { position: relative; display: block; cursor: pointer; }
.spread-opt input { position: absolute; opacity: 0; inset: 0; }
.opt-body { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 14px; align-content: start; padding: 18px 34px 16px 4px; border-top: 1px solid var(--line); transition: background .2s; }
.opt-body .mini { grid-row: 1 / span 3; margin-top: 2px; }
.opt-body::after { content: ""; position: absolute; right: 6px; top: 22px; width: 13px; height: 13px; border-radius: 50%; border: 1px solid var(--line-2); transition: background .2s, border-color .2s, box-shadow .2s; }
.spread-opt:hover .opt-body::after { border-color: var(--accent); }
.spread-opt input:checked + .opt-body::after { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--accent); }
.opt-title { font-family: var(--f-display); font-size: 1.4rem; font-weight: 600; color: var(--ink); line-height: 1.15; }
.spread-opt input:checked + .opt-body .opt-title { color: var(--accent-lt); }
.opt-sub { color: var(--muted); font-size: .84rem; line-height: 1.45; margin-top: 2px; }
.opt-count { margin-top: 6px; font-size: .68rem; color: var(--dim); text-transform: uppercase; letter-spacing: .14em; font-weight: 600; }
.badge { display: inline-block; vertical-align: middle; margin-left: 10px; padding: 1px 8px; border: 1px solid var(--accent); border-radius: 2px; color: var(--accent-lt); font-family: var(--f-body); font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; }
.badge.fit { color: var(--accent-lt); }

/* bước 3 */
.step textarea { margin-bottom: 0; }
.step .hints { margin: 12px 0 18px; }

/* thanh nút chính: luôn hiển thị, tóm tắt lựa chọn */
.cta-bar {
  position: sticky; bottom: var(--bnav-h); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin: 0 calc(var(--pad) * -1); padding: 12px var(--pad);
  background: rgba(12, 11, 10, .96); backdrop-filter: blur(8px); border-top: 1px solid var(--line-2);
}
.cta-summary { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.cta-what { font-family: var(--f-display); font-weight: 600; font-size: 1.3rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cta-meta { font-size: .76rem; color: var(--muted); }
.cta-bar .btn { flex: none; }

/* ============ BÀN TRẢI BÀI ============ */
.table-head { display: flex; align-items: flex-start; gap: 16px; padding-top: 22px; margin-bottom: 6px; }
.table-title h2 { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 500; margin-top: 2px; }
.question { color: var(--muted); font-family: var(--f-display); font-style: italic; font-size: 1.1rem; margin-top: 4px; word-break: break-word; }
.status { text-align: center; min-height: 3.4em; padding: 10px 0 12px; color: var(--muted); }
.status strong { color: var(--ink); font-weight: 500; }

/* tấm trải bàn: vải tối có hạt, viền mảnh */
.mat {
  position: relative; margin: 0 auto 18px; padding: 30px 14px 22px; overflow-x: auto; overflow-y: hidden;
  border-radius: 6px; border: 1px solid var(--line-2);
  background: var(--grain) 0 0 / 220px 220px, radial-gradient(ellipse at 50% 40%, #1c1812 0%, #110f0c 70%);
  background-blend-mode: soft-light, normal;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, .55);
}
.mat::before { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(185, 138, 74, .22); border-radius: 3px; pointer-events: none; }

/* lá bài (khung 3D lật) */
.card {
  --cw: 100px;
  position: relative; display: block; padding: 0; border: 0; background: none;
  width: var(--cw); height: calc(var(--cw) * var(--ratio));
  perspective: 900px; border-radius: 5% / 3%;
}
.card-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.3, .7, .2, 1); }
.card.flipped .card-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: 5% / 3%; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; box-shadow: 0 10px 24px rgba(0, 0, 0, .6); }
.face.back { background: var(--card-back) center / 100% 100% no-repeat, #14110d; }
.face.front { transform: rotateY(180deg); background: transparent; box-shadow: none; overflow: visible; }
.card.rev .face.front { transform: rotateY(180deg) rotate(180deg); }

/* ảnh lá bài: không khung, chỉ bo góc và bóng */
.tcard { position: relative; display: block; width: 100%; height: 100%; border-radius: 5% / 3%; overflow: hidden; background: #14110d; box-shadow: 0 10px 24px rgba(0, 0, 0, .6), 0 0 0 1px rgba(236, 228, 214, .08); }
.tcard img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover; }
.tc-name {
  position: absolute; inset: 0; z-index: 0; display: grid; place-items: center; padding: 8%; text-align: center;
  font-family: var(--f-display); font-weight: 600; font-size: clamp(8px, 1.4vw, 15px); line-height: 1.15; color: var(--accent-lt);
  background: #14110d;
}

/* các ô trong bàn */
.spread {
  --cw: 100px;
  --gap: max(8px, calc(var(--cw) * .22));
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cw));
  column-gap: var(--gap); row-gap: 16px;
  justify-content: center; margin: 0 auto;
}
.spread.s-one { --cw: clamp(130px, min(34vw, 30vh), 200px); }
.spread.s-three { --cw: clamp(78px, min(22vw, 22vh), 150px); }
/* 5 cột + 4 khe (0.22 lá) = 5.9 lá; 4 cột + 3 khe (0.5 lá) = 5.5 lá: chia theo bề ngang còn lại để không bị tràn */
.spread.s-love { --cw: clamp(38px, calc((100vw - 52px) / 5.9), 118px); }
.spread.s-choice { --cw: clamp(56px, min(21vw, 17vh), 132px); }
.spread.s-celtic { --cw: clamp(40px, min(calc((100vw - 52px) / 5.6), 10.5vh), 100px); --gap: calc(var(--cw) * .5); }
.spread.s-year { --cw: clamp(52px, min(16vw, 11vh), 100px); }

.slot { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; min-width: 0; }
.slot .holder { position: relative; width: var(--cw); height: calc(var(--cw) * var(--ratio)); }
.slot .holder::before {
  content: attr(data-n); position: absolute; inset: 0; display: grid; place-items: center;
  border: 1px solid rgba(185, 138, 74, .35); border-radius: 5% / 3%; color: rgba(185, 138, 74, .6);
  font-family: var(--f-display); font-size: 1.6rem; background: rgba(255, 255, 255, .015);
}
.slot .card { display: none; position: absolute; inset: 0; --cw: 100%; width: 100%; height: 100%; }
.slot.filled .card { display: block; animation: land .35s ease both; }
@keyframes land { from { transform: scale(1.06); } to { transform: none; } }

/* lá bắt chéo (Celtic Cross, vị trí số 2): nằm ngang đè lên lá số 1 */
.slot.cross { z-index: 3; }
.slot.cross .holder::before { transform: rotate(90deg); background: rgba(12, 11, 10, .6); }
.slot.cross .card { transform: rotate(90deg); }
.slot.cross.filled .card { animation-name: landX; }
@keyframes landX { from { transform: rotate(90deg) scale(1.06); } to { transform: rotate(90deg); } }

.slot.filled .holder::before { display: none; }
.no-anim .card-inner { transition: none !important; }
.no-anim .card { animation: none !important; }

.slot-label { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px; font-size: .72rem; color: var(--muted); text-align: center; line-height: 1.25; max-width: calc(var(--cw) * 1.5); }
.slot-label b { display: inline-grid; place-items: center; flex: none; width: 1.8em; height: 1.8em; border-radius: 50%; border: 1px solid var(--accent-dk); color: var(--accent-lt); font-family: var(--f-body); font-size: .62rem; font-weight: 600; }
.slot-name { font-family: var(--f-display); font-weight: 600; font-size: 1.1rem; text-align: center; min-height: 1.3em; color: var(--ink); line-height: 1.15; max-width: calc(var(--cw) * 1.6); visibility: hidden; }
.slot-name.on { visibility: visible; }
.tag { display: inline-block; font-family: var(--f-body); font-weight: 500; color: var(--bad); font-size: .64rem; border: 1px solid rgba(221, 146, 133, .5); border-radius: 2px; padding: 0 6px; margin-left: 5px; vertical-align: middle; letter-spacing: .04em; }

/* lá chưa lật: gợi ý nhẹ */
.slot.filled:not(.shown) .card { cursor: pointer; animation: land .35s ease both, pulse 2.4s ease-in-out .5s infinite; }
.slot.cross.filled:not(.shown) .card { animation-name: landX, pulse; }
@keyframes pulse { 0%, 100% { filter: drop-shadow(0 0 0 rgba(185, 138, 74, 0)); } 50% { filter: drop-shadow(0 0 10px rgba(185, 138, 74, .55)); } }
.slot.shown .card { cursor: zoom-in; }

/* ---- khu điều khiển: cỗ bài & quạt bài ---- */
.controls { position: relative; z-index: 5; text-align: center; }
.controls.sticky {
  position: sticky; bottom: 0; margin: 0 calc(var(--pad) * -1); padding: 12px 0 max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(12, 11, 10, 0), rgba(12, 11, 10, .94) 24%, rgba(12, 11, 10, .98));
}
.ctrl-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.controls.sticky .ctrl-row { margin-top: 6px; }
.picked-note { color: var(--muted); font-size: .85rem; margin-top: 8px; }

.pile { position: relative; width: 104px; height: calc(104px * var(--ratio)); margin: 6px auto 0; }
.pile .pc { position: absolute; inset: 0; border-radius: 5% / 3%; background: var(--card-back) center / 100% 100% no-repeat, #14110d; box-shadow: 0 6px 16px rgba(0, 0, 0, .6); }
.pile .pc:nth-child(1) { transform: translate(-3px, 3px); }
.pile .pc:nth-child(2) { transform: translate(-1.5px, 1.5px); }
.pile.shuffling .pc:nth-child(odd) { animation: riffleL .55s ease-in-out 3; }
.pile.shuffling .pc:nth-child(even) { animation: riffleR .55s ease-in-out 3; }
@keyframes riffleL { 0%, 100% { transform: translate(0, 0) rotate(0); } 45% { transform: translate(-64px, -8px) rotate(-10deg); } 75% { transform: translate(-14px, 0) rotate(-2deg); } }
@keyframes riffleR { 0%, 100% { transform: translate(0, 0) rotate(0); } 45% { transform: translate(64px, -14px) rotate(10deg); } 75% { transform: translate(14px, 0) rotate(2deg); } }

.fan-wrap { overflow-x: auto; overflow-y: hidden; padding: 16px 16px 2px; scrollbar-width: thin; scrollbar-color: var(--accent-dk) transparent; -webkit-overflow-scrolling: touch; }
.fan { --fw: 54px; display: inline-flex; flex-direction: column; gap: 8px; min-width: 100%; align-items: flex-start; }
.fan-row { display: flex; padding-right: 8px; margin: 0 auto; }
.fan-card {
  flex: none; width: var(--fw); height: calc(var(--fw) * var(--ratio));
  margin-left: calc(var(--step) - var(--fw));
  border: 0; padding: 0; border-radius: 5% / 3%;
  background: var(--card-back) center / 100% 100% no-repeat, #14110d;
  box-shadow: -3px 0 8px rgba(0, 0, 0, .55);
  transition: transform .18s ease, filter .18s;
}
.fan-row .fan-card:first-child { margin-left: 0; }
.fan-card:hover, .fan-card:focus-visible { transform: translateY(-14px); filter: brightness(1.2) drop-shadow(0 6px 10px rgba(185, 138, 74, .4)); z-index: 4; position: relative; }
.fan-card.taken { visibility: hidden; pointer-events: none; }

/* lá bài đang bay từ quạt bài xuống bàn */
.flyer {
  position: fixed; z-index: 90; pointer-events: none; border-radius: 5% / 3%;
  background: var(--card-back) center / 100% 100% no-repeat, #14110d;
  box-shadow: 0 16px 34px rgba(0, 0, 0, .65);
  transform-origin: 50% 50%;
}

/* thanh tiến trình 4 bước */
.stepper { display: flex; justify-content: center; align-items: center; gap: 0; list-style: none; margin: 14px 0 2px; padding: 0; }
.stepper li { display: flex; align-items: center; gap: 7px; font-size: .78rem; color: var(--dim); }
.stepper li + li::before { content: ""; width: 26px; height: 1px; margin: 0 8px 0 4px; background: var(--line-2); }
.stepper .n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-2); font-size: .68rem; font-weight: 600; }
.stepper li.done { color: var(--muted); }
.stepper li.done .n { background: var(--accent-dk); border-color: var(--accent-dk); color: #15100a; }
.stepper li.now { color: var(--ink); font-weight: 500; }
.stepper li.now .n { background: var(--accent); border-color: var(--accent); color: #15100a; }

/* tiến độ chọn bài */
.pick-head { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 16px; }
.progress { flex: 1; max-width: 280px; height: 2px; background: var(--line-2); overflow: hidden; }
.progress span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .3s ease; }
.pick-count { font-size: .86rem; color: var(--ink); font-weight: 500; white-space: nowrap; }
.pick-count b { font-weight: 600; color: var(--accent-lt); }

/* ---- lời giải ---- */
.reading { margin-top: 38px; animation: fadeIn .5s ease both; }
.reading > h3 { font-size: clamp(2.2rem, 6vw, 3.1rem); font-weight: 500; text-align: center; }
.verdict { text-align: center; padding: 26px 16px 24px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid var(--line-2); }
.verdict-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .22em; color: var(--muted); }
.verdict-word { font-family: var(--f-display); font-weight: 600; font-size: clamp(2.8rem, 11vw, 4.4rem); letter-spacing: .14em; line-height: 1.05; margin: 4px 0 6px; }
.verdict-sub { max-width: 46ch; margin: 0 auto; color: var(--muted); }
.verdict-yes { border-color: rgba(148, 189, 155, .5); }
.verdict-yes .verdict-word { color: var(--ok); }
.verdict-no { border-color: rgba(221, 146, 133, .5); }
.verdict-no .verdict-word { color: var(--bad); }
.verdict-maybe .verdict-word { color: var(--accent-lt); }

.overview { border-top: 1px solid var(--accent-dk); border-bottom: 1px solid var(--line); padding: 20px 4px; margin-bottom: 8px; }
.overview h4 { font-size: 1.5rem; font-weight: 500; color: var(--accent-lt); margin-bottom: 8px; }
.overview p + p { margin-top: 8px; }
.overview b { color: var(--ink); font-weight: 600; }

.read-item { display: grid; grid-template-columns: 118px 1fr; gap: 22px; align-items: start; padding: 24px 4px; border-bottom: 1px solid var(--line); }
.read-thumb { width: 118px; aspect-ratio: 1 / var(--ratio); padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 5% / 3%; }
.read-thumb .tcard { height: 100%; }
.read-thumb.rev .tcard { transform: rotate(180deg); }
.read-pos { color: var(--accent); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .18em; }
.read-name { font-size: 1.9rem; font-weight: 600; margin: 2px 0 2px; color: var(--ink); }
.read-name .tag { font-size: .7rem; padding: 1px 8px; }
.read-desc { color: var(--muted); font-family: var(--f-display); font-style: italic; font-size: 1.05rem; margin-bottom: 10px; }
.read-text { font-size: 1rem; line-height: 1.8; color: var(--ink-soft); }
.read-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 26px; }
.read-card-text { margin-top: 8px; }
.read-card-text p { margin: 0 0 8px; line-height: 1.6; }
.read-card-text p:last-child { margin-bottom: 0; }
.read-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; }
.link-btn { padding: 4px 0; border: 0; background: none; color: var(--accent-lt); font-size: .84rem; font-weight: 500; text-decoration: underline; text-decoration-color: rgba(185, 138, 74, .5); text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); text-decoration-color: var(--ink); }
.read-item, .reading, .mat { scroll-margin-top: 76px; }
.read-item.flash { animation: flash 1.7s ease; }
@keyframes flash { 0%, 100% { box-shadow: 0 0 0 0 rgba(185, 138, 74, 0); } 20%, 60% { box-shadow: 0 0 0 1px var(--accent); background: rgba(185, 138, 74, .06); } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chips.static { justify-content: flex-start; gap: 6px; margin: 8px 0 12px; }
.chip { padding: 6px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: .85rem; font-weight: 500; transition: color .2s, border-color .2s, background .2s; }
button.chip:hover { color: var(--ink); border-color: var(--line-2); }
.chip[aria-selected="true"] { color: #15100a; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.chips.static .chip { padding: 1px 10px; font-size: .76rem; cursor: default; color: var(--accent-lt); border-color: rgba(185, 138, 74, .4); background: transparent; }
.read-item .chips.static { margin: 0 0 10px; }

/* chọn chủ đề đọc lời giải */
.topic-bar { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 22px 0 16px; }
.topic-bar-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .2em; color: var(--muted); }
.topic-tabs .chip { padding: 5px 16px; font-family: var(--f-display); font-size: 1.1rem; font-weight: 600; }
#dlgTopics { justify-content: flex-start; gap: 6px; margin: 12px 0 2px; }
#dlgTopics .chip { padding: 3px 12px; font-size: 1rem; }

/* ---- thư viện ---- */
.chips#libFilters { margin-bottom: 24px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 24px 16px; }
.lib-item { padding: 0; border: 0; background: none; text-align: center; transition: transform .2s; }
.lib-item:hover { transform: translateY(-4px); }
.lib-item .art { display: block; width: 100%; aspect-ratio: 1 / var(--ratio); }
.lib-item .tcard { height: 100%; }
.lib-item .cap { display: block; margin-top: 9px; font-family: var(--f-display); font-weight: 600; font-size: 1.05rem; color: var(--ink); line-height: 1.2; transition: color .2s; }
.lib-item:hover .cap { color: var(--accent-lt); }
.search { display: flex; align-items: center; gap: 12px; max-width: 560px; margin: 0 auto 16px; }
.search input { flex: 1; min-width: 0; padding: 12px 14px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); transition: border-color .2s, box-shadow .2s; }
.search input::placeholder { color: var(--dim); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); outline: none; }
.lib-count { flex: none; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 44px 12px; border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty a { color: var(--accent-lt); }

/* ---- khung phẳng dùng chung (hộp thoại, khung tư vấn, mục nhật ký) ---- */
.frame { border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); }

/* ---- hộp thoại ---- */
.dialog { width: min(840px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 4px; box-shadow: 0 30px 90px rgba(0, 0, 0, .8); overflow: auto; }
.dialog::backdrop { background: rgba(6, 5, 4, .86); }
.dialog[open] { animation: pop .25s ease both; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.dlg-close { position: absolute; top: 14px; right: 14px; z-index: 3; width: 36px; height: 36px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--bg); line-height: 1; }
.dlg-close:hover { border-color: var(--accent); color: var(--accent-lt); }
.dlg-body { position: relative; z-index: 2; display: grid; grid-template-columns: 260px 1fr; gap: 30px; padding: 34px; }
.dlg-card { width: 260px; aspect-ratio: 1 / var(--ratio); align-self: start; }
.dlg-card .tcard { height: 100%; }
.dlg-card.rev .tcard { transform: rotate(180deg); }
.dlg-text h3 { font-size: clamp(2.2rem, 5vw, 3rem); font-weight: 500; margin: 4px 0 0; }
.dlg-text .en { color: var(--muted); font-family: var(--f-display); font-style: italic; font-size: 1.15rem; margin-bottom: 4px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 2px 0 8px; }
.facts dt { font-size: .66rem; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }
.facts dd { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: 1.15rem; color: var(--ink); }
.meaning { padding: 10px 14px; border-radius: var(--radius); margin-top: 8px; border: 1px solid transparent; }
.meaning h4 { font-family: var(--f-body); font-size: .68rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.meaning p { font-size: .96rem; line-height: 1.75; color: var(--ink-soft); }
.meaning.active { background: rgba(185, 138, 74, .08); border-color: rgba(185, 138, 74, .35); }
.meaning.active h4 { color: var(--accent-lt); }

/* ---- toast ---- */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 20px; border-radius: var(--radius); background: var(--ink); color: #15100a; font-weight: 500; font-size: .9rem; transition: opacity .25s, transform .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ===== Tư vấn (khung chat) ===== */
.consult { margin-top: 30px; padding: 24px 22px 18px; scroll-margin-top: 76px; }
.consult-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.ai-avatar { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--accent); color: var(--accent-lt); font-size: 1.2rem; }
.consult-head h4 { font-size: 1.7rem; font-weight: 600; color: var(--ink); }
.consult-sub { font-size: .84rem; color: var(--muted); line-height: 1.5; }
.ai-badge { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 2px; border: 1px solid var(--accent-dk); color: var(--accent-lt); font-size: .64rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; vertical-align: middle; }
.ai-badge.mock { border-color: rgba(221, 146, 133, .6); color: var(--bad); }

.consult-opts { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 14px; }
.consult-opts label { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); }
.consult-opts select, .consult .c-form textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius); }
.consult-opts select { padding: 7px 10px; min-height: 38px; }
.consult-opts select:focus, .consult .c-form textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 1px var(--accent); }

.c-log { display: flex; flex-direction: column; gap: 14px; margin-bottom: 4px; }
.c-msg { max-width: 92%; padding: 14px 18px; border-radius: var(--radius); font-size: 1rem; line-height: 1.8; color: var(--ink-soft); word-wrap: break-word; }
.c-msg p + p { margin-top: 10px; }
.c-msg strong { color: var(--ink); font-weight: 600; }
.c-assistant { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-left: 2px solid var(--accent); }
.c-user { align-self: flex-end; background: transparent; border: 1px solid var(--line-2); font-size: .95rem; line-height: 1.6; }
.c-error { align-self: stretch; max-width: 100%; background: rgba(221, 146, 133, .08); border: 1px solid rgba(221, 146, 133, .45); font-size: .9rem; }
.c-error .link-btn { color: var(--bad); }
.c-msg.streaming:empty::after, .c-msg.streaming p:last-child::after { content: "▍"; margin-left: 2px; color: var(--accent); animation: caret 1s steps(2, start) infinite; }
.c-msg.streaming:empty { min-width: 3.2em; }
@keyframes caret { to { visibility: hidden; } }

.c-start { text-align: center; margin: 4px 0 6px; }
.c-form { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; }
.c-form textarea { flex: 1; min-width: 0; padding: 11px 14px; resize: none; line-height: 1.5; }
.c-left { margin-top: 8px; font-size: .78rem; color: var(--muted); }
.c-credit { margin-top: 8px; font-size: .78rem; color: var(--muted); }
.c-paywall { background: rgba(185, 138, 74, .07); border-color: var(--accent-dk); }
.c-paywall-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ai-tag { display: inline-block; margin-top: 10px; font-size: .72rem; color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--line-2); }
.ai-tag:hover { color: var(--ink); }

/* ===== Ví lượt, nạp lượt, ủng hộ ===== */
.topbar-right { display: flex; align-items: center; gap: 12px; }
.wallet-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 14px; border-radius: var(--radius);
  border: 1px solid var(--accent-dk); background: transparent; color: var(--accent-lt); font-weight: 500; font-size: .86rem;
  transition: border-color .2s, background .2s;
}
.wallet-chip:hover { border-color: var(--accent); background: rgba(185, 138, 74, .08); }
.wallet-chip .wc-ico { color: var(--accent); }
.wallet-chip.low { border-color: rgba(221, 146, 133, .6); color: var(--bad); }
.wallet-chip.low .wc-ico { color: var(--bad); }

.pay-dialog { width: min(480px, calc(100vw - 24px)); }
.pd-body { position: relative; z-index: 2; padding: 32px 28px 26px; }
.pd-body h3 { font-size: 2.1rem; font-weight: 500; margin-bottom: 12px; padding-right: 40px; }
.pd-help { font-size: .86rem; color: var(--muted); line-height: 1.65; margin-bottom: 12px; }
.pd-help.center { display: block; margin-top: 0; text-align: center; }
.pd-help b, .pd-code b { color: var(--ink); font-weight: 600; }
.pd-stats { display: flex; gap: 12px; margin-bottom: 12px; }
.pd-stats > div { flex: 1; padding: 14px 12px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); text-align: center; }
.pd-stats .n { display: block; font-family: var(--f-display); font-weight: 600; font-size: 2.5rem; line-height: 1; color: var(--ink); }
.pd-stats .n small { font-size: 1.1rem; color: var(--muted); }
.pd-stats .l { display: block; margin-top: 4px; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.pd-code { font-size: .9rem; margin-bottom: 14px; }
.pd-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.pd-more { margin: 10px 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; background: var(--bg); }
.pd-more summary { cursor: pointer; padding: 11px 0; font-size: .9rem; color: var(--ink); }
.pd-more[open] { padding-bottom: 14px; }
.pd-more[open] summary { padding-bottom: 8px; }
.pd-inline { display: flex; gap: 8px; margin-top: 10px; }
.pd-inline input, .pd-field input { flex: 1; min-width: 0; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius); }
.pd-inline input:focus, .pd-field input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 1px var(--accent); }
.pd-key { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; padding: 10px 12px; border-radius: var(--radius); background: rgba(185, 138, 74, .07); border: 1px dashed var(--accent-dk); }
.pd-key b { letter-spacing: .06em; color: var(--accent-lt); font-size: .95rem; }
.pd-sub { font-size: 1.3rem; font-weight: 600; color: var(--ink); margin: 20px 0 6px; }
.pd-hist { list-style: none; margin: 0; padding: 0; font-size: .84rem; }
.pd-hist li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pd-hist .d { font-weight: 600; }
.pd-hist .d.pos { color: var(--ok); }
.pd-hist .d.neg { color: var(--muted); }
.pd-hist .t { color: var(--muted); font-size: .76rem; }
.pd-error { margin: 10px 0; padding: 9px 12px; border-radius: var(--radius); font-size: .86rem; color: var(--bad); background: rgba(221, 146, 133, .08); border: 1px solid rgba(221, 146, 133, .45); }

.pd-packs { display: grid; gap: 10px; margin: 12px 0 16px; }
.pd-pack { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; text-align: left; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--bg); transition: border-color .2s; }
.pd-pack:hover:not(:disabled) { border-color: var(--accent); }
.pd-pack:disabled { opacity: .6; }
.pk-name { font-family: var(--f-display); font-weight: 600; font-size: 1.35rem; color: var(--ink); }
.pk-per { grid-column: 1; font-size: .78rem; color: var(--muted); }
.pk-price { grid-column: 2; grid-row: 1 / span 2; font-weight: 600; font-size: 1.1rem; color: var(--accent-lt); }
/* gói vừa đủ cho số lượt khách đang thiếu */
.pd-pack.suggest { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pd-need { margin: 4px 0 8px; padding: 9px 12px; border-radius: var(--radius); font-size: .9rem; color: var(--accent-lt); background: rgba(185, 138, 74, .08); border: 1px solid rgba(185, 138, 74, .35); }

.pd-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.pd-presets .chip[aria-pressed="true"] { color: #15100a; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.pd-field { display: block; margin-bottom: 12px; font-size: .84rem; color: var(--muted); }
.pd-field input { width: 100%; margin-top: 5px; }
.pd-field em { font-style: italic; }

.pd-qrbox { display: flex; justify-content: center; margin: 12px 0 6px; }
.pd-qrnote { margin: 0 0 10px; text-align: center; font-size: .9rem; color: var(--ink); }
.pd-qracts { display: flex; justify-content: center; margin: 0 0 8px; }
.pd-qracts .btn { min-width: 14em; }
.pd-more { margin: 10px 0; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .015); }
.pd-more summary { cursor: pointer; padding: 11px 14px; font-size: .92rem; color: var(--ink-soft); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pd-more summary::-webkit-details-marker { display: none; }
.pd-more summary::after { content: "+"; color: var(--accent-lt); font-size: 1.1rem; line-height: 1; }
.pd-more[open] summary::after { content: "\2212"; }
.pd-more[open] > :not(summary) { margin-left: 14px; margin-right: 14px; }
.pd-more[open] > :last-child { margin-bottom: 14px; }
.pd-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: .9rem; line-height: 1.55; color: var(--ink-soft); }
.pd-qr { width: 260px; height: 260px; max-width: 100%; border-radius: var(--radius); background: #fff; padding: 8px; object-fit: contain; }
.pd-qr.fake { display: grid; place-items: center; text-align: center; font-family: var(--f-display); font-weight: 600; font-size: 2.2rem; color: #15100a; background: repeating-conic-gradient(#f4efe3 0 25%, #e6dcc0 0 50%) 0 0 / 24px 24px; }
.pd-qr.fake small { font-family: var(--f-body); font-size: .72rem; }
.pd-rows { margin: 10px 0; }
.pd-row { display: grid; grid-template-columns: 7.5em 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.pd-row .k { color: var(--muted); font-size: .8rem; }
.pd-row .v { word-break: break-all; }
.pd-row.big .v { font-weight: 600; letter-spacing: .08em; font-size: 1.1rem; color: var(--accent-lt); }
.pd-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; font-size: .9rem; color: var(--ink); }
.pd-status #pdLeft { color: var(--muted); font-size: .78rem; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(185, 138, 74, .3); border-top-color: var(--accent); animation: rot 1s linear infinite; flex: none; }
@keyframes rot { to { transform: rotate(360deg); } }
.pd-mock { margin: 10px 0; padding: 10px 12px; border-radius: var(--radius); border: 1px dashed rgba(221, 146, 133, .55); background: rgba(221, 146, 133, .06); font-size: .82rem; color: var(--bad); }
.pd-mock p { margin-bottom: 8px; }
.pd-done { text-align: center; padding: 14px 0 4px; }
.pd-done h3 { padding-right: 0; }
.pd-check { display: grid; place-items: center; width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 50%; border: 1px solid var(--accent); color: var(--accent-lt); font-size: 1.8rem; }
.pd-done .pd-actions { justify-content: center; }

/* ---- tab Lưu ý: bố cục kiểu tạp chí, tiêu đề một cột, nội dung một cột ---- */
.notes { margin: 0 0 40px; }
.notes section { display: grid; grid-template-columns: 210px minmax(0, 1fr); column-gap: 36px; padding: 26px 0; border-top: 1px solid var(--line); }
.notes section:first-child { border-top: 0; padding-top: 6px; }
.notes h2 { grid-row: 1 / span 8; align-self: start; font-size: 1.55rem; font-weight: 600; color: var(--ink); }
.notes p { grid-column: 2; max-width: 68ch; margin: 0 0 12px; font-size: .95rem; line-height: 1.75; color: var(--ink-soft); }
.notes .dim { color: var(--muted); font-size: .84rem; }

/* thanh điều hướng dưới (chỉ điện thoại) */
.bnav { display: none; }

/* màn hình cảm ứng: vùng chạm tối thiểu 44px */
@media (pointer: coarse) {
  .btn, .btn.small { min-height: 44px; }
  .nav a, .chip, .hint { min-height: 44px; display: inline-flex; align-items: center; }
  .chips.static .chip { min-height: 0; }
  .switch { min-height: 44px; }
  .link-btn, .text-btn { min-height: 44px; display: inline-flex; align-items: center; }
  .dlg-close { width: 44px; height: 44px; }
  #dlgTopics .chip { min-height: 40px; }
  .consult-opts select { min-height: 44px; }
}

/* ---- responsive ---- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 6px; padding: 30px 0 32px; }
  .hero-cards { order: -1; --hw: 104px; height: calc(var(--hw) * 1.77 + 36px); }
  .hero-copy { text-align: left; }
  .notes section { grid-template-columns: 1fr; }
  .notes h2 { grid-row: auto; margin-bottom: 8px; }
  .notes p { grid-column: 1; }
}
@media (max-width: 640px) {
  :root { --pad: 14px; --bnav-h: calc(60px + env(safe-area-inset-bottom)); }
  body { padding-bottom: var(--bnav-h); }
  body.in-table { padding-bottom: 0; }
  .brand-sub { display: none; }
  .nav { display: none; }
  .bnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: var(--bnav-h); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(12, 11, 10, .97); backdrop-filter: blur(8px); border-top: 1px solid var(--line-2);
  }
  body.in-table .bnav { display: none; }
  .bnav a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; padding: 8px 1px 0; min-height: 48px; color: var(--muted); text-decoration: none; font-size: .62rem; font-weight: 500; letter-spacing: 0; line-height: 1.15; text-align: center; }
  .bnav a svg { flex: none; width: 22px; height: 22px; }
  .bnav a span { display: block; max-width: 100%; min-height: 2.3em; overflow-wrap: anywhere; }
  .bnav a[aria-current="page"] { color: var(--accent-lt); }
  .toast { bottom: calc(var(--bnav-h) + 16px); }

  .page-head { padding: 28px 0 18px; margin-bottom: 18px; }
  .hero h1 { font-size: 2.6rem; }
  .hero-cta .btn { width: 100%; }
  .step { padding: 26px 0 24px; }
  .intent-grid { grid-template-columns: 1fr 1fr; }
  .intent-body { min-height: 84px; padding: 14px 14px 12px; }
  .intent-name { font-size: 1.3rem; }
  .spread-options { grid-template-columns: 1fr; }
  .cta-bar .btn.big { padding: 13px 20px; font-size: .95rem; }
  .wallet-chip .wc-t { display: none; }
  .pd-body { padding: 28px 18px 20px; }
  .pd-row { grid-template-columns: 6em 1fr auto; }
  .consult { padding: 20px 14px 14px; }
  .consult-head h4 { font-size: 1.45rem; }
  .c-msg { max-width: 100%; }
  .stepper li { font-size: .74rem; gap: 5px; }
  .stepper li + li::before { width: 16px; margin: 0 6px 0 2px; }
  .dlg-body { grid-template-columns: 1fr; padding: 24px 18px; gap: 16px; }
  .dlg-card { width: 170px; margin: 0 auto; }
  .read-item { grid-template-columns: 82px 1fr; gap: 14px; padding: 20px 0; }
  .read-thumb { width: 82px; }
  .read-name { font-size: 1.55rem; }
      .slot-label { font-size: .64rem; }
  .slot-name { font-size: .9rem; }
  .mat { padding: 22px 6px 14px; }
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 18px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---- thư viện: mỗi lá là một liên kết thật ---- */
a.lib-item { display: block; color: inherit; text-decoration: none; }
.dlg-page { margin-top: 14px; }

/* ---- trang riêng từng lá bài (do máy chủ dựng sẵn, xem server/seo.js) ---- */
.static-page { padding-top: 20px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .78rem; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent-lt); }
.crumbs .sep { color: var(--dim); }
.crumbs [aria-current] { color: var(--ink-soft); }

.cp-top { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 44px; align-items: start; padding: 28px 0 36px; border-bottom: 1px solid var(--line); }
.cp-art { margin: 0; position: sticky; top: 84px; }
.cp-art img { display: block; width: 100%; height: auto; border-radius: 6px; box-shadow: 0 20px 50px rgba(0, 0, 0, .65), 0 0 0 1px rgba(236, 228, 214, .1); }
.cp-head h1 { font-size: clamp(2.6rem, 6vw, 4.2rem); font-weight: 500; margin: 8px 0 0; }
.cp-head .en { color: var(--muted); font-family: var(--f-display); font-style: italic; font-size: 1.35rem; margin-bottom: 4px; }
.cp-head ul.chips { list-style: none; padding: 0; margin: 10px 0 14px; }
.cp-lead { color: var(--ink-soft); max-width: 60ch; margin-top: 16px; line-height: 1.8; }
.cp-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 26px; }
.cp-cta .text-btn { text-decoration: none; }

.cp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 32px 0 8px; }
.cp-cols .meaning { padding: 18px 20px; border-color: var(--line); }
.cp-cols .meaning h2 { font-size: 1.65rem; font-weight: 500; color: var(--ink); margin-bottom: 8px; }
.cp-cols .meaning p { font-size: 1rem; }

.cp-sec { padding: 34px 0; border-bottom: 1px solid var(--line); }
.cp-sec h2 { font-size: clamp(1.6rem, 3.4vw, 2.1rem); font-weight: 500; margin-bottom: 16px; }
.cp-sec h2 .count { font-family: var(--f-body); font-size: .72rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-left: 10px; }
.cp-sec p { max-width: 68ch; color: var(--ink-soft); margin-bottom: 10px; line-height: 1.8; }
.cp-sec p b { color: var(--ink); font-weight: 600; }
.cp-topics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.cp-topic h3 { font-size: 1.4rem; font-weight: 600; color: var(--accent-lt); margin-bottom: 8px; }
.cp-topic p { font-size: .92rem; line-height: 1.7; }
.cp-lore blockquote { margin: 0 0 20px; padding: 2px 0 2px 20px; border-left: 1px solid var(--accent); }
.cp-lore blockquote p { max-width: 58ch; margin: 0; font-family: var(--f-display); font-style: italic; font-size: 1.35rem; line-height: 1.45; color: var(--ink); }
.cp-lore blockquote footer { margin-top: 6px; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.cp-cta-box .btn { margin-top: 6px; text-decoration: none; }

.cp-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.cp-pn a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; transition: border-color .2s; }
.cp-pn a:hover { border-color: var(--accent); }
.cp-pn a[rel="next"] { text-align: right; }
.cp-pn span { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.cp-pn b { font-family: var(--f-display); font-size: 1.35rem; font-weight: 600; }

.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 22px 14px; }
.rel-card { display: block; text-align: center; color: var(--ink); text-decoration: none; transition: transform .2s; }
.rel-card:hover { transform: translateY(-4px); }
.rel-card img { display: block; width: 100%; height: auto; aspect-ratio: 252 / 446; border-radius: 5px; background: #14110d; box-shadow: 0 8px 20px rgba(0, 0, 0, .55), 0 0 0 1px rgba(236, 228, 214, .08); }
.rel-card span { display: block; margin-top: 8px; font-family: var(--f-display); font-weight: 600; font-size: 1.02rem; line-height: 1.2; transition: color .2s; }
.rel-card:hover span { color: var(--accent-lt); }
.static-page .page-head { margin-top: 8px; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent-lt); }

@media (max-width: 860px) {
  .cp-top { grid-template-columns: 1fr; gap: 24px; padding-top: 18px; }
  .cp-art { position: static; width: min(220px, 62vw); margin: 0 auto; }
  .cp-cols, .cp-topics, .cp-pn { grid-template-columns: 1fr; }
  .cp-pn a[rel="next"] { text-align: left; }
}
a.btn { text-decoration: none; }

/* ---- hộp Ví và Thanh toán: hướng dẫn từng bước ---- */
.pd-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 16px 18px; margin-bottom: 14px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg); }
.pd-total .n { font-family: var(--f-display); font-weight: 600; font-size: 3.4rem; line-height: 1; color: var(--ink); }
.pd-total .u { font-size: 1.02rem; color: var(--ink-soft); }
.pd-total .sub { flex-basis: 100%; margin-top: 4px; font-size: .84rem; color: var(--muted); line-height: 1.5; }
.pd-list { margin: 0 0 14px; padding-left: 1.15em; font-size: .93rem; line-height: 1.65; color: var(--ink-soft); }
.pd-list li { margin: 3px 0; }
.pd-list .pd-list { margin: 4px 0 2px; }
.pd-list li.sub { font-size: .86rem; color: var(--muted); }
.pd-list b { color: var(--ink); font-weight: 600; }
.pd-steps { list-style: none; counter-reset: pd-step; margin: 0 0 14px; padding: 0; }
.pd-steps li { counter-increment: pd-step; position: relative; padding: 6px 0 6px 40px; font-size: .94rem; line-height: 1.6; color: var(--ink-soft); }
.pd-steps li::before { content: counter(pd-step); position: absolute; left: 0; top: 6px; display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; border: 1px solid var(--accent); color: var(--accent-lt); font-size: .82rem; font-weight: 600; }
.pd-steps b { color: var(--ink); font-weight: 600; }
.pd-help b, .pd-hint b, .pd-need b { color: var(--ink); font-weight: 600; }
.pd-hint { margin: 10px 0; padding: 12px 14px; border: 1px solid var(--accent-dk); border-radius: var(--radius); background: rgba(185, 138, 74, .07); font-size: .9rem; line-height: 1.6; color: var(--ink-soft); }
.pd-hint p + p { margin-top: 6px; }
.pd-code .dim { font-size: .82rem; }

.pd-warn { margin: 10px 0 14px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: var(--radius); background: rgba(185, 138, 74, .09); font-size: .9rem; line-height: 1.6; color: var(--ink-soft); }
.pd-warn b { color: var(--ink); font-weight: 600; }
.pd-warn .btn { margin-top: 8px; }
.pd-warn p + p { margin-top: 6px; }
.pd-save { margin-top: 18px; padding-top: 4px; border-top: 1px solid var(--line); text-align: left; }
.pd-save .pd-help { text-align: left; }
.pd-key + .pd-key { margin-top: 6px; }

/* ---- "Mã của bạn" (3 chữ + 3 số) và ô nhập mã ---- */
.pd-codebox { display: flex; align-items: center; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; margin: 4px 0 10px; padding: 14px 16px; border: 1px solid var(--accent); border-radius: var(--radius); background: rgba(185, 138, 74, .08); }
.pd-codebox .l { flex-basis: 100%; font-size: .7rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-lt); }
.pd-codebox .code { font-family: var(--f-display); font-size: 2.8rem; font-weight: 600; line-height: 1; letter-spacing: .16em; color: var(--ink); }
.pd-codeform { margin: 0 0 14px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg); }
.pd-codelabel { display: block; margin-bottom: 8px; font-size: .96rem; font-weight: 500; color: var(--ink); }
.pd-codeform .pd-inline { margin-top: 0; }
.pd-codeform .pd-help { margin: 8px 0 0; }

/* ---- Khung "đọc kỹ trước khi chuyển tiền" ---- */
.pd-notice { margin: 4px 0 14px; padding: 14px 16px; border: 1px solid var(--accent); border-radius: var(--radius); background: rgba(185, 138, 74, .1); }
.pd-notice .t { margin: 0 0 8px; font-size: .74rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-lt); }
.pd-notice ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--ink); font-size: .94rem; line-height: 1.55; }
.pd-notice b { color: var(--ink); }

/* ---- Bản gợi ý (mờ ảo) và khung "tấm màn" mở diễn giải chi tiết ---- */
.c-hint { border-left-style: dashed; }
.c-hint p:last-child { font-style: italic; color: var(--muted); }
.see-more { display: inline-block; padding: 6px 4px; margin: -6px 0; border: 0; background: none; font: inherit; font-size: 1.1em; font-style: normal; font-weight: 700; color: #f5cf7a; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; cursor: pointer; -webkit-tap-highlight-color: rgba(245, 207, 122, .25); }
.see-more:hover, .see-more:focus-visible { color: #ffe29a; text-decoration-thickness: 2px; }
.see-detail-top { margin: 4px 0 14px; text-align: center; }
.see-more:disabled { opacity: .5; cursor: default; }
.c-unlock-note { align-self: stretch; text-align: center; }
.c-unlock-note .c-credit:empty { display: none; }
.c-unlock { align-self: stretch; padding: 18px 20px 16px; text-align: center; border: 1px dashed var(--accent-dk); border-radius: var(--radius); background: rgba(185, 138, 74, .05); animation: fadeIn .5s ease both; }
.c-veil { display: grid; gap: 9px; max-width: 460px; margin: 0 auto 14px; filter: blur(3px); opacity: .8; }
.c-veil i { display: block; height: 11px; border-radius: 6px; background: linear-gradient(90deg, var(--line-2), rgba(216, 178, 119, .4), var(--line-2)); background-size: 220% 100%; animation: veilDrift 7s linear infinite; }
.c-veil i:nth-child(1) { width: 96%; } .c-veil i:nth-child(2) { width: 88%; } .c-veil i:nth-child(3) { width: 93%; } .c-veil i:nth-child(4) { width: 58%; }
@keyframes veilDrift { to { background-position: -220% 0; } }
@media (prefers-reduced-motion: reduce) { .c-veil i { animation: none; } .c-unlock { animation: none; } }
.c-unlock-t { font-family: var(--f-display); font-size: 1.4rem; font-weight: 600; line-height: 1.25; color: var(--ink); }
.c-unlock-s { margin: 6px 0 14px; font-size: .88rem; color: var(--muted); }
.c-unlock .c-credit { margin-top: 10px; }

/* Ưu đãi lần nạp đầu (màu xanh: tin tốt, không phải cảnh báo) */
.pd-bonus { margin: 4px 0 10px; padding: 9px 12px; border-radius: var(--radius); font-size: .9rem; color: var(--ink); background: rgba(94, 160, 126, .10); border: 1px solid rgba(94, 160, 126, .42); }
.pd-bonus b { color: #8fd3ae; font-weight: 600; }

/* Trang lời đọc mẫu */
.sx { margin: 0 0 34px; padding-top: 6px; }
.sx h2 { font-family: var(--serif, "Cormorant Garamond", serif); font-size: 1.5rem; margin: 0 0 4px; }
.sx-meta { margin: 0 0 14px; color: var(--ink-dim, #9a9384); font-size: .92rem; }
.sx-cards { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 16px; }
.sx-card { margin: 0; width: 84px; text-align: center; font-size: .72rem; line-height: 1.3; color: var(--ink-dim, #9a9384); }
.sx-card img { display: block; width: 84px; height: auto; border-radius: 6px; border: 1px solid rgba(185, 138, 74, .35); }
.sx-card.rev img { transform: rotate(180deg); }
.sx-card figcaption span { display: block; color: var(--accent-lt, #d2a96a); }
.sx-step { margin: 0 0 14px; padding: 14px 16px; border-radius: var(--radius, 10px); border: 1px solid rgba(185, 138, 74, .35); background: rgba(255, 255, 255, .02); }
.sx-free { border-color: rgba(94, 160, 126, .45); background: rgba(94, 160, 126, .06); }
.sx-tag { margin: 0 0 8px; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-dim, #9a9384); }
.sx-free .sx-tag b { color: #8fd3ae; }
.sx-paid .sx-tag b { color: var(--accent-lt, #d2a96a); }
.sx-text p { margin: 0 0 10px; line-height: 1.7; }
.sx-text ol { margin: 0 0 10px; padding-left: 1.3em; line-height: 1.7; }
.sx-text strong { color: var(--ink, #ece6d8); font-weight: 600; }
.sx-jump { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0 0; }
.sx-jump a { font-size: .9rem; }
.sx-cta { text-align: center; margin: 22px 0 8px; }

/* Đoạn dẫn dắt đầu trang chủ */
.hero-intro { margin: 0 0 18px; padding: 2px 0 2px 16px; border-left: 2px solid rgba(185, 138, 74, .55); max-width: 52ch; }
.hero-intro p { margin: 0 0 8px; font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; font-size: 1.16rem; line-height: 1.6; color: var(--ink-soft); }
.hero-intro p:last-child { margin-bottom: 0; color: var(--ink); }

/* Điều khoản sử dụng: danh sách, ô tick đồng ý khi thanh toán */
.notes ul { grid-column: 2; max-width: 68ch; margin: 0 0 12px; padding-left: 1.2em; font-size: .95rem; line-height: 1.75; color: var(--ink-soft); }
.notes li { margin-bottom: 4px; }
.notes b { color: var(--ink); font-weight: 600; }
@media (max-width: 720px) { .notes ul { grid-column: 1; } }
.pd-terms { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 12px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid rgba(185, 138, 74, .4); background: rgba(185, 138, 74, .06); font-size: .88rem; line-height: 1.6; color: var(--ink-soft); cursor: pointer; }
.pd-terms input { flex: none; width: 20px; height: 20px; margin-top: 2px; accent-color: #b98a4a; cursor: pointer; }
.pd-terms a { color: var(--accent-lt); text-decoration: underline; text-underline-offset: 3px; }
.pd-packs.locked { opacity: .45; }
.pd-packs.locked .pd-pack, .pd-actions button[disabled] { cursor: not-allowed; }
@media (max-width: 520px) { .hero-intro { margin-bottom: 14px; } .hero-intro p { font-size: 1.06rem; line-height: 1.5; margin-bottom: 6px; } }

/* Nút Zalo nổi ở góc màn hình */
.zalo-fab { position: fixed; right: 20px; bottom: 24px; z-index: 35; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: #0068ff; box-shadow: 0 6px 18px rgba(0, 0, 0, .5), 0 0 0 3px rgba(255, 255, 255, .1); transition: transform .15s ease; }
.zalo-fab svg { width: 38px; height: 38px; display: block; }
.zalo-fab:hover, .zalo-fab:focus-visible { transform: scale(1.07); }
.zalo-fab:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .zalo-fab { transition: none; } }
@media (max-width: 640px) {
  .zalo-fab { right: 12px; bottom: calc(var(--bnav-h) + 84px); width: 48px; height: 48px; }
  .zalo-fab svg { width: 32px; height: 32px; }
  body.in-table .zalo-fab { bottom: 16px; }
}

/* Quạt bài cuộn ngang: mũi tên, mép mờ và dòng gợi ý khi còn lá bài ở phía sau */
.fan-scroller { position: relative; }
.fan-scroller::before, .fan-scroller::after { content: ""; position: absolute; top: 0; bottom: 0; width: 44px; z-index: 5; pointer-events: none; opacity: 0; transition: opacity .2s ease; }
.fan-scroller::before { left: 0; background: linear-gradient(90deg, var(--bg), rgba(12, 11, 10, 0)); }
.fan-scroller::after { right: 0; background: linear-gradient(270deg, var(--bg), rgba(12, 11, 10, 0)); }
.fan-scroller.has-prev::before, .fan-scroller.has-next::after { opacity: 1; }
.fan-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 6; display: grid; place-items: center; width: 36px; height: 68px; padding: 0 0 4px; border-radius: 12px; border: 1px solid rgba(185, 138, 74, .55); background: rgba(12, 11, 10, .88); color: var(--accent-lt); font-size: 2rem; line-height: 1; cursor: pointer; box-shadow: 0 3px 12px rgba(0, 0, 0, .55); }
.fan-arrow[hidden] { display: none; }
.fan-arrow.prev { left: 4px; }
.fan-arrow.next { right: 4px; }
.fan-arrow:hover, .fan-arrow:focus-visible { background: rgba(185, 138, 74, .22); }
.fan-hint { margin: 6px 14px 0; font-size: .8rem; line-height: 1.45; color: var(--muted); text-align: center; }
@keyframes fanNudge { 0%, 100% { transform: translateY(-50%) translateX(0); } 50% { transform: translateY(-50%) translateX(4px); } }
@keyframes fanNudgeL { 0%, 100% { transform: translateY(-50%) translateX(0); } 50% { transform: translateY(-50%) translateX(-4px); } }
@media (prefers-reduced-motion: no-preference) {
  .fan-arrow.next { animation: fanNudge 1.3s ease-in-out infinite; }
  .fan-arrow.prev { animation: fanNudgeL 1.3s ease-in-out infinite; }
}

/* Chân trang: một câu chiêm nghiệm bên trái, điều khoản và số liên hệ bên phải; điện thoại thì xếp dọc, căn giữa */
.footer-in { display: flex; align-items: center; justify-content: space-between; gap: 10px 32px; flex-wrap: wrap; max-width: 1060px; margin: 0 auto; }
.footer-quote { margin: 0; font-family: var(--f-display, "Cormorant Garamond", serif); font-style: italic; font-size: 1.12rem; line-height: 1.5; color: var(--ink-soft); }
.footer-links { display: flex; align-items: center; gap: 0; margin: 0; font-size: .86rem; white-space: nowrap; }
.footer-links a { color: var(--muted); text-decoration: underline; text-decoration-color: rgba(163, 154, 139, .4); text-underline-offset: 4px; }
.footer-links a:hover { color: var(--accent-lt); }
.footer-contact { margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--line-2); }
.footer-contact b { color: var(--ink); font-weight: 600; letter-spacing: .02em; }
@media (max-width: 720px) {
  .footer-in { flex-direction: column; text-align: center; gap: 12px; }
  .footer-quote { font-size: 1.05rem; max-width: 30ch; }
  .footer-links { flex-wrap: wrap; justify-content: center; row-gap: 4px; }
}
/* chừa chỗ cho nút Zalo nổi để không che số liên hệ ở chân trang */
@media (min-width: 721px) { body:has(.zalo-fab) .footer-in { padding-right: 76px; } }

/* Biểu tượng Zalo trong dòng chữ (chân trang, Điều khoản, ví): không hiện số điện thoại */
.zalo-link { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 22px; padding: 0 9px; border-radius: 11px; background: #0068ff; color: #fff !important; font-weight: 800; font-size: .78rem; letter-spacing: .02em; line-height: 1; text-decoration: none !important; vertical-align: middle; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.zalo-link:hover, .zalo-link:focus-visible { background: #1a7bff; }
.zalo-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---- lưu lời đọc: sao chép, Word, in hoặc lưu PDF ---- */
.save-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 6px; }
.save-l { margin-right: 4px; font-size: .8rem; color: var(--muted); }
#printArea { display: none; }
@media print {
  body.printing { background: #fff !important; padding: 0 !important; min-height: 0; display: block; }
  body.printing > *:not(#printArea) { display: none !important; }
  body.printing #printArea { display: block; color: #000; background: #fff; font-family: Georgia, "Times New Roman", serif; font-size: 12pt; line-height: 1.55; }
  #printArea h1 { font-size: 20pt; margin: 0 0 8pt; color: #000; }
  #printArea h2 { font-size: 13pt; margin: 14pt 0 4pt; color: #000; font-family: Georgia, serif; }
  #printArea p { margin: 0 0 8pt; }
}

.field-error { margin: 10px 0 0; padding: 10px 14px; border: 1px solid rgba(221, 146, 133, .45); border-radius: var(--radius); background: rgba(221, 146, 133, .08); color: var(--ink-soft); font-size: .92rem; line-height: 1.6; }
.field-error[hidden] { display: none; }
