/* TheMostHub คลังข้อสอบ */
.tmh-exam-app{
  --tmh-maroon:#8b1a1a; --tmh-maroon-d:#6f1313; --tmh-maroon-l:#a82222;
  --tmh-navy:#1b2f63; --tmh-cyan:#1aa6e0; --tmh-cyan-d:#138fc4;
  --tmh-text:#1f2a44; --tmh-muted:#7a8399; --tmh-line:#e8ebf1;
  --tmh-chip:#eef1f6; --tmh-red-chip:#fdecec; --tmh-red:#c0262d;
  --tmh-blue-chip:#e7f1fd; --tmh-blue:#2b6fd1;
  font-family:'Prompt',system-ui,sans-serif; color:var(--tmh-text);
  background:var(--tmh-maroon); padding:18px; border-radius:6px;
  box-sizing:border-box; line-height:1.4;
}
.tmh-exam-app *,.tmh-exam-app *::before,.tmh-exam-app *::after{box-sizing:border-box}
.tmh-exam-app a{text-decoration:none!important;box-shadow:none!important}
.tmh-exam-app button{font-family:inherit}
.tmh-loading{color:#fff;padding:40px;text-align:center}

.tmh-layout{display:grid;grid-template-columns:260px 1fr;gap:22px;align-items:start}

/* ---------- Sidebar ---------- */
.tmh-side{background:#fff;border-radius:12px;padding:14px 12px 16px;position:sticky;top:46px}
.tmh-side-label{font-size:13px;font-weight:600;color:var(--tmh-muted);letter-spacing:.3px;padding:2px 10px 10px}
.tmh-cat{display:flex;align-items:center;gap:10px;width:100%;border:0;background:none;cursor:pointer;
  padding:10px 12px;border-radius:9px;font-size:15px;font-weight:500;color:var(--tmh-text);text-align:left;margin:2px 0;transition:background .15s}
.tmh-cat:hover{background:#f6f2f2}
.tmh-cat .tmh-caret{width:12px;font-size:10px;color:var(--tmh-muted);transition:transform .15s;flex:none}
.tmh-cat .tmh-caret.open{transform:rotate(90deg)}
.tmh-cat .tmh-ico{width:28px;height:28px;border-radius:7px;display:grid;place-items:center;font-size:13px;flex:none}
.tmh-cat .tmh-name{flex:1}
.tmh-count{font-size:12px;font-weight:600;min-width:30px;text-align:center;padding:2px 8px;border-radius:999px;background:var(--tmh-blue-chip);color:var(--tmh-blue)}
.tmh-cat.active{background:var(--tmh-maroon-l);color:#fff;box-shadow:0 4px 10px rgba(139,26,26,.35)}
.tmh-cat.active .tmh-caret{color:#fff}
.tmh-cat.active .tmh-ico{background:rgba(255,255,255,.18)!important;color:#fff!important}
.tmh-cat.active .tmh-count{background:rgba(255,255,255,.22);color:#fff}
.tmh-sub{margin:2px 0 6px 32px;border-left:2px solid var(--tmh-line);padding-left:6px}
.tmh-sub .tmh-cat{font-size:14px;font-weight:400;padding:8px 10px;color:#4a5570}
.tmh-sub .tmh-count{background:none;color:var(--tmh-muted);font-weight:400}
.tmh-sub .tmh-cat.active{background:#fbeaea;color:var(--tmh-maroon);box-shadow:none;font-weight:600}
.tmh-sub .tmh-cat.active .tmh-count{color:var(--tmh-maroon);background:none}
.tmh-side hr{border:0;border-top:1px solid var(--tmh-line);margin:10px 6px}

/* ---------- Main panel ---------- */
.tmh-main{background:#fff;border-radius:14px;padding:22px 26px 28px;border-top:4px solid var(--tmh-cyan);min-width:0}
.tmh-head{display:flex;align-items:center;gap:16px;padding-bottom:16px;border-bottom:1px solid var(--tmh-line);margin-bottom:20px;flex-wrap:wrap}
.tmh-head-ico{width:46px;height:46px;border-radius:50%;display:grid;place-items:center;font-size:18px;background:#eaf5fc;color:var(--tmh-cyan)}
.tmh-head h2{margin:0!important;font-size:20px!important;font-weight:700;color:var(--tmh-navy);flex:1;font-family:inherit!important;line-height:1.3}
.tmh-search{border:1px solid var(--tmh-line);border-radius:999px;padding:8px 16px;font:inherit;font-size:14px;width:230px;outline:none;background:#fafbfd}
.tmh-search:focus{border-color:var(--tmh-cyan);background:#fff}
.tmh-stat{font-size:14px;color:var(--tmh-muted);background:var(--tmh-chip);padding:6px 14px;border-radius:999px;white-space:nowrap}
.tmh-add{background:var(--tmh-maroon-l);color:#fff!important;font-size:14px;font-weight:600;padding:7px 14px;border-radius:999px}
.tmh-add:hover{background:var(--tmh-maroon)}

/* ---------- Cards ---------- */
.tmh-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:16px}
.tmh-card{position:relative;background:#fff;border:1px solid var(--tmh-line);border-radius:12px;padding:20px 16px 12px;
  box-shadow:0 2px 6px rgba(20,30,60,.05);transition:transform .15s,box-shadow .15s;overflow:hidden}
.tmh-card::before{content:"";position:absolute;inset:0 0 auto 0;height:4px;background:linear-gradient(90deg,var(--tmh-navy),var(--tmh-cyan))}
.tmh-card:hover{transform:translateY(-3px);box-shadow:0 10px 22px rgba(20,30,60,.12)}
.tmh-card.fav{border-color:#f3c64d}
.tmh-card-top{display:flex;gap:12px;align-items:flex-start}
.tmh-num{width:34px;height:34px;border-radius:50%;background:var(--tmh-navy);color:#fff;display:grid;place-items:center;font-size:13px;font-weight:600;flex:none;margin-top:2px}
.tmh-title{font-size:16px;font-weight:600;color:var(--tmh-navy);margin:0 0 4px;word-break:break-word;line-height:1.35}
.tmh-meta{display:flex;flex-wrap:wrap;gap:4px 12px;font-size:12.5px;color:var(--tmh-muted)}
.tmh-meta span{display:inline-flex;align-items:center;gap:4px}
.tmh-pills{display:flex;gap:6px;margin:12px 0 14px;flex-wrap:wrap}
.tmh-pill{font-size:12.5px;font-weight:600;padding:3px 10px;border-radius:999px}
.tmh-pill.year{background:var(--tmh-red-chip);color:var(--tmh-red)}
.tmh-pill.src{background:var(--tmh-blue-chip);color:var(--tmh-blue);font-size:11px;letter-spacing:.6px;padding:4px 9px}
.tmh-btns{display:flex;gap:8px;padding-bottom:12px;border-bottom:1px solid var(--tmh-line)}
.tmh-btn{display:inline-flex;align-items:center;gap:6px;font-size:14px;font-weight:600;padding:9px 14px;border-radius:9px;border:0;cursor:pointer;line-height:1.2}
.tmh-btn.dl{background:var(--tmh-cyan);color:#fff!important;box-shadow:0 3px 8px rgba(26,166,224,.3)}
.tmh-btn.dl:hover{background:var(--tmh-cyan-d)}
.tmh-btn.view{background:var(--tmh-chip);color:#6b7590!important;font-weight:500}
.tmh-btn.view:hover{background:#e2e6ee}
.tmh-tools{display:flex;justify-content:flex-end;gap:8px;padding-top:10px}
.tmh-tool{width:30px;height:30px;border-radius:8px;border:1px solid var(--tmh-line);background:#fff;display:grid;place-items:center;
  cursor:pointer;color:#3b4560;font-size:13px;padding:0}
.tmh-tool:hover{background:var(--tmh-chip)}
.tmh-tool.star.on{color:#e9a400;border-color:#f3c64d;background:#fff8e1}
.tmh-tool.del:hover{color:var(--tmh-red);border-color:#f2b8bb;background:var(--tmh-red-chip)}
.tmh-tool svg{width:14px;height:14px}
.tmh-empty{text-align:center;color:var(--tmh-muted);padding:50px 10px;grid-column:1/-1}

/* ---------- Mobile ---------- */
@media (max-width:860px){
  .tmh-exam-app{padding:10px}
  .tmh-layout{grid-template-columns:1fr;gap:12px}
  .tmh-side{position:static;max-height:300px;overflow-y:auto}
  .tmh-head h2{font-size:18px!important;min-width:120px}
  .tmh-main{padding:16px}
  .tmh-search{width:100%;order:5}
}

/* ---------- Full width (หลุดจากกรอบเนื้อหาของธีม) ---------- */
.tmh-exam-app.tmh-full{
  border-radius:0;padding:22px clamp(12px,1.6vw,28px)}
body:has(.tmh-full){overflow-x:hidden}
.entry-content:has(> .tmh-full),.entry-content:has(.tmh-full){max-width:none!important}
@media (min-width:1500px){.tmh-layout{grid-template-columns:270px 1fr}}

/* การ์ด/กรอบของธีมที่ห่อคลังข้อสอบ ให้โปร่งใส */
.tmh-host{background:transparent!important;box-shadow:none!important;border:0!important;padding:0!important;border-radius:0!important;overflow:visible!important;max-width:none!important}
.tmh-host::before,.tmh-host::after{display:none!important}
