* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0b18; font-family: 'Segoe UI', system-ui, sans-serif; color: #f3efff; user-select: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
b { font-weight: 700; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#money { position: absolute; top: 14px; left: 16px; text-shadow: 0 2px 6px #000a; }
#money .coins { font-size: 34px; font-weight: 800; color: #ffd54f; display: flex; gap: 8px; align-items: center; }
#money .rate { font-size: 15px; color: #e8dcff; opacity: .9; margin-left: 4px; }
#money .sub { margin-top: 6px; display: flex; gap: 16px; font-size: 17px; }
#mom { position: absolute; left: 16px; top: 132px; width: 230px; text-shadow: 0 1px 4px #000a; }
#mom .lbl { font-size: 12px; letter-spacing: 1px; color: #9fe8ff; }
#mom .bar { height: 10px; background: #ffffff22; border-radius: 6px; overflow: hidden; margin-top: 3px; }
#momfill { height: 100%; width: 0; background: linear-gradient(90deg, #36d1ff, #a66bff); transition: width .15s; }
#mom .tip { font-size: 11px; opacity: .55; margin-top: 3px; }
#frenzy { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); font-size: 24px; font-weight: 800; color: #fff; background: linear-gradient(90deg, #ff4fd8, #7c4dff); padding: 6px 18px; border-radius: 12px; box-shadow: 0 0 24px #ff4fd8aa; animation: pulse 0.8s infinite alternate; }
@keyframes pulse { to { transform: translateX(-50%) scale(1.06); } }
#buffs { position: absolute; top: 14px; right: 16px; margin-top: 22px; text-align: right; font-size: 15px; font-weight: 700; color: #ffe27a; background: #2a1650d9; border: 1px solid #ffd54f66; padding: 6px 12px; border-radius: 10px; line-height: 1.5; }
#toasts { margin-top: 70px; }
#runhud { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); text-align: center; text-shadow: 0 2px 6px #000c; }
#runname { font-size: 14px; letter-spacing: 2px; opacity: .8; }
#runtime { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; }
#runtime.ready { color: #8effa8; }
#runtime.void { color: #ff7b7b; }
#runtime.done { color: #ffd54f; }
#runsplits { font-size: 13px; opacity: .85; font-variant-numeric: tabular-nums; }
#cross { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #fff; box-shadow: 0 0 3px #000; }
#speed { position: absolute; left: 50%; top: calc(50% + 70px); transform: translateX(-50%); font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: 0 2px 4px #000; }
#prompt { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); background: #120e24d9; border: 1px solid #ffffff30; padding: 8px 16px; border-radius: 10px; font-size: 17px; white-space: nowrap; }
#prompt kbd { background: #ffd54f; color: #222; border-radius: 4px; padding: 0 6px; font-weight: 800; margin-right: 6px; }
#help { position: absolute; right: 14px; top: 12px; font-size: 12px; opacity: .55; text-align: right; max-width: 520px; }
#toasts { position: absolute; right: 16px; top: 44px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.toast { background: #1b1534e8; border-left: 4px solid #ffd54f; padding: 7px 12px; border-radius: 8px; font-size: 15px; animation: tin .25s; max-width: 420px; }
.toast.err { border-color: #ff6b6b; }
.toast.good { border-color: #4cffa0; }
@keyframes tin { from { transform: translateX(30px); opacity: 0; } }
#chat { position: absolute; left: 16px; bottom: 16px; width: 440px; pointer-events: none; }
#chatlog { display: flex; flex-direction: column; gap: 2px; font-size: 14px; text-shadow: 0 1px 3px #000; max-height: 220px; overflow: hidden; justify-content: flex-end; }
#chatlog div { background: #0008; padding: 2px 8px; border-radius: 6px; width: fit-content; max-width: 440px; transition: opacity 1s; }
#chatlog div.old { opacity: 0; }
#chatlog .sys { color: #ffd54f; }
#chatlog .nm { color: #9fe8ff; font-weight: 700; }
#chatin { pointer-events: auto; width: 100%; margin-top: 6px; background: #000c; border: 1px solid #ffffff40; color: #fff; padding: 7px 10px; border-radius: 8px; font-size: 15px; outline: none; }

#clickplay { position: fixed; inset: 0; display: grid; place-items: center; background: #0006; cursor: pointer; }
#clickplay .box { text-align: center; background: #1a1430ee; padding: 18px 36px; border-radius: 16px; border: 1px solid #ffffff22; }
#clickplay h2 { margin: 0 0 4px; }
#clickplay p { margin: 0; opacity: .7; }

.panel { background: #171229f2; border: 1px solid #ffffff22; border-radius: 16px; box-shadow: 0 20px 60px #000a; }
#menu { position: fixed; inset: 0; display: grid; place-items: center; background: #0007; }
#menu .panel { width: min(1060px, 94vw); height: min(760px, 90vh); display: flex; flex-direction: column; }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; flex-wrap: wrap; }
.tabs button { background: #ffffff10; border: 0; color: #ddd; padding: 9px 16px; border-radius: 10px 10px 0 0; font-size: 15px; cursor: pointer; }
.tabs button.on { background: #2b2350; color: #fff; font-weight: 700; }
.tabs button .dot { display: inline-block; width: 8px; height: 8px; background: #4cffa0; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.body { flex: 1; overflow-y: auto; background: #2b2350; margin: 0 12px; border-radius: 0 10px 10px 10px; padding: 14px; }
.foot { padding: 8px 14px; font-size: 12px; opacity: .5; }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; background: #ffffff0a; margin-bottom: 7px; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 700; font-size: 16px; }
.row .d { font-size: 13px; opacity: .75; }
.row.locked { opacity: .45; }
.row.owned { opacity: .6; }
.swatch { width: 14px; height: 38px; border-radius: 4px; }
button.buy { background: #ffd54f; color: #241a00; border: 0; border-radius: 8px; padding: 8px 12px; font-weight: 800; cursor: pointer; min-width: 92px; font-size: 14px; }
button.buy.t { background: #7cf0ff; color: #002a33; }
button.buy.c { background: #c49bff; color: #1d0040; }
button.buy:disabled { background: #ffffff25; color: #ffffff70; cursor: default; }
button.buy.big { font-size: 18px; padding: 12px 22px; }
h3 { margin: 14px 0 8px; font-size: 15px; letter-spacing: 1px; text-transform: uppercase; opacity: .7; }
h3:first-child { margin-top: 0; }
.note { font-size: 13px; opacity: .7; margin: 4px 0 10px; line-height: 1.45; }
.tree { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tree .col { display: flex; flex-direction: column; gap: 8px; }
.tree .node { background: #ffffff0d; border: 1px solid #ffffff1a; border-radius: 10px; padding: 9px; }
.tree .node.have { border-color: #4cffa0; background: #4cffa012; }
.tree .node.lock { opacity: .45; }
.tree .node .t { font-weight: 700; }
.tree .node .d { font-size: 12px; opacity: .8; margin: 3px 0 6px; }
.tree .bh { text-align: center; font-weight: 800; letter-spacing: 1px; opacity: .8; }
.kv { display: grid; grid-template-columns: 220px 1fr; gap: 4px 12px; font-size: 14px; }
.kv div:nth-child(odd) { opacity: .65; }
.setting { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.setting label { width: 190px; }
.setting input[type=range] { width: 260px; }
input.txt { background: #0006; border: 1px solid #ffffff40; color: #fff; padding: 7px 10px; border-radius: 8px; font-size: 14px; }
.medal { font-size: 18px; }
code.rc { background: #0008; padding: 4px 8px; border-radius: 6px; user-select: all; word-break: break-all; }

#lb { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; }
#lb .panel { width: min(900px, 94vw); max-height: 80vh; overflow: auto; padding: 16px 20px; }
#lb h2 { margin: 0 0 10px; }
#lb table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
#lb th { text-align: left; opacity: .6; font-weight: 600; padding: 4px 6px; }
#lb td { padding: 5px 6px; border-top: 1px solid #ffffff14; }
#lb .on { color: #4cffa0; }

#login, #winscreen { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #3a2a6a, #0d0b18); }
#winscreen { background: #000a; }
#login .panel, #winscreen .panel { padding: 28px 34px; width: min(440px, 92vw); text-align: center; }
#login h1 { margin: 0; font-size: 42px; letter-spacing: 3px; background: linear-gradient(90deg, #ffd54f, #ff4fd8, #7cf0ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
#login .tag { opacity: .7; margin: 4px 0 18px; }
#login input, #login button, #winscreen button { width: 100%; font-size: 18px; padding: 10px 12px; border-radius: 10px; border: 1px solid #ffffff30; margin-top: 8px; }
#login input { background: #0006; color: #fff; outline: none; }
#login button, #winscreen button { background: #ffd54f; color: #241a00; font-weight: 800; border: 0; cursor: pointer; }
#login details { margin-top: 14px; text-align: left; font-size: 14px; opacity: .85; }
#loginerr { color: #ff8080; margin-top: 10px; min-height: 20px; }
#login .small { font-size: 12px; opacity: .55; }
