/* 手机版 / 电脑版。规则只在 html.view-mobile 下生效，电脑宽屏保持原排版。 */

html.view-mobile {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

html.view-mobile body {
  overflow-x: hidden;
  max-width: 100%;
  overflow-wrap: anywhere;
}

html.view-mobile img,
html.view-mobile video,
html.view-mobile canvas,
html.view-mobile iframe,
html.view-mobile svg:not(.nine-mark) {
  max-width: 100%;
  height: auto;
}

html.view-mobile .wrap,
html.view-mobile .main,
html.view-mobile .project,
html.view-mobile article,
html.view-mobile .auth-box,
html.view-mobile .gate,
html.view-mobile .hero,
html.view-mobile .top,
html.view-mobile .topbar,
html.view-mobile .tabbar,
html.view-mobile .formula,
html.view-mobile pre,
html.view-mobile table {
  max-width: 100%;
  min-width: 0;
}

html.view-mobile pre,
html.view-mobile code {
  white-space: pre-wrap;
}

html.view-mobile h1 {
  font-size: 26px !important;
  line-height: 1.35 !important;
}

html.view-mobile h2 {
  font-size: 22px !important;
  line-height: 1.35 !important;
}

html.view-mobile input,
html.view-mobile select,
html.view-mobile textarea {
  font-size: 16px !important;
  max-width: 100%;
}

html.view-mobile input[type="search"] {
  min-width: 0 !important;
  width: 100%;
}

/* 顶栏：标题一行，导航换成可换行的按钮 */
html.view-mobile header.top,
html.view-mobile .topbar,
html.view-mobile .quiz-shell > header,
html.view-mobile .quiz-shell .top {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  height: auto !important;
  min-height: 0 !important;
  gap: 10px !important;
  padding: 12px 14px !important;
}

html.view-mobile .top-inner {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 10px !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  max-width: 100% !important;
}

html.view-mobile .brand,
html.view-mobile .brand strong,
html.view-mobile .brand-course,
html.view-mobile .brand-task {
  min-width: 0 !important;
  max-width: 100% !important;
}

html.view-mobile .brand strong,
html.view-mobile .brand-course {
  font-size: 20px !important;
  line-height: 1.35 !important;
}

html.view-mobile header nav,
html.view-mobile .top nav,
html.view-mobile .top-inner nav,
html.view-mobile .top-actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  font-size: 15px !important;
}

html.view-mobile .top nav a,
html.view-mobile header.top nav a,
html.view-mobile .top-inner nav a {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 6px 12px !important;
  line-height: 1.3;
}

html.view-mobile .wrap {
  padding-left: 14px !important;
  padding-right: 14px !important;
}

html.view-mobile .main {
  padding: 16px 12px 120px !important;
}

html.view-mobile article.norm {
  padding: 16px 14px 28px !important;
}

html.view-mobile .foot,
html.view-mobile footer.foot,
html.view-mobile .quiz-shell .foot {
  height: auto !important;
  flex-wrap: wrap !important;
}

/* 多列改成单列。窄轨加文字的卡片仍并排。 */
html.view-mobile .gate,
html.view-mobile .util,
html.view-mobile .hero,
html.view-mobile .hero-grid,
html.view-mobile .grid-2,
html.view-mobile .grid-3,
html.view-mobile .grid-4,
html.view-mobile .grid2,
html.view-mobile .grid3,
html.view-mobile .split,
html.view-mobile .band,
html.view-mobile .cards,
html.view-mobile .cards.two,
html.view-mobile .cards.three,
html.view-mobile .shell,
html.view-mobile .object-grid,
html.view-mobile .object-grid.five,
html.view-mobile .diag-row.three,
html.view-mobile .diag-row.four,
html.view-mobile .gate-row,
html.view-mobile .fw-pillars,
html.view-mobile .fw-funcs,
html.view-mobile .demand-grid,
html.view-mobile .norm-tabs,
html.view-mobile .norm-two,
html.view-mobile .mini-grid,
html.view-mobile .card-deck,
html.view-mobile .ais-pills,
html.view-mobile .ais-three,
html.view-mobile .ais-four,
html.view-mobile .tf-row.three,
html.view-mobile .home-grid,
html.view-mobile .tips-grid,
html.view-mobile .rev,
html.view-mobile .map-list,
html.view-mobile .bars,
html.view-mobile .prac-home,
html.view-mobile .opts,
html.view-mobile .parts,
html.view-mobile .task-grid,
html.view-mobile .card-grid,
html.view-mobile .two,
html.view-mobile .lab-layout,
html.view-mobile .matchgrid,
html.view-mobile .vgrid,
html.view-mobile .teachgrid,
html.view-mobile .entrygrid,
html.view-mobile .flow3,
html.view-mobile .cmp,
html.view-mobile .sub-grid,
html.view-mobile .match,
html.view-mobile .dim-grid,
html.view-mobile .app-grid,
html.view-mobile .three-ex,
html.view-mobile .purpose-grid,
html.view-mobile .map-grid,
html.view-mobile .map-pair,
html.view-mobile .lanes-3,
html.view-mobile .lanes-2,
html.view-mobile .proc-split,
html.view-mobile .proc-row,
html.view-mobile .side-row,
html.view-mobile .hubgrid,
html.view-mobile .menulist,
html.view-mobile .abc,
html.view-mobile .diag,
html.view-mobile .yzt-stack {
  grid-template-columns: 1fr !important;
}

html.view-mobile .gate-case,
html.view-mobile .card:has(.num),
html.view-mobile body.home details.project > summary {
  grid-template-columns: 60px minmax(0, 1fr) !important;
}

html.view-mobile body.home details.project > summary .fold-hint {
  grid-column: 2;
  justify-self: start !important;
  margin-top: 8px;
}

html.view-mobile body.home .case-no,
html.view-mobile .gate-case .num,
html.view-mobile .card .num {
  width: 52px !important;
  height: 52px !important;
  font-size: 18px !important;
  border-radius: 14px !important;
}

html.view-mobile .pipe,
html.view-mobile .stage-path,
html.view-mobile .flow-connect,
html.view-mobile .askbar,
html.view-mobile .yzt-col {
  flex-direction: column !important;
  align-items: stretch !important;
}

html.view-mobile .yzt-wrap {
  flex-wrap: wrap !important;
  white-space: normal !important;
}

html.view-mobile .side,
html.view-mobile .hero-art,
html.view-mobile .gate-chibi {
  display: none !important;
}

html.view-mobile .mobile-nav {
  display: flex !important;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff0f5;
  border-top: 2px solid #ffd0dc;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 24;
}

html.view-mobile .mobile-nav button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px 1px;
  font-size: 12px;
  letter-spacing: 0;
  min-height: 44px;
}

html.view-mobile .mobile-nav button.active {
  font-weight: 700;
  color: var(--seal, #e23b6a);
}

html.view-pc .mobile-nav {
  display: none !important;
}

html.yzt-show-switch .tabbar {
  top: 52px !important;
}

html.view-mobile .tabbar .tabs,
html.view-mobile .top-inner.tabs,
html.view-mobile .tabs {
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  overflow: visible !important;
  max-width: 100%;
}

html.view-mobile .tabs button,
html.view-mobile .tabbar a.back {
  flex: 0 0 auto !important;
}

html.view-mobile .yzt-scroll,
html.view-mobile .scroll,
html.view-mobile .table-wrap,
html.view-mobile .score-scroll {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

html.view-mobile .yzt-scroll table {
  width: max-content;
  min-width: 100%;
  max-width: none;
}

html.view-mobile .session-bar,
html.view-mobile .actions,
html.view-mobile .row,
html.view-mobile .chips,
html.view-mobile .layer-nav {
  flex-wrap: wrap !important;
}

html.view-mobile .float-d {
  left: auto !important;
  right: 10px !important;
  width: min(240px, calc(100vw - 20px)) !important;
}

/* 切换条。电脑宽屏不显示。 */
.yzt-view-bar {
  display: none;
}

html.yzt-show-switch .yzt-view-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: #fff8e8;
  color: #1f4e9a;
  border-bottom: 2px solid #e8b931;
  font: 700 15px/1.3 "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  box-shadow: 0 4px 14px rgba(31, 78, 154, 0.16);
}

html.yzt-show-switch body {
  padding-top: calc(46px + env(safe-area-inset-top));
}

.yzt-inline-switch { display: none; }

html.yzt-show-switch .yzt-inline-switch {
  display: inline-block;
  appearance: none;
  border: 0;
  cursor: pointer;
  background: #e8b931;
  color: #1e2a44;
  border-radius: 999px;
  padding: 8px 14px;
  font: 800 15px/1.2 "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

html.yzt-show-switch .yzt-view-bar button {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: #1f4e9a;
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-weight: 800;
}

@media print {
  .yzt-view-bar { display: none !important; }
}
