/* app.css — lottery-lab 手机网页（移动优先，零依赖）
   原则：竖屏优先、无横向溢出、触控目标 ≥ 44px、尊重安全区 */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1c2330;
  --ink-2: #5b6572;
  --line: #e4e7ec;
  --brand: #c62828;      /* 前区红 */
  --brand-2: #1e5bbf;    /* 后区蓝 */
  --ok: #1e8e3e;
  --warn: #b26a00;
  --muted: #8a93a0;
  --radius: 14px;
  --pad: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: clip; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

main { max-width: 560px; margin: 0 auto; padding: 12px var(--pad); width: 100%; }
h1 { font-size: 20px; }
h2 { font-size: 17px; margin-bottom: 8px; }
p { word-break: break-word; }

.card { background: var(--card); border-radius: var(--radius); padding: var(--pad); margin-bottom: 12px; box-shadow: 0 1px 3px rgba(16,24,40,.06); border: 1px solid var(--line); }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; color: var(--ink-2); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: #eef1f5; color: var(--ink-2); margin: 2px 4px 2px 0; }
.chip.red { background: #fdecec; color: var(--brand); }
.chip.blue { background: #e8f0fe; color: var(--brand-2); }
.chip.green { background: #e6f4ea; color: var(--ok); }
.chip.amber { background: #fff4e0; color: var(--warn); }

/* 号码球 */
.balls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ball {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff; flex: 0 0 auto;
}
.ball.front { background: var(--brand); }
.ball.back { background: var(--brand-2); }
.ball-sep { color: var(--muted); margin: 0 2px; }

/* 按钮 */
button, .btn {
  font: inherit; border: none; border-radius: 12px;
  min-height: 46px; padding: 10px 18px;
  background: var(--brand); color: #fff; font-weight: 600;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
button.secondary { background: #eef1f5; color: var(--ink); border: 1px solid var(--line); }
button.blue { background: var(--brand-2); }
button.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
button:disabled { opacity: .45; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row > button { flex: 1 1 calc(50% - 5px); min-width: 140px; }
.btn-wide { width: 100%; }

/* 组卡片 */
.group-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; }
.group-card .meta { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* 表格类信息 → 卡片行，避免横向滚动 */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-2); flex: 0 0 auto; }
.kv .v { text-align: right; word-break: break-all; }

/* 频率条 */
.freq-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.freq-row .n { width: 30px; text-align: center; font-weight: 700; font-size: 14px; }
.freq-row .bar { flex: 1; height: 10px; border-radius: 6px; background: #edf0f4; overflow: hidden; min-width: 0; }
.freq-row .bar > i { display: block; height: 100%; border-radius: 6px; }
.freq-row .c { width: 52px; text-align: right; font-size: 12px; color: var(--ink-2); flex: 0 0 auto; }
.freq-row.front .bar > i { background: var(--brand); }
.freq-row.back .bar > i { background: var(--brand-2); }

.tabs { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.tabs button.active { background: var(--ink); color: #fff; }

/* 状态徽标 */
.state { font-weight: 700; font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.state-PENDING { background: #fff4e0; color: var(--warn); }
.state-SETTLED { background: #e6f4ea; color: var(--ok); }
.state-RETRO { background: #eef1f5; color: var(--ink-2); }

.disclaimer { font-size: 12px; color: var(--muted); margin: 10px 0; line-height: 1.6; }

/* 底部导航 */
nav.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.bottom a {
  flex: 1; text-align: center; text-decoration: none; color: var(--ink-2);
  font-size: 11px; padding: 8px 0 6px; min-height: 50px;
  display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center;
}
nav.bottom a .ic { font-size: 18px; line-height: 1; }
nav.bottom a.active { color: var(--brand); font-weight: 700; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(28,35,48,.92); color: #fff; font-size: 14px;
  padding: 10px 18px; border-radius: 10px; max-width: 86vw;
  opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 99;
}
#toast.show { opacity: 1; }

.header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 12px; flex-wrap: wrap; }
.hero-cta { display: block; text-align: center; text-decoration: none; }

@media (min-width: 768px) {
  main { max-width: 640px; }
  body { font-size: 17px; }
}
