/* KL8 V6 研选通用基线 · 双色球沿用同一变量与圆角。基础变量仅在此定义。 */
:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --card: #fff;
  --text: #202b35;
  --muted: #727c88;
  --line: #e7eaf0;
  --accent: #c43c35;
  --accent-light: #fff0ed;
  --green: #287666;
  --green-light: #edf6f2;
  --blue: #507bac;
  --blue-light: #eef3fa;
  --ink: #202b35;
  --shadow: 0 5px 22px #263b5010;
  --shadow-ring: 0 0 0 2px var(--accent-light);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.4; letter-spacing: -.5px; }
h2 { font-size: 16px; letter-spacing: -.2px; font-weight: 650; }
h3 { font-size: 14px; }
p + p, details p, details h3 { margin-top: 8px; }
small { font-size: 12px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #559bce; outline-offset: 3px; }
input:focus, select:focus { outline: 2px solid #e89991; outline-offset: 1px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select {
  max-width: 100%;
  min-height: 40px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
}
input { min-width: 0; }
.muted, .tiny { color: var(--muted); font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; flex: none; vertical-align: middle; }
.skip-link { position: fixed; top: -80px; left: 14px; z-index: 40; padding: 8px; background: var(--card); }
.skip-link:focus { top: 8px; }

/* 顶栏 */
.topbar { height: 56px; position: sticky; top: 0; background: var(--card); border-bottom: 1px solid var(--line); z-index: 10; }
.top-inner { max-width: 1180px; height: 100%; margin: auto; padding: 0 18px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; text-decoration: none; color: inherit; cursor: default; user-select: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: 2px; line-height: 1.4; }
.tabs { display: flex; gap: 4px; margin: auto; }
.tabs button {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 15px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 14px; font-weight: 600;
}
.tabs button[aria-current="page"] { color: var(--accent); background: var(--accent-light); font-weight: 650; }
.tabs button:hover { background: #f3f4f6; }
/* 容器与卡片 */
.container { max-width: 1180px; margin: auto; padding: 18px; }
.page-head, .section-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
}
.section-label { display: flex; align-items: center; gap: 8px; }
.card {
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-title {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 12px; font-size: 16px; font-weight: 650;
}
.card-title em { font-weight: 500; color: var(--muted); font-style: normal; font-size: 13px; }
.pill { display: inline-flex; padding: 3px 8px; border-radius: 6px; background: var(--green-light); color: var(--green); font-size: 11px; font-weight: 600; }
.pill.neutral, .pill.replay { background: var(--bg); color: var(--muted); font-weight: 500; }
.pill.accent { background: var(--accent-light); color: var(--accent); }
.pill.warn { background: #fff5e0; color: #b86a00; }
.actions { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 10px; }
.actions label { max-width: 100%; }
.segmented { display: flex; flex-wrap: wrap; gap: 4px; }
/* 触摸目标 ≥40px，别再是 35px 的小方块 */
.segmented button { min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--muted); font-size: 13px; }
.segmented button.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent); font-weight: 650; }
.info-note { padding-left: 10px; border-left: 2px solid var(--line); margin-top: 10px; color: var(--muted); font-size: 12px; }
.table-scroll { max-width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); background: var(--bg); font-weight: 500; }
th:first-child, td:first-child { text-align: left; }
.table-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--muted); margin-top: 10px; font-size: 11px; }
.empty { padding: 20px; text-align: center; color: var(--muted); }
summary { cursor: pointer; padding: 6px 0; font-weight: 600; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px; border-radius: 6px; background: var(--bg); max-height: 200px; overflow: auto; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 18px; color: var(--muted); font-size: 11px; }

/* 按钮 */
.primary, .secondary {
  min-height: 40px;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
}
.primary { background: var(--accent); color: var(--card); border-color: var(--accent); }
.primary:hover { filter: brightness(1.05); }
.secondary { background: var(--card); color: var(--text); }
.secondary:hover { background: var(--bg); }

/* 弹层 */
.modal-bg { position: fixed; inset: 0; background: #202b3580; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 360px; background: var(--card); border-radius: 12px; padding: 22px; box-shadow: var(--shadow); }
.modal h3 { font-size: 17px; margin-bottom: 14px; }
.modal input { width: 100%; min-height: 38px; }
.modal-err { min-height: 18px; color: var(--accent); font-size: 12px; margin-top: 6px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.modal-hint { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.6; }

/* 推荐 lock 提示 */
.lock-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 36px 20px; text-align: center; gap: 14px;
  border: 1px dashed var(--accent); border-radius: 12px;
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--card) 80%);
}
.lock-card .lock { font-size: 36px; }
.lock-card .title { font-size: 17px; font-weight: 650; color: var(--text); }
.lock-card .desc { color: var(--muted); font-size: 13px; }
.activate-cta {
  margin-top: 4px;
  padding: 10px 24px;
  background: var(--accent); color: #fff; border: 0;
  border-radius: 8px; font-size: 14px; font-weight: 600;
}
.shop-hint { color: var(--muted); font-size: 12px; }

/* 移动端：tabs 改为底部 tabbar，参考 KL8 V6 */
@media (max-width: 700px) {
  body { font-size: 14px; }
  /* 收紧内边距：每层 2-6px，乘起来能给号码盘多留 ~45px 宽度 */
  .container { padding: 12px; }
  .card { padding: 14px; }
  .topbar { height: 54px; }
  .top-inner { padding: 0 14px; gap: 10px; }
  .brand-mark { width: 32px; height: 32px; font-size: 12px; border-radius: 8px; }
  .brand-name { font-size: 15px; }
  .brand-sub { display: none; }

  /* 底部 tabbar：加大到 13px 字号 + 24px 图标 + 56px 高，拇指好按 */
  .tabs {
    position: fixed; inset: auto 0 0; display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px; margin: 0;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: #fffffff2;
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -3px 16px #263b500f;
    z-index: 20;
  }
  .tabs button {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
    min-height: 54px;
    padding: 7px 4px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 10px;
  }
  .tabs button .icon { width: 24px; height: 24px; stroke-width: 1.9; }
  .tabs button[aria-current="page"] { font-weight: 700; }
  .container { padding: 14px 12px calc(112px + env(safe-area-inset-bottom)); }
  h1 { font-size: 21px; }
  .card { padding: 14px; border-radius: 12px; }
  .actions input { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}