/* Mihao World UI: light, clean cards over the 3D world. One radius, one shadow, one accent. */
:root {
  --ink: #1c2230; --muted: #6b7385; --soft: #f2f4f7; --line: rgba(20, 30, 50, .09);
  --card: rgba(255, 255, 255, .94); --red: #d63a2b; --red-d: #b32a1e; --gold: #e3a21a; --green: #22a35a;
  --r: 16px; --shadow: 0 10px 30px rgba(15, 25, 45, .18), 0 1px 2px rgba(15, 25, 45, .08);
  --orange: #f29a3a;
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fb6cc; color: var(--ink); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
kbd { font: 700 10.5px ui-monospace, Consolas, monospace; padding: 2px 5px; border-radius: 5px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; filter: saturate(1.08) contrast(1.03); }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 60%, rgba(8, 12, 24, .28) 100%); }

/* ---------- shared card ---------- */
#hud, #wallet, #quest, #bar, .panel, #game, #chickHud, #prompt, #chat input, #result .box, #intro .card {
  background: var(--card); border: 1px solid rgba(255, 255, 255, .7); border-radius: var(--r); box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
}

/* ---------- HUD ---------- */
#hud { position: fixed; top: 14px; left: 14px; padding: 8px 12px 8px 8px; font-size: 13px; }
#hud .brand { display: flex; align-items: center; gap: 10px; }
#hud .brand img { width: 36px; height: 36px; border-radius: 10px; display: block; }
#hud .brand > div { line-height: 1.15; font-weight: 800; letter-spacing: .02em; }
#hud .brand b { color: var(--red); }
#where { display: block; font-weight: 700; color: var(--muted); font-size: 12px; letter-spacing: 0; }
#count { color: var(--muted); font-size: 11.5px; margin: 6px 0 0 2px; font-weight: 600; }
#ticker { margin-top: 8px; display: block; width: 100%; text-align: left; border: 0; background: var(--soft); padding: 6px 9px; border-radius: 10px; font-size: 12.5px; font-weight: 700; }
#ticker b { color: var(--red); }
#ticker .up { color: var(--green); } #ticker .down { color: var(--red); }

#wallet { position: fixed; top: 14px; right: 14px; padding: 8px 14px; font-size: 18px; font-weight: 800; display: flex; align-items: center; }
#wallet small { font-size: 11px; color: var(--muted); font-weight: 800; letter-spacing: .08em; margin-left: 5px; }
.coin { display: inline-block; width: 18px; height: 18px; border-radius: 50%; margin-right: 8px;
  background: radial-gradient(circle at 35% 35%, #ffe58a, #f2c23a 55%, #b8860b); box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .15); }
#gain { position: absolute; right: 12px; top: 46px; color: var(--gold); font-weight: 900; font-size: 20px; text-shadow: 0 1px 0 #fff, 0 2px 8px rgba(0,0,0,.25); 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); } }

#radar { position: fixed; top: 66px; right: 14px; width: 132px; height: 132px; border-radius: 50%; cursor: pointer; border: 4px solid #fff; box-shadow: var(--shadow); }
#quest { position: fixed; top: 208px; right: 14px; width: 132px; padding: 7px 10px; font-size: 12.5px; font-weight: 800; text-align: center; }
#quest b { color: var(--red); margin-right: 4px; }

/* chat: messages fade out after a while, all come back while typing */
#log { position: fixed; left: 16px; bottom: 66px; width: min(420px, 60vw); max-height: 190px; overflow: hidden; font-size: 13.5px; line-height: 1.45; pointer-events: none;
  color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .7), 0 0 8px rgba(0, 0, 0, .35); font-weight: 600; }
#log p { margin: 0 0 2px; animation: logfade 14s forwards; }
#log b { color: #ffd27a; font-weight: 800; }
#log .sys { color: #e6ecf5; font-style: italic; font-weight: 600; }
.chatting #log p { animation: none; opacity: 1; }
@keyframes logfade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
#chat { position: fixed; left: 14px; bottom: 14px; width: min(360px, 56vw); }
#chat input { width: 100%; padding: 11px 14px; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; outline: none; border-radius: 999px; }
#chat input::placeholder { color: var(--muted); }
#chat input:focus { box-shadow: var(--shadow), 0 0 0 3px rgba(214, 58, 43, .25); }

/* action bar: round icon buttons */
#bar { position: fixed; right: 14px; bottom: 14px; display: flex; gap: 4px; padding: 5px; border-radius: 999px; }
#bar button { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; font-size: 13.5px; font-weight: 800; }
#bar button:hover { background: var(--soft); }
#bar svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#bar kbd { margin-left: 2px; }
#bar button.accent { background: var(--red); color: #fff; }
#bar button.accent kbd { background: rgba(255,255,255,.2); color: #fff; border-color: transparent; }
#setBtn { padding: 0 11px !important; }
#carBtn { white-space: nowrap; background: #fff4e0 !important; color: #a0560c; }
#help { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); font-size: 12.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }

/* ---------- panels (one style for all) ---------- */
.panel { position: fixed; right: 14px; top: 14px; bottom: 76px; width: 360px; padding: 16px; overflow: auto; z-index: 20; }
.panel header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel h2 { margin: 0; font-size: 19px; font-weight: 900; }
.panel button { border: 1px solid var(--line); background: #fff; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 700; }
.panel button:hover { background: var(--soft); }
.close { width: 34px; height: 34px; padding: 0 !important; border-radius: 50% !important; font-size: 20px !important; line-height: 1; background: var(--soft) !important; border: 0 !important; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 4px 0 12px; font-weight: 600; }
#emotes { bottom: auto; }
#emoteGrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
#emoteGrid button { display: flex; justify-content: space-between; align-items: center; }
#tabs { display: flex; gap: 4px; margin-bottom: 12px; background: var(--soft); padding: 4px; border-radius: 12px; }
#tabs button { flex: 1; border: 0; background: transparent; padding: 7px 4px; }
#tabs button.on { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
#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: 8px; background: var(--soft) center/cover no-repeat; display: grid; place-items: center; }
.it .th svg { width: 70%; height: 70%; }
.it .nm { font-size: 11.5px; line-height: 1.2; min-height: 2.4em; }
.it .pr { font-size: 11.5px; color: #b77806; font-weight: 900; }
.it .pr.owned { color: var(--muted); font-weight: 700; }
.it.on { outline: 2.5px solid var(--red); background: #fff1ef !important; }
.it.locked .th { filter: saturate(.6) brightness(.95); }
#palette { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
#palette button { width: 30px; height: 30px; padding: 0 !important; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
#palette button.on { box-shadow: 0 0 0 2.5px var(--red); }
#palette p { width: 100%; margin: 0 0 2px; font-size: 12px; color: var(--muted); font-weight: 700; }
#minimap { width: 100%; height: auto; border-radius: 12px; display: block; margin-bottom: 12px; }
#zones { display: grid; gap: 6px; }
#zones button { display: flex; justify-content: space-between; align-items: center; }
#zones button span:last-child { color: var(--red); font-weight: 900; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
#cars { display: grid; gap: 8px; }
.car { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: var(--soft); border: 2px solid transparent; }
.car.on { border-color: var(--red); background: #fff1ef; }
.car i { width: 30px; height: 30px; border-radius: 9px; flex: none; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2); }
.car div { flex: 1; min-width: 0; }
.car b { display: block; font-size: 14.5px; }
.car small { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.car button.buy { color: #b77806; font-weight: 900; }
.car button.go { background: var(--red) !important; color: #fff; border-color: transparent !important; font-weight: 900; }
#qtabs { display: flex; gap: 4px; margin-bottom: 12px; background: var(--soft); padding: 4px; border-radius: 12px; }
#qtabs button { flex: 1; border: 0; background: transparent; padding: 7px; }
#qtabs button.on { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
#qlist { display: grid; gap: 10px; }
.q { padding: 12px; border-radius: 12px; background: var(--soft); }
.q .qt { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 800; }
.q .qt b { color: #b77806; }
.q small { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.q.done { opacity: .6; }
.q.done .qt span { text-decoration: line-through; }
.prog { height: 9px; border-radius: 5px; background: rgba(20, 30, 50, .1); overflow: hidden; margin: 8px 0 4px; }
.prog div { height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width .4s; }
.lb { margin-bottom: 14px; }
.lb h3 { margin: 0 0 6px; font-size: 12px; letter-spacing: .1em; color: var(--muted); }
.lb ol { margin: 0; padding: 0; list-style: none; }
.lb li { display: flex; justify-content: space-between; padding: 7px 10px; border-radius: 10px; font-size: 13.5px; font-weight: 700; }
.lb li:nth-child(odd) { background: var(--soft); }
.lb li:first-child b { color: #b77806; }
.lb .empty { color: var(--muted); font-weight: 600; font-size: 13px; padding: 6px 10px; }
#settings .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 700; }
#settings input[type=range] { width: 150px; accent-color: var(--red); }
#settings input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--red); }
.seg { display: inline-flex; gap: 3px; background: var(--soft); padding: 3px; border-radius: 10px; }
.seg button { border: 0 !important; background: transparent !important; padding: 6px 12px; }
.seg button.on { background: #fff !important; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
#chart { width: 400px; }
#chartCv { width: 100%; height: auto; border-radius: 12px; display: block; background: #121a2c; }
#cstats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
#cstats div { background: var(--soft); border-radius: 10px; padding: 8px 10px; }
#cstats small { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
#cstats b { font-size: 16px; }
.csrc { font-size: 11px; color: var(--muted); margin: 6px 0; font-weight: 600; }
.ca { display: flex; gap: 6px; align-items: center; margin: 8px 0; }
.ca code { flex: 1; font-size: 11px; background: var(--soft); padding: 8px; border-radius: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clinks { display: flex; gap: 8px; }
.clinks a { flex: 1; text-align: center; padding: 9px; border-radius: 10px; background: var(--soft); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 800; }
.clinks a:hover { background: #e6e9ee; }

/* ---------- world labels ---------- */
.tag { display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; transform: translateY(-6px); }
.tag .name { font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--ink); white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.tag.me .name { background: var(--red); color: #fff; }
.tag .bubble { max-width: 220px; font-size: 13px; font-weight: 700; line-height: 1.35; padding: 8px 11px; border-radius: 14px; background: #fff; color: var(--ink);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2); 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; }
.nonames .tag .name { display: none; }

/* ---------- prompts, minigames, toasts, results ---------- */
#prompt { position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%); padding: 9px 16px; font-size: 14px; font-weight: 800; border-radius: 999px; white-space: nowrap; }
#toast { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); padding: 11px 20px; border-radius: 999px; font-size: 15px; font-weight: 900;
  background: rgba(28, 34, 48, .92); color: #fff; text-align: center; pointer-events: none; box-shadow: var(--shadow); animation: pop .25s ease-out; max-width: 92vw; z-index: 30; }
@keyframes pop { from { transform: translate(-50%, -8px) scale(.96); opacity: 0; } }
#game { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); min-width: 300px; max-width: min(560px, 94vw); padding: 14px 18px; text-align: center; z-index: 15; }
#game p { margin: 6px 0; color: var(--muted); font-size: 13.5px; font-weight: 600; }
#game small { color: var(--muted); font-size: 11px; letter-spacing: .08em; font-weight: 800; }
.gtitle { font-size: 17px; font-weight: 900; }
.gtitle.bite { color: var(--red); font-size: 28px; animation: pulse .35s infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }
.reel { position: relative; width: 46px; height: 220px; margin: 10px auto; border-radius: 12px; background: #dfeaf2; overflow: hidden; }
.rz { position: absolute; left: 3px; right: 3px; height: 25%; border-radius: 9px; background: rgba(34, 163, 90, .3); border: 2px solid rgba(34, 163, 90, .8); }
.rz.in { background: rgba(34, 163, 90, .6); }
.rf { position: absolute; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px #fff; }
#game button { border: 1px solid var(--line); background: #fff; padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 800; }
#game button.big { background: var(--red); color: #fff; border: 0; padding: 10px 20px; }
.prow { display: flex; gap: 18px; justify-content: center; margin: 8px 0; }
.prow canvas { display: block; width: 120px; height: 120px; margin: 4px auto; }
#orderTxt { font-size: 12.5px; font-weight: 900; }
.tops { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.top { display: flex; align-items: center; gap: 6px; font-size: 12px !important; }
.top i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.top.on { outline: 2.5px solid var(--red); background: #fff1ef !important; }
.prow2 { display: flex; gap: 8px; justify-content: center; }
#meter { position: fixed; left: 50%; bottom: 160px; transform: translateX(-50%); width: 300px; height: 22px; border-radius: 11px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); }
#meter .zone { position: absolute; top: 3px; bottom: 3px; border-radius: 8px; background: rgba(34, 163, 90, .8); }
#meter .needle { position: absolute; top: -5px; bottom: -5px; width: 5px; border-radius: 3px; background: var(--red); box-shadow: 0 0 0 2px #fff; }
#meter span { position: absolute; top: 30px; left: 0; right: 0; text-align: center; font-size: 12.5px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
#chickHud { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; font-size: 15px; font-weight: 800; white-space: nowrap; }
#chickHud b { color: #b77806; margin-right: 6px; }
#chickHud small { color: var(--muted); margin-left: 8px; font-size: 11px; }
#speedo { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); font: 900 30px "Nunito", system-ui, sans-serif; color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, .55); pointer-events: none; }
#result { position: fixed; inset: 0; display: grid; place-items: center; z-index: 40; background: rgba(10, 16, 30, .25); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
#result .box { width: min(340px, 90vw); padding: 24px 22px 20px; text-align: center; animation: rise .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes rise { from { transform: translateY(20px) scale(.92); opacity: 0; } }
#result .kick { font-size: 12px; font-weight: 900; letter-spacing: .14em; color: var(--muted); }
#result h3 { margin: 6px 0 4px; font-size: 26px; font-weight: 900; }
#result .sub { margin: 0 0 14px; color: var(--muted); font-weight: 700; }
#result .rw { display: inline-flex; align-items: center; gap: 6px; font-size: 22px; font-weight: 900; color: #b77806; background: #fff6e0; padding: 6px 16px; border-radius: 999px; }
#result .best { margin-top: 10px; font-size: 13px; font-weight: 900; color: var(--red); }
#result button { margin-top: 16px; width: 100%; padding: 12px; border: 0; border-radius: 12px; background: var(--red); color: #fff; font-size: 15px; font-weight: 900; }

/* ---------- touch controls ---------- */
#stick { position: fixed; left: 24px; bottom: 170px; width: 124px; height: 124px; border-radius: 50%; background: rgba(255, 255, 255, .28); border: 2px solid rgba(255, 255, 255, .6); touch-action: none; }
#stick .knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); }
#actBtn, #shootBtn { position: fixed; right: 24px; bottom: 200px; width: 84px; height: 84px; border-radius: 50%; background: var(--red); border: 4px solid #fff; color: #fff; font-weight: 900; box-shadow: var(--shadow); }
#jumpBtn { position: fixed; right: 120px; bottom: 120px; width: 70px; height: 70px; border-radius: 50%; border: 0; background: #fff; color: var(--ink); font-weight: 900; box-shadow: var(--shadow); }

/* ---------- intro ---------- */
#intro { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(10, 18, 34, .1), rgba(10, 18, 34, .55)); z-index: 50; }
#intro .card { text-align: center; padding: 28px 30px 22px; width: min(420px, 92vw); }
#intro .logo { width: 104px; height: 104px; border-radius: 26px; display: block; margin: 0 auto 12px; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); }
#intro h1 { margin: 0 0 6px; font-size: 34px; font-weight: 900; letter-spacing: .02em; }
#intro h1 b { color: var(--red); }
#intro .sub { margin: 0 0 20px; color: var(--muted); font-weight: 700; line-height: 1.45; }
#join { display: flex; gap: 8px; }
#join input { flex: 1; min-width: 0; padding: 13px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 700; font-size: 15px; outline: none; }
#join input:focus { border-color: var(--red); }
#join button { padding: 0 22px; border: 0; border-radius: 12px; background: var(--red); color: #fff; font-weight: 900; font-size: 15px; }
#join button:disabled { opacity: .5; cursor: wait; }
.feats { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.feats li { font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); }
#loadMsg { margin: 14px 0 0; font-size: 12px; color: var(--muted); min-height: 1em; font-weight: 700; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { #bar button span { display: none; } #carBtn span { display: inline !important; } #bar button { padding: 0 11px; } #bar kbd { display: none; } #help { display: none; } }
@media (max-width: 900px) { #chickHud, #game { top: 150px; } }
@media (max-width: 640px) {
  #hud { padding: 6px 10px 6px 6px; max-width: calc(100vw - 150px); }
  #hud .brand img { width: 28px; height: 28px; }
  #ticker { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #wallet { font-size: 15px; padding: 7px 11px; }
  #radar { top: 58px; width: 92px; height: 92px; border-width: 3px; }
  #quest { top: 156px; width: 92px; font-size: 11px; padding: 5px 6px; }
  .panel { left: 10px; right: 10px; width: auto; top: 10px; bottom: 66px; }
  #bar { left: 10px; right: 10px; bottom: 10px; justify-content: space-between; }
  #bar button { height: 38px; padding: 0 9px; }
  #log { width: 64vw; max-height: 110px; font-size: 12px; bottom: 112px; }
  #chat { bottom: 60px; width: calc(100vw - 20px); left: 10px; }
  #stick { bottom: 250px; left: 18px; }
  #jumpBtn { right: 16px; bottom: 124px; width: 64px; height: 64px; }
  #actBtn, #shootBtn { right: 16px; bottom: 200px; width: 76px; height: 76px; }
  #speedo { bottom: 310px; }
  .tops { grid-template-columns: repeat(3, 1fr); }
  #prompt { bottom: 160px; font-size: 12.5px; white-space: normal; text-align: center; width: max-content; max-width: 90vw; }
}
