/* Authoritative compact dialog layout; loaded after legacy card styles. */
.msph-modal{padding:18px;--msph-dialog-height:min(680px,calc(100dvh - 36px))}
.msph-modal [hidden]{display:none!important}
.msph-modal__dialog{display:grid;grid-template-rows:auto minmax(0,1fr);width:min(960px,94vw);height:var(--msph-dialog-height);max-height:var(--msph-dialog-height);overflow:hidden;border-radius:26px}
.msph-modal__loading{grid-row:1/-1;min-height:0;height:100%;background:linear-gradient(145deg,#f2f4ff,#fff);font-size:13px}
.msph-modal__skeleton{width:58%;height:55%;border-radius:20px;background:linear-gradient(100deg,#e3e8f6,#f5f7ff,#e3e8f6);background-size:200% 100%;animation:msphSkeleton 2.2s ease-in-out infinite}
@keyframes msphSkeleton{to{background-position:-200% 0}}
.msph-modal__content{grid-row:1/-1;display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);min-height:0;height:100%;overflow:hidden}
.msph-modal__content .msph-modal__media{width:100%;height:100%;min-height:0;max-height:none;margin:0;aspect-ratio:auto;border-radius:0;background:#edf1fa;align-self:stretch}
.msph-modal__content .msph-modal__media img{object-fit:contain;object-position:center}
.msph-modal__placeholder{text-align:center;padding:20px}.msph-modal__placeholder small{display:block;font-size:12px;color:#667396;line-height:1.8}
.msph-modal__main{display:flex;flex-direction:column;min-height:0;padding:42px 22px 18px;gap:10px;overflow:hidden}
.msph-modal__main h2{font-size:clamp(18px,2vw,25px);line-height:1.5;margin:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;flex:none}
.msph-modal__category{font-size:11px;flex:none}
.msph-modal__main .msph-prompt-box{display:flex;flex-direction:column;flex:1;min-height:0}
.msph-prompt-box__head{padding:10px 12px;flex:none}
.msph-modal__main .msph-prompt-box__text{padding:12px;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;font-size:12px;line-height:1.9;overflow-wrap:anywhere}
.msph-modal__actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:7px;margin:0;flex:none}
.msph-modal__actions .msph-btn{min-width:0;min-height:44px;padding:8px;font-size:11px;gap:6px;border-radius:11px;flex:none}
.msph-modal__stats{margin:0;padding-top:8px;font-size:10px;gap:10px;flex:none}
.msph-modal__close{width:44px;height:44px;top:8px;left:8px;font-size:16px}
.msph-modal__close>span{font-size:25px;line-height:1}
.msph-modal button:focus-visible{outline:2px solid #ff8300;outline-offset:2px}
@media(max-width:780px){
 .msph-modal{padding:10px;--msph-dialog-height:min(720px,calc(100dvh - 20px))}
 .msph-modal__dialog{width:min(480px,100%);border-radius:20px;grid-template-rows:minmax(0,1fr)}
 .msph-modal__content{grid-row:1;display:grid;grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) auto;min-height:0}
 .msph-modal__content .msph-modal__media{position:relative;inset:auto;display:grid;width:100%;height:100%;min-height:0;max-height:none;margin:0;aspect-ratio:auto;background:#f4f5fa}
 .msph-modal__content .msph-modal__media img{width:100%;height:100%;object-fit:contain;object-position:center}
 .msph-modal__main{height:auto;min-height:0;padding:8px 12px 12px;gap:5px;overflow:visible}
 .msph-modal__main h2{font-size:15px;line-height:1.45;margin:0;-webkit-line-clamp:2}
 .msph-modal__category{font-size:10px}
 .msph-modal__main .msph-prompt-box{display:none}
 .msph-modal__actions{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:4px}
 .msph-modal__stats{margin-top:0;padding-top:5px}
}
@media(max-width:780px) and (max-height:520px){.msph-modal__main{padding:6px 10px}.msph-modal__stats{display:none}.msph-modal__main h2{-webkit-line-clamp:1}.msph-modal__actions{grid-template-columns:repeat(4,minmax(0,1fr))}.msph-modal__actions .msph-btn{font-size:10px;padding:6px 2px}}
@media(prefers-reduced-motion:reduce){.msph-modal__skeleton{animation:none}}

/* Wrapped categories: balanced two rows on wide displays, extra rows on phones. */
.msph-landing .msph-category-strip{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px;overflow:visible;padding:6px 0 14px}
.msph-landing .msph-chip{min-width:0;min-height:44px;white-space:normal;justify-content:center;font-size:12px;padding:10px 8px;line-height:1.6}
.msph-landing .msph-grid{--msph-columns:5;gap:18px}
.msph-landing .msph-toolbar{justify-content:flex-start;margin:14px 0 16px}
@media(max-width:1100px){.msph-landing .msph-grid{--msph-columns:3}}
@media(max-width:780px){.msph-landing .msph-grid{--msph-columns:2;gap:12px}.msph-landing .msph-category-strip{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.msph-landing .msph-card__body{padding:12px}.msph-landing .msph-card__title{font-size:13px;min-height:44px;line-height:1.7}.msph-landing .msph-card__stats{display:none}}
