:root {
  --deep: #061a12; --deep2: #0b2a1f; --ink: #0b3b26;
  --mint: #2ee88a; --mint2: #18c06c; --emerald: #0f8f55; --aqua: #3fd0ff; --water: #2a8cff;
  --gold: #ffd34d; --rare: #5aa2ff; --red: #ff6b6b; --text: #eafff4; --muted: #8fb8a6;
  --glass: rgba(14, 10, 36, 0.62); --glass-line: rgba(180, 160, 255, 0.22);
  --display: "Outfit", "Segoe UI", sans-serif; --head: "Bungee", "Outfit", sans-serif; --pink: #ff4fa8; --cyan: #4fd8ff; --violet: #b98cff; --px: "Press Start 2P", monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #120d2e; color: var(--text); font-family: var(--display); font-weight: 600; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

#game { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; image-rendering: pixelated; touch-action: none; transition: filter 1s ease; }
body:not(.playing) #game { filter: saturate(1.15) brightness(0.75); }

/* ================= MAIN MENU (neon city) ================= */
#title { position: fixed; inset: 0; z-index: 20; display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; justify-items: center; gap: 18px; overflow-y: auto; overflow-x: hidden;
  padding: max(24px, env(safe-area-inset-top)) clamp(16px, 4vw, 56px) max(20px, env(safe-area-inset-bottom)); transition: opacity .8s ease, transform .9s ease; }
#title.leaving { opacity: 0; transform: scale(1.04); pointer-events: none; }
.menu-shade { position: fixed; inset: 0; pointer-events: none; background:
  radial-gradient(ellipse at 20% 40%, rgba(255, 79, 168, .16), transparent 50%),
  radial-gradient(ellipse at 85% 30%, rgba(79, 216, 255, .14), transparent 45%),
  linear-gradient(90deg, rgba(10, 6, 28, .88) 0%, rgba(10, 6, 28, .55) 45%, rgba(10, 6, 28, .25) 100%),
  linear-gradient(180deg, transparent 60%, rgba(10, 6, 28, .85)); }
.menu-cubes { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.menu-cubes i { position: absolute; bottom: -20px; width: calc(var(--s) * .35); height: calc(var(--s) * .35); border-radius: 50%; background: var(--c);
  box-shadow: 0 0 12px var(--c), 0 0 26px var(--c); opacity: .7; animation: spark var(--d) linear infinite; animation-delay: var(--dl); }
@keyframes spark { from { transform: translateY(0); opacity: 0; } 10% { opacity: .8; } to { transform: translateY(-110vh); opacity: 0; } }

.menu { position: relative; width: min(1120px, 100%); display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .85fr); gap: clamp(18px, 4vw, 56px); align-items: center; min-width: 0; }
.hero { display: flex; flex-direction: column; gap: 14px; min-width: 0; animation: rise .8s both; }
.brand-row { display: flex; align-items: center; gap: 12px; }
.pill-emblem { position: relative; width: 52px; height: 52px; border-radius: 16px; flex: none; background: linear-gradient(145deg, #1d1650, #0c0824);
  border: 2px solid rgba(46, 232, 138, .6); box-shadow: 0 0 22px rgba(46, 232, 138, .45), inset 0 0 18px rgba(79, 216, 255, .18); }
.pill-emblem::after { content: ""; position: absolute; left: 50%; top: 50%; width: 32px; height: 14px; margin: -7px 0 0 -16px; border-radius: 14px; transform: rotate(-35deg);
  background: linear-gradient(90deg, var(--mint) 50%, #f4fbf7 50%); box-shadow: 0 0 14px rgba(46, 232, 138, .8); }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; font: 700 13px var(--display); letter-spacing: .5px; text-transform: uppercase;
  color: #fff; background: rgba(255, 79, 168, .14); border: 1px solid rgba(255, 79, 168, .5); }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 10px var(--pink); animation: blink 1.2s infinite; }
.wordmark { margin: 0; font: 400 clamp(52px, 9.5vw, 118px)/.9 var(--head); letter-spacing: 1px; color: #f4fbff;
  text-shadow: 0 0 10px rgba(79, 216, 255, .55), 0 0 34px rgba(79, 216, 255, .35), 0 6px 0 #2a1f6a; animation: flicker 6s infinite; }
.wordmark span { color: var(--mint); text-shadow: 0 0 12px rgba(46, 232, 138, .75), 0 0 40px rgba(46, 232, 138, .45), 0 6px 0 #0b5a36; }
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: .7; } 94% { opacity: 1; } 96% { opacity: .82; } }
.tagline { margin: 0; max-width: 520px; font: 600 clamp(16px, 2vw, 20px)/1.4 var(--display); color: #d8d2ff; }
.tagline b { color: #fff; font-weight: 800; }

.menu-panel { width: min(440px, 100%); padding: 16px; border-radius: 22px; margin-top: 6px;
  background: rgba(16, 11, 42, .72); border: 1px solid var(--glass-line); box-shadow: 0 24px 60px rgba(0, 0, 0, .5); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.mscreen { display: flex; flex-direction: column; gap: 12px; animation: fade .25s; }
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mtitle { margin: 0; font: 400 20px var(--head); color: #fff; text-align: center; }
#login-name { font: 700 20px var(--display); padding: 14px 16px; border-radius: 14px; outline: none; color: #fff; text-align: center;
  background: rgba(0, 0, 0, .35); border: 2px solid rgba(180, 160, 255, .35); }
#login-name::placeholder { color: #8f88b8; }
#login-name:focus { border-color: var(--mint); box-shadow: 0 0 0 4px rgba(46, 232, 138, .25); }
.err { color: #ffb3c8; font-size: 14px; margin: 0; text-align: center; }
.err:empty { display: none; }
.link-btn { background: none; border: 0; color: #a69fd6; font: 600 15px var(--display); padding: 4px; cursor: pointer; }
.link-btn:hover { color: var(--mint); }
.back { align-self: center; }

/* sleek neon buttons */
.vbtn { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px 18px; border-radius: 14px; overflow: hidden;
  font: 700 17px var(--display); letter-spacing: .4px; color: #fff; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06);
  transition: transform .12s, box-shadow .2s, background .2s, border-color .2s; }
.vbtn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .3); }
.vbtn:active { transform: translateY(1px) scale(.99); }
.vbtn:disabled { opacity: .65; }
.vbtn-play { font: 400 28px var(--head); letter-spacing: 1.5px; padding: 16px; color: #062a1a; border: 0;
  background: linear-gradient(135deg, #7dffbe, var(--mint) 45%, #12c97a); box-shadow: 0 0 0 1px rgba(255, 255, 255, .25) inset, 0 10px 30px rgba(46, 232, 138, .45), 0 0 50px rgba(46, 232, 138, .25); }
.vbtn-play:hover { background: linear-gradient(135deg, #9dffcf, #44f39a 45%, #18d685); box-shadow: 0 0 0 1px rgba(255, 255, 255, .3) inset, 0 14px 40px rgba(46, 232, 138, .55), 0 0 60px rgba(46, 232, 138, .35); }
.vbtn-play::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 45%, transparent 60%) -200% 0 / 200% 100% no-repeat; animation: sweep 3s ease-in-out infinite; }
@keyframes sweep { 0%, 45% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.vbtn-play .pill3d { width: 34px; height: 16px; border-color: #062a1a; }
.vbtn-wood { border-color: rgba(255, 79, 168, .45); box-shadow: inset 0 0 18px rgba(255, 79, 168, .12); }
.vbtn-wood:hover { border-color: var(--pink); box-shadow: 0 0 22px rgba(255, 79, 168, .35), inset 0 0 18px rgba(255, 79, 168, .18); }
.vbtn-stone { border-color: rgba(79, 216, 255, .45); box-shadow: inset 0 0 18px rgba(79, 216, 255, .12); }
.vbtn-stone:hover { border-color: var(--cyan); box-shadow: 0 0 22px rgba(79, 216, 255, .35), inset 0 0 18px rgba(79, 216, 255, .18); }
.vbtn-dark { font-size: 15px; padding: 12px; background: rgba(0, 0, 0, .3); }
.vbtn.loading .vbtn-label { opacity: .6; }

.who-chip { display: flex; align-items: center; gap: 8px; justify-content: center; font: 600 15px var(--display); color: #cfc8f5; }
.who-chip b { font-weight: 800; color: #fff; }
.avatar.sm { width: 28px; height: 28px; border-radius: 9px; font-size: 14px; }

.side-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: 22px; animation: rise .8s .15s both;
  background: rgba(16, 11, 42, .66); border: 1px solid var(--glass-line); box-shadow: 0 24px 60px rgba(0, 0, 0, .45); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.side-card h3 { margin: 0; font: 400 16px var(--head); color: #fff; letter-spacing: .5px; }
.district-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.district-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, .04); border-left: 3px solid; }
.district-list b { font-weight: 800; font-size: 16px; color: #fff; }
.district-list span { font-size: 13px; color: #a69fd6; }
.d-town { border-color: var(--mint) !important; } .d-forest { border-color: #ff7a55 !important; } .d-summit { border-color: var(--violet) !important; }
.reward-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.reward-strip div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px; border-radius: 12px; background: rgba(0, 0, 0, .28); font: 600 12px var(--display); color: #a69fd6; }
.reward-strip b { font-weight: 800; color: var(--gold); font-size: 14px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot.common { background: #e6e1ff; } .dot.rare { background: var(--rare); box-shadow: 0 0 8px var(--rare); }
.dot.legendary { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.x-link { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 14px; border-radius: 14px; text-decoration: none;
  font: 700 15px var(--display); color: #fff; background: #000; border: 1px solid rgba(255, 255, 255, .2); transition: transform .12s, border-color .2s; }
.x-link svg { width: 17px; height: 17px; fill: currentColor; }
.x-link b { color: var(--mint); }
.x-link:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .5); }
.menu-foot { margin: 0; font: 600 13px var(--display); color: #8f88b8; text-align: center; animation: rise .8s .3s both; }
#sound-hint { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 21;
  font: 600 14px var(--display); color: #e6e1ff; padding: 8px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line); transition: opacity .5s; }
#sound-hint.gone { opacity: 0; pointer-events: none; }
@keyframes pop { from { opacity: 0; transform: scale(.85) translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }
@keyframes blink { 50% { opacity: .3; } }
@media (max-width: 860px) {
  #title { align-content: start; }
  .menu { grid-template-columns: minmax(0, 1fr); }
  .hero { align-items: center; text-align: center; }
  .menu-panel { width: 100%; }
  .tagline { max-width: none; }
}

/* ================= PAUSE MENU ================= */
#pause { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 16px; background: rgba(2, 12, 8, .55); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); animation: fade .2s; }
.pause-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 22px 18px 16px; border-radius: 24px; text-align: center;
  background: linear-gradient(180deg, rgba(14, 58, 43, .92), rgba(6, 28, 20, .95)); border: 1px solid var(--glass-line); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: pop2 .3s cubic-bezier(.2, 1.3, .4, 1); }
.pause-logo { width: 84px; height: 84px; border-radius: 20px; margin: -60px auto 0; border: 3px solid rgba(160, 255, 210, .6); box-shadow: 0 0 0 4px rgba(4, 18, 12, .8), 0 0 30px rgba(46, 232, 138, .45); }
.pause-card h2 { margin: 0; font: 400 30px var(--display); color: #fff; text-shadow: 0 3px 0 var(--ink); letter-spacing: 1px; }
.pause-keys { margin: 2px 0 0; font: 12px var(--display); color: var(--muted); line-height: 1.5; }

/* how to play + settings */
.how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.how-step { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .05); display: flex; flex-direction: column; gap: 4px; }
.how-step b { font-weight: 400; font-size: 18px; color: var(--mint); }
.how-step p { margin: 0; font-size: 14px; color: #cfeee0; line-height: 1.35; }
.how-ico { font-size: 26px; height: 30px; display: flex; align-items: center; }
.how-table { display: grid; gap: 6px; }
.how-table div { display: grid; grid-template-columns: 14px 90px 100px 1fr; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .05); font-size: 15px; }
.how-table b { font-weight: 400; color: var(--gold); } .how-table span { color: var(--muted); font-size: 13px; }
.how-keys { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 14px; color: #cfeee0; }
kbd { display: inline-block; min-width: 24px; padding: 2px 6px; margin-right: 3px; border-radius: 6px; text-align: center; font: 12px var(--px); color: var(--ink); background: #effff7; box-shadow: 0 3px 0 #8fb8a6; }
.set-row { display: grid; grid-template-columns: 1fr 1.3fr 48px; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid rgba(255, 255, 255, .06); font-size: 16px; }
.set-row b { font-weight: 400; color: var(--gold); text-align: right; }
.set-row.check { grid-template-columns: 1fr auto; }
.set-row input[type=range] { accent-color: var(--mint); width: 100%; }
.set-row input[type=checkbox] { accent-color: var(--mint); width: 22px; height: 22px; }
@media (max-width: 560px) { .how-steps { grid-template-columns: 1fr; } .how-table div { grid-template-columns: 14px 80px 1fr; } .how-table span { display: none; } }

/* ================= HUD ================= */
#hud { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap;
  padding: max(10px, env(safe-area-inset-top)) 12px 0; pointer-events: none; opacity: 0; transform: translateY(-20px); transition: .6s .3s; }
body.playing #hud { opacity: 1; transform: none; }
#hud > * { pointer-events: auto; }
.glass { background: var(--glass); border: 1px solid var(--glass-line); border-radius: 16px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.player { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; color: #04281a;
  background: linear-gradient(180deg, #7dffbe, var(--mint2)); border: 2px solid var(--ink); }
.who { display: flex; flex-direction: column; line-height: 1.15; }
.who b { font-weight: 400; font-size: 17px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: 12px; color: var(--muted); }
.bag { flex: 1; min-width: 170px; max-width: 360px; padding: 8px 14px; }
.bag-top { display: flex; align-items: baseline; gap: 6px; }
.bag-top b { font-weight: 400; font-size: 20px; color: var(--gold); text-shadow: 0 0 12px rgba(255, 211, 77, .35); }
.bag-top span:last-child { font-size: 13px; color: var(--muted); }
.pill-ico { width: 16px; height: 9px; border-radius: 9px; align-self: center; background: linear-gradient(90deg, var(--mint) 50%, #fff 50%); border: 2px solid var(--ink); transform: rotate(-30deg); }
.bar { height: 8px; border-radius: 8px; background: rgba(0, 0, 0, .45); overflow: hidden; margin: 5px 0 3px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.bar i { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--emerald), var(--mint), var(--aqua)); transition: width .6s cubic-bezier(.2, 1, .3, 1); }
#hud.full .bar i, .bar.big i[style*="100%"] { background: linear-gradient(90deg, #ffb800, var(--gold), #fff3b0); animation: pulse .9s infinite; }
.bag small { font-size: 11px; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 4px; padding: 5px; margin-left: auto; }
.actions button { display: flex; align-items: center; gap: 6px; height: 40px; min-width: 40px; padding: 0 10px; border-radius: 12px; border: 0;
  background: transparent; color: var(--text); font-size: 15px; transition: background .2s; }
.actions button:hover { background: rgba(46, 232, 138, .14); }
.actions svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#btn-bag { background: rgba(46, 232, 138, .14); }
#hud.full #btn-bag { background: var(--gold); color: #3a2a00; animation: pulse .9s infinite; }
#btn-sound .off-i, #btn-sound.off .on-i { display: none; }
#btn-sound.off .off-i { display: block; color: var(--muted); }

#toasts { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 12; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { font-size: 18px; padding: 8px 18px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(8px);
  animation: toast 3.2s ease forwards; color: var(--gold); }
.toast b { font-weight: 400; color: #fff; }
.toast.rare { border-color: var(--rare); box-shadow: 0 0 22px rgba(90, 162, 255, .5); }
.toast.legendary { border-color: var(--gold); box-shadow: 0 0 30px rgba(255, 211, 77, .65); }
@keyframes toast { 0% { opacity: 0; transform: translateY(-10px) scale(.8); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-14px); } }

/* ================= MODALS ================= */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(2, 10, 7, .6); backdrop-filter: blur(4px); animation: fade .25s; }
.panel { width: min(560px, 100%); max-height: 86vh; overflow: auto; padding: 18px; border-radius: 22px; color: var(--text);
  background: linear-gradient(180deg, #0f3b2c, #082419); border: 1px solid var(--glass-line); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: pop2 .3s cubic-bezier(.2, 1.3, .4, 1); }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-weight: 400; font-size: 26px; flex: 1; color: var(--mint); text-shadow: 0 2px 0 var(--ink); }
.count { font-size: 14px; color: var(--muted); }
.panel-head button { width: 36px; height: 36px; border-radius: 12px; border: 1px solid var(--glass-line); background: rgba(255, 255, 255, .05); color: var(--text); font-size: 14px; }
.panel h3 { font-weight: 400; font-size: 16px; color: var(--muted); margin: 18px 0 8px; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.dex-card { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .06); }
.dex-card canvas { width: 52px; height: 52px; image-rendering: pixelated; flex: none; background: radial-gradient(circle, rgba(46, 232, 138, .2), transparent 70%); border-radius: 10px; }
.dex-card div { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.dex-card b { font-weight: 400; font-size: 16px; }
.dex-card span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dex-card em { font-style: normal; font-size: 12px; color: var(--gold); }
.dex-card.unseen canvas { filter: brightness(0) drop-shadow(0 0 1px rgba(160, 255, 210, .5)); opacity: .55; }
.dex-card.unseen em { color: var(--muted); }
.wbal { display: flex; align-items: baseline; gap: 10px; }
.wbal b { font-weight: 400; font-size: 42px; color: var(--gold); text-shadow: 0 0 20px rgba(255, 211, 77, .35); }
.wbal span { color: var(--muted); }
.bar.big { height: 12px; margin: 6px 0 14px; }
.holdings { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.hold { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); font-size: 15px; }
.hold b { font-weight: 400; color: var(--gold); }
.muted { color: var(--muted); font-size: 14px; }
#w-form { display: grid; gap: 8px; margin-top: 8px; }
#w-form label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
#w-form input { font: 14px ui-monospace, monospace; padding: 12px; border-radius: 12px; border: 2px solid var(--glass-line); background: rgba(0, 0, 0, .3); color: var(--text); outline: none; }
#w-form input:focus { border-color: var(--mint); }
.big-btn { font: 12px var(--px); padding: 14px; border-radius: 14px; border: 3px solid var(--ink); color: #3a2a00;
  background: linear-gradient(180deg, #fff3b0, var(--gold)); box-shadow: 0 5px 0 var(--ink); }
.big-btn:disabled { filter: grayscale(1); opacity: .6; }
.ok { color: var(--mint); font-size: 14px; min-height: 18px; }
.hist { display: flex; gap: 10px; font-size: 14px; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); align-items: center; }
.hist span:first-child { flex: 1; color: var(--muted); }
.hist .st { text-transform: capitalize; } .hist.pending .st { color: var(--gold); } .hist.paid .st { color: var(--mint); } .hist.rejected .st { color: var(--red); }
.hist a { color: var(--aqua); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop2 { from { opacity: 0; transform: scale(.92) translateY(10px); } }

@media (max-width: 640px) {
  .actions button span { display: none; }
  .actions { margin-left: 0; }
  #hud { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .bag { order: 3; max-width: none; flex-basis: 100%; }
  .player { flex: 1; }
  #toasts { top: 140px; }
}

/* ================= CHAT ================= */
#chat { position: fixed; left: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 11; width: min(380px, calc(100vw - 24px));
  display: none; flex-direction: column; gap: 6px; pointer-events: none; }
body.playing #chat { display: flex; }
#chat-log { max-height: 30vh; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: 14px;
  background: linear-gradient(180deg, transparent, rgba(6, 30, 22, .55) 30%); scrollbar-width: none;
  mask-image: linear-gradient(180deg, transparent 0, #000 22px); -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22px);
  opacity: .55; transition: opacity .4s; }
#chat-log::-webkit-scrollbar { display: none; }
#chat.fresh #chat-log, #chat.open #chat-log, #chat:hover #chat-log { opacity: 1; }
#chat.open #chat-log, #chat:hover #chat-log { pointer-events: auto; }
.msg { font: 15px/1.3 var(--display); color: #eafff4; text-shadow: 0 1px 2px #000a; word-wrap: break-word; animation: fade .3s; }
.msg b { font-weight: 400; margin-right: 6px; }
.msg b::after { content: ":"; color: #eafff499; }
.msg.mine span { color: #d8fff0; }
.msg.sys { color: var(--gold); font-size: 14px; }
#chat-form { display: flex; gap: 6px; pointer-events: auto; padding: 5px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#chat-input { flex: 1; min-width: 0; font: 15px var(--display); color: var(--text); background: transparent; border: 0; outline: none; padding: 6px 8px; }
#chat-input::placeholder { color: var(--muted); }
#chat-form button { width: 36px; border-radius: 10px; border: 0; background: rgba(46, 232, 138, .25); color: var(--text); display: grid; place-items: center; }
#chat-form button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
#chat:focus-within #chat-form { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(46, 232, 138, .25); }

/* phones: chat sits above the touch pad, input only when opened */
@media (pointer: coarse) {
  #chat { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 150px); width: min(300px, calc(100vw - 24px)); }
  #chat-log { max-height: 18vh; }
  #chat:not(.open) #chat-form { display: none; }
  #chat.open { bottom: max(12px, env(safe-area-inset-bottom)); left: 8px; width: calc(100vw - 16px); z-index: 25; }
  #chat.open #chat-log { max-height: 36vh; }
}

@media (max-width: 400px) { #btn-full { display: none; } }

/* ================= 3D OVERLAYS ================= */
#game { cursor: crosshair; }
#crosshair, #hotbar, #area-banner, #touch { display: none; }
body.playing #crosshair, body.playing #hotbar, body.playing #area-banner { display: block; }
#crosshair { position: fixed; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%); z-index: 8; pointer-events: none; }
#crosshair::before, #crosshair::after { content: ""; position: absolute; background: rgba(255, 255, 255, .9); box-shadow: 0 0 2px #000; }
#crosshair::before { left: 10px; top: 2px; width: 2px; height: 18px; }
#crosshair::after { top: 10px; left: 2px; height: 2px; width: 18px; }

#area-banner { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 9; pointer-events: none; opacity: 0;
  font: clamp(22px, 4vw, 40px) var(--display); color: #fff; letter-spacing: 1px; white-space: nowrap;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink), 0 0 30px rgba(46, 232, 138, .6); }
#area-banner.show { animation: banner 3s ease forwards; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, 10px); } 15%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -8px); } }

@media (pointer: coarse) { #crosshair { width: 18px; height: 18px; } }

#hotbar { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 9; pointer-events: none; text-align: center; }
#hotbar .slot { position: relative; width: 64px; height: 64px; margin: 0 auto; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(180deg, rgba(14, 58, 43, .85), rgba(6, 30, 22, .9)); border: 3px solid var(--mint); box-shadow: 0 0 0 3px var(--ink), 0 0 24px rgba(46, 232, 138, .5); }
#hotbar .slot em { position: absolute; right: 6px; bottom: 2px; font: 400 16px var(--display); font-style: normal; color: #fff; text-shadow: 0 2px 0 var(--ink); }
.hotbar-tip { margin: 6px 0 0; font: 13px var(--display); color: #eafff4cc; text-shadow: 0 1px 3px #000; }
.pill3d { display: block; width: 40px; height: 18px; border-radius: 18px; transform: rotate(-35deg); border: 3px solid var(--ink);
  background: linear-gradient(90deg, var(--mint) 50%, #f4fbf7 50%); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .45); }

/* phones: joystick left, throw + jump right */
@media (pointer: coarse) {
  body.playing #touch { display: block; }
  #hotbar { display: none !important; }
  #chat { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 150px) !important; }
  #chat.open { bottom: max(12px, env(safe-area-inset-bottom)) !important; }
}
#touch { position: fixed; inset: auto 0 0 0; height: 0; z-index: 9; }
#joy { position: fixed; left: max(22px, env(safe-area-inset-left)); bottom: max(26px, env(safe-area-inset-bottom)); width: 128px; height: 128px; border-radius: 50%;
  background: rgba(6, 30, 22, .42); border: 2px solid rgba(160, 255, 210, .35); touch-action: none; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9dffcf, var(--mint2)); border: 3px solid var(--ink); pointer-events: none; }
#btn-throw, #btn-jump { position: fixed; border-radius: 50%; touch-action: none; display: grid; place-items: center; border: 3px solid var(--ink); }
#btn-throw { right: max(22px, env(safe-area-inset-right)); bottom: max(34px, env(safe-area-inset-bottom)); width: 92px; height: 92px;
  background: radial-gradient(circle at 35% 30%, rgba(46, 232, 138, .55), rgba(6, 30, 22, .7)); box-shadow: 0 0 0 3px rgba(46, 232, 138, .5), 0 0 26px rgba(46, 232, 138, .5); }
#btn-throw:active { transform: scale(.94); }
#btn-jump { right: max(126px, calc(env(safe-area-inset-right) + 126px)); bottom: max(24px, env(safe-area-inset-bottom)); width: 62px; height: 62px;
  background: rgba(6, 30, 22, .55); color: #eafff4; font: 26px var(--display); }
@media (pointer: coarse) { #chat-log { max-height: 11vh !important; } #chat.open #chat-log { max-height: 30vh !important; } #chat { width: min(260px, calc(100vw - 24px)) !important; } }

/* ================= VOICE ================= */
#talk { position: fixed; left: 50%; bottom: 112px; transform: translateX(-50%) translateY(10px); z-index: 12; display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px; font: 16px var(--display); color: #04281a; background: var(--mint); border: 3px solid var(--ink);
  box-shadow: 0 0 24px rgba(46, 232, 138, .6); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
#talk.show { opacity: 1; transform: translateX(-50%); }
#talk.asking { background: var(--gold); }
.talk-dot { width: 10px; height: 10px; border-radius: 50%; background: #e84040; box-shadow: 0 0 0 3px rgba(232, 64, 64, .3); animation: blink .8s infinite; }
.hotbar-tip b { color: var(--mint); font-weight: 400; }
#btn-mic { position: fixed; right: max(126px, calc(env(safe-area-inset-right) + 126px)); bottom: max(98px, calc(env(safe-area-inset-bottom) + 98px)); width: 56px; height: 56px;
  border-radius: 50%; touch-action: none; display: grid; place-items: center; font-size: 24px; border: 3px solid var(--ink); background: rgba(6, 30, 22, .6); }
#btn-mic.on { background: var(--mint); box-shadow: 0 0 22px rgba(46, 232, 138, .7); }
@media (pointer: coarse) { #talk { bottom: auto; top: 46%; } }


/* ================= ANNOUNCEMENTS ================= */
#announce { position: fixed; left: 50%; top: 92px; z-index: 13; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 24px);
  padding: 12px 22px; border-radius: 16px; text-decoration: none; color: #3a2a00; font: 20px var(--display); letter-spacing: .5px;
  background: linear-gradient(180deg, #fff3b0, var(--gold) 55%, #f0b400); border: 3px solid #5a4100;
  box-shadow: 0 6px 0 #5a4100, 0 0 40px rgba(255, 211, 77, .65); transform: translateX(-50%); pointer-events: none; }
#announce.linked { pointer-events: auto; cursor: pointer; }
#announce.big { font-size: clamp(22px, 4vw, 34px); padding: 14px 28px; }
#announce.show { animation: ann 7.5s ease forwards; }
#announce .ann-ico { font-size: 1.2em; animation: wiggle .6s ease-in-out infinite alternate; }
#announce em { font-style: normal; font-size: 13px; padding: 3px 9px; border-radius: 999px; background: rgba(90, 65, 0, .18); white-space: nowrap; }
#announce em:empty { display: none; }
@keyframes ann { 0% { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(.8); } 8% { opacity: 1; transform: translateX(-50%) scale(1.06); }
  12%, 88% { opacity: 1; transform: translateX(-50%) scale(1); } 100% { opacity: 0; transform: translateX(-50%) translateY(-12px); } }
@keyframes wiggle { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
@media (max-width: 640px) { #announce { top: 150px; font-size: 17px; } }
.msg.ann, .msg.ann a { color: var(--gold); font-size: 15px; text-decoration: none; }
.msg.ann a:hover { text-decoration: underline; }

/* ================= CITY HUD ================= */
.who b, .bag-top b, .panel-head h2, #area-banner { font-family: var(--display); font-weight: 800; }
.panel-head h2 { font: 400 22px var(--head); color: var(--mint); text-shadow: 0 0 14px rgba(46, 232, 138, .4); }
.panel { background: linear-gradient(180deg, #1a1342, #0e0a28); }
#area-banner { font: 400 clamp(22px, 4vw, 40px) var(--head); -webkit-text-stroke: 0; color: #fff;
  text-shadow: 0 0 12px rgba(79, 216, 255, .7), 0 0 36px rgba(255, 79, 168, .45), 0 4px 0 #2a1f6a; }
.toast { font-weight: 700; }
#map-card { display: none; position: fixed; right: 12px; top: 84px; z-index: 9; width: 172px; padding: 6px 6px 8px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
body.playing #map-card { display: block; }
#minimap { display: block; width: 160px; height: 160px; border-radius: 11px; image-rendering: auto; }
#radar-text { display: block; margin-top: 6px; font: 700 12px var(--display); color: #e6e1ff; text-align: center; line-height: 1.3; }
#hotbar .slot { border-radius: 18px; border: 2px solid var(--mint); background: rgba(16, 11, 42, .8); box-shadow: 0 0 22px rgba(46, 232, 138, .45), inset 0 0 18px rgba(46, 232, 138, .15); }
.hotbar-tip { font-weight: 700; }
.pause-logo { display: block; margin: -56px auto 0; width: 72px; height: 72px; border-radius: 20px; }
.pause-logo::after { width: 42px; height: 18px; margin: -9px 0 0 -21px; border-radius: 18px; }
.pause-card { background: linear-gradient(180deg, rgba(26, 19, 66, .95), rgba(12, 8, 34, .97)); }
.pause-card h2 { font: 400 28px var(--head); }
@media (max-width: 640px) {
  #map-card { top: auto; bottom: 228px; right: 10px; width: 116px; padding: 4px 4px 6px; }
  #minimap { width: 108px; height: 108px; }
  #radar-text { font-size: 10px; }
}
@media (pointer: coarse) and (max-width: 640px) { #map-card { bottom: auto; top: 150px; } }

/* CRAFTCITY logo (small) */
.brand-logo { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; flex: none; border: 2px solid rgba(46, 232, 138, .65);
  box-shadow: 0 0 20px rgba(46, 232, 138, .4), 0 6px 18px rgba(0, 0, 0, .4); }
.pause-logo.brand-logo { width: 72px; height: 72px; border-radius: 18px; }
.pause-logo.brand-logo::after { content: none; }

/* Phantom / guest choice */
.vbtn-phantom { font: 800 18px var(--display); border: 0; color: #fff; background: linear-gradient(135deg, #ab9ff2, #7b61ff); box-shadow: 0 10px 28px rgba(123, 97, 255, .45); }
.vbtn-phantom:hover { background: linear-gradient(135deg, #bdb3f6, #8a73ff); box-shadow: 0 14px 36px rgba(123, 97, 255, .55); }
.vbtn-phantom svg { width: 26px; height: 26px; background: #ab9ff2; border-radius: 8px; padding: 2px; }
.vbtn-phantom.no-ext { opacity: .85; }
.choose-note { margin: -4px 0 0; font: 600 13px/1.4 var(--display); color: #a69fd6; text-align: center; }
.err a { color: #fff; }
.kind { font-style: normal; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: #cfc8f5; margin-left: 4px; }
#w-wallet-row { display: grid; gap: 8px; }
.linked { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(171, 159, 242, .15); border: 1px solid rgba(171, 159, 242, .4); font-size: 14px; color: #e6e1ff; }

/* $CRAFTCITY buy buttons */
.buy-link { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 14px; border-radius: 14px; text-decoration: none;
  font: 800 15px var(--display); color: #062a1a; background: linear-gradient(135deg, #7dffbe, var(--mint) 50%, #12c97a);
  box-shadow: 0 8px 24px rgba(46, 232, 138, .35); transition: transform .12s, box-shadow .2s; }
.buy-link svg, .buy-chip svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.buy-link:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(46, 232, 138, .5); }
.buy-chip { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 12px; text-decoration: none;
  font: 800 14px var(--display); color: #062a1a; background: var(--mint); box-shadow: 0 0 16px rgba(46, 232, 138, .45); }
.buy-chip:hover { filter: brightness(1.1); }
@media (max-width: 640px) { .buy-chip span { display: none; } .buy-chip { padding: 0 10px; } }
