:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --text2: #8e8e93;
  --text3: #c7c7cc;
  --line: rgba(60, 60, 67, 0.12);
  --blue: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(242, 242, 247, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}

.brand { display: flex; align-items: center; gap: 10px; }

.logo {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: #fff;
  object-fit: contain;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.brand-text h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: 0.2px; }
.brand-text p { margin: 0; font-size: 11px; color: var(--text2); }

/* ---------- 系列切换 ---------- */
.series-switch {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  padding: 3px;
  border-radius: 11px;
  background: rgba(120, 120, 128, 0.12);
}
.series-switch .seg {
  flex: 1;
  padding: 7px 0;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}
.series-switch .seg:active { transform: scale(0.98); }
.series-switch .seg.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* ---------- 玩法切换 ---------- */
.game-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 16px 12px;
  scrollbar-width: none;
}
.game-strip::-webkit-scrollbar { display: none; }

.pill {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.12);
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.pill:active { transform: scale(0.96); }
.pill.active {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 3px 10px rgba(0, 122, 255, 0.3);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 0 16px 12px;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title h2 { margin: 0; font-size: 15px; font-weight: 650; }
.card-title .more {
  font-size: 13px;
  color: var(--blue);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* ---------- 头奖卡 ---------- */
.hero { padding: 18px 16px 14px; }

.hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}
.hero-issue { font-size: 17px; font-weight: 650; letter-spacing: 0.2px; }
.hero-date { font-size: 12px; color: var(--text2); margin-top: 2px; }

.badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  background: rgba(52, 199, 89, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
}

/* ---------- 号码球 ---------- */
.ball-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ball {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  flex: 0 0 auto;
}
.ball.red { background: linear-gradient(150deg, #ff7b72, #d9261c); }
.ball.blue { background: linear-gradient(150deg, #6fc3ff, #0a84ff); }
.ball.orange { background: linear-gradient(150deg, #ffbe4d, #f08a24); }
.ball.small { width: 30px; height: 30px; font-size: 12px; }
.ball.big { width: 56px; height: 56px; font-size: 24px; }

.plus { color: var(--text3); font-size: 18px; font-weight: 600; margin: 0 2px; }

.ball-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
}
.ball-grid .ball {
  width: 100%; height: auto;
  aspect-ratio: 1;
  font-size: 12px;
}

/* ---------- 元信息 ---------- */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 0.5px solid var(--line);
}
.meta-grid .cell { text-align: left; }
.meta-grid .cell span { display: block; font-size: 11px; color: var(--text2); }
.meta-grid .cell strong { display: block; font-size: 15px; font-weight: 650; margin-top: 2px; }

/* ---------- 奖级表 ---------- */
.prize-table { margin-top: 12px; }
.prize-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-top: 0.5px solid var(--line);
  font-size: 14px;
}
.prize-row:first-child { border-top: none; }
.prize-row .tier { color: var(--text); }
.prize-row .tier em {
  font-style: normal;
  color: var(--text2);
  font-size: 12px;
  margin-left: 6px;
}
.prize-row .money { font-weight: 600; font-variant-numeric: tabular-nums; }

.empty-tip {
  padding: 28px 16px;
  text-align: center;
  color: var(--text2);
  font-size: 13px;
}

/* ---------- 往期列表 ---------- */
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 0.5px solid var(--line);
  background: none;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.history-item:first-child { border-top: none; }
.history-info { flex: 0 0 auto; min-width: 92px; }
.history-issue { font-size: 14px; font-weight: 600; }
.history-date { font-size: 11px; color: var(--text2); margin-top: 1px; }
.history-nums {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}
.mini-num {
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: #f2f2f7;
  color: var(--text);
}
.mini-num.red { background: rgba(217, 38, 28, 0.09); color: #c0271d; }
.mini-num.blue { background: rgba(10, 132, 255, 0.1); color: #0a6dc2; }
.mini-num.orange { background: rgba(240, 138, 36, 0.12); color: #b96a13; }

.chevron {
  flex: 0 0 auto;
  color: var(--text3);
  display: inline-flex;
  align-items: center;
}
.chevron svg { width: 16px; height: 16px; display: block; }

.load-more {
  display: block;
  width: calc(100% - 32px);
  margin: 4px 16px 16px;
  padding: 12px;
  border: none;
  border-radius: 14px;
  background: rgba(120, 120, 128, 0.1);
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.load-more:disabled { color: var(--text2); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 18px; }
.field:last-of-type { margin-bottom: 20px; }
.field > label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.pills::-webkit-scrollbar { display: none; }

.input-row { display: flex; gap: 8px; }

input[type="text"], textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #f7f7fa;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}
input[type="text"] { flex: 1 1 auto; }
input[type="text"]:focus, textarea:focus {
  border-color: var(--blue);
  background: #fff;
}
textarea {
  resize: vertical;
  min-height: 84px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px;
  letter-spacing: 0.6px;
  line-height: 1.7;
}

.hint {
  margin: 8px 2px 0;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
}
.hint.error { color: var(--red); }

.btn-mini {
  flex: 0 0 auto;
  padding: 0 16px;
  border-radius: 12px;
  border: none;
  background: rgba(0, 122, 255, 0.1);
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 122, 255, 0.28);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn-primary:active { transform: scale(0.985); }
.btn-primary:disabled { opacity: 0.55; box-shadow: none; }

.btn-ghost {
  width: 100%;
  margin-top: 14px;
  padding: 11px;
  border: none;
  border-radius: 12px;
  background: rgba(120, 120, 128, 0.1);
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- 兑奖结果 ---------- */
.result-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.result-icon {
  width: 52px; height: 52px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 26px; font-weight: 700;
  color: #fff;
  background: linear-gradient(150deg, #c7c7cc, #8e8e93);
}
.card.won .result-icon { background: linear-gradient(150deg, #ff9f0a, #ff3b30); }
.result-icon svg { width: 26px; height: 26px; display: block; }
.result-title { font-size: 20px; font-weight: 700; }
.result-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }

.amount-hero {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 14px 0 6px;
}
.amount-hero .num {
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--red);
  letter-spacing: -0.5px;
}
.amount-hero .unit { font-size: 14px; color: var(--text2); }
.card.won .amount-hero .num { color: var(--red); }

.divider { height: 0.5px; background: var(--line); margin: 14px 0; }

.line-block { margin-top: 12px; }
.line-block:first-of-type { margin-top: 0; }
.line-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text2);
}
.line-head .raw {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text);
  font-size: 13px;
  word-break: break-all;
}
.line-head .line-amount { flex: 0 0 auto; font-weight: 600; color: var(--text); }

/* 兑奖结果：用户号码命中标记（实心高亮为命中，灰色为未中） */
.bet-nums {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.bet-nums .mini-num {
  background: #f2f2f7;
  color: #aeaeb2;
  font-weight: 500;
}
.bet-nums .mini-num.hit {
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
}
.bet-nums .mini-num.red.hit { background: #e0322b; }
.bet-nums .mini-num.blue.hit { background: #0a84ff; }
.bet-nums .mini-num.orange.hit { background: #f08a24; }
.bet-nums .bet-plus { color: var(--text3); font-size: 12px; padding: 0 1px; }
.bet-nums .bet-group { display: inline-flex; gap: 4px; }
.bet-nums .bet-group + .bet-group { margin-left: 6px; }

.tier-row {
  padding: 8px 10px;
  margin-top: 6px;
  border-radius: 10px;
  background: rgba(255, 59, 48, 0.07);
  font-size: 13px;
}
.tier-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.tier-row .tier-name { font-weight: 600; color: #c0271d; flex: 0 0 auto; }
.tier-row .tier-detail { color: var(--text2); font-variant-numeric: tabular-nums; text-align: right; }
.tier-note {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 0.5px dashed rgba(255, 59, 48, 0.25);
  font-size: 11px;
  color: var(--text2);
  line-height: 1.55;
}
.tier-note strong { color: #c0271d; font-variant-numeric: tabular-nums; }

.tax-note {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.6;
}
.tax-note strong { color: var(--red); font-size: 14px; font-variant-numeric: tabular-nums; }

.line-error {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 59, 48, 0.08);
  color: #c0271d;
  font-size: 13px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text2);
  padding: 5px 0;
}
.summary-row strong { color: var(--text); font-variant-numeric: tabular-nums; }

.ref-draw {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 0.5px solid var(--line);
}

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  max-width: 520px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 6px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--blue); }

/* ---------- 详情抽屉 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 8px 0 calc(24px + env(safe-area-inset-bottom));
  animation: slideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-handle {
  width: 38px; height: 5px;
  border-radius: 999px;
  background: rgba(60, 60, 67, 0.2);
  margin: 6px auto 14px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 12px;
}
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.sheet-close {
  border: none;
  background: none;
  color: var(--blue);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
}
.sheet-body { padding: 0 16px; }

.link-out {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}
.link-out svg { width: 15px; height: 15px; }

/* ---------- 公告弹窗 ---------- */
.ann-mask { z-index: 100; }
.ann-sheet { max-height: 90vh; }

/* 体彩公告 PDF 内嵌预览 */
.pdf-wrap {
  margin: 0 16px 12px;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}
.pdf-frame {
  display: block;
  width: 100%;
  height: 72vh;
  border: 0;
  background: #fff;
}

.ann-body {
  background: #fff;
  border-radius: 14px;
  margin: 0 16px 16px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
  overflow-wrap: anywhere;
}
.ann-body p { margin: 0 0 8px; }
.ann-body div { margin: 0 0 6px; }
.ann-body p:last-child, .ann-body div:last-child { margin-bottom: 0; }
.ann-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
}
.ann-body th, .ann-body td {
  border: 0.5px solid var(--line);
  padding: 7px 6px;
  text-align: center;
  line-height: 1.4;
}
.ann-body th {
  background: #f7f7fa;
  font-weight: 600;
  color: var(--text2);
}
.ann-body td:first-child { font-weight: 500; }
.ann-body strong { font-weight: 650; }

.ann-source {
  display: block;
  margin: 0 16px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text2);
  text-decoration: none;
}

/* ---------- 其他 ---------- */
.skeleton {
  height: 160px;
  background: linear-gradient(100deg, #eeeef2 30%, #f6f6f9 50%, #eeeef2 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  max-width: 80vw;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.92);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.24s ease;
  z-index: 200;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 360px) {
  .ball { width: 36px; height: 36px; font-size: 14px; }
  .ball.big { width: 48px; height: 48px; font-size: 20px; }
  .ball-grid .ball { font-size: 10px; }
  .history-info { min-width: 78px; }
}
