@font-face { font-family: pix; src: url(assets/pixel.woff2) format('woff2'); font-display: swap; }
:root {
  --bg: #120f22; --bg2: #1c1734; --panel: #231d40; --line: #3d3366; --ink: #f3ecff; --dim: #9c92c4;
  --gold: #ffd23f; --pink: #ff3d8b;
  --N: #b8c0cc; --R: #4fc3ff; --SR: #b57bff; --SSR: #ffb52e; --UR: #ff3d8b; --LR: #ffe066;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: pix, "PingFang SC", monospace; font-size: 14px; -webkit-font-smoothing: none; }
body { min-height: 100vh; background:
  radial-gradient(circle at 50% -20%, #3a2a6e 0, transparent 60%),
  repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 2px, transparent 2px 4px), var(--bg); }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
button { font-family: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* pixel borders */
.panel, .btn, .card, header, .detailBox, .tab {
  box-shadow: 0 -3px 0 0 var(--line), 0 3px 0 0 var(--line), -3px 0 0 0 var(--line), 3px 0 0 0 var(--line);
}

#marquee { height: 26px; overflow: hidden; background: #0a0816; border-bottom: 2px solid var(--line); white-space: nowrap; font-size: 13px; }
#marqueeInner { display: inline-block; padding-left: 100%; line-height: 26px; animation: mq 22s linear infinite; color: var(--gold); }
@keyframes mq { to { transform: translateX(-100%); } }

header { display: flex; align-items: center; gap: 18px; margin: 14px 16px; padding: 8px 14px; background: var(--bg2); flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; }
.logo canvas { width: 64px; height: 48px; }
.logo b { display: block; font-size: 22px; color: var(--gold); text-shadow: 2px 2px 0 #7a3b00; letter-spacing: 1px; }
.logo small { color: var(--dim); font-size: 12px; }
nav { display: flex; gap: 10px; margin-left: auto; }
.tab { background: var(--panel); border: 0; padding: 8px 14px; font-size: 15px; }
.tab.on { background: var(--gold); color: #2a1a00; }
.tab i { font-style: normal; background: var(--pink); color: #fff; padding: 0 5px; margin-left: 4px; }
.wallet { display: flex; align-items: center; gap: 6px; color: var(--dim); }
.wallet b { color: var(--gold); font-size: 17px; }
#mute { background: var(--panel); border: 0; width: 30px; height: 28px; font-size: 16px; }
#mute.off { opacity: .35; }

main { padding: 0 16px 20px; }
.page { display: none; }
.page.on { display: block; }
#shop.on { display: grid; grid-template-columns: 250px 1fr 260px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { #shop.on { grid-template-columns: 1fr; } .feed { order: 3; } }

.panel { background: var(--panel); padding: 12px; }
.panel h3 { margin: 0 0 10px; font-size: 16px; font-weight: normal; color: var(--gold); }
.panel h3 small { color: var(--dim); font-size: 12px; margin-left: 4px; }
.panel h3 em { font-style: normal; color: #fff; font-size: 20px; }
.hint { color: var(--dim); font-size: 12px; line-height: 1.6; margin: 10px 0 0; }

.oddsRow { margin-bottom: 9px; }
.oddsRow .top { display: flex; justify-content: space-between; font-size: 13px; }
.oddsRow .name b { padding: 0 4px; margin-right: 4px; color: #120f22; }
.oddsRow .pct { color: #fff; }
.oddsRow .bar { height: 8px; background: #120f22; margin-top: 3px; position: relative; }
.oddsRow .bar i { position: absolute; inset: 0 auto 0 0; }
.oddsRow .rem { color: var(--dim); font-size: 12px; }
.oddsRow.bump .pct { animation: bump .5s; }
@keyframes bump { 30% { color: var(--pink); transform: scale(1.3); } }

.stage { display: flex; flex-direction: column; align-items: center; }
#shopCanvas { width: 100%; max-width: 768px; aspect-ratio: 192/108; background: #000; box-shadow: 0 0 0 3px var(--line), 0 0 0 6px #0a0816; }
.pulls { display: flex; gap: 22px; margin-top: 22px; }
.btn { border: 0; background: #4a3d86; padding: 8px 18px; font-size: 15px; position: relative; top: 0; transition: transform .05s; }
.btn:active { transform: translateY(3px); }
.btn.big { min-width: 170px; padding: 12px 18px; display: flex; flex-direction: column; align-items: center; background: #6a4cff; box-shadow: 0 -3px 0 #2e1f8a, 0 6px 0 #2e1f8a, -3px 0 0 #2e1f8a, 3px 0 0 #2e1f8a, 0 10px 0 rgba(0,0,0,.4); }
.btn.big span { font-size: 24px; }
.btn.big small { font-size: 12px; opacity: .85; }
.btn.gold { background: var(--gold); color: #3a2000; box-shadow: 0 -3px 0 #a05a00, 0 6px 0 #a05a00, -3px 0 0 #a05a00, 3px 0 0 #a05a00, 0 10px 0 rgba(0,0,0,.4); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { filter: brightness(1.18); } }
.btn:disabled { filter: grayscale(1) brightness(.6); animation: none; cursor: not-allowed; }
.btn.small { font-size: 13px; padding: 6px 12px; }
.fast { margin-top: 14px; color: var(--dim); font-size: 13px; }
.stats { margin-top: 12px; color: var(--dim); font-size: 13px; text-align: center; line-height: 1.7; }
.stats b { color: #fff; }

.feed ul { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow: hidden; }
.feed li { display: flex; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; animation: slideIn .35s; }
.feed li canvas { width: 48px; height: 36px; background: #0a0816; }
.feed li .who { color: var(--dim); }
.feed li b { padding: 0 3px; color: #120f22; }
.feed li.hot { background: linear-gradient(90deg, rgba(255,61,139,.25), transparent); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }

/* cards */
.card { --c: var(--N); position: relative; background: #0d0b1a; padding: 6px; width: 200px; box-shadow: 0 -3px 0 var(--c), 0 3px 0 var(--c), -3px 0 0 var(--c), 3px 0 0 var(--c); cursor: pointer; }
.card canvas { width: 100%; aspect-ratio: 64/48; display: block; }
.card .cap { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; font-size: 13px; }
.card .tierTag { background: var(--c); color: #120f22; padding: 0 5px; }
.card .nm { font-size: 13px; margin-top: 2px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .stars { color: var(--c); font-size: 11px; letter-spacing: -1px; }
.card .no { color: var(--dim); font-size: 12px; }
.card.t-N { --c: var(--N); } .card.t-R { --c: var(--R); } .card.t-SR { --c: var(--SR); }
.card.t-SSR { --c: var(--SSR); } .card.t-UR { --c: var(--UR); }
.card.t-LR { --c: var(--LR); animation: rainbowB 2s linear infinite; }
.card.t-SSR::after, .card.t-UR::after, .card.t-LR::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.35) 45%, transparent 60%); background-size: 300% 100%; animation: sheen 2.4s infinite; mix-blend-mode: overlay; }
@keyframes sheen { from { background-position: 150% 0; } to { background-position: -150% 0; } }
@keyframes rainbowB { 0% { --c: #ff5a5a; filter: hue-rotate(0); } 100% { filter: hue-rotate(360deg); } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; margin-top: 14px; }
.grid .card { width: auto; }
.garageBar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
#garageFilter button { background: var(--panel); border: 0; padding: 5px 10px; margin-right: 6px; box-shadow: 0 0 0 2px var(--line); }
#garageFilter button.on { background: var(--gold); color: #2a1a00; }
.empty { text-align: center; color: var(--dim); margin-top: 60px; font-size: 16px; }

/* overlay */
#overlay { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: rgba(6,4,14,.97); display: flex; align-items: center; justify-content: center; flex-direction: column; overflow-x: hidden; }
#overlay.shake { animation: shk .35s; }
@keyframes shk { 20% { transform: translate(-8px, 4px); } 40% { transform: translate(7px, -5px); } 60% { transform: translate(-5px, -3px); } 80% { transform: translate(4px, 5px); } }
#fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; image-rendering: auto; }
#ovStage { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; max-width: 1150px; }
#ovBar { position: relative; z-index: 2; margin-top: 26px; display: flex; gap: 16px; }
#skip { position: absolute; right: 20px; top: 20px; z-index: 3; }

.rays { position: absolute; left: 50%; top: 50%; width: 1400px; height: 1400px; margin: -700px 0 0 -700px; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: repeating-conic-gradient(from 0deg, var(--rc, #fff) 0 6deg, transparent 6deg 18deg); mask: radial-gradient(circle, #000 0, transparent 60%); -webkit-mask: radial-gradient(circle, #000 0, transparent 60%); animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.box { width: 240px; height: 240px; position: relative; z-index: 2; }
.box canvas { width: 100%; height: 100%; }
.box.drop { animation: drop .5s cubic-bezier(.3,1.6,.6,1); }
@keyframes drop { from { transform: translateY(-120vh); } }
.box.jit { animation: jit .1s infinite; }
@keyframes jit { 25% { transform: translate(-3px, 1px) rotate(-2deg); } 75% { transform: translate(3px, -1px) rotate(2deg); } }
.box.jit2 { animation: jit2 .06s infinite; }
@keyframes jit2 { 25% { transform: translate(-6px, 2px) rotate(-4deg) scale(1.04); } 75% { transform: translate(6px, -2px) rotate(4deg) scale(1.06); } }

.flipWrap { perspective: 900px; position: relative; z-index: 2; }
.flipper { position: relative; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.2,.8,.3,1.2); }
.flipper.down { transform: rotateY(180deg); }
.flipper .back { position: absolute; inset: 0; backface-visibility: hidden; transform: rotateY(180deg); background: repeating-linear-gradient(45deg, #2b2252 0 8px, #231d40 8px 16px); box-shadow: 0 0 0 3px var(--bc, #3d3366); display: flex; align-items: center; justify-content: center; font-size: 34px; color: var(--bc, #3d3366); }
.flipper .card { backface-visibility: hidden; }
.big .card { width: 380px; }
.big .card .nm { font-size: 18px; }
.big .card .cap { font-size: 15px; }
.revealCol { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; justify-content: center; }

.banner { position: relative; z-index: 3; font-size: 40px; text-align: center; margin-bottom: 18px; letter-spacing: 4px; text-shadow: 3px 3px 0 #000; animation: slam .45s cubic-bezier(.2,1.8,.4,1); }
.banner small { display: block; font-size: 16px; letter-spacing: 1px; color: var(--dim); }
@keyframes slam { from { transform: scale(3); opacity: 0; } }

.traits { width: 300px; background: var(--panel); padding: 12px; box-shadow: 0 0 0 3px var(--line); }
.traits h4 { margin: 0 0 8px; font-weight: normal; color: var(--gold); }
.traits .tr { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 14px; opacity: 0; transform: translateX(20px); transition: all .2s; }
.traits .tr.in { opacity: 1; transform: none; }
.traits .tr span { color: var(--dim); }
.traits .uniq { margin-top: 10px; color: var(--pink); font-size: 13px; opacity: 0; transition: opacity .3s; }
.traits .uniq.in { opacity: 1; }
.traits .perf { margin-top: 6px; font-size: 13px; color: var(--dim); }
.traits .perf b { color: #fff; }

.ten { display: grid; grid-template-columns: repeat(5, min(190px, 17vw, calc((100vh - 230px) * .62))); gap: 14px; }
@media (max-width: 560px) { .ten { grid-template-columns: repeat(2, 42vw); } #overlay { justify-content: flex-start; padding: 50px 0 20px; } }
.ten .card { width: auto; }
.ten .card .cap, .ten .card .nm { font-size: 12px; }
.ten .slot { position: relative; }
.ten .slot .glowBox { position: absolute; inset: -6px; z-index: -1; transition: box-shadow .3s; }

.cut { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; flex-direction: column; background: #000; }
.cut .t1 { font-size: 64px; letter-spacing: 8px; animation: slam .4s cubic-bezier(.2,1.8,.4,1); }
.cut .t2 { font-size: 20px; margin-top: 12px; color: #fff; opacity: .8; }
.cut.ur { background: repeating-linear-gradient(-45deg, #2a0011 0 30px, #000 30px 60px); animation: stripes .5s linear infinite; }
.cut.ur .t1 { color: var(--pink); text-shadow: 4px 4px 0 #fff; }
.cut.lr { background: #000; }
.cut.lr .t1 { background: linear-gradient(90deg, #ff5a5a, #ffd23f, #5fe3b0, #4fb4ff, #b57bff, #ff5a5a); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: slam .4s, rb 1s linear infinite; }
@keyframes stripes { to { background-position: 85px 0; } }
@keyframes rb { to { background-position: 200% 0; } }
.flash { position: fixed; inset: 0; z-index: 70; background: #fff; pointer-events: none; animation: flash .5s forwards; }
@keyframes flash { to { opacity: 0; } }

#detail { position: fixed; inset: 0; z-index: 80; background: rgba(6,4,14,.85); display: flex; align-items: center; justify-content: center; }
.detailBox { background: var(--bg2); padding: 18px; display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; max-width: 94vw; }
.detailBox .card { width: 360px; }

#dexTiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.dexTier { background: var(--panel); padding: 12px; box-shadow: 0 0 0 3px var(--c); }
.dexTier .samples { display: flex; gap: 6px; margin: 8px 0; }
.dexTier .samples canvas { width: 33%; aspect-ratio: 64/48; background: #000; }
.dexTier p { margin: 4px 0; color: var(--dim); font-size: 13px; }
.dexTier p b { color: #fff; }
.dna { margin-top: 18px; line-height: 1.7; }
.dna p { color: var(--dim); }
#dexTraits { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
#dexTraits div { font-size: 12px; color: var(--dim); }
#dexTraits b { color: var(--gold); display: block; font-weight: normal; font-size: 14px; }

footer { text-align: center; color: var(--dim); font-size: 12px; padding: 18px; }

.rules table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.rules th, .rules td { text-align: left; padding: 5px 8px; border-bottom: 1px dashed var(--line); }
.rules th { color: var(--gold); font-weight: normal; }
.rules td { color: var(--ink); }

.ai { margin-top: 18px; width: 100%; max-width: 768px; }
.aiRow { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
#aiText { white-space: pre-wrap; word-break: break-all; background: #0a0816; padding: 10px; font-size: 12px; color: var(--ink); font-family: inherit; margin: 10px 0 0; }
#tray { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.trayBoxes { display: flex; gap: 4px; flex-wrap: wrap; }
.trayBoxes canvas { width: 40px; height: 40px; animation: jit 1.2s infinite; filter: drop-shadow(0 0 4px #fff); }
.trayBoxes canvas:nth-child(2n) { animation-delay: .3s; }

/* run map */
.runWrap { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .runWrap { grid-template-columns: 1fr; } }
.viewBox { position: relative; box-shadow: 0 0 0 3px var(--line), 0 0 0 6px #0a0816; background: #000; }
#view { width: 100%; aspect-ratio: 384/216; display: block; }
#mini { position: absolute; right: 8px; top: 8px; width: min(200px, 26%); height: auto; aspect-ratio: 168/126; box-shadow: 0 0 0 2px #0a0816, 0 0 0 4px var(--line); opacity: .92; }
#runHud { position: absolute; left: 8px; top: 8px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 190px); }
#runHud span { background: rgba(10,8,22,.78); padding: 3px 8px; font-size: 13px; }
#runHud b { color: #fff; }
#runToast { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%) translateY(20px); background: rgba(10,8,22,.85); padding: 6px 14px; font-size: 15px; opacity: 0; transition: all .25s; white-space: nowrap; pointer-events: none; }
#runToast.on { opacity: 1; transform: translateX(-50%); }
.runCtl { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
#bikeSel { font-family: inherit; background: var(--panel); color: var(--ink); border: 0; padding: 6px 8px; box-shadow: 0 0 0 2px var(--line); max-width: 100%; }
#modeBtn.gold { background: var(--gold); color: #3a2000; }
.keys { color: var(--dim); font-size: 12px; }
.pad { display: none; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 40px); gap: 4px; }
.pad button { background: var(--panel); border: 0; box-shadow: 0 0 0 2px var(--line); font-size: 16px; touch-action: none; }
.pad button:nth-child(1) { grid-column: 2; grid-row: 1; } .pad button:nth-child(2) { grid-column: 1; grid-row: 2; }
.pad button:nth-child(3) { grid-column: 2; grid-row: 2; } .pad button:nth-child(4) { grid-column: 3; grid-row: 2; }
@media (pointer: coarse) { .pad { display: grid; } .keys { display: none; } }
.runSide h3 { margin-top: 12px; }
.runSide h3:first-child { margin-top: 0; }
.oc { background: #1a1533; padding: 7px 8px; margin-bottom: 7px; cursor: pointer; box-shadow: 0 0 0 2px var(--line); font-size: 13px; }
.oc:hover { box-shadow: 0 0 0 2px var(--gold); }
.oc.mine { cursor: default; box-shadow: 0 0 0 2px #7dff6b55; }
.oc.late { box-shadow: 0 0 0 2px #ff5a5a; }
.oc .ot { display: flex; align-items: center; gap: 5px; }
.oc .ot b { color: #fff; padding: 0 3px; font-weight: normal; }
.oc .pay { margin-left: auto; color: var(--gold); }
.oc .od { color: var(--ink); margin-top: 3px; }
.oc .om { color: var(--dim); font-size: 12px; margin-top: 2px; }
.oc .om i { font-style: normal; color: #7dff6b; }
#runLb { margin: 0; padding: 0; list-style: none; font-size: 13px; }
#runLb li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--line); }
#runLb li.me { color: var(--gold); }

.skill { color: #4fc3ff; font-size: 13px; flex-basis: 100%; }
#runHud .bat i { display: inline-block; width: 46px; height: 8px; background: #0a0816; box-shadow: 0 0 0 1px #555; vertical-align: middle; margin: 0 3px; position: relative; }
#runHud .bat u { position: absolute; inset: 0 auto 0 0; }
.pad { grid-template-columns: repeat(4, 44px); }
.pad button:nth-child(5) { grid-column: 4; grid-row: 1 / span 2; background: #4fc3ff; color: #0a0816; }
.tag { font-style: normal; font-size: 11px; padding: 0 3px; margin-right: 4px; color: #0a0816; }
.tag.rush { background: #ff5a5a; } .tag.spill { background: #ff9a3c; } .tag.big { background: #b57bff; }
#runQuests { list-style: none; margin: 0; padding: 0; font-size: 13px; }
#runQuests li { position: relative; display: flex; justify-content: space-between; padding: 4px 6px; margin-bottom: 4px; background: #1a1533; overflow: hidden; }
#runQuests li i { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--gold); }
#runQuests li.ok { color: var(--gold); }
#runQuests li span, #runQuests li b { position: relative; }

#bigMap { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(96%, 800px); height: auto; aspect-ratio: 432/256; box-shadow: 0 0 0 3px var(--line), 0 0 0 6px #0a0816; z-index: 3; }
#bigBtn.gold { background: var(--gold); color: #3a2000; }
#dayEnd { position: absolute; inset: 0; background: rgba(6,4,14,.86); display: flex; align-items: center; justify-content: center; z-index: 4; }
#dayEnd .de { background: var(--bg2); padding: 16px 22px; text-align: center; box-shadow: 0 0 0 3px var(--gold); max-width: 92%; }
#dayEnd h2 { margin: 0 0 10px; font-weight: normal; color: var(--gold); letter-spacing: 3px; }
.deGrid { display: grid; grid-template-columns: auto auto auto auto; gap: 4px 14px; font-size: 14px; text-align: left; }
.deGrid span { color: var(--dim); } .deGrid b { color: #fff; font-weight: normal; }
@media (max-width: 600px) { .deGrid { grid-template-columns: auto auto; } }
#dayEnd .title { font-size: 22px; color: var(--pink); margin: 12px 0; }
.btn.ride { background: #1fb58f; color: #04140f; }

/* market + tuning shop */
.chips button { background: var(--panel); border: 0; padding: 5px 10px; margin: 0 6px 6px 0; box-shadow: 0 0 0 2px var(--line); }
.chips button.on { background: var(--gold); color: #2a1a00; }
.chips button small { opacity: .75; }
#mkSort, .sellRow select, .sellRow input { background: #0d0b1a; color: #fff; border: 0; box-shadow: 0 0 0 2px var(--line); padding: 6px 8px; font: inherit; font-size: 13px; }
.sellRow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.sellRow select { max-width: 100%; min-width: 0; flex: 1 1 220px; }
.sellRow input { width: 120px; }
.mySell { margin: 12px 0; }
.mkItem { display: flex; flex-direction: column; gap: 8px; }
.mkItem .card { width: auto; }
.mkPrice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mkPrice b { color: var(--gold); font-weight: normal; font-size: 15px; }
.mkPrice small { color: var(--dim); font-size: 11px; flex: 1; }
.tuneHead { margin-bottom: 12px; }
.tuneRule { border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.tuneRule td, .tuneRule th { padding: 4px 12px 4px 0; text-align: left; font-weight: normal; }
.tuneRule th { color: var(--dim); }
.tuneBar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.tuneBar #tuneInfo { margin-right: auto; }
.tuneBar b { font-weight: normal; color: var(--gold); }
.card.sel { box-shadow: 0 -4px 0 var(--gold), 0 4px 0 var(--gold), -4px 0 0 var(--gold), 4px 0 0 var(--gold), 0 0 22px var(--gold); transform: translateY(-4px); }
.mergeRing { position: relative; width: 340px; height: 340px; max-width: 90vw; max-height: 90vw; }
.mergeRing .card { position: absolute; left: 50%; top: 50%; width: 120px; margin: -50px 0 0 -60px; transform: rotate(var(--a)) translateY(-120px) rotate(calc(-1 * var(--a))); transition: transform .9s ease-in, opacity .9s ease-in; }
.mergeRing.spin .card { transform: rotate(calc(var(--a) + 360deg)) translateY(0) rotate(calc(-1 * var(--a) - 360deg)) scale(.2); opacity: 0; }
#toast { position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 30px); background: #0d0b1a; color: #fff; padding: 10px 16px; box-shadow: 0 0 0 3px var(--gold); opacity: 0; pointer-events: none; transition: .25s; z-index: 60; max-width: calc(100vw - 32px); font-size: 14px; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

.priceNow { font-size: 13px; color: var(--dim); text-align: center; margin-top: 8px; }
.priceNow b { color: var(--gold); font-weight: normal; }
.freeBox { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; margin: 10px auto 0; padding: 8px 12px; background: var(--panel); box-shadow: 0 0 0 2px var(--line); max-width: 460px; font-size: 14px; }
.freeBox b { color: var(--gold); font-weight: normal; }
.freeBox small { flex-basis: 100%; text-align: center; color: var(--dim); font-size: 11px; }

/* wallet */
#connectBtn { margin-left: 8px; }
#connectBtn.on { background: #1d3a2c; }
.idBadge { font-style: normal; background: var(--gold); color: #2a1a00; padding: 0 4px; margin-right: 6px; font-size: 11px; }
#connectBtn .warn { font-style: normal; color: #ff8080; font-size: 11px; }
.linkBtn { background: none; border: 0; color: var(--gold); text-decoration: underline; padding: 0 4px; font: inherit; font-size: 12px; cursor: pointer; }
#walletModal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 55; padding: 16px; }
.wmBox { position: relative; background: var(--panel); box-shadow: 0 0 0 3px var(--line); padding: 18px; width: 420px; max-width: 100%; max-height: calc(100vh - 32px); overflow: auto; }
.wmBox h3 { margin: 0 0 12px; font-weight: normal; color: var(--gold); }
.wmBox h3 small { color: var(--dim); font-size: 12px; margin-left: 6px; }
.wmBox h4 { margin: 14px 0 6px; font-weight: normal; color: var(--gold); }
.wmClose { position: absolute; right: 10px; top: 8px; background: none; border: 0; color: var(--dim); font-size: 18px; cursor: pointer; }
.wList { display: grid; gap: 8px; }
.wItem { display: flex; align-items: center; gap: 10px; background: #0d0b1a; border: 0; box-shadow: 0 0 0 2px var(--line); padding: 10px 12px; font: inherit; color: #fff; cursor: pointer; text-align: left; }
.wItem:hover { box-shadow: 0 0 0 2px var(--gold); }
.wItem img, .wIco { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.wInfo { border-collapse: collapse; font-size: 14px; margin-bottom: 10px; width: 100%; }
.wInfo td { padding: 4px 8px 4px 0; vertical-align: top; }
.wInfo td:first-child { color: var(--dim); white-space: nowrap; }
.wmBox .ok { color: #6fe39b; font-weight: normal; } .wmBox .no, .freeBox .no { color: #ff8080; font-weight: normal; }
.wmBox .dim { color: var(--dim); }
.wmLookup { border-top: 2px solid var(--line); margin-top: 12px; }
#idInput { flex: 1; min-width: 0; background: #0d0b1a; color: #fff; border: 0; box-shadow: 0 0 0 2px var(--line); padding: 6px 8px; font: inherit; font-size: 13px; }
#idResult { min-height: 1.4em; word-break: break-all; }
@media (max-width: 700px) { .wallet { flex-wrap: wrap; } }

/* agent page */
.agentLogin { max-width: 560px; margin: 20px auto; }
#agentInput { flex: 1; min-width: 0; background: #0d0b1a; color: #fff; border: 0; box-shadow: 0 0 0 2px var(--line); padding: 8px 10px; font: inherit; }
.agentHead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.agentHead code { color: var(--dim); }
.demoNote { margin: 8px 0; }
.agentStats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.agentLast pre { white-space: pre-wrap; word-break: break-all; background: #0d0b1a; padding: 10px; font-size: 12px; max-height: 220px; overflow: auto; margin: 0 0 8px; }
.agentH { font-weight: normal; color: var(--gold); margin: 18px 0 0; }
.agentH small { color: var(--dim); font-size: 12px; }
.agPrice { width: 84px; background: #0d0b1a; color: #fff; border: 0; box-shadow: 0 0 0 2px var(--line); padding: 4px 6px; font: inherit; font-size: 12px; }
.no { color: #ff8080; font-weight: normal; }

/* invites */
.refBar { margin: 10px auto 0; max-width: 560px; padding: 8px 12px; background: #1d3a2c; box-shadow: 0 0 0 2px #2f6b4c; font-size: 13px; }
.refBar b { color: var(--gold); font-weight: normal; }
.panel.invite { margin-top: 12px; }
.inviteLink { flex: 1 1 240px; min-width: 0; background: #0d0b1a; color: #fff; border: 0; box-shadow: 0 0 0 2px var(--line); padding: 6px 8px; font: inherit; font-size: 12px; }

/* gacha feel */
.tapHint { position: relative; z-index: 3; margin-top: 18px; font-size: 18px; color: #fff; letter-spacing: 2px; text-shadow: 2px 2px 0 #000; animation: pulse 1s infinite; pointer-events: none; }
.box.tappable { cursor: pointer; }
.box.hit { animation: hit .18s; }
@keyframes hit { 30% { transform: scale(.9, 1.08) rotate(-3deg); } 70% { transform: scale(1.08, .94) rotate(2deg); } }
.flipper .back.glow { animation: backGlow .9s ease-in-out infinite; }
@keyframes backGlow { 50% { box-shadow: 0 0 0 3px var(--bc), 0 0 22px 4px var(--bc); } }
.flipper .back.glow.g5 { animation: backGlow .9s ease-in-out infinite, hue 1.2s linear infinite; }
@keyframes hue { to { filter: hue-rotate(360deg); } }
.ten .slot { cursor: pointer; }
.ten .slot.jit2b { animation: jit2 .06s infinite; }
.newB, .firstB { position: absolute; top: -8px; font-style: normal; font-size: 11px; padding: 1px 5px; z-index: 4; box-shadow: 2px 2px 0 #000; animation: slam .4s cubic-bezier(.2,1.8,.4,1); }
.newB { right: -6px; background: var(--pink); color: #fff; }
.firstB { left: -6px; background: var(--gold); color: #2a1a00; }
@media (max-width: 700px) {
  nav { flex-wrap: wrap; margin-left: 0; gap: 6px; min-width: 0; max-width: 100%; }
  .tab { padding: 6px 9px; font-size: 13px; }
  header { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  #ovBar { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px; width: calc(100vw - 32px); }
  #ovBar .btn { width: 100%; padding: 10px 8px; font-size: 14px; white-space: nowrap; }
  #overlay { background: rgba(6,4,14,.97); }
}
@media (max-width: 560px) { .flipWrap.big .card { width: calc(100vw - 48px) !important; max-width: 340px; } .revealCol { gap: 16px; } }
@media (max-width: 420px) { .pulls { gap: 12px; } .pulls .btn.big { min-width: 0; flex: 1; padding: 12px 8px; } }

/* more juice */
.pillar { position: fixed; left: 50%; bottom: 0; width: 160px; height: 100vh; margin-left: -80px; z-index: 1; pointer-events: none; transform-origin: bottom; animation: pillarUp .55s cubic-bezier(.2,1.2,.4,1) forwards;
  background: linear-gradient(90deg, transparent, var(--pc) 30%, #fff 50%, var(--pc) 70%, transparent); filter: blur(2px); opacity: .9; mix-blend-mode: screen; }
.pillar.p4 { width: 240px; margin-left: -120px; }
.pillar.p5 { width: 300px; margin-left: -150px; background: linear-gradient(90deg, transparent, #ff5a5a, #ffd23f, #fff, #5aff9b, #5aa0ff, transparent); animation: pillarUp .55s cubic-bezier(.2,1.2,.4,1) forwards, hue 1s linear infinite; }
@keyframes pillarUp { from { transform: scaleY(0) scaleX(.3); opacity: 0; } 60% { opacity: 1; } to { transform: scaleY(1) scaleX(1); } }
#overlay.dim { background: rgba(0,0,0,.99); }
#overlay.dim #ovStage { filter: brightness(.55) saturate(.6); transition: filter .2s; }
#overlay.beat #ovStage { animation: beat .5s; }
@keyframes beat { 10% { transform: scale(1.05); } 25% { transform: scale(1); } 40% { transform: scale(1.03); } 60% { transform: scale(1); } }
.bcast { position: fixed; left: 50%; top: 12px; transform: translate(-50%, -140%); z-index: 70; background: #0d0b1a; padding: 10px 16px; box-shadow: 0 0 0 3px var(--gold), 0 6px 0 rgba(0,0,0,.5); font-size: 14px; max-width: calc(100vw - 32px); animation: bIn .4s cubic-bezier(.2,1.4,.4,1) forwards; }
.bcast.t4 { box-shadow: 0 0 0 3px var(--pink), 0 0 24px var(--pink); } .bcast.t5 { box-shadow: 0 0 0 3px #fff, 0 0 30px #ffd23f; }
.bcast.out { animation: bOut .4s forwards; }
@keyframes bIn { to { transform: translate(-50%, 0); } }
@keyframes bOut { from { transform: translate(-50%, 0); } to { transform: translate(-50%, -160%); } }
.ten .slot.best { z-index: 3; animation: bestPop .5s cubic-bezier(.2,1.6,.4,1) forwards; }
.ten .slot.best::before { content: ''; position: absolute; inset: -18px; z-index: -1; background: conic-gradient(from 0deg, transparent, var(--bc), transparent 30%, var(--bc), transparent 60%, var(--bc), transparent 90%); animation: spin 2.4s linear infinite; filter: blur(6px); opacity: .8; }
@keyframes bestPop { 50% { transform: scale(1.14); } to { transform: scale(1.06); } }
.bestTag { position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); font-style: normal; font-size: 12px; background: var(--bc); color: #120f22; padding: 1px 8px; white-space: nowrap; z-index: 4; box-shadow: 2px 2px 0 #000; }
.btn.share { background: #ff5ab4; box-shadow: 0 -3px 0 #a0246b, 0 6px 0 #a0246b, -3px 0 0 #a0246b, 3px 0 0 #a0246b; }
.shareImg { width: min(360px, 80vw); display: block; margin: 0 auto 10px; image-rendering: pixelated; box-shadow: 0 0 0 3px var(--line); }
a.btn { text-decoration: none; color: inherit; display: inline-block; }
a.btn.gold { color: #3a2000; }
footer a.tg { color: var(--gold); }
#tgBtn { text-decoration: none; display: inline-block; }
.waitBox { display: flex; flex-direction: column; align-items: center; gap: 18px; position: relative; z-index: 2; }
.waitMsg { color: var(--gold); font-size: 18px; text-align: center; padding: 0 16px; animation: waitPulse 1.2s ease-in-out infinite; }
@keyframes waitPulse { 50% { opacity: .45; } }
#garageSum .btn { margin-left: 6px; }
/* v2: genesis badge + dispatch/rent page */
.genB { font-style: normal; font-size: 10px; background: var(--gold); color: #2a1a00; padding: 0 4px; margin-right: 4px; box-shadow: 1px 1px 0 #000; }
.rideTop { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 720px) { .rideTop { grid-template-columns: 1fr; } }
.rideStats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.rideStats div { background: rgba(0,0,0,.25); padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rideStats span { font-size: 12px; opacity: .7; }
.rideStats b { font-weight: normal; color: var(--gold); overflow-wrap: anywhere; }
#ride .mkPrice input.agPrice { width: 70px; }

/* ================= game skin ================= */
body { padding-bottom: 92px; background:
  linear-gradient(180deg, rgba(10,8,22,0) 55%, rgba(10,8,22,.9) 100%),
  radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 72% 9%, #ffd23f 50%, transparent 51%),
  radial-gradient(1px 1px at 33% 30%, #b57bff 50%, transparent 51%), radial-gradient(1px 1px at 88% 26%, #fff 50%, transparent 51%),
  radial-gradient(1px 1px at 52% 14%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 6% 40%, #4fc3ff 50%, transparent 51%),
  radial-gradient(ellipse at 50% -10%, #3d2a7a 0, transparent 65%), #0d0a1c; background-attachment: fixed; }
body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 40; background: repeating-linear-gradient(0deg, rgba(0,0,0,.13) 0 1px, transparent 1px 3px); }

/* HUD */
header.hud { position: sticky; top: 0; z-index: 30; margin: 0; padding: 6px 14px; gap: 12px; flex-wrap: nowrap; background: linear-gradient(180deg, #2b2154, #1a1436); box-shadow: 0 3px 0 #0a0816, 0 6px 0 rgba(0,0,0,.35); }
.hud .logo canvas { width: 48px; height: 36px; }
.hud .logo b { font-size: 20px; }
.hud .logo small { font-size: 11px; }
.hud .wallet { margin-left: auto; gap: 8px; flex-wrap: nowrap; }
.hud .wallet > span { display: none; }
.hud .wallet b { background: #0d0a1c; padding: 4px 10px 4px 26px; position: relative; box-shadow: 0 0 0 2px #ffd23f55; font-size: 15px; }
.hud .wallet b::before { content: '◆'; position: absolute; left: 8px; color: var(--gold); }
#marquee { display: flex; height: 24px; background: #070512; border: 0; box-shadow: 0 2px 0 var(--line); }
#marquee .mqTag { flex: none; padding: 0 8px; background: var(--pink); color: #fff; line-height: 24px; font-size: 12px; }
#marquee #marqueeInner { line-height: 24px; }
main { padding: 16px 16px 10px; }

/* bottom dock: the game's main menu */
nav.dock { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 35; display: flex; gap: 6px; margin: 0; padding: 8px 10px; background: linear-gradient(180deg, #2b2154, #15102c);
  box-shadow: 0 -3px 0 #5a4b9c, 0 3px 0 #0a0816, -3px 0 0 #5a4b9c, 3px 0 0 #5a4b9c, 0 8px 0 rgba(0,0,0,.45); max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; }
nav.dock::-webkit-scrollbar { display: none; }
.dock .tab { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 72px; height: 60px; padding: 4px 8px; font-size: 12px; background: #1d1740; color: var(--dim);
  box-shadow: 0 -2px 0 #3d3366, 0 4px 0 #0a0816, -2px 0 0 #3d3366, 2px 0 0 #3d3366; transition: transform .08s; white-space: nowrap; }
.dock .tab::before { content: attr(data-ic); font-size: 24px; line-height: 26px; filter: saturate(.8); }
.dock .tab:hover { color: #fff; transform: translateY(-2px); }
.dock .tab.on { background: linear-gradient(180deg, #ffe066, #ffb52e); color: #3a2000; transform: translateY(-6px); box-shadow: 0 -2px 0 #fff3b0, 0 6px 0 #a05a00, -2px 0 0 #a05a00, 2px 0 0 #a05a00, 0 0 18px #ffd23f88; }
.dock .tab.on::before { filter: none; }
.dock .tab i { position: absolute; top: -6px; right: -4px; margin: 0; font-size: 11px; padding: 1px 5px; box-shadow: 0 0 0 2px #0a0816; }
#agentTab { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }

/* windows */
.panel { background: linear-gradient(180deg, #2a2250, #1f1940); box-shadow: 0 -3px 0 #5a4b9c, 0 3px 0 #0a0816, -3px 0 0 #4a3d86, 3px 0 0 #4a3d86, 0 7px 0 rgba(0,0,0,.35); }
.panel h3 { margin: -12px -12px 10px; padding: 7px 12px; background: linear-gradient(90deg, #3a2d74, transparent); border-bottom: 2px solid #0a0816; text-shadow: 2px 2px 0 #000; }
.page.on { animation: pageIn .25s cubic-bezier(.2,1.4,.4,1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* folded explanations */
details.tip { margin-top: 8px; }
details.tip summary { list-style: none; cursor: pointer; display: inline-block; font-size: 12px; color: var(--dim); padding: 2px 8px; background: #120e26; box-shadow: 0 0 0 2px #3d3366; }
details.tip summary::-webkit-details-marker { display: none; }
details.tip[open] summary { color: var(--gold); }
details.tip .hint { margin-top: 8px; }

/* shop = main game screen */
#shop.on { grid-template-columns: 230px minmax(0, 1fr) 240px; gap: 16px; }
#shopCanvas { max-width: 860px; box-shadow: 0 0 0 4px #0a0816, 0 0 0 7px #5a4b9c, 0 0 0 10px #0a0816, 0 0 40px #6a4cff66; }
.pulls { margin-top: 18px; }
.btn.big { min-width: 190px; padding: 14px 20px; }
.btn.big span { font-size: 28px; text-shadow: 2px 2px 0 rgba(0,0,0,.35); }
.priceNow { margin-top: 12px; padding: 6px 14px; background: #0d0a1c; box-shadow: 0 0 0 2px #ffd23f55; color: var(--gold); }
.freeBox { margin-top: 14px; background: linear-gradient(90deg, #3a2410, #2a1d4a); box-shadow: 0 0 0 3px #ffb52e88, 0 6px 0 rgba(0,0,0,.35); }
.actRow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; max-width: 860px; margin-top: 16px; }
.actRow .panel { margin: 0 !important; width: auto !important; }
.odds .oddsRow .bar { height: 10px; box-shadow: 0 0 0 2px #0a0816; }
.feed { position: sticky; top: 80px; }
.feed ul { max-height: 60vh; }

footer { padding: 10px 18px 4px; opacity: .7; }

@media (max-width: 1000px) {
  #shop.on { grid-template-columns: 1fr; }
  .odds { order: 2; } .feed { order: 3; position: static; }
}
@media (max-width: 700px) {
  header.hud { padding: 5px 8px; gap: 8px; }
  .hud .logo small { display: none; }
  .hud .logo b { font-size: 16px; }
  .hud .wallet #tgBtn { display: none; }
  .actRow { grid-template-columns: 1fr; }
  nav.dock { left: 0; right: 0; bottom: 0; transform: none; max-width: none; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); gap: 2px; justify-content: space-between; }
  .dock .tab { min-width: 0; flex: 1; height: 54px; padding: 2px; font-size: 11px; }
  .dock .tab::before { font-size: 20px; line-height: 22px; }
  .dock .tab.on { transform: translateY(-4px); }
  #agentTab { font-size: 0; } #agentTab::after { content: 'Agent'; font-size: 11px; }
  body { padding-bottom: 80px; }
}
.hud .logo { flex: none; white-space: nowrap; }
#freeNote { display: block; margin-top: 4px; }
@media (max-width: 700px) {
  .hud .logo canvas { width: 40px; height: 30px; }
  .hud .wallet { gap: 5px; } .hud .wallet b { font-size: 13px; padding: 3px 6px 3px 20px; } .hud .wallet b::before { left: 5px; }
  .hud .wallet .btn.small { padding: 5px 8px; font-size: 12px; white-space: nowrap; }
  .hud .wallet { font-size: 0; } .hud .wallet > * { font-size: 13px; }
}
h3.agentH { display: inline-block; margin: 22px 0 4px; padding: 6px 16px 6px 12px; font-weight: normal; color: var(--gold); background: linear-gradient(90deg, #3a2d74, #2a2250); box-shadow: 0 -2px 0 #5a4b9c, 0 3px 0 #0a0816, -2px 0 0 #5a4b9c, 2px 0 0 #5a4b9c; clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 50%, 100% 100%, 0 100%); padding-right: 26px; text-shadow: 2px 2px 0 #000; }
h3.agentH small { display: block; color: var(--dim); font-size: 11px; margin-top: 2px; text-shadow: none; }
.empty { margin-top: 30px; font-size: 14px; padding: 18px; background: #120e26; box-shadow: 0 0 0 2px #3d3366; }
