:root {
  --glass: rgba(18, 26, 40, 0.62);
  --glass-hi: rgba(255, 255, 255, 0.10);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f4f6fa;
  --muted: #b9c2d0;
  --blue: #2f5bff;
  --orange: #f29a3a;
  font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fb6cc; color: var(--text); }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
[hidden] { display: none !important; }

.panel, #hud, #bar, #wardrobe, #chat input, #log {
  background: linear-gradient(180deg, var(--glass-hi), transparent 60%), var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#hud { position: fixed; top: 14px; left: 14px; padding: 9px 14px; border-radius: 10px; font-size: 14px; letter-spacing: .04em; }
#hud .brand b { color: var(--orange); }
#hud #where { color: var(--muted); margin-left: 8px; font-size: 12px; }
#count { color: var(--muted); font-size: 12px; margin-top: 2px; }

#log { position: fixed; left: 14px; bottom: 64px; width: min(420px, 60vw); max-height: 170px; overflow: hidden;
  padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
#log p { margin: 0; }
#log b { color: var(--orange); font-weight: 600; }
#log .sys { color: var(--muted); font-style: italic; }

#chat { position: fixed; left: 14px; bottom: 14px; width: min(420px, 60vw); }
#chat input { width: 100%; padding: 10px 12px; border-radius: 10px; color: var(--text); font-size: 14px; outline: none; }
#chat input::placeholder { color: var(--muted); }
#chat input:focus { border-color: rgba(255,255,255,.45); }

#bar { position: fixed; right: 14px; bottom: 14px; display: flex; gap: 6px; padding: 6px; border-radius: 12px; }
#bar button, #wardrobe button, #join button {
  border: 1px solid var(--line); background: rgba(255,255,255,.08); color: var(--text);
  padding: 8px 12px; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer;
}
#bar button:hover { background: rgba(255,255,255,.18); }
#bar button.accent { background: var(--blue); border-color: transparent; }
#bar kbd { margin-left: 6px; font: 11px ui-monospace, monospace; opacity: .65; }

#wardrobe { position: fixed; right: 14px; top: 14px; bottom: 74px; width: 300px; border-radius: 14px; padding: 14px; overflow: auto; }
#wardrobe header { display: flex; align-items: center; justify-content: space-between; }
#wardrobe h2 { margin: 0; font-size: 17px; letter-spacing: .03em; }
#wardrobe h3 { margin: 16px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
#wardrobeClose { padding: 2px 10px !important; font-size: 18px !important; }
.items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.item { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 6px !important; gap: 4px; }
.item .sw { flex: 1; width: 100%; border-radius: 6px; background: rgba(0,0,0,.2) center/contain no-repeat; }
.item span { font-size: 11px; }
.item.on { outline: 2px solid var(--orange); background: rgba(242,154,58,.16) !important; }

#help { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); font-size: 12px; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.6); opacity: .85; }

/* name tags and chat bubbles above the cats */
.tag { display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; transform: translateY(-6px); }
.tag .name { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(10,16,28,.55); color: #fff; white-space: nowrap; }
.tag.me .name { background: rgba(47,91,255,.75); }
.tag .bubble { max-width: 220px; font-size: 13px; line-height: 1.35; padding: 7px 10px; border-radius: 12px; background: #fff; color: #141821;
  box-shadow: 0 2px 8px rgba(0,0,0,.25); position: relative; text-align: center; word-wrap: break-word; }
.tag .bubble::after { content: ""; position: absolute; bottom: -6px; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; border-bottom: 0; }

#intro { position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(ellipse at center, rgba(10,18,34,.25), rgba(10,18,34,.75)); }
#intro .card { text-align: center; padding: 34px 40px; border-radius: 18px; width: min(440px, 92vw);
  background: linear-gradient(180deg, rgba(255,255,255,.12), transparent 50%), rgba(14,22,36,.78); border: 1px solid var(--line); }
#intro .kicker { margin: 0; color: var(--muted); letter-spacing: .2em; text-transform: uppercase; font-size: 12px; }
#intro h1 { margin: 6px 0 6px; font-size: 40px; letter-spacing: .06em; font-weight: 400; }
#intro h1 b { color: var(--orange); font-weight: 800; }
#intro .sub { margin: 0 0 22px; color: var(--muted); }
#join { display: flex; gap: 8px; }
#join input { flex: 1; padding: 11px 12px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,.08);
  color: var(--text); font: inherit; outline: none; }
#join button { background: var(--blue); border-color: transparent; font-weight: 600; }
#join button:disabled { opacity: .5; cursor: wait; }
#loadMsg { margin: 14px 0 0; font-size: 12px; color: var(--muted); min-height: 1em; }

#stick { position: fixed; left: 24px; bottom: 170px; width: 120px; height: 120px; border-radius: 50%;
  background: rgba(18,26,40,.35); border: 1px solid var(--line); touch-action: none; }
#stick .knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  background: rgba(255,255,255,.55); }

@media (max-width: 640px) {
  #bar { left: 14px; right: 14px; bottom: 64px; justify-content: space-between; }
  #bar kbd { display: none; }
  #log { bottom: 118px; width: calc(100vw - 28px); }
  #chat { width: calc(100vw - 28px); }
  #wardrobe { left: 14px; width: auto; bottom: 120px; }
  #help { display: none; }
}

/* ---------- v2: wallet, panels, emotes, shop, map, minigame ---------- */
#wallet { position: fixed; top: 14px; right: 14px; padding: 9px 14px; border-radius: 10px; font-size: 18px; font-weight: 700;
  background: linear-gradient(180deg, var(--glass-hi), transparent 60%), var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px); }
#wallet small { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .1em; }
.coin { display: inline-block; width: 16px; height: 16px; border-radius: 50%; margin-right: 7px; vertical-align: -2px;
  background: radial-gradient(circle at 35% 35%, #ffe58a, #f2c23a 55%, #b8860b); box-shadow: 0 0 0 1px rgba(0,0,0,.25) inset; }
#gain { position: absolute; right: 12px; top: 44px; color: #ffe58a; font-weight: 800; text-shadow: 0 1px 3px rgba(0,0,0,.6); opacity: 0; pointer-events: none; }
#gain.show { animation: gain 1.4s ease-out; }
@keyframes gain { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-22px); } }

.panel { position: fixed; right: 14px; top: 64px; bottom: 74px; width: 340px; border-radius: 14px; padding: 14px; overflow: auto;
  background: linear-gradient(180deg, var(--glass-hi), transparent 60%), var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.panel header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.panel h2 { margin: 0; font-size: 17px; letter-spacing: .03em; }
.panel button, #shootBtn { border: 1px solid var(--line); background: rgba(255,255,255,.08); color: var(--text); padding: 7px 10px; border-radius: 8px;
  font: inherit; font-size: 13px; cursor: pointer; }
.panel button:hover { background: rgba(255,255,255,.18); }
.close { font-size: 18px !important; padding: 2px 10px !important; }
#emotes { bottom: auto; }
#emoteGrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
#emoteGrid button { display: flex; justify-content: space-between; }
#emoteGrid kbd { opacity: .6; font: 11px ui-monospace, monospace; }
#tabs { display: flex; gap: 4px; margin-bottom: 10px; }
#tabs button { flex: 1; }
#tabs button.on { background: var(--blue); border-color: transparent; }
#items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.it { display: flex; flex-direction: column; gap: 4px; padding: 6px !important; text-align: center; position: relative; }
.it .th { aspect-ratio: 1; border-radius: 6px; background: rgba(0,0,0,.25) center/cover no-repeat; display: grid; place-items: center; }
.it .th svg { width: 70%; height: 70%; }
.it .nm { font-size: 11px; line-height: 1.2; min-height: 2.4em; }
.it .pr { font-size: 11px; color: #ffe58a; font-weight: 700; }
.it .pr.owned { color: var(--muted); font-weight: 400; }
.it.on { outline: 2px solid var(--orange); background: rgba(242,154,58,.16) !important; }
.it.locked .th { filter: saturate(.6) brightness(.85); }
#palette { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
#palette button { width: 30px; height: 30px; padding: 0 !important; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); }
#palette button.on { border-color: #fff; box-shadow: 0 0 0 2px var(--orange); }
#palette p { width: 100%; margin: 0 0 2px; font-size: 12px; color: var(--muted); }
#minimap { width: 100%; height: auto; border-radius: 10px; background: #5f8f4a; display: block; margin-bottom: 10px; }
#zones { display: grid; gap: 6px; }
#zones button { display: flex; justify-content: space-between; }
#prompt { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); padding: 8px 14px; border-radius: 10px; font-size: 14px;
  background: rgba(10,16,28,.7); border: 1px solid var(--line); }
#meter { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); width: 300px; height: 22px; border-radius: 11px;
  background: rgba(10,16,28,.75); border: 1px solid var(--line); overflow: visible; }
#meter .zone { position: absolute; top: 2px; bottom: 2px; border-radius: 8px; background: rgba(89,179,107,.85); }
#meter .needle { position: absolute; top: -4px; bottom: -4px; width: 4px; border-radius: 2px; background: #fff; box-shadow: 0 0 6px #fff; }
#meter span { position: absolute; top: 28px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--muted); }
#shootBtn { position: fixed; right: 24px; bottom: 140px; width: 84px; height: 84px; border-radius: 50%; background: #e8611a; border: 0; font-weight: 800; }
@media (max-width: 640px) { .panel { left: 14px; width: auto; top: 64px; bottom: 120px; } }
#wardrobe { top: 64px; width: 340px; }
@media (max-width: 640px) { #wardrobe { left: 14px; width: auto; } }
