/* ============================================================
   文瑞游戏库 · 前端设计系统
   ============================================================ */

:root {
  --bg: #0b0b0d;
  --bg-2: #121216;
  --card: #17171c;
  --card-2: #1f1f26;
  --card-3: #262630;
  --line: #2a2a33;
  --line-soft: #202028;

  --txt: #f3f3f5;
  --txt-2: #a0a0ac;
  --txt-3: #6d6d79;

  --yellow: #ffcb2e;
  --yellow-2: #ffe27a;
  --yellow-dim: rgba(255, 203, 46, 0.14);
  --red: #e8322c;
  --green: #2fbf71;
  --blue: #3f7ff9;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  --tab-h: 54px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  /* 应用外壳自己管理滚动，避免出现"页面整体滚动 + 面板内部不滚"的双层滚动 */
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* ---------------- 外壳 ---------------- */

.phone {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  /* 必须是确定高度：只写 min-height 时整条 flex 链会被内容撑开，
     .pane 拿到内容全高，overflow-y:auto 永远不产生滚动条 */
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}

@media (min-width: 560px) {
  body {
    background: #050506;
  }
  .phone {
    min-height: 100dvh;
    box-shadow: 0 0 0 1px #1a1a1f, 0 24px 80px rgba(0, 0, 0, 0.7);
  }
}

.view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ---------------- 底部导航 ---------------- */

.tabbar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: flex;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: #0e0e11;
  border-top: 1px solid var(--line-soft);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: var(--txt-3);
  transition: color 0.2s;
}

.tab img {
  width: 24px;
  height: 24px;
  opacity: 0.45;
  filter: grayscale(1);
  transition: 0.2s;
}

.tab.active {
  color: var(--yellow);
}

.tab.active img {
  opacity: 1;
  filter: none;
}

/* ---------------- 通用图标 / 基础组件 ---------------- */

.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--txt);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, filter 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(180deg, #ffd752, var(--yellow));
  color: #241a00;
  box-shadow: 0 6px 18px rgba(255, 203, 46, 0.22);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--txt-2);
}

.btn-block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  background: var(--card-3);
  color: var(--txt-2);
}

.chip-gold {
  background: var(--yellow-dim);
  color: var(--yellow);
}

.chip-solid {
  background: #f0c33a;
  color: #2a1e00;
  font-weight: 700;
}

.muted {
  color: var(--txt-2);
}

.tiny {
  font-size: 11px;
  color: var(--txt-3);
}

.divider {
  height: 1px;
  background: var(--line-soft);
}

/* 头部（内页） */
.pagebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 12px;
  background: rgba(11, 11, 13, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}

.pagebar h1 {
  flex: 1;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  padding-right: 32px;
}

.iconbtn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--card-2);
  color: var(--txt);
  font-size: 18px;
  cursor: pointer;
}

.iconbtn.plain {
  background: transparent;
}

/* 骨架屏 */
.skl {
  background: linear-gradient(90deg, #1b1b21 25%, #24242c 37%, #1b1b21 63%);
  background-size: 400% 100%;
  animation: skl 1.3s ease infinite;
  border-radius: 6px;
}

@keyframes skl {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 56px 24px;
  color: var(--txt-3);
  font-size: 13px;
  text-align: center;
}

.empty .icon {
  font-size: 34px;
  opacity: 0.5;
}

/* ============================================================
   首页
   ============================================================ */

.home {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.home-top {
  flex: none;
  padding: 14px 14px 0;
  background:
    radial-gradient(120% 90% at 50% -30%, rgba(232, 50, 44, 0.16), transparent 60%),
    var(--bg);
}

/* 品牌行 */
.brandrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;          /* 作为 h1 使用时清除默认外边距 */
  font-weight: 700;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex: none;
}

.brand-name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 1px 12px rgba(232, 50, 44, 0.35);
}

.brand-shortcut {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--yellow);
  line-height: 1.35;
}

.brand-shortcut a {
  padding: 1px 2px;
}

.brand-shortcut a:active {
  opacity: 0.6;
}

/* 跑马灯 */
.ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  margin-top: 12px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

.ticker > .icon {
  font-size: 17px;
  color: var(--yellow);
  flex: none;
}

.ticker-track {
  position: relative;
  flex: 1;
  height: 100%;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
}

.ticker-line {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  font-size: 12.5px;
  color: #e6c977;
  white-space: nowrap;
  animation: marquee 18s linear infinite;
}

@keyframes marquee {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* 四宫格入口 */
.quickgrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.quick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

.quick img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 14px;
  transition: transform 0.14s;
}

.quick:active img {
  transform: scale(0.94);
}

.quick span {
  font-size: 11.5px;
  color: var(--txt-2);
}

/* 主体双栏 */
.home-main {
  flex: 1;
  min-height: 0;
  display: flex;
  margin-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.rail {
  flex: none;
  width: 96px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #101014;
  border-right: 1px solid var(--line-soft);
  -webkit-overflow-scrolling: touch;
}

.rail-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 8px 6px;
  font-size: 13px;
  color: var(--txt-2);
  text-align: center;
  line-height: 1.25;
  cursor: pointer;
  border: 0;
  background: none;
  width: 100%;
  transition: color 0.18s, background 0.18s;
}

.rail-item.active {
  color: var(--yellow);
  font-weight: 600;
  background: linear-gradient(90deg, rgba(255, 203, 46, 0.1), transparent 85%);
}

.rail-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--yellow);
}

.rail-item .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  line-height: 15px;
  font-weight: 700;
}

.pane {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 12px 24px;
  -webkit-overflow-scrolling: touch;
}

/* 分组标题 */
.sect-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 8px;
  background: linear-gradient(180deg, var(--bg) 72%, rgba(11, 11, 13, 0));
}

.sect-head h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.sect-head h2 .icon {
  color: var(--yellow);
  font-size: 16px;
}

.sect-head .spacer {
  flex: 1;
}

.sect-head .link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--yellow-2);
  opacity: 0.9;
}

.sect-head .cnt {
  font-size: 11px;
  color: var(--txt-3);
  font-weight: 400;
}

/* 软件卡片 */
.appcard {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 12px 10px;
  margin-bottom: 10px;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #1a1a20, #15151a);
  border: 1px solid var(--line-soft);
  cursor: pointer;
  transition: border-color 0.18s, transform 0.12s;
}

.appcard:active {
  transform: scale(0.995);
  border-color: #35353f;
}

.appcard .thumb {
  flex: none;
  width: 68px;
  height: 68px;
  border-radius: var(--r);
  background: #262630 center/cover no-repeat;
  overflow: hidden;
}

.appcard .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.appcard .body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.appcard .title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--txt);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-right: 4px;
}

.appcard .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.appcard .foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.appcard .time {
  font-size: 10.5px;
  color: var(--txt-3);
  white-space: nowrap;
}

.dlbtn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd752, var(--yellow));
  color: #2a1d00;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(255, 203, 46, 0.18);
}

.dlbtn:active {
  filter: brightness(0.94);
}

.dlbtn.h5 {
  background: linear-gradient(180deg, #6ba3ff, var(--blue));
  color: #fff;
  box-shadow: 0 3px 10px rgba(63, 127, 249, 0.22);
}

.dlbtn.installed {
  background: var(--card-3);
  color: var(--txt-2);
  box-shadow: none;
}

/* 加载更多 */
.morebar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  margin: 6px 0 2px;
  border-radius: var(--r);
  border: 1px dashed var(--line);
  color: var(--txt-2);
  font-size: 12.5px;
  cursor: pointer;
  background: none;
  width: 100%;
}

.morebar:active {
  background: var(--card);
}

/* ============================================================
   搜索 / 列表通用
   ============================================================ */

.searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line-soft);
}

.searchbar .icon {
  font-size: 16px;
  color: var(--txt-3);
}

.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 14px;
}

.searchbar input::placeholder {
  color: var(--txt-3);
}

.searchbar .clear {
  border: 0;
  background: none;
  color: var(--txt-3);
  font-size: 16px;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}

.scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ============================================================
   详情页
   ============================================================ */

.detail-hero {
  display: flex;
  gap: 14px;
  padding: 18px 14px;
  background: radial-gradient(120% 100% at 20% 0%, rgba(255, 203, 46, 0.1), transparent 60%);
}

.detail-hero .thumb {
  width: 84px;
  height: 84px;
  border-radius: 18px;
  background: #262630 center/cover no-repeat;
  border: 1px solid var(--line);
  overflow: hidden;
  flex: none;
}

.detail-hero .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-hero h2 {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.34;
  font-weight: 700;
}

.detail-body {
  padding: 0 14px 24px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--txt-2);
  word-break: break-word;
}

.detail-body img {
  border-radius: var(--r);
  margin: 8px 0;
}

.kv {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 12px 14px;
  margin: 0 14px 14px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--txt-2);
}

.kv b {
  color: var(--txt);
  font-weight: 600;
}

.sticky-action {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 10px 14px calc(10px + var(--safe-b));
  background: linear-gradient(180deg, rgba(11, 11, 13, 0), var(--bg) 30%);
}

/* ============================================================
   表单 / 账号
   ============================================================ */

.authwrap {
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.auth-logo img {
  width: 68px;
  height: 68px;
  border-radius: 20px;
}

.auth-logo h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.auth-logo p {
  margin: 0;
  font-size: 12.5px;
  color: var(--txt-3);
}

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 14px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line-soft);
  transition: border-color 0.18s;
}

.field:focus-within {
  border-color: rgba(255, 203, 46, 0.5);
}

.field .icon {
  font-size: 17px;
  color: var(--txt-3);
}

.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 15px;
}

.field input::placeholder {
  color: var(--txt-3);
  font-size: 14px;
}

.field-hint {
  padding: 0 4px;
  font-size: 11.5px;
  color: var(--txt-3);
  margin-top: -6px;
}

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--txt-2);
  padding: 6px 0;
}

.auth-switch a {
  color: var(--yellow);
  font-weight: 600;
}

/* 我的 */
.profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 16px;
}

.avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #2c2c36, #1b1b22);
  border: 1px solid var(--line);
  font-size: 24px;
  color: var(--txt-2);
  flex: none;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile .who {
  flex: 1;
  min-width: 0;
}

.profile .who .name {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.menu {
  margin: 4px 12px 24px;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: var(--card);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 15px 14px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: none;
  color: var(--txt);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.menu-item:last-child {
  border-bottom: 0;
}

.menu-item .icon {
  font-size: 18px;
  color: var(--txt-2);
}

.menu-item .chev {
  font-size: 16px;
  color: var(--txt-3);
}

.menu-item.danger {
  color: #ff6b6b;
}

.menu-item.danger .icon {
  color: #ff6b6b;
}

/* ============================================================
   返利榜 / IP / 公告
   ============================================================ */

.rank-hero {
  padding: 18px 16px 14px;
  background:
    radial-gradient(120% 120% at 50% -20%, rgba(255, 203, 46, 0.16), transparent 55%),
    linear-gradient(180deg, #17130a, var(--bg));
  text-align: center;
}

.rank-hero h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.rank-hero p {
  margin: 0;
  font-size: 12px;
  color: #b9a267;
}

.rank-head {
  display: flex;
  padding: 9px 12px;
  font-size: 11px;
  color: var(--txt-3);
}

.rank-head > span:nth-child(1) { width: 48px; }
.rank-head > span:nth-child(2) { flex: 1; }
.rank-head > span:nth-child(3) { width: 82px; text-align: right; }
.rank-head > span:nth-child(4) { width: 68px; text-align: right; }

.rank-row {
  display: flex;
  align-items: center;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}

.rank-row .no {
  width: 26px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  background: var(--card-3);
  color: var(--txt-2);
  margin-right: 22px;
  flex: none;
}

.rank-row.top1 .no { background: #ffd752; color: #2a1d00; }
.rank-row.top2 .no { background: #d8dde6; color: #1e2229; }
.rank-row.top3 .no { background: #cf9163; color: #2a1a0b; }

.rank-row .who {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--txt);
}

.rank-row .m1 {
  width: 82px;
  text-align: right;
  color: var(--yellow);
  font-weight: 600;
}

.rank-row .m2 {
  width: 68px;
  text-align: right;
  color: #6be0a0;
  font-weight: 600;
}

.resultbox {
  margin: 12px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line-soft);
  padding: 12px 14px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.resultbox .row {
  display: flex;
  gap: 8px;
}

.resultbox .row b {
  font-weight: 600;
  color: var(--txt);
}

.tag-ok { color: var(--green); }
.tag-no { color: #ff6b6b; }
.tag-wait { color: var(--yellow); }

.iplist {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.iprow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line-soft);
  font-size: 13px;
}

.iprow .t {
  font-size: 11px;
  color: var(--txt-3);
}

.notice-card {
  margin: 12px;
  padding: 14px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line-soft);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--txt-2);
  white-space: pre-wrap;
}

/* 教程列表 */
.tutcat {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
}

.tutcat .chip {
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12.5px;
  flex: none;
  cursor: pointer;
  border: 1px solid transparent;
}

.tutcat .chip.active {
  background: var(--yellow-dim);
  color: var(--yellow);
  border-color: rgba(255, 203, 46, 0.35);
}

.tutcard {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--line-soft);
  cursor: pointer;
}

.tutcard .thumb {
  width: 92px;
  height: 66px;
  border-radius: 10px;
  background: #262630 center/cover no-repeat;
  flex: none;
  overflow: hidden;
}

.tutcard .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tutcard h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   浮层：toast / sheet / modal
   ============================================================ */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(90px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: 86vw;
}

.toast {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(38, 38, 46, 0.96);
  border: 1px solid var(--line);
  color: var(--txt);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toastIn 0.22s ease;
  text-align: center;
}

.toast.err {
  background: rgba(70, 24, 24, 0.96);
  border-color: #7a3030;
}

.toast.ok {
  background: rgba(22, 56, 38, 0.96);
  border-color: #2c6b48;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.layer-host {
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
}

.mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
  pointer-events: auto;
  animation: fade 0.18s ease;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  padding: 18px 18px calc(18px + var(--safe-b));
  border-radius: 20px 20px 0 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 0;
  pointer-events: auto;
  animation: sheetUp 0.24s cubic-bezier(0.22, 0.8, 0.3, 1);
}

@keyframes sheetUp {
  from { transform: translate(-50%, 100%); }
  to { transform: translate(-50%, 0); }
}

.sheet h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
}

.sheet .sub {
  margin: 0 0 16px;
  font-size: 12.5px;
  color: var(--txt-2);
  line-height: 1.6;
}

.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sheet-close {
  position: absolute;
  right: 14px;
  top: 14px;
}

.dlg {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 48px);
  max-width: 340px;
  padding: 22px 20px 18px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  pointer-events: auto;
  animation: dlgIn 0.2s ease;
  text-align: center;
}

@keyframes dlgIn {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.dlg h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.dlg p {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--txt-2);
  line-height: 1.65;
  max-height: 44vh;
  overflow-y: auto;
  text-align: left;
  white-space: pre-wrap;
}

.dlg .acts {
  display: flex;
  gap: 10px;
}

.dlg .acts .btn {
  flex: 1;
}

.progress {
  height: 6px;
  border-radius: 99px;
  background: var(--card-3);
  overflow: hidden;
  margin: 14px 0 6px;
}

.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--yellow), var(--yellow-2));
  transition: width 0.2s;
}

/* 滚动提示 */
.scroll-hint {
  padding: 10px 0 20px;
  text-align: center;
  font-size: 11.5px;
  color: var(--txt-3);
}

/* ============================================================
   性能与细节修正
   ============================================================ */

/* 长列表离屏渲染优化：128 个分类也不会卡首屏 */
.sect {
  content-visibility: auto;
  contain-intrinsic-size: auto 720px;
}

.appcard .thumb {
  display: grid;
  place-items: center;
  color: var(--txt-3);
  font-size: 26px;
}

.tutcard .thumb {
  display: grid;
  place-items: center;
  color: var(--txt-3);
}

/* 触摸设备去掉 hover 残留 */
@media (hover: none) {
  .appcard:active {
    background: linear-gradient(180deg, #1e1e25, #191920);
  }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* 安全区：非 fullscreen 时页面底部留白 */
.view {
  padding-bottom: 0;
}

/* 表单输入在 iOS 上不缩放 */
input,
textarea,
select {
  font-size: 16px;
}

@media (min-width: 400px) {
  input,
  textarea,
  select {
    font-size: 15px;
  }
}
