:root {
  --red:       #d92027;
  --red-dark:  #b01820;
  --red-light: #fff0f0;
  --gold:      #e8a020;
  --bg:        #f2f2f7;
  --white:     #ffffff;
  --text:      #1a1a1a;
  --text2:     #555;
  --text3:     #999;
  --border:    #ebebeb;
  --nav-h:     60px;
  --hdr-h:     50px;
  --radius:    12px;
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
  background: #e8e8ec;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.page {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}

/* ── HEADER ── */
.app-hdr {
  position: sticky; top:0; z-index:150;
  height: var(--hdr-h);
  background: var(--red);
  color: #fff;
  display: flex; align-items:center; justify-content:center;
  font-size: 17px; font-weight:700;
}
.app-hdr .back  { position:absolute; left:14px; font-size:24px; color:#fff; text-decoration:none; line-height:1; cursor:pointer; }
.app-hdr .right { position:absolute; right:14px; font-size:13px; color:rgba(255,255,255,.85); text-decoration:none; }

/* ── BOTTOM NAV ── */
.bot-nav {
  position: fixed; bottom:0; left:50%; transform:translateX(-50%);
  width:100%; max-width:480px; height:var(--nav-h);
  background:#fff; border-top:1px solid var(--border);
  display:flex; z-index:200;
}
.bot-nav a {
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:3px; color:var(--text3); font-size:11px; text-decoration:none;
}
.bot-nav a.act { color:var(--red); }
.bot-nav a svg { width:24px; height:24px; }

/* Content padding */
.content { padding-bottom: calc(var(--nav-h) + 5px); }

/* ── CARDS ── */
.card { background:var(--white); border-radius:var(--radius); overflow:hidden; }

/* ── FORM ── */
.form-wrap { padding:20px 24px; }
.f-group   { position:relative; margin-bottom:14px; }
.f-icon    { position:absolute; left:16px; top:50%; transform:translateY(-50%); font-size:18px; pointer-events:none; color:#bbb; }
.f-input {
  width:100%; height:50px;
  background:#f7f7f7; border:1.5px solid var(--border); border-radius:25px;
  padding:0 18px 0 46px; font-size:15px; color:var(--text); outline:none;
  transition:border-color .2s, background .2s;
}
.f-input:focus { border-color:var(--red); background:#fff; }
.f-input::placeholder { color:#ccc; }

/* ── BUTTONS ── */
.btn-red {
  width:100%; height:50px;
  background:linear-gradient(135deg, var(--red), var(--red-dark));
  color:#fff; border:none; border-radius:25px;
  font-size:17px; font-weight:700; letter-spacing:1px;
  cursor:pointer; transition:opacity .15s;
}
.btn-red:active   { opacity:.85; }
.btn-red:disabled { opacity:.6; cursor:not-allowed; }

.btn-outline {
  height:36px; padding:0 18px;
  border:1.5px solid var(--red); border-radius:18px;
  color:var(--red); background:transparent;
  font-size:14px; cursor:pointer;
}

/* ── LOTTERY BALLS ── */
.balls { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.ball  {
  display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px; border-radius:50%;
  background:var(--red); color:#fff; font-size:15px; font-weight:800;
  flex-shrink:0;
}
.ball.sm { width:28px; height:28px; font-size:13px; }

/* ── NOTICE BAR ── */
.notice-bar {
  background:#fff; display:flex; align-items:center; gap:8px;
  padding:9px 14px; font-size:13px; color:#444; overflow:hidden;
}
.notice-bar .icon { flex-shrink:0; font-size:16px; }
.marquee { overflow:hidden; flex:1; }
.marquee-inner { display:inline-block; animation:scroll 18s linear infinite; white-space:nowrap; }
@keyframes scroll { from{transform:translateX(300px)} to{transform:translateX(-100%)} }

/* ── WINNER TABLE ── */
.winner-section { background:#fff; padding:14px; }
.w-head {
  display:flex; align-items:center; justify-content:center; gap:8px;
  margin-bottom:14px;
}
.w-line { flex:1; height:1px; background:linear-gradient(90deg,transparent,var(--gold)); }
.w-line.r { background:linear-gradient(90deg,var(--gold),transparent); }
.w-title { font-size:15px; font-weight:800; color:var(--red); }
.diamond { color:var(--gold); font-size:11px; }
.w-table { width:100%; border-collapse:collapse; }
.w-table th { font-size:12px; color:var(--text3); padding:7px 4px; text-align:left; border-bottom:1px solid var(--border); }
.w-table th:last-child { text-align:right; }
.w-table td { font-size:13px; color:var(--text); padding:10px 4px; border-bottom:1px solid #f5f5f5; }
.w-table td:last-child { text-align:right; color:var(--red); font-weight:700; }
.w-table tr:last-child td { border-bottom:none; }

/* ── GAME GRID ── */
.game-grid { background:#fff; padding:14px 8px; display:grid; grid-template-columns:repeat(4,1fr); gap:14px 4px; }
.game-item { display:flex; flex-direction:column; align-items:center; gap:6px; cursor:pointer; text-decoration:none; }
.g-icon { width:58px; height:58px; border-radius:14px; display:flex; align-items:center; justify-content:center; overflow:hidden; box-shadow:0 3px 10px rgba(0,0,0,.15); flex-shrink:0; }
.g-icon svg { width:44px; height:44px; }
.g-name { font-size:11px; color:var(--text); text-align:center; line-height:1.3; }

/* ── BET UI (game.html) ── */
.round-bar {
  background:#fff; padding:12px 14px;
  display:flex; align-items:center; justify-content:space-between;
}
.round-no  { font-size:12px; color:var(--text3); }
.countdown { font-size:22px; font-weight:900; color:var(--red); letter-spacing:2px; font-variant-numeric:tabular-nums; }
.countdown.closed { color:var(--text3); }

.last-draw { background:#fff; padding:10px 14px; display:flex; align-items:center; gap:10px; border-top:1px solid var(--border); }
.last-draw .label { font-size:12px; color:var(--text3); flex-shrink:0; }

.bet-tabs { display:flex; background:#fff; border-top:1px solid var(--border); border-bottom:1px solid var(--border); }
.bet-tab  { flex:1; text-align:center; padding:12px 0; font-size:14px; color:var(--text3); cursor:pointer; position:relative; }
.bet-tab.act { color:var(--red); font-weight:700; }
.bet-tab.act::after { content:''; position:absolute; bottom:0; left:50%; transform:translateX(-50%); width:30px; height:3px; background:var(--red); border-radius:3px 3px 0 0; }

.bet-opts { background:#fff; padding:14px; display:flex; gap:10px; flex-wrap:wrap; }
.bet-opt  {
  flex:1; min-width:80px; height:58px;
  border:2px solid var(--border); border-radius:var(--radius);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  cursor:pointer; transition:border-color .2s, background .2s;
  font-size:18px; font-weight:700; color:var(--text);
}
.bet-opt .odds { font-size:11px; font-weight:400; color:var(--text3); margin-top:2px; }
.bet-opt.sel { border-color:var(--red); background:var(--red-light); color:var(--red); }
.bet-opt.sel .odds { color:var(--red); }
.bet-opt:disabled, .bet-opt.disabled { opacity:.45; cursor:not-allowed; }

/* position selector */
.pos-grid { display:flex; gap:8px; padding:14px; background:#fff; border-bottom:1px solid var(--border); }
.pos-btn  { flex:1; height:42px; border:2px solid var(--border); border-radius:8px; font-size:13px; color:var(--text3); cursor:pointer; background:#fff; }
.pos-btn.sel { border-color:var(--red); background:var(--red); color:#fff; font-weight:700; }
.num-grid { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; padding:0 14px 14px; background:#fff; }
.num-btn  { height:42px; border:2px solid var(--border); border-radius:8px; font-size:16px; font-weight:700; cursor:pointer; background:#fff; }
.num-btn.sel { border-color:var(--red); background:var(--red); color:#fff; }

.amt-section { background:#fff; padding:14px; margin-top:8px; }
.amt-label { font-size:13px; color:var(--text2); margin-bottom:10px; }
.quick-btns { display:flex; gap:8px; margin-bottom:10px; flex-wrap:wrap; }
.quick-btn {
  flex:1; min-width:52px; height:38px;
  border:1.5px solid var(--border); border-radius:8px;
  font-size:14px; cursor:pointer; background:#fafafa; color:var(--text2);
}
.quick-btn.sel { border-color:var(--red); background:var(--red-light); color:var(--red); font-weight:700; }
.amt-input {
  width:100%; height:46px; border:1.5px solid var(--border); border-radius:10px;
  padding:0 14px; font-size:16px; color:var(--text); outline:none;
}
.amt-input:focus { border-color:var(--red); }
.bal-row { display:flex; justify-content:space-between; margin-top:8px; font-size:13px; color:var(--text3); }
.bal-row span { color:var(--red); font-weight:700; }

.bet-confirm {
  margin:0 14px 14px; padding:14px;
  background:#fff; border-radius:var(--radius);
}
.confirm-info { display:flex; justify-content:space-between; font-size:13px; color:var(--text2); margin-bottom:12px; }
.confirm-info strong { color:var(--red); }
.bet-list { margin-bottom:12px; }
.bet-item {
  display:flex; align-items:center; justify-content:space-between;
  padding:8px 0; border-bottom:1px solid var(--border); font-size:13px;
}
.bet-item:last-child { border-bottom:none; }
.bet-item .del { color:var(--text3); cursor:pointer; font-size:16px; }

/* ── PROFILE ── */
.profile-hero { background:linear-gradient(135deg,var(--red),var(--red-dark)); padding:20px 16px 30px; color:#fff; }
.p-user { display:flex; align-items:center; gap:14px; margin-bottom:20px; }
.p-avatar { width:54px; height:54px; border-radius:50%; background:rgba(255,255,255,.25); display:flex; align-items:center; justify-content:center; font-size:26px; }
.p-name { font-size:18px; font-weight:700; }
.p-id   { font-size:12px; opacity:.75; margin-top:2px; }
.p-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.p-stat  { background:rgba(255,255,255,.15); border-radius:10px; padding:12px 8px; text-align:center; }
.p-stat .val { font-size:20px; font-weight:900; }
.p-stat .lbl { font-size:11px; opacity:.8; margin-top:2px; }

.p-actions { display:flex; gap:10px; padding:14px; margin-top:-16px; }
.p-act-btn {
  flex:1; height:46px; border:none; border-radius:10px;
  font-size:15px; font-weight:700; cursor:pointer;
}
.p-act-btn.red  { background:var(--red); color:#fff; }
.p-act-btn.gold { background:linear-gradient(135deg,var(--gold),#c87800); color:#fff; }
.p-act-btn.gray { background:#f0f0f0; color:var(--text2); }

.menu-group { background:#fff; border-radius:var(--radius); margin:8px 12px; overflow:hidden; }
.menu-item  {
  display:flex; align-items:center; padding:15px 16px;
  border-bottom:1px solid var(--border); text-decoration:none; color:var(--text);
  font-size:15px; gap:12px;
}
.menu-item:last-child { border-bottom:none; }
.menu-item .mi-icon { font-size:20px; width:26px; text-align:center; }
.menu-item .mi-arr  { margin-left:auto; color:var(--text3); font-size:16px; }

/* ── RESULTS ── */
.result-item { background:#fff; margin:8px 12px; border-radius:var(--radius); overflow:hidden; }
.ri-header   { display:flex; align-items:center; justify-content:space-between; padding:12px 14px; border-bottom:1px solid var(--border); }
.ri-name     { font-size:15px; font-weight:700; color:var(--text); }
.ri-time     { font-size:11px; color:var(--text3); }
.ri-body     { padding:12px 14px; display:flex; align-items:center; gap:10px; }
.ri-round    { font-size:11px; color:var(--text3); flex-shrink:0; }

/* ── MISC ── */
.section-title {
  font-size:13px; color:var(--text3); padding:14px 14px 6px;
  display:flex; align-items:center; justify-content:space-between;
}
.empty { padding:40px 0; text-align:center; color:var(--text3); font-size:14px; }
.loading-dots::after { content:'...'; animation:dots 1.2s infinite; }
@keyframes dots { 0%{content:'.'} 50%{content:'..'} 100%{content:'...'} }

/* Toast */
.lc-toast { position:fixed; top:65px; left:50%; transform:translateX(-50%); z-index:9999; pointer-events:none; }

/* Float service */
.float-svc {
  position:fixed; right:12px; bottom:76px;
  background:linear-gradient(160deg,var(--red),var(--red-dark));
  color:#fff; border-radius:30px; padding:8px 12px;
  font-size:11px; line-height:1.6; text-align:center;
  box-shadow:0 4px 16px rgba(217,32,39,.4); cursor:pointer; z-index:150;
}

/* Skeleton */
.skel { background:linear-gradient(90deg,#f0f0f0 25%,#e0e0e0 50%,#f0f0f0 75%); background-size:200% 100%; animation:skel 1.2s infinite; border-radius:6px; }
@keyframes skel { from{background-position:200% 0} to{background-position:-200% 0} }

@media (max-width: 480px) { .page { width:100%; max-width:100%; } .bot-nav { left:0!important; right:0!important; width:100%!important; max-width:100%!important; transform:none!important; } }

/* Fix: SVG inside nav links block click events */
.bot-nav a svg { pointer-events: none; display: block; }
.bot-nav a *   { pointer-events: none; }
.bot-nav a svg, .bot-nav a svg * { pointer-events: none; }

/* Fix nav SVG blocking clicks */
.bot-nav a svg, .bot-nav a svg * { pointer-events: none; }
.bot-nav a { -webkit-tap-highlight-color: rgba(0,0,0,.05); }
