/* MET story books — add-on to met-site.css + met-product.css (install after them).
   Used by: T8 story book page (.met-book), T9 story shelf page (.met-books), My Materials story card (.mm-book).
   Same colours, cards, tags and pills as the product page. Level colours below are the only new colours. */
:root { --lv1:#FFE9B8; --lv1-line:#F2D27A; --lv2:#D9F2EA; --lv2-line:#9FD8C6; --lv3:#DCE9FB; --lv3-line:#A9C6EE; --lv4:#EBE0FB; --lv4-line:#C8B3EE; }

/* Level badge: number big, CEFR small. No school year anywhere. */
.lv { display:inline-flex; align-items:center; gap:6px; min-height:26px; padding:0 10px; border-radius:10px; font-size:12px; font-weight:800; border:1px solid transparent; color:var(--ink); }
.lv small { font-size:11px; font-weight:700; opacity:.75; }
.lv-1 { background:var(--lv1); border-color:var(--lv1-line); }
.lv-2 { background:var(--lv2); border-color:var(--lv2-line); }
.lv-3 { background:var(--lv3); border-color:var(--lv3-line); }
.lv-4 { background:var(--lv4); border-color:var(--lv4-line); }

/* "What's inside" icons under the title */
.book-inside { display:flex; flex-wrap:wrap; gap:8px; margin:2px 0 4px; }
.book-inside span { display:inline-flex; align-items:center; gap:6px; padding:5px 12px; border-radius:999px; background:var(--soft); border:1px solid var(--line); font-size:13px; font-weight:750; }

/* Sample player in the hero (1 minute) */
.sample-player { display:flex; align-items:center; gap:12px; padding:10px 14px; border-radius:14px; background:var(--mint); border:1px solid var(--mint-line); }
.sample-player b { font-size:14px; white-space:nowrap; }
.sample-player audio { flex:1; min-width:0; height:36px; }

/* Section head used on this page: emoji + title + small right note */
.book-sec { padding:20px 24px; display:flex; flex-direction:column; gap:12px; }
.book-sec h2 { margin:0; font-size:22px; font-weight:900; }
.book-sec .sec-head { display:flex; justify-content:space-between; align-items:baseline; gap:12px; flex-wrap:wrap; }

/* ---- Audio section ---- */
.audio-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.1fr); gap:20px; align-items:start; }
.player-card { display:flex; flex-direction:column; gap:10px; padding:16px; border-radius:16px; background:var(--ink); color:#fff; }
.player-card .now { font-size:13px; opacity:.8; }
.player-card h3 { margin:0; font-size:19px; }
.player-card audio { width:100%; }
.speed { display:flex; gap:6px; flex-wrap:wrap; }
.speed button { min-height:36px; padding:0 14px; border-radius:999px; border:1px solid #ffffff55; background:transparent; color:#fff; font:700 14px inherit; cursor:pointer; }
.speed button[aria-pressed="true"] { background:var(--yellow); color:var(--ink); border-color:var(--yellow); }
.player-meta { display:flex; flex-wrap:wrap; gap:6px; }
.player-meta span { font-size:12px; padding:3px 10px; border-radius:999px; background:#ffffff1a; }
.chapters { list-style:none; margin:0; padding:0; border:1px solid var(--line); border-radius:14px; overflow:hidden; }
.chapters li { display:grid; grid-template-columns:34px minmax(0,1fr) auto auto; gap:10px; align-items:center; padding:8px 12px; font-size:14px; border-bottom:1px solid var(--line); background:#fff; }
.chapters li:last-child { border-bottom:0; }
.chapters li:nth-child(even) { background:var(--soft); }
.chapters .no { font-weight:900; color:var(--link); }
.chapters .len { font-variant-numeric:tabular-nums; color:var(--grey); font-size:13px; }
.chapters .st { font-size:12px; font-weight:750; }
.chapters .st.free { color:#16845E; }
.chapters .total { grid-template-columns:34px minmax(0,1fr) auto; font-weight:800; background:var(--cream) !important; }

/* How to use the audio: 3 steps in a row (show, don't tell) */
.steps3 { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; list-style:none; margin:0; padding:0; counter-reset:s; }
.steps3 li { position:relative; padding:14px 14px 14px 52px; border-radius:14px; background:#fff; border:2px solid var(--card-line); box-shadow:3px 4px 0 0 var(--card-shadow); font-size:14px; }
.steps3 li::before { counter-increment:s; content:counter(s); position:absolute; left:14px; top:12px; width:28px; height:28px; border-radius:999px; background:var(--yellow); display:grid; place-items:center; font-weight:900; }
.steps3 b { display:block; font-size:16px; margin-bottom:2px; }

/* ---- Formats table ---- */
.formats { width:100%; border-collapse:collapse; font-size:14px; }
.formats th, .formats td { padding:9px 10px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
.formats thead th { background:var(--soft); font-size:13px; }
.formats .f { font-weight:900; white-space:nowrap; }

/* ---- Guide (teachers and parents) ---- */
.guide-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,.9fr); gap:16px; align-items:start; }
.guide-col { padding:14px 16px; border-radius:14px; border:1px solid var(--line); background:#fff; }
.guide-col h3 { margin:0 0 6px; font-size:17px; }
.guide-col ul { margin:0; padding-left:18px; font-size:14px; line-height:1.7; }
.guide-col.parent { background:var(--pink); border-color:var(--pink-line); }
.guide-col.teacher { background:var(--blue); border-color:var(--blue-line); }
.guide-pages { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.guide-pages img { width:100%; height:auto; aspect-ratio:210/297; object-fit:cover; border:1px solid var(--line); border-radius:8px; background:#fff; }

/* ---- Key words with sound ---- */
.words { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; list-style:none; margin:0; padding:0; }
.words li { display:flex; flex-direction:column; gap:2px; padding:10px 12px; border-radius:12px; background:var(--cream); border:1px solid var(--cream-line); }
.words .w { display:flex; align-items:center; justify-content:space-between; gap:6px; font-weight:900; font-size:16px; }
.words button { width:32px; height:32px; border-radius:999px; border:0; background:#fff; cursor:pointer; font-size:15px; }
.words .zh { font-size:13px; }
.words .m { font-size:12px; color:var(--grey); line-height:1.4; }

/* ---- Which level fits? (4 cards) ---- */
.levels4 { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.lvcard { display:flex; flex-direction:column; gap:8px; padding:14px; border-radius:14px; border:2px solid var(--line); background:#fff; }
.lvcard.lv-1 { border-color:var(--lv1-line); } .lvcard.lv-2 { border-color:var(--lv2-line); }
.lvcard.lv-3 { border-color:var(--lv3-line); } .lvcard.lv-4 { border-color:var(--lv4-line); }
.lvcard.is-this { box-shadow:0 0 0 3px var(--action); }
.lvcard h3 { margin:0; font-size:17px; }
.lvcard .sample { margin:0; padding:10px 12px; border-radius:10px; background:var(--soft); font-family:Lora,Georgia,serif; font-size:14px; line-height:1.55; }
.lvcard .what { font-size:13px; color:var(--grey); margin:0; }
.lvcard a { margin-top:auto; font-size:13px; font-weight:800; }

/* ---- T9 story shelf page ---- */
.met-books { max-width:1366px; margin:0 auto; padding:12px 48px 40px; display:flex; flex-direction:column; gap:20px; }
.books-hero { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,1fr); gap:24px; align-items:center; padding:22px 28px; }
.books-hero h1 { margin:0 0 6px; font-size:34px; }
.lv-jump { display:flex; gap:8px; flex-wrap:wrap; }
.lv-jump a { text-decoration:none; }
.level-row { padding:18px 22px; border-radius:18px; border:2px solid var(--line); }
.level-row.lv-1 { background:#FFFBF0; border-color:var(--lv1-line); } .level-row.lv-2 { background:#F4FBF8; border-color:var(--lv2-line); }
.level-row.lv-3 { background:#F5F9FE; border-color:var(--lv3-line); } .level-row.lv-4 { background:#F9F6FE; border-color:var(--lv4-line); }
.level-head { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:16px; align-items:center; margin-bottom:12px; }
.level-head h2 { margin:0; font-size:24px; }
.level-head p { margin:2px 0 0; font-size:14px; color:var(--grey); }
.set-label { font-size:13px; font-weight:800; margin:4px 0 8px; }
.book-shelf { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:14px; list-style:none; margin:0; padding:0; }
.book-shelf a { display:flex; flex-direction:column; align-items:center; gap:6px; height:100%; padding:10px; text-align:center; color:var(--ink); text-decoration:none; background:#fff; border:2px solid var(--card-line); border-radius:14px; box-shadow:3px 4px 0 0 var(--card-shadow); transition:transform .15s; }
.book-shelf a:hover { transform:translateY(-2px) rotate(-1deg); }
.book-shelf img { width:120px; height:160px; object-fit:contain; }
.book-shelf .t { font-size:14px; font-weight:800; line-height:1.3; }
.book-shelf .s { font-size:12px; color:var(--grey); }
.book-shelf .icons { font-size:12px; }
.book-shelf .price { margin-top:auto; font-size:16px; font-weight:900; color:var(--action); }
.book-shelf .soon { opacity:.6; }
.book-shelf .soon .price { color:var(--grey); font-size:13px; }

/* ---- My Materials: story book card (wider, two rows of buttons) ---- */
.mm-book { grid-column:1 / -1; display:grid; grid-template-columns:120px minmax(0,1fr) minmax(0,1fr); gap:16px; padding:14px; }
.mm-book img { width:120px; height:160px; object-fit:contain; }
.mm-book h3 { font-size:17px; margin:4px 0 4px; }
.mm-progress { height:8px; border-radius:999px; background:var(--soft); overflow:hidden; margin:6px 0 2px; }
.mm-progress span { display:block; height:100%; background:#16845E; }
.mm-book .acts { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.mm-listen { padding:12px; border-radius:14px; background:var(--ink); color:#fff; display:flex; flex-direction:column; gap:8px; }
.mm-listen select { min-height:38px; border-radius:10px; border:0; padding:0 10px; font:14px inherit; }
.mm-listen audio { width:100%; }
.mm-listen .small { color:#fff; opacity:.8; }

@media (max-width:1100px) { .words { grid-template-columns:repeat(4,minmax(0,1fr)); } .book-shelf { grid-template-columns:repeat(4,minmax(0,1fr)); } .guide-grid { grid-template-columns:1fr 1fr; } .guide-pages { grid-column:1 / -1; grid-template-columns:repeat(4,1fr); } }
@media (max-width:900px) { .audio-grid, .books-hero { grid-template-columns:1fr; } .levels4 { grid-template-columns:1fr 1fr; } .steps3 { grid-template-columns:1fr; } .words { grid-template-columns:repeat(3,minmax(0,1fr)); } .met-books { padding:12px 24px 40px; } .book-shelf { grid-template-columns:repeat(3,minmax(0,1fr)); } .mm-book { grid-template-columns:100px minmax(0,1fr); } .mm-book img { width:100px; height:134px; } .mm-listen { grid-column:1 / -1; } }
@media (max-width:520px) { .levels4, .guide-grid { grid-template-columns:1fr; } .guide-pages { grid-template-columns:1fr 1fr; } .words { grid-template-columns:1fr 1fr; } .met-books { padding:12px 14px 40px; } .book-shelf { grid-template-columns:1fr 1fr; gap:10px; } .book-shelf img { width:100px; height:134px; } .books-hero { padding:18px; } .books-hero h1 { font-size:28px; } .level-head { grid-template-columns:1fr; } .chapters li { grid-template-columns:28px minmax(0,1fr) auto; } .chapters .st { display:none; } .book-sec { padding:16px; } }
.met-book #lang-0:checked ~ .lang-panel-0, .met-book #lang-2:checked ~ .lang-panel-2 { grid-template-columns:1fr; }

/* Integration refinements; owner template retained. */
body.met-story-preview .met-product,body.met-story-preview .met-books{max-width:1420px;margin:0 auto;padding:20px 24px}
.met-book .missing-guide{aspect-ratio:210/297;display:grid;place-content:center;text-align:center;background:#f6f8fa;border:1px dashed #b7c6ce;border-radius:12px;padding:16px}
.met-books .empty-book{display:grid;place-content:center;min-height:150px;padding:24px;border:1px dashed var(--line);border-radius:14px;background:#fff}
.met-book .sample-player{flex-wrap:wrap}.met-book .audio-pending{width:100%}.met-book .speed button,.met-book .words button{min-width:44px;min-height:44px}.met-book .gallery-stage img{object-fit:contain;transform:none}
.met-books [id^="level-"],.met-book [id]{scroll-margin-top:140px}
@media(min-width:1100px){.met-book .hero{padding:16px}.met-book .hero-grid{grid-template-columns:minmax(170px,.65fr) minmax(360px,1.55fr) minmax(245px,.9fr);gap:18px}.met-book .gallery-stage{height:340px}.met-book .gallery-stage img{height:330px;width:100%}.met-book h1{font-size:30px}.met-book .facts th,.met-book .facts td{padding:5px 8px;font-size:13px}.met-book .promise{font-size:14px;line-height:1.55}.met-book .buy-box{padding:14px}.met-book .buy-box li{font-size:13px}.met-book .book-inside span{font-size:12px}.met-book .trust{gap:10px;font-size:12px}}
@media(max-width:600px){body.met-story-preview .met-product,body.met-story-preview .met-books{padding:12px}.met-book .hero-grid{display:flex;flex-direction:column}.met-book .hero-cover,.met-book .hero-main,.met-book .buy-box{width:100%;min-width:0}.met-book .gallery-stage{height:360px}.met-book .gallery-stage img{height:350px;width:100%;object-fit:contain}.met-book .hero-main{gap:12px}.met-book .phone-bar{display:none}.met-book .guide-pages{grid-template-columns:1fr 1fr}.met-book .missing-guide{padding:8px;font-size:13px}.met-books .books-hero{padding:16px}.met-book .book-sec{padding:18px}.met-book .chapters li{font-size:12px}.met-book .chapters .len{font-size:10px}}
body.met-story-preview #primary{margin:0!important;padding:0!important}
body.met-story-preview .met-product.met-book{padding:12px 24px!important}
body.met-story-preview .met-book .hero{padding:14px!important}
body.met-story-preview .met-book .hero-main{gap:8px!important}
body.met-story-preview .met-book .buy-box{padding:14px!important;gap:8px!important}
body.met-story-preview .met-book .buy-box .btn,body.met-story-preview .met-book .buy-box .btn2{min-height:44px!important;padding:8px 12px!important}
body.met-story-preview .met-book .sample-player{padding:6px 10px!important;gap:4px!important}
body.met-story-preview .met-book .sample-player audio{height:32px!important}
body.met-story-preview .met-book .audio-pending{font-size:11px}
@media(min-width:1100px){
body.met-story-preview .met-book .hero-grid{grid-template-columns:250px minmax(0,1fr) 290px!important;gap:18px!important}
body.met-story-preview .met-book .gallery-stage,body.met-story-preview .met-book .hero-cover{height:340px!important;min-height:0!important}
body.met-story-preview .met-book .gallery-stage img{height:340px!important;max-height:340px!important}
body.met-story-preview .met-book .gallery{grid-template-columns:42px minmax(0,1fr)!important}
body.met-story-preview .met-book h1{font-size:28px!important;margin:0!important}
body.met-story-preview .met-book .promise{font-size:14px!important;line-height:1.5!important;padding:0!important}
body.met-story-preview .met-book .subtitle{font-size:13px!important}
body.met-story-preview .met-book .facts td,body.met-story-preview .met-book .facts th{padding:4px 6px!important;font-size:12px!important;line-height:1.5!important}
body.met-story-preview .met-book .book-inside{gap:4px!important;margin:0!important}
body.met-story-preview .met-book .book-inside span{padding:3px 7px!important;font-size:11px!important}
body.met-story-preview .met-book .tags{gap:5px!important}
body.met-story-preview .met-book .tag{font-size:12px!important;min-height:25px!important;padding:3px 8px!important}
body.met-story-preview .met-book .trust{padding-top:8px!important;margin-top:8px!important;font-size:11px!important}
body.met-story-preview .met-book .note{font-size:11px!important;line-height:1.4!important}
}
@media(max-width:600px){body.met-story-preview .met-product.met-book{padding:12px!important}body.met-story-preview .met-book .hero-cover{order:0!important}body.met-story-preview .met-book .hero-main{order:1!important}body.met-story-preview .met-book .buy-box{order:2!important}body.met-story-preview .met-book .phone-bar{display:none!important}body.met-story-preview .met-book .hero-grid{gap:20px!important}}
@media(min-width:1100px){body.met-story-preview .met-book .buy-box .price{font-size:30px!important}body.met-story-preview .met-book .buy-box li{font-size:12px!important;line-height:1.4!important;margin:2px 0!important}body.met-story-preview .met-book .buy-box ul{margin:2px 0!important}body.met-story-preview .met-book .buy-box .chips{gap:3px!important}body.met-story-preview .met-book .buy-box .pill{font-size:10px!important;min-height:22px!important;padding:2px 7px!important}body.met-story-preview .met-book .bundle-line{font-size:11px!important;line-height:1.5!important;padding:8px!important}body.met-story-preview .met-book .trust{padding:6px 0 0!important;gap:8px!important;line-height:1.4!important}}
body.met-story-preview .met-book .player-card h3{color:#fff!important;background:none!important}
