/* ============================================================
   示例导航 · 样式
   尺寸/间距对齐原站（酷客导航 yuanyuan 模板），可直接换肤
   ============================================================ */
:root {
  --primary: #4a6cf7;
  --primary-soft: #4a6cf74d;
  --bg: #f5f7fa;
  --surface: #fff;
  --text: #222;
  --text-strong: #1a1a2e;
  --text-muted: #8b93a7;
  --line: #eef0f5;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 18px rgba(15, 23, 42, .06);
  --kk-maxw: 560px;
  --kk-nav-h: 54px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
img { max-width: 100%; }

#kkApp { position: relative; z-index: 1; }

/* ------------------------------------------------------------ 顶栏 */
.kk-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 130;
  width: 100%; max-width: var(--kk-maxw); margin: 0 auto;
  background: var(--surface); border-bottom: 1px solid var(--line);
  transform: translateZ(0);
}
.kk-header-logo { padding: 8px 12px 0; }
.kk-header-logo img {
  width: 34px; height: 34px; border-radius: 10px;
  object-fit: cover; display: block; background: var(--primary-soft);
}
.kk-header-main { padding: 0 12px 8px; min-width: 0; }
.kk-header-title {
  font-size: 17px; font-weight: 700; color: var(--text-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kk-header-sub {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kk-header-ops { position: absolute; right: 8px; top: 8px; display: flex; gap: 6px; }
.kk-ico-btn {
  width: 34px; height: 34px; flex: none; border: 0; border-radius: 10px;
  background: #f3f5fa; color: var(--primary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.kk-ico-btn svg { width: 18px; height: 18px; }
.kk-ico-btn.on { background: var(--primary); color: #fff; }

.kk-menu-drop {
  position: absolute; right: 10px; top: calc(100% + 6px);
  width: min(70vw, 240px); background: var(--surface);
  border-radius: var(--radius-md); box-shadow: 0 10px 30px #0f172a29;
  padding: 6px; display: none; z-index: 140;
}
.kk-menu-drop.show { display: block; }
.kk-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text); font-size: 13px;
}
.kk-menu-item:active { background: #f5f7fc; }
.kk-menu-item img, .kk-menu-letter {
  width: 22px; height: 22px; border-radius: 6px; object-fit: cover; flex: none;
}
.kk-menu-letter {
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 600;
}

/* ------------------------------------------------------------ 主体 */
.kk-body {
  max-width: var(--kk-maxw); margin: 0 auto;
  padding-left: 12px; padding-right: 12px;
}

/* 轮播 */
.kk-slides {
  position: relative; margin-top: 12px; border-radius: var(--radius-lg);
  overflow: hidden; background: #e9edf4; aspect-ratio: 16/9;
}
.kk-slide-track { display: flex; height: 100%; transition: transform .45s ease; }
.kk-slide { flex: 0 0 100%; height: 100%; position: relative; }
.kk-slide a { display: block; height: 100%; }
.kk-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kk-slide-dots {
  position: absolute; left: 0; right: 0; bottom: 6px;
  display: flex; justify-content: center; gap: 5px; z-index: 2;
}
.kk-slide-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #ffffff8c; cursor: pointer; transition: width .2s;
}
.kk-slide-dots i.on { width: 16px; border-radius: 3px; background: #fff; }

/* 弹幕 */
.kk-marquee {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  padding: 9px 12px; border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer;
}
.kk-marquee-ico { color: var(--primary); display: flex; flex: none; }
.kk-marquee-ico svg { width: 16px; height: 16px; }
.kk-marquee-text { flex: 1; min-width: 0; overflow: hidden; font-size: 12px; color: var(--text-strong); }
.kk-marquee-run {
  display: inline-block; white-space: nowrap; will-change: transform;
  animation: kkMarqueeRun var(--kk-mq-dur, 10s) linear infinite;
}
@keyframes kkMarqueeRun {
  0% { transform: translateX(var(--kk-mq-from, 100%)); }
  100% { transform: translateX(var(--kk-mq-to, -100%)); }
}

/* 域名条 */
.kk-info {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--shadow);
}
.kk-info-host {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--text-strong);
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kk-info-host::before {
  content: ""; width: 14px; height: 14px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h7v2H6v12h12v-5h2v7H4z'/%3E%3Cpath d='M14 3h7v7h-2V6.4l-7.3 7.3-1.4-1.4L17.6 5H14z'/%3E%3C/svg%3E") no-repeat center/contain;
  mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h7v2H6v12h12v-5h2v7H4z'/%3E%3Cpath d='M14 3h7v7h-2V6.4l-7.3 7.3-1.4-1.4L17.6 5H14z'/%3E%3C/svg%3E") no-repeat center/contain;
  opacity: .7;
}
.kk-promo {
  flex: none; height: 34px; padding: 0 16px; border: 0; border-radius: 10px;
  background: linear-gradient(135deg, #ff9f43, #ff6b6b);
  color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 16px #ff6b6b52;
}

/* 区块 */
.kk-block { margin-top: 14px; }
.kk-block-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px; padding: 0 2px;
}
.kk-block-title { font-size: 15px; font-weight: 700; color: var(--text-strong); }
.kk-block-more {
  font-size: 12px; color: var(--primary); text-decoration: none;
  padding: 3px 10px; border-radius: 999px; background: var(--surface);
}

/* 分类卡片 */
.kk-section {
  margin-bottom: 12px; padding: 12px; border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow);
}
.kk-section-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.kk-section-name { font-size: 14px; font-weight: 700; color: var(--text-strong); }
.kk-links { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 6px; }
.kk-link {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-decoration: none; color: var(--text); min-width: 0;
}
.kk-link img, .kk-link-letter {
  width: 44px; height: 44px; border-radius: 12px;
  object-fit: cover; flex: none; background: #f3f5fa;
}
.kk-link-letter {
  display: flex; align-items: center; justify-content: center;
  color: #fff; background: var(--primary); font-size: 16px; font-weight: 700;
}
.kk-link-name {
  font-size: 11px; color: var(--text-muted); max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kk-link-desc {
  display: block; max-width: 100%; font-size: 10px; line-height: 1.3;
  color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 联系方式 */
.kk-contacts { margin-top: 14px; }
.kk-contact-list { display: flex; flex-direction: column; gap: 8px; }
.kk-contact {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow);
}
.kk-contact img, .kk-contact-letter {
  width: 34px; height: 34px; border-radius: 10px; object-fit: cover; flex: none; background: #f3f5fa;
}
.kk-contact-letter {
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; font-weight: 700;
}
.kk-contact-main { flex: 1; min-width: 0; }
.kk-contact-name { font-size: 13px; font-weight: 600; color: var(--text-strong); }
.kk-contact-value {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kk-contact-copy {
  flex: none; height: 30px; padding: 0 12px; border: 0; border-radius: 9px;
  background: var(--primary); color: #fff; font-size: 12px; cursor: pointer;
}

/* ------------------------------------------------------------ 底部导航 */
.kk-bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 130;
  width: 100%; max-width: var(--kk-maxw); margin: 0 auto;
  display: flex; background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
  transform: translateZ(0);
}
.kk-nav-item {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  height: var(--kk-nav-h); text-decoration: none;
  color: var(--text-muted); font-size: 11px;
}
.kk-nav-item.on { color: var(--primary); }
.kk-nav-ico { display: flex; width: 22px; height: 22px; }
.kk-nav-ico svg { width: 100%; height: 100%; }
.kk-nav-label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------ 全部应用 */
.kk-games {
  position: fixed; left: 0; right: 0; z-index: 120;
  max-width: var(--kk-maxw); margin: 0 auto;
  background: var(--bg); display: flex; flex-direction: column;
}
.kk-games[hidden] { display: none; }
.kk-games-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.kk-games-back {
  flex: none; height: 30px; padding: 0 14px; border: 0; border-radius: 9px;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 600; cursor: pointer;
}
.kk-games-body { flex: 1; min-height: 0; display: flex; gap: 10px; padding: 10px 12px; }
.kk-gtabs {
  width: 80px; flex: none; display: flex; flex-direction: column;
  gap: 6px; overflow-y: auto;
}
.kk-gtab {
  padding: 9px 10px; border: 0; border-left: 3px solid transparent;
  border-radius: 0 10px 10px 0; background: transparent;
  color: var(--text-muted); font-size: 12px; text-align: left;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kk-gtab i { font-style: normal; font-size: 9px; opacity: .7; margin-left: 4px; }
.kk-gtab.on {
  background: var(--surface); border-left-color: var(--primary);
  color: var(--primary); font-weight: 600; box-shadow: var(--shadow);
}
.kk-glist {
  flex: 1; min-width: 0; overflow-y: auto; display: grid;
  grid-template-columns: repeat(2, 1fr); gap: 10px; align-content: start;
}
.kk-gcard {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 8px; border-radius: 14px; background: var(--surface);
  box-shadow: var(--shadow); text-decoration: none; color: var(--text);
  text-align: center; min-width: 0;
}
.kk-gcard img, .kk-gicon {
  width: 48px; height: 48px; border-radius: 14px; object-fit: cover; flex: none; background: #f1f3fa;
}
.kk-gicon {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff; font-size: 18px; font-weight: 700;
}
.kk-gname {
  font-size: 12px; font-weight: 600; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kk-gdesc {
  font-size: 10px; color: var(--text-muted); max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kk-gplay {
  margin-top: 2px; height: 26px; padding: 0 14px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 600; line-height: 26px;
}
.kk-gempty { grid-column: 1/-1; padding: 30px 0; text-align: center; font-size: 12px; color: var(--text-muted); }

/* ------------------------------------------------------------ 悬浮条 */
.kk-float {
  position: fixed; right: 14px; bottom: 90px; z-index: 90030;
  display: flex; flex-direction: column; gap: 10px;
}
.kk-float[hidden] { display: none; }
.kk-float-btn {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; box-shadow: 0 4px 14px #00000029; overflow: hidden;
  text-decoration: none; transition: transform .18s; border: 0; cursor: pointer; padding: 0;
}
.kk-float-btn:active { transform: translateY(-3px); }
.kk-float-btn svg { width: 24px; height: 24px; color: var(--primary); }
@media (max-width: 768px) {
  .kk-float { right: 10px; bottom: 76px; gap: 8px; }
  .kk-float-btn { width: 42px; height: 42px; }
  .kk-float-btn svg { width: 22px; height: 22px; }
}

/* ------------------------------------------------------------ 弹层 */
.kk-sheet {
  position: fixed; inset: 0; z-index: 200; background: #0f172a80;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.kk-sheet[hidden] { display: none; }
.kk-sheet-box {
  width: 100%; max-width: min(88vw, 320px); background: var(--surface);
  border-radius: var(--radius-lg); padding: 18px; box-shadow: 0 20px 50px #0f172a47;
}
.kk-sheet-title { font-size: 15px; font-weight: 700; color: var(--text-strong); margin-bottom: 8px; }
.kk-sheet-text {
  font-size: 13px; line-height: 1.7; color: #4b5563;
  white-space: pre-line; word-break: break-word; max-height: 50vh; overflow: auto;
}
.kk-sheet-ok {
  margin-top: 14px; width: 100%; height: 38px; border: 0; border-radius: 10px;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}

/* 轻提示 */
.kk-toast {
  position: fixed; left: 50%; bottom: 96px; max-width: 76vw;
  padding: 9px 16px; border-radius: 20px; background: #000000c7;
  color: #fff; font-size: 13px; line-height: 1.3; text-align: center;
  word-break: break-all; opacity: 0; visibility: hidden;
  transform: translate(-50%, 10px); transition: opacity .22s, transform .22s, visibility .22s;
  pointer-events: none; z-index: 90130;
}
.kk-toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* 窄屏 */
@media (max-width: 360px) {
  .kk-links { grid-template-columns: repeat(3, 1fr); }
  .kk-header-title { font-size: 16px; }
}
@media (max-width: 400px) {
  .kk-gtabs { width: 84px; }
  .kk-glist { grid-template-columns: 1fr; }
}
@media (min-width: 768px) {
  .kk-body { padding-left: 16px; padding-right: 16px; }
}
