/* DartScore — 霓虹科技風 */
:root {
  --bg: #050814; --bg2: rgba(10, 16, 34, .72); --card: rgba(255, 255, 255, .045); --card2: rgba(255, 255, 255, .08);
  --line: rgba(130, 160, 255, .16); --line2: rgba(130, 160, 255, .3);
  --text: #eef3ff; --text2: #93a0c4; --text3: #5d6889;
  --cyan: #22e3ff; --violet: #a259ff; --pink: #ff4fd8; --lime: #b6ff3b; --gold: #ffcc33; --red: #ff4d6a;
  --accent: #22e3ff; --accent-ink: #001018; --accent-soft: rgba(34, 227, 255, .12);
  --grad: linear-gradient(120deg, #22e3ff 0%, #6f7dff 50%, #c04dff 100%);
  --amber: #ffb02e; --blue: #4d7dff;
  --p1: #22e3ff; --p2: #ff4fd8; --p3: #b6ff3b; --p4: #ffb02e;
  --r: 14px;
  --tabs-h: 62px;
  --num: "Orbitron", "Rajdhani", "Segoe UI", system-ui, sans-serif;
  font-family: "Noto Sans TC", system-ui, -apple-system, "Segoe UI", "Microsoft JhengHei", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #02040b; color: var(--text); overscroll-behavior: none; }
body { display: flex; justify-content: center; }
button { font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; cursor: pointer; transition: transform .12s, box-shadow .2s, border-color .2s, background .2s; }
button:hover { border-color: var(--line2); }
button:active { transform: scale(.96); }
button.primary {
  position: relative; overflow: hidden; background: var(--grad); color: #fff; border: 0; font-weight: 800; letter-spacing: .5px;
  box-shadow: 0 0 18px rgba(34, 227, 255, .35), 0 0 40px rgba(162, 89, 255, .25), inset 0 1px 0 rgba(255, 255, 255, .35);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .35);
}
button.primary::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent); transform: skewX(-20deg); animation: shine 4.5s ease-in-out infinite; }
@keyframes shine { 0%, 70% { left: -60%; } 100% { left: 140%; } }
button.ghost { background: transparent; }
input, select { font: inherit; color: var(--text); background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 227, 255, .15); }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

/* 背景：深空＋會慢慢飄的網格＋光暈 */
#app {
  width: 100%; max-width: 480px; height: 100dvh; display: flex; flex-direction: column; position: relative; overflow: hidden;
  background:
    radial-gradient(600px 400px at 110% 30%, rgba(162, 89, 255, .18), transparent 60%),
    radial-gradient(500px 380px at -20% 75%, rgba(34, 227, 255, .14), transparent 60%),
    linear-gradient(180deg, #060a18, #04060f);
  box-shadow: 0 0 60px rgba(34, 227, 255, .06);
}
#app::before {
  content: ""; position: absolute; inset: -40px; pointer-events: none; z-index: 0; opacity: .5;
  background-image: linear-gradient(rgba(110, 140, 255, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(110, 140, 255, .07) 1px, transparent 1px);
  background-size: 36px 36px; animation: drift 24s linear infinite;
  mask-image: linear-gradient(180deg, transparent 20%, #000 60%, transparent);
}
@keyframes drift { to { transform: translate(36px, 36px); } }
#app > .cam, #app > main, #app > nav { position: relative; z-index: 1; }
#app > nav { z-index: 2; }
#fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

/* 相機區 */
.cam { position: relative; flex: none; height: 25dvh; background: #000; transition: height .35s cubic-bezier(.2, .8, .2, 1); overflow: hidden; border-bottom: 1px solid rgba(34, 227, 255, .25); box-shadow: 0 8px 30px rgba(34, 227, 255, .08); }
.cam.half { height: 50dvh; }
.cam.cal { height: 64dvh; }
#view { width: 100%; height: 100%; display: block; touch-action: none; }
.hud { position: absolute; inset: 8px; pointer-events: none; }
.hud i { position: absolute; width: 18px; height: 18px; border: 2px solid var(--cyan); filter: drop-shadow(0 0 4px var(--cyan)); opacity: .85; }
.hud i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; }
.hud i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; }
.hud i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; }
.hud i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; }
.scan { position: absolute; left: 0; right: 0; height: 40%; top: -40%; pointer-events: none; opacity: 0; background: linear-gradient(180deg, transparent, rgba(34, 227, 255, .14) 80%, rgba(34, 227, 255, .55) 99%, transparent); }
.cam.scanning .scan { opacity: 1; animation: scan 1.1s linear infinite; }
@keyframes scan { to { top: 100%; } }
.cam-top, .cam-bottom { position: absolute; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; gap: 6px; pointer-events: none; }
.cam-top { top: calc(12px + env(safe-area-inset-top)); }
.cam-bottom { bottom: 12px; align-items: flex-end; }
.chip { pointer-events: auto; background: rgba(4, 8, 20, .62); color: #dfe8ff; border: 1px solid rgba(34, 227, 255, .25); border-radius: 999px; padding: 4px 11px; font-size: 12px; display: inline-flex; align-items: center; gap: 7px; backdrop-filter: blur(8px); white-space: nowrap; letter-spacing: .3px; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text3); }
.chip.ok .dot { background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.chip.busy .dot { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: pulse .7s infinite; }
.chip.warn .dot { background: var(--red); box-shadow: 0 0 8px var(--red); }
@keyframes pulse { 50% { opacity: .25; } }
.chip.last { font-family: var(--num); font-size: 15px; font-weight: 800; padding: 5px 13px; border-color: rgba(162, 89, 255, .5); box-shadow: 0 0 14px rgba(162, 89, 255, .35); }
.chip.last:empty { display: none; }
.cam-btns { display: flex; gap: 8px; pointer-events: auto; margin-left: auto; }
.cbtn { width: 40px; height: 40px; padding: 0; border-radius: 12px; background: rgba(4, 8, 20, .6); border: 1px solid rgba(34, 227, 255, .3); display: grid; place-items: center; backdrop-filter: blur(8px); color: #cfe9ff; }
.cbtn:hover { box-shadow: 0 0 12px rgba(34, 227, 255, .45); }
.cbtn.on { background: var(--grad); color: #fff; border: 0; box-shadow: 0 0 16px rgba(34, 227, 255, .5); }
.calbar { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, rgba(5, 8, 20, .75), rgba(5, 8, 20, .95)); border-top: 1px solid rgba(34, 227, 255, .3); padding: 12px; display: flex; flex-direction: column; gap: 8px; backdrop-filter: blur(10px); }
.calbar[hidden] { display: none; }
.calbar p { margin: 0; font-size: 13px; color: var(--text2); line-height: 1.55; }
.calbar p b { color: var(--cyan); }
.calbar .row { display: flex; gap: 8px; }
.calbar .row button { flex: 1; }

/* 命中大字 */
.flash { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.4); font-family: var(--num); font-size: 54px; font-weight: 900; letter-spacing: 2px; color: #fff; opacity: 0; pointer-events: none; text-align: center; line-height: 1; white-space: nowrap; }
.flash small { display: block; font-size: 16px; letter-spacing: 4px; margin-top: 4px; opacity: .9; }
.flash.show { animation: flashpop .9s cubic-bezier(.2, 1.4, .3, 1) forwards; }
@keyframes flashpop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); filter: blur(6px); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); filter: blur(0); }
  45% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(1.04); }
}

/* 主區 */
main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.page { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.game { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.game .scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 10px; }
.game .scroll > *, .page > * { flex-shrink: 0; }
.page, .game .scroll { scrollbar-width: thin; scrollbar-color: rgba(34, 227, 255, .25) transparent; }

.topline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); }
.topline .tag { background: rgba(34, 227, 255, .1); border: 1px solid rgba(34, 227, 255, .35); color: var(--cyan); border-radius: 999px; padding: 3px 11px; font-weight: 700; letter-spacing: .5px; text-shadow: 0 0 8px rgba(34, 227, 255, .5); }
.topline .rd { font-family: var(--num); font-size: 12px; letter-spacing: 1px; }
.topline .sp { flex: 1; }

/* 主分數卡 */
.hero {
  --pc: var(--cyan);
  position: relative; border-radius: 20px; padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, color-mix(in srgb, var(--pc) 16%, transparent), rgba(255, 255, 255, .03) 55%), rgba(8, 12, 28, .7);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--pc) 45%, transparent), 0 10px 40px color-mix(in srgb, var(--pc) 18%, transparent), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.hero.enter { animation: heroin .55s cubic-bezier(.2, .9, .2, 1); }
@keyframes heroin { from { transform: translateX(40px); opacity: 0; filter: blur(4px); } }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: repeating-linear-gradient(115deg, transparent 0 22px, rgba(255, 255, 255, .025) 22px 23px); }
.hero::after { content: ""; position: absolute; right: -40px; top: -60px; width: 200px; height: 200px; z-index: -1; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--pc) 35%, transparent), transparent 70%); animation: breathe 3.5s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.15); opacity: .7; } }
.hero .who { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; }
.hero .who .av { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 900; color: #000; background: var(--pc); box-shadow: 0 0 12px var(--pc); }
.hero .who small { font-weight: 500; color: var(--text2); font-size: 12px; }
.hero .big {
  grid-row: span 2; align-self: center; font-family: var(--num); font-size: 60px; font-weight: 900; line-height: 1; letter-spacing: -1px; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff 20%, color-mix(in srgb, var(--pc) 80%, #fff)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--pc) 55%, transparent));
}
.hero .big.bump { animation: bump .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes bump { 30% { transform: scale(1.12); } }
.hero .meta { font-size: 13px; color: var(--text2); display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.hero .meta b { color: var(--text); font-weight: 800; font-family: var(--num); font-size: 14px; }
.hero .meta .plus { color: var(--lime); text-shadow: 0 0 8px rgba(182, 255, 59, .5); }
.hero .meta .bust { color: var(--red); font-weight: 900; letter-spacing: 2px; text-shadow: 0 0 10px var(--red); }
.hero .prog { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 4px; }
.hero .prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--pc), #fff); box-shadow: 0 0 10px var(--pc); transition: width .6s cubic-bezier(.2, .9, .2, 1); }

.co { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text2); flex-wrap: wrap; }
.co .seg { font-family: var(--num); background: rgba(162, 89, 255, .14); border: 1px solid rgba(162, 89, 255, .45); color: #e3ccff; border-radius: 8px; padding: 3px 9px; font-weight: 800; font-size: 12px; letter-spacing: .5px; box-shadow: 0 0 10px rgba(162, 89, 255, .25); }

/* 三鏢 */
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { position: relative; background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02)); border: 1px solid var(--line); border-radius: 14px; padding: 9px 6px 12px; text-align: center; min-height: 70px; display: flex; flex-direction: column; justify-content: center; gap: 2px; overflow: hidden; }
.slot .lb { font-size: 11px; color: var(--text2); letter-spacing: 1px; }
.slot .sc { font-family: var(--num); font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.slot.empty { border-style: dashed; color: var(--text3); background: transparent; }
.slot.empty .sc { color: var(--text3); font-weight: 600; }
.slot.next { border-color: rgba(34, 227, 255, .6); box-shadow: inset 0 0 18px rgba(34, 227, 255, .12); animation: waitglow 1.6s ease-in-out infinite; }
@keyframes waitglow { 50% { box-shadow: inset 0 0 26px rgba(34, 227, 255, .25), 0 0 12px rgba(34, 227, 255, .2); } }
.slot.t { border-color: rgba(162, 89, 255, .7); box-shadow: 0 0 16px rgba(162, 89, 255, .3); }
.slot.t .sc { color: #e2c6ff; text-shadow: 0 0 12px var(--violet); }
.slot.d { border-color: rgba(34, 227, 255, .6); box-shadow: 0 0 14px rgba(34, 227, 255, .25); }
.slot.d .sc { color: #c9f7ff; text-shadow: 0 0 12px var(--cyan); }
.slot.b { border-color: rgba(255, 204, 51, .8); box-shadow: 0 0 18px rgba(255, 204, 51, .35); }
.slot.b .sc { color: #ffe9a6; text-shadow: 0 0 12px var(--gold); }
.slot.m .sc { color: var(--text3); }
.slot.fresh { animation: slotin .6s cubic-bezier(.2, 1.5, .3, 1); }
.slot.fresh::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 60%, rgba(255, 255, 255, .5), transparent 60%); animation: slotflash .7s ease-out forwards; }
@keyframes slotin { 0% { transform: scale(.7) rotateX(60deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes slotflash { to { opacity: 0; } }
.slot.low { border-color: var(--amber); }
.slot.low::after { content: "待確認"; position: absolute; top: 4px; right: 5px; background: var(--amber); color: #2a1700; font-size: 9px; font-weight: 900; padding: 1px 5px; border-radius: 5px; }
.slot .cb { position: absolute; left: 12px; right: 12px; bottom: 6px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.slot .cb i { display: block; height: 100%; background: var(--grad); }

.sect { font-size: 11px; color: var(--text3); font-weight: 800; letter-spacing: 1.5px; margin: 4px 2px -3px; display: flex; justify-content: space-between; align-items: center; text-transform: uppercase; }
.sect span:first-child { display: flex; align-items: center; gap: 8px; }
.sect span:first-child::before { content: ""; width: 14px; height: 2px; background: var(--grad); border-radius: 2px; box-shadow: 0 0 6px var(--cyan); }

.plist { display: flex; flex-direction: column; gap: 7px; }
.prow { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 9px 12px; display: grid; grid-template-columns: 30px 1fr auto auto; gap: 10px; align-items: center; transition: all .3s; }
.prow .pc { width: 30px; height: 30px; border-radius: 9px; background: color-mix(in srgb, var(--pc) 22%, transparent); border: 1px solid var(--pc); color: var(--pc); display: grid; place-items: center; font-weight: 900; font-size: 13px; font-style: normal; }
.prow .nm { font-weight: 700; }
.prow .nm small { display: block; color: var(--text2); font-weight: 500; font-size: 12px; }
.prow .st { text-align: right; font-size: 11px; color: var(--text2); }
.prow .st b { display: block; color: var(--text); font-size: 14px; font-family: var(--num); }
.prow .val { font-family: var(--num); font-size: 26px; font-weight: 900; min-width: 70px; text-align: right; font-variant-numeric: tabular-nums; }
.prow.on { background: linear-gradient(90deg, color-mix(in srgb, var(--pc) 16%, transparent), transparent 70%); border-color: color-mix(in srgb, var(--pc) 60%, transparent); box-shadow: 0 0 18px color-mix(in srgb, var(--pc) 20%, transparent); }
.prow.on .pc { background: var(--pc); color: #000; box-shadow: 0 0 12px var(--pc); }
.prow.on .val { color: #fff; text-shadow: 0 0 12px color-mix(in srgb, var(--pc) 70%, transparent); }

.hist { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.hist div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 5px 4px; text-align: center; font-size: 10px; color: var(--text2); letter-spacing: 1px; }
.hist div b { display: block; color: var(--text); font-size: 16px; font-family: var(--num); letter-spacing: 0; }
.hist div.hi { border-color: rgba(182, 255, 59, .5); }
.hist div.hi b { color: var(--lime); text-shadow: 0 0 8px rgba(182, 255, 59, .5); }
.hist div.bust b { color: var(--red); }
.note { font-size: 13px; color: var(--text2); line-height: 1.65; margin: 0; }
.note b { color: var(--cyan); font-weight: 700; }

.heat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: grid; grid-template-columns: 136px 1fr; gap: 14px; align-items: center; }
.heat canvas { width: 136px; height: 136px; filter: drop-shadow(0 0 12px rgba(34, 227, 255, .15)); }
.heat .hs { display: grid; gap: 6px; }
.heat .hs div { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 12px; color: var(--text2); }
.heat .hs b { color: var(--text); font-family: var(--num); }
.heat .hs .bar { grid-column: 1 / -1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.heat .hs .bar i { display: block; height: 100%; background: var(--grad); }

table.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; font-variant-numeric: tabular-nums; }
table.grid th, table.grid td { padding: 7px 4px; text-align: center; border-bottom: 1px solid rgba(130, 160, 255, .08); font-size: 14px; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid th { font-size: 12px; color: var(--text2); font-weight: 700; background: rgba(0, 0, 0, .25); }
table.grid th.on { color: var(--pc); box-shadow: inset 0 -2px 0 var(--pc); text-shadow: 0 0 8px var(--pc); }
table.grid td.tg { font-family: var(--num); font-weight: 900; font-size: 16px; color: var(--text); width: 54px; background: rgba(0, 0, 0, .22); }
table.grid td.tg.dead { color: var(--text3); text-decoration: line-through; }
table.grid td.cur { background: color-mix(in srgb, var(--pc, #22e3ff) 7%, transparent); }
table.grid tr.tot td { font-family: var(--num); font-weight: 900; font-size: 18px; }
.mk { display: inline-block; width: 24px; height: 24px; vertical-align: middle; color: #c9d5ff; }
.mk.full { color: var(--lime); filter: drop-shadow(0 0 5px var(--lime)); }

.actions { flex: none; display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: linear-gradient(180deg, rgba(6, 10, 24, .6), rgba(6, 10, 24, .92)); backdrop-filter: blur(12px); }
.actions button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 6px; font-weight: 700; }

nav#tabs { flex: none; height: var(--tabs-h); display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(5, 8, 20, .92); padding-bottom: env(safe-area-inset-bottom); position: relative; }
nav#tabs::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(34, 227, 255, .5), rgba(162, 89, 255, .5), transparent); }
nav#tabs button { background: none; border: 0; border-radius: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--text3); position: relative; letter-spacing: 1px; }
nav#tabs button.on { color: var(--cyan); text-shadow: 0 0 10px rgba(34, 227, 255, .6); }
nav#tabs button.on svg { filter: drop-shadow(0 0 6px var(--cyan)); }
nav#tabs button.on::before { content: ""; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 4px 4px; background: var(--grad); box-shadow: 0 0 12px var(--cyan); }

/* 玩法、設定 */
.cards { display: grid; gap: 9px; }
.gcard { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: grid; grid-template-columns: 50px 1fr; gap: 4px 14px; text-align: left; overflow: hidden; }
.gcard .ic { grid-row: span 2; width: 50px; height: 50px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); display: grid; place-items: center; font-family: var(--num); font-weight: 900; font-size: 15px; color: var(--cyan); }
.gcard b { font-size: 17px; }
.gcard span { font-size: 13px; color: var(--text2); }
.gcard.on { border-color: transparent; background: linear-gradient(rgba(8, 12, 28, .92), rgba(8, 12, 28, .92)) padding-box, var(--grad) border-box; border: 1px solid transparent; box-shadow: 0 0 24px rgba(34, 227, 255, .18); }
.gcard.on .ic { background: var(--grad); color: #fff; border: 0; box-shadow: 0 0 16px rgba(34, 227, 255, .5); }
.box { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 11px; }
.box h3 { margin: 0; font-size: 12px; color: var(--text2); font-weight: 800; letter-spacing: 2px; }
.seg2 { display: flex; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg2 button { flex: 1; border: 0; background: none; padding: 7px 4px; border-radius: 9px; font-size: 14px; color: var(--text2); }
.seg2 button.on { background: linear-gradient(135deg, rgba(34, 227, 255, .25), rgba(162, 89, 255, .25)); color: #fff; font-weight: 800; box-shadow: 0 0 0 1px rgba(34, 227, 255, .45), 0 0 12px rgba(34, 227, 255, .2); }
.line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.line small { color: var(--text2); display: block; font-size: 12px; }
.line input[type=range] { flex: 1; accent-color: var(--cyan); }
.line .v { min-width: 50px; text-align: right; font-weight: 800; font-family: var(--num); color: var(--cyan); }
.tog { width: 48px; height: 28px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid var(--line); padding: 0; position: relative; flex: none; }
.tog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #c9d3f0; transition: left .2s, background .2s; }
.tog.on { background: var(--grad); border-color: transparent; box-shadow: 0 0 12px rgba(34, 227, 255, .4); }
.tog.on::after { left: 23px; background: #fff; }
.pl { display: flex; gap: 8px; align-items: center; }
.pl i { width: 30px; height: 30px; border-radius: 9px; background: color-mix(in srgb, var(--pc) 22%, transparent); border: 1px solid var(--pc); flex: none; box-shadow: 0 0 10px color-mix(in srgb, var(--pc) 40%, transparent); }
.pl input { flex: 1; }
.rec { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.rec b { font-size: 15px; font-family: var(--num); }
.rec small { color: var(--text2); font-size: 12px; }
.rec .w { grid-row: span 2; align-self: center; color: var(--lime); font-weight: 800; text-shadow: 0 0 8px rgba(182, 255, 59, .4); }
.empty-state { text-align: center; color: var(--text2); padding: 30px 10px; }
a { color: var(--cyan); }

/* 修正面板 */
.sheet { position: absolute; inset: 0; background: rgba(2, 4, 12, .6); backdrop-filter: blur(4px); display: flex; align-items: flex-end; z-index: 20; }
.sheet[hidden] { display: none; }
.sheet .panel { width: 100%; background: linear-gradient(180deg, rgba(14, 20, 42, .98), rgba(6, 10, 24, .98)); border-radius: 22px 22px 0 0; border-top: 1px solid rgba(34, 227, 255, .4); box-shadow: 0 -10px 40px rgba(34, 227, 255, .12); padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; max-height: 92%; overflow-y: auto; animation: sheetin .3s cubic-bezier(.2, .9, .2, 1); }
@keyframes sheetin { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { margin: 0; font-size: 16px; display: flex; justify-content: space-between; align-items: center; letter-spacing: 1px; }
.sheet canvas { width: 100%; max-width: 300px; aspect-ratio: 1; align-self: center; touch-action: none; filter: drop-shadow(0 0 18px rgba(34, 227, 255, .2)); }
.numgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.numgrid button { padding: 8px 0; font-weight: 800; font-family: var(--num); font-size: 13px; }
.numgrid button.on { background: var(--grad); color: #fff; border: 0; box-shadow: 0 0 12px rgba(34, 227, 255, .4); }
.pick { text-align: center; font-family: var(--num); font-size: 28px; font-weight: 900; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* 獲勝 */
.overlay-win { position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, rgba(34, 227, 255, .15), rgba(2, 4, 12, .9) 70%); display: flex; align-items: center; justify-content: center; z-index: 15; padding: 20px; backdrop-filter: blur(6px); }
.overlay-win .card { background: linear-gradient(rgba(8, 12, 28, .95), rgba(8, 12, 28, .95)) padding-box, var(--grad) border-box; border: 1px solid transparent; border-radius: 22px; padding: 22px 18px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 0 50px rgba(162, 89, 255, .3); animation: winin .6s cubic-bezier(.2, 1.4, .3, 1); }
@keyframes winin { from { transform: scale(.8); opacity: 0; } }
.overlay-win .crown { font-family: var(--num); font-size: 13px; letter-spacing: 6px; color: var(--gold); text-shadow: 0 0 10px var(--gold); }
.overlay-win h2 { margin: 0; font-size: 30px; text-shadow: 0 0 20px currentColor; }
.overlay-win .row { display: flex; gap: 8px; }
.overlay-win .row button { flex: 1; padding: 13px; }

/* 大橫幅（100+、180、換人） */
.banner { position: absolute; left: 0; right: 0; top: 34%; z-index: 35; pointer-events: none; text-align: center; padding: 14px 0; background: linear-gradient(90deg, rgba(4, 7, 18, .5), rgba(6, 10, 26, .96) 18%, rgba(6, 10, 26, .96) 82%, rgba(4, 7, 18, .5)); backdrop-filter: blur(6px); box-shadow: 0 0 40px rgba(34, 227, 255, .2); border-top: 1px solid rgba(34, 227, 255, .5); border-bottom: 1px solid rgba(162, 89, 255, .5); animation: bannerin 1.6s cubic-bezier(.2, .9, .2, 1) forwards; }
.banner b { display: block; font-family: var(--num); font-size: 46px; font-weight: 900; letter-spacing: 6px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 14px rgba(34, 227, 255, .6)); }
.banner span { font-size: 13px; letter-spacing: 4px; color: var(--text2); }
.banner.gold b { background: linear-gradient(120deg, #fff3b0, #ffcc33, #ff8a00); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 16px rgba(255, 204, 51, .7)); }
.banner.red b { background: linear-gradient(120deg, #ff9aa8, #ff4d6a); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 14px rgba(255, 77, 106, .7)); }
@keyframes bannerin {
  0% { transform: scaleY(0); opacity: 0; }
  12% { transform: scaleY(1); opacity: 1; }
  80% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateX(30px); }
}

.toast { position: absolute; left: 50%; bottom: calc(var(--tabs-h) + 76px); transform: translate(-50%, 10px); background: rgba(10, 16, 36, .92); border: 1px solid rgba(34, 227, 255, .35); color: #fff; padding: 9px 15px; border-radius: 12px; font-size: 13px; opacity: 0; transition: all .25s; pointer-events: none; max-width: 90%; text-align: center; z-index: 30; box-shadow: 0 0 20px rgba(34, 227, 255, .15); backdrop-filter: blur(8px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* 加到桌面 */
.installbar { display: grid; grid-template-columns: 40px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 8px 8px 10px; border-radius: 16px;
  background: linear-gradient(rgba(8, 12, 28, .9), rgba(8, 12, 28, .9)) padding-box, var(--grad) border-box; border: 1px solid transparent; box-shadow: 0 0 18px rgba(34, 227, 255, .15); }
.installbar img { width: 40px; height: 40px; border-radius: 10px; }
.installbar b { display: block; font-size: 14px; }
.installbar small { color: var(--text2); font-size: 12px; }
.installbar .primary { padding: 8px 12px; display: flex; gap: 4px; align-items: center; font-size: 13px; }
.installbar .ghost { padding: 6px; border: 0; color: var(--text3); }
.steps { display: grid; gap: 10px; }
.steps div { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-size: 14px; }
.steps b { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; font-family: var(--num); }
.steps em { font-style: normal; color: var(--cyan); font-weight: 700; }
.kbd { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line2); vertical-align: middle; color: var(--cyan); }
