:root {
  --bg: #0a0e1a; --bg2: #0e1424; --card: #141c30; --card2: #1c2840; --line: #2b3a5c;
  --text: #f1f5ff; --muted: #8c9bc0; --gold: #ffce5c; --gold2: #f5a623;
  --blue: #5aa0ff; --green: #2fe0a0; --red: #ff5d77; --felt: #0c5a3a;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: "Segoe UI", "Microsoft JhengHei", system-ui, sans-serif; overflow-x: hidden; }
.bg-glow { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(245,166,35,.10), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(90,160,255,.10), transparent 60%),
    radial-gradient(600px 400px at 50% 50%, rgba(12,90,58,.10), transparent 70%); }
.app { position: relative; z-index: 1; max-width: 540px; margin: 0 auto; min-height: 100vh;
  display: flex; flex-direction: column; }

.appbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between;
  align-items: center; padding: 13px 16px; backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(14,20,36,.95), rgba(14,20,36,.75));
  border-bottom: 1px solid var(--line); }
.brand { font-size: 14px; color: var(--muted); display: flex; align-items: baseline; gap: 6px; }
.brand b { color: var(--gold); font-size: 18px; letter-spacing: 1px; font-weight: 800; }
.brand i { font-style: normal; font-size: 12.5px; }
.period-chip { font-size: 12px; color: var(--gold); border: 1px solid var(--line);
  background: rgba(245,166,35,.08); padding: 4px 10px; border-radius: 20px; }

.screens { flex: 1; padding: 14px 14px 92px; }
.screen { display: none; }
.screen.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.screen-h { font-size: 19px; margin: 4px 0 6px; }
.screen-sub { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; line-height: 1.6; }

/* countdown */
.countdown-bar { display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, rgba(12,90,58,.35), rgba(20,28,48,.6));
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.cd-label { color: var(--muted); font-size: 12.5px; }
.cd-time { font-size: 22px; font-weight: 800; color: var(--gold); letter-spacing: 2px;
  font-variant-numeric: tabular-nums; text-shadow: 0 0 16px rgba(245,166,35,.5); }

/* pickers */
.picker { background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 8px 12px; margin-bottom: 14px; }
.picker-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.picker-label { width: 36px; color: var(--muted); font-size: 13px; flex-shrink: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.seg-btn { background: var(--card2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 13px; font-size: 14px; cursor: pointer; transition: .15s; }
.seg-btn:active { transform: scale(.95); }
.seg-btn.active { background: linear-gradient(135deg, var(--gold), var(--gold2));
  border-color: var(--gold); color: #2a1a00; font-weight: 800; box-shadow: 0 4px 14px rgba(245,166,35,.35); }

/* bet card */
.betcard { position: relative; border-radius: 20px; padding: 20px 18px; overflow: hidden;
  background: linear-gradient(160deg, #1b2742, #121a2e);
  border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.04); }
.betcard::before { content: ""; position: absolute; inset: 0; border-radius: 20px; padding: 1px;
  background: linear-gradient(135deg, rgba(245,166,35,.5), transparent 40%, rgba(90,160,255,.4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.bc-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.bc-title { text-align: center; color: var(--gold); font-weight: 800; font-size: 16px; margin: 8px 0 4px;
  text-shadow: 0 0 18px rgba(245,166,35,.4); }
.bc-play { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.bc-play b { color: var(--text); font-size: 16px; }
.rate-pills { display: flex; gap: 8px; justify-content: center; margin: 8px 0 4px; }
.pill { font-size: 11.5px; padding: 3px 10px; border-radius: 20px; border: 1px solid var(--line); }
.pill.hit { color: var(--blue); background: rgba(90,160,255,.1); }
.pill.win { color: var(--gold); background: rgba(245,166,35,.1); }
.balls { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin: 14px 0; }
.ball { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-weight: 800; font-size: 18px; position: relative;
  background: radial-gradient(circle at 32% 28%, #7e9bef 0%, #3a52a0 55%, #25346e 100%);
  color: #fff; box-shadow: 0 4px 10px rgba(0,0,0,.45), inset 0 2px 4px rgba(255,255,255,.35);
  animation: ballIn .45s cubic-bezier(.2,1.3,.4,1) backwards; }
.ball::after { content: ""; position: absolute; top: 6px; left: 10px; width: 12px; height: 8px;
  border-radius: 50%; background: rgba(255,255,255,.55); filter: blur(1px); }
@keyframes ballIn { from { opacity: 0; transform: translateY(-16px) scale(.4); } to { opacity: 1; transform: none; } }
.ball.sm { width: 32px; height: 32px; font-size: 13px; }
.ball.gold { background: radial-gradient(circle at 32% 28%, #ffe08a, #f5a623 55%, #c97f10 100%); color: #3a2400; }
.ball.dim { opacity: .35; filter: grayscale(.4); }
.bc-rows { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 6px; }
.bc-line { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.bc-line .k { color: var(--muted); }
.bc-line .v { font-weight: 700; }
.bc-total { display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.bc-total .k { color: var(--muted); }
.bc-total .v { font-size: 32px; font-weight: 900;
  background: linear-gradient(135deg, #ffe08a, #f5a623); -webkit-background-clip: text;
  background-clip: text; color: transparent; }
.bc-return { text-align: right; color: var(--green); font-size: 13px; margin-top: 5px; }
.bc-return small { color: var(--muted); }

.home-actions { display: flex; gap: 10px; margin: 14px 0 4px; }
.btn-ghost, .btn-gold { flex: 1; border-radius: 12px; padding: 13px; font-size: 14.5px; cursor: pointer; border: 1px solid var(--line); transition: .15s; }
.btn-ghost { background: var(--card2); color: var(--text); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #2a1a00; font-weight: 800; border-color: var(--gold); box-shadow: 0 6px 18px rgba(245,166,35,.3); }
.btn-gold.full { width: 100%; margin-bottom: 14px; }
.btn-ghost:active, .btn-gold:active { transform: scale(.97); }
.warn { color: #ffd9a8; background: rgba(58,42,23,.6); border: 1px solid #5a4220; border-radius: 11px; padding: 10px 12px; font-size: 12.5px; margin-top: 12px; }
.warn b { color: #ffb454; }

/* games */
.games-list { display: flex; flex-direction: column; gap: 10px; }
.game-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; transition: .15s; }
.game-card:active { transform: scale(.99); border-color: var(--gold); }
.game-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.game-star { font-size: 18px; font-weight: 800; }
.game-star small { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 6px; }
.game-odds { color: var(--gold); font-weight: 800; font-size: 16px; }
.game-rates { display: flex; gap: 8px; margin-bottom: 8px; }
.rate-box { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; text-align: center; }
.rate-box .rl { font-size: 11px; color: var(--muted); display: block; }
.rate-box .rv { font-size: 17px; font-weight: 800; }
.rate-box.hit .rv { color: var(--blue); } .rate-box.win .rv { color: var(--gold); }
.game-foot { color: var(--muted); font-size: 12px; }
.game-foot b { color: var(--text); }

/* strategy center */
.sub-h { font-size: 15px; margin: 20px 0 10px; color: var(--gold); }
.prof-card { background: linear-gradient(160deg,#1b2742,#141c30); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.prof-head { display: flex; justify-content: space-between; align-items: center; }
.prof-name { font-size: 16px; font-weight: 800; }
.prof-var { font-size: 11px; padding: 2px 9px; border-radius: 12px; }
.prof-var.低 { background: #14352a; color: var(--green); } .prof-var.中 { background: #33371a; color: var(--gold); } .prof-var.高 { background: #3a1c22; color: var(--red); }
.prof-analogy { color: var(--blue); font-size: 12.5px; margin: 6px 0; }
.prof-desc { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin-bottom: 10px; }
.prof-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.prof-stat { background: var(--card2); border-radius: 9px; padding: 7px; text-align: center; }
.prof-stat .pl { font-size: 10.5px; color: var(--muted); display: block; }
.prof-stat .pv { font-size: 15px; font-weight: 800; }
.prof-apply { width: 100%; background: var(--card2); border: 1px solid var(--gold2); color: var(--gold); border-radius: 9px; padding: 9px; font-size: 13px; cursor: pointer; }

.calc-result { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 14px; margin-bottom: 10px; }
.calc-line { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.calc-line:last-child { border: none; }
.calc-line .k { color: var(--muted); } .calc-line .v { font-weight: 700; }
.calc-line .v.neg { color: var(--red); } .calc-line .v.pos { color: var(--green); }

.sim-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.sim-box { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 13px; text-align: center; }
.sim-box .sl { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.sim-box .sv { font-size: 22px; font-weight: 800; }
.sim-box.loss .sv { color: var(--red); } .sim-box.profit .sv { color: var(--green); }

/* evidence */
.ev-verdict { background: linear-gradient(135deg, rgba(47,224,160,.12), rgba(20,28,48,.6)); border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 12px; padding: 13px 15px; font-size: 13.5px; line-height: 1.7; margin-bottom: 14px; }
.ev-card { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 14px; margin-bottom: 12px; }
.ev-card h4 { margin: 0 0 4px; font-size: 14.5px; }
.ev-card .ev-sub { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.ev-bar { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 13px; }
.ev-bar .lab { width: 96px; color: var(--muted); flex-shrink: 0; }
.ev-bar .track { flex: 1; height: 10px; background: var(--card2); border-radius: 6px; position: relative; overflow: hidden; }
.ev-bar .track > i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--gold)); border-radius: 6px; }
.ev-bar .track .expect { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--red); }
.ev-bar .val { width: 58px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ev-tag { display: inline-block; font-size: 11px; color: var(--green); border: 1px solid var(--green); border-radius: 6px; padding: 1px 7px; margin-left: 6px; }

/* AI chat */
.ai-screen { display: none; flex-direction: column; height: calc(100vh - 150px); }
.ai-screen.active { display: flex; }
.chat-log { flex: 1; overflow-y: auto; padding: 4px 2px 8px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 11px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; animation: fade .2s; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #2a1a00; border-bottom-right-radius: 5px; }
.msg.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.bot .tools { margin-top: 8px; font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; }
.msg.typing { color: var(--muted); }
.dots span { animation: blink 1.2s infinite; } .dots span:nth-child(2){animation-delay:.2s} .dots span:nth-child(3){animation-delay:.4s}
@keyframes blink { 0%,60%,100%{opacity:.25} 30%{opacity:1} }
.chat-suggest { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; }
.chip { white-space: nowrap; background: var(--card2); border: 1px solid var(--line); color: var(--text);
  border-radius: 18px; padding: 8px 13px; font-size: 13px; cursor: pointer; flex: 0 0 auto; }
.chat-input { display: flex; gap: 8px; padding-top: 6px; }
.chat-input input { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  padding: 12px 16px; color: var(--text); font-size: 14.5px; outline: none; }
.chat-input input:focus { border-color: var(--gold); }
.chat-send { width: 46px; border-radius: 50%; border: none; font-size: 18px;
  background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #2a1a00; cursor: pointer; }

/* backtest */
.bt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 14px; }
.bt-arm { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.bt-arm.is-strat { border-color: var(--gold2); box-shadow: 0 0 0 1px rgba(245,166,35,.2); }
.bt-arm h4 { margin: 0 0 10px; font-size: 13.5px; }
.bt-stat { margin: 8px 0; } .bt-stat .k { color: var(--muted); font-size: 11.5px; display: block; }
.bt-stat .v { font-size: 16px; font-weight: 700; }
.bt-net.pos .v { color: var(--green); } .bt-net.neg .v { color: var(--red); } .bt-net .v { font-size: 22px; }
.bt-concl { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.bt-concl b { color: var(--text); }

/* draws */
.draw-row { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; margin-bottom: 9px; }
.draw-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.draw-result { font-size: 13px; margin-top: 5px; }
.draw-result.won { color: var(--gold); font-weight: 800; }

/* tabbar */
.tabbar { position: sticky; bottom: 0; z-index: 20; display: flex; backdrop-filter: blur(10px);
  background: linear-gradient(0deg, rgba(10,14,26,.98), rgba(10,14,26,.8)); border-top: 1px solid var(--line); }
.tabbtn { flex: 1; background: none; border: none; color: var(--muted); font-size: 11px; padding: 9px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.tabbtn span { font-size: 19px; }
.tabbtn.active { color: var(--gold); }
.loading { color: var(--muted); text-align: center; padding: 30px 10px; }
