:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #3a342c;
  --ink-2: #7a7063;
  --line: #e5dfd3;
  --red: #d94f3d;
  --blue: #2f6fba;
  --accent: #e8824a;
  --ok: #4d8f5e;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--ink); }
.topbar { background: #2e2a25; color: #fff; }
.topbar-inner { max-width: 920px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { font-size: 18px; font-weight: 700; }
.brand-sub { font-size: 12px; color: #cfc8bd; }
.disclaimer { margin-left: auto; font-size: 11px; color: #f0b97f; }
.tabs { max-width: 920px; margin: 14px auto 0; display: flex; gap: 6px; padding: 0 16px; }
.tab { border: 1px solid var(--line); background: var(--card); color: var(--ink-2); padding: 9px 18px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.tab.active { background: var(--red); color: #fff; border-color: var(--red); }
main { max-width: 920px; margin: 14px auto; padding: 0 16px; }
.panel { display: none; }
.panel.active { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
h2 { margin: 0 0 16px; font-size: 19px; }
.sub { font-size: 12px; color: var(--ink-2); font-weight: normal; margin-left: 8px; }
.controls { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--ink-2); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg-btn { border: 0; background: #fff; padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.seg-btn.active { background: var(--blue); color: #fff; }
select, input, textarea { border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink); }
select { min-width: 80px; }
.btn-primary { background: var(--red); color: #fff; border: 0; padding: 10px 22px; border-radius: 9px; font-size: 15px; cursor: pointer; font-weight: 600; }
.btn-primary:hover { opacity: .92; }
.machine-note { margin: 14px 0 4px; font-size: 12px; color: var(--ink-2); }
.numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.ticket { border: 1px dashed #cbb; border-radius: 12px; padding: 12px 14px; background: #fffaf4; }
.ticket .t-no { font-size: 11px; color: var(--ink-2); margin-bottom: 6px; }
.ball { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; font-size: 14px; font-weight: 700; color: #fff; margin: 2px; }
.ball.red { background: var(--red); }
.ball.blue { background: var(--blue); }
.ball.gray { background: #b9a; }
.t-sum { font-size: 12px; color: var(--ink-2); margin-left: 6px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat-block { border: 1px solid var(--line); border-radius: 11px; padding: 14px 16px; background: #fff; }
.stat-block.wide { grid-column: 1 / -1; }
.stat-block h3 { margin: 0 0 10px; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.balls { display: flex; flex-wrap: wrap; gap: 4px; }
.balls .it { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.miss-list { font-size: 13px; line-height: 1.9; }
.stat-line { font-size: 14px; line-height: 1.8; margin: 0; }
.stat-note { font-size: 12px; color: var(--ink-2); margin-top: 14px; line-height: 1.7; }
.post-form { display: grid; grid-template-columns: 120px 120px 1fr; gap: 8px; margin-bottom: 18px; }
.post-form textarea { grid-column: 1 / -1; }
.post-form .btn-primary { grid-column: 1 / -1; justify-self: start; }
.posts { display: flex; flex-direction: column; gap: 12px; }
.post { border: 1px solid var(--line); border-radius: 11px; padding: 14px 16px; background: #fff; }
.post-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.post-head .nick { font-weight: 600; font-size: 14px; }
.post-head .cat { font-size: 11px; color: var(--ink-2); }
.post-head .time { margin-left: auto; font-size: 11px; color: var(--ink-2); }
.post-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.post-content { font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.post-nums { margin: 8px 0; }
.post-actions { display: flex; gap: 12px; margin-top: 10px; align-items: center; }
.like-btn, .cmt-btn { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 5px 12px; cursor: pointer; font-size: 12px; color: var(--ink-2); }
.like-btn:hover { border-color: var(--red); color: var(--red); }
.comments { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.comments .c { font-size: 13px; line-height: 1.6; margin: 4px 0; }
.cmt-box { display: flex; gap: 6px; margin-top: 8px; }
.cmt-box input { flex: 1; }
.footer { max-width: 920px; margin: 20px auto; padding: 14px 16px; text-align: center; font-size: 11px; color: var(--ink-2); line-height: 1.7; }
/* 登录/用户 */
.userbox { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.login-btn { border: 1px solid #f0b97f; background: transparent; color: #f0b97f; border-radius: 8px; padding: 5px 12px; cursor: pointer; font-size: 12px; }
.login-btn:hover { background: #f0b97f; color: #2e2a25; }
.user-tag { font-size: 12px; color: #cfc8bd; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal[hidden] { display: none; }
.modal-box { background: var(--card); border-radius: 14px; padding: 22px; width: 320px; max-width: 92vw; }
.modal-box h3 { margin: 0 0 12px; font-size: 18px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.auth-tab { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.auth-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.modal-box input { width: 100%; margin-bottom: 10px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.btn-ghost { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 9px 16px; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.auth-note { font-size: 11px; color: var(--ink-2); margin: 10px 0 0; line-height: 1.6; }
/* 走势图 */
.chart { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 12px; overflow-x: auto; }
/* 历史表格 */
.history-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13px; }
.history-table th, .history-table td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.history-table th { color: var(--ink-2); font-weight: 600; }
.ball.sm { width: 24px; height: 24px; font-size: 12px; }
/* 晒单 */
.upload-row { display: flex; align-items: center; gap: 10px; }
.upload-btn { border: 1px dashed #cbb; border-radius: 9px; padding: 7px 14px; cursor: pointer; font-size: 13px; color: var(--ink-2); background: #fffaf4; }
.upload-preview { max-width: 140px; max-height: 100px; border-radius: 8px; border: 1px solid var(--line); }
.post-img { max-width: 100%; max-height: 280px; border-radius: 10px; margin: 8px 0; cursor: zoom-in; display: block; }
.post .lv { font-size: 11px; color: var(--accent); background: rgba(232,130,74,.12); padding: 1px 7px; border-radius: 6px; }
@media (max-width: 640px) {
  .post-form { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .disclaimer { margin-left: 0; width: 100%; }
}
