:root{
  --bg:#f5f7f6;
  --card:#fff;
  --border:#c7cfcd;
  --dark:#28435a;
  --dark-2:#20384b;
  --mint:#a8d6cc;
  --mint-2:#dff1eb;
  --text:#242d35;
  --muted:#84919a;
  --accent:#ff7b5f;
  --green:#2f8d41;
  --red:#c73329;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;line-height:1.45}
a{text-decoration:none;color:inherit}
img{max-width:100%;height:auto;display:block}
.th-container{width:min(1800px,calc(100% - 64px));margin:0 auto}
.th-header{background:#fff;padding:14px 0;border-bottom:1px solid #eff3f2}
.th-header-inner{display:flex;align-items:center;justify-content:space-between;gap:20px}
.th-header-left{display:flex;align-items:center;gap:28px}.th-site-logo img{max-height:56px;width:auto}.th-logo-link{display:flex;align-items:center;justify-content:center;width:58px;height:58px;background:var(--dark);color:#fff;border-radius:12px;font-size:28px}.th-book-icon{filter:grayscale(100%) brightness(10)}
.th-primary-nav{display:flex;gap:34px;align-items:center;flex-wrap:wrap}.th-primary-nav a{font-weight:700;color:var(--dark);padding:8px 0;position:relative}.th-primary-nav a.is-active:after{content:"";position:absolute;left:0;right:0;bottom:-8px;height:2px;background:#70879c}
.th-header-right{display:flex;align-items:center;gap:12px}.th-outline-btn,.th-solid-btn,.th-outline-wide{border:1px solid var(--dark);padding:11px 18px;border-radius:6px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;gap:8px}.th-solid-btn{background:var(--dark);color:#fff;border-color:var(--dark)}.th-outline-wide{min-width:190px}.th-icon-btn,.th-avatar-btn{border:none;background:transparent;font-size:25px;cursor:pointer}.th-avatar-btn{font-size:28px}
.th-site-main{padding:34px 0 0}
.th-breadcrumb{font-weight:700;color:#222;margin-bottom:26px}.th-breadcrumb span{color:#97d0c3}
.th-hero{background:var(--dark);border-radius:0;min-height:650px;position:relative;overflow:hidden;padding:70px 28px 36px}.th-hero:before,.th-hero:after{content:"";position:absolute;background:var(--mint);opacity:.9;border-radius:50% 50% 0 50%}.th-hero:before{width:300px;height:300px;left:-70px;bottom:-90px}.th-hero:after{width:270px;height:270px;right:-50px;top:-60px}
.th-hero-inner{display:grid;grid-template-columns:1.05fr 1fr;align-items:center;gap:40px}.th-hero-copy h2{font-size:58px;line-height:1.05;color:#9fa7ab;margin:0 0 24px}.th-hero-copy .th-hero-btn{background:#fff;border:none;border-radius:999px;padding:16px 28px;font-size:20px;font-weight:700;color:var(--dark);display:inline-block}
.th-hero-books{position:relative;height:430px;display:flex;justify-content:flex-end;align-items:center;gap:18px;padding-right:42px}.th-hero-book{width:190px;border-radius:16px;box-shadow:0 12px 20px rgba(0,0,0,.18);overflow:hidden;background:#fff}.th-hero-book.is-secondary{width:92px;opacity:.92}.th-hero-book img{width:100%;height:100%;object-fit:cover;aspect-ratio:2/3}.th-hero-dots{position:absolute;left:18px;bottom:18px;display:flex;gap:12px}.th-hero-dots span{width:14px;height:14px;border-radius:50%;display:block;background:#ffbe4d}.th-hero-dots span.is-active{background:transparent;border:4px solid #fff;width:18px;height:18px}
.th-section{padding:26px 0}.th-section-header{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;margin-bottom:16px}.th-section-title{font-size:30px;font-weight:800;margin:0}.th-section-subtitle{margin:4px 0 0;font-size:18px;color:#3b434b}.th-show-all{font-size:20px;color:var(--dark);display:inline-flex;gap:8px;align-items:center}
.th-grid-5,.th-grid-4,.th-grid-3,.th-authors-grid{display:grid;gap:28px}.th-grid-5{grid-template-columns:repeat(5,minmax(0,1fr))}.th-grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}.th-grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.th-card{background:#fff;border:1px solid #b8c0be;padding:12px;min-height:100%}.th-card.cover-wide .th-card-image img{aspect-ratio:16/9}.th-card .th-card-image{margin-bottom:12px;border-radius:8px;overflow:hidden}.th-card .th-card-image img{width:100%;aspect-ratio:3/4;object-fit:cover}.th-card-title{font-size:18px;font-weight:700;margin:.15rem 0}.th-card-category{color:var(--accent);font-weight:700;font-size:18px}.th-card-language{color:#90d6c7;font-weight:700;font-size:17px}.th-card-author{color:#99a0a8;font-size:17px}.th-card-price{font-size:18px;font-weight:800;color:var(--green)}.th-card-price.paid{color:var(--red)}.th-card-badge{font-size:17px;font-weight:800;margin-bottom:2px}.th-card-badge.free{color:var(--green)}.th-card-badge.paid{color:var(--red)}.th-card-badge.subscription{color:#295eb4}.th-stars{color:#f59d2b;letter-spacing:1px}.th-rating-row{display:flex;align-items:center;gap:8px;color:#555;font-size:17px}
.th-categories{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:18px}.th-category-card{padding:16px;border-radius:14px;text-align:center;display:block}.th-category-card img{aspect-ratio:1.15/1;border-radius:12px;object-fit:cover;margin-bottom:12px}.th-category-card h3{margin:0;font-size:18px}.bg-1{background:#ece8f7}.bg-2{background:#deede8}.bg-3{background:#e6eefb}.bg-4{background:#f0e8f3}.bg-5{background:#e8efe1}
.th-authors-row{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:28px}.th-author-card{text-align:center}.th-author-card img{width:160px;height:160px;object-fit:cover;border-radius:50%;border:4px solid #2e475f;margin:0 auto 16px}.th-author-card h3{font-size:18px;color:var(--accent);margin:0;font-weight:700}
.th-listing-layout{display:grid;grid-template-columns:360px 1fr;gap:24px}.th-filter-box{background:#fff;border:1px solid #b9c0be;border-radius:16px;padding:18px;margin-bottom:18px}.th-filter-box h3{display:flex;justify-content:space-between;align-items:center;font-size:18px;margin:0 0 14px}.th-filter-list{display:grid;gap:12px}.th-filter-list label{display:flex;align-items:center;gap:10px;font-size:18px;font-weight:700}.th-filter-list input{width:22px;height:22px}
.th-cards-wrap{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px}
.th-library-tabs{display:flex;gap:10px;margin:0 0 20px}.th-tab{border:1px solid var(--dark);padding:8px 14px;border-radius:6px;background:#fff}.th-tab.is-active{background:var(--dark);color:#fff}.th-empty-state{background:#e9eeef;min-height:470px;border-radius:0;display:flex;align-items:center;justify-content:center;padding:30px}.th-empty-inner{max-width:900px;display:grid;grid-template-columns:1.1fr 1fr;align-items:center;gap:30px}.th-empty-title{font-size:64px;line-height:1.05;margin:0 0 14px}.th-empty-ill{background:linear-gradient(135deg,#dde4ea,#f8f9fa);border-radius:16px;height:280px;position:relative}.th-empty-ill:before{content:"🧑‍💻";position:absolute;font-size:150px;right:100px;bottom:40px}.th-empty-ill:after{content:"📚";position:absolute;font-size:88px;right:240px;top:54px}
.th-single{display:grid;grid-template-columns:1.05fr 1fr;gap:18px}.th-single-media{background:#fff;padding:0;border-radius:20px;overflow:hidden}.th-single-media img{width:100%;aspect-ratio:5/3.9;object-fit:cover}.th-tabs{display:flex;align-items:center;gap:24px;padding:14px 0;border-bottom:1px solid #bfc6c5;margin-bottom:18px}.th-tabs a{font-weight:700;position:relative;padding-bottom:8px}.th-tabs a.is-active:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:#1b2f40}.th-bookmark{margin-left:auto;border:1px solid #b4c1bc;border-radius:8px;padding:8px 10px;color:#8ac3b5;background:#fff}
.th-detail-panel{padding:10px 0 0}.th-badges{display:flex;gap:12px;margin-bottom:14px}.th-badge{padding:8px 14px;border-radius:6px;font-weight:800;border:2px solid var(--dark);color:var(--dark);background:#fff}.th-badge.filled{background:var(--dark);color:#fff}.th-detail-title{font-size:28px;font-weight:800;margin:0 0 6px}.th-detail-price{font-size:28px;font-weight:800;margin:0 0 18px}.th-divider{height:1px;background:#d6dcdb;margin:0 0 22px}.th-action-row{display:flex;gap:14px;margin-bottom:20px}.th-solid-btn.wide,.th-outline-wide{flex:1;height:54px;font-size:16px}.th-meta-grid-2{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:18px}.th-meta-item{display:flex;align-items:center;gap:8px;font-size:16px;font-weight:700}.th-author-box{background:var(--dark);color:#fff;padding:12px 16px;border-radius:12px;display:flex;gap:12px;align-items:center}.th-author-box img{width:54px;height:54px;border-radius:50%;object-fit:cover}.th-author-box strong{display:block}.th-detail-content{max-width:760px;padding-top:8px}.th-detail-content h3{font-size:20px}.th-similar{padding-top:16px}.th-similar .th-grid-5{grid-template-columns:repeat(3,minmax(0,150px));justify-content:flex-start}
.th-reader-page .th-reader-header{display:flex;justify-content:space-between;align-items:center;margin:10px 0 22px}.th-reader-controls{display:flex;gap:16px;color:#97d0c3;font-weight:800;align-items:center}.th-reader-controls .pct{color:#f66e56}.th-reader-frame{background:#fff;border-top:1px solid #e0e5e4;border-bottom:1px solid #e0e5e4;padding:24px 80px 14px;min-height:760px;position:relative}.th-reader-topline{display:grid;grid-template-columns:1fr 60px 1fr;align-items:center;font-weight:800;font-size:24px;margin-bottom:30px}.th-reader-topline .center{text-align:center;color:#b6b6b6}.th-reader-topline .right{text-align:right}.th-reader-body{font-size:27px;font-style:italic;line-height:1.5;text-align:center;max-width:1280px;margin:0 auto}.th-reader-body h1,.th-reader-body h2{font-size:50px;margin:28px 0}.th-reader-footerbar{position:sticky;bottom:10px;background:#fff;border:1px solid #e3e6e5;border-radius:16px;margin-top:16px;padding:12px 18px;display:flex;justify-content:center;gap:22px;color:#98d2c3;font-size:26px}
.th-audio-layout{display:grid;grid-template-columns:1.05fr 1fr;gap:18px}.th-audio-right .th-solid-btn{width:100%;height:56px}.th-audio-right .status{padding:8px 0 18px;text-align:center;color:#98a0a6}.th-audio-description{max-width:760px;padding-top:18px}.th-audio-stats{display:grid;grid-template-columns:auto repeat(4,1fr);gap:22px;align-items:center;margin:22px 0}.th-audio-stats .stat{padding-left:22px;border-left:2px solid #a5d6c8}.th-audio-stats .author-mini{display:flex;align-items:center;gap:10px;font-weight:700}.th-audio-stats img{width:28px;height:28px;border-radius:50%}.th-review-box textarea{width:100%;min-height:90px;border:1px solid #fa907c;border-radius:6px;padding:12px;background:#fff}.th-review-box .submit-row{text-align:right;margin-top:10px}.th-sticky-player{position:fixed;left:0;right:0;bottom:0;background:#fff;border-top:1px solid #d9e1df;box-shadow:0 -4px 18px rgba(0,0,0,.06);z-index:20}.th-sticky-inner{width:min(1800px,calc(100% - 64px));margin:0 auto;display:grid;grid-template-columns:80px 1fr auto;gap:14px;align-items:center;padding:10px 0}.th-sticky-inner img{width:60px;height:60px;object-fit:cover;border-radius:6px}.th-player-progress{display:flex;align-items:center;gap:10px}.th-player-progress input[type=range]{width:100%}.th-player-btn{width:44px;height:44px;border-radius:50%;background:var(--dark);color:#fff;border:none}
.th-footer{background:#edf4f3;margin-top:70px;padding-top:46px}.th-footer-top{display:grid;grid-template-columns:1.2fr .9fr .9fr;gap:70px;padding-bottom:42px}.th-footer-col h4{font-size:22px;margin:8px 0 18px;padding-bottom:10px;border-bottom:2px solid #bfc6c3}.th-footer-col ul{list-style:none;padding:0;margin:0;display:grid;gap:12px;font-size:18px}.th-footer-brand p{max-width:560px;font-size:18px}.th-socials{display:flex;gap:18px;font-size:36px;align-items:center}.th-app-title{margin-top:28px}.th-apps{display:flex;gap:18px;font-size:40px}.th-footer-bottom{display:flex;justify-content:space-between;align-items:center;padding:20px 0 28px;font-size:18px;font-weight:700}.th-payments{display:flex;gap:26px;flex-wrap:wrap}
@media (max-width: 1400px){.th-grid-5{grid-template-columns:repeat(4,minmax(0,1fr))}.th-categories{grid-template-columns:repeat(5,minmax(0,1fr))}.th-authors-row{grid-template-columns:repeat(5,minmax(0,1fr))}.th-cards-wrap{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width: 1024px){.th-container{width:min(100%,calc(100% - 32px))}.th-hero-inner,.th-single,.th-audio-layout,.th-listing-layout,.th-empty-inner,.th-footer-top{grid-template-columns:1fr}.th-grid-5,.th-grid-4{grid-template-columns:repeat(2,minmax(0,1fr))}.th-categories{grid-template-columns:repeat(3,minmax(0,1fr))}.th-authors-row{grid-template-columns:repeat(3,minmax(0,1fr))}.th-reader-frame{padding:24px}.th-reader-body{font-size:21px}.th-reader-body h1,.th-reader-body h2{font-size:36px}.th-header-inner{flex-direction:column;align-items:flex-start}.th-header-right{align-self:flex-end}.th-empty-title{font-size:42px}.th-cards-wrap{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width: 640px){.th-primary-nav{gap:18px}.th-grid-5,.th-grid-4,.th-grid-3,.th-cards-wrap,.th-categories,.th-authors-row{grid-template-columns:repeat(2,minmax(0,1fr))}.th-hero{min-height:auto}.th-hero-books{height:auto;flex-wrap:wrap;justify-content:center;padding-right:0}.th-hero-copy h2{font-size:38px}.th-action-row{flex-direction:column}.th-meta-grid-2{grid-template-columns:1fr}.th-audio-stats{grid-template-columns:1fr 1fr}.th-footer-bottom{flex-direction:column;gap:14px;align-items:flex-start}.th-sticky-inner{grid-template-columns:60px 1fr 44px;width:calc(100% - 24px)}}


/* Auth UI */
.th-user-menu{position:relative}
.th-user-trigger{border:none;background:transparent;display:flex;align-items:center;gap:10px;cursor:pointer;padding:0}
.th-user-avatar{width:42px;height:42px;border-radius:50%;background:var(--dark);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:800}
.th-user-name{font-weight:700;color:var(--dark)}
.th-user-dropdown{position:absolute;top:calc(100% + 12px);right:0;background:#fff;border:1px solid #d8e0de;border-radius:14px;min-width:210px;box-shadow:0 16px 32px rgba(24,37,50,.12);padding:10px;display:none;z-index:30}
.th-user-menu:hover .th-user-dropdown,.th-user-menu:focus-within .th-user-dropdown{display:block}
.th-user-dropdown a{display:block;padding:12px 14px;border-radius:10px;font-weight:600;color:var(--dark)}
.th-user-dropdown a:hover{background:#f3f6f7}

.th-auth-modal{position:fixed;inset:0;display:none;z-index:1000}
.th-auth-modal.is-visible{display:block}
.th-auth-backdrop{position:absolute;inset:0;background:rgba(21,32,44,.56);backdrop-filter:blur(2px)}
.th-auth-dialog{position:relative;z-index:2;width:min(980px,calc(100% - 28px));margin:6vh auto;background:#fff;border-radius:28px;overflow:hidden;display:grid;grid-template-columns:.95fr 1.05fr;box-shadow:0 30px 80px rgba(20,31,43,.28)}
.th-auth-side{background:linear-gradient(135deg,var(--dark),var(--dark-2));color:#fff;padding:42px 34px}
.th-auth-brand{display:inline-flex;background:rgba(255,255,255,.12);padding:10px 14px;border-radius:999px;font-weight:800;letter-spacing:.02em}
.th-auth-side h3{font-size:34px;line-height:1.15;margin:22px 0 14px}
.th-auth-side p{color:#d5e0e7;font-size:16px;margin:0 0 18px}
.th-auth-side ul{list-style:none;padding:0;margin:24px 0 0;display:grid;gap:12px}
.th-auth-side li{position:relative;padding-left:24px;color:#eff4f7}
.th-auth-side li:before{content:"✓";position:absolute;left:0;top:0;color:#9ee1ce;font-weight:800}
.th-auth-panel{padding:34px 34px 36px;position:relative}
.th-auth-close{position:absolute;top:18px;right:18px;border:none;background:#eef3f6;color:var(--dark);width:38px;height:38px;border-radius:50%;font-size:24px;line-height:1;cursor:pointer}
.th-auth-tabs{display:flex;gap:10px;background:#f2f5f6;border-radius:999px;padding:6px;margin:0 40px 26px 0}
.th-auth-tabs button{border:none;background:transparent;padding:12px 18px;border-radius:999px;font-weight:800;color:#63717d;cursor:pointer}
.th-auth-tabs button.is-active{background:#fff;color:var(--dark);box-shadow:0 6px 14px rgba(32,56,75,.12)}
.th-auth-form{display:none}
.th-auth-form.is-active{display:block}
.th-auth-form h2{font-size:30px;margin:0 0 8px;color:var(--dark)}
.th-auth-form p{margin:0 0 22px;color:#6d7b86}
.th-auth-form label{display:block;font-size:14px;font-weight:700;margin:0 0 8px;color:#33414c}
.th-auth-form input[type=text],.th-auth-form input[type=email],.th-auth-form input[type=password]{width:100%;padding:14px 16px;border:1px solid #d5dddb;border-radius:14px;background:#fff;margin:0 0 16px;font-size:15px;outline:none}
.th-auth-form input:focus{border-color:#9ab7cb;box-shadow:0 0 0 3px rgba(112,135,156,.16)}
.th-auth-row{display:flex;align-items:center;justify-content:space-between;gap:14px;margin:-2px 0 18px}
.th-check{display:flex;align-items:center;gap:8px;font-size:14px;color:#5f6c77;font-weight:600}
.th-auth-row a{font-size:14px;color:var(--dark);font-weight:700}
.th-auth-submit{width:100%;border-radius:14px;padding:15px 18px;font-size:16px}
.th-auth-message{margin:0 0 18px;padding:12px 14px;border-radius:14px;font-weight:700}
.th-auth-message.is-error{background:#fff1ef;color:#ac3427;border:1px solid #ffc8bf}

@media (max-width: 1024px){
  .th-auth-dialog{grid-template-columns:1fr}
  .th-auth-side{display:none}
}
@media (max-width: 767px){
  .th-user-name{display:none}
  .th-auth-panel{padding:26px 18px 24px}
  .th-auth-tabs{margin-right:50px}
  .th-auth-dialog{margin:2vh auto;border-radius:20px}
}


/* --- Ebook Cover Standard Ratio 3:4 --- */
.book-cover,
.card-media img,
.media-cover img{
    width:100%;
    aspect-ratio:3/4;
    object-fit:cover;
    border-radius:10px;
}

/* Mobile optimization */
@media (max-width:768px){
    .card-media img,
    .media-cover img{
        aspect-ratio:3/4;
    }
}

/* Grid spacing improvement */
.media-grid{
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(140px,1fr));
    gap:16px;
}

@media (min-width:1024px){
    .media-grid{
        grid-template-columns:repeat(5,1fr);
    }
}


/* ===== UI Upgrade v1.4 ===== */

/* Wishlist Heart */
.book-card{
    position:relative;
}
.book-wishlist{
    position:absolute;
    top:10px;
    right:10px;
    background:#fff;
    border-radius:50%;
    width:34px;
    height:34px;
    display:flex;
    align-items:center;
    justify-content:center;
    box-shadow:0 2px 6px rgba(0,0,0,0.15);
    cursor:pointer;
    font-size:16px;
}
.book-wishlist.active{
    color:#e63946;
}

/* Trending Badge */
.trending-badge{
    position:absolute;
    top:10px;
    left:10px;
    background:#ff6b00;
    color:#fff;
    padding:4px 8px;
    font-size:12px;
    border-radius:4px;
}

/* Card hover performance */
.book-card:hover{
    transform:translateY(-4px);
    transition:all .25s ease;
}

/* Dark mode */
body.dark-mode{
    background:#0f172a;
    color:#e2e8f0;
}

body.dark-mode .book-card{
    background:#1e293b;
    border-color:#334155;
}

.dark-toggle{
    cursor:pointer;
}

/* Lazy image fade */
img.lazy{
    opacity:0;
    transition:opacity .3s ease;
}
img.lazy.loaded{
    opacity:1;
}


/* v1.5 Search popup */
.search-popup{
 position:fixed;
 top:80px;
 left:50%;
 transform:translateX(-50%);
 width:600px;
 background:#fff;
 box-shadow:0 10px 30px rgba(0,0,0,.2);
 padding:20px;
 z-index:9999;
 display:none;
}

/* User profile */
.user-profile{
 max-width:700px;
 margin:40px auto;
 text-align:center;
}

.profile-links a{
 display:inline-block;
 margin:10px;
 padding:10px 20px;
 background:#0f172a;
 color:#fff;
 border-radius:6px;
 text-decoration:none;
}

/* reader improvements */
.reader-container{
 max-width:900px;
 margin:auto;
 line-height:1.8;
 font-size:18px;
}

/* audiobook player */
.audio-player-bar{
 position:fixed;
 bottom:0;
 left:0;
 right:0;
 background:#111827;
 color:#fff;
 padding:12px;
 display:flex;
 align-items:center;
 justify-content:center;
}


/* ===== v1.5.1 Amazon-style cover sizing ===== */
/* Amazon-like covers feel a bit taller than generic 3:4 cards */
.book-card,
.media-card,
.card-media{
    position: relative;
}

.book-card .book-cover,
.book-card .book-cover img,
.media-card .book-cover,
.media-card .book-cover img,
.card-media .book-cover,
.card-media .book-cover img,
.card-media img,
.media-cover img{
    width: 100%;
    aspect-ratio: 5 / 8;
    object-fit: cover;
    object-position: center;
    border-radius: 6px;
    display: block;
}

/* Keep card bodies compact like marketplace shelves */
.book-card .card-body,
.media-card .card-body,
.card-media .card-body{
    padding-top: 10px;
}

/* Desktop shelves: slightly narrower covers like Amazon rows */
@media (min-width: 1200px){
    .media-grid,
    .book-grid,
    .books-grid{
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 18px;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1199px){
    .media-grid,
    .book-grid,
    .books-grid{
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px;
    }
}

/* Mobile: 2 per row, tall readable covers */
@media (max-width: 767px){
    .media-grid,
    .book-grid,
    .books-grid{
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .book-card .book-cover,
    .book-card .book-cover img,
    .media-card .book-cover,
    .media-card .book-cover img,
    .card-media .book-cover,
    .card-media .book-cover img,
    .card-media img,
    .media-cover img{
        aspect-ratio: 5 / 8;
        border-radius: 5px;
    }
}

/* Horizontal sections should also look like Amazon shelves */
.home-section .card-media,
.section-books .card-media,
.section-trending .card-media,
.section-latest .card-media{
    max-width: 100%;
}


/* ===== v1.6 Amazon-like horizontal shelves ===== */
.th-shelf-wrap{
    position:relative;
}

.th-shelf{
    display:flex;
    gap:18px;
    overflow-x:auto;
    overflow-y:hidden;
    scroll-behavior:smooth;
    padding:4px 28px 12px 0;
    scrollbar-width:none;
    -ms-overflow-style:none;
}

.th-shelf::-webkit-scrollbar{
    display:none;
}

.th-shelf > .th-card{
    flex:0 0 calc((100% - (7 * 18px)) / 7.5);
    min-width:0;
}

.th-shelf > .th-card.cover-wide{
    flex-basis:calc((100% - (7 * 18px)) / 5.5);
}

.th-shelf-arrow{
    position:absolute;
    top:35%;
    transform:translateY(-50%);
    width:44px;
    height:44px;
    border:1px solid #c7d0cf;
    background:rgba(255,255,255,.96);
    color:#243e57;
    border-radius:999px;
    font-size:30px;
    line-height:1;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    z-index:4;
    box-shadow:0 6px 16px rgba(0,0,0,.12);
}

.th-shelf-prev{ left:-12px; }
.th-shelf-next{ right:-12px; }

.th-shelf-arrow:hover{
    background:#fff;
}

.th-shelf-arrow[disabled]{
    opacity:.35;
    cursor:default;
}

/* Amazon-like cover sizing inside shelves */
.th-shelf .th-card{
    background:#fff;
    border:1px solid #d5dddb;
    padding:12px;
}

.th-shelf .th-card .th-card-image img{
    width:100%;
    aspect-ratio:5/8;
    object-fit:cover;
    border-radius:6px;
}

.th-shelf .th-card.cover-wide .th-card-image img{
    aspect-ratio:16/9;
}

.th-shelf .th-card-title{
    font-size:16px;
    line-height:1.25;
}

.th-shelf .th-card-category,
.th-shelf .th-card-language,
.th-shelf .th-card-author,
.th-shelf .th-rating-row,
.th-shelf .th-card-price{
    font-size:15px;
}

/* Tablet = about 5.5 covers visible */
@media (max-width: 1024px){
    .th-shelf > .th-card{
        flex-basis:calc((100% - (5 * 16px)) / 5.5);
    }

    .th-shelf > .th-card.cover-wide{
        flex-basis:calc((100% - (5 * 16px)) / 4.2);
    }

    .th-shelf{
        gap:16px;
    }

    .th-shelf-arrow{
        width:40px;
        height:40px;
    }
}

/* Mobile = about 3.5 covers visible */
@media (max-width: 640px){
    .th-shelf{
        gap:14px;
        padding-right:18px;
    }

    .th-shelf > .th-card{
        flex-basis:calc((100% - (3 * 14px)) / 3.5);
        padding:10px;
    }

    .th-shelf > .th-card.cover-wide{
        flex-basis:calc((100% - (3 * 14px)) / 2.4);
    }

    .th-shelf .th-card-title{
        font-size:15px;
    }

    .th-shelf .th-card-category,
    .th-shelf .th-card-language,
    .th-shelf .th-card-author,
    .th-shelf .th-rating-row,
    .th-shelf .th-card-price{
        font-size:14px;
    }

    .th-shelf-arrow{
        width:34px;
        height:34px;
        font-size:24px;
        top:30%;
    }

    .th-shelf-prev{ left:-6px; }
    .th-shelf-next{ right:-6px; }
}


/* ===== v1.7 Amazon Kindle UI / UX upgrade ===== */

/* Hard fix for oversized shelf cards */
.th-shelf{
    align-items: flex-start;
}

.th-shelf > .th-card{
    flex: 0 0 180px !important;
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
    box-sizing: border-box;
}

.th-shelf > .th-card.cover-wide{
    flex: 0 0 240px !important;
    width: 240px !important;
    min-width: 240px !important;
    max-width: 240px !important;
}

.th-shelf .th-card .th-card-image{
    width: 100%;
    overflow: hidden;
    border-radius: 6px;
}

.th-shelf .th-card .th-card-image img{
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 5 / 8 !important;
    object-fit: cover !important;
    display: block;
    transition: transform .25s ease, filter .25s ease;
}

.th-shelf .th-card.cover-wide .th-card-image img{
    aspect-ratio: 16 / 9 !important;
}

/* Better Amazon-like shelf card body */
.th-shelf .th-card{
    border-radius: 8px;
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.th-shelf .th-card:hover{
    transform: translateY(-4px);
    box-shadow: 0 10px 22px rgba(0,0,0,.10);
    border-color: #b7c6c3;
}

.th-shelf .th-card:hover .th-card-image img{
    transform: scale(1.03);
}

/* Bestseller / featured ribbon helper */
.th-card-ribbon{
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    background: #ff9900;
    color: #111;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 6px 8px;
    border-radius: 999px;
    text-transform: uppercase;
}

/* Cleaner section header spacing */
.th-section-header{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:16px;
    margin-bottom: 14px;
}

.th-section-header h2{
    margin-bottom: 2px;
}

/* Make show all feel closer to marketplace links */
.th-section-header .th-show-all,
.th-show-all{
    white-space: nowrap;
    font-weight: 600;
}

/* arrows nicer and auto-hidden until hover desktop */
@media (min-width: 1025px){
    .th-shelf-arrow{
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease, transform .2s ease;
    }

    .th-shelf-wrap:hover .th-shelf-arrow{
        opacity: 1;
        pointer-events: auto;
    }
}

/* Tablet target: around 5.5 visible */
@media (max-width: 1024px){
    .th-shelf > .th-card{
        flex: 0 0 148px !important;
        width: 148px !important;
        min-width: 148px !important;
        max-width: 148px !important;
    }

    .th-shelf > .th-card.cover-wide{
        flex: 0 0 210px !important;
        width: 210px !important;
        min-width: 210px !important;
        max-width: 210px !important;
    }
}

/* Mobile target: around 3.5 visible */
@media (max-width: 640px){
    .th-shelf{
        gap: 12px;
    }

    .th-shelf > .th-card{
        flex: 0 0 112px !important;
        width: 112px !important;
        min-width: 112px !important;
        max-width: 112px !important;
        padding: 8px;
    }

    .th-shelf > .th-card.cover-wide{
        flex: 0 0 182px !important;
        width: 182px !important;
        min-width: 182px !important;
        max-width: 182px !important;
    }

    .th-shelf .th-card-title{
        font-size: 14px;
    }

    .th-shelf .th-card-category,
    .th-shelf .th-card-language,
    .th-shelf .th-card-author,
    .th-shelf .th-rating-row,
    .th-shelf .th-card-price{
        font-size: 13px;
    }
}

/* fallback for older grid wrappers if any remain */
.th-grid-3,
.th-grid-4,
.th-grid-5{
    display:flex;
    gap:18px;
    overflow-x:auto;
    scrollbar-width:none;
}
.th-grid-3::-webkit-scrollbar,
.th-grid-4::-webkit-scrollbar,
.th-grid-5::-webkit-scrollbar{
    display:none;
}
.th-grid-3 > *,
.th-grid-4 > *,
.th-grid-5 > *{
    flex:0 0 180px;
    min-width:180px;
    max-width:180px;
}


/* ===== v1.7.1 hard shelf width fix ===== */
/* Force homepage shelves to stay horizontal and never expand cards full width */
.th-shelf,
.th-grid-3,
.th-grid-4,
.th-grid-5{
    display:flex !important;
    flex-wrap:nowrap !important;
    align-items:flex-start !important;
    overflow-x:auto !important;
    overflow-y:hidden !important;
    gap:18px !important;
    width:100% !important;
    white-space:normal !important;
    scrollbar-width:none;
}

.th-shelf::-webkit-scrollbar,
.th-grid-3::-webkit-scrollbar,
.th-grid-4::-webkit-scrollbar,
.th-grid-5::-webkit-scrollbar{
    display:none;
}

/* Apply fixed shelf card width to every direct child, not only .th-card */
.th-shelf > *,
.th-grid-3 > *,
.th-grid-4 > *,
.th-grid-5 > *{
    flex:0 0 180px !important;
    width:180px !important;
    min-width:180px !important;
    max-width:180px !important;
    box-sizing:border-box !important;
}

/* Wide cards for magazine/audio/read sections */
.th-shelf > *.cover-wide,
.th-grid-3 > *.cover-wide,
.th-grid-4 > *.cover-wide,
.th-grid-5 > *.cover-wide{
    flex:0 0 240px !important;
    width:240px !important;
    min-width:240px !important;
    max-width:240px !important;
}

/* Make image area obey card width */
.th-shelf > * .th-card-image,
.th-grid-3 > * .th-card-image,
.th-grid-4 > * .th-card-image,
.th-grid-5 > * .th-card-image{
    display:block !important;
    width:100% !important;
    overflow:hidden !important;
    border-radius:6px !important;
}

.th-shelf > * .th-card-image img,
.th-grid-3 > * .th-card-image img,
.th-grid-4 > * .th-card-image img,
.th-grid-5 > * .th-card-image img{
    display:block !important;
    width:100% !important;
    max-width:100% !important;
    height:auto !important;
    aspect-ratio:5/8 !important;
    object-fit:cover !important;
}

.th-shelf > *.cover-wide .th-card-image img,
.th-grid-3 > *.cover-wide .th-card-image img,
.th-grid-4 > *.cover-wide .th-card-image img,
.th-grid-5 > *.cover-wide .th-card-image img{
    aspect-ratio:16/9 !important;
}

/* Desktop target ≈ 7.5 visible */
@media (min-width:1025px){
    .th-shelf > *,
    .th-grid-3 > *,
    .th-grid-4 > *,
    .th-grid-5 > *{
        flex-basis:180px !important;
        width:180px !important;
        min-width:180px !important;
        max-width:180px !important;
    }
}

/* Tablet target ≈ 5.5 visible */
@media (max-width:1024px){
    .th-shelf,
    .th-grid-3,
    .th-grid-4,
    .th-grid-5{
        gap:16px !important;
    }

    .th-shelf > *,
    .th-grid-3 > *,
    .th-grid-4 > *,
    .th-grid-5 > *{
        flex:0 0 148px !important;
        width:148px !important;
        min-width:148px !important;
        max-width:148px !important;
    }

    .th-shelf > *.cover-wide,
    .th-grid-3 > *.cover-wide,
    .th-grid-4 > *.cover-wide,
    .th-grid-5 > *.cover-wide{
        flex:0 0 210px !important;
        width:210px !important;
        min-width:210px !important;
        max-width:210px !important;
    }
}

/* Mobile target ≈ 3.5 visible */
@media (max-width:640px){
    .th-shelf,
    .th-grid-3,
    .th-grid-4,
    .th-grid-5{
        gap:12px !important;
    }

    .th-shelf > *,
    .th-grid-3 > *,
    .th-grid-4 > *,
    .th-grid-5 > *{
        flex:0 0 112px !important;
        width:112px !important;
        min-width:112px !important;
        max-width:112px !important;
    }

    .th-shelf > *.cover-wide,
    .th-grid-3 > *.cover-wide,
    .th-grid-4 > *.cover-wide,
    .th-grid-5 > *.cover-wide{
        flex:0 0 182px !important;
        width:182px !important;
        min-width:182px !important;
        max-width:182px !important;
    }
}


/* ===== v1.7.2 homepage shelf structure fix ===== */
.th-shelf{
  display:flex !important;
  flex-wrap:nowrap !important;
  overflow-x:auto !important;
  overflow-y:hidden !important;
  gap:18px !important;
  align-items:flex-start !important;
  scrollbar-width:none;
}
.th-shelf::-webkit-scrollbar{display:none}

.th-shelf-item{
  flex:0 0 180px !important;
  width:180px !important;
  min-width:180px !important;
  max-width:180px !important;
}
.th-shelf-item.is-wide{
  flex:0 0 240px !important;
  width:240px !important;
  min-width:240px !important;
  max-width:240px !important;
}

.th-shelf-item > .th-card{
  width:100% !important;
  min-width:0 !important;
  max-width:none !important;
}

.th-shelf-item .th-card-image,
.th-shelf-item .th-card-image img{
  width:100% !important;
}
.th-shelf-item .th-card-image img{
  aspect-ratio:5/8 !important;
  object-fit:cover !important;
}
.th-shelf-item.is-wide .th-card-image img{
  aspect-ratio:16/9 !important;
}

@media (max-width:1024px){
  .th-shelf{gap:16px !important}
  .th-shelf-item{
    flex-basis:148px !important;
    width:148px !important;
    min-width:148px !important;
    max-width:148px !important;
  }
  .th-shelf-item.is-wide{
    flex-basis:210px !important;
    width:210px !important;
    min-width:210px !important;
    max-width:210px !important;
  }
}
@media (max-width:640px){
  .th-shelf{gap:12px !important}
  .th-shelf-item{
    flex-basis:112px !important;
    width:112px !important;
    min-width:112px !important;
    max-width:112px !important;
  }
  .th-shelf-item.is-wide{
    flex-basis:182px !important;
    width:182px !important;
    min-width:182px !important;
    max-width:182px !important;
  }
}


/* ===== v1.7.3 homepage shelf hard repair ===== */
.home .th-shelf{
  display:flex !important;
  flex-wrap:nowrap !important;
  overflow-x:auto !important;
  overflow-y:hidden !important;
  gap:18px !important;
  align-items:flex-start !important;
  scrollbar-width:none;
}
.home .th-shelf::-webkit-scrollbar{display:none;}

.home .th-shelf-item{
  box-sizing:border-box !important;
}
.home .th-shelf-item > .th-card{
  width:100% !important;
  min-width:0 !important;
  max-width:none !important;
}
.home .th-shelf-item .th-card-image{
  width:100% !important;
  overflow:hidden !important;
}
.home .th-shelf-item .th-card-image img{
  width:100% !important;
  max-width:100% !important;
  aspect-ratio:5/8 !important;
  object-fit:cover !important;
  display:block !important;
}
.home .th-shelf-item.is-wide .th-card-image img{
  aspect-ratio:16/9 !important;
}
@media (max-width:1024px){
  .home .th-shelf{gap:16px !important;}
}
@media (max-width:640px){
  .home .th-shelf{gap:12px !important;}
}


/* ===== v2.0 real homepage shelf rebuild ===== */
.home .th-shelf,
.home .th-grid-3,
.home .th-grid-4,
.home .th-grid-5{
    display:flex !important;
    flex-direction:row !important;
    flex-wrap:nowrap !important;
    align-items:flex-start !important;
    justify-content:flex-start !important;
    gap:18px !important;
    overflow-x:auto !important;
    overflow-y:hidden !important;
    width:100% !important;
    max-width:100% !important;
    white-space:normal !important;
    scrollbar-width:none !important;
}

.home .th-shelf::-webkit-scrollbar,
.home .th-grid-3::-webkit-scrollbar,
.home .th-grid-4::-webkit-scrollbar,
.home .th-grid-5::-webkit-scrollbar{
    display:none !important;
}

.home .th-shelf > *,
.home .th-grid-3 > *,
.home .th-grid-4 > *,
.home .th-grid-5 > *{
    flex:0 0 180px !important;
    width:180px !important;
    min-width:180px !important;
    max-width:180px !important;
    display:block !important;
    box-sizing:border-box !important;
}

.home .th-shelf > *.is-wide,
.home .th-grid-3 > *.is-wide,
.home .th-grid-4 > *.is-wide,
.home .th-grid-5 > *.is-wide,
.home .th-shelf > *.cover-wide,
.home .th-grid-3 > *.cover-wide,
.home .th-grid-4 > *.cover-wide,
.home .th-grid-5 > *.cover-wide{
    flex:0 0 240px !important;
    width:240px !important;
    min-width:240px !important;
    max-width:240px !important;
}

.home .th-shelf > * .th-card,
.home .th-grid-3 > * .th-card,
.home .th-grid-4 > * .th-card,
.home .th-grid-5 > * .th-card{
    width:100% !important;
    min-width:0 !important;
    max-width:none !important;
    display:block !important;
}

.home .th-shelf > * .th-card-image,
.home .th-grid-3 > * .th-card-image,
.home .th-grid-4 > * .th-card-image,
.home .th-grid-5 > * .th-card-image{
    display:block !important;
    width:100% !important;
    overflow:hidden !important;
    border-radius:6px !important;
}

.home .th-shelf > * .th-card-image img,
.home .th-grid-3 > * .th-card-image img,
.home .th-grid-4 > * .th-card-image img,
.home .th-grid-5 > * .th-card-image img,
.home .th-shelf > * img,
.home .th-grid-3 > * img,
.home .th-grid-4 > * img,
.home .th-grid-5 > * img{
    width:100% !important;
    max-width:100% !important;
    height:auto !important;
    aspect-ratio:5/8 !important;
    object-fit:cover !important;
    display:block !important;
}

.home .th-shelf > *.is-wide .th-card-image img,
.home .th-grid-3 > *.is-wide .th-card-image img,
.home .th-grid-4 > *.is-wide .th-card-image img,
.home .th-grid-5 > *.is-wide .th-card-image img,
.home .th-shelf > *.cover-wide .th-card-image img,
.home .th-grid-3 > *.cover-wide .th-card-image img,
.home .th-grid-4 > *.cover-wide .th-card-image img,
.home .th-grid-5 > *.cover-wide .th-card-image img{
    aspect-ratio:16/9 !important;
}

@media (max-width:1024px){
    .home .th-shelf,
    .home .th-grid-3,
    .home .th-grid-4,
    .home .th-grid-5{
        gap:16px !important;
    }

    .home .th-shelf > *,
    .home .th-grid-3 > *,
    .home .th-grid-4 > *,
    .home .th-grid-5 > *{
        flex:0 0 148px !important;
        width:148px !important;
        min-width:148px !important;
        max-width:148px !important;
    }

    .home .th-shelf > *.is-wide,
    .home .th-grid-3 > *.is-wide,
    .home .th-grid-4 > *.is-wide,
    .home .th-grid-5 > *.is-wide,
    .home .th-shelf > *.cover-wide,
    .home .th-grid-3 > *.cover-wide,
    .home .th-grid-4 > *.cover-wide,
    .home .th-grid-5 > *.cover-wide{
        flex:0 0 210px !important;
        width:210px !important;
        min-width:210px !important;
        max-width:210px !important;
    }
}

@media (max-width:640px){
    .home .th-shelf,
    .home .th-grid-3,
    .home .th-grid-4,
    .home .th-grid-5{
        gap:12px !important;
    }

    .home .th-shelf > *,
    .home .th-grid-3 > *,
    .home .th-grid-4 > *,
    .home .th-grid-5 > *{
        flex:0 0 115px !important;
        width:115px !important;
        min-width:115px !important;
        max-width:115px !important;
    }

    .home .th-shelf > *.is-wide,
    .home .th-grid-3 > *.is-wide,
    .home .th-grid-4 > *.is-wide,
    .home .th-grid-5 > *.is-wide,
    .home .th-shelf > *.cover-wide,
    .home .th-grid-3 > *.cover-wide,
    .home .th-grid-4 > *.cover-wide,
    .home .th-grid-5 > *.cover-wide{
        flex:0 0 182px !important;
        width:182px !important;
        min-width:182px !important;
        max-width:182px !important;
    }
}


/* ===== v2.1 isolated homepage shelves ===== */
.home .ts-home-section{position:relative;}
.home .ts-shelf-wrap{position:relative;}
.home .ts-shelf-track{
  display:flex !important;
  flex-direction:row !important;
  flex-wrap:nowrap !important;
  align-items:flex-start !important;
  gap:18px !important;
  overflow-x:auto !important;
  overflow-y:hidden !important;
  width:100% !important;
  max-width:100% !important;
  padding:4px 8px 12px 0 !important;
  margin:0 !important;
  scrollbar-width:none;
  -ms-overflow-style:none;
}
.home .ts-shelf-track::-webkit-scrollbar{display:none;}

.home .ts-shelf-item{
  flex:0 0 180px !important;
  width:180px !important;
  min-width:180px !important;
  max-width:180px !important;
  box-sizing:border-box !important;
  margin:0 !important;
}
.home .ts-shelf-item.is-wide{
  flex:0 0 240px !important;
  width:240px !important;
  min-width:240px !important;
  max-width:240px !important;
}
.home .ts-shelf-item > article{
  width:100% !important;
  min-width:0 !important;
  max-width:none !important;
}
.home .ts-shelf-item .th-card{
  border:1px solid #d5dddb;
  background:#fff;
  padding:12px;
  border-radius:8px;
}
.home .ts-shelf-item .th-card-image{
  display:block !important;
  width:100% !important;
  overflow:hidden !important;
  border-radius:6px !important;
}
.home .ts-shelf-item .th-card-image img{
  width:100% !important;
  max-width:100% !important;
  height:auto !important;
  display:block !important;
  aspect-ratio:5 / 8 !important;
  object-fit:cover !important;
}
.home .ts-shelf-item.is-wide .th-card-image img{
  aspect-ratio:16 / 9 !important;
}
.home .ts-shelf-item .th-card-title{font-size:16px; line-height:1.25; margin:.45rem 0;}
.home .ts-shelf-item .th-card-category,
.home .ts-shelf-item .th-card-language,
.home .ts-shelf-item .th-card-author,
.home .ts-shelf-item .th-rating-row,
.home .ts-shelf-item .th-card-price{font-size:15px;}

.home .ts-shelf-arrow{
  position:absolute;
  top:34%;
  transform:translateY(-50%);
  width:40px;
  height:40px;
  border:1px solid #cbd4d2;
  background:#fff;
  color:#243e57;
  border-radius:999px;
  box-shadow:0 6px 16px rgba(0,0,0,.12);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:28px;
  line-height:1;
  cursor:pointer;
  z-index:3;
}
.home .ts-shelf-prev{left:-8px;}
.home .ts-shelf-next{right:-8px;}
.home .ts-shelf-arrow[disabled]{opacity:.35; cursor:default;}

@media (max-width:1024px){
  .home .ts-shelf-track{gap:16px !important;}
  .home .ts-shelf-item{
    flex:0 0 148px !important;
    width:148px !important;
    min-width:148px !important;
    max-width:148px !important;
  }
  .home .ts-shelf-item.is-wide{
    flex:0 0 210px !important;
    width:210px !important;
    min-width:210px !important;
    max-width:210px !important;
  }
}
@media (max-width:640px){
  .home .ts-shelf-track{gap:12px !important;}
  .home .ts-shelf-item{
    flex:0 0 115px !important;
    width:115px !important;
    min-width:115px !important;
    max-width:115px !important;
  }
  .home .ts-shelf-item.is-wide{
    flex:0 0 182px !important;
    width:182px !important;
    min-width:182px !important;
    max-width:182px !important;
  }
  .home .ts-shelf-item .th-card{padding:8px;}
  .home .ts-shelf-item .th-card-title{font-size:14px;}
  .home .ts-shelf-item .th-card-category,
  .home .ts-shelf-item .th-card-language,
  .home .ts-shelf-item .th-card-author,
  .home .ts-shelf-item .th-rating-row,
  .home .ts-shelf-item .th-card-price{font-size:13px;}
  .home .ts-shelf-arrow{
    width:32px;
    height:32px;
    font-size:22px;
    top:28%;
  }
}

/* ensure old shelf classes on homepage do not interfere */
.home .th-shelf,
.home .th-grid-3,
.home .th-grid-4,
.home .th-grid-5{
  display:block !important;
}


/* ===== v4.0.6 mobile menu ===== */
.th-mobile-menu-btn{display:none;border:none;background:transparent;font-size:28px;cursor:pointer;color:var(--dark);padding:4px 8px;line-height:1}
.th-mobile-drawer{position:fixed;inset:0;z-index:9999;display:none}
.th-mobile-drawer.is-open{display:block}
.th-mobile-drawer-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.42)}
.th-mobile-drawer-panel{position:absolute;left:0;top:0;bottom:0;width:min(320px,86vw);background:#fff;padding:18px 18px 24px;box-shadow:8px 0 24px rgba(0,0,0,.18);overflow:auto}
.th-mobile-drawer-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}
.th-mobile-menu-close{border:none;background:transparent;font-size:34px;line-height:1;cursor:pointer;color:var(--dark)}
.th-mobile-nav{display:flex;flex-direction:column;gap:4px}
.th-mobile-nav a{padding:12px 10px;border-radius:10px;font-weight:700;color:var(--dark)}
.th-mobile-nav a.is-active{background:#eef3f5}
@media (max-width: 900px){
  .th-mobile-menu-btn{display:inline-flex;align-items:center;justify-content:center}
  .th-primary-nav{display:none}
  .th-header-left{gap:14px}
}
@media (max-width: 640px){
  .th-header-right .th-outline-btn{display:none}
  .th-header-right{gap:8px}
  .th-site-logo img{max-height:48px}
}


/* ===== v4.0.7 clean rebuild: remove listing filters ===== */
.th-filter-panel,
.th-filter-sidebar,
.library-filter,
.filter-panel,
.th-listing-layout--no-filters .th-filter-panel{
  display:none !important;
}
.th-listing-layout--no-filters{
  display:block !important;
}
.th-listing-layout--no-filters .th-cards-wrap{
  width:100% !important;
  max-width:100% !important;
}


/* ===== v4.0.8 force remove all listing filters ===== */
.th-filter-panel,
.th-filter-sidebar,
.library-filter,
.filter-panel,
.th-filter-box,
.th-filter-list,
.th-listing-layout > aside,
.th-listing-layout [class*="filter"],
.th-listing-layout [id*="filter"]{
  display:none !important;
  visibility:hidden !important;
  opacity:0 !important;
  pointer-events:none !important;
  width:0 !important;
  max-width:0 !important;
  height:0 !important;
  overflow:hidden !important;
  margin:0 !important;
  padding:0 !important;
  border:0 !important;
}

/* clean full-width listing page */
.th-listing-layout,
.th-listing-layout--no-filters{
  display:block !important;
  grid-template-columns:none !important;
}
.th-cards-wrap{
  width:100% !important;
  max-width:100% !important;
  display:grid !important;
  grid-template-columns:repeat(4,minmax(0,1fr)) !important;
  gap:24px !important;
}
@media (max-width:1024px){
  .th-cards-wrap{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:18px !important;
  }
}
@media (max-width:640px){
  .th-cards-wrap{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:14px !important;
  }
}


/* v4.1.1 grid 8 / 5 / 3 */
.th-cards-wrap{
  display:grid !important;
  grid-template-columns:repeat(8,minmax(0,1fr)) !important;
  gap:22px !important;
}
@media (max-width:1024px){
  .th-cards-wrap{
    grid-template-columns:repeat(5,minmax(0,1fr)) !important;
    gap:18px !important;
  }
}
@media (max-width:640px){
  .th-cards-wrap{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:14px !important;
  }
}


/* v4.1.3 desktop duplicate logo fix */
.th-mobile-drawer{display:none !important}
.th-mobile-drawer.is-open{display:block !important}
@media (min-width: 901px){
  .th-mobile-drawer,
  .th-mobile-drawer.is-open{
    display:none !important;
    visibility:hidden !important;
    opacity:0 !important;
    pointer-events:none !important;
  }
}


/* v4.1.4 drawer hidden attribute fix */
.th-mobile-drawer[hidden]{
  display:none !important;
}
.th-mobile-drawer{
  display:none !important;
}
.th-mobile-drawer.is-open{
  display:block !important;
}
@media (min-width: 901px){
  .th-mobile-menu-btn{
    display:none !important;
  }
  .th-mobile-drawer,
  .th-mobile-drawer.is-open,
  .th-mobile-drawer[hidden]{
    display:none !important;
    visibility:hidden !important;
  }
}


/* ===== v4.1.5 header clean + search modal ===== */
.th-search-trigger{font-size:28px}
.th-search-modal[hidden]{display:none !important}
.th-search-modal{position:fixed;inset:0;z-index:99999}
.th-search-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.42)}
.th-search-dialog{
  position:relative;
  width:min(680px, calc(100vw - 32px));
  margin:84px auto 0;
  background:#fff;
  border-radius:18px;
  padding:24px;
  box-shadow:0 18px 40px rgba(0,0,0,.18);
}
.th-search-dialog h3{margin:0 0 16px;font-size:28px;color:var(--dark)}
.th-search-close{
  position:absolute;right:14px;top:10px;border:none;background:transparent;
  font-size:34px;line-height:1;cursor:pointer;color:var(--dark);
}
.th-search-form{display:flex;gap:12px;align-items:center}
.th-search-form input{
  flex:1;min-width:0;border:1px solid #cdd6d5;border-radius:12px;
  padding:14px 16px;font-size:16px;
}
.th-search-form button{
  border:none;background:var(--dark);color:#fff;border-radius:12px;
  padding:14px 20px;font-weight:700;cursor:pointer;
}
.th-search-quick-links{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
.th-search-quick-links a{
  background:#eef3f5;border-radius:999px;padding:8px 12px;font-weight:700;color:var(--dark);
}

/* remove old header clutter and improve mobile */
@media (max-width: 900px){
  .th-header{padding:10px 0}
  .th-header-inner{gap:10px}
  .th-header-left{gap:10px !important;min-width:0}
  .th-site-logo img{max-height:38px !important}
  .th-header-right{gap:8px !important}
  .th-outline-btn{display:none !important}
}
@media (max-width: 640px){
  .th-container{width:min(100%, calc(100% - 24px)) !important}
  .th-header-inner{display:grid !important;grid-template-columns:auto 1fr auto;align-items:center !important}
  .th-header-left{min-width:0 !important}
  .th-site-logo{min-width:0}
  .th-site-logo img{max-height:30px !important}
  .th-header-right{justify-self:end}
  .th-icon-btn,.th-avatar-btn{font-size:22px !important}
  .th-search-dialog{margin-top:60px;padding:18px}
  .th-search-dialog h3{font-size:22px;padding-right:24px}
  .th-search-form{flex-direction:column;align-items:stretch}
  .th-search-form button{width:100%}
  .th-mobile-drawer-panel{width:min(300px,88vw) !important;padding:16px}
  .th-mobile-nav a{font-size:16px !important;padding:12px 10px !important}
}


/* v4.1.6 search modal fix */
.th-search-modal{
  display:none;
}
.th-search-modal[hidden]{
  display:none !important;
}
.th-search-modal[aria-hidden="false"]{
  display:block !important;
}


/* v4.1.7 robust search + mobile menu */
.th-mobile-drawer[hidden],
.th-search-modal[hidden]{display:none !important}
.th-mobile-drawer,
.th-search-modal{display:none}
.th-mobile-drawer.is-open,
.th-search-modal[aria-hidden="false"]{display:block !important}

.th-mobile-drawer{position:fixed;inset:0;z-index:99999}
.th-mobile-drawer-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.45)}
.th-mobile-drawer-panel{position:absolute;left:0;top:0;bottom:0;width:min(320px,88vw);background:#fff;padding:18px;box-shadow:8px 0 24px rgba(0,0,0,.18);overflow:auto}
.th-mobile-drawer-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.th-mobile-menu-close{border:none;background:transparent;font-size:34px;line-height:1;cursor:pointer;color:var(--dark)}
.th-mobile-nav{display:flex;flex-direction:column;gap:8px}
.th-mobile-nav a{display:block;padding:12px 10px;border-radius:10px;background:#f3f6f7;font-weight:700;color:var(--dark)}

.th-search-modal{position:fixed;inset:0;z-index:99999}
.th-search-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.45)}
.th-search-dialog{position:relative;width:min(680px,calc(100vw - 32px));margin:80px auto 0;background:#fff;border-radius:18px;padding:22px;box-shadow:0 18px 40px rgba(0,0,0,.18)}
.th-search-close{position:absolute;right:14px;top:10px;border:none;background:transparent;font-size:34px;cursor:pointer;color:var(--dark)}
.th-search-form{display:flex;gap:10px;align-items:center}
.th-search-form input{flex:1;min-width:0;border:1px solid #cdd6d5;border-radius:12px;padding:14px 16px;font-size:16px}
.th-search-form button{border:none;background:var(--dark);color:#fff;border-radius:12px;padding:14px 20px;font-weight:700;cursor:pointer}
.th-search-quick-links{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
.th-search-quick-links a{background:#eef3f5;border-radius:999px;padding:8px 12px;font-weight:700;color:var(--dark)}

@media (max-width:900px){
  .th-primary-nav{display:none !important}
  .th-mobile-menu-btn{display:inline-flex !important;align-items:center;justify-content:center;border:none;background:#f3f3f3;padding:8px 12px;border-radius:10px;font-size:22px;cursor:pointer}
}
@media (max-width:640px){
  .th-header{padding:10px 0}
  .th-container{width:min(100%,calc(100% - 20px)) !important}
  .th-header-inner{display:grid !important;grid-template-columns:auto 1fr auto !important;gap:10px !important;align-items:center !important}
  .th-header-left{display:flex !important;align-items:center !important;gap:10px !important;min-width:0 !important}
  .th-site-logo img{max-height:30px !important;width:auto !important}
  .th-header-right{display:flex !important;align-items:center !important;gap:8px !important}
  .th-user-name{display:none !important}
  .th-user-avatar{width:38px !important;height:38px !important}
  .th-icon-btn,.th-avatar-btn{font-size:22px !important}
  .th-search-dialog{width:min(100vw - 20px, 680px);margin-top:55px;padding:18px}
  .th-search-form{flex-direction:column;align-items:stretch}
  .th-search-form button{width:100%}
}


/* v4.1.8 mobile menu final */
#th-mobile-drawer[hidden]{display:none !important}
#th-mobile-drawer{
  position:fixed;
  inset:0;
  z-index:999999;
  display:none;
}
#th-mobile-drawer .th-mobile-drawer-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.45);
}
#th-mobile-drawer .th-mobile-drawer-panel{
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width:min(320px,88vw);
  background:#fff;
  padding:18px 16px 20px;
  box-shadow:8px 0 24px rgba(0,0,0,.18);
  overflow:auto;
}
#th-mobile-drawer .th-mobile-drawer-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}
#th-mobile-drawer .th-mobile-menu-close{
  border:none;
  background:transparent;
  font-size:34px;
  line-height:1;
  cursor:pointer;
  color:var(--dark);
}
#th-mobile-drawer .th-mobile-nav{
  display:flex;
  flex-direction:column;
  gap:8px;
}
#th-mobile-drawer .th-mobile-nav a{
  display:block;
  padding:12px 12px;
  border-radius:10px;
  background:#f2f5f6;
  font-weight:700;
  color:var(--dark);
}
@media (min-width:901px){
  .th-mobile-menu-btn{display:none !important}
  #th-mobile-drawer{display:none !important}
}
@media (max-width:900px){
  .th-primary-nav{display:none !important}
  .th-mobile-menu-btn{
    display:inline-flex !important;
    align-items:center;
    justify-content:center;
    width:42px;
    height:42px;
    border:none;
    border-radius:12px;
    background:#f1f1f1;
    font-size:22px;
    line-height:1;
    cursor:pointer;
  }
}
@media (max-width:640px){
  .th-header{padding:10px 0}
  .th-container{width:min(100%, calc(100% - 20px)) !important}
  .th-header-inner{
    display:grid !important;
    grid-template-columns:auto 1fr auto !important;
    gap:10px !important;
    align-items:center !important;
  }
  .th-header-left{
    display:flex !important;
    align-items:center !important;
    gap:10px !important;
    min-width:0 !important;
  }
  .th-site-logo img{
    max-height:30px !important;
    width:auto !important;
  }
  .th-header-right{
    display:flex !important;
    align-items:center !important;
    gap:8px !important;
  }
  .th-user-name{display:none !important}
  .th-user-avatar{width:38px !important;height:38px !important}
  .th-icon-btn,.th-avatar-btn{font-size:22px !important}
  .th-search-dialog{
    width:min(100vw - 20px, 680px);
    margin-top:55px;
    padding:18px;
  }
  .th-search-form{flex-direction:column;align-items:stretch}
  .th-search-form button{width:100%}
}


/* v4.1.9 no-JS mobile menu */
.th-mobile-menu-details{display:none;position:relative}
.th-mobile-menu-details summary{list-style:none}
.th-mobile-menu-details summary::-webkit-details-marker{display:none}
.th-mobile-menu-sheet{
  position:absolute;
  top:calc(100% + 10px);
  left:0;
  width:min(320px, 88vw);
  background:#fff;
  border:1px solid #d7dede;
  border-radius:16px;
  box-shadow:0 16px 36px rgba(0,0,0,.16);
  padding:14px;
  z-index:99999;
}
.th-mobile-menu-logo{margin-bottom:10px}
.th-mobile-menu-logo img{max-height:30px;width:auto}
.th-mobile-menu-links{display:flex;flex-direction:column;gap:8px}
.th-mobile-menu-links a{
  display:block;
  padding:12px 12px;
  border-radius:10px;
  background:#f2f5f6;
  font-weight:700;
  color:var(--dark);
}
@media (min-width:901px){
  .th-mobile-menu-details{display:none !important}
}
@media (max-width:900px){
  .th-primary-nav{display:none !important}
  .th-mobile-menu-details{display:block !important}
  .th-mobile-menu-btn{
    display:inline-flex !important;
    align-items:center;
    justify-content:center;
    width:42px;
    height:42px;
    border:none;
    border-radius:12px;
    background:#f1f1f1;
    font-size:22px;
    line-height:1;
    cursor:pointer;
    user-select:none;
  }
}
@media (max-width:640px){
  .th-header{padding:10px 0}
  .th-container{width:min(100%, calc(100% - 20px)) !important}
  .th-header-inner{
    display:grid !important;
    grid-template-columns:auto 1fr auto !important;
    gap:10px !important;
    align-items:center !important;
  }
  .th-header-left{
    display:flex !important;
    align-items:center !important;
    gap:10px !important;
    min-width:0 !important;
  }
  .th-site-logo img{
    max-height:30px !important;
    width:auto !important;
  }
  .th-header-right{
    display:flex !important;
    align-items:center !important;
    gap:8px !important;
  }
  .th-user-name{display:none !important}
  .th-user-avatar{width:38px !important;height:38px !important}
  .th-icon-btn,.th-avatar-btn{font-size:22px !important}
}


/* v4.2.0 details mobile menu visibility fix */
.th-mobile-menu-details{display:none;position:relative}
.th-mobile-menu-details summary{list-style:none}
.th-mobile-menu-details summary::-webkit-details-marker{display:none}
.th-mobile-menu-sheet{display:none !important}
.th-mobile-menu-details[open] .th-mobile-menu-sheet{display:block !important}

@media (max-width:900px){
  .th-header-inner{
    display:grid !important;
    grid-template-columns:auto 1fr auto !important;
    align-items:center !important;
    gap:10px !important;
  }
  .th-header-left{
    display:flex !important;
    align-items:center !important;
    gap:10px !important;
    min-width:0 !important;
  }
  .th-header-right{
    display:flex !important;
    align-items:center !important;
    gap:10px !important;
    justify-self:end !important;
  }
  .th-mobile-menu-details{display:block !important}
  .th-primary-nav{display:none !important}
  .th-site-logo img{max-height:30px !important;width:auto !important}
  .th-user-name{display:none !important}
  .th-user-avatar{width:38px !important;height:38px !important}
  .th-mobile-menu-btn{
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    width:42px !important;
    height:42px !important;
    border:none !important;
    border-radius:12px !important;
    background:#f1f1f1 !important;
    font-size:22px !important;
    line-height:1 !important;
    cursor:pointer !important;
  }
  .th-mobile-menu-sheet{
    position:absolute !important;
    top:calc(100% + 10px) !important;
    left:0 !important;
    width:min(320px, 88vw) !important;
    background:#fff !important;
    border:1px solid #d7dede !important;
    border-radius:16px !important;
    box-shadow:0 16px 36px rgba(0,0,0,.16) !important;
    padding:14px !important;
    z-index:99999 !important;
  }
  .th-mobile-menu-logo{margin-bottom:10px}
  .th-mobile-menu-logo img{max-height:28px !important;width:auto !important}
  .th-mobile-menu-links{
    display:flex !important;
    flex-direction:column !important;
    gap:8px !important;
  }
  .th-mobile-menu-links a{
    display:block !important;
    padding:12px 12px !important;
    border-radius:10px !important;
    background:#f2f5f6 !important;
    font-weight:700 !important;
    color:var(--dark) !important;
  }
}
@media (max-width:640px){
  .th-header{padding:10px 0 !important}
  .th-container{width:min(100%, calc(100% - 20px)) !important}
  .th-icon-btn,.th-avatar-btn{font-size:22px !important}
}
