* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; }

#crosshair { position: fixed; left: 50%; top: 50%; width: 20px; height: 20px; transform: translate(-50%, -50%); pointer-events: none; z-index: 5; }
#crosshair::before, #crosshair::after { content: ''; position: absolute; background: rgba(255,255,255,0.9); box-shadow: 0 0 3px rgba(0,0,0,0.8); }
#crosshair::before { left: 9px; top: 0; width: 2px; height: 20px; }
#crosshair::after { left: 0; top: 9px; width: 20px; height: 2px; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.hudbox { position: absolute; padding: 10px 14px; background: rgba(0,0,0,0.45); color: #fff; border-radius: 8px; font-size: 14px; line-height: 1.6; }
.hudbox.left { left: 12px; top: 12px; }
.hudbox.center { left: 50%; top: 12px; transform: translateX(-50%); text-align: center; min-width: 260px; }
.hudbox.right { right: 12px; top: 12px; text-align: right; }
#coinCounter { position: fixed; right: 12px; top: 70px; background: rgba(0,0,0,0.45); color: #ffd54a; border: 1px solid #ffd54a; border-radius: 20px; padding: 6px 16px; font-size: 18px; font-weight: 700; z-index: 6; pointer-events: none; }
.badge { display: inline-block; background: #f59e0b; color: #1f1f1f; padding: 2px 8px; border-radius: 20px; font-size: 12px; margin-top: 2px; }

#health { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 2px; z-index: 7; pointer-events: none; background: rgba(0,0,0,0.35); padding: 6px 10px; border-radius: 10px; }
.heart { width: 20px; height: 20px; background: rgba(255,255,255,0.15); clip-path: polygon(50% 0, 61% 15%, 75% 8%, 82% 25%, 95% 25%, 89% 43%, 98% 58%, 62% 80%, 50% 100%, 38% 80%, 2% 58%, 11% 43%, 5% 25%, 18% 25%, 25% 8%, 39% 15%); }
.heart.full { background: #e5484d; }
.heart.half { background: linear-gradient(90deg, #e5484d 50%, rgba(255,255,255,0.15) 50%); }

#bubbles { position: fixed; left: 50%; bottom: 68px; transform: translateX(-50%); display: flex; gap: 3px; z-index: 7; pointer-events: none; background: rgba(0,0,0,0.35); padding: 6px 10px; border-radius: 10px; }
#chargeBar { position: fixed; left: 50%; bottom: 140px; transform: translateX(-50%); color: #ffd54a; background: rgba(0,0,0,0.65); padding: 6px 16px; border-radius: 10px; font-size: 15px; z-index: 7; pointer-events: none; display: none; }
.bubble { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #7fd4ff; background: rgba(255,255,255,0.08); }
.bubble.on { background: #7fd4ff; box-shadow: 0 0 6px rgba(127,212,255,0.8); }
.bubble.on.danger { background: #ff5a4d; border-color: #ff5a4d; }

#backpackBtn { position: fixed; left: 12px; bottom: 12px; z-index: 7; pointer-events: auto; background: #3b5bdb; color: #fff; border: 2px solid #4263eb; border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer; }
#backpackBtn:hover { background: #4263eb; }
#houseBtn { position: fixed; left: 92px; bottom: 12px; z-index: 7; pointer-events: auto; background: #f59e0b; color: #1f1f1f; border: 2px solid #ffb43c; border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer; font-weight: 700; }
#houseBtn:hover { background: #ffb43c; }
#equipbar { position: fixed; right: 12px; bottom: 92px; z-index: 7; pointer-events: none; display: flex; gap: 6px; }
#speedMeter { position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%); z-index: 7; pointer-events: none; display: flex; gap: 3px; background: rgba(0,0,0,0.35); padding: 5px 8px; border-radius: 8px; }
.speedicon { width: 10px; height: 16px; background: rgba(255,255,255,0.12); border: 1px solid #555; border-radius: 2px; }
.speedicon.on { background: #4dd0e1; box-shadow: 0 0 4px rgba(77,208,225,0.7); }
.eqslot { background: rgba(0,0,0,0.45); color: #fff; border: 1px solid #555; border-radius: 8px; padding: 6px 10px; font-size: 12px; line-height: 1.5; text-align: center; }
.eqlabel { color: #b9c0d0; margin-right: 4px; }
.sellbtn { background: #e5484d; }
.sellbtn:hover { background: #ff5a4d; }
#sleep .panel { min-width: 260px; }
#sleep h2 { color: #ffd54a; }

.invpanel { min-width: 520px; }
.invbody { display: flex; gap: 18px; justify-content: center; align-items: flex-start; margin: 14px 0; }
.invcol, .workcol { text-align: left; }
.invtip { color: #b9c0d0; font-size: 13px; margin-bottom: 6px; }
.invitems { display: flex; flex-wrap: wrap; gap: 4px; max-width: 260px; min-height: 90px; padding: 6px; background: rgba(255,255,255,0.05); border-radius: 8px; }
.invitem { position: relative; width: 34px; height: 34px; border: 1px solid #555; border-radius: 4px; background: rgba(255,255,255,0.06); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.invitem:hover { border-color: #ffd54a; }
.invitem.selected { border-color: #ffd54a; box-shadow: 0 0 6px rgba(255,213,74,0.8); }
.workslot.selected { border-color: #ffd54a; box-shadow: 0 0 6px rgba(255,213,74,0.8); }
.invcount { position: absolute; right: 1px; bottom: 1px; color: #fff; font-size: 11px; background: rgba(0,0,0,0.6); border-radius: 3px; padding: 0 3px; }
.workgrid { display: grid; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); gap: 4px; background: rgba(0,0,0,0.4); padding: 6px; border-radius: 8px; }
.workslot { width: 40px; height: 40px; border: 2px solid #444; border-radius: 4px; background: rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.workslot.has { border-color: #7fd4ff; }
.workslot .swatch { width: 30px; height: 30px; border-radius: 4px; }
.invitem .swatch { width: 26px; height: 26px; border-radius: 3px; }
.trashbtn { margin-top: 8px; width: 100%; text-align: center; padding: 8px 0; background: rgba(200,40,40,0.25); color: #ffb4b4; border: 1px dashed #e5484d; border-radius: 6px; cursor: pointer; font-size: 13px; }
.trashbtn:hover { background: rgba(229,72,77,0.4); }
.helditem { position: fixed; left: 0; top: 0; width: 38px; height: 38px; pointer-events: none; z-index: 60; display: none; background: rgba(0,0,0,0.4); border: 1px solid #fff; border-radius: 4px; align-items: center; justify-content: center; }
.helditem .swatch { width: 30px; height: 30px; border-radius: 3px; }

#hotbar { position: fixed; right: 12px; bottom: 12px; display: flex; gap: 6px; z-index: 7; pointer-events: none; }
.slot { width: 66px; height: 66px; background: rgba(0,0,0,0.5); border: 2px solid #555; border-radius: 6px; text-align: center; padding-top: 6px; color: #fff; font-size: 11px; }
.slot.active { border-color: #ffd54a; background: rgba(255,213,74,0.25); }
.swatch { width: 34px; height: 34px; margin: 0 auto 4px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.3); }

#interact { position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%); color: #fff; font-size: 16px; background: rgba(0,0,0,0.55); padding: 8px 18px; border-radius: 20px; z-index: 7; pointer-events: none; display: none; }

#damageFlash { position: fixed; inset: 0; background: rgba(220,20,20,0.55); opacity: 0; pointer-events: none; z-index: 8; }

.overlay { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 20; background: rgba(0,0,0,0.55); }
.panel { background: rgba(15,15,25,0.92); color: #fff; padding: 36px 48px; border-radius: 16px; text-align: center; border: 1px solid rgba(255,255,255,0.15); min-width: 320px; }
.panel h1 { font-size: 40px; margin-bottom: 14px; letter-spacing: 6px; color: #ffd54a; text-shadow: 0 0 20px rgba(255,213,74,0.5); }
.panel h2 { font-size: 28px; margin-bottom: 18px; }
.panel p { margin: 8px 0; line-height: 1.7; }
.panel p.small { color: #b9c0d0; font-size: 13px; }
.panel button { display: block; width: 100%; margin: 10px 0 0; padding: 12px; font-size: 16px; background: #3b5bdb; color: #fff; border: none; border-radius: 8px; cursor: pointer; }
.panel button:hover { background: #4263eb; }

#menuHint { pointer-events: none; }
#menuHint .panel { pointer-events: none; }
#btnHomeShop { pointer-events: auto; display: block; width: 100%; margin-top: 14px; padding: 12px; font-size: 16px; background: #f59e0b; color: #1f1f1f; border: none; border-radius: 8px; cursor: pointer; font-weight: 700; }
#btnHomeShop:hover { background: #ffb43c; }
.hintbar { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); color: #fff; background: rgba(0,0,0,0.6); padding: 8px 20px; border-radius: 20px; z-index: 15; font-size: 15px; pointer-events: none; }

.shoppanel { min-width: 460px; max-height: 84vh; overflow-y: auto; }
.shoppanel h2 { color: #ffd54a; }
#shopCoins, #houseCoins { color: #ffd54a !important; font-size: 18px !important; font-weight: 700; margin: 6px 0; }
.shoppanel .small { color: #b9c0d0; margin: 2px 0; }
.shoplist { margin: 14px 0; text-align: left; max-height: 46vh; overflow-y: auto; }
.shopheader { color: #ffd54a; font-weight: 700; margin: 10px 0 4px; font-size: 14px; }
.shoprow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,0.06); margin: 4px 0; }
.shoprow.equipped { background: rgba(255,213,74,0.18); }
.wname { flex: 1; color: #fff; }
.wtype { color: #b9c0d0; font-size: 12px; width: 36px; }
.wdmg { color: #ff8a80; font-size: 13px; width: 64px; }
.wcost { color: #ffd54a; font-size: 13px; width: 110px; text-align: right; }
.buybtn { background: #3b5bdb; color: #fff; border: none; border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.buybtn:hover { background: #4263eb; }

#toast { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); color: #ffd54a; background: rgba(0,0,0,0.75); padding: 10px 22px; border-radius: 10px; font-size: 17px; z-index: 25; pointer-events: none; opacity: 0; transition: opacity 0.3s; }
