:root {
  --red: #c8102e;
  --red-dark: #9e0c24;
  --gold: #f0b429;
  --gold-dark: #d99a17;
  --ink: #1f1f1f;
  --muted: #6b6b6b;
  --line: #ececec;
  --bg: #f6f6f4;
  --card: #ffffff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: linear-gradient(135deg, var(--red), var(--red-dark)); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.header-inner { display: flex; align-items: center; gap: 16px; padding: 12px 16px; flex-wrap: wrap; }
.brand { color: #fff; font-size: 18px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.search-box { flex: 1; min-width: 180px; display: flex; gap: 6px; }
.search-box input { flex: 1; padding: 8px 12px; border: none; border-radius: 6px; font-size: 14px; }
.search-box button { padding: 8px 14px; border: none; border-radius: 6px; background: var(--gold); color: #3a2c00; font-weight: 600; cursor: pointer; }
.user-nav { display: flex; gap: 8px; }
.btn { display: inline-block; padding: 8px 16px; border-radius: 6px; text-decoration: none; font-size: 14px; cursor: pointer; border: none; }
.btn-ghost { background: rgba(255,255,255,.15); color: #fff; }
.btn-gold { background: var(--gold); color: #3a2c00; font-weight: 700; }
.btn-gold:hover { background: var(--gold-dark); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-dark); }

/* Notice */
.notice { background: #fff7e6; border-bottom: 1px solid #ffe1a8; color: #8a5b00; font-size: 13px; padding: 8px 16px; text-align: center; }

/* Main */
main { padding: 20px 16px 40px; min-height: 50vh; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 12px; }
.section-title h2 { margin: 0; font-size: 18px; }
.muted { color: var(--muted); font-size: 13px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.topic-row { display: flex; flex-direction: column; gap: 4px; }
.topic-title { font-size: 16px; font-weight: 600; color: var(--ink); text-decoration: none; }
.topic-title:hover { color: var(--red); }
.topic-meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tag { background: #fdeef0; color: var(--red); padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.board-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; text-decoration: none; color: inherit; transition: .15s; }
.board-card:hover { border-color: var(--gold); box-shadow: 0 4px 12px rgba(200,16,46,.08); }
.board-card h3 { margin: 0 0 6px; font-size: 16px; color: var(--red-dark); }
.board-card p { margin: 0; font-size: 13px; color: var(--muted); }
.board-card .count { font-size: 12px; color: var(--gold-dark); margin-top: 8px; }

/* Topic detail */
.detail-title { font-size: 22px; font-weight: 700; margin: 8px 0; }
.detail-content { white-space: pre-wrap; background: #fafafa; border-radius: 8px; padding: 14px; font-size: 15px; }
.reply { border-top: 1px solid var(--line); padding: 12px 0; display: flex; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.reply-body { flex: 1; }
.reply-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.reply-content { white-space: pre-wrap; }

/* Forms */
input, textarea, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; font-family: inherit; margin-bottom: 10px; }
.auth-box { max-width: 360px; margin: 40px auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.auth-box h2 { margin: 0 0 16px; text-align: center; }
.form-msg { font-size: 13px; min-height: 18px; margin: 4px 0 10px; }
.form-msg.err { color: var(--red); }
.form-msg.ok { color: #2e7d32; }
.form-msg.warn { color: #8a5b00; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal.hidden { display: none; }
.modal-box { background: #fff; width: 520px; max-width: 92vw; border-radius: 12px; overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: var(--red); color: #fff; font-weight: 600; }
.modal-x { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; }
.modal-body { padding: 18px; }

/* Footer */
.site-footer { background: #1f1f1f; color: #cfcfcf; padding: 24px 0; font-size: 13px; text-align: center; margin-top: 40px; }
.site-footer .muted { color: #888; }

.pagination { display: flex; gap: 8px; justify-content: center; margin: 18px 0; }
.pagination button { padding: 6px 12px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; }
.pagination button:disabled { opacity: .4; cursor: default; }

/* Draw banner */
.draw-banner { display: flex; gap: 16px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.draw-latest { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; border-right: 1px dashed var(--line); padding-right: 16px; }
.draw-issue { font-size: 14px; font-weight: 600; color: var(--red-dark); }
.draw-balls { display: flex; gap: 10px; }
.ball { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, var(--red), var(--red-dark)); color: #fff; font-size: 22px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(200,16,46,.25); }
.draw-stat { font-size: 13px; color: var(--muted); }
.draw-stat b { color: var(--ink); }
.draw-history { flex: 1.4; min-width: 260px; display: flex; flex-direction: column; gap: 6px; max-height: 132px; overflow-y: auto; }
.draw-h-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.draw-h-issue { color: var(--muted); width: 78px; flex-shrink: 0; }
.ball-sm { width: 26px; height: 26px; border-radius: 50%; background: #fdeef0; color: var(--red); font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
@media (max-width: 600px) {
  .draw-latest { border-right: none; border-bottom: 1px dashed var(--line); padding-right: 0; padding-bottom: 12px; }
}
