
.m-tabbar,
.m-backdrop,
.m-sheet-head,
.m-drawer-head,
.site-nav-panel .view-switch { display: none; }

.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.75rem auto 0;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  font-size: 0.76rem;
}
.view-switch__label { padding: 0 0.35rem 0 0.55rem; color: var(--muted); }
.view-switch__btn {
  border: 0;
  background: transparent;
  color: var(--fg-soft);
  font: inherit;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}
.view-switch__btn[aria-pressed="true"] {
  background: var(--themecolor);
  color: #fff;
}

html.shell-mobile {
  --header-h: 3.1rem;
  --m-tab-h: 3.6rem;
  --m-safe-b: env(safe-area-inset-bottom, 0px);
  --m-gutter: 0.85rem;
  scroll-padding-top: calc(var(--header-h) + 0.5rem);
}
html.shell-mobile.m-lock,
html.shell-mobile.m-lock body { overflow: hidden; }

.shell-mobile body {
  font-size: 1rem;
  -webkit-tap-highlight-color: rgba(220, 68, 55, 0.12);
}
.shell-mobile body.has-m-tabbar {
  padding-bottom: calc(var(--m-tab-h) + var(--m-safe-b));
}

.shell-mobile .preview-banner {
  padding: 0.18rem 0.75rem;
  font-size: 0.68rem;
}

.shell-mobile .site-header {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--bg-elevated);
}
.shell-mobile .site-header__inner {
  padding: 0.3rem var(--m-gutter);
  min-height: var(--header-h);
  gap: 0.5rem;
}
.shell-mobile .brand__logo { width: 1.95rem; height: 1.95rem; }
.shell-mobile .brand__name { font-size: 0.95rem; }
.shell-mobile .brand__tag { display: none; }
.shell-mobile .nav-toggle {
  display: flex;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
}

.shell-mobile .site-nav-panel {
  display: flex;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: min(86vw, 22rem);
  max-height: none;
  z-index: 70;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0 0.85rem calc(1rem + var(--m-safe-b));
  background: var(--bg-elevated);
  border-left: 3px solid var(--themecolor);
  box-shadow: -12px 0 32px rgba(28, 25, 23, 0.18);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
}
.shell-mobile .site-header.is-nav-open .site-nav-panel {
  transform: none;
  visibility: visible;
  transition: transform 0.22s ease, visibility 0s;
}
.shell-mobile .m-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0 -0.85rem;
  padding: 0.7rem 0.85rem 0.6rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-soft);
}
.shell-mobile .m-drawer-head__t {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--themecolor-dark);
}
.m-close {
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--fg-soft);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.shell-mobile .site-nav {
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  width: 100%;
  gap: 0.15rem;
}
.shell-mobile .nav-link,
.shell-mobile .nav-dd__btn {
  display: flex;
  justify-content: space-between;
  width: 100%;
  min-height: 3rem;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  font-size: 1rem;
  color: var(--fg);
}
.shell-mobile .nav-dd__caret {
  border-left-width: 5px;
  border-right-width: 5px;
  border-top-width: 6px;
  transition: transform 0.15s;
}
.shell-mobile .nav-dd.is-open .nav-dd__caret { transform: rotate(180deg); }
.shell-mobile .nav-dd__menu,
.shell-mobile .nav-dd--wide .nav-dd__menu {
  position: static;
  display: none;
  min-width: 0;
  margin: 0.1rem 0 0.4rem;
  padding: 0.35rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--card);
  box-shadow: none;
}
.shell-mobile .nav-dd.is-open .nav-dd__menu,
.shell-mobile .nav-dd--wide.is-open .nav-dd__menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem;
}
.shell-mobile .nav-dd__menu a {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.45rem 0.6rem;
  font-size: 0.92rem;
}
.shell-mobile .nav-search {
  width: 100%;
  margin: 0.4rem 0 0;
}
.shell-mobile .nav-search input {
  flex: 1;
  width: auto;
  max-width: none;
  min-height: 2.9rem;
  padding: 0.5rem 0.9rem;
  font-size: 16px;
}
.shell-mobile .nav-search__btn { min-height: 2.9rem; padding: 0 1.1rem; font-size: 0.95rem; }
.shell-mobile .site-nav-panel .view-switch {
  display: flex;
  justify-content: space-between;
  margin: 0.75rem 0 0;
}
.shell-mobile .site-nav-panel .view-switch__btn { min-height: 2.5rem; flex: 1; }

.shell-mobile .m-backdrop:not([hidden]) {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(28, 18, 16, 0.42);
  animation: m-fade 0.18s ease;
}
.shell-mobile.m-sheet-open .m-backdrop:not([hidden]) { z-index: 55; }
@keyframes m-fade { from { opacity: 0; } to { opacity: 1; } }

.shell-mobile .m-tabbar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: calc(var(--m-tab-h) + var(--m-safe-b));
  padding: 0 0.25rem var(--m-safe-b);
  background: color-mix(in srgb, var(--bg-elevated) 94%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(28, 25, 23, 0.06);
}
.shell-mobile .m-tabbar:has(.m-tab[hidden]) { grid-template-columns: repeat(4, 1fr); }
.m-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.7rem;
  text-decoration: none;
  cursor: pointer;
}
.m-tab[hidden] { display: none; }
.m-tab[aria-current="page"],
.m-tab[aria-expanded="true"] { color: var(--themecolor); }
.m-tab[aria-current="page"] .m-tab__t,
.m-tab[aria-expanded="true"] .m-tab__t { font-weight: 650; }
.m-tab__ico {
  width: 1.45rem;
  height: 1.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
}
.m-ico-home::before { content: "⌂"; font-size: 1.4rem; }
.m-ico-list::before { content: "☰"; }
.m-ico-grid::before { content: "▦"; }
.m-ico-side::before { content: "◧"; }
.m-ico-me::before { content: "◉"; }

.shell-mobile .layout {
  display: block;
  padding: 0.85rem var(--m-gutter) 1.5rem;
}
.shell-mobile .layout__main,
.shell-mobile .layout__main--read { max-width: none; }
.shell-mobile .site-main { padding: 1rem var(--m-gutter) 1.5rem; }

.shell-mobile .sidebar {
  position: fixed;
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  max-height: min(82vh, 40rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  gap: 0.7rem;
  padding: 0 var(--m-gutter) calc(1rem + var(--m-safe-b));
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  border-top: 3px solid var(--themecolor);
  box-shadow: 0 -12px 32px rgba(28, 25, 23, 0.2);
  transform: translateY(105%);
  visibility: hidden;
  transition: transform 0.24s ease, visibility 0s linear 0.24s;
}
.shell-mobile .sidebar.is-sheet-open {
  transform: none;
  visibility: visible;
  transition: transform 0.24s ease, visibility 0s;
}
.shell-mobile .m-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0 calc(-1 * var(--m-gutter));
  padding: 0.95rem var(--m-gutter) 0.55rem;
  background: var(--bg);
}
.shell-mobile .m-sheet-head__grip {
  position: absolute;
  top: 0.4rem;
  left: 50%;
  width: 2.6rem;
  height: 4px;
  margin-left: -1.3rem;
  border-radius: 2px;
  background: var(--border);
}
.shell-mobile .m-sheet-head__t { font-size: 0.92rem; color: var(--fg-soft); }
.shell-mobile .side-card { padding: 0.9rem 0.95rem; }
.shell-mobile .side-notice,
.shell-mobile .side-recent,
.shell-mobile .side-rank { font-size: 0.92rem; }
.shell-mobile .side-recent li + li,
.shell-mobile .side-rank li + li { margin-top: 0; }
.shell-mobile .side-recent a,
.shell-mobile .side-rank li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.shell-mobile .side-tool-btn,
.shell-mobile .side-search input,
.shell-mobile .side-search__btn { min-height: 2.75rem; font-size: 0.95rem; }
.shell-mobile .side-search input { font-size: 16px; }
.shell-mobile .side-feat { grid-template-columns: 1fr 1fr; }

.shell-mobile .home-hero { margin: 0 0 1rem; }
.shell-mobile .home-hero__banner,
.shell-mobile .home-hero__img { min-height: 0; height: 11.5rem; }
.shell-mobile .home-hero__banner { border-radius: 14px; }
.shell-mobile .home-hero__shade {
  background: linear-gradient(0deg, rgba(28, 18, 16, 0.82) 0%, rgba(28, 18, 16, 0.4) 55%, rgba(28, 18, 16, 0.1) 100%);
}
.shell-mobile .home-hero__copy { padding: 0.95rem 1rem; max-width: none; }
.shell-mobile .home-hero__title { font-size: 1.4rem; }
.shell-mobile .home-hero__sub { font-size: 0.86rem; }
.shell-mobile .home-hero__actions .btn { min-height: 2.6rem; }

.shell-mobile .activity-strip { gap: 0.6rem; margin-bottom: 0.9rem; }
.shell-mobile .activity-strip__bar {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.7rem 0.75rem;
}
.shell-mobile .activity-strip__label { align-self: flex-start; font-size: 0.74rem; }
.shell-mobile .activity-strip__list {
  flex-wrap: nowrap;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.75rem;
  padding: 0 0.75rem 0.1rem;
}
.shell-mobile .activity-strip__list::-webkit-scrollbar { display: none; }
.shell-mobile .activity-strip__list li { flex: 0 0 auto; }
.shell-mobile .activity-strip__list a,
.shell-mobile .activity-strip__muted {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 0.95rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--themecolor) 30%, var(--border));
  background: var(--card);
  font-size: 0.9rem;
  white-space: nowrap;
}
.shell-mobile .activity-pin {
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.7rem 0.8rem;
  font-size: 0.9rem;
}

.shell-mobile .home-panels { grid-template-columns: 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.shell-mobile .home-panel { padding: 0.9rem 0.95rem; border-radius: 14px; }
.shell-mobile .home-rank { font-size: 0.95rem; }
.shell-mobile .home-rank li + li { margin-top: 0; }
.shell-mobile .home-rank li {
  display: flex;
  align-items: center;
  min-height: 2.9rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.shell-mobile .home-rank li:last-child { border-bottom: 0; }
.shell-mobile .home-rank .side-rank__n { margin-top: 0; width: 1.6rem; height: 1.6rem; flex-basis: 1.6rem; font-size: 0.8rem; }
.shell-mobile .home-rank li:nth-child(-n+3) .side-rank__n { background: var(--themecolor); color: #fff; }

.shell-mobile .home-grid {
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.shell-mobile .home-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 4.6rem;
  padding: 0.8rem 0.85rem;
  border-radius: 14px;
}
.shell-mobile .home-tile strong { font-size: 0.98rem; }

.shell-mobile .page-title { font-size: 1.4rem; }
.shell-mobile .page-lead { font-size: 0.92rem; margin-bottom: 1rem; }
.shell-mobile .panel { padding: 1rem; border-radius: 14px; }
.shell-mobile .panel .btn { min-height: 2.9rem; margin: 0.25rem 0 0 !important; }
.shell-mobile .panel p:has(> .btn + .btn) { display: flex; flex-direction: column; gap: 0.5rem; }
.shell-mobile .panel p:has(> .btn + .btn) .btn { justify-content: center; }
.shell-mobile .post-list { gap: 0.65rem; }
.shell-mobile .card { padding: 0.95rem 1rem; border-radius: 14px; }
.shell-mobile .card h2 { font-size: 1.06rem; }
.shell-mobile .card h2 a { display: block; }
.shell-mobile .visual-only,
.shell-mobile .warn,
.shell-mobile .info { font-size: 0.88rem; padding: 0.75rem 0.85rem; }

.shell-mobile .layout__main--read { padding: 0 0.1rem; }
.shell-mobile .article-header h1 { font-size: 1.45rem; line-height: 1.4; }
.shell-mobile .content-pending { font-size: 0.86rem; padding: 0.75rem 0.85rem; }
.shell-mobile .layout__main--read .article-body,
.shell-mobile .layout__main--read .origin-html {
  font-size: 1.075rem;
  line-height: 1.95;
  letter-spacing: 0.015em;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.shell-mobile .layout__main--read .article-body { padding: 0.15rem 0 1rem; }
.shell-mobile .origin-html p { margin: 0 0 1.05em; }
.shell-mobile .origin-html img,
.shell-mobile .origin-html video { max-width: 100%; height: auto; border-radius: 8px; }
.shell-mobile .origin-html table { display: block; max-width: 100%; overflow-x: auto; }
.shell-mobile .origin-html pre { white-space: pre-wrap; overflow-x: auto; }
.shell-mobile .origin-frame-wrap iframe { width: 100%; height: 70vh; }

.shell-mobile .copy-guard-tip { bottom: calc(var(--m-tab-h) + var(--m-safe-b) + 0.75rem); }

.shell-mobile .auth-card {
  max-width: none;
  padding: 1.25rem 1.1rem 1.35rem;
  border-radius: 16px;
}
.shell-mobile .auth-card label { margin: 1rem 0 0.4rem; font-size: 0.95rem; }
.shell-mobile .auth-card input {
  min-height: 3.1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  font-size: 16px;
}
.shell-mobile .auth-card .auth-actions {
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.4rem;
}
.shell-mobile .auth-card .btn {
  justify-content: center;
  width: 100%;
  min-height: 3.1rem;
  font-size: 1rem;
}
.shell-mobile .auth-card .auth-hint { text-align: center; }

.shell-mobile .site-footer__inner { padding-left: var(--m-gutter); padding-right: var(--m-gutter); }
.shell-mobile .site-footer__contact { display: flex; flex-direction: column; gap: 0.15rem; }
.shell-mobile .site-footer__sep { display: none; }
.shell-mobile .site-footer .view-switch__btn { min-height: 2.4rem; }

html.theme-dark.shell-mobile .site-nav-panel,
html.theme-dark.shell-mobile .m-drawer-head { background: var(--bg-elevated); }
html.theme-dark .view-switch { background: var(--bg-elevated); }

@media (prefers-reduced-motion: reduce) {
  .shell-mobile .site-nav-panel,
  .shell-mobile .sidebar { transition: none !important; }
}
.m-tab__t { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
