/* ══════════════════════════════════════════════════════════════
   彩迹 · 设计系统
   参考机型 iPhone 14 Pro（393 × 852 pt，顶部安全区 59，底部 34）
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg: #F1F2F6;
  --bg-top: #F7F8FB;
  --card: #FFFFFF;
  --card-2: #F7F8FB;
  --card-3: #EFF1F6;
  --line: rgba(18, 20, 26, .075);
  --line-2: rgba(18, 20, 26, .05);
  --text: #14161C;
  --text-2: #6A7383;
  --text-3: #9CA4B2;

  --brand: #E23A3E;
  --brand-ink: #C42A2E;
  --brand-soft: rgba(226, 58, 62, .10);
  --orange: #F2673A;
  --gold: #DFA23B;
  --gold-soft: rgba(223, 162, 59, .14);
  --blue: #3B7DF6;
  --blue-soft: rgba(59, 125, 246, .12);
  --green: #12A150;
  --green-soft: rgba(18, 161, 80, .12);
  --red: #E23A3E;
  --red-soft: rgba(226, 58, 62, .10);

  --ball-red-1: #FF8A8D;
  --ball-red-2: #E23A3E;
  --ball-red-3: #B31F24;
  --ball-blue-1: #8FB8FF;
  --ball-blue-2: #3B7DF6;
  --ball-blue-3: #2354C9;

  --shadow-1: 0 1px 2px rgba(16, 20, 30, .045), 0 8px 22px -14px rgba(16, 20, 30, .18);
  --shadow-2: 0 2px 6px rgba(16, 20, 30, .06), 0 18px 44px -20px rgba(16, 20, 30, .26);
  --shadow-brand: 0 6px 20px -6px rgba(226, 58, 62, .48);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 999px;

  --tab-h: 56px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);

  --ease: cubic-bezier(.32, .72, 0, 1);
}

[data-theme="dark"] {
  --bg: #0B0D12;
  --bg-top: #0E1118;
  --card: #161A23;
  --card-2: #1C212C;
  --card-3: #232936;
  --line: rgba(255, 255, 255, .085);
  --line-2: rgba(255, 255, 255, .05);
  --text: #F0F2F7;
  --text-2: #98A1B3;
  --text-3: #6C7688;

  --brand: #F0524F;
  --brand-ink: #FF6B66;
  --brand-soft: rgba(240, 82, 79, .16);
  --gold-soft: rgba(223, 162, 59, .18);
  --blue: #5C93FF;
  --blue-soft: rgba(92, 147, 255, .16);
  --green: #2CC46C;
  --green-soft: rgba(44, 196, 108, .16);
  --red: #F0524F;
  --red-soft: rgba(240, 82, 79, .16);

  --ball-red-1: #FF9EA1;
  --ball-red-2: #E2433F;
  --ball-red-3: #9E1B20;
  --ball-blue-1: #A6C7FF;
  --ball-blue-2: #4B87F5;
  --ball-blue-3: #1F49A8;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 26px -16px rgba(0, 0, 0, .8);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, .5), 0 22px 48px -22px rgba(0, 0, 0, .9);
  --shadow-brand: 0 6px 22px -8px rgba(240, 82, 79, .5);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text", "PingFang SC",
    "HarmonyOS Sans SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
  transition: background .3s var(--ease), color .3s var(--ease);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
::-webkit-scrollbar { width: 0; height: 0; }

/* ───────────────────────────────────────────── 壳层 */

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% -10%, var(--bg-top) 0%, var(--bg) 62%);
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(var(--sat) + 8px) 18px 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  /* 提升为独立合成层：避免滚动时粘性头栏反复触发主线程重绘 */
  transform: translateZ(0);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.appbar.scrolled { border-bottom-color: var(--line); }
.appbar-title { font-size: 17px; font-weight: 700; letter-spacing: -.2px; flex: 1; }
.appbar-sub { font-size: 12px; color: var(--text-3); font-weight: 500; }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  color: var(--text-2);
  transition: background .15s, color .15s, transform .12s;
}
.icon-btn:active { transform: scale(.9); background: var(--card-3); }
.icon-btn.solid { background: var(--card); box-shadow: var(--shadow-1); color: var(--text); }

.view {
  flex: 1;
  padding: 6px 16px calc(var(--tab-h) + var(--sab) + 28px);
}

/* ───────────────────────────────────────────── 底部导航 */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  padding: 0 4px calc(var(--sab));
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  transform: translateZ(0);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  height: var(--tab-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1px;
  position: relative;
  transition: color .18s;
}
.tab .ic { transition: transform .2s var(--ease); }
.tab.active { color: var(--brand); }
.tab.active .ic { transform: translateY(-1px) scale(1.06); }
.tab-dot {
  position: absolute;
  top: 7px;
  right: 50%;
  margin-right: -18px;
  min-width: 7px; height: 7px;
  border-radius: var(--r-full);
  background: var(--brand);
  box-shadow: 0 0 0 2px var(--card);
}
.tab-dot.count {
  height: 15px; min-width: 15px; padding: 0 4px;
  font-size: 9.5px; line-height: 15px; text-align: center;
  color: #fff; font-weight: 700; margin-right: -22px;
}

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--tab-h) + var(--sab) + 16px);
  z-index: 45;
  width: 56px; height: 56px;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(150deg, var(--orange), var(--brand) 62%, var(--brand-ink));
  box-shadow: var(--shadow-brand), 0 12px 30px -10px rgba(226, 58, 62, .55);
  transition: transform .18s var(--ease), opacity .2s;
}
.fab:active { transform: scale(.92); }
.fab[hidden] { display: none; }

/* ───────────────────────────────────────────── 首页主卡 */

.hero {
  position: relative;
  border-radius: var(--r-xl);
  padding: 20px 20px 18px;
  color: #fff;
  overflow: hidden;
  background: linear-gradient(135deg, #D92E36 0%, #E8463C 34%, #F06A33 70%, #E9A63B 100%);
  box-shadow: 0 10px 30px -12px rgba(200, 50, 40, .55), 0 2px 6px rgba(0, 0, 0, .12);
  margin-bottom: 14px;
}
.hero::before {
  content: '';
  position: absolute;
  width: 240px; height: 240px;
  right: -90px; top: -130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .3), transparent 68%);
}
.hero::after {
  content: '';
  position: absolute;
  left: -60px; bottom: -110px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 70%);
}
.hero-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .3px;
  opacity: .92;
  margin-bottom: 2px;
}
.hero-label { position: relative; font-size: 12.5px; opacity: .86; margin-top: 8px; font-weight: 500; }
.hero-value {
  position: relative;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -1.4px;
  line-height: 1.15;
  margin: 2px 0 2px;
  text-shadow: 0 2px 8px rgba(140, 20, 18, .28);
}
.hero-value .cur { font-size: 22px; font-weight: 700; letter-spacing: 0; margin-right: 2px; opacity: .9; }
.hero-value .neg { }
.hero-sub { position: relative; font-size: 12px; opacity: .88; }
.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .22);
}
.hero-cell { text-align: left; }
.hero-cell .k { font-size: 11px; opacity: .8; font-weight: 500; }
.hero-cell .v { font-size: 16px; font-weight: 700; letter-spacing: -.3px; margin-top: 1px; }
.hero-badge {
  position: relative;
  padding: 0;
  background: none;
  backdrop-filter: none;
}
/* 注意：.chip.gold 等修饰类在通用元件区、位置靠后，这里必须提高选择器权重才能覆盖 */
.hero .chip,
.hero .hero-badge .chip,
.hero .hero-badge .chip.gold,
.hero .hero-badge .chip.green {
  height: 24px;
  background: rgba(255, 255, 255, .26);
  color: #fff;
  font-weight: 700;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ───────────────────────────────────────────── 卡片 */

.card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-1);
  margin-bottom: 12px;
  border: 1px solid var(--line-2);
}
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card.tight { padding: 12px 14px; }
.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.card-title { font-size: 15px; font-weight: 700; letter-spacing: -.2px; flex: 1; display: flex; align-items: center; gap: 6px; }
.card-title .ic { color: var(--text-3); }
.card-more { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 2px; font-weight: 500; }

.section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .6px;
  padding: 18px 4px 8px;
  text-transform: none;
}

/* ───────────────────────────────────────────── 数字球 */

.balls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.balls .sep { color: var(--text-3); font-size: 13px; font-weight: 600; padding: 0 1px; }

.ball {
  --s: 32px;
  width: var(--s); height: var(--s);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: calc(var(--s) * .46);
  font-weight: 700;
  color: #fff;
  letter-spacing: -.5px;
  background: radial-gradient(circle at 32% 26%, var(--ball-red-1), var(--ball-red-2) 54%, var(--ball-red-3));
  box-shadow: 0 2px 5px rgba(226, 58, 62, .34), inset 0 -2px 4px rgba(0, 0, 0, .2), inset 0 1px 2px rgba(255, 255, 255, .5);
  flex: none;
  position: relative;
}
.ball.blue {
  background: radial-gradient(circle at 32% 26%, var(--ball-blue-1), var(--ball-blue-2) 54%, var(--ball-blue-3));
  box-shadow: 0 2px 5px rgba(59, 125, 246, .34), inset 0 -2px 4px rgba(0, 0, 0, .2), inset 0 1px 2px rgba(255, 255, 255, .5);
}
.ball.sm { --s: 25px; }
.ball.lg { --s: 38px; }
.ball.xs { --s: 22px; font-size: 11px; }
.ball.hit { box-shadow: 0 0 0 2px var(--gold), 0 2px 8px rgba(223, 162, 59, .5), inset 0 -2px 4px rgba(0, 0, 0, .2); }
.ball.dim { opacity: .34; filter: saturate(.5); }
.ball.dan::after {
  content: '胆';
  position: absolute;
  top: -4px; right: -4px;
  font-size: 8px;
  background: var(--gold);
  color: #fff;
  border-radius: var(--r-full);
  padding: 0 3px;
  line-height: 12px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.ball.sel { box-shadow: 0 0 0 2px var(--brand), 0 3px 10px rgba(226, 58, 62, .4); }
.ball.ghost {
  background: var(--card-2);
  color: var(--text-3);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 600;
}

/* ───────────────────────────────────────────── 通用元件 */

.btn {
  height: 44px;
  padding: 0 18px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .14s var(--ease), opacity .16s, background .16s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary {
  background: linear-gradient(150deg, var(--orange), var(--brand) 70%);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: var(--card-2); color: var(--text); }
.btn-outline { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--text); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13.5px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.seg {
  display: flex;
  padding: 3px;
  background: var(--card-3);
  border-radius: var(--r-sm);
  gap: 2px;
}
.seg button {
  flex: 1;
  height: 30px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  transition: all .2s var(--ease);
}
.seg button.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-1);
  font-weight: 700;
}
.seg.on-brand button.active { color: var(--brand); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-full);
  background: var(--card-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.gold { background: var(--gold-soft); color: var(--gold); }
.chip.on { background: var(--text); color: var(--bg); }

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: var(--card-3);
  color: var(--text-2);
  letter-spacing: .2px;
}
.badge.dlt { background: var(--brand-soft); color: var(--brand); }
.badge.ssq { background: var(--blue-soft); color: var(--blue); }
.badge.pending { background: var(--gold-soft); color: var(--gold); }
.badge.won { background: var(--red-soft); color: var(--red); }
.badge.lost { background: var(--card-3); color: var(--text-3); }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line-2);
  transition: background .14s;
}
.row:last-child { border-bottom: 0; }
.row:active { background: var(--card-2); }
.row-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--card-2);
  color: var(--text-2);
  flex: none;
}
.row-icon.brand { background: var(--brand-soft); color: var(--brand); }
.row-icon.blue { background: var(--blue-soft); color: var(--blue); }
.row-icon.green { background: var(--green-soft); color: var(--green); }
.row-icon.gold { background: var(--gold-soft); color: var(--gold); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14.5px; font-weight: 600; letter-spacing: -.1px; }
.row-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.row-right { text-align: right; flex: none; display: flex; align-items: center; gap: 6px; }
.row-right .ic { color: var(--text-3); }

.kv { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; font-size: 13.5px; }
.kv .k { color: var(--text-2); }
.kv .v { font-weight: 650; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--card-2);
  border-radius: var(--r-md);
  padding: 12px 13px;
}
.stat .k { font-size: 11.5px; color: var(--text-3); font-weight: 600; display: flex; align-items: center; gap: 4px; }
.stat .v { font-size: 20px; font-weight: 750; letter-spacing: -.6px; margin-top: 3px; }
.stat .v small { font-size: 12px; font-weight: 600; color: var(--text-3); margin-left: 2px; letter-spacing: 0; }
.stat .d { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.stat.wide { grid-column: span 2; }

.pos { color: var(--brand); }
.neg { color: var(--text-2); }
.gain { color: var(--brand); }
.muted { color: var(--text-3); }
.mono { font-variant-numeric: tabular-nums; }

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--text-3);
}
.empty .ic { opacity: .5; margin-bottom: 10px; }
.empty .t { font-size: 14px; font-weight: 600; color: var(--text-2); }
.empty .s { font-size: 12.5px; margin-top: 4px; line-height: 1.6; }

.skeleton {
  background: linear-gradient(90deg, var(--card-2) 25%, var(--card-3) 37%, var(--card-2) 63%);
  background-size: 400% 100%;
  animation: sk 1.4s ease infinite;
  border-radius: var(--r-sm);
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ───────────────────────────────────────────── 列表项：票据 */

.tk {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line-2);
  transition: transform .16s var(--ease), box-shadow .16s;
}
.tk:active { transform: scale(.985); }
.tk.won { border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.tk-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.tk-title { font-size: 14px; font-weight: 700; letter-spacing: -.1px; }
.tk-time { font-size: 11.5px; color: var(--text-3); }
.tk-amt { margin-left: auto; text-align: right; }
.tk-amt .n { font-size: 17px; font-weight: 750; letter-spacing: -.4px; }
.tk-amt .l { font-size: 10.5px; color: var(--text-3); }
.tk-balls { margin: 2px 0 8px; }
.tk-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--text-3);
}
.tk-foot .r { margin-left: auto; display: flex; gap: 6px; align-items: center; }

/* ───────────────────────────────────────────── 开奖结果条 */

.draw-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}
.draw-strip:last-child { border-bottom: 0; }
.draw-issue { flex: none; width: 66px; }
.draw-issue .n { font-size: 13px; font-weight: 700; letter-spacing: -.2px; }
.draw-issue .d { font-size: 11px; color: var(--text-3); }
.draw-nums { flex: 1; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-width: 0; }
.draw-pool { flex: none; text-align: right; font-size: 11px; color: var(--text-3); }

/* ───────────────────────────────────────────── 图表 */

.chart-wrap { margin: 4px -2px 0; }
/* 注意：不要用 preserveAspectRatio="none"，那会把文字与圆形横向压扁 */
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.ch-grid { stroke: var(--line-2); stroke-width: 1; }
.ch-zero { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.ch-axis { fill: var(--text-3); font-size: 10px; font-weight: 500; }
.ch-bar-stake { fill: var(--text-3); opacity: .38; }
.ch-bar-prize { fill: var(--brand); opacity: .92; }
.ch-line { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-area { fill: var(--gold); opacity: .1; }
.ch-dot { fill: var(--card); stroke: var(--gold); stroke-width: 1.8; }
.ch-legend { display: flex; gap: 14px; justify-content: center; padding-top: 6px; font-size: 11px; color: var(--text-3); font-weight: 600; }
.ch-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.ch-legend i.dot.stake { background: var(--text-3); opacity: .45; }
.ch-legend i.dot.prize { background: var(--brand); }
.ch-legend i.line { background: var(--gold); height: 3px; border-radius: 2px; width: 12px; }
.chart-empty { text-align: center; color: var(--text-3); font-size: 12.5px; padding: 34px 0; }

.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.hbar-label { width: 62px; flex: none; color: var(--text-2); font-weight: 600; }
.hbar-track { flex: 1; height: 8px; background: var(--card-3); border-radius: var(--r-full); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: var(--r-full); background: linear-gradient(90deg, var(--orange), var(--brand)); transition: width .5s var(--ease); }
.hbar-fill.blue { background: linear-gradient(90deg, #7FA9FF, var(--blue)); }
.hbar-fill.gold { background: linear-gradient(90deg, #F0C879, var(--gold)); }
.hbar-fill.grey { background: var(--text-3); }
.hbar-value { width: 62px; flex: none; text-align: right; font-weight: 650; color: var(--text); }

.donut-wrap { display: flex; align-items: center; gap: 14px; }
.donut-svg { width: 128px; height: 128px; flex: none; }
.ch-arc { transition: opacity .2s; }
.donut-center-top { fill: var(--text-3); font-size: 9px; font-weight: 600; }
.donut-center { fill: var(--text); font-size: 15px; font-weight: 750; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dl-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.dl-row i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.dl-name { color: var(--text-2); }
.dl-val { margin-left: auto; font-weight: 650; }

.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 5px; }
.heat-cell {
  aspect-ratio: 1 / .82;
  border-radius: 8px;
  display: grid;
  place-items: center;
  position: relative;
  background: color-mix(in srgb, var(--brand) calc(var(--a) * 100%), var(--card-2));
  transition: transform .14s;
}
.heat-cell[data-tone="blue"] { background: color-mix(in srgb, var(--blue) calc(var(--a) * 100%), var(--card-2)); }
.heat-num { font-size: 12px; font-weight: 700; color: var(--text); opacity: .9; }
.heat-cnt { position: absolute; right: 4px; bottom: 2px; font-size: 9px; font-weight: 700; color: var(--text); }

.spark { width: 100%; height: 100%; }
.spark polyline { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; }

/* ───────────────────────────────────────────── 号码选择器 */

.picker-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.picker-head .t { font-size: 13.5px; font-weight: 700; }
.picker-head .c { font-size: 12px; color: var(--text-3); font-weight: 600; margin-left: auto; }
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 7px;
  margin-bottom: 12px;
}
.pk {
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: all .14s var(--ease);
}
.pk:active { transform: scale(.9); }
.pk.on {
  color: #fff;
  background: radial-gradient(circle at 32% 26%, var(--ball-red-1), var(--ball-red-2) 54%, var(--ball-red-3));
  box-shadow: 0 2px 6px rgba(226, 58, 62, .4);
}
.pk.on.tone-blue { background: radial-gradient(circle at 32% 26%, var(--ball-blue-1), var(--ball-blue-2) 54%, var(--ball-blue-3)); box-shadow: 0 2px 6px rgba(59, 125, 246, .4); }
.pk.dan { box-shadow: inset 0 0 0 2px var(--gold), 0 0 0 1px rgba(255, 255, 255, .1); }
.pk.on.dan { box-shadow: 0 0 0 2px var(--gold), 0 2px 8px rgba(223, 162, 59, .5); }
.pk .mk { position: absolute; }

/* ───────────────────────────────────────────── 表单 */

.field { margin-bottom: 14px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }
.field-hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.5; }
.input, .textarea, .select {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border-radius: var(--r-md);
  background: var(--card-2);
  border: 1px solid var(--line);
  outline: none;
  font-size: 15px;
  transition: border-color .16s, background .16s;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--brand); background: var(--card); }
.textarea { height: auto; padding: 11px 13px; min-height: 78px; resize: vertical; line-height: 1.5; }
.select { background-image: none; }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; }

.switch {
  width: 50px; height: 30px;
  border-radius: var(--r-full);
  background: var(--card-3);
  position: relative;
  flex: none;
  transition: background .22s var(--ease);
}
.switch::after {
  content: '';
  position: absolute;
  top: 2.5px; left: 2.5px;
  width: 25px; height: 25px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
  transition: transform .22s var(--ease);
}
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }

/* ───────────────────────────────────────────── 识别流程 */

.drop {
  border-radius: var(--r-xl);
  border: 1.5px dashed var(--line);
  background: var(--card-2);
  padding: 30px 20px;
  text-align: center;
  transition: all .2s var(--ease);
}
.drop:active { border-color: var(--brand); background: var(--brand-soft); }
.drop .ic { color: var(--brand); margin-bottom: 10px; }
.drop .t { font-size: 15px; font-weight: 700; }
.drop .s { font-size: 12.5px; color: var(--text-3); margin-top: 4px; line-height: 1.6; }

/* 拖拽悬停：整页都是落点，虚线框只负责告诉你「松手会发生什么」 */
.drop.dragging {
  border-color: var(--brand);
  border-style: solid;
  background: var(--brand-soft);
  transform: scale(1.012);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent);
}
/* 卡片本身也提亮一档，让落点在整屏里一眼可见
 *（不用 fixed 遮罩层：祖先若带 transform 会改变 fixed 的包含块，
 *  之前踩过这个坑，这里用纯静态样式就能达到同样效果） */
.card:has(.drop.dragging) {
  border-color: color-mix(in srgb, var(--brand) 42%, transparent);
  box-shadow: 0 6px 26px -14px color-mix(in srgb, var(--brand) 52%, transparent);
}
.drop.dragging .ic { transform: scale(1.08); }
.drop .ic { transition: transform .2s var(--ease); }

/* 拖动文件时整页显示「可放置」光标，比压暗遮罩更轻、也没有 fixed 包含块的风险 */
html.dragging-file, html.dragging-file * { cursor: copy !important; }

.shot {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--card-3);
  margin-bottom: 12px;
}
.shot img { display: block; width: 100%; max-height: 46vh; object-fit: contain; background: #000; }
.shot-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .68));
}
.shot-bar .btn { height: 34px; font-size: 13px; background: rgba(255, 255, 255, .18); color: #fff; backdrop-filter: blur(10px); }
.shot-bar .btn:active { background: rgba(255, 255, 255, .3); }

.scan {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--card-3);
}
.scan img { display: block; width: 100%; max-height: 42vh; object-fit: contain; opacity: .55; filter: grayscale(.4); }
.scan-line {
  position: absolute;
  left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  box-shadow: 0 0 16px 3px rgba(226, 58, 62, .7);
  animation: scanmove 2.1s var(--ease) infinite;
}
@keyframes scanmove { 0% { top: 4%; } 50% { top: 92%; } 100% { top: 4%; } }
.scan-tip {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .72));
  color: #fff; font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.spinner {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
  flex: none;
}
.spinner.dark { border-color: var(--line); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

.confidence {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--card-2);
  font-size: 12.5px;
  margin-bottom: 12px;
}
.confidence .bar { flex: 1; height: 6px; border-radius: var(--r-full); background: var(--card-3); overflow: hidden; }
.confidence .bar i { display: block; height: 100%; border-radius: var(--r-full); background: var(--green); transition: width .5s var(--ease); }
.confidence.warn .bar i { background: var(--gold); }
.confidence.bad .bar i { background: var(--red); }

.note {
  display: flex;
  gap: 9px;
  padding: 11px 12px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  line-height: 1.6;
  margin-bottom: 10px;
  background: var(--card-2);
  color: var(--text-2);
}
.note .ic { flex: none; margin-top: 1px; }
.note.warn { background: var(--gold-soft); color: #7A5510; }
.note.bad { background: var(--red-soft); color: var(--brand-ink); }
.note.ok { background: var(--green-soft); color: #0B7A3C; }
[data-theme="dark"] .note.warn { color: #E9C079; }
[data-theme="dark"] .note.bad { color: #FF9C99; }
[data-theme="dark"] .note.ok { color: #5BD894; }
.note .ic { color: currentColor; }

/* ───────────────────────────────────────────── 反馈层 */

.toast-host {
  position: fixed;
  left: 0; right: 0;
  top: calc(var(--sat) + 10px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 16px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--text) 92%, transparent);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: translateY(-14px) scale(.96);
  transition: all .26s var(--ease);
}
.toast.in { opacity: 1; transform: none; }
.toast .ic { flex: none; }
.toast-error { background: var(--brand); color: #fff; }
.toast-success { background: var(--green); color: #fff; }

.modal-host, .sheet-host {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-host { align-items: flex-end; }
.modal-mask, .sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 16, .42);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .24s;
}
.modal-host.in .modal-mask, .sheet-host.in .sheet-mask { opacity: 1; }

.modal-card {
  position: relative;
  width: calc(100% - 56px);
  max-width: 340px;
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 22px 20px 16px;
  box-shadow: var(--shadow-2);
  transform: scale(.92);
  opacity: 0;
  transition: all .26s var(--ease);
}
.modal-host.in .modal-card { transform: none; opacity: 1; }
.modal-title { font-size: 16.5px; font-weight: 750; text-align: center; letter-spacing: -.2px; }
.modal-body { font-size: 13.5px; color: var(--text-2); text-align: center; margin-top: 8px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

.sheet-panel {
  position: relative;
  width: 100%;
  max-height: 88%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 8px 16px calc(var(--sab) + 16px);
  box-shadow: 0 -8px 40px -12px rgba(0, 0, 0, .28);
  transform: translateY(100%);
  transition: transform .32s var(--ease);
}
.sheet-host.in .sheet-panel { transform: none; }
.sheet-grip { width: 38px; height: 4px; border-radius: var(--r-full); background: var(--card-3); margin: 4px auto 10px; }
.sheet-title { font-size: 16px; font-weight: 750; margin-bottom: 12px; letter-spacing: -.2px; }
.sheet-content { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.sheet-actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet-actions .btn { flex: 1; }

/* ───────────────────────────────────────────── 锁屏 */

.lock {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: calc(var(--sat) + 20px) 28px calc(var(--sab) + 20px);
  background: radial-gradient(120% 70% at 50% 0%, var(--bg-top), var(--bg) 70%);
}
.lock-logo {
  width: 66px; height: 66px;
  border-radius: 20px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(150deg, var(--orange), var(--brand) 66%);
  box-shadow: var(--shadow-brand);
  margin-bottom: 2px;
}
.lock h1 { font-size: 21px; font-weight: 800; letter-spacing: -.4px; margin: 0; }
.lock p { font-size: 13px; color: var(--text-3); margin: 0 0 8px; text-align: center; line-height: 1.6; }
.pin-dots { display: flex; gap: 12px; margin: 6px 0 14px; }
.pin-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--card-3); transition: all .2s var(--ease); }
.pin-dots i.on { background: var(--brand); transform: scale(1.12); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 74px); gap: 12px; }
.pin-key {
  height: 62px;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-1);
  font-size: 24px;
  font-weight: 600;
  display: grid;
  place-items: center;
  transition: transform .12s, background .12s;
}
.pin-key:active { transform: scale(.94); background: var(--card-2); }
.pin-key.wide { font-size: 14px; font-weight: 700; }
.pin-key.blank { background: none; box-shadow: none; }

/* ───────────────────────────────────────────── 其他 */

.risk {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.65;
  padding: 2px 4px 8px;
}
.disclaimer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--card-2);
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.65;
  margin: 4px 0 8px;
}
.disclaimer .ic { flex: none; margin-top: 1px; color: var(--text-3); }

/* ───────────────────────────────────────────── 公益贡献卡片
   金色系：与「中奖红」区分开 —— 这部分不依赖运气，是确定发生的善意。 */

.card.give {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--gold-soft) 0%, var(--card) 58%);
  border: 1px solid rgba(223, 162, 59, .28);
}
.card.give::after {
  /* 右上角一枚极淡的金色圆环，做点缀但不抢内容 */
  content: '';
  position: absolute;
  right: -34px; top: -46px;
  width: 132px; height: 132px;
  border-radius: 50%;
  border: 14px solid rgba(223, 162, 59, .10);
  pointer-events: none;
}
.give-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.give-mark {
  flex: none;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(150deg, #F0B44E, #D08F26);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(208, 143, 38, .8);
}
.give-title { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.give-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.5; }
.give-sub b { color: #8A5E0C; }
[data-theme="dark"] .give-sub b { color: #E9C079; }

.give-amount {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -1.4px;
  line-height: 1.06;
  color: #8A5E0C;
  font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .give-amount { color: #F0C56A; }
.give-amount small { font-size: 15px; font-weight: 700; margin-left: 4px; letter-spacing: 0; }

.give-formula { font-size: 12px; color: var(--text-3); margin-top: 7px; line-height: 1.6; }

.give-note {
  display: flex; gap: 8px;
  margin-top: 12px; padding: 10px 12px;
  border-radius: var(--r-md);
  /* 提示条用中性底 + 金色左竖线。
     一开始我用金色底 + 金褐色文字，实测浅色 2.99:1、深色 1.31:1，两个主题都不达标 ——
     金色只适合做大号金额，不该承担小字的可读性。 */
  background: var(--card-3);
  border-left: 3px solid var(--gold);
  font-size: 12.5px; line-height: 1.6;
  color: var(--text);
}
.give-note .ic { flex: none; margin-top: 1px; color: #8A5E0C; }
[data-theme="dark"] .give-note .ic { color: #E9C079; }
.give-note b { color: inherit; }

.give-more { margin-top: 14px; border-top: 1px dashed rgba(223, 162, 59, .32); padding-top: 12px; }
.give-more > summary {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  cursor: pointer; list-style: none;
  padding: 2px 0;
}
.give-more > summary::-webkit-details-marker { display: none; }
.give-more > summary .ic { transition: transform .2s var(--ease); }
.give-more[open] > summary .ic { transform: rotate(90deg); }
.give-split { margin-top: 10px; }
.give-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-2);
}
.give-row:last-child { border-bottom: 0; }
.give-row-main { flex: 1; min-width: 0; }
.give-row-label { font-size: 13px; font-weight: 600; }
.give-row-hint { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.give-row-val { text-align: right; flex: none; }
.give-row-val b { font-size: 14px; font-variant-numeric: tabular-nums; color: #8A5E0C; }
[data-theme="dark"] .give-row-val b { color: #E9C079; }
.give-row-val span { display: block; font-size: 11px; color: var(--text-3); }

.give-src {
  margin-top: 12px;
  font-size: 11.5px; line-height: 1.75;
  color: var(--text-3);
}
.give-quote {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--text-3);
  text-align: center;
  letter-spacing: .1px;
}
.give-inline { color: #8A5E0C; }
[data-theme="dark"] .give-inline { color: #E9C079; }

/* 入场动画只在「换页面」时播一次。
 * 放在默认态会在每次局部刷新（切机选/均衡、改号码、标记已读）时重播，
 * 整页反复淡入位移 —— 这是「不跟手」的主要来源。 */
#view.anim .seg-page { animation: fadein .26s var(--ease); }
#view.anim .action-dock { animation: dockin .3s var(--ease); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ───────────────────────────────────────────── 吸底操作条
   识别确认页的主操作（确认保存）常驻屏幕底部，不用滚到页面最下面去找。 */

.action-dock {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--tab-h) + var(--sab) + 1px);
  z-index: 43;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 93%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  transform: translateZ(0);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 26px -20px rgba(12, 16, 24, .5);
  transition: transform .22s var(--ease), opacity .18s;
}

@keyframes dockin { from { transform: translateY(120%); } to { transform: none; } }
.action-dock .btn { min-height: 46px; }
.action-dock .btn-primary { flex: 1; font-weight: 700; }
.action-dock .btn-icon {
  flex: 0 0 auto;
  width: 46px;
  padding: 0;
  color: var(--text-3);
}
.action-dock .btn-icon:active { color: var(--brand); }
/* 输入框聚焦（iPhone 弹键盘）时收起，避免遮挡正在编辑的字段 */
html.kb .action-dock { transform: translateY(130%); opacity: 0; pointer-events: none; }

/* 页面里给吸底条留出空间 */
.seg-page.has-dock { padding-bottom: 76px; }

/* ───────────────────────────────────────────── 启动占位
   在 JS 起来之前先把品牌画出来，用户不会看到白屏。 */

.boot-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 62vh;
  color: var(--brand);
  animation: fadein .2s var(--ease);
}
.boot-mark { transform: translateZ(0); }
.boot-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--text-2);
}
.boot-bar {
  width: 96px; height: 3px;
  border-radius: var(--r-full);
  background: var(--card-3);
  overflow: hidden;
}
.boot-bar i {
  display: block;
  width: 40%; height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--orange), var(--brand));
  animation: bootslide 1.05s var(--ease) infinite;
}
@keyframes bootslide {
  from { transform: translateX(-105%); }
  to { transform: translateX(255%); }
}

.hstack { display: flex; align-items: center; gap: 8px; }
.hstack.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mb0 { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
