/* Home and search refinements; this file is linked only by those two routes. */
body[data-page="HOME"] #homeHeroGrid .hero-card[hidden],
body[data-page="HOME"] .home-hero-empty[hidden]{display:none!important;}
body[data-page="HOME"] .home-hero-empty{margin:8px 0;color:var(--ink-faint);font-size:11px;line-height:1.7;}

body[data-page="SEARCH"] #searchTypeTabs{gap:8px;padding:3px 2px 8px;min-height:48px;}
body[data-page="SEARCH"] #searchTypeTabs button{min-height:44px;padding-inline:14px;}
body[data-page="SEARCH"] .toolbar-search{min-height:48px;margin-bottom:10px;}
body[data-page="SEARCH"] .toolbar-search input{min-height:44px;}
body[data-page="SEARCH"] .search-result-count{margin:8px 0 2px;color:var(--ink-faint);font-size:11px;line-height:1.5;}
body[data-page="SEARCH"] .search-result-count:empty{display:none;}
body[data-page="SEARCH"] #searchResults{display:flex;flex-direction:column;gap:8px;max-width:880px;min-width:0;margin-top:8px;}
body[data-page="SEARCH"] .search-result-card{display:grid;grid-template-columns:44px minmax(0,1fr) auto 10px;align-items:center;gap:9px;min-height:66px;padding:9px 10px;color:var(--ink-soft);text-decoration:none;background:var(--card);border:1px solid var(--line);border-radius:8px;}
body[data-page="SEARCH"] .search-result-card:hover{border-color:var(--gold-thin);background:color-mix(in srgb,var(--card) 88%,var(--gold) 12%);}
body[data-page="SEARCH"] .search-result-card:focus-visible{outline:3px solid var(--gold-bright);outline-offset:2px;}
body[data-page="SEARCH"] .search-result-icon{width:42px;height:42px;display:flex;align-items:center;justify-content:center;overflow:hidden;border:1px solid var(--gold-thin);border-radius:7px;background:var(--panel);}
body[data-page="SEARCH"] .search-result-icon--hero{color:var(--role-assassin);}
body[data-page="SEARCH"] .search-result-icon--item{color:var(--gold-bright);}
body[data-page="SEARCH"] .search-result-icon--term{color:var(--role-mage);}
body[data-page="SEARCH"] .search-result-image{display:block;width:100%;height:100%;object-fit:contain;background:var(--panel);}
body[data-page="SEARCH"] .search-result-image[hidden]{display:none!important;}
body[data-page="SEARCH"] .search-result-fallback{width:100%;height:100%;display:flex;align-items:center;justify-content:center;}
body[data-page="SEARCH"] .search-result-fallback[hidden]{display:none!important;}
body[data-page="SEARCH"] .search-result-fallback svg{display:block;width:22px;height:22px;}
body[data-page="SEARCH"] .search-result-copy{display:flex;flex-direction:column;gap:2px;min-width:0;}
body[data-page="SEARCH"] .search-result-name{color:var(--ink);font-size:13px;font-weight:800;line-height:1.5;overflow-wrap:anywhere;}
body[data-page="SEARCH"] .search-result-meta{color:var(--ink-faint);font-size:10.5px;line-height:1.45;overflow-wrap:anywhere;}
body[data-page="SEARCH"] .search-result-type{display:inline-flex;align-items:center;justify-content:center;min-height:26px;padding:3px 7px;color:var(--gold-bright);font-size:10px;font-weight:700;line-height:1.35;white-space:nowrap;background:rgba(199,154,62,.12);border:1px solid var(--gold-thin);border-radius:999px;}
body[data-page="SEARCH"] .search-result-chevron{color:var(--ink-faint);font-size:18px;line-height:1;}
body[data-page="SEARCH"] .search-result-empty{padding:14px;color:var(--ink-faint);font-size:12px;line-height:1.7;background:var(--card);border:1px dashed var(--line);border-radius:8px;}
body[data-page="SEARCH"] .search-site-notice{display:block;max-width:880px;margin:32px 0 8px;padding:15px 14px 17px;color:var(--ink-soft);font-size:11px;line-height:1.9;overflow-wrap:anywhere;background:rgba(20,18,16,.72);border:1px solid var(--line);border-radius:8px;}
body[data-page="SEARCH"] .device.no-furigana .search-site-notice{font-size:13px;line-height:1.9;}

@media(min-width:1024px){
  body[data-page="SEARCH"] #device{display:flex;flex-direction:column;min-height:100vh;min-height:100dvh;}
  body[data-page="SEARCH"] #device>header{flex:0 0 auto;}
  body[data-page="SEARCH"] .desktop-layout{flex:1 0 auto;align-items:stretch;}
  body[data-page="SEARCH"] #wikiContent{display:flex;flex-direction:column;min-width:0;}
  body[data-page="SEARCH"] #wikiContent>.panel.active{display:flex;flex:1 0 auto;flex-direction:column;min-width:0;}
  body[data-page="SEARCH"] .search-site-notice{margin:auto 0 8px;}
}

@media(max-width:1023px){
  body[data-page="HOME"] #device,
  body[data-page="SEARCH"] #device{width:min(390px,100vw);}
  body[data-page="SEARCH"] #device{display:flex;flex-direction:column;min-height:100vh;min-height:100dvh;padding-bottom:calc(76px + env(safe-area-inset-bottom,0px));}
  body[data-page="SEARCH"] #device>header{flex:0 0 auto;}
  body[data-page="SEARCH"] .desktop-layout{display:flex;flex:1 0 auto;flex-direction:column;min-width:0;}
  body[data-page="SEARCH"] #wikiContent{display:flex;flex:1 0 auto;flex-direction:column;min-width:0;}
  body[data-page="SEARCH"] #wikiContent>.panel.active{display:flex;flex:1 0 auto;flex-direction:column;min-width:0;}
  body[data-page="SEARCH"] .search-site-notice{margin:auto 0 0;padding:17px 13px 18px;}
  body[data-page="SEARCH"] nav.bottom-nav{bottom:0;width:min(390px,100vw);height:calc(60px + env(safe-area-inset-bottom,0px));padding-bottom:env(safe-area-inset-bottom,0px);}
  body.search-keyboard-open #device{padding-bottom:16px;}
  body.search-keyboard-open nav.bottom-nav{display:none;}
}

@media(max-width:350px){
  body[data-page="SEARCH"] .search-result-card{grid-template-columns:40px minmax(0,1fr) auto 8px;gap:7px;padding-inline:8px;}
  body[data-page="SEARCH"] .search-result-icon{width:38px;height:38px;}
  body[data-page="SEARCH"] .search-result-type{padding-inline:5px;font-size:9.5px;}
}

/* The mobile device stays 390px wide even at an 846px viewport. */
@media(max-width:1023px){
 body[data-page="HOME"] .home-mlbb-intro{grid-template-columns:minmax(0,1fr);gap:11px;padding:12px;}
 body[data-page="HOME"] .home-mlbb-links{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));}
 body[data-page="HOME"] .home-mlbb-links a{min-width:0;justify-content:center;text-align:center;overflow-wrap:anywhere;}
}

/* Reader chrome must grow with text, including synthetic 200% text scaling. */
@media(max-width:1023px){
 body[data-page="HOME"] #device>header{height:auto;min-height:52px;overflow:visible;flex-wrap:wrap;gap:8px;padding:8px 12px;}
 body[data-page="HOME"] #device>header .brand{flex:1 1 220px;min-width:0;flex-wrap:wrap;line-height:1.5;}
 body[data-page="HOME"] #device>header .brand>span{min-width:0;overflow-wrap:anywhere;}
 body[data-page="HOME"] #device{padding-bottom:calc(116px + env(safe-area-inset-bottom,0px));}
 body[data-page="HOME"] nav.bottom-nav{height:auto;min-height:60px;padding-bottom:env(safe-area-inset-bottom,0px);width:min(390px,100vw);}
 body[data-page="HOME"] nav.bottom-nav button{flex:1 1 0;min-width:0;padding:8px 3px;}
 body[data-page="HOME"] nav.bottom-nav .nav-label{width:100%;white-space:normal;overflow-wrap:anywhere;line-height:1.3;text-align:center;}
}

/* Reader chrome must grow with text, including synthetic 200% text scaling. */
@media(max-width:1023px){
 body[data-page="SEARCH"] #device>header{height:auto;min-height:52px;overflow:visible;flex-wrap:wrap;gap:8px;padding:8px 12px;}
 body[data-page="SEARCH"] #device>header .brand{flex:1 1 220px;min-width:0;flex-wrap:wrap;line-height:1.5;}
 body[data-page="SEARCH"] #device>header .brand>span{min-width:0;overflow-wrap:anywhere;}
 body[data-page="SEARCH"] #device{padding-bottom:calc(116px + env(safe-area-inset-bottom,0px));}
 body[data-page="SEARCH"] nav.bottom-nav{height:auto;min-height:60px;padding-bottom:env(safe-area-inset-bottom,0px);width:min(390px,100vw);}
 body[data-page="SEARCH"] nav.bottom-nav button{flex:1 1 0;min-width:0;padding:8px 3px;}
 body[data-page="SEARCH"] nav.bottom-nav .nav-label{width:100%;white-space:normal;overflow-wrap:anywhere;line-height:1.3;text-align:center;}
}

body.search-keyboard-open #device{padding-bottom:16px;}
