* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root { --gold: #f5c451; --gold2: #b8862a; --red: #e5483b; --blue: #3b8ee5; --bg: #14100c; --card: #221a12; --line: #4a3a22; --text: #f3e9d6; --dim: #a39377; }
html, body { height: 100%; background: #000; color: var(--text); font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; user-select: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:active { transform: scale(.95); }
.hidden { display: none !important; }

#app { position: relative; max-width: 480px; height: 100dvh; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden;
  background: radial-gradient(ellipse at top, #3a2614 0%, var(--bg) 60%); }

.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.35); }
.avatar { position: relative; width: 42px; height: 42px; border-radius: 50%; background: radial-gradient(#7a4a1a, #2a1608); color: var(--gold); font-weight: 900; display: grid; place-items: center; }
.avatar::after { content: ''; position: absolute; inset: -6px; background: url(../assets/ui/frame_avatar.webp) center / contain no-repeat; }
.nick { flex: 1; font-weight: 700; }
.coins { display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 20px; background: #000; border: 1px solid var(--gold2); font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.coin { width: 24px; height: 24px; }

main { flex: 1; overflow-y: auto; padding: 16px; }
.screen { display: none; }
.screen.active { display: block; animation: fadeIn .25s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }

.logo-img { display: block; width: 86%; margin: 12vh auto 0; filter: drop-shadow(0 4px 12px rgba(0,0,0,.8)); }
.slogan { text-align: center; color: var(--dim); margin: 6px 0 28px; }
.btn-main { display: block; width: 100%; padding: 4px 8px; margin-bottom: 10px; text-align: center; border: 26px solid transparent; border-width: 26px 48px; filter: drop-shadow(0 6px 8px rgba(0,0,0,.6)); }
.btn-main b { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 24px; text-shadow: 0 2px 3px rgba(0,0,0,.7); }
.btn-main b img { width: 34px; height: 34px; }
.btn-main small { color: rgba(255,255,255,.85); text-shadow: 0 1px 2px #000; }
.btn-main.red { border-image: url(../assets/ui/btn_red.webp) 60 110 fill / 26px 48px stretch; }
.btn-main.blue { border-image: url(../assets/ui/btn_blue.webp) 60 110 fill / 26px 48px stretch; }
.btn-relief { width: 100%; padding: 12px; border-radius: 12px; border: 1px dashed var(--gold); color: var(--gold); margin-bottom: 14px; }
.demo-box { margin-top: 24px; padding: 12px; border-radius: 12px; border: 1px dashed #555; color: var(--dim); font-size: 13px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.demo-title { width: 100%; font-weight: 700; }
.btn-small { padding: 4px 10px; border-radius: 6px; border: 1px solid #666; }

.title { font-size: 20px; color: var(--gold); margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { border: 16px solid transparent; border-image: url(../assets/ui/panel.webp) 70 fill / 16px stretch; padding: 4px 0; text-align: center; position: relative; }
.card img { width: 96px; height: 96px; object-fit: contain; }
.card .name { font-weight: 900; }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; color: #111; font-weight: 700; }
.muted { color: var(--dim); font-size: 12px; }
.pw { color: var(--gold); font-weight: 900; }
.expbar { height: 6px; background: #000; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.expbar i { display: block; height: 100%; background: linear-gradient(90deg, #6fe0ff, #2a8cff); transition: width .8s; }

.shop-item { display: flex; gap: 10px; align-items: center; border: 16px solid transparent; border-image: url(../assets/ui/panel.webp) 70 fill / 16px stretch; padding: 4px; margin-bottom: 8px; }
.shop-item img { width: 80px; height: 80px; }
.shop-item .desc { flex: 1; font-size: 13px; }
.btn-buy { padding: 10px 14px; border-radius: 10px; background: linear-gradient(180deg, var(--gold), var(--gold2)); color: #3a2410; font-weight: 900; white-space: nowrap; }
.btn-buy:disabled { filter: grayscale(1); opacity: .5; }

.rec { background: var(--card); border-left: 4px solid #666; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.rec.win { border-color: var(--gold); }
.rec .top { display: flex; justify-content: space-between; margin-bottom: 4px; }
.up { color: #4cd27a; font-weight: 900; } .down { color: var(--red); font-weight: 900; }
.empty { text-align: center; color: var(--dim); padding: 40px 0; }

.bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.back { color: var(--gold); font-size: 16px; }
.vs { display: flex; align-items: stretch; gap: 6px; }
.vs-mark { align-self: center; width: 44px; margin: 0 -10px; z-index: 1; filter: drop-shadow(0 2px 4px #000); }
.side { flex: 1; border-radius: 14px; padding: 10px; text-align: center; border: 3px solid transparent; position: relative; transition: .2s; }
.side.red { background: linear-gradient(180deg, #5a1712, #2a0d0a); }
.side.blue { background: linear-gradient(180deg, #123a66, #0a1a2e); }
.side.sel { border-color: var(--gold); box-shadow: 0 0 18px rgba(245,196,81,.5); }
.side .corner { font-weight: 900; font-size: 13px; }
.side img { width: 120px; height: 110px; object-fit: contain; }
.side.blue img { transform: scaleX(-1); }
.stats { font-size: 12px; color: var(--dim); text-align: left; margin-top: 6px; }
.stats div { display: flex; align-items: center; gap: 4px; }
.stats u { flex: 1; height: 5px; background: #000; border-radius: 3px; text-decoration: none; overflow: hidden; }
.stats u i { display: block; height: 100%; background: var(--gold); }
.prob { margin-top: 6px; font-size: 12px; color: #7fd4ff; }
.pick-tip { position: absolute; top: 6px; right: 6px; font-size: 18px; }
.pick-row { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; }
.pick-row .mini { flex: 0 0 auto; width: 72px; padding: 4px; border-radius: 10px; background: var(--card); border: 2px solid var(--line); text-align: center; font-size: 11px; }
.pick-row .mini img { width: 52px; height: 52px; }
.pick-row .mini.sel { border-color: var(--gold); }
.btn-refresh { display: block; margin: 8px auto 0; font-size: 12px; color: #9cc8ff; padding: 4px 10px; border: 1px solid #335; border-radius: 6px; }

.bet-panel { margin-top: 10px; border: 22px solid transparent; border-image: url(../assets/ui/panel.webp) 70 fill / 22px stretch; padding: 2px; }
.bet-panel .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bet-panel input { width: 60%; padding: 10px; font-size: 20px; font-weight: 900; text-align: right; border-radius: 10px; border: 1px solid var(--gold2); background: #000; color: var(--gold); }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.quick button { padding: 8px 0; border-radius: 8px; background: #000; border: 1px solid var(--line); color: var(--gold); font-weight: 700; }
.info { font-size: 13px; color: var(--dim); line-height: 1.8; }
.info b { color: var(--text); }
.btn-confirm { width: 100%; margin-top: 8px; padding: 2px; font-size: 20px; font-weight: 900; color: #3a2410;
  border: 22px solid transparent; border-width: 22px 40px; border-image: url(../assets/ui/btn_gold.webp) 60 110 fill / 22px 40px stretch; }

.tabbar { display: flex; border-top: 1px solid var(--line); background: #0d0a07; padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { flex: 1; padding: 6px 0; display: flex; flex-direction: column; align-items: center; opacity: .55; filter: grayscale(.6); }
.tabbar button img { width: 30px; height: 30px; object-fit: contain; }
.tabbar button span { font-size: 11px; }
.tabbar button.active { opacity: 1; color: var(--gold); filter: none; }

.battle { position: absolute; inset: 0; background: #0b0806; z-index: 10; }
.battle canvas { width: 100%; height: 100%; display: block; }
.battle-ctrl { position: absolute; bottom: 20px; right: 16px; display: flex; gap: 8px; }
.battle-ctrl button { padding: 8px 14px; border-radius: 20px; background: rgba(0,0,0,.6); border: 1px solid var(--gold2); color: var(--gold); font-weight: 700; }

.modal { position: absolute; inset: 0; background: rgba(0,0,0,.75); z-index: 20; display: grid; place-items: center; padding: 16px; }
.modal-box { width: 100%; max-height: 90%; overflow-y: auto; border: 22px solid transparent; border-image: url(../assets/ui/panel.webp) 70 fill / 22px stretch; padding: 4px; text-align: center; animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
.modal-box.lose { filter: grayscale(.85); }
.res-img { width: 82%; margin: -6px auto 0; display: block; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.res-title { font-size: 42px; font-weight: 900; color: var(--gold); text-shadow: 0 0 20px rgba(245,196,81,.7); }
.lose .res-title { color: #aaa; text-shadow: none; }
.res-lines { margin: 14px 0; line-height: 2; font-size: 15px; }
.res-big { font-size: 30px; font-weight: 900; }
.lvup { margin: 10px 0; padding: 10px; border-radius: 12px; background: rgba(245,196,81,.12); border: 1px solid var(--gold); animation: glow 1s infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 20px rgba(245,196,81,.6); } }
.lvup .lv { font-size: 22px; font-weight: 900; color: var(--gold); }
.btns { display: flex; gap: 10px; margin-top: 16px; }
.btns button { flex: 1; padding: 12px; border-radius: 12px; font-weight: 900; background: #333; }
.btns button.pri { background: none; padding: 2px 4px; border: 14px solid transparent; border-image: url(../assets/ui/btn_gold.webp) 60 110 fill / 14px 26px stretch; color: #3a2410; border-radius: 0; }
.btn-ico { width: 28px; height: 28px; display: block; margin: 0 auto 2px; }
.detail-img { width: 170px; height: 160px; object-fit: contain; }
.detail-stats { text-align: left; margin: 10px 0; font-size: 14px; }
.detail-stats .stats { font-size: 14px; }

.coin-rain { position: absolute; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.coin-rain i { position: absolute; top: -30px; width: 28px; height: 28px; background: url(../assets/ui/icon_coin.webp) center / contain no-repeat;
  animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotateY(720deg); } }

.toast { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); z-index: 40; background: rgba(0,0,0,.85); border: 1px solid var(--gold2); padding: 10px 18px; border-radius: 10px; white-space: nowrap; }

/* 竞猜大厅 */
.bar b { flex: 1; }
.share { padding: 4px 12px; border-radius: 14px; border: 1px solid var(--gold2); color: var(--gold); font-size: 13px; }
.phase { text-align: center; margin-bottom: 10px; padding: 8px; border-radius: 10px; background: rgba(0,0,0,.4); font-weight: 900; font-size: 18px; }
.phase .t { color: var(--gold); font-variant-numeric: tabular-nums; }
.phase.locked { color: #ff8a6a; }
.side .sub { font-size: 11px; color: var(--dim); line-height: 1.6; }
.pool { margin-top: 10px; border: 22px solid transparent; border-image: url(../assets/ui/panel.webp) 70 fill / 22px stretch; padding: 0; font-size: 12px; }
.pool .nums { display: flex; justify-content: space-between; margin-bottom: 6px; }
.pool .nums b { font-size: 14px; }
.pool .bar2 { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: #000; }
.pool .bar2 i { transition: width .4s; }
.bet-sides { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 12px; }
.bet-sides button { padding: 0; font-weight: 900; display: flex; flex-direction: column; align-items: center; text-shadow: 0 1px 2px #000;
  border: 12px solid transparent; border-width: 12px 22px; transition: transform .15s, filter .15s; }
.bet-sides button b { font-size: 18px; color: var(--gold); }
.bet-sides .r { border-image: url(../assets/ui/btn_red.webp) 60 110 fill / 12px 22px stretch; }
.bet-sides .d { border-image: url(../assets/ui/btn_gold.webp) 60 110 fill / 12px 22px stretch; color: #3a2410; text-shadow: none; }
.bet-sides .d b { color: #6a1a0a; }
.bet-sides .b { border-image: url(../assets/ui/btn_blue.webp) 60 110 fill / 12px 22px stretch; }
.bet-sides button.sel { transform: scale(1.06); filter: drop-shadow(0 0 10px rgba(255,216,74,.95)); }
.bet-sides button:disabled { opacity: .45; }
.my-bet { text-align: center; padding: 12px; font-weight: 900; color: var(--gold); }
.feed { margin-top: 12px; min-height: 104px; font-size: 12px; color: var(--dim); }
.feed div { padding: 3px 0; animation: fadeIn .3s; }
.feed .R { color: #ff7a6a; } .feed .B { color: #6ab0ff; } .feed .D { color: #5fe08a; }
.road-box { margin-top: 10px; border: 22px solid transparent; border-image: url(../assets/ui/panel.webp) 70 fill / 22px stretch; padding: 0; }
.road-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px; }
.road { display: grid; grid-template-rows: repeat(6, 20px); grid-auto-flow: column; grid-auto-columns: 20px; gap: 3px; overflow-x: auto; }
.road i { width: 20px; height: 20px; border-radius: 50%; font-style: normal; font-size: 11px; font-weight: 900; display: grid; place-items: center; color: #fff; }
.road .R { background: var(--red); } .road .B { background: var(--blue); } .road .D { background: #2faa5a; }
.battle-bet { position: absolute; left: 16px; bottom: 24px; padding: 6px 12px; border-radius: 16px; background: rgba(0,0,0,.6); border: 1px solid var(--gold2); color: var(--gold); font-size: 13px; font-weight: 700; }
.battle-bet:empty { display: none; }

/* 背景图 */
#app { background: #14100c url(../assets/bg_lobby.jpg) center bottom / cover no-repeat; }
#app.dim main { background: rgba(14, 10, 7, .86); }
.topbar { background: rgba(0,0,0,.55); }
#lobby.active { display: flex; flex-direction: column; min-height: 100%; }
#lobby .slogan { color: #f3e9d6; text-shadow: 0 1px 4px #000; }
#lobby .spacer { flex: 1; }
#lobby .demo-box { background: rgba(0,0,0,.6); margin-top: 6px; }

/* 特殊属性 */
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; margin-top: 6px; font-size: 11px; color: var(--dim); text-align: left; }
.specs b { color: #7fd4ff; }
.trait { font-size: 11px; color: var(--dim); text-align: left; margin-top: 3px; }
.trait b { color: var(--gold); }
.trait i { font-style: normal; color: var(--text); }
.trait.rare b { color: #ff8af0; text-shadow: 0 0 6px rgba(255,138,240,.6); }
.detail-stats .specs, .detail-stats .trait { font-size: 13px; }
.detail-stats .stats .lb { width: 7.5em; }
.mute { width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.5); border: 1px solid var(--gold2); font-size: 16px; }
