/* Bảng màu An Hạnh Trang · ngày và đêm */
:root {
  --green: #38634F;
  --green-deep: #294938;
  --cream: #F7F4EC;
  --paper: #FFFCF5;
  --sage: #E7EDE2;
  --sand: #EDE6D8;
  --blush: #F0E3E5;
  --ink: #342D27;
  --muted: #5F554B;
  --line: #D7CEBE;
  --rose: #A94F70;
  --rose-d: #85445D;
  --rose-soft: #C992A6;
  --bronze: #B89A5E;
  --bronze-deep: #82663D;
  --control-line: #887B6A;
  --soft-ink: #6E5B3E;
  --prayer-paper-top: #FBF5E6;
  --prayer-paper-bottom: #F6EDD6;
  --prayer-frame: #FBF7EE;
  --prayer-border: #C992A6;
  --print-paper: #FFFFFF;
  --print-ink: #000000;
  --on-green: #FFFDF6;
  --panel-text: #F7F4EC;
  --green-panel: #38634F;
  --cover-ivory: #FAEFD9;
  --cover-gilt: #D1B982;
  --cover-spine: #302923;
  --cover-moss: #506658;
  --cover-celadon: #586751;
  --cover-mahogany: #6B504B;
  --cover-jade: #496566;
  --cover-ash: #595751;
  --cover-plum: #66515E;
  --cover-lotus: #74565F;
  --cover-indigo: #505D6D;
  --cover-tea: #6B5849;
  --read-day: #F0ECE3;
  --read-sepia: #EDE1C8;
  --read-sepia-paper: #F7EDD7;
  --read-night: #2C251F;
  --read-night-page: #25201C;
  --read-ink: #362E27;
  --read-line: #857768;
  --read-night-ink: #F7EEE1;
  --read-night-line: #B6A594;
  --shadow-ink: #2E251D;
  --mark-gold: #CEAB61;
  --mark-lotus: #CF8FA5;
  --mark-moss: #9CB69A;
  --mark-plum: #B9A0B0;
  --canvas-ink: #342D27;
  --canvas-cream: #F7F4EC;
  --canvas-moss: #38634F;
  --canvas-lotus: #A94F70;
  --radius: 22px;
  --reader-size: 21px;
  --focus: var(--rose);
  --prayer-line: var(--green);
  --uncertain-text: var(--rose-d);
  font-size: 16px;
}
html.night {
  color-scheme: dark;
  --cream: #28221D;
  --paper: #352B24;
  --sage: #3A382E;
  --sand: #403428;
  --blush: #46323A;
  --ink: #F7EEE1;
  --muted: #D6C6B6;
  --line: #69594C;
  --green: #B3CCAE;
  --green-deep: #C6D9BF;
  --rose: #E0A0B6;
  --rose-d: #EDAFC3;
  --bronze: #C3A974;
  --bronze-deep: #D0B57A;
  --control-line: #AA9A8D;
  --soft-ink: #E3C99D;
  --prayer-paper-top: #322922;
  --prayer-paper-bottom: #2E2620;
  --prayer-frame: #372B24;
  --prayer-border: #AE7389;
  --on-green: #243023;
  --panel-text: #F7EEE1;
  --green-panel: #354137;
  --shadow-ink: #201A16;
}

@font-face{font-family:Be Vietnam Pro;src:url('assets/fonts/BeVietnamPro-Regular.ttf') format('truetype');font-weight:400;font-display:swap}@font-face{font-family:Be Vietnam Pro;src:url('assets/fonts/BeVietnamPro-Bold.ttf') format('truetype');font-weight:700;font-display:swap}
*{box-sizing:border-box}html{scroll-behavior:smooth;scroll-padding-top:108px}body{margin:0;background:var(--cream);color:var(--ink);font-family:'Be Vietnam Pro',sans-serif;font-size:1rem;line-height:1.75}html.large{font-size:19px}button,input,select{font:inherit}button,a,input,select{touch-action:manipulation}a{color:inherit;text-underline-offset:5px}button{cursor:pointer}button,a{ -webkit-tap-highlight-color:transparent}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid var(--rose);outline-offset:5px}button:disabled{opacity:.6}img,svg{max-width:100%;display:block}h1,h2,h3,p{margin-top:0}h1,h2,h3{line-height:1.3;font-weight:400}h1{font-size:clamp(2.6rem,4.7vw,4.5rem);letter-spacing:-.055em;margin-bottom:24px}h2{font-size:clamp(1.9rem,3vw,2.65rem);letter-spacing:-.035em}h3{font-size:1.3rem}p{margin-bottom:1.1rem}small,.small{font-size:.86rem}.muted{color:var(--muted)}.wrap{width:min(1200px,calc(100% - 80px));margin:auto}.skip{position:absolute;left:16px;top:-100px;z-index:100;background:var(--print-paper);padding:12px}.skip:focus{top:10px}.demo-bar{padding:7px 20px;text-align:center;background:var(--sage);font-size:.8rem;color:var(--green)}.demo-bar a{margin-left:12px}.header{border-bottom:1px solid var(--line);background:var(--cream)}.header-inner{display:flex;align-items:center;justify-content:space-between;gap:24px;min-height:100px}.brand{display:flex;gap:12px;align-items:center;text-decoration:none;white-space:nowrap}.brand img{width:58px;height:58px}.brand strong{font-weight:400;font-size:1.35rem;letter-spacing:-.025em}.brand small{display:block;font-size:.72rem;color:var(--muted);letter-spacing:.11em}.nav{display:flex;gap:23px;align-items:center}.nav a{text-decoration:none;font-size:.87rem;white-space:nowrap}.nav a:hover{color:var(--rose)}.text-toggle,.menu-toggle{border:1px solid var(--line);background:transparent;border-radius:100px;padding:9px 12px;color:var(--green);min-height:44px}.menu-toggle{display:none}.eyebrow{font-size:.76rem;font-weight:700;letter-spacing:.15em;text-transform:uppercase;color:var(--rose);margin-bottom:22px}.hero{display:grid;grid-template-columns:1.08fr .92fr;gap:64px;align-items:center;padding:66px 0 60px}.hero .lead{max-width:520px;color:var(--muted);font-size:1.06rem}.hero h1 em{font-style:normal;color:var(--green)}.hero-art{position:relative;background:var(--sage);border-radius:240px 240px 26px 26px;min-height:500px;overflow:hidden;display:flex;align-items:center;justify-content:center}.hero-art svg{width:100%;height:500px}.art-caption{position:absolute;bottom:22px;width:100%;text-align:center;color:var(--green);font-size:.74rem;letter-spacing:.18em}.buttons{display:flex;gap:12px;flex-wrap:wrap;margin-top:30px}.button{display:inline-flex;align-items:center;justify-content:center;padding:13px 22px;min-height:48px;border-radius:100px;background:var(--green);color:var(--print-paper);border:1px solid var(--green);font-size:.9rem;text-decoration:none}.button.secondary{color:var(--green);background:transparent}.button:hover{filter:brightness(.95)}.hero-note{display:flex;align-items:center;gap:12px;margin-top:28px;font-size:.8rem;color:var(--muted)}.hero-note:before{content:'';width:28px;height:1px;background:var(--rose)}.values{border-top:1px solid var(--line);border-bottom:1px solid var(--line);display:grid;grid-template-columns:repeat(3,1fr);padding:24px 0;gap:24px}.values div{display:flex;gap:15px;align-items:baseline}.values b{font-weight:400;font-size:1.2rem;color:var(--green)}.values span{font-size:.86rem;color:var(--muted)}section.section{padding:75px 0}.section-head{display:flex;align-items:end;justify-content:space-between;gap:30px;margin-bottom:28px}.section-head h2{margin-bottom:0}.section-head p{margin:0;max-width:390px;color:var(--muted);font-size:.9rem}.filters{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:24px}.search{flex:1;min-width:220px}.search input,select{border:1px solid var(--line);border-radius:12px;background:var(--paper);padding:13px 16px;width:100%;color:var(--ink)}select{appearance:auto;padding-right:16px;background-repeat:no-repeat;background-position:right 12px center}.filter-select{width:190px}.filter-select label,.search label{display:block;font-size:.8rem;margin-bottom:5px;color:var(--muted)}.chips{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:20px}.chip{border:1px solid var(--line);background:transparent;border-radius:60px;color:var(--muted);padding:8px 15px;font-size:.85rem;min-height:42px}.chip.active{color:var(--print-paper);background:var(--green);border-color:var(--green)}.article-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:26px}.article-card{border:0;background:transparent;padding:0;text-align:left;color:inherit;display:flex;flex-direction:column;line-height:inherit}.thumb{height:195px;border-radius:18px;background:var(--sage);width:100%;position:relative;overflow:hidden;display:grid;place-items:center;margin-bottom:20px}.thumb svg{height:155px;width:155px}.thumb.rose{background:var(--blush)}.thumb.sand{background:var(--sand)}.card-meta{font-size:.75rem;color:var(--rose);margin-bottom:8px}.article-card h3{font-size:1.35rem;margin:0 0 10px}.article-card:hover h3{text-decoration:underline;text-underline-offset:5px}.article-card p{font-size:.88rem;color:var(--muted)}.sample-label{position:absolute;bottom:12px;left:15px;font-size:.7rem;padding:3px 8px;background:var(--paper);border-radius:20px;color:var(--muted)}.result-count{font-size:.8rem;color:var(--muted);margin-bottom:18px}.practice{background:var(--green);color:var(--cream);border-radius:28px;padding:48px 52px;display:grid;grid-template-columns:1fr 1fr;gap:80px;align-items:center}.practice h2{font-size:2.45rem;max-width:370px}.practice .eyebrow{color:var(--on-green)}.practice p{color:var(--panel-text)}.practice ol{padding-left:25px;margin:0}.practice li{padding:10px 0 10px 12px;border-bottom:1px solid color-mix(in srgb, var(--panel-text) 25%, transparent)}.practice .button{background:var(--cream);color:var(--green);border-color:var(--cream)}.practice-result{font-size:.8rem;margin-top:14px;min-height:24px}.family{display:grid;grid-template-columns:1fr 1fr;gap:70px;align-items:center}.family-panel{padding:42px;border-radius:24px;background:var(--blush);min-height:325px;display:flex;flex-direction:column;justify-content:center}.family-panel .big{font-size:1.75rem;line-height:1.5;margin-bottom:24px;color:var(--green)}.text-link{color:var(--green);font-size:.9rem}.library{border-block:1px solid var(--line)}.library-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:22px}.library-item{padding:25px;border:1px solid var(--line);border-radius:16px;background:var(--paper)}.library-item h3{margin:12px 0}.tag{display:inline-block;color:var(--rose);font-size:.74rem;font-weight:700;letter-spacing:.05em}.library-item p{font-size:.85rem;color:var(--muted)}.about{display:grid;grid-template-columns:.8fr 1.2fr;gap:80px}.about p{color:var(--muted)}footer{padding:35px 0;background:var(--sage)}.footer-inner{display:flex;justify-content:space-between;gap:25px;font-size:.8rem}.footer-inner p{margin:0}.footer-links{display:flex;gap:22px;align-items:center}.preview-controls{border-top:1px solid var(--line);padding:18px 0}.preview-controls .wrap{display:flex;align-items:center;justify-content:space-between;gap:16px;font-size:.82rem}.preview-controls select{max-width:250px}.empty{grid-column:1/-1;border:1px dashed var(--line);padding:35px;text-align:center;border-radius:18px}.identity-hero{max-width:780px;padding:65px 0 45px}.identity-hero h1{font-size:3.2rem}.concept-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:24px}.concept{border:1px solid var(--line);border-radius:22px;overflow:hidden;background:var(--paper)}.concept-visual{padding:35px 20px 24px;background:var(--sage);text-align:center}.concept:nth-child(2) .concept-visual{background:var(--blush)}.concept:nth-child(3) .concept-visual{background:var(--sand)}.concept-visual>img{width:144px;height:144px;margin:auto}.concept-visual strong{display:block;font-size:1.4rem;font-weight:400;letter-spacing:-.03em;margin:8px 0}.concept-body{padding:25px}.concept-body p{font-size:.88rem;color:var(--muted)}.micro{display:flex;align-items:center;gap:25px;padding:20px 0}.micro img{width:48px;height:48px}.micro img:last-child{width:24px;height:24px}.concept .button{width:100%}.swatches{display:grid;grid-template-columns:repeat(5,1fr);gap:12px}.swatch{border:1px solid var(--line);border-radius:12px;overflow:hidden}.swatch i{height:70px;display:block}.swatch div{padding:12px;font-size:.8rem}.type-demo{font-size:clamp(1.5rem,3vw,2.7rem);max-width:800px;color:var(--green)}.review-note{padding:22px 28px;border-left:3px solid var(--rose);background:var(--paper);margin-top:35px;font-size:.9rem}.concept-legend{display:flex;align-items:center;gap:10px;font-size:.8rem;color:var(--muted)}.concept-legend img{width:36px;height:36px}
@media(max-width:1100px){.wrap{width:calc(100% - 48px)}.header-inner{flex-wrap:wrap;gap:12px;padding:18px 0}.nav{order:3;width:100%;justify-content:center;padding-top:12px;border-top:1px solid var(--line)}.hero{gap:32px}.hero-art,.hero-art svg{min-height:420px;height:420px}.practice{gap:35px}.values div{display:block}.values span{display:block}.concept-grid{gap:14px}}
@media(max-width:700px){html{scroll-padding-top:20px}.wrap{width:calc(100% - 40px)}.demo-bar{font-size:.72rem}.header-inner{min-height:86px;padding:10px 0;gap:8px}.brand img{width:44px;height:44px}.brand strong{font-size:1.15rem}.brand small{font-size:.62rem}.text-toggle{margin-left:auto}.menu-toggle{display:block}.nav{display:none;align-items:start;flex-direction:column;gap:0}.nav.open{display:flex}.nav a{padding:12px;width:100%}.hero{grid-template-columns:1fr;padding:40px 0;gap:30px}.hero h1{font-size:2.8rem}.hero-art{min-height:310px;height:310px;border-radius:180px 180px 22px 22px}.hero-art svg{height:350px;min-height:350px}.hero .lead{font-size:1rem}.hero-note{margin-top:20px}.values{gap:15px}.values b{font-size:1.03rem}.values span{font-size:.74rem}.section-head{display:block}.section-head p{margin-top:18px}.article-grid,.library-grid,.concept-grid{grid-template-columns:1fr}.article-card{margin-bottom:10px}.thumb{height:215px}.filter-select{flex:1;min-width:140px}.practice{grid-template-columns:1fr;padding:30px 25px;gap:20px;border-radius:20px}.practice h2{font-size:2rem}.family,.about{grid-template-columns:1fr;gap:28px}.family-panel{padding:28px;min-height:280px}.family-panel .big{font-size:1.55rem}section.section{padding:48px 0}.footer-inner{display:block}.footer-links{flex-wrap:wrap;margin-top:18px}.preview-controls .wrap{flex-wrap:wrap}.identity-hero{padding:40px 0 25px}.identity-hero h1{font-size:2.4rem}.swatches{grid-template-columns:repeat(2,1fr)}.concept-visual{padding:25px}.concept-visual>img{width:132px;height:132px}.buttons .button{padding:12px 18px;font-size:.85rem}}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}

/* Readable recurring labels on small screens */
.result-count,.sample-label,.card-meta,.tag{font-size:.875rem}.brand small{font-size:.75rem;letter-spacing:.04em}.demo-bar{font-size:.8rem}@media(max-width:700px){.brand small{font-size:.7rem}.hero h1{font-size:2.65rem}.filter-select label,.search label{font-size:.875rem}}

.brand .full-logo{width:250px;height:auto}.header-inner{gap:16px}@media(max-width:700px){.brand .full-logo{width:210px}}@media(max-width:370px){.brand .full-logo{width:175px}}

.lecture{white-space:pre-line;line-height:1.85}#more{display:block;margin:20px auto}

/* ===== Redesign v2 — trang sách mở ra thành bông sen ===== */

.eyebrow{color:var(--rose-d)}
.header{border-bottom:0}
.hero{padding:40px 0 80px;gap:72px}
.hero h1{font-size:clamp(3rem,6.2vw,5.2rem);line-height:1.08;letter-spacing:-.05em;margin-bottom:28px}
.hero .lead{font-size:1.15rem;line-height:1.75;max-width:500px}
.hero .buttons .button{min-height:56px;padding:0 32px;font-size:1rem}
.hero-art{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:26px;padding:72px 40px 36px;min-height:0;background:var(--sage);border-radius:280px 280px 24px 24px;overflow:visible}
.hero-art svg.mini-lotus{width:96px;height:96px;flex:none}
.book{display:flex;width:100%;background:var(--paper);border-radius:6px 6px 16px 16px;overflow:hidden}
.book>div{flex:1 1 0;min-width:0;padding:28px 22px}
.book .page-r{flex:1.15 1 0;font-size:.95rem;line-height:1.85}
.book .page-r p{margin:0 0 8px}
.page-l{border-right:1px solid var(--line);display:flex;flex-direction:column;justify-content:space-between;gap:24px}
.book-kicker{font-size:.72rem;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--rose-d);margin:0 0 10px}
.book-title{font-size:1.5rem;line-height:1.25;letter-spacing:-.03em;color:var(--green);margin:0}
.book-type{font-size:.8rem;color:var(--muted)}
.art-caption{position:static;width:auto;margin:0;font-size:.82rem;letter-spacing:.02em;color:var(--muted)}
.values{display:flex;flex-wrap:wrap;justify-content:space-between;gap:10px 40px;background:var(--green);color:var(--cream);border:0;padding:24px 36px;border-radius:20px;font-size:.95rem}
.values span{color:var(--cream);font-size:.95rem}.values b{color:var(--on-green);font-weight:700;font-size:1.25rem;margin-right:4px}
.topics{margin-top:8px}
.topic-row{display:grid;grid-template-columns:56px minmax(220px,1fr) 2fr auto;gap:12px 40px;align-items:center;padding:30px 36px;text-decoration:none;color:var(--ink);background:var(--blush);min-height:44px}
.topic-row{border-bottom:1px solid color-mix(in srgb, var(--ink) 12%, transparent)}
.topic-row:nth-child(1){border-radius:24px 24px 0 0}.topic-row:nth-child(4){border-radius:0 0 24px 24px;border-bottom:0}
.topic-row:nth-child(2){background:var(--sand)}.topic-row:nth-child(3){background:var(--sage)}
.topic-row .no{font-size:.95rem;font-weight:700;color:var(--rose-d)}
.topic-row:nth-child(2) .no,.topic-row:nth-child(3) .no{color:var(--green)}
.topic-row .nm b{display:block;font-weight:400;font-size:1.65rem;line-height:1.2;letter-spacing:-.03em}
.topic-row .n{font-size:.85rem;color:var(--muted)}
.topic-row .s{font-size:.92rem;color:var(--muted);line-height:1.7}
.topic-row .go{font-size:.92rem;color:var(--green)}
.topic-row:hover .go{text-decoration:underline;text-underline-offset:5px}
.article-grid{display:block;border-top:1px solid var(--line)}
.article-card{display:flex;flex-direction:row;flex-wrap:wrap;align-items:baseline;gap:4px 24px;width:100%;padding:20px 12px;border:0;border-bottom:1px solid var(--line);background:transparent;min-height:44px}
.article-card:hover{background:color-mix(in srgb, var(--green) 7%, transparent)}
.card-title{flex:1 1 320px;min-width:0;font-size:1.3rem;line-height:1.4;letter-spacing:-.015em}
.article-card:hover .card-title{text-decoration:underline;text-underline-offset:5px}
.card-meta{margin:0;color:var(--rose-d);font-weight:700}.card-type{flex:0 0 150px;font-size:.875rem;color:var(--muted)}
.bedtime{background:var(--green);color:var(--cream);margin:40px calc(50% - 50vw);padding:96px max(40px,calc(50vw - 600px));display:grid;grid-template-columns:1fr 1fr;gap:56px 96px;align-items:center}
.bedtime h2{font-size:clamp(2.2rem,4vw,3.4rem);line-height:1.12;letter-spacing:-.045em;margin-bottom:28px}
.bedtime .eyebrow{color:var(--on-green)}
.button.light{background:var(--cream);color:var(--ink);border-color:var(--cream);min-height:56px;padding:0 32px;font-size:1rem}
.bed-text{border-left:2px solid var(--rose);padding-left:28px;font-size:1.3rem;line-height:1.95}
.bed-text p{margin:0 0 6px}
.practice{background:var(--sage);color:var(--ink)}.practice .eyebrow{color:var(--rose-d)}.practice p{color:var(--muted)}.practice li{border-bottom:1px solid color-mix(in srgb, var(--ink) 18%, transparent)}.practice .button{background:var(--green);color:var(--on-green);border-color:var(--green)}
.about{grid-template-columns:.8fr 1.2fr}.layers{grid-column:1/-1;display:grid;grid-template-columns:repeat(4,1fr);gap:0 24px;margin:16px 0 0;padding-top:24px;border-top:1px solid var(--line)}
.layers dt{font-size:.78rem;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:var(--rose-d);margin-bottom:4px}.layers dd{margin:0;font-size:.92rem;color:var(--muted)}
.library-item{border:0;border-top:1px solid var(--line);border-radius:0;background:transparent;padding:22px 0}











@media(max-width:1100px){.hero{gap:40px}.topic-row{grid-template-columns:48px 1fr auto;padding:26px 28px}.topic-row .s{display:none}.bedtime{gap:40px}}
@media(max-width:700px){
.hero{padding:24px 0 48px;gap:36px}.hero h1{font-size:2.9rem}
.hero .buttons{flex-direction:column}.hero .buttons .button{width:100%}
.hero-art{padding:56px 20px 24px;border-radius:170px 170px 20px 20px}.book{flex-direction:column}.page-l{border-right:0;border-bottom:1px solid var(--line)}.book>div{padding:20px}
.values{padding:20px;border-radius:16px;gap:6px}
.topic-row{grid-template-columns:32px 1fr auto;padding:22px 20px;gap:10px 14px}.topic-row .nm b{font-size:1.3rem}.topic-row .go{font-size:0}.topic-row .go:before{content:'→';font-size:1rem}
.card-title{font-size:1.15rem}.card-type{display:none}
.bedtime{grid-template-columns:1fr;padding:56px 20px;gap:28px;margin:32px calc(50% - 50vw)}.bed-text{font-size:1.1rem;padding-left:18px}
.layers{grid-template-columns:1fr 1fr;gap:16px}


}

@font-face {
  font-family: Lora;
  src: url('assets/fonts/Lora-vietnamese.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: Lora;
  src: url('assets/fonts/Lora-latin.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

[hidden], #more[hidden] { display: none !important; }
html.large { --reader-size: 25px; }
.night .brand img { filter: brightness(0) invert(.91); }
.chip, .text-toggle, .menu-toggle, .search input, select { border-color: var(--control-line); }
.chip, .text-toggle, .menu-toggle { min-height: 44px; min-width: 44px; }
.header-inner :is([data-size], [data-night])[aria-pressed="true"] {
  background: var(--sage);
  color: var(--ink);
  border-color: var(--green);
}
.night select { background-image: none; appearance: auto; }
.skip { color: var(--ink); background: var(--paper); }
:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.button:not(.secondary):not(.light), .chip.active, .practice .button {
  color: var(--on-green);
}
.values, .bedtime { background: var(--green-panel); color: var(--panel-text); }
.values span, .values b, .bedtime .eyebrow { color: var(--panel-text); }
.art-caption { color: var(--muted); }
.article-card { text-decoration: none; overflow-wrap: anywhere; }
.card-title { text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: var(--control-line); }
.topic-row { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; }
.header-inner { min-height: 84px; }
.header-inner .reading-tools { margin-left: auto; }

.reading-page {
  width: min(100% - 40px, 760px);
  padding: 1rem 0 4rem;
  overflow-wrap: anywhere;
}
.breadcrumbs { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }
.breadcrumbs a { display: inline-flex; align-items: center; min-height: 44px; }
.reading-page h1 { font-size: clamp(2rem, 5vw, 3.55rem); margin-bottom: .65em; }
.reading-topic { margin-bottom: .5rem; }
.reading-description { font-size: .9rem; max-width: 62ch; margin-bottom: 1.75rem; }
.reading-frame {
  padding: clamp(15px, 3.5vw, 34px);
  border: 1px solid var(--prayer-border);
  border-radius: 16px;
  background: var(--prayer-frame);
}
.reading-frame > h2, .reading-source h2, .learner-note h2 {
  margin-bottom: .6rem;
  font-size: .95rem;
  font-weight: 700;
  color: var(--rose-d);
  letter-spacing: 0;
}
#article-text {
  max-width: 34em;
  margin-inline: auto;
  font-size: var(--reader-size);
  text-align: left;
  hyphens: none;
  text-wrap: pretty;
}
#article-text h3 { font-size: 1em; }
#article-text .lecture { line-height: 1.75; }
.is-prayer #article-text { font-family: Lora, Georgia, serif; text-align: center; }
.is-prayer #article-text .lecture { line-height: 1.85; white-space: normal; }
.prayer-stanza + .prayer-stanza { margin-top: .8em; }
.prayer-line { display: block; }
.prayer-chant { color: var(--prayer-line); font-weight: 600; line-height: 1.5; }
@media screen and (max-width: 414px) {
  .prayer-chant {
    font-size: clamp(16px, 4.25vw, 20px);
    letter-spacing: -.02em;
    margin-inline: -12px;
    text-wrap: balance;
  }
}
.prayer-chant-group { margin-block: .35em; break-inside: avoid; }
.prayer-name { white-space: nowrap; }
.prayer-note { color: var(--muted); font-size: .85em; font-style: italic; }
.prayer-subheading { color: var(--rose-d); font-size: .86em; font-weight: 600; margin-block: .3em; }
.prayer-subtitle { text-align: center; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: .8em; }
@media (min-width: 761px) {
  .prayer-chant { white-space: nowrap; font-size: .95em; }
  .prayer-chant-group { container-type: inline-size; }
  .prayer-chant { font-size: min(.95em, var(--chant-fit)); }
}
@media print {
  .prayer-chant { white-space: normal; }
}
.uncertain {
  color: var(--uncertain-text);
  font-size: max(16px, .83em);
  position: relative;
  cursor: help;
  text-decoration: underline dotted;
}
.uncertain::after {
  content: attr(data-note);
  display: none;
  position: absolute;
  inset-block-start: 100%;
  inset-inline-start: 0;
  z-index: 1;
  inline-size: max-content;
  max-inline-size: min(16rem, 75vw);
  padding: .4rem .65rem;
  border: 1px solid var(--prayer-border);
  border-radius: .5rem;
  background: var(--blush);
  color: var(--ink);
  font: 16px/1.5 'Be Vietnam Pro', sans-serif;
}
.uncertain:focus::after, .uncertain:hover::after { display: block; }
.reading-notice, .reading-source, .learner-note { color: var(--muted); font-size: .9rem; margin-top: 1.2rem; }
.learner-note { background: var(--sage); padding: 1rem; border-radius: 12px; }
.learner-note p { font-style: italic; margin: 0; }
.reading-tools, .neighbor-links { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.article-actions, .neighbor-links, .reading-related { margin-top: 1.5rem; }
#reading-status { font-size: .85rem; color: var(--muted); }
.neighbor-links a {
  flex: 1 1 220px;
  min-height: 44px;
  padding: .6rem .75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.neighbor-links strong { display: block; }
.copy-field { position: fixed; inset: 0 auto auto 0; opacity: 0; }

@media (max-width: 1100px) {
  .topic-row { grid-template-columns: minmax(0, 1fr) auto; }
}
@media (max-width: 700px) {
  :root { --reader-size: 20px; }
  html.large { --reader-size: 24px; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: clamp(2.3rem, 10vw, 2.9rem); }
  .hero-art { height: auto; }
  .hero-art svg.mini-lotus { min-height: 0; }
  .header-inner { gap: 8px; }
  .header-inner .brand .full-logo { width: clamp(110px, 36vw, 172px); }
  .header-inner > [data-night] { padding-inline: 10px; }
  .header-inner .reading-tools { gap: 4px; }
  .article-card { margin-bottom: 0; }
  .uncertain:focus::after, .uncertain:hover::after {
    position: fixed;
    inset: auto 20px 20px;
    inline-size: auto;
    max-inline-size: none;
  }
}
@media print {
  html, body { color-scheme: light; background: var(--print-paper) !important; color: var(--print-ink) !important; }
  .header, .skip, footer, .breadcrumbs, .reading-tools, .neighbor-links, .reading-related,
  .reading-description, .learner-note, .reading-notice { display: none !important; }
  .reading-page { width: 100%; padding: 0; }
  .reading-page h1 { font-size: 20pt; }
  .reading-frame { padding: 0; border: 0; background: var(--print-paper) !important; }
  #article-text, #article-text .uncertain { font-size: 12.5pt; }
  .reading-page :is(h2, p, span, .prayer-opening, .prayer-chant) { color: var(--print-ink) !important; }
  .uncertain::after { display: none !important; }
  .prayer-line { break-inside: avoid; }
}

.site-menu { position: relative; }
.site-menu summary {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--control-line);
  border-radius: 100px;
  padding-inline: .65rem;
  color: var(--green);
  font-size: .85rem;
  cursor: pointer;
  list-style: none;
}
.site-menu summary::-webkit-details-marker { display: none; }
.site-menu summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.site-menu[open] summary { background: var(--sage); }
.site-menu .site-links {
  position: absolute;
  z-index: 2;
  inset: calc(100% + 6px) 0 auto auto;
  display: grid;
  min-width: 220px;
  padding: .5rem;
  border: 1px solid var(--control-line);
  border-radius: 12px;
  background: var(--paper);
}
.site-links a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: .5rem; }
.site-links a[aria-current="page"] { color: var(--green); font-weight: 700; }
.footer-inner .site-links { display: flex; flex-wrap: wrap; column-gap: .4rem; }
.page-lead { font-size: 1.15rem; max-width: 55ch; }
.editorial-list { display: grid; gap: 1rem; margin-block: 1.5rem; }
.editorial-list > div { padding: .85rem 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.editorial-list dt { font-weight: 700; color: var(--green); }
.editorial-list dd { margin: 0; }
.editorial-library h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.reading-guide { padding-inline-start: 1.5rem; }
.reading-guide li + li { margin-top: .65em; }
.report-link { margin-top: 1rem; }
@media (max-width: 700px) {
  .site-menu { margin-inline-start: auto; }
  .header-inner .brand .full-logo { width: clamp(94px, 32vw, 160px); }
}
@media print {
  .report-link { display: none !important; }
}

.assistant { margin-block: .45rem 1rem; }
.assistant-panel {
  max-width: 760px;
  padding: clamp(1rem, 3vw, 1.7rem);
  margin-block: .65rem;
  background: var(--paper);
  border: 1px solid var(--control-line);
  border-radius: 16px;
  overflow-wrap: anywhere;
}
.assistant-panel h2 { font-size: clamp(1.35rem, 3vw, 1.9rem); margin-bottom: .9rem; }
.assistant-choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.assistant-choices [aria-pressed="true"] { background: var(--green); color: var(--on-green); }
.assistant-search { display: flex; gap: .65rem; align-items: end; flex-wrap: wrap; margin-top: 1rem; }
.assistant-search label { flex-basis: 100%; font-size: .9rem; }
.assistant-search input {
  flex: 1 1 185px;
  min-width: 0;
  min-height: 48px;
  padding: .5rem .75rem;
  color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--control-line);
  border-radius: 12px;
}
#assistant-status { margin: .8rem 0 .25rem; color: var(--muted); }
.assistant-results { list-style: none; padding: 0; margin: .65rem 0 0; }
.assistant-results li { border-top: 1px solid var(--line); padding-block: .85rem; }
.assistant-results h3 { margin: 0; font-weight: 700; font-size: 1.05rem; }
.assistant-results p { margin: .2rem 0 .4rem; font-size: .85rem; }
.assistant-results blockquote { border-left: 2px solid var(--prayer-border); margin: .55rem 0; padding-inline-start: .75rem; }
.assistant-results .button { padding: .35rem .8rem; min-height: 44px; }
.assistant-recent { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.assistant-recent h3 { margin-bottom: .5rem; }
.assistant-recent ul { margin-block: .5rem 1rem; padding-inline-start: 1.4rem; }
@media print { .assistant { display: none !important; } }

.article-author { font-size: .9rem; }

.gift-invitation {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem 1.3rem;
  margin-block: 2rem;
  padding: clamp(1rem, 4vw, 2rem);
  border: 1px solid var(--prayer-border);
  border-radius: 16px;
  background: var(--paper);
}
.gift-invitation > div { flex: 1 1 230px; min-width: 0; }
.gift-invitation h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); margin-bottom: .35rem; }
.gift-invitation p { color: var(--muted); margin: 0; }
.night .gift-invitation img { filter: brightness(0) invert(.91); }

.card-maker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.card-controls, .card-result, .card-messages {
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.25rem);
  border: 1px solid var(--prayer-border);
  border-radius: 16px;
  background: var(--paper);
}
.card-maker h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: .85rem; }
.card-controls label { display: block; margin: .65rem 0 .25rem; font-size: .9rem; font-weight: 700; }
.card-controls select { border-color: var(--control-line); background-color: var(--cream); }
.card-line-controls { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: .65rem; }
.card-excerpt {
  margin: 1rem 0 .4rem;
  padding-inline-start: .75rem;
  border-inline-start: 2px solid var(--prayer-border);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 400 1rem/1.7 Lora, Georgia, serif;
}
#card-source-link { display: inline-flex; align-items: center; min-height: 44px; }
#card-status, .card-feedback { color: var(--muted); font-size: .85rem; margin: .55rem 0 0; }
#card-status:empty, .card-feedback:empty { display: none; }
#card-canvas { display: block; width: 100%; height: auto; border-radius: 8px; }
.card-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .85rem; }
.card-messages { grid-column: 1 / -1; }
.card-message { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; border-top: 1px solid var(--line); padding-block: .8rem; }
.card-message div { flex: 1 1 225px; min-width: 0; }
.card-message h3 { font-size: .95rem; font-weight: 700; margin: 0 0 .2rem; }
.card-message p { font-size: .9rem; margin: 0; }
@media (max-width: 700px) { .card-maker { grid-template-columns: minmax(0, 1fr); } }


.ebook-intro { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; align-items: center; }
.ebook-intro img { width: 100%; height: auto; border-radius: 14px; }
.ebook-excerpt { margin: 0 0 1.5rem; padding: 1rem; border: 1px solid var(--prayer-border); border-radius: 12px; background: var(--prayer-frame); white-space: pre-wrap; font: 400 1.1rem/1.85 Lora, Georgia, serif; }
@media (max-width: 700px) { .ebook-intro { grid-template-columns: minmax(0, 1fr); } }

.occasion-entry { margin-block: 1rem 0; }
.occasion-nav { display: flex; flex-wrap: wrap; gap: .4rem .7rem; margin-bottom: 1.5rem; }
.occasion-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: .35rem .7rem; border: 1px solid var(--control-line); border-radius: 999px; color: var(--green); }
.occasion-section { margin-block: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.occasion-section h2 { margin-bottom: .4rem; font-size: 1.3rem; }
.occasion-section ul { list-style: none; margin: 0; padding: 0; }
.occasion-section li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .75rem; border-top: 1px solid var(--line); padding: .45rem 0; }
.occasion-section li span { font-size: .85rem; }

#assistant-lunar-suggestions:not(:empty) { margin-bottom: .7rem; }



.auth-controls { flex: 0 1 auto; min-width: 0; }
.google-mark { color: var(--green); font-weight: 700; margin-right: .2em; }
.account-menu summary { display: flex; align-items: center; gap: .4em; max-width: min(220px, 65vw); }
.account-menu summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu summary img { border-radius: 50%; flex: none; }
.account-menu .site-links { z-index: 4; }
.member-panel { padding: clamp(.85rem, 3vw, 1.5rem); margin-block: .9rem; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); overflow-wrap: anywhere; }
.member-panel h2, .member-panel h3 { margin-top: 0; }
.member-panel h2 { font-size: 1.22em; }
.member-panel h3 { font-size: 1.05em; }
.member-panel label { display: block; font-weight: 600; }
.member-panel :is(input,textarea) { width: 100%; box-sizing: border-box; min-height: 44px; border: 1px solid var(--control-line); border-radius: 8px; padding: .45em .55em; margin-bottom: .6em; color: var(--ink); background: var(--paper); font: inherit; }
.member-document { border-top: 1px solid var(--line); padding: .85em 0; }
.member-document p { margin: .2em 0; }
.member-panel .chip, .member-tabs .chip { margin: .25rem .25rem .15rem 0; }
.member-tabs [aria-pressed="true"] { background: var(--green); color: var(--on-green); }
.member-list { padding-inline-start: 1.25rem; }
.member-list .chip { margin-inline-start: .5em; }
.member-media { display: block; width: 100%; max-width: 100%; margin-top: .65em; }
iframe.member-media { height: min(75vh, 52rem); border: 1px solid var(--line); }
.member-panel:fullscreen { overflow: auto; padding: 1rem; }
.member-status:empty { display: none; }
@media (max-width: 480px) { .auth-controls { margin-inline-start: auto; } }
.assistant-dates { margin: .5em 0; }
.assistant-dates summary { cursor: pointer; min-height: 44px; width: fit-content; display: list-item; padding: .45em 0; color: var(--green); }
#assistant-documents { margin: .75em 0; border-top: 1px solid var(--line); padding-top: .65em; }

/* Tủ Kinh Sách */
.book-intro .page-lead { max-width: 54ch; }
.book-steps { list-style: none; counter-reset: book-step; padding: 0; display: grid; gap: .65rem; }
.book-steps li { counter-increment: book-step; padding: .75rem 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; margin-inline-start: calc(var(--step) * clamp(2px, 1vw, 15px)); }
.book-steps strong::before { content: counter(book-step) " · "; color: var(--rose-d); }
.book-steps p { margin: .25rem 0; }
.book-controls { margin-bottom: 1.5rem; }
.book-controls h2, .book-row h2 { font-size: 1.15rem; }
.book-controls input, .book-admin-pick select, .book-task select, .book-detail :is(input:not([type=checkbox]),textarea,select) { display: block; min-height: 44px; width: 100%; margin: .3em 0 .8em; border: 1px solid var(--control-line); border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; padding: .35rem .6rem; }
.book-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.book-chips [aria-pressed=true] { background: var(--green); color: var(--on-green); }
.book-row { padding: .85rem 0; border-block-start: 1px solid var(--line); }
.book-stairs { margin-block: 1rem; }
.book-stairs .book-row { margin-inline-start: calc(var(--step) * clamp(1px, .5vw, 8px)); }
.book-start { font-size: .9em; font-weight: 700; color: var(--rose-d); }
.book-rail { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(145px, 44vw, 175px); gap: .65rem; overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: x proximity; padding: .15rem .15rem .55rem; }
.book-card { min-width: 0; scroll-snap-align: start; overflow-wrap: anywhere; }
.book-card p { margin: .22rem 0; font-size: .84em; }
.book-card progress, .quota-panel progress, .book-task progress { width: 100%; accent-color: var(--rose-d); }
.book-open { display: block; width: 100%; padding: 0; text-align: start; color: var(--ink); border: 0; background: transparent; text-decoration: none; font: inherit; }
.book-title { display: block; margin-top: .35rem; font-weight: 700; }
.book-cover { position: relative; isolation: isolate; aspect-ratio: 3 / 4; display: grid; place-content: center; gap: .6rem; text-align: center; overflow: hidden; border-radius: 5px 12px 12px 5px; border: 1px solid var(--control-line); border-inline-start-width: 6px; padding: .6rem; background: var(--blush); color: var(--ink); }
.book-cover[data-shelf=can-ban], .book-cover[data-shelf=thien] { background: var(--sage); color: var(--ink); }
.book-cover[data-shelf=kinh-dien], .book-cover[data-shelf=mat-tong] { background: var(--sand); color: var(--ink); }
.book-cover[data-shelf=tinh-do], .book-cover[data-shelf=sinh-tu-ho-niem] { background: var(--sand); color: var(--ink); }
.book-cover strong { font: 700 .98rem/1.42 Lora, Georgia, serif; }
.book-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; background: var(--paper); }
.book-cover img:not([src]) { visibility: hidden; }
.book-lotus { display: block; position: relative; margin: 0 auto; width: 25px; height: 27px; }
.book-lotus::before,.book-lotus::after { content: ''; position: absolute; inset: 3px 5px 0; border: 1px solid currentColor; border-radius: 10px 10px 4px 10px; transform: rotate(-35deg); }
.book-lotus::after { transform: rotate(35deg); border-radius: 10px 10px 10px 4px; }
.book-detail { margin: 0 0 0 auto; inset: 0 0 0 auto; width: min(100%, 465px); max-width: 100%; height: 100%; max-height: 100%; padding: clamp(1rem,4vw,2rem); color: var(--ink); background: var(--paper); border: 1px solid var(--line); overflow-wrap: anywhere; }
.book-detail[open] { animation: detail-enter .2s ease-out; }
@keyframes detail-enter { from { transform: translateX(100%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .book-detail[open] { animation: none; } }
.book-detail::backdrop, .reader-outline::backdrop { background: color-mix(in srgb, var(--shadow-ink) 66%, transparent); }
.book-detail .book-cover { width: 145px; margin: .8rem 0; }
.book-detail :is(.chip,.button) { margin: .25rem .25rem .15rem 0; }
.book-detail label, .book-admin-pick label, .book-task label { display: block; margin-top: .5rem; }
.book-switch { margin-block: .5em; }
.book-switch input, .book-admin-row input[type=checkbox], .book-detail input[type=checkbox], .member-panel input[type=checkbox] { width: auto; min-height: 0; margin: 0 .35em 0 0; accent-color: var(--green); }
.book-admin-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; border-bottom: 1px solid var(--line); padding-block: .4rem; }
.book-admin-row > :first-child { flex: 1; }
.book-admin-row p, .book-task p { margin: .25em 0; }
.book-task { padding: .7rem 0; border-top: 1px solid var(--line); }
.quota-warning { padding: .6rem; color: var(--soft-ink); background: var(--sand); border-radius: 8px; font-weight: 700; }

/* Bìa sách Đợt 10 */
.book-rail { grid-auto-columns: clamp(120px, 36vw, 173px); }
.book-cover.cover-v2 { display: block; aspect-ratio: 2 / 3; padding: 0; border: 0; border-radius: 4px 8px 8px 4px; box-shadow: 1px 3px 8px color-mix(in srgb, var(--shadow-ink) 21%, transparent); }
.cover-v2 .cover-paper { display: grid; place-items: center; position: absolute; inset: 0; padding: .6rem; overflow: hidden; font: 600 1rem/1.35 Lora, Georgia, serif; }
.cover-v2 .cover-paper:has(svg) { padding: 0; }
.cover-v2 svg { width: 100%; height: 100%; display: block; }
.book-detail .cover-v2 { width: min(255px, 85%); margin: .8rem auto 1rem; }
.book-cover-comparison { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; }
.book-cover-comparison figure { margin: 0; text-align: center; min-width: 0; }
.book-cover-comparison .cover-v2 { width: 100%; margin: 0; }
.book-cover-comparison figcaption { margin: .35rem 0; font-size: .9em; }
.cover-placeholder { display: grid; place-items: center; aspect-ratio: 2/3; border: 1px dashed var(--control-line); padding: .5rem; border-radius: 8px; }
.book-admin-row { flex-wrap: wrap; }
.book-admin-row .book-cover-select { width: auto; min-height: 44px; max-width: 100%; padding: .35rem 1.5rem .35rem .55rem; }



/* Tủ Kinh Sách và trình đọc PDF */
.book-guide { margin-bottom: 1rem; padding: .5rem .85rem; border: 1px solid var(--control-line); border-radius: 12px; }
.book-guide summary { cursor: pointer; padding: .35rem 0; font-weight: 700; }
.book-card { position: relative; }
.book-info { position: absolute; z-index: 1; inset: 6px 6px auto auto; width: 44px; min-height: 44px; border: 1px solid var(--control-line); border-radius: 50%; color: var(--ink); background: var(--paper); font: italic 700 1rem Georgia, serif; }
.book-open { -webkit-touch-callout: none; user-select: none; }
::view-transition-group(aht-reader-cover) { animation-duration: 340ms; }
[data-member-page="tu-kinh-sach/doc"] { view-transition-name: aht-reader-cover; }
body.book-reading { overflow: hidden; }
.book-reading > :is(.header, .skip, footer, #tro-ly), .book-reading main > :not([data-member-page]) { display: none; }
.book-reading main { width: 100%; margin: 0; padding: 0; }
.book-reading [data-member-page] { position: fixed; inset: 0; }

.reader-workspace {
  --book-bg: var(--read-day); --book-fg: var(--read-ink); --book-line: var(--read-line); --book-page: var(--print-paper);
  --top-safe: env(safe-area-inset-top, 0px); --bottom-safe: env(safe-area-inset-bottom, 0px);
  --left-safe: env(safe-area-inset-left, 0px); --right-safe: env(safe-area-inset-right, 0px);
  position: relative; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; color: var(--book-fg); background: var(--book-bg);
}
.reader-workspace[data-reader-theme=sepia] { --book-bg: var(--read-sepia); --book-fg: var(--read-ink); --book-line: var(--read-line); --book-page: var(--read-sepia-paper); }
.reader-workspace[data-reader-theme=night] { --book-bg: var(--read-night); --book-fg: var(--read-night-ink); --book-line: var(--read-night-line); --book-page: var(--read-night-page); color-scheme: dark; }
.reader-workspace :is(.chip, .button, input, select, textarea) { color: var(--book-fg); background: var(--book-bg); border: 1px solid var(--book-line); min-height: 44px; }
.reader-workspace :is(input, select, textarea) { max-width: 100%; }
.reader-workspace input[type=range] { border: 0; accent-color: var(--book-line); }
.reader-workspace input[type=checkbox] { min-height: 0; inline-size: 1.15rem; block-size: 1.15rem; margin: 0; accent-color: var(--book-line); }
.reader-loading { display: grid; place-content: center; gap: .6rem; text-align: center; }
.reader-viewport { position: absolute; inset: var(--top-safe) var(--right-safe) var(--bottom-safe) var(--left-safe); overflow: auto; overflow-anchor: none; overscroll-behavior: contain; touch-action: pan-x pan-y; }
.reader-viewport:focus { outline: none; }
.reader-viewport:focus-visible { box-shadow: inset 0 0 0 2px var(--book-line); }
.reader-pages { position: relative; width: max-content; margin: auto; min-width: 100%; min-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.reader-tail { flex: none; }
.reader-workspace[data-layout=flip] .reader-tail { display: none; }
.reader-sheet { flex: none; position: relative; background: var(--book-page); overflow: hidden; box-shadow: 0 1px 4px color-mix(in srgb, var(--shadow-ink) 27%, transparent); }
.reader-sheet canvas { display: block; width: 100%; height: 100%; }
.reader-workspace[data-layout=flip] .reader-pages { flex-direction: row; align-items: safe center; justify-content: center; gap: 2px; }
.reader-workspace[data-layout=flip][data-zoomed=false] .reader-viewport { touch-action: none; }
.reader-workspace[data-drawing=true] .reader-viewport { touch-action: none; cursor: crosshair; }
.reader-workspace[data-drawing=true] .reader-text { pointer-events: none; }
.reader-workspace[data-reader-theme=sepia] canvas { filter: sepia(.25) contrast(.94); }
.reader-workspace[data-reader-theme=night] canvas { filter: invert(.9) hue-rotate(180deg); }
.reader-workspace[data-reader-theme=night] canvas[data-book-photo=true] { filter: brightness(.85); }
.reader-shade { position: absolute; inset: 0; pointer-events: none; background: color-mix(in srgb, var(--print-ink) calc(var(--dim, 0) * 100%), transparent); }
.reader-shade.reader-warm::after { content: ''; position: absolute; inset: 0; background: color-mix(in srgb, var(--canvas-cream) 15%, transparent); }

.reader-bar, .reader-bottom {
  position: absolute; z-index: 2; inset-inline: 0; background: var(--book-bg);
  background: color-mix(in srgb, var(--book-bg) 93%, transparent); backdrop-filter: blur(14px);
  padding-inline: max(.5rem, var(--left-safe)) max(.5rem, var(--right-safe));
  transition: opacity 170ms, visibility 170ms;
}
.reader-bar { top: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .55rem; padding-block: max(.3rem, var(--top-safe)) .3rem; box-shadow: 0 2px 12px color-mix(in srgb, var(--shadow-ink) 13%, transparent); }
.reader-bottom { bottom: 0; padding-bottom: max(.35rem, var(--bottom-safe)); text-align: center; box-shadow: 0 -2px 12px color-mix(in srgb, var(--shadow-ink) 13%, transparent); }
.reader-workspace[data-tools=false] :is(.reader-bar, .reader-bottom) { opacity: 0; visibility: hidden; pointer-events: none; }
.reader-back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; font-size: .82rem; white-space: nowrap; text-decoration: none; }
.reader-title { flex: 1 1 125px; min-width: 0; font: 600 .95rem Lora, Georgia, serif; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-commands, .reader-options { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.reader-commands .chip { padding-inline: .65rem; }
.reader-ribbon[aria-pressed=true] svg path { fill: var(--rose-d); stroke: var(--rose-d); }
.reader-workspace[data-reader-theme=night] .reader-ribbon[aria-pressed=true] svg path { stroke: var(--rose); }
.reader-bottom input { display: block; width: 100%; margin: 0; }
.reader-position { margin: -.48rem 0 .05rem; font-size: .78rem; }
.reader-preview { position: absolute; bottom: 100%; left: clamp(62px, var(--preview-x, 50%), calc(100% - 62px)); transform: translateX(-50%); border: 1px solid var(--book-line); border-radius: 9px; background: var(--book-bg); padding: .35rem; min-width: 104px; box-shadow: 0 3px 12px color-mix(in srgb, var(--shadow-ink) 27%, transparent); }
.reader-preview canvas { display: block; max-height: 122px; max-width: 104px; margin: 0 auto; }
.reader-status { position: absolute; z-index: 3; top: max(7.5rem, calc(var(--top-safe) + 6.2rem)); left: 50%; transform: translateX(-50%); max-width: calc(100% - 24px); width: max-content; border: 1px solid var(--book-line); border-radius: 35px; padding: .25rem .85rem; background: var(--book-bg); color: var(--book-fg); font-size: .84rem; pointer-events: none; }
.reader-loading .reader-status { position: static; transform: none; margin: 0 auto; }
.reader-status:empty { display: none; }
.reader-reopen { position: absolute; top: -200px; z-index: 3; }
.reader-reopen:focus { top: max(8px, var(--top-safe)); left: max(8px, var(--left-safe)); }

.reader-outline { color: var(--book-fg); background: var(--book-bg); border: 1px solid var(--book-line); width: min(92vw, 545px); max-height: 82dvh; padding: 1.15rem; border-radius: 18px; overflow: auto; }
.reader-outline::backdrop { background: color-mix(in srgb, var(--shadow-ink) 54%, transparent); }
.reader-outline h2 { font: 600 1.38rem/1.4 Lora, Georgia, serif; margin: .3rem 4.5rem 1.35rem 0; }
.reader-close { position: absolute; top: .7rem; right: .7rem; }
.reader-outline :is(label, form) { display: grid; gap: .2rem; margin-bottom: .55rem; }
.reader-outline label:has([type=checkbox]) { display: flex; flex-direction: row-reverse; align-items: center; justify-content: flex-end; gap: .65rem; min-height: 44px; }
.reader-outline :is(select, textarea, input:not([type=checkbox],[type=range])) { padding: .35rem .55rem; border-radius: 8px; width: 100%; }
.reader-outline select { appearance: auto; background-image: none; }
.reader-outline textarea { font: inherit; }
.reader-outline .reader-options { margin-bottom: .8rem; }
.reader-outline [aria-selected=true] { text-decoration: underline; font-weight: 700; }
.reader-outline-list { padding-inline-start: 1.25rem; }
.reader-outline-list button, .reader-note-row button, #reader-search ~ div button { text-align: start; white-space: normal; max-width: 100%; overflow-wrap: anywhere; }
.reader-note-row { display: flex; align-items: center; gap: .3rem; margin-bottom: .4rem; }

.reader-text { position: absolute; inset: 0; text-align: initial; overflow: clip; opacity: 1; line-height: 1; text-size-adjust: none; -webkit-text-size-adjust: none; transform-origin: 0 0; }
.reader-text :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0 0; }
.reader-text ::selection { background: color-mix(in srgb, var(--mark-moss) 40%, transparent); }
.reader-marks { position: absolute; inset: 0; pointer-events: none; }
.reader-marks span { position: absolute; border-radius: 2px; background: var(--mark-color); opacity: .43; }
.reader-marks span[data-color=find] { background: var(--mark-gold); opacity: .52; }
.reader-marks span[data-color=draft] { background: color-mix(in srgb, var(--mark-moss) 33%, transparent); outline: 2px dashed var(--green-deep); opacity: .8; }
[data-color=vang] { --mark-color: var(--mark-gold); }
[data-color=hong] { --mark-color: var(--mark-lotus); }
[data-color=xanh] { --mark-color: var(--mark-moss); }
[data-color=tim] { --mark-color: var(--mark-plum); }
.reader-palette { position: absolute; z-index: 4; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; width: max-content; max-width: calc(100% - 10px); transform: translateX(-50%); gap: .1rem; padding: .2rem; border-radius: 14px; border: 1px solid var(--book-line); background: var(--book-bg); box-shadow: 0 4px 14px color-mix(in srgb, var(--shadow-ink) 27%, transparent); }
.reader-palette[hidden] { display: none; }
.reader-palette .chip { padding-inline: .4rem; font-size: .76rem; }
.reader-color { width: 40px; height: 44px; border: 0; background: none; font-size: 0; display: grid; place-items: center; }
.reader-color::after { content: ''; display: block; width: 22px; height: 22px; border: 1px solid var(--control-line); background: var(--mark-color); border-radius: 100%; }
@media (prefers-reduced-motion: no-preference) {
  .reader-workspace:not(.reader-loading) { animation: reader-reveal 230ms ease-out; }
  @keyframes reader-reveal { from { opacity: .4; transform: scale(.98); } to { opacity: 1; transform: scale(1); } }
}
@media (prefers-reduced-motion: reduce) { .reader-bar, .reader-bottom { transition: none; } }
.reader-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: .45rem; margin-top: .65rem; }
.reader-thumbs .chip { border-radius: 7px; min-height: 118px; padding: .25rem; }
.reader-thumbs canvas { display: block; margin: auto; max-width: 100%; max-height: 86px; }

/* Lưới thư viện */
.home-shelf { margin-block: 0 2rem; padding: clamp(1rem, 3vw, 2rem); border-radius: 22px; background: var(--panel, var(--paper)); border: 1px solid var(--line); }
.home-shelf-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1.2rem; }
.home-shelf-head h2 { margin-bottom: .35rem; }
.home-shelf-head p { margin: 0; }
.home-shelf-covers { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(.6rem, 2vw, 1.5rem); }
.home-shelf-covers a { border-radius: 4px 8px 8px 4px; overflow: hidden; box-shadow: 1px 4px 8px color-mix(in srgb, var(--shadow-ink) 25%, transparent); }
.home-shelf-covers svg { width: 100%; height: auto; aspect-ratio: 2 / 3; }
.shelf-resume { display: flex; align-items: center; gap: .55rem; overflow-x: auto; white-space: nowrap; margin-bottom: .6rem; padding: .25rem .15rem; }
.shelf-resume[hidden] { display: none; }
.shelf-resume a { text-decoration: none; flex: none; }
.shelf-tools { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(10rem, .37fr); align-items: center; gap: .4rem .65rem; margin-block: .8rem 1rem; padding: .65rem; border: 1px solid var(--control-line); border-radius: 13px; background: var(--cream); }
.shelf-tools label { grid-column: 1 / -1; font-weight: 600; }
.shelf-tools input, .shelf-tools select, .shelf-filter-dialog input { min-height: 44px; width: 100%; min-width: 0; padding: .55rem; border: 1px solid var(--control-line); border-radius: 8px; background-color: var(--paper); color: var(--ink); }
.shelf-tools select { appearance: auto; background-image: none; }
.shelf-filter-status { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem; min-height: 30px; }
.shelf-filter-status button { min-height: 44px; }
.shelf-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(.7rem, 2vw, 1.4rem); align-items: start; }
.shelf-grid .book-card { padding: 2px 2px .7rem; content-visibility: auto; contain-intrinsic-block-size: auto 285px; }
.shelf-grid .book-title { display: block; margin-top: .45rem; font-size: .95rem; line-height: 1.35; }
.shelf-grid .book-card p { line-height: 1.45; }
.shelf-grid .book-open { position: relative; }
.shelf-grid .book-info { width: 44px; height: 44px; }
.shelf-hover-facts { display: none; }
@media (hover: hover) and (pointer: fine) {
  .shelf-hover-facts { position: absolute; inset: 100% .2rem auto; z-index: 2; padding: .5rem; border-radius: 7px; font-size: .77rem; background: var(--paper); color: var(--ink); pointer-events: none; }
  .book-open:is(:hover, :focus-visible) .shelf-hover-facts { display: block; }
}
.shelf-desktop-subjects { display: none; }
@media (hover: hover) and (pointer: fine) and (min-width: 1120px) {
  .shelf-desktop-subjects { grid-column: 1 / -1; display: flex; gap: .3rem; overflow-x: auto; padding: .18rem .25rem .35rem; }
  .shelf-desktop-subjects .chip { flex: none; padding-inline: .62rem; min-height: 44px; }
  .shelf-desktop-subjects .chip[aria-pressed=true] { background: var(--green); color: var(--on-green); border-color: var(--green); }
}
.shelf-sentinel { min-height: 1px; }

.shelf-filter-dialog { background: var(--paper); color: var(--ink); border: 1px solid var(--control-line); border-radius: 18px; width: min(92vw, 650px); max-height: 85dvh; overflow: auto; padding: 0; }
.shelf-filter-dialog header, .shelf-filter-dialog footer { position: sticky; z-index: 1; background: var(--paper); padding: .7rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.shelf-filter-dialog header { top: 0; border-bottom: 1px solid var(--line); }
.shelf-filter-dialog footer { bottom: 0; border-top: 1px solid var(--line); }
.shelf-filter-dialog h2 { margin: 0; font-size: 1.55rem; }
.shelf-filter-dialog::backdrop, .shelf-reader::backdrop { background: color-mix(in srgb, var(--shadow-ink) 72%, transparent); backdrop-filter: blur(3px); }
.shelf-facets { padding: .6rem 1rem; }
.shelf-facets fieldset { margin: 0 0 .85rem; padding: .55rem; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.shelf-facets legend { font-weight: 600; }
.shelf-facets summary { padding: .5rem 0; cursor: pointer; }
.shelf-facet-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.shelf-facet-chips .chip { min-height: 44px; }
.shelf-facet-chips [aria-pressed=true] { background: var(--green); color: var(--on-green); border-color: var(--green); }
.shelf-filter-dialog input { margin-bottom: .5rem; }
.shelf-reader { position: fixed; width: min(1050px, 94vw); height: min(90dvh, 940px); padding: 0; overflow: hidden; border: 0; border-radius: 16px; background: var(--read-day); }
.shelf-reader iframe { display: block; width: 100%; height: 100%; border: 0; }
.shelf-reader-close { position: absolute; z-index: 2; top: .45rem; right: .8rem; display: grid; place-items: center; width: 44px; height: 44px; background: var(--paper); color: var(--ink); border: 1px solid var(--control-line); border-radius: 50%; font-size: 1.35rem; }
body:has(.shelf-reader[open], .shelf-filter-dialog[open]) { overflow: hidden; }
body.book-reader-embedded .reader-bar { padding-right: 65px; }

@media (min-width: 1440px) {
  .shelf-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}
@media (min-width: 1800px) {
  .shelf-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (min-width: 720px) and (max-width: 1179px) and (orientation: portrait) {
  .shelf-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 720px) and (max-width: 1100px) and (orientation: landscape) {
  .shelf-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 719px) {
  .shelf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-shelf-covers { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(90px, 31%); overflow-x: auto; padding: 2px 2px .6rem; scroll-snap-type: x proximity; }
  .home-shelf-covers a { scroll-snap-align: start; }
  .shelf-filter-dialog { inset: auto 0 0; width: 100%; max-width: none; max-height: 88dvh; margin: 0; border-radius: 18px 18px 0 0; }
  .shelf-filter-dialog footer { padding-bottom: max(.7rem, env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) {
  .shelf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shelf-tools { grid-template-columns: minmax(0, 1fr) auto; }
  .shelf-tools select { grid-column: 1 / -1; }
}
@media (max-width: 719px) and (prefers-reduced-motion: no-preference) {
  .shelf-filter-dialog[open] { animation: shelf-slide-up 210ms ease-out; }
  @keyframes shelf-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
}

/* Đợt 12b · Lưới Tủ Kinh Sách rộng hơn trên máy tính, nút gọn */
.reading-page:has(.shelf-grid) { width: min(100% - 40px, 1320px); }
.shelf-grid .book-card [data-save-book] { min-width: 38px; min-height: 38px; padding: 0; font-size: 1.05rem; line-height: 1; margin-top: .2rem; }
.shelf-grid .book-card p { font-size: .82rem; color: var(--muted); }
.shelf-grid .book-info { width: 34px; height: 34px; min-height: 34px; inset: 6px 6px auto auto; font-size: .9rem; opacity: .82; background: color-mix(in srgb, var(--paper) 85%, transparent); }
.shelf-grid .book-info:is(:hover, :focus-visible) { opacity: 1; }
.shelf-grid .book-card { scroll-margin-top: 9rem; }
@media (hover: hover) and (pointer: fine) {
  .shelf-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
  .shelf-grid .book-info { width: 28px; height: 28px; min-height: 28px; font-size: .8rem; }
  .shelf-desktop-subjects { flex-wrap: wrap; overflow-x: visible; }
}
@media (hover: hover) and (pointer: fine) and (min-width: 700px) {
  .shelf-tools { grid-template-columns: minmax(0, 1fr) auto minmax(13rem, auto); }
}
@media (min-width: 700px) and (max-width: 1119px) {
  .shelf-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* Bìa sách dùng chung giữa tủ, chi tiết và trình đọc. */
.shelf-resume a { display: inline-flex; align-items: center; gap: .45rem; }
.shelf-resume .cover-v2 { width: 30px; flex: none; }
.book-admin-row > .cover-v2 { width: 44px; flex: 0 0 44px; }
.book-admin-row > :is(label,p) { flex: 1 1 12rem; }
.book-detail:has(.shelf-detail-layout) { width: min(100%, 700px); }
.shelf-detail-layout { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(1rem, 3vw, 2rem); align-items: start; margin-top: 1rem; }
.shelf-detail-layout .cover-v2 { width: min(100%, 260px); margin: 0 auto; }
.shelf-detail-layout h2 { margin-bottom: .6rem; }
@media (max-width: 600px) {
  .shelf-detail-layout { grid-template-columns: 1fr; }
  .shelf-detail-layout .cover-v2 { width: min(64%, 225px); }
}
.reader-workspace[data-cover-spread=true] .reader-pages { justify-content: flex-end; }
.reader-cover-sheet { container-type: size; background: transparent; box-shadow: none; }
.reader-cover-open { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .7rem; background: transparent; border: 0; color: var(--book-fg); padding: .45rem .7rem; touch-action: pan-y; }
.reader-cover-open:focus-visible { outline-offset: -5px; }
.reader-cover-open .cover-v2 { width: var(--cover-size); flex: none; pointer-events: none; }
.reader-cover-meta { display: grid; justify-items: center; gap: .12rem; font-size: .76rem; line-height: 1.42; }
.reader-cover-meta strong { font: 600 clamp(.95rem, 3.3cqw, 1.25rem)/1.25 Lora, Georgia, serif; }
.reader-cover-meta span { overflow-wrap: anywhere; max-width: 100%; }
.reader-preview > .cover-v2 { width: 73px; margin: 0 auto; }
.reader-cover-index { display: flex; align-items: center; gap: .7rem; margin-bottom: .6rem; }
.reader-cover-index .cover-v2 { width: 46px; }
.home-shelf-covers .cover-v2 { width: 100%; }

.shelf-pencil { position:absolute; z-index:2; inset:6px 52px auto auto; display:grid; place-items:center; width:44px; height:44px; border:1px solid var(--control-line); border-radius:50%; background:var(--paper); color:var(--ink); }
.book-card[data-book-status=hidden] .cover-v2 { opacity:.64; }
.shelf-hidden-label { display:inline-block; padding:.12rem .45rem; border-radius:6px; font-size:.78rem; background:var(--sage); color:var(--ink); }
.shelf-editor { grid-column:1 / -1; border-top:1px solid var(--line); padding-top:.75rem; scroll-margin-top:.7rem; }
.shelf-editor > summary { font-weight:700; cursor:pointer; padding:.4rem 0; }
.shelf-edit-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.2rem .8rem; }
.shelf-edit-fields > label:nth-child(3) { grid-column:1 / -1; }
.shelf-edit-covers { margin:1rem 0; min-width:0; padding:.6rem; border:1px solid var(--control-line); border-radius:10px; }
.shelf-edit-covers > div { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.6rem; }
.shelf-edit-covers label { margin:0; padding:.4rem; cursor:pointer; border:2px solid var(--line); border-radius:10px; }
.shelf-edit-covers label:has(:checked) { border-color:var(--green); }
.shelf-edit-covers input[type=radio] { display:inline-block; width:auto; min-height:0; margin:0 .25rem; accent-color:var(--green); }
.shelf-edit-covers .cover-v2, .shelf-edit-covers .cover-placeholder { width:min(100%,145px); margin:.45rem auto 0; }
.shelf-bulk { margin:0 0 1rem; padding:.7rem; border:1px solid var(--control-line); border-radius:12px; background:var(--paper); }
.shelf-bulk form:not([hidden]) { display:flex; flex-wrap:wrap; gap:.6rem; align-items:end; margin-top:.6rem; }
.shelf-bulk form label { display:grid; gap:.15rem; }
.shelf-bulk form select { min-height:44px; padding:.45rem; }
.shelf-bulk p { margin:.35rem 0 0; }
.shelf-bulk p:empty { display:none; }
.shelf-select-book { position:absolute; z-index:3; inset:6px auto auto 6px; width:28px; height:28px; accent-color:var(--green); }
.book-detail:has(.shelf-editor) > .chip:first-child { position:sticky; top:0; z-index:4; background:var(--paper); }

/* Đọc trực tuyến: lớp chữ vẫn hỗ trợ bôi chọn để tô màu và ghi chú. */
:is(.book-cover, .home-shelf-covers, .reader-workspace) { -webkit-touch-callout: none; }
:is(.book-cover, .home-shelf-covers, .reader-viewport) { -webkit-user-select: none; user-select: none; }
.reader-text, .reader-text span { -webkit-user-select: text; user-select: text; }
.reader-watermark {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-around;
  align-items: center; overflow: hidden; pointer-events: none; user-select: none; z-index: 1;
}
.reader-watermark span {
  transform: rotate(-26deg); white-space: nowrap; font: 600 clamp(.7rem, 1.8vw, 1.05rem)/1.2 'Be Vietnam Pro', sans-serif;
  color: var(--shadow-ink); opacity: .14; text-shadow: 0 1px 2px var(--on-green);
}
.reader-workspace[data-reader-theme=night] .reader-watermark span { color: var(--read-night-ink); opacity: .19; text-shadow: 0 1px 2px var(--shadow-ink); }
body.reader-obscured :is(.reader-viewport, .reader-outline, .reader-palette, .reader-preview) {
  filter: blur(22px); pointer-events: none;
}
.book-print-notice { display: none; }
@media print {
  body:is([data-book-reader], [data-book-shelf]) > :not(.book-print-notice),
  body .home-shelf, body .book-cover, body .reader-workspace { display: none !important; }
  body:is([data-book-reader], [data-book-shelf]) { overflow: visible !important; }
  body:is([data-book-reader], [data-book-shelf]) > .book-print-notice {
    display: block !important; margin: 0; color: var(--print-ink); font: 12pt/1.5 sans-serif;
  }
}

/* Khung lời khấn: viền nhũ đồng, góc sen và ấn triện. */
.reading-frame.is-prayer {
  --seal-paper: #FBF8F1;
  --seal-metal-light: #D8C08A;
  --seal-metal-pale: #E3D2A6;
  --seal-metal-deep: #A88B57;
  --seal-heading: #8A7347;
  padding: 1px;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(150deg, var(--seal-metal-light), var(--bronze), var(--seal-metal-pale), var(--seal-metal-deep));
  box-shadow: 0 28px 60px -38px rgba(90, 66, 28, .55);
}
html.night .reading-frame.is-prayer {
  --seal-paper: #2E2620;
  --seal-metal-light: #9F8656;
  --seal-metal-pale: #AA9163;
  --seal-metal-deep: #867143;
  --seal-heading: var(--soft-ink);
}
.prayer-paper {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  border-radius: 21px;
  background: var(--seal-paper);
}
.prayer-paper::before {
  content: '';
  position: absolute;
  inset: 13px;
  border: 1px solid color-mix(in srgb, var(--bronze) 55%, transparent);
  border-radius: 14px;
  pointer-events: none;
  z-index: 1;
}
.prayer-corners { position: absolute; inset: 24px; color: var(--seal-metal-deep); z-index: 2; pointer-events: none; }
.prayer-corners svg {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--seal-paper);
  transform: translate(-50%, -50%);
}
.prayer-corners svg:nth-child(1) { top: 0; left: 0; }
.prayer-corners svg:nth-child(2) { top: 0; left: 100%; }
.prayer-corners svg:nth-child(3) { top: 100%; left: 0; transform: translate(-50%, -50%); }
.prayer-corners svg:nth-child(4) { top: 100%; left: 100%; transform: translate(-50%, -50%); }
.prayer-rail {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin-block: 30px;
  padding: 12px 0 0 9px;
  border-inline-end: 1px solid color-mix(in srgb, var(--bronze) 45%, transparent);
  background: color-mix(in srgb, var(--bronze) 5%, transparent);
}
.prayer-seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1.5px solid currentColor;
  border-radius: 7px;
  color: var(--rose);
  font: 600 13px/1.1 Lora, Georgia, serif;
}
.prayer-content { min-width: 0; padding: 42px clamp(26px, 4vw, 48px) 32px; }
.prayer-content > h2 {
  margin: 0 0 1.35rem;
  text-align: center;
  letter-spacing: .24em;
  color: var(--seal-heading);
  font: 500 14px/1.5 Lora, Georgia, serif;
}
.prayer-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  color: var(--bronze);
  margin: .9em auto;
}
.prayer-divider::before, .prayer-divider::after {
  content: '';
  flex: 0 1 110px;
  height: 1px;
  background: currentColor;
}
.prayer-divider i {
  flex: 0 0 8px;
  height: 8px;
  border: 1px solid currentColor;
  transform: rotate(45deg);
}
.prayer-end { width: 28px; margin: .9rem auto 0; color: var(--bronze-deep); }
@media (max-width: 699px) {
  .prayer-paper { grid-template-columns: minmax(0, 1fr); }
  .prayer-rail { margin: 0; padding: 33px 0 0; border: 0; background: none; }
  .prayer-corners svg { width: 34px; height: 34px; }
  .prayer-corners { inset: 20px; }
  .prayer-content { padding: 14px clamp(18px, 6vw, 30px) 28px; }
}
@media print {
  .reading-frame.is-prayer {
    padding: 0;
    border: 1px solid var(--print-ink);
    border-radius: 0;
    box-shadow: none;
    background: var(--print-paper) !important;
  }
  .prayer-paper { display: block; background: transparent; }
  .prayer-paper::before, .prayer-corners, .prayer-divider, .prayer-end { display: none; }
  .prayer-rail { margin: 0; padding: 8pt 0 0; border: 0; background: none; }
  .prayer-content { padding: 8pt 12pt 12pt; }
  .reading-frame.is-prayer :is(.prayer-seal, #body-title, #article-text, #article-text *) { color: var(--print-ink) !important; }
}
/* Bỏ gạch chân ở tên bài trong danh sách (Trang yêu cầu) */
.card-title, .article-card:hover .card-title { text-decoration: none; }
.article-card:hover .card-title, .article-card:focus-visible .card-title { color: var(--green); }
.reading-page li > a[href^="/bai/"], main li > a[href^="/bai/"] { text-decoration: none; }
main li > a[href^="/bai/"]:hover { color: var(--green); }

/* Lời khấn: đoạn văn căn trái đều, lùi đầu dòng; câu niệm vẫn căn giữa (Trang yêu cầu) */
.is-prayer #article-text .prayer-line:not(.prayer-chant) {
  text-align: justify;
  text-align-last: left;
  text-indent: 1.6em;
  hyphens: manual;
}
.is-prayer #article-text .prayer-chant-group,
.is-prayer #article-text .prayer-subheading,
.is-prayer #article-text .prayer-note { text-align: center; text-indent: 0; }
@media (max-width: 699px) {
  .is-prayer #article-text .prayer-line:not(.prayer-chant) { text-indent: 1.2em; text-align: left; }
}

/* Bỏ gạch chân toàn web; khi rê chuột: đổi màu êm + gạch mảnh hiện dần (Trang yêu cầu) */
a, a:visited, .card-title, .article-card:hover .card-title, .topic-row:hover .go,
.reader-outline [aria-selected=true] {
  text-decoration: none !important;
}
a { transition: color .25s ease, background-size .3s ease; }
a:not(.button):not(.chip):not(.brand):not(.book-open):not(.article-card):not(.topic-row) {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
}
a:not(.button):not(.chip):not(.brand):not(.book-open):not(.article-card):not(.topic-row):hover,
a:not(.button):not(.chip):not(.brand):not(.book-open):not(.article-card):not(.topic-row):focus-visible {
  color: var(--rose-d, #8F3F5C);
  background-size: 100% 1px;
}
.article-card:hover .card-title, .article-card:focus-visible .card-title,
.topic-row:hover .go { color: var(--rose-d, #8F3F5C); }
/* Link nằm trong đoạn văn: màu xanh rêu để vẫn nhận ra là link */
:is(p, li, dd) > a:not(.button):not(.chip) { color: var(--green); }

/* Lời khấn: hai tông giấy như mẫu C – cột ấn ngà ấm, phần chữ giấy sáng bật lên (Trang yêu cầu) */
.reading-frame.is-prayer { --seal-paper: #FDFBF6; --seal-rail: #F3EAD9; }
html.night .reading-frame.is-prayer { --seal-paper: #2B231E; --seal-rail: #372D25; }
.prayer-rail {
  margin: 14px 0 14px 14px;
  padding-top: 40px;
  padding-left: 0;
  background: var(--seal-rail);
  border-radius: 13px 0 0 13px;
}
@media (max-width: 699px) {
  .prayer-rail { margin: 14px 14px 0; padding: 30px 0 16px; border-radius: 13px 13px 0 0; background: var(--seal-rail); }
}

/* Ấn triện: chữ không bị bẻ giữa từ; ô tự nới theo chữ dài (Khấn nguyện) */
.prayer-seal {
  width: auto;
  min-width: 48px;
  height: auto;
  min-height: 48px;
  padding: 6px 7px;
  box-sizing: border-box;
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: none;
}
.prayer-seal > span { display: block; white-space: nowrap; }

/* Điện thoại: đoạn lời khấn cũng căn đều hai lề (Trang yêu cầu) */
@media (max-width: 699px) {
  .is-prayer #article-text .prayer-line:not(.prayer-chant) { text-align: justify; text-align-last: left; text-indent: 1.2em; }
}

/* Đợt 20 · Vườn Sen Dịu */
html:has(.v2-home, [data-book-shelf], .member-book-shelf) {
  --cream: #F7F4EC;
  --paper: #F9F5EC;
  --sand: #EEE7D9;
  --ink: #23372F;
  --muted: #526255;
  --sage: #DFE6D5;
  --line: #D8CDB7;
  --rose-d: #A94F70;
  --v2-shelf: #E3C9A6;
}
html.night:has(.v2-home, [data-book-shelf], .member-book-shelf) {
  --cream: #182720;
  --paper: #24382E;
  --sand: #24382E;
  --ink: #F2EBDD;
  --muted: #C9C5B7;
  --sage: #2C4034;
  --line: #4E6357;
  --bronze: #D2B780;
  --rose: #D7A0B5;
  --rose-d: #D7A0B5;
  --v2-shelf: #33493B;
}
:is(.v2-home, [data-book-shelf]) .wrap, .v2-header .wrap, .v2-footer .wrap {
  width: min(1360px, calc(100% - clamp(32px, 5.56vw, 80px)));
}
.v2-header { border-bottom: 1px solid var(--line); }
.v2-header .header-inner {
  position: relative;
  min-height: 80px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: clamp(4px, 1vw, 16px);
  padding-block: 0;
}
.v2-brand { display: inline-flex; align-items: center; gap: 12px; flex: none; }
.v2-brand strong { font: 600 clamp(1rem, 2.2vw, 2rem)/1.2 Lora, Georgia, serif; }
.v2-brand img { width: clamp(32px, 4vw, 54px); height: auto; }
.night .v2-brand img { filter: none; background: #F7F4EC; border-radius: 8px; padding: 3px; }
.v2-primary { display: flex; align-items: center; gap: clamp(4px, 1vw, 18px); margin-inline-start: auto; }
.v2-primary a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 6px clamp(6px, .85vw, 16px);
  border-radius: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.v2-primary [aria-current=page] { background-color: #D8E0CC; color: #23372F; }
.night .v2-primary [aria-current=page] { background-color: #A8BFA8; }
.v2-header-tools { display: flex; align-items: center; }
.v2-icon-button, .v2-header :is([data-night], [data-night][aria-pressed=true]) {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: none;
}
.v2-menu > summary { list-style: none; cursor: pointer; }
.v2-menu > summary::-webkit-details-marker { display: none; }
.v2-menu-panel {
  position: absolute;
  z-index: 16;
  inset: 100% 0 auto auto;
  display: grid;
  justify-items: start;
  gap: 8px;
  width: min(100%, 320px);
  max-height: 75dvh;
  overflow: auto;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px #0002;
}
.v2-menu-panel .v2-primary { display: none; }
.v2-menu-panel .site-links { display: grid; align-items: start; gap: 0; }
.v2-menu-panel :is(.site-links a, .chip, .account-menu summary) { display: flex; align-items: center; min-height: 48px; }
.v2-menu-panel .account-menu .site-links { position: static; margin-block: 6px; }
.v2-header [data-night][aria-pressed=false] .icon-sun, .v2-header [data-night][aria-pressed=true] .icon-moon { display: none; }
.v2-header .v2-header-tools a, .v2-assistant { min-height: 48px; }
.v2-footer { border-top: 1px solid var(--line); background: var(--cream); padding: 16px 0 0; }
.v2-footer .footer-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 28px; }
.v2-footer .v2-brand strong { font-size: 1.22rem; }
.v2-footer .v2-brand img { width: 45px; }
.v2-footer p { font: italic 1rem/1.25 Lora, Georgia, serif; color: var(--rose-d); }
.v2-footer .site-links { display: flex; flex-wrap: wrap; gap: 0 16px; }
.v2-footer .site-links a { display: inline-flex; align-items: center; min-height: 48px; }
.v2-assistant, .v2-footer .v2-assistant {
  display: inline-flex; gap: 8px; align-items: center; justify-content: center;
  border-color: var(--green); color: var(--green-deep); font-weight: 700;
}
.v2-footer-art {
  height: clamp(42px, 6vw, 84px);
  margin-top: 6px;
  background: url('/assets/img/v2/nhanh-sen-trong.webp') center 58% / min(88%, 960px) auto no-repeat;
  opacity: .65;
}
.v2-footer .assistant:not(:has(#assistant-panel:not([hidden]))) { display: none; }
.v2-footer .assistant-panel:focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; }

.v2-home {
  --home-gutter: max(clamp(16px, 2.78vw, 40px), calc((100vw - 1360px) / 2));
  --home-hero-art: url('/assets/img/v2/hero-ngay.webp');
  --home-prayer-art: url('/assets/img/v2/nen-loi-khan-ngay.webp');
  --home-footer-art: url('/assets/img/v2/chan-trang-ngay.webp');
  overflow-x: clip;
}
html.night .v2-home {
  --home-hero-art: url('/assets/img/v2/hero-dem.webp');
  --home-prayer-art: url('/assets/img/v2/nen-loi-khan-dem.webp');
  --home-footer-art: url('/assets/img/v2/chan-trang-dem.webp');
}
.v2-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 52fr) minmax(0, 48fr);
  align-items: center;
  min-height: clamp(385px, 31.5vw, 470px);
}
.v2-hero-copy { position: relative; z-index: 1; padding: 22px 0 30px clamp(0px, 2.45vw, 35px); }
.v2-hero h1, .v2-shelf-heading h1 {
  font: 600 clamp(3rem, 4.55vw, 4rem)/1.08 Lora, Georgia, serif;
  letter-spacing: -.036em;
  margin: 0 0 8px;
}
.v2-hero h1 { color: #173C2B; font-size: clamp(3rem, 5.05vw, 4.55rem); }
.night .v2-hero h1 { color: var(--ink); }
.v2-kicker { color: var(--bronze-deep); font: 600 1.2rem/1.35 Lora, Georgia, serif; margin-bottom: 10px; }
.v2-tagline { color: var(--rose-d); font: italic 600 clamp(1.12rem, 2.15vw, 1.75rem)/1.3 Lora, Georgia, serif; margin-bottom: 12px; }
.v2-hero-copy > p:not([class]) { margin-bottom: 18px; font-size: clamp(1rem, 1.4vw, 1.18rem); }
.v2-hero-actions { display: flex; flex-wrap: wrap; gap: 16px; }
.v2-home .button, .book-card-actions .button { min-height: 48px; }
.v2-hero-actions .button { min-height: 55px; padding-inline: clamp(16px, 2.6vw, 36px); border-radius: 15px; font-weight: 700; }
.v2-hero-art {
  position: absolute;
  inset: 0 calc(-1 * var(--home-gutter)) 0 auto;
  width: min(71vw, calc(63% + var(--home-gutter)));
  background: var(--home-hero-art) right center / 100% 114% no-repeat;
  mask-image: linear-gradient(to right, transparent, #000 14%);
}
.v2-entrances, .v2-recent-grid, .v2-home-books { display: grid; gap: clamp(12px, 1.8vw, 26px); }
.v2-entrances, .v2-recent-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.v2-entrance {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 28px);
  min-height: 100px;
  padding: 12px clamp(12px, 2.4vw, 32px);
  border: 1px solid color-mix(in srgb, var(--bronze) 57%, var(--line));
  border-radius: 12px;
  background-color: color-mix(in srgb, var(--sand) 56%, var(--cream));
  line-height: 1.45;
}
.v2-entrance svg { width: clamp(28px, 4vw, 54px); height: auto; flex: none; color: var(--rose-d); }
.v2-entrance:nth-child(2) svg { color: var(--green); }
.v2-entrance span { border-inline-start: 1px solid var(--bronze); padding-inline-start: clamp(10px, 2vw, 25px); }
.v2-entrance strong { display: block; font: 600 clamp(1.16rem, 2vw, 1.85rem)/1.2 Lora, Georgia, serif; color: var(--ink); }
.v2-recent, .v2-prayers, .v2-home-shelf { margin-top: clamp(22px, 2.6vw, 38px); }
.v2-section-heading { display: flex; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.v2-section-heading h2, .v2-prayers h2 { font-family: Lora, Georgia, serif; margin: 0; font-size: clamp(1.65rem, 3.45vw, 2.95rem); font-weight: 600; }
.v2-section-heading a { display: inline-flex; align-items: center; min-height: 48px; color: var(--green-deep); font-weight: 700; }
.v2-section-heading p { margin: 0; }
.v2-article {
  display: block;
  padding: 0;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  overflow: hidden;
}
.v2-article-art { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; }
.v2-article-text { display: grid; gap: 3px; padding: 10px 18px 14px; color: var(--muted); line-height: 1.5; }
.v2-article-text > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.v2-article-text .card-title { font-family: Lora, Georgia, serif; color: var(--ink); font-size: clamp(1.14rem, 1.75vw, 1.58rem); }
.v2-prayers {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 166px;
  margin-inline: calc(-1 * clamp(0px, 2vw, 30px));
  padding: 10px clamp(16px, 4.3vw, 62px) 10px clamp(16px, 2.4vw, 34px);
  border-radius: 20px;
  background: linear-gradient(105deg, transparent 60%, color-mix(in srgb, var(--sage) 30%, transparent)),
    var(--home-prayer-art) center / cover no-repeat var(--sage);
}
.v2-prayers-heading {
  display: grid;
  grid-template-columns: clamp(75px, 14vw, 208px) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}
.v2-prayers-heading img { width: 100%; height: clamp(90px, 10.2vw, 148px); object-fit: contain; }
.v2-prayers-heading > div { border-inline-start: 1px solid var(--bronze); padding-inline-start: clamp(14px, 3vw, 46px); }
.v2-prayers .v2-tagline { margin: 3px 0 0; font-size: clamp(1rem, 1.7vw, 1.5rem); }
.v2-prayers ul { margin: 0; padding: 0; list-style: none; }
.v2-prayers li + li { border-top: 1px solid color-mix(in srgb, var(--ink) 24%, transparent); }
.v2-prayers li a { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding-inline: 12px; font-family: Lora, Georgia, serif; font-size: clamp(1rem, 1.45vw, 1.25rem); font-weight: 600; color: var(--ink); }
.v2-section-heading a, .v2-prayers li a { gap: 12px; }
.v2-section-heading a::after, .v2-prayers li a::after {
  content: '';
  flex: none;
  width: 29px;
  height: 29px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M6.5 12h11m-5-5 5 5-5 5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.v2-home-shelf { margin-top: 14px; padding: 0; border: 0; background: transparent; }
.v2-home-books { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; padding: 0; }
.v2-home-books .book-card :is(a, svg) { box-shadow: none; border-radius: initial; }
.v2-home-books .book-card .button { border-radius: 22px; }
.v2-sample-note, [data-home-save-status] { margin: 10px 0 0; font-size: .88rem; }
[data-home-save-status]:empty { margin: 0; }
.v2-directory {
  --directory-surface: var(--cream);
  --directory-accent: #38634F;
  --directory-text: #293B33;
  --directory-leaf: #E7EFE5;
  --directory-petal: #F5E7EB;
  --directory-gap: clamp(12px, 1.5vw, 22px);
  --directory-padding: clamp(14px, 2.2vw, 30px);
  --directory-radius: 16px;
  margin-top: clamp(32px, 5vw, 72px);
  color: var(--directory-text);
}
html.night .v2-directory {
  --directory-surface: var(--paper);
  --directory-accent: #B2D3B7;
  --directory-text: var(--ink);
  --directory-leaf: #2C4034;
  --directory-petal: #47333D;
}
.directory-heading { flex-wrap: wrap; align-items: baseline; margin-bottom: var(--directory-gap); }
.directory-heading h2 { font: 600 clamp(1.45rem, 3vw, 2.4rem)/1.3 "Be Vietnam Pro", sans-serif; }
.directory-heading p { margin: 0; color: var(--muted); font-size: .88rem; }
.directory-heading b { color: var(--directory-accent); }
.directory-panels, .directory-companions { display: grid; gap: var(--directory-gap); }
.directory-panel, .directory-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--directory-radius);
  background: var(--directory-surface);
  box-shadow: 0 3px 12px color-mix(in srgb, var(--shadow-ink) 8%, transparent);
}
.directory-panel > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--directory-gap);
  padding: clamp(12px, 1.6vw, 22px) var(--directory-padding);
  border-radius: calc(var(--directory-radius) - 1px);
  list-style: none;
  cursor: pointer;
}
.directory-panel > summary::-webkit-details-marker { display: none; }
.directory-panel > summary:hover, .directory-panel[open] > summary { background: var(--directory-leaf); }
.directory-panel[open] > summary { border-end-start-radius: 0; border-end-end-radius: 0; }
.directory-panel > summary:focus-visible { outline: 2px solid var(--directory-accent); outline-offset: 3px; }
.directory-icon {
  display: grid;
  place-items: center;
  width: clamp(34px, 4vw, 52px);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--directory-accent);
  background: var(--directory-leaf);
}
.directory-panel:last-child .directory-icon { color: var(--rose-d); background: var(--directory-petal); }
.directory-icon svg { width: clamp(20px, 2.5vw, 26px); height: auto; }
.directory-label { display: grid; gap: 2px; }
.directory-label .eyebrow, .directory-card .eyebrow {
  margin: 0;
  font-size: .69rem;
  font-weight: 700;
  letter-spacing: .09em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--rose-d);
}
.directory-label strong, .directory-card h2 {
  margin: 0;
  font-size: clamp(1.08rem, 2vw, 1.55rem);
  line-height: 1.3;
}
.directory-description { color: var(--muted); font-size: .85rem; line-height: 1.5; }
.directory-chevron {
  width: .56rem;
  height: .56rem;
  margin: .25rem;
  border: solid var(--directory-accent);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.directory-panel[open] > summary .directory-chevron { transform: rotate(225deg); }
.directory-content {
  min-width: 0;
  padding: var(--directory-padding);
  border-top: 1px solid var(--line);
}
.v2-directory .topics, .directory-gifts, .directory-companions { margin: 0; gap: var(--directory-gap); }
.v2-directory .topics { display: grid; gap: 8px; }
.v2-directory .topic-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr) auto;
  gap: 8px 18px;
  padding: clamp(12px, 1.3vw, 18px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--directory-surface);
}
.v2-directory .topic-row:hover { background: var(--directory-leaf); }
.v2-directory .topic-row .nm b { font-size: 1rem; font-weight: 700; letter-spacing: normal; }
.v2-directory .topic-row .go { color: var(--directory-accent); }
.v2-directory .article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr));
  gap: 10px;
  border: 0;
}
.v2-directory .article-card {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.v2-directory .article-card:hover { background: var(--directory-leaf); }
.v2-directory .article-card .card-title { width: auto; font-size: 1rem; line-height: 1.45; }
.v2-directory .directory-more { margin-top: 14px; }
.directory-gifts, .directory-companions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.directory-companions { margin-top: var(--directory-gap); }
.directory-card {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 10px;
  padding: var(--directory-padding);
}
.directory-card > div { min-width: 0; }
.directory-card p { margin: 0; color: var(--muted); }
.directory-card h2 { margin-block: 4px 8px; }
.directory-card .button { margin-top: 8px; }
.directory-gifts .directory-card { grid-template-rows: auto 1fr auto; }
.directory-bedtime .bed-text {
  border-inline-start: 2px solid var(--rose-d);
  padding-inline-start: 12px;
  font-size: .94rem;
}
.directory-card ol { margin: 0; padding-inline-start: 1.4rem; }
.directory-card li + li { margin-top: .24rem; }
.directory-family-message {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--directory-leaf);
}
.directory-family-message .eyebrow,
.directory-panel > summary:hover .eyebrow, .directory-panel[open] > summary .eyebrow {
  color: var(--directory-accent);
}
.directory-family-message .directory-message { color: var(--directory-text); font-weight: 600; }
@media (max-width: 620px) {
  .directory-gifts, .directory-companions { grid-template-columns: minmax(0, 1fr); }
  .v2-directory .topic-row { grid-template-columns: minmax(0, 1fr) auto; }
  .v2-directory .topic-row .s { grid-column: 1 / -1; grid-row: 2; }
  .v2-directory .topic-row .go { grid-column: 2; grid-row: 1; }
}
.v2-home #ve-trang {
  margin: 18px 0 28px;
  padding: clamp(18px, 3vw, 38px);
  border-radius: 12px;
  background: var(--sand);
}
.v2-home #ve-trang p { max-width: 82ch; margin-bottom: .7rem; }
.v2-home #ve-trang h2 { margin-bottom: .5rem; }
.v2-home .v2-home-books .book-stage {
  --stage-book-width: min(64%, 172px);
  --stage-book-height: min(96cqi, 258px, calc(clamp(200px, 19vw, 280px) - 22px));
  height: clamp(200px, 19vw, 280px);
}
.v2-home .v2-home-books .book-card-actions { padding-top: 4px; }
.v2-home-footer .v2-footer-art {
  height: clamp(36px, 4.2vw, 66px);
  margin: 0;
  background: var(--home-footer-art) center bottom / 100% 142% no-repeat;
  opacity: 1;
}
.v2-home-footer .footer-inner { gap: 6px 18px; font-size: .91rem; }
.v2-footer-brand { position: relative; }
.v2-footer-brand .v2-brand { gap: 10px; }
.v2-footer-brand .v2-brand img { width: 52px; }
.v2-footer-brand p { margin: -12px 0 3px 62px; }
.v2-footer-domain { display: inline-flex; min-height: 48px; align-items: center; }
@media (min-width: 1140px) {
  .v2-home-footer { padding-top: 8px; }
  .v2-home-footer .footer-inner { flex-wrap: nowrap; }
  .v2-home-footer .site-links { flex-wrap: nowrap; gap: 0 clamp(4px, 1.2vw, 20px); white-space: nowrap; }
  .v2-home-footer :is(.site-links, .v2-footer-domain) { border-inline-start: 1px solid var(--line); padding-inline-start: clamp(8px, 1.5vw, 24px); }
  .v2-home-footer .v2-assistant { white-space: nowrap; }
}

.book-cover.cover-v2 {
  overflow: visible;
  isolation: isolate;
  background: transparent;
  box-shadow: none;
  perspective: 850px;
  color: #E4C98F;
  --cloth: #51463C;
}
.cover-v2::before, .cover-v2::after {
  position: absolute;
  content: '';
  pointer-events: none;
}
.book-cover.cover-v2::before {
  z-index: -2;
  inset: .8% -5% 1.2% 4%;
  border-radius: 3px 5px 7px 3px;
  border: 2px solid var(--cloth);
  background: repeating-linear-gradient(90deg, #E0CCAC 0 1px, #F5E7CA 1px 3px);
  transform: skewY(2deg);
  box-shadow: 3px 5px 5px #22190f55, 8px 12px 18px #22190f33;
}
.book-cover.cover-v2::after {
  z-index: 1;
  inset: -.15% auto -.15% -5.8%;
  width: 6%;
  border-radius: 65% 15% 15% 65% / 2% 1% 1% 2%;
  background:
    linear-gradient(90deg, #0005, #fff3 24%, transparent 54%, #0007),
    linear-gradient(transparent 9%, #d3b16c 9% 9.6%, transparent 9.6% 11%, #d3b16c 11% 11.6%, transparent 11.6% 87%, #d3b16c 87% 87.6%, transparent 87.6% 89%, #d3b16c 89% 89.6%, transparent 89.6%),
    var(--cloth);
  box-shadow: -4px 3px 6px #19140e30;
}
.cover-v2 .cover-paper {
  border-radius: 2px 5px 5px 2px;
  padding: 0;
  transform-origin: left center;
  transform: rotateY(-6deg);
  background: var(--cloth);
  border: 1px solid #32281d65;
  box-shadow: inset 3px 0 3px #19140e48;
}
.cover-v2 .cover-paper svg { width: 100%; height: 100%; }
.book-cover.cover-v2--photo {
  --photo-color: var(--muted);
  --photo-spine: color-mix(in srgb, var(--photo-color) 76%, #171a16);
  --photo-edge: color-mix(in srgb, var(--photo-color) 84%, #26241f);
  aspect-ratio: var(--photo-ratio);
}
.book-cover.cover-v2--photo::before {
  inset: .7% -4.5% 0 0;
  border: 0;
  border-radius: 2px 4px 4px 2px;
  transform: none;
  background: repeating-linear-gradient(90deg, var(--photo-edge) 0 1px,
    color-mix(in srgb, var(--photo-edge) 90%, white) 1px 2px);
  box-shadow: 1px 2px 3px #241e1850, 2px 6px 8px -4px #241e1870;
}
.book-cover.cover-v2--photo::after {
  inset: 0 auto 0 -2.6%;
  width: 3%;
  border-radius: 3px 0 0 3px;
  background: linear-gradient(90deg, #0003, transparent 70%, #0004), var(--photo-spine);
  box-shadow: none;
}
.cover-v2--photo .cover-paper {
  border: 0;
  border-radius: 1px 3px 3px 1px;
  transform: none;
  background: var(--photo-color);
  box-shadow: none;
}
.cover-v2--photo .cover-photo {
  object-fit: contain;
  border-radius: inherit;
  background: transparent;
}

[data-book-shelf] .reading-page { max-width: 1360px; padding-top: 28px; }
[data-book-shelf] .breadcrumbs { display: none; }
.v2-shelf-heading { border-inline-start: 2px solid var(--bronze); padding-inline-start: clamp(14px, 3vw, 38px); margin: 0 0 22px; }
.v2-shelf-heading p { margin: 0; color: var(--rose-d); font: italic 600 clamp(1.08rem, 2.4vw, 2rem)/1.32 Lora, Georgia, serif; }
.v2-shelf-heading strong { color: var(--bronze-deep); font: 600 clamp(1.05rem, 1.85vw, 1.55rem)/1.5 Lora, Georgia, serif; }
[data-book-shelf] .book-guide { width: fit-content; margin-block: 0 8px; }
[data-book-shelf] .book-guide summary { min-height: 48px; align-content: center; cursor: pointer; }
.shelf-layout {
  display: grid;
  grid-template: "shelves tools" auto "shelves results" 1fr / minmax(190px, 280px) minmax(0, 1fr);
  gap: 16px clamp(16px, 1.9vw, 28px);
  align-items: start;
}
.shelf-sidebar { grid-area: shelves; display: grid; gap: 9px; }
.shelf-sidebar h2 { font-size: 1.75rem; font-weight: 600; margin: 2px 0 10px; }
.shelf-sidebar .chip {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  text-align: left;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-inline-start: 6px solid var(--shelf-color, var(--green));
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper) 52%, var(--sand));
  color: var(--ink);
  font: 600 1.16rem/1.2 Lora, Georgia, serif;
}
.shelf-sidebar svg { flex: none; color: var(--bronze-deep); }
.shelf-sidebar .chip[aria-pressed=true], .shelf-tools .chip[aria-pressed=true] {
  background: var(--sage);
  box-shadow: inset 0 0 0 1px var(--green);
  color: var(--ink);
}
.shelf-layout .shelf-tools {
  grid-area: tools;
  position: static;
  grid-template-columns: minmax(0, 1fr) auto minmax(8rem, .62fr) auto;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}
.shelf-tools .shelf-search { position: relative; grid-column: auto; min-width: 0; }
.shelf-search svg { position: absolute; left: 12px; top: 12px; pointer-events: none; }
.shelf-tools .shelf-search input { padding-inline-start: 42px; }
.shelf-layout .shelf-tools :is(input, select, .chip) { min-height: 48px; }
.shelf-layout .shelf-tools select { grid-column: auto; width: 100%; }
.shelf-layout .shelf-tools .chip { display: inline-flex; gap: 7px; align-items: center; justify-content: center; border-radius: 8px; }
.shelf-layout .shelf-filter-status { min-height: 20px; font-size: .88rem; color: var(--muted); }
.shelf-results { grid-area: results; min-width: 0; }
.shelf-layout .shelf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
:is(.shelf-grid, .v2-home-books) .book-card {
  display: flex;
  flex-direction: column;
  text-align: center;
  background: color-mix(in srgb, var(--paper) 70%, var(--sand));
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 0 7px;
  content-visibility: visible;
}
:is(.shelf-grid, .v2-home-books) .book-open { display: block; width: 100%; padding: 0; text-align: center; min-width: 0; color: var(--ink); }
.book-stage {
  --stage-book-width: min(71%, 210px);
  --stage-book-height: min(106.5cqi, 315px);
  container-type: inline-size;
  display: grid;
  place-items: end center;
  min-width: 0;
  padding: 12px 12px 10px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(transparent calc(100% - 10px), var(--v2-shelf, var(--sand)) 0, var(--sand)),
    radial-gradient(ellipse at 67% 32%, var(--paper), var(--sand));
}
.night .book-stage {
  background: linear-gradient(transparent calc(100% - 10px), var(--v2-shelf) 0, var(--paper)),
    radial-gradient(ellipse at 65% 32%, var(--sage), var(--paper));
}
/* Let the designed cover size reserve a shelf, then fit the full photo inside it. */
.book-stage:has(.cover-v2--photo)::before {
  content: '';
  grid-area: 1 / 1;
  width: min(var(--stage-book-width), calc(var(--stage-book-height) * 2 / 3));
  aspect-ratio: 2 / 3;
}
.book-stage .cover-v2--photo {
  grid-area: 1 / 1;
  width: min(var(--stage-book-width), calc(var(--stage-book-height) * var(--photo-ratio)));
}
.book-stage .cover-v2:not(.cover-v2--photo) {
  width: min(var(--stage-book-width), calc(var(--stage-book-height) * 2 / 3));
}
.book-caption {
  display: block;
  padding: 8px 8px 4px;
  overflow-wrap: anywhere;
}
:is(.shelf-grid, .v2-home-books) .book-caption .book-title { margin: 0; }
.book-author {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
}
:is(.shelf-grid, .v2-home-books) .book-title {
  display: block;
  margin: 6px 8px 0;
  font: 600 clamp(1rem, 1.55vw, 1.28rem)/1.22 Lora, Georgia, serif;
}
:is(.shelf-grid, .v2-home-books) .book-card p.book-shelf-label { margin: 4px 6px; color: var(--rose-d); font-size: .9rem; }
.book-card-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 6px; margin-top: auto; padding-inline: 4px; }
.book-card-actions .button { padding: 4px 14px; font-weight: 700; font-size: .88rem; min-width: 0; }
.book-card-actions .chip, .shelf-grid .book-card .book-card-actions [data-save-book], .book-detail [data-save-book] {
  display: inline-flex;
  min-width: 48px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 2px 5px;
  margin: 0;
  border: 0;
  color: var(--green-deep);
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}
[data-save-book][aria-pressed=true] .icon-save { fill: currentColor; }
.shelf-grid .book-info, .shelf-grid .shelf-pencil { min-width: 48px; min-height: 48px; width: 48px; height: 48px; }
.shelf-grid .book-info { z-index: 2; inset: 4px 4px auto auto; background: var(--paper); }
.shelf-grid .shelf-pencil { inset-inline-end: 56px; }
.shelf-more { width: 100%; min-height: 48px; margin-top: 16px; }
.shelf-filter-dialog :is(.chip, .button, summary), .shelf-reader-close, .book-detail .chip { min-height: 48px; }
.shelf-filter-dialog summary { align-content: center; }
.book-detail .shelf-detail-layout h2 { overflow-wrap: anywhere; }

@media (max-width: 1000px) {
  .v2-header .header-inner > .v2-primary { display: none; }
  .v2-menu-panel .v2-primary { display: flex; flex-wrap: wrap; margin: 0; }
  .shelf-layout { grid-template-columns: minmax(145px, 23%) minmax(0, 1fr); }
  .shelf-layout .shelf-tools { grid-template-columns: minmax(0, 1fr) auto auto; }
  .shelf-tools .shelf-search { grid-column: 1 / -1; }
  .shelf-layout .book-card-actions { gap: 0; }
}
@media (max-width: 700px) {
  .v2-header .header-inner { min-height: 64px; }
  .v2-header .v2-brand { gap: 6px; min-width: 0; }
  .v2-header .v2-brand strong { font-size: clamp(.94rem, 4.1vw, 1.12rem); overflow-wrap: anywhere; }
  .v2-header .v2-brand img { width: 34px; flex: none; }
  .v2-hero { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .v2-hero-copy { padding: 20px 0 0; }
  .v2-hero h1, .v2-shelf-heading h1 { font-size: clamp(1.85rem, 8.5vw, 2.65rem); }
  .v2-hero-art { position: static; width: calc(100% + var(--home-gutter)); height: clamp(190px, 62vw, 325px); background-size: 100% 100%; mask-image: none; }
  .v2-entrances { gap: 6px; }
  .v2-entrance { min-height: 94px; padding: 8px 5px; display: grid; gap: 4px; justify-items: center; text-align: center; }
  .v2-entrance span { padding: 0; border: 0; font-size: .8rem; }
  .v2-entrance strong { font-size: 1.02rem; }
  .v2-recent-grid, .v2-prayers { grid-template-columns: minmax(0, 1fr); }
  .v2-prayers { gap: 8px; margin-inline: 0; padding: 12px 14px; }
  .v2-prayers-heading { grid-template-columns: 64px minmax(0, 1fr); gap: 6px; }
  .v2-prayers-heading img { height: 72px; }
  .v2-prayers li a { padding-inline: 0; }
  .v2-home .v2-home-books .book-stage {
    --stage-book-width: 75%;
    --stage-book-height: 112.5cqi;
    height: auto;
    min-height: 0;
  }
  .v2-home .v2-home-books .book-card-actions { gap: 0 2px; }
  .v2-home .v2-home-books .book-card-actions .button { font-size: .82rem; }
  .v2-home .v2-home-books .book-card-actions .chip { gap: 2px; padding-inline: 0; font-size: .76rem; }
  .v2-home .v2-home-books .book-card-actions .chip svg { width: 19px; }
  .v2-home-footer .v2-footer-art { background-size: auto 160%; }
  .v2-section-heading a { font-size: .88rem; text-align: end; }
  .v2-home-books { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v2-footer .footer-inner { column-gap: 10px; justify-content: space-between; }
  .v2-footer .site-links { gap: 0 12px; }
  .v2-footer .v2-assistant { margin: 0 auto; }
  .v2-footer-art { background-size: 100% auto; }
  [data-book-shelf] .reading-page { padding-top: 18px; }
  .v2-shelf-heading { margin-bottom: 12px; }
  .shelf-layout {
    grid-template: "tools" auto "shelves" auto "results" 1fr / minmax(0, 1fr);
    gap: 12px;
  }
  .shelf-layout .shelf-tools { grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; }
  .shelf-layout .shelf-tools .chip { padding-inline: 7px; }
  .shelf-layout .shelf-tools .chip svg { width: 18px; }
  .shelf-layout .shelf-tools select { font-size: .87rem; padding-inline: 4px; }
  .shelf-sidebar { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .shelf-sidebar h2 { position: absolute; clip-path: inset(50%); height: 1px; width: 1px; overflow: hidden; }
  .shelf-sidebar .chip { min-height: 48px; min-width: 0; padding: 5px; gap: 4px; font-size: clamp(.82rem, 3.3vw, 1rem); border-inline-start-width: 4px; }
  .shelf-sidebar .chip:nth-of-type(1) { grid-column: 1 / -1; justify-content: center; }
  .shelf-sidebar svg { width: 16px; }
  .shelf-layout .shelf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .book-stage {
    --stage-book-width: min(75%, 188px);
    --stage-book-height: min(112.5cqi, 282px);
    padding-inline: 6px;
  }
  .shelf-grid .book-info { inset: 0 0 auto auto; width: 48px; height: 48px; background: transparent; border: 0; color: var(--ink); }
  .book-card-actions .button { padding-inline: 8px; }
}
@media (max-width: 360px) {
  .v2-header .v2-brand img { width: 28px; }
  .shelf-sidebar svg { display: none; }
  .shelf-layout .shelf-tools .icon-filter { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .v2-header a, .v2-home a, .v2-footer a, [data-book-shelf] a { transition: none; }
}
.v2-header .v2-menu { position: static; margin: 0; }
.v2-header .v2-menu > summary {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  color: var(--ink);
}
.v2-header .v2-menu-panel > .site-links { position: static; min-width: 0; padding: 0; border: 0; }
.v2-header .v2-menu-panel > .site-links a { padding-inline: 0; }
.v2-header .v2-menu-panel .auth-controls { margin: 0; }
.shelf-layout + .chip { min-height: 48px; margin-top: 10px; }
.v2-home #ve-trang h2, .shelf-sidebar h2, .shelf-detail-layout h2 {
  font-family: Lora, Georgia, serif;
  font-weight: 600;
}
/* V2: tiêu đề trang đọc dùng Lora xanh rêu cho đồng bộ */
.reading-page h1, .reading-page h2 { font-family: Lora, Georgia, serif; color: var(--green); letter-spacing: -.02em; font-weight: 500; }

.tts-trigger { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.tts-speaker { flex: none; }
.tts-panel {
  margin: .5rem 0;
  padding: .55rem .7rem;
  border: 1px solid var(--book-line, var(--control-line));
  border-radius: 12px;
  color: var(--book-fg, var(--ink));
  background: var(--book-bg, var(--paper));
  font-size: .85rem;
}
.tts-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .65rem; }
.tts-actions label:not([hidden]) { display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; white-space: nowrap; }
.tts-actions label select {
  width: auto;
  min-width: 0;
  min-height: 44px;
  padding: .25rem .35rem;
  border: 1px solid var(--book-line, var(--control-line));
  border-radius: 8px;
  color: inherit;
  background: var(--book-bg, var(--paper));
  font: inherit;
}
.tts-actions button:disabled { opacity: .6; }
.tts-panel p { margin: .25rem 0 0; }
.tts-panel p:empty { margin: 0; }
.tts-help { margin: .35rem 0 0; padding-inline-start: 1.25rem; }
.reader-workspace .tts-panel {
  position: absolute;
  z-index: 2;
  inset: auto max(.5rem, var(--right-safe)) 0 max(.5rem, var(--left-safe));
  width: fit-content;
  max-width: calc(100% - max(.5rem, var(--left-safe)) - max(.5rem, var(--right-safe)));
  max-height: 55%;
  overflow: auto;
  margin: 0 auto var(--bottom-safe);
  box-shadow: 0 -2px 12px color-mix(in srgb, var(--shadow-ink) 13%, transparent);
}
.reader-workspace .reader-viewport { bottom: calc(var(--bottom-safe) + var(--listen-inset, 0px)); }
.reader-workspace .reader-bottom { bottom: var(--listen-inset, 0px); }
@media print { .tts-panel { display: none !important; } }
/* Ấn triện: viền son đậm, có đường chỉ trong như dấu ấn thật */
.prayer-seal {
  border: 2.5px solid currentColor;
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px var(--seal-rail, #F3EAD9), inset 0 0 0 3px currentColor;
  font-weight: 700;
}

/* Ấn triện: mọi bài cùng một khuôn vuông, chữ dài ngắn đều vừa */
.prayer-seal {
  width: 60px;
  min-width: 60px;
  height: 60px;
  min-height: 60px;
  padding: 4px;
  font-size: 13px;
  line-height: 1.15;
  text-align: center;
}
@media (max-width: 699px) {
  .prayer-seal { width: 54px; min-width: 54px; height: 54px; min-height: 54px; font-size: 12px; }
}

/* Bài pháp: cùng khung giấy, viền bo và góc sen với lời khấn; chữ căn đều hai bên (Trang yêu cầu 01/12) */
.is-teaching #article-text { text-align: justify; text-align-last: left; hyphens: manual; font-family: Lora, Georgia, serif; }
.is-teaching #article-text .lecture { white-space: normal; line-height: 1.85; }
.is-teaching #article-text .teach-raw { white-space: pre-line; text-align: left; }
.is-teaching #article-text .teach-kicker {
  text-align-last: center;
  text-indent: 0;
  margin: 0 0 .5rem;
  text-align: center;
  color: var(--rose);
  letter-spacing: .2em;
  font: 600 12px/1.5 Lora, Georgia, serif;
}
.is-teaching #article-text .teach-title {
  text-align-last: center;
  text-indent: 0;
  margin: 0 0 .2rem;
  text-align: center;
  text-wrap: balance;
  color: var(--green);
  font: 600 clamp(19px, 5vw, 25px)/1.4 Lora, Georgia, serif;
}
.is-teaching #article-text .teach-p, .is-teaching #article-text .teach-item-text {
  margin: 0 0 1em;
  text-align: justify;
  text-align-last: left;
}
.is-teaching #article-text .teach-p { text-indent: 1.4em; }
.is-teaching #article-text .teach-sub {
  text-align-last: center;
  text-indent: 0;
  margin: 1.7em 0 .7em;
  text-align: center;
  text-indent: 0;
  color: var(--rose);
  letter-spacing: .08em;
  font: 600 .86em/1.5 Lora, Georgia, serif;
}
.is-teaching #article-text .teach-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  margin: 1.2em 0;
}
.is-teaching #article-text .teach-num {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-top: 2px;
  border: 1px solid var(--rose);
  border-radius: 50%;
  color: var(--rose);
  font: 600 13px/1 Lora, Georgia, serif;
  white-space: nowrap;
}
.is-teaching #article-text .teach-item-title {
  margin: 0 0 .25em;
  text-indent: 0;
  text-align: left;
  color: var(--green);
  font-weight: 700;
}
.is-teaching #article-text .teach-item-text { margin: 0; text-indent: 0; }
.is-teaching #article-text .teach-quote {
  margin: 1.1em .3em;
  padding: .1em 0 .1em 1em;
  border-left: 2px solid var(--bronze);
  font-style: italic;
  color: var(--soft-ink);
}
.is-teaching #article-text .teach-list { margin: .6em 0 1em; padding-left: 1.3em; }
.is-teaching #article-text .teach-list li { margin: .3em 0; }
.is-teaching #article-text .teach-list li::marker { color: var(--bronze); }
.is-teaching #article-text .teach-verse {
  margin: 1.1em 0;
  text-align: center;
  text-align-last: center;
  text-indent: 0;
  line-height: 1.9;
}
@media (max-width: 699px) {
  .is-teaching #article-text .teach-p { text-indent: 1.1em; }
  .is-teaching #article-text .teach-item { grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
  .is-teaching #article-text .teach-num { width: 26px; height: 26px; font-size: 12px; }
}

.is-teaching #article-text .teach-note { margin: 1.4em 0 0; text-align: center; text-indent: 0; color: var(--muted); font-size: .82em; font-style: italic; }

/* Sổ Pháp Học trên trang chủ */
.v2-study-book {
  --study-surface: #F7F4EC;
  --study-display: #F5E7EB;
  --study-leaf: #E7EFE5;
  --study-title: #293B33;
  --study-accent: #38634F;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  margin-top: clamp(24px, 4vw, 52px);
  padding: clamp(18px, 3vw, 42px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(110deg, var(--study-leaf), var(--study-surface) 52%);
  box-shadow: 0 5px 20px color-mix(in srgb, var(--shadow-ink) 9%, transparent);
}
.night .v2-study-book {
  --study-surface: var(--paper);
  --study-display: #4B343B;
  --study-leaf: var(--sage);
  --study-title: var(--ink);
  --study-accent: var(--green-deep);
}
.study-book-lotus {
  position: absolute;
  z-index: -1;
  inset: auto 2% 5% auto;
  width: min(45%, 430px);
  color: var(--rose-d);
  opacity: .09;
  pointer-events: none;
}
.study-book-display {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: clamp(20px, 3vw, 38px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: radial-gradient(ellipse at 50% 35%, var(--study-surface), var(--study-display));
}
.study-book-display .book-cover.cover-v2--photo {
  /* Dominant RGB sampled from assets/so-phap-hoc-bia.jpg. */
  --photo-color: rgb(101 12 10);
  --photo-ratio: 899 / 1270;
  width: min(70%, 212px);
}
.study-book-copy .eyebrow { margin-bottom: 8px; }
.study-book-copy h2 {
  margin-bottom: 12px;
  color: var(--study-title);
  font: 600 clamp(2.15rem, 4.7vw, 4.1rem)/1.12 Lora, Georgia, serif;
}
.study-book-description { max-width: 47ch; margin-bottom: 14px; color: var(--muted); }
.study-book-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 .62em;
  width: fit-content;
  margin-bottom: 20px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--study-leaf);
  color: var(--study-accent);
  font-size: .82rem;
}
.study-book-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 700px) {
  .v2-study-book { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .study-book-display .book-cover.cover-v2--photo { width: min(66%, 164px); }
  .study-book-lotus { width: 63%; }
  .study-book-actions .button { padding-inline: 12px; }
}
