/* 掌经验 · 可用界面（对齐设计稿色与结构） */
:root {
  --km-blue: #1c69dd;
  --km-blue-deep: #1557bd;
  --km-blue-soft: #e8f1fc;
  --km-orange: #ff8a3d;
  --km-ink: #1f2329;
  --km-sub: #8f959e;
  --km-line: #eef0f4;
  --km-bg: #ffffff;
  --km-page: #f7f8fa;
  --km-radius: 14px;
  --km-shadow: 0 6px 20px rgba(28, 105, 221, 0.08);
  --km-nav-h: 56px;
  --km-safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body.km-app {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #dfe3ea;
  color: var(--km-ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; border: 0; outline: 0; background: none; }
button { cursor: pointer; }

.km-page {
  max-width: 390px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--km-bg);
  position: relative;
  padding-bottom: calc(var(--km-nav-h) + var(--km-safe-b) + 8px);
  box-shadow: 0 0 40px rgba(0,0,0,.08);
}
.km-page.no-tab { padding-bottom: calc(72px + var(--km-safe-b)); background: var(--km-page); }

.km-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 10px 14px 4px;
}
.km-slogan { font-size: 11px; color: #a0a6b0; line-height: 1.35; max-width: 110px; }
.km-logo { font-size: 20px; font-weight: 800; color: var(--km-blue); letter-spacing: .06em; text-align: center; }
.km-capsule {
  justify-self: end; display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid #e5e6eb; border-radius: 999px;
  padding: 4px 10px; height: 28px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.km-capsule .dot { width: 4px; height: 4px; border-radius: 50%; background: #333; box-shadow: 8px 0 #333, -8px 0 #333; margin: 0 8px; }
.km-capsule .ring { width: 16px; height: 16px; border: 1.5px solid #333; border-radius: 50%; position: relative; }
.km-capsule .ring::after { content: ""; position: absolute; inset: 3px; border: 1.5px solid #333; border-radius: 50%; }

.km-search {
  margin: 10px 16px 8px; background: var(--km-blue); border-radius: 999px;
  display: flex; align-items: center; gap: 8px; padding: 12px 18px;
  box-shadow: 0 6px 18px rgba(28,105,221,.28);
}
.km-search input { flex: 1; color: #fff; font-size: 14px; }
.km-search input::placeholder { color: rgba(255,255,255,.88); }

.km-tabs {
  display: flex; gap: 28px; padding: 6px 20px 0; border-bottom: 1px solid #f0f1f5;
}
.km-tabs button { padding: 10px 0 12px; color: #8f959e; font-size: 15px; position: relative; }
.km-tabs button.on { color: var(--km-blue); font-weight: 700; }
.km-tabs button.on::after {
  content: ""; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 20px; height: 3px; border-radius: 999px; background: var(--km-blue);
}

.km-banner {
  margin: 14px 16px 6px; border-radius: 18px; min-height: 148px; padding: 22px 18px 26px;
  color: #fff; position: relative; overflow: hidden; cursor: pointer;
  background:
    linear-gradient(105deg, rgba(21,87,189,.92) 0%, rgba(28,105,221,.5) 50%, rgba(28,105,221,.2) 100%),
    url("/assets/screens/home@2x.png") 70% 28% / 180% auto no-repeat,
    linear-gradient(135deg, #3b82f6, #1c69dd);
  box-shadow: var(--km-shadow);
}
.km-banner h2 { font-size: 26px; font-weight: 800; margin-bottom: 8px; max-width: 58%; text-shadow: 0 2px 8px rgba(0,0,0,.15); }
.km-banner p { font-size: 13px; opacity: .95; max-width: 55%; line-height: 1.45; }
.km-banner .dots {
  position: absolute; left: 0; right: 0; bottom: 10px;
  display: flex; justify-content: center; gap: 5px;
}
.km-banner .dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.45); display: block; }
.km-banner .dots i.on { width: 14px; border-radius: 999px; background: #fff; }

.km-sec { padding: 14px 16px 0; }
.km-sec-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; font-size: 16px; font-weight: 700;
}
.km-sec-hd .more { color: #c0c4cc; font-weight: 400; }

.km-topics { display: flex; gap: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.km-topics::-webkit-scrollbar { display: none; }
.km-topic {
  flex: 0 0 auto; width: 112px; min-height: 72px; padding: 14px 12px;
  border-radius: 14px; background: #f3f5f8; border: 1.5px solid transparent;
  font-size: 13px; font-weight: 600; color: #333; position: relative; cursor: pointer; line-height: 1.35;
}
.km-topic.on { background: #fff; border-color: var(--km-blue); box-shadow: var(--km-shadow); }
.km-topic .badge {
  position: absolute; right: 6px; top: 6px; width: 16px; height: 16px; border-radius: 4px;
  background: linear-gradient(145deg, #ffb14a, #ff8a3d);
}

.km-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 2px 16px 20px; }
.km-card {
  background: #fff; border-radius: 16px; overflow: hidden; cursor: pointer;
  box-shadow: 0 6px 20px rgba(31,35,41,.06); border: 1px solid #f2f3f5;
}
.km-card:active { transform: scale(.98); }
.km-card .cover {
  height: 128px; background: #e8f0fa center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.km-card .cover.avatar-mode { background: linear-gradient(160deg, #eaf2ff, #d6e6ff); }
.km-card .cover .av {
  width: 72px; height: 72px; border-radius: 50%;
  background: center/cover no-repeat #bcd4f5; border: 3px solid #fff;
  box-shadow: 0 8px 18px rgba(28,105,221,.22);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 26px; font-weight: 800;
}
.km-card .cover .mock {
  width: 86%; height: 78%; border-radius: 8px;
  background: linear-gradient(145deg, #1e3a5f, #334155); color: #93c5fd;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; padding: 8px; text-align: center;
  box-shadow: 0 8px 16px rgba(0,0,0,.18);
}
.km-card .body { padding: 10px 11px 12px; }
.km-card .title {
  font-size: 13px; font-weight: 700; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em;
}
.km-card .meta {
  margin-top: 6px; font-size: 11px; color: var(--km-sub); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.km-card .foot { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; }
.km-card .price { color: var(--km-blue); font-weight: 800; font-size: 15px; }

.km-sorts {
  display: flex; gap: 18px; padding: 12px 16px 4px; font-size: 13px; color: var(--km-sub);
}
.km-sorts button { color: inherit; }
.km-sorts button.on { color: var(--km-ink); font-weight: 700; }

.km-tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 390px;
  background: #fff; border-top: 1px solid #f0f1f5;
  display: flex; padding: 6px 0 calc(6px + var(--km-safe-b)); z-index: 50;
}
.km-tabbar a {
  flex: 1; text-align: center; font-size: 11px; color: #9aa0a6;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0;
}
.km-tabbar a.on { color: var(--km-blue); font-weight: 700; }
.km-tabbar svg { width: 24px; height: 24px; }

.km-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--km-blue); color: #fff; border-radius: 12px;
  padding: 13px 20px; font-weight: 700;
}
.km-btn.block { width: 100%; }
.km-btn.ghost { background: #fff; color: var(--km-ink); border: 1px solid var(--km-line); }
.km-btn:disabled { opacity: .5; }
.km-sticky {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 390px;
  background: #fff; border-top: 1px solid #f0f1f5;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px calc(10px + var(--km-safe-b)); z-index: 40;
}
.km-sticky .link { color: #555; font-size: 12px; text-align: center; white-space: nowrap; min-width: 64px; }
.km-sticky .km-btn { flex: 1; border-radius: 999px; }

.km-navback { display: flex; align-items: center; padding: 10px 14px 4px; background: #fff; }
.km-navback .back { width: 32px; font-size: 24px; color: #333; cursor: pointer; line-height: 1; }
.km-navback .ttl { flex: 1; text-align: center; color: var(--km-blue); font-size: 17px; font-weight: 800; margin-right: 32px; }

.km-panel {
  margin: 0 16px 12px; background: #fff; border-radius: 16px;
  box-shadow: var(--km-shadow); padding: 14px 16px;
}
.km-panel.overlap { margin-top: -16px; position: relative; z-index: 2; }
.km-panel h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.km-panel h3.bar::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--km-blue); }
.km-panel p { color: #555; font-size: 13px; line-height: 1.55; }
.km-user-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.km-user-row .av {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(145deg,#60a5fa,#1c69dd); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0;
}
.km-user-row .name { font-weight: 700; font-size: 15px; }
.km-user-row .desc { font-size: 12px; color: var(--km-sub); margin-top: 2px; }
.km-user-row .arrow { margin-left: auto; color: #c0c4cc; font-size: 18px; }
.km-cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.km-cat-grid .cell { background: #f5f7fb; border-radius: 12px; padding: 14px 12px; font-size: 13px; font-weight: 600; }
.km-cat-grid .n { color: var(--km-blue); margin-right: 6px; }
.km-preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.km-preview-grid .box { background: #f5f7fb; border-radius: 12px; padding: 14px; text-align: center; font-size: 12px; }
.km-locked { margin-top: 8px; padding: 16px; border-radius: 12px; background: #f5f7fb; color: var(--km-sub); font-size: 13px; text-align: center; }
.km-empty { text-align: center; color: var(--km-sub); padding: 48px 16px; font-size: 14px; }

.prod-hero {
  margin: 8px 16px 14px; border-radius: 18px; padding: 20px 18px 22px;
  color: #fff; position: relative; overflow: hidden; min-height: 190px;
  background: linear-gradient(145deg, #1a5fd4 0%, #1c69dd 45%, #4b8ef0 100%);
  box-shadow: 0 10px 28px rgba(28,105,221,.28);
}
.prod-hero .pill {
  display: inline-block; background: #fff; color: #1c69dd;
  font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px;
}
.prod-hero h1 { margin: 14px 0 8px; font-size: 26px; font-weight: 800; max-width: 58%; line-height: 1.25; }
.prod-hero .sub { font-size: 13px; opacity: .92; max-width: 58%; line-height: 1.4; }
.prod-hero .author { margin-top: 18px; font-size: 13px; opacity: .95; }
.prod-hero .right { position: absolute; right: 16px; top: 54px; text-align: right; }
.prod-hero .right .lab { font-size: 12px; opacity: .85; }
.prod-hero .right .p { font-size: 28px; font-weight: 800; margin: 4px 0; }
.prod-hero .right .s { font-size: 12px; opacity: .85; }

.port-hero {
  margin: 8px 16px; border-radius: 18px; padding: 22px 18px 28px; color: #fff; min-height: 160px;
  background:
    linear-gradient(135deg, rgba(21,87,189,.9), rgba(28,105,221,.75)),
    linear-gradient(145deg, #3b82f6, #1c69dd);
}

.km-mine-head {
  background: linear-gradient(180deg, #1c69dd 0%, #3b82f6 55%, #6ba3f5 100%);
  color: #fff; padding: 18px 16px 52px; border-radius: 0 0 24px 24px;
}
.km-mine-user { display: flex; align-items: center; gap: 12px; }
.km-mine-user .av {
  width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(255,255,255,.9);
  background: linear-gradient(145deg,#93c5fd,#1c69dd); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; flex-shrink: 0;
}
.km-mine-user .nm { font-size: 18px; font-weight: 800; }
.km-mine-user .bio { font-size: 12px; opacity: .92; margin-top: 4px; line-height: 1.4; }
.km-pill {
  display: inline-block; background: var(--km-orange); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: 6px; font-weight: 700;
}
.km-stat {
  margin: -30px 16px 14px; background: #fff; border-radius: 16px;
  box-shadow: 0 8px 24px rgba(28,105,221,.12);
  display: grid; grid-template-columns: repeat(3,1fr); padding: 18px 8px; position: relative; z-index: 2;
}
.km-stat div { text-align: center; border-right: 1px solid #f0f1f5; }
.km-stat div:last-child { border-right: 0; }
.km-stat span { font-size: 12px; color: var(--km-sub); }
.km-stat b { display: block; color: var(--km-blue); font-size: 22px; margin-top: 6px; font-weight: 800; }
.km-menu { padding: 0 16px 24px; display: flex; flex-direction: column; gap: 10px; }
.km-menu a {
  background: #fff; border-radius: 14px; padding: 15px 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 4px 14px rgba(31,35,41,.05); font-size: 15px; font-weight: 600;
}
.km-menu a .arrow { margin-left: auto; color: #c0c4cc; }
.km-menu .mi {
  width: 30px; height: 30px; border-radius: 8px; background: var(--km-blue-soft); color: var(--km-blue);
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800;
}

.km-form-card {
  margin: 12px 16px; background: #fff; border-radius: 16px; padding: 14px 16px; box-shadow: var(--km-shadow);
}
.km-form-card label { display: block; font-size: 12px; color: var(--km-sub); margin: 10px 0 6px; }
.km-form-card input, .km-form-card textarea {
  width: 100%; border: 1px solid var(--km-line); border-radius: 10px; padding: 10px 12px; background: #fafbff;
}
.km-form-card textarea { min-height: 72px; resize: vertical; }
.km-price-row { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-weight: 700; }
.km-price-row .v { color: var(--km-blue); font-size: 22px; }
.km-upload-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.km-upload-slot {
  border: 1.5px dashed #c9d4ea; border-radius: 12px; min-height: 100px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: var(--km-sub); font-size: 12px; background: #fafbff; padding: 10px; text-align: center; cursor: pointer;
}
.km-upload-slot.has { border-style: solid; border-color: var(--km-blue); color: var(--km-ink); }
.km-dev {
  display: none; margin: 8px 16px 20px; font-size: 11px; color: var(--km-sub);
  background: #fafbff; border-radius: 10px; padding: 8px 10px;
}
.km-dev.show { display: block; }
.km-dev button {
  border: 1px solid var(--km-line); background: #fff; border-radius: 6px;
  padding: 2px 8px; margin: 2px; cursor: pointer; font-size: 11px;
}
