/*
Theme Name: 克米设计手机版
Theme URI: https://example.com/km-design
Author: 克米设计
Author URI: https://example.com
Description: 移动端优先的 WordPress 论坛主题。内置版块、圈子、信息汇、日志、相册、签到、积分、道具、任务、勋章与前端发布中心，无需任何插件，数据全部存放在 usermeta / postmeta。
Version: 1.0.0
Requires at least: 6.2
Tested up to: 6.8
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: km-design
Tags: mobile, custom-colors, dark-mode, threaded-comments, custom-menu, featured-images, translation-ready
*/

/* ==========================================================================
   1. Tokens
   ========================================================================== */
:root {
  --km-primary: #00c5c6;
  --km-primary-dark: #00a6a7;
  --km-accent: #ff9e01;
  --km-accent-dark: #f08c00;
  --km-bg: #f2f3f5;
  --km-card: #ffffff;
  --km-text: #2b2b2b;
  --km-sub: #666666;
  --km-muted: #9a9a9a;
  --km-line: #ececec;
  --km-soft: #f7f7f8;
  --km-danger: #e6462f;
  --km-radius: 10px;
  --km-radius-sm: 6px;
  --km-radius-lg: 14px;
  --km-header-h: 48px;
  --km-tabbar-h: 56px;
  --km-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --km-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --km-shadow-up: 0 -2px 12px rgba(0, 0, 0, 0.05);
}

body.dark-mode {
  --km-bg: #121212;
  --km-card: #1c1c1e;
  --km-text: #e8e8e8;
  --km-sub: #b7b7b7;
  --km-muted: #8a8a8a;
  --km-line: #2a2a2c;
  --km-soft: #232325;
  --km-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   2. Reset / base
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--km-font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--km-text);
  background: #e9ecef;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.dark-mode { background: #000; }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 15px; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
figure { margin: 0; }

.km-app {
  position: relative;
  width: 100%;
  max-width: 750px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--km-bg);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.km-main {
  padding-bottom: calc(var(--km-tabbar-h) + 20px);
}

body.km-has-actionbar .km-main { padding-bottom: 76px; }

.km-wrap { padding: 0 12px; }
.km-section { background: var(--km-card); margin-bottom: 8px; padding: 12px; }
.km-card { background: var(--km-card); border-radius: var(--km-radius); }
.km-page { padding: 10px 10px 20px; }

.km-hide { display: none !important; }
.km-muted { color: var(--km-muted); }
.km-small { font-size: 12px; }
.km-teal { color: var(--km-primary); }
.km-accent { color: var(--km-accent); }
.km-row { display: flex; align-items: center; }
.km-between { display: flex; align-items: center; justify-content: space-between; }
.km-grow { flex: 1; min-width: 0; }
.km-ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.km-clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.km-mt8 { margin-top: 8px; }
.km-mt12 { margin-top: 12px; }
.km-scroll-x {
  display: flex; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.km-scroll-x::-webkit-scrollbar { display: none; }

/* ==========================================================================
   3. Top bar
   ========================================================================== */
.km-topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  height: var(--km-header-h);
  padding: 0 6px;
  background: var(--km-primary);
  color: #fff;
}
.admin-bar .km-topbar { top: 32px; }

.km-topbar__back,
.km-topbar__action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  color: #fff;
  border-radius: 50%;
}
.km-topbar__back svg,
.km-topbar__action svg { width: 22px; height: 22px; }

.km-topbar__title {
  flex: 1;
  min-width: 0;
  padding: 0 4px;
  font-size: 17px;
  font-weight: 500;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.km-topbar__actions { display: flex; align-items: center; }

/* Channel / sub tabs */
.km-tabs {
  position: sticky;
  top: var(--km-header-h);
  z-index: 80;
  display: flex;
  background: var(--km-card);
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--km-line);
}
.admin-bar .km-tabs { top: calc(var(--km-header-h) + 32px); }
.km-tabs::-webkit-scrollbar { display: none; }

.km-tab {
  position: relative;
  flex: 0 0 auto;
  padding: 11px 15px 9px;
  font-size: 15px;
  color: var(--km-sub);
  white-space: nowrap;
}
.km-tab.is-active { color: var(--km-primary); font-weight: 500; }
.km-tab.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  transform: translateX(-50%);
}

.km-tabs--sub .km-tab { flex: 1 0 auto; text-align: center; padding-left: 8px; padding-right: 8px; }
.km-tabs--equal .km-tab { flex: 1 1 0; }

/* ==========================================================================
   4. Buttons / chips / badges
   ========================================================================== */
.km-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--km-soft);
  color: var(--km-text);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.km-btn:active { transform: scale(0.98); }
.km-btn--accent { background: var(--km-accent); color: #fff; }
.km-btn--primary { background: var(--km-primary); color: #fff; }
.km-btn--ghost {
  background: transparent;
  border-color: var(--km-primary);
  color: var(--km-primary);
}
.km-btn--gray { background: #f0f0f0; color: #888; }
.km-btn--block { display: flex; width: 100%; height: 44px; font-size: 15px; border-radius: 8px; }
.km-btn--sm { height: 26px; padding: 0 10px; font-size: 12px; }
.km-btn--lg { height: 42px; padding: 0 22px; font-size: 14px; }
.km-btn[disabled] { opacity: 0.55; pointer-events: none; }

.km-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 197, 198, 0.1);
  color: var(--km-primary);
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
}
.km-chip--soft { background: var(--km-soft); color: var(--km-muted); }

.km-badge {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 10px;
  line-height: 16px;
  color: #fff;
  background: var(--km-primary);
  vertical-align: 1px;
}
.km-badge--group { background: #a5c916; }
.km-badge--vip { background: #f3324b; }
.km-badge--lv { background: #00b4b5; }
.km-badge--new { background: #fff; color: var(--km-danger); border: 1px solid currentColor; }
.km-badge--hot { background: #fff0e0; color: var(--km-accent); }
.km-badge--verify { background: var(--km-accent); border-radius: 50%; width: 15px; height: 15px; padding: 0; justify-content: center; }

.km-gender {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  font-size: 10px;
  color: #fff;
  background: #f06ea9;
}
.km-gender--male { background: #59a5f5; }

/* ==========================================================================
   5. Avatars / user line
   ========================================================================== */
.km-avatar {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #e8e8e8;
}
.km-avatar--sm { width: 26px; height: 26px; }
.km-avatar--lg { width: 64px; height: 64px; border: 2px solid #fff; }
.km-avatar--xl { width: 76px; height: 76px; border: 3px solid #fff; }

.km-userline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.km-userline__body { min-width: 0; flex: 1; }
.km-userline__name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 500;
  color: var(--km-text);
  line-height: 1.4;
}
.km-userline__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--km-muted);
  line-height: 1.5;
}

/* ==========================================================================
   6. Section head
   ========================================================================== */
.km-sec { background: var(--km-card); margin-bottom: 8px; }
.km-sec__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 12px 11px;
}
.km-sec__title {
  position: relative;
  padding-left: 11px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--km-text);
}
.km-sec__title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 16px;
  margin-top: -8px;
  border-radius: 2px;
  background: var(--km-primary);
}
.km-sec__more { font-size: 12px; color: #bbb; }
.km-sec__body { padding: 0 12px 12px; }
.km-sec--flush .km-sec__body { padding: 0; }

/* ==========================================================================
   7. Post card
   ========================================================================== */
.km-feed { padding: 8px; }
.km-post {
  background: var(--km-card);
  border-radius: var(--km-radius);
  padding: 12px 12px 8px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}
.km-post__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.km-post__head .km-btn { margin-left: auto; }

.km-post__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--km-text);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.km-post__title a { color: inherit; }
.km-post__excerpt {
  font-size: 13px;
  line-height: 1.65;
  color: var(--km-sub);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.km-post--plain .km-post__title { margin-bottom: 10px; }

/* media layouts */
.km-media { display: grid; gap: 3px; margin-bottom: 8px; border-radius: 8px; overflow: hidden; }
.km-media__item { position: relative; display: block; overflow: hidden; background: #f0f0f0; }
.km-media__item img { width: 100%; height: 100%; object-fit: cover; }

.km-media--single { display: block; }
.km-media--single .km-media__item { width: 100%; aspect-ratio: 16 / 9; }
.km-media--single .km-media__item img { position: absolute; inset: 0; }

.km-media--triple { grid-template-columns: repeat(3, 1fr); }
.km-media--triple .km-media__item { aspect-ratio: 1 / 1; }

.km-media--wall {
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 178px;
}
.km-media--wall .km-media__item:first-child { grid-row: 1 / span 2; }
.km-media--wall .km-media__item img { position: absolute; inset: 0; }

.km-media--grid { grid-template-columns: repeat(3, 1fr); }
.km-media--grid .km-media__item { aspect-ratio: 1 / 1; }

.km-media__more {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
}

.km-post__foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 6px;
  font-size: 12px;
  color: var(--km-muted);
}
.km-stat { display: inline-flex; align-items: center; gap: 4px; }
.km-stat svg { width: 15px; height: 15px; }
.km-stat.is-on { color: var(--km-primary); }
.km-stat.is-on svg { stroke: var(--km-primary); fill: rgba(0, 197, 198, 0.12); }
.km-post__cat { margin-left: auto; color: var(--km-primary); font-size: 11px; }

/* news style card */
.km-news { display: flex; gap: 10px; padding: 12px; background: var(--km-card); border-bottom: 1px solid var(--km-line); }
.km-news:last-child { border-bottom: 0; }
.km-news__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.km-news__title {
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--km-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.km-news__meta { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; font-size: 11px; color: var(--km-muted); }
.km-news__thumb { flex: 0 0 96px; width: 96px; height: 68px; border-radius: 6px; overflow: hidden; background: #eee; }
.km-news__thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   8. Listing card
   ========================================================================== */
.km-listing { display: flex; gap: 10px; padding: 12px; background: var(--km-card); border-bottom: 1px solid var(--km-line); }
.km-listing__media { position: relative; flex: 0 0 104px; width: 104px; height: 84px; border-radius: 6px; overflow: hidden; background: #eee; }
.km-listing__media img { width: 100%; height: 100%; object-fit: cover; }
.km-listing__kind {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 1px 6px;
  border-radius: 0 6px 0 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 10px;
}
.km-listing__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.km-listing__title { font-size: 15px; font-weight: 500; line-height: 1.45; color: var(--km-text); }
.km-listing__loc { margin-top: 5px; font-size: 11px; color: var(--km-muted); }
.km-listing__price { margin-left: auto; color: var(--km-accent); font-size: 17px; font-weight: 600; white-space: nowrap; }
.km-listing__price small { font-size: 11px; font-weight: 400; }
.km-listing__attrs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.km-attr { padding: 0 5px; border: 1px solid currentColor; border-radius: 2px; font-size: 10px; line-height: 16px; }
.km-attr--blue { color: #5b9bd5; }
.km-attr--red { color: #e07070; }
.km-attr--green { color: #59a86b; }
.km-attr--purple { color: #9a86c8; }

/* ==========================================================================
   9. Home sections
   ========================================================================== */
/* hero */
.km-hero { position: relative; background: #000; }
.km-hero__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.km-hero__track::-webkit-scrollbar { display: none; }
.km-hero__slide { position: relative; display: block; flex: 0 0 100%; height: 200px; scroll-snap-align: start; overflow: hidden; }
.km-hero__slide > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.km-hero__mask {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.62) 100%);
}
.km-hero__cap { position: absolute; z-index: 2; left: 12px; right: 12px; bottom: 12px; color: #fff; }
.km-hero__title {
  font-size: 16px; font-weight: 500; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.km-hero__meta { display: flex; align-items: center; gap: 10px; margin-top: 5px; font-size: 11px; color: rgba(255, 255, 255, 0.85); }
.km-hero__dots { position: absolute; right: 12px; bottom: 10px; display: flex; gap: 4px; }
.km-hero__dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, 0.45); }
.km-hero__dot.is-active { background: #fff; }

/* quick entries */
.km-quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 14px 8px; background: var(--km-card); margin-bottom: 8px; }
.km-quick__item { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.km-quick__icon {
  display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 14px;
  background: #e9f7f1; color: #4caf7d;
}
.km-quick__icon svg { width: 26px; height: 26px; }
.km-quick__item:nth-child(2) .km-quick__icon { background: #fff4e0; color: #f0a100; }
.km-quick__item:nth-child(3) .km-quick__icon { background: #e6f6ef; color: #29b39a; }
.km-quick__item:nth-child(4) .km-quick__icon { background: #ffecec; color: #ef6a6a; }
.km-quick__item:nth-child(5) .km-quick__icon { background: #fff3e2; color: #f0a24a; }
.km-quick__label { font-size: 12px; color: var(--km-sub); }
.km-quick__hot {
  position: absolute; top: -6px; right: 6px;
  padding: 0 4px; border-radius: 4px 4px 4px 0;
  background: var(--km-accent); color: #fff; font-size: 9px; line-height: 14px;
}

/* notice */
.km-notice {
  display: flex; align-items: center; gap: 8px;
  margin: 0 8px 8px; padding: 8px 10px;
  background: linear-gradient(90deg, #fff6e8, #fffdf8);
  border-radius: 8px; font-size: 12px; color: #a06a1e;
}
.km-notice__icon { font-size: 16px; }
.km-notice__text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.km-notice .km-btn { height: 24px; padding: 0 10px; font-size: 11px; }

/* news flash */
.km-flash { display: flex; gap: 10px; padding: 12px; background: var(--km-card); margin-bottom: 8px; }
.km-flash__label {
  flex: 0 0 44px; text-align: center; padding: 3px 0;
  background: var(--km-danger); color: #fff; border-radius: 4px;
  font-size: 9px; line-height: 1.35; letter-spacing: 0.5px;
}
.km-flash__label strong { display: block; font-size: 12px; }
.km-flash__list { flex: 1; min-width: 0; }
.km-flash__item {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--km-text); line-height: 26px;
}
.km-flash__item::before { content: ""; width: 4px; height: 4px; border-radius: 1px; background: var(--km-primary); flex: 0 0 auto; }
.km-flash__item span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ads */
.km-ads { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 8px 8px; }
.km-ad { position: relative; border-radius: 8px; overflow: hidden; background: #e9ecef; aspect-ratio: 2 / 1; }
.km-ad--wide { grid-column: span 2; aspect-ratio: 3 / 1; }
.km-ad img { width: 100%; height: 100%; object-fit: cover; }
.km-ad__tag {
  position: absolute; right: 6px; bottom: 6px;
  padding: 0 5px; border-radius: 3px;
  background: rgba(0, 0, 0, 0.45); color: rgba(255, 255, 255, 0.9); font-size: 9px;
}

/* expose list */
.km-expose__item { display: flex; gap: 10px; padding: 11px 12px; border-top: 1px solid var(--km-line); }
.km-expose__thumb { flex: 0 0 88px; width: 88px; height: 62px; border-radius: 6px; overflow: hidden; background: #eee; }
.km-expose__thumb img { width: 100%; height: 100%; object-fit: cover; }
.km-expose__body { flex: 1; min-width: 0; }
.km-expose__title { font-size: 14px; line-height: 1.5; color: var(--km-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.km-expose__meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; font-size: 11px; color: var(--km-muted); }
.km-expose__meta .km-badge { transform: scale(0.92); }

/* masonry */
.km-masonry { columns: 2; column-gap: 6px; padding: 0 8px; }
.km-masonry__item {
  position: relative; display: block; break-inside: avoid;
  margin-bottom: 6px; border-radius: 8px; overflow: hidden; background: #eee;
}
.km-masonry__item img { width: 100%; display: block; }
.km-masonry__cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px 8px 6px; color: #fff; font-size: 11px; line-height: 1.4;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.6));
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* quotes */
.km-quotes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 8px 8px; }
.km-quote {
  position: relative; background: var(--km-card); border-radius: 8px;
  padding: 22px 10px 10px; min-height: 96px;
}
.km-quote::before {
  content: "\201C"; position: absolute; left: 8px; top: 0;
  font-family: Georgia, serif; font-size: 34px; line-height: 1; color: #e6e6e6;
}
body.dark-mode .km-quote::before { color: #333; }
.km-quote__text { font-size: 13.5px; line-height: 1.55; color: var(--km-text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.km-quote__by { display: flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 11px; color: var(--km-muted); }
.km-quote__by img { width: 16px; height: 16px; border-radius: 50%; }

/* tag cloud */
.km-tagcloud { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 12px; }
.km-tag {
  padding: 4px 10px; border-radius: 999px;
  background: var(--km-soft); color: var(--km-sub); font-size: 12px;
}
.km-tag:nth-child(3n) { color: var(--km-primary); background: rgba(0, 197, 198, 0.09); }
.km-tag:nth-child(4n) { color: #e08a00; background: rgba(255, 158, 1, 0.1); }

/* members rank */
.km-members { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 6px 12px 16px; }
.km-member { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.km-member__ring {
  position: relative; width: 58px; height: 58px; border-radius: 50%;
  padding: 2px; background: linear-gradient(145deg, #ffd76e, #ff9e01);
}
.km-member:nth-child(2) .km-member__ring { background: linear-gradient(145deg, #c8d6e5, #8fa6bd); }
.km-member:nth-child(3) .km-member__ring { background: linear-gradient(145deg, #f3c9a0, #d99b62); }
.km-member:nth-child(4) .km-member__ring { background: linear-gradient(145deg, #e3e3e3, #bdbdbd); }
.km-member__ring img { width: 100%; height: 100%; border-radius: 50%; border: 2px solid var(--km-card); object-fit: cover; }
.km-member__no {
  position: absolute; left: 50%; bottom: -3px; transform: translateX(-50%);
  padding: 0 5px; border-radius: 6px;
  background: var(--km-accent); color: #fff; font-size: 9px; line-height: 13px; white-space: nowrap;
}
.km-member__name { font-size: 11px; color: var(--km-sub); max-width: 64px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* load more */
.km-loadmore { padding: 12px 12px 20px; text-align: center; }
.km-loadmore .km-btn { width: 100%; height: 42px; background: var(--km-card); color: var(--km-muted); border-radius: 999px; }

/* ==========================================================================
   10. Article / single
   ========================================================================== */
.km-article { background: var(--km-card); padding: 16px 14px 20px; }
.km-article__title { font-size: 21px; font-weight: 600; line-height: 1.5; text-align: center; margin-bottom: 8px; }
.km-article__meta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 11px; color: var(--km-muted); margin-bottom: 14px;
}
.km-article__cover { margin: 0 0 14px; border-radius: 8px; overflow: hidden; }
.km-article__cover img { width: 100%; }

.km-content { font-size: 16px; line-height: 1.9; color: var(--km-text); word-break: break-word; }
.km-content > p { text-indent: 2em; margin-bottom: 12px; }
.km-content img { border-radius: 6px; margin: 10px auto; }
.km-content h2, .km-content h3 { margin: 18px 0 8px; font-size: 17px; }
.km-content blockquote {
  margin: 12px 0; padding: 10px 12px;
  border-left: 3px solid var(--km-primary); background: var(--km-soft);
  color: var(--km-sub); font-size: 14px;
}
.km-content a { color: var(--km-primary); }
.km-content ul, .km-content ol { padding-left: 22px; list-style: disc; margin-bottom: 12px; }
.km-content ol { list-style: decimal; }

.km-tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; background: var(--km-card); }
.km-tags .km-tag { font-size: 11px; padding: 3px 10px; }

/* reward */
.km-reward { padding: 16px 14px 8px; background: var(--km-card); text-align: center; border-top: 8px solid var(--km-bg); }
.km-reward__hint { font-size: 12px; color: var(--km-muted); }
.km-reward__btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px; margin: 10px auto 6px;
  border: 0; border-radius: 50%;
  background: var(--km-accent); color: #fff; font-size: 20px;
  box-shadow: 0 6px 14px rgba(255, 158, 1, 0.35);
}
.km-reward__count { font-size: 12px; color: var(--km-muted); }
.km-reward__list { margin-top: 12px; text-align: left; }
.km-reward__item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--km-line); }
.km-reward__item .km-avatar { width: 30px; height: 30px; }
.km-reward__who { font-size: 12px; color: var(--km-sub); }
.km-reward__note { font-size: 12px; color: var(--km-sub); }
.km-reward__amount { margin-left: auto; font-size: 12px; color: var(--km-accent); }
.km-reward__faces { display: flex; align-items: center; justify-content: center; padding: 6px 14px 14px; background: var(--km-card); }
.km-reward__faces img { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--km-card); margin-left: -6px; }
.km-reward__faces img:first-child { margin-left: 0; }
.km-reward__faces span { margin-left: 8px; font-size: 11px; color: var(--km-muted); }

/* reactions */
.km-react { display: flex; justify-content: space-around; align-items: flex-end; padding: 14px 6px 12px; background: var(--km-card); border-top: 8px solid var(--km-bg); }
.km-react__item {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  height: 118px;
  border: 0; background: none; padding: 0 4px; color: var(--km-muted);
}
.km-react__count { font-size: 12px; line-height: 1; }
.km-react__bar { display: block; width: 5px; border-radius: 3px; background: #e3e3e3; min-height: 4px; transition: height 0.2s ease; }
.km-react__item:nth-child(1) .km-react__bar { background: #7fb2e5; }
.km-react__item:nth-child(2) .km-react__bar { background: #f06a4d; }
.km-react__item:nth-child(3) .km-react__bar { background: #ffb020; }
.km-react__item:nth-child(4) .km-react__bar { background: #e5484d; }
.km-react__item:nth-child(5) .km-react__bar { background: #9d8df1; }
.km-react__icon { font-size: 22px; line-height: 1.1; filter: grayscale(0.15); }
.km-react__label { font-size: 11px; }
.km-react__item.is-on .km-react__label { color: var(--km-primary); font-weight: 500; }

/* prev next */
.km-prevnext { margin-top: 8px; background: var(--km-card); padding: 12px 14px; font-size: 13px; color: var(--km-sub); }
.km-prevnext a { display: block; padding: 4px 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.km-prevnext span { color: var(--km-muted); }

/* comments */
.km-comments { margin-top: 8px; background: var(--km-card); padding: 14px; }
.km-comments__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.km-comments__title { font-size: 15px; font-weight: 600; }
.km-comments__title span { color: var(--km-muted); font-weight: 400; margin-left: 4px; }

.km-comment { display: flex; gap: 8px; padding: 12px 0; border-top: 1px solid var(--km-line); }
.km-comment:first-of-type { border-top: 0; }
.km-comment__body { flex: 1; min-width: 0; }
.km-comment__head { display: flex; align-items: center; gap: 6px; }
.km-comment__name { font-size: 13px; color: var(--km-sub); }
.km-comment__time { font-size: 11px; color: var(--km-muted); }
.km-comment__reply {
  margin-left: auto; border: 0; background: none; color: var(--km-muted);
  font-size: 11px; padding: 2px 6px; border-radius: 10px; background: var(--km-soft);
}
.km-comment__text { margin-top: 4px; font-size: 14px; line-height: 1.65; color: var(--km-text); word-break: break-word; }
.km-comment__quote {
  margin: 6px 0 4px; padding: 6px 8px; border-left: 2px solid #ddd;
  background: var(--km-soft); color: var(--km-muted); font-size: 12px;
  border-radius: 0 4px 4px 0;
}
.km-comment__children { margin-top: 8px; padding-left: 38px; }
.km-comment__children .km-comment { border-top: 0; padding: 8px 0 0; }

.km-comment-form { margin-top: 12px; }
.km-comment-form textarea {
  width: 100%; min-height: 84px; padding: 10px;
  border: 1px solid var(--km-line); border-radius: 8px;
  background: var(--km-soft); color: var(--km-text); resize: vertical;
}
.km-comment-form__foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.km-comment-form__foot .km-btn { margin-left: auto; }

/* single action bar */
.km-actionbar {
  position: fixed; left: 50%; bottom: 0; z-index: 95;
  display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: 750px; transform: translateX(-50%);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--km-card); border-top: 1px solid var(--km-line);
}
.km-actionbar__input {
  flex: 1; height: 36px; padding: 0 14px;
  border: 0; border-radius: 18px; background: var(--km-soft);
  color: var(--km-muted); font-size: 13px; text-align: left;
}
.km-actionbar__btn {
  position: relative; display: flex; flex-direction: column; align-items: center;
  border: 0; background: none; color: var(--km-muted); font-size: 10px; gap: 1px;
}
.km-actionbar__btn svg { width: 22px; height: 22px; }
.km-actionbar__btn.is-on { color: var(--km-primary); }
.km-actionbar__badge {
  position: absolute; top: -4px; right: -6px; min-width: 15px; height: 15px;
  padding: 0 4px; border-radius: 8px; background: #f3324b; color: #fff;
  font-size: 9px; line-height: 15px; text-align: center;
}

/* ==========================================================================
   11. Tabbar / fab / drawer
   ========================================================================== */
.km-tabbar {
  position: fixed; left: 50%; bottom: 0; z-index: 90;
  display: flex; align-items: flex-end; justify-content: space-around;
  width: 100%; max-width: 750px; transform: translateX(-50%);
  height: calc(var(--km-tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--km-card); border-top: 1px solid var(--km-line);
  box-shadow: var(--km-shadow-up);
}
.km-tabbar__item {
  position: relative; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; height: var(--km-tabbar-h); color: #9b9b9b; font-size: 10px;
}
.km-tabbar__item svg { width: 22px; height: 22px; }
.km-tabbar__item.is-active { color: var(--km-primary); }
.km-tabbar__plus {
  flex: 0 0 64px;
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; margin-top: -22px;
  border-radius: 50%; background: var(--km-primary); color: #fff;
  box-shadow: 0 4px 12px rgba(0, 197, 198, 0.4);
}
.km-tabbar__plus svg { width: 26px; height: 26px; }

.km-fab {
  position: fixed; right: 14px; bottom: calc(var(--km-tabbar-h) + 24px);
  z-index: 85; display: flex; flex-direction: column; gap: 10px;
}
.km-fab__btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%;
  border: 0; color: #fff; font-size: 8.5px; line-height: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}
.km-fab__btn svg { width: 20px; height: 20px; margin-bottom: 2px; }
.km-fab__btn--menu { background: var(--km-accent); }
.km-fab__btn--publish { background: var(--km-primary); }
.km-fab__btn--message { background: var(--km-accent); }
.km-fab__badge {
  position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 8px; background: #f3324b; color: #fff;
  font-size: 9px; line-height: 16px; text-align: center;
}

.km-drawer { position: fixed; inset: 0; z-index: 120; visibility: hidden; }
.km-drawer.is-open { visibility: visible; }
.km-drawer__mask {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45);
  opacity: 0; transition: opacity 0.22s ease;
}
.km-drawer.is-open .km-drawer__mask { opacity: 1; }
.km-drawer__panel {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 78%; max-width: 320px; padding: 22px 18px;
  background: var(--km-card); overflow-y: auto;
  transform: translateX(-100%); transition: transform 0.24s ease;
}
.km-drawer.is-open .km-drawer__panel { transform: translateX(0); }
.km-drawer__user { display: flex; align-items: center; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--km-line); }
.km-drawer__name { font-size: 16px; font-weight: 600; }
.km-drawer__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 18px 0; }
.km-drawer__link {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 0; border-radius: 8px; background: var(--km-soft);
  font-size: 11px; color: var(--km-sub);
}
.km-drawer__link svg { width: 20px; height: 20px; color: var(--km-primary); }
.km-drawer__rows { border-top: 1px solid var(--km-line); padding-top: 8px; }

/* ==========================================================================
   12. Footer
   ========================================================================== */
.km-footer {
  padding: 18px 12px calc(var(--km-tabbar-h) + 26px);
  text-align: center; color: var(--km-muted); font-size: 11px;
}
.km-footer__links { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--km-sub); font-size: 13px; }
.km-footer__links span { color: #d0d0d0; }
.km-footer__copy { margin-top: 10px; line-height: 1.7; }

/* ==========================================================================
   13. Lists / forms / switches
   ========================================================================== */
.km-list { background: var(--km-card); border-radius: var(--km-radius); overflow: hidden; margin-bottom: 10px; }
.km-list__item {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 14px;
  border-bottom: 1px solid var(--km-line);
  font-size: 14px; color: var(--km-text);
}
.km-list__item:last-child { border-bottom: 0; }
.km-list__icon { display: flex; width: 20px; color: var(--km-muted); }
.km-list__icon svg { width: 19px; height: 19px; }
.km-list__label { flex: 1; min-width: 0; }
.km-list__value { font-size: 12px; color: var(--km-muted); }
.km-list__arrow { color: #ccc; font-size: 16px; line-height: 1; }
.km-list__item.is-danger .km-list__label { color: var(--km-danger); }

.km-form { padding: 4px 0; }
.km-field { padding: 12px 14px; background: var(--km-card); border-bottom: 1px solid var(--km-line); }
.km-field--row { display: flex; align-items: center; gap: 10px; }
.km-label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--km-sub); }
.km-label em { color: var(--km-danger); font-style: normal; margin-left: 3px; }
.km-input, .km-textarea, .km-select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--km-line);
  border-radius: 8px; background: var(--km-soft); color: var(--km-text);
  outline: none; appearance: none;
}
.km-input:focus, .km-textarea:focus, .km-select:focus { border-color: var(--km-primary); background: var(--km-card); }
.km-textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.km-hint { margin-top: 6px; font-size: 11px; color: var(--km-muted); }
.km-submit { padding: 16px 14px; }

.km-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: 0 0 auto; }
.km-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.km-switch__track {
  position: absolute; inset: 0; border-radius: 12px; background: #dcdcdc; transition: background 0.2s;
}
.km-switch__track::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.km-switch input:checked + .km-switch__track { background: var(--km-primary); }
.km-switch input:checked + .km-switch__track::after { transform: translateX(20px); }

.km-upload { display: flex; flex-wrap: wrap; gap: 8px; }
.km-upload__add {
  display: flex; align-items: center; justify-content: center;
  width: 76px; height: 76px; border: 1px dashed #d5d5d5; border-radius: 8px;
  background: var(--km-soft); color: var(--km-muted); font-size: 11px;
  flex-direction: column; gap: 3px;
}
.km-upload__add svg { width: 20px; height: 20px; }
.km-upload__preview { position: relative; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; }
.km-upload__preview img { width: 100%; height: 100%; object-fit: cover; }
.km-upload__preview button {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff;
  font-size: 12px; line-height: 18px; padding: 0;
}
.km-upload input[type="file"] { display: none; }

.km-radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.km-radio {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border: 1px solid var(--km-line); border-radius: 999px;
  font-size: 12px; color: var(--km-sub); background: var(--km-soft);
}
.km-radio input { display: none; }
.km-radio.is-on { border-color: var(--km-primary); color: var(--km-primary); background: rgba(0, 197, 198, 0.08); }

/* ==========================================================================
   14. Profile / user center / space
   ========================================================================== */
.km-profile { position: relative; margin-bottom: 10px; }
.km-profile__cover {
  position: relative; height: 150px; overflow: hidden; background: #2f3d4a;
}
.km-profile__cover img { width: 100%; height: 100%; object-fit: cover; }
.km-profile__cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.45));
}
.km-profile__card {
  position: relative; margin: -34px 10px 0; padding: 0 12px 12px;
  background: var(--km-card); border-radius: 12px; box-shadow: var(--km-shadow);
}
.km-profile__top { display: flex; align-items: flex-end; gap: 10px; }
.km-profile__avatar { margin-top: -26px; }
.km-profile__name { display: flex; align-items: center; gap: 6px; padding-top: 8px; font-size: 18px; font-weight: 600; }
.km-profile__uid { font-size: 11px; color: var(--km-muted); }
.km-profile__stats { display: flex; gap: 18px; margin-left: auto; padding-top: 10px; text-align: center; }
.km-profile__stat { font-size: 16px; font-weight: 600; color: var(--km-accent); line-height: 1.2; }
.km-profile__stat span { display: block; font-size: 11px; font-weight: 400; color: var(--km-muted); }

.km-grid8 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 4px; padding: 16px 12px; background: var(--km-card); border-radius: 12px; margin-bottom: 10px; }
.km-grid8__item { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; color: var(--km-sub); }
.km-grid8__icon { font-size: 22px; line-height: 1; }

.km-assets { display: grid; grid-template-columns: 1fr 1fr; background: var(--km-card); border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
.km-asset { display: flex; align-items: center; justify-content: space-between; padding: 14px; border-bottom: 1px solid var(--km-line); font-size: 13px; color: var(--km-sub); }
.km-asset:nth-last-child(-n + 2) { border-bottom: 0; }
.km-asset:nth-child(odd) { border-right: 1px solid var(--km-line); }
.km-asset b { font-size: 16px; font-weight: 600; color: var(--km-primary); }

.km-kv { background: var(--km-card); border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
.km-kv__row { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border-bottom: 1px solid var(--km-line); font-size: 13px; color: var(--km-sub); }
.km-kv__row:last-child { border-bottom: 0; }
.km-kv__row b { font-weight: 400; color: var(--km-text); }

.km-cover-edit { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: #fff; }

/* ==========================================================================
   15. Points / shop / tasks / badges
   ========================================================================== */
.km-points-hero { padding: 18px 16px 16px; background: var(--km-primary); color: #fff; }
.km-points-hero__label { font-size: 13px; opacity: 0.9; }
.km-points-hero__num { font-size: 40px; font-weight: 600; line-height: 1.1; margin: 4px 0 6px; }
.km-points-hero__formula { font-size: 11px; line-height: 1.6; color: rgba(255, 255, 255, 0.85); }

.km-balance { background: var(--km-card); }
.km-balance__row { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border-bottom: 1px solid var(--km-line); font-size: 13px; }
.km-balance__row:last-child { border-bottom: 0; }
.km-balance__row a { color: var(--km-accent); font-size: 12px; }

.km-banner {
  position: relative; margin: 10px; padding: 22px 16px;
  border-radius: 14px; color: #fff; overflow: hidden;
  background: linear-gradient(120deg, #ff8a00, #ff5e3a);
}
.km-banner--gold { background: linear-gradient(120deg, #ffcf3f, #ff9e01); }
.km-banner--blue { background: linear-gradient(120deg, #4facfe, #00b4d8); }
.km-banner__title { font-size: 26px; font-weight: 700; letter-spacing: 1px; line-height: 1.2; }
.km-banner__sub { margin-top: 6px; font-size: 12px; opacity: 0.9; }
.km-banner__art { position: absolute; right: 14px; bottom: 6px; font-size: 54px; opacity: 0.9; }

.km-subtabs { display: flex; background: var(--km-card); border-bottom: 1px solid var(--km-line); }
.km-subtabs .km-tab { flex: 1; text-align: center; padding-left: 4px; padding-right: 4px; font-size: 14px; }

.km-shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 10px; }
.km-shop-item { background: var(--km-card); border-radius: 10px; padding: 10px 8px 0; text-align: center; overflow: hidden; }
.km-shop-item__icon { font-size: 36px; line-height: 1.3; }
.km-shop-item__name { font-size: 13px; margin-top: 4px; }
.km-shop-item__price { font-size: 11px; color: var(--km-muted); margin-top: 2px; }
.km-shop-item .km-btn { margin: 8px -8px 0; width: calc(100% + 16px); border-radius: 0; display: flex; height: 30px; font-size: 12px; }

.km-task { display: flex; align-items: center; gap: 10px; padding: 13px 14px; background: var(--km-card); border-bottom: 1px solid var(--km-line); }
.km-task__icon { flex: 0 0 34px; font-size: 28px; text-align: center; }
.km-task__body { flex: 1; min-width: 0; }
.km-task__title { font-size: 14px; color: var(--km-text); }
.km-task__reward { font-size: 11px; color: var(--km-muted); margin-top: 2px; }
.km-task .km-btn { height: 28px; font-size: 12px; padding: 0 12px; }

.km-badge-item { display: flex; align-items: center; gap: 10px; padding: 13px 14px; background: var(--km-card); border-bottom: 1px solid var(--km-line); }
.km-badge-item__icon { flex: 0 0 36px; font-size: 30px; text-align: center; }
.km-badge-item__body { flex: 1; min-width: 0; }
.km-badge-item__title { font-size: 14px; }
.km-badge-item__desc { font-size: 11px; color: var(--km-muted); margin-top: 2px; line-height: 1.5; }

/* ==========================================================================
   16. Messages / favorites / friends / circles
   ========================================================================== */
.km-msg { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--km-card); border-bottom: 1px solid var(--km-line); }
.km-msg__icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; }
.km-msg__icon svg { width: 20px; height: 20px; }
.km-msg__icon--blue { background: #5eaef5; }
.km-msg__icon--red { background: #f06a6a; }
.km-msg__icon--green { background: #9ccc3c; }
.km-msg__icon--orange { background: #ffa726; }
.km-msg__icon--pink { background: #f28aa6; }
.km-msg__icon--purple { background: #9d8df1; }
.km-msg__label { flex: 1; font-size: 14px; }
.km-msg__count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #f3324b; color: #fff; font-size: 10px; line-height: 18px; text-align: center; }

.km-user-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--km-card); border-bottom: 1px solid var(--km-line); }
.km-user-row__body { flex: 1; min-width: 0; }
.km-user-row__name { font-size: 14px; display: flex; align-items: center; gap: 5px; }
.km-user-row__meta { font-size: 11px; color: var(--km-muted); margin-top: 2px; }
.km-user-row__actions { display: flex; gap: 6px; }
.km-user-row__actions .km-btn { height: 26px; font-size: 11px; padding: 0 9px; }

.km-circle-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px; background: var(--km-card); border-radius: 10px; text-align: center;
}
.km-circle-card__icon { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; background: var(--km-soft); }
.km-circle-card__name { font-size: 13px; }
.km-circle-card__meta { font-size: 10px; color: var(--km-muted); }
.km-circle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 10px 10px; }

.km-community { display: flex; min-height: calc(100vh - var(--km-header-h)); background: var(--km-card); }
.km-community__rail { flex: 0 0 96px; background: var(--km-bg); padding-top: 6px; }
.km-community__rail a { display: block; padding: 14px 10px; font-size: 13px; color: var(--km-sub); border-left: 3px solid transparent; }
.km-community__rail a.is-active { background: var(--km-card); color: var(--km-primary); border-left-color: var(--km-primary); font-weight: 500; }
.km-community__body { flex: 1; min-width: 0; padding: 4px 0; }

.km-forum-row { display: flex; align-items: center; gap: 10px; padding: 13px 12px; border-bottom: 1px solid var(--km-line); }
.km-forum-row__icon { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--km-soft); }
.km-forum-row__body { flex: 1; min-width: 0; }
.km-forum-row__name { font-size: 14px; }
.km-forum-row__meta { font-size: 11px; color: var(--km-muted); margin-top: 2px; }
.km-forum-row .km-btn { height: 28px; padding: 0 12px; font-size: 12px; }

/* appearance */
.km-swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 12px; background: var(--km-card); }
.km-swatch { display: flex; flex-direction: column; gap: 6px; align-items: center; font-size: 11px; color: var(--km-muted); }
.km-swatch__color {
  width: 100%; aspect-ratio: 2.4 / 1; border-radius: 4px;
  border: 2px solid transparent; outline: 1px solid rgba(0, 0, 0, 0.04);
}
.km-swatch input { display: none; }
.km-swatch input:checked + .km-swatch__color { border-color: #333; box-shadow: 0 0 0 2px #fff inset; }

/* ==========================================================================
   17. Empty state / toast / pagination
   ========================================================================== */
.km-empty { padding: 40px 20px; text-align: center; color: var(--km-muted); background: var(--km-card); }
.km-empty__art { width: 96px; height: 96px; margin: 0 auto 10px; opacity: 0.35; }
.km-empty__text { font-size: 13px; }

.km-toast {
  position: fixed; left: 50%; bottom: 96px; z-index: 200;
  max-width: 80%; padding: 9px 16px; border-radius: 20px;
  background: rgba(0, 0, 0, 0.78); color: #fff; font-size: 13px;
  transform: translate(-50%, 10px); opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.km-toast.is-show { opacity: 1; transform: translate(-50%, 0); }

.km-pagination { display: flex; justify-content: center; gap: 6px; padding: 14px; }
.km-pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 6px;
  background: var(--km-card); color: var(--km-sub); font-size: 12px;
}
.km-pagination .page-numbers.current { background: var(--km-primary); color: #fff; }

/* ==========================================================================
   18. Misc
   ========================================================================== */
.km-login-tip { padding: 14px; text-align: center; font-size: 13px; color: var(--km-muted); background: var(--km-card); }
.km-divider { height: 8px; background: var(--km-bg); }
.km-note { padding: 10px 12px; font-size: 11px; color: #c58a00; background: #fff8e6; border-radius: 8px; line-height: 1.6; }
body.dark-mode .km-note { background: #2a2416; color: #d8b25c; }

.km-search { display: flex; gap: 8px; padding: 10px; background: var(--km-card); }
.km-search input { flex: 1; }

.km-review { padding: 8px 12px; font-size: 11px; color: var(--km-muted); }

@media (min-width: 751px) {
  .km-app { min-height: calc(100vh - 40px); margin: 20px auto; border-radius: 16px; }
  .km-tabbar, .km-actionbar { border-radius: 0 0 16px 16px; }
}

@media (max-width: 360px) {
  .km-quick__icon { width: 42px; height: 42px; }
  .km-quick__label { font-size: 11px; }
  .km-members { grid-template-columns: repeat(4, 1fr); }
}

/* WordPress core bits */
.alignleft { float: left; margin: 0 12px 8px 0; }
.alignright { float: right; margin: 0 0 8px 12px; }
.aligncenter { display: block; margin: 8px auto; }
.wp-caption { max-width: 100%; }
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}

/* ==========================================================================
   19. Template glue
   ========================================================================== */
.km-ph {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 60px;
  background: linear-gradient(135deg, #eef0f2, #e2e5e8);
}
body.dark-mode .km-ph { background: linear-gradient(135deg, #26262a, #1e1e22); }

.km-flash-bar {
  margin: 8px 8px 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: #e8f8f8;
  color: #00898a;
  font-size: 12px;
}
body.dark-mode .km-flash-bar { background: #143033; color: #62d6d7; }

.km-article__author {
  padding: 0 0 12px;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--km-line);
}

.km-post__excerpt { display: -webkit-box; }

.km-quick__item { text-align: center; }

.km-hero__cap { padding-right: 48px; }

.km-term-icon,
.km-term-letter,
.km-term-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  overflow: hidden;
}
.km-term-letter { color: #fff; font-weight: 600; }

.km-reward__picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 10px;
}

.km-sec--bare { background: transparent; margin-bottom: 0; }
.km-sec--bare .km-sec__head { background: var(--km-card); }

.km-footer__widgets { margin-bottom: 14px; }
.km-widget { margin-bottom: 12px; }
.km-widget__title { font-size: 13px; margin-bottom: 6px; color: var(--km-sub); }

.km-tabbar__item--publish { justify-content: flex-end; padding-bottom: 5px; }
.km-tabbar__item--publish .km-tabbar__plus {
  position: absolute;
  left: 50%;
  top: -26px;
  width: 52px;
  height: 52px;
  margin-top: 0;
  transform: translateX(-50%);
}
.km-tabbar__item--publish .km-tabbar__plus svg { width: 24px; height: 24px; }

body.km-has-actionbar .km-tabbar { display: none; }
body.km-has-actionbar .km-footer { padding-bottom: 28px; }
body.km-has-actionbar .km-fab { bottom: 78px; }

body.dark-mode .km-btn--gray { background: #2c2c2e; color: #999; }
body.dark-mode .km-notice { background: linear-gradient(90deg, #2b2416, #211d14); color: #d7b370; }
body.dark-mode .km-tag { background: #232325; }
body.dark-mode .km-comment-form textarea { background: #232325; color: var(--km-text); }
body.dark-mode .km-switch__track { background: #3a3a3c; }

/* Search / archive headline */
.km-archive-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--km-card);
  border-bottom: 1px solid var(--km-line);
  font-size: 13px;
  color: var(--km-muted);
}
.km-search-form { display: flex; gap: 8px; padding: 10px 12px; background: var(--km-card); }
.km-search-form input[type="search"] {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 19px;
  background: var(--km-soft);
  color: var(--km-text);
  outline: none;
}

/* ==========================================================================
   20. Page specifics
   ========================================================================== */
.km-profile__cover { position: relative; }
.km-profile__cover--plain {
  height: 110px;
  background: linear-gradient(135deg, var(--km-primary), #5ad9c9 70%, #8fe8dd);
}
.km-cover-edit {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
  padding: 4px 9px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 11px;
}
.km-profile__name { flex-wrap: wrap; }

.km-row > .km-btn--block { width: auto; flex: 1; }
body.km-has-actionbar .km-footer { padding-bottom: 92px; }

.km-news__meta svg { width: 14px; height: 14px; vertical-align: -2px; }

.km-banner { padding-right: 116px; }
.km-banner__title { font-size: 24px; }

.km-checkin { background: var(--km-card); margin-bottom: 10px; }
.km-checkin__cover {
  height: 150px;
  overflow: hidden;
  background: linear-gradient(135deg, #2f3d4a, #5a6b7a);
}
.km-checkin__cover img { width: 100%; height: 100%; object-fit: cover; }
.km-checkin__cover--empty { background: linear-gradient(135deg, var(--km-primary), #0e8f90); }
.km-checkin__user {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: -32px;
  padding: 0 14px;
}
.km-checkin__name {
  padding-top: 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--km-text);
}
.km-checkin__lv {
  font-size: 11px;
  color: var(--km-muted);
}
.km-checkin__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
  padding: 14px 0 16px;
  text-align: center;
}
.km-checkin__stats b { display: block; font-size: 20px; font-weight: 600; color: var(--km-text); }
.km-checkin__stats span { font-size: 11px; color: var(--km-muted); }

.km-quick__item:active,
.km-post__title a:active { opacity: 0.75; }

.km-user-row__actions .km-btn { white-space: nowrap; }

@media (max-width: 360px) {
  .km-banner__title { font-size: 21px; }
  .km-shop-grid { gap: 6px; padding: 8px; }
  .km-shop-item__name { font-size: 12px; }
}
