* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #1d2b1f; --panel: rgba(20,30,22,.92); --accent: #ffd34d; --danger: #ff5a4d;
  --grass: #4a7a3a; --good: #6fe08a;
}
html, body { height: 100%; font-family: "PingFang SC","Microsoft YaHei",system-ui,sans-serif; background: #0e1410; color: #eee; overflow: hidden; }
.hidden { display: none !important; }

/* 开始界面 */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 30%, #2c4a33, #0e1410); z-index: 50; }
.panel { width: min(460px, 92vw); background: var(--panel); border: 1px solid #3a5a40; border-radius: 18px; padding: 28px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.panel h1 { font-size: 30px; text-align: center; color: var(--accent); }
.panel .sub { text-align: center; color: #9fc7a6; margin: 6px 0 18px; }
#nameInput { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid #3a5a40; background: #0e1a12; color: #fff; font-size: 16px; margin-bottom: 12px; }
#startBtn { width: 100%; padding: 13px; border: none; border-radius: 10px; background: linear-gradient(180deg,#ffe27a,#f5b53c); color: #2a1c00; font-weight: 700; font-size: 17px; cursor: pointer; transition: transform .08s; }
#startBtn:hover { transform: translateY(-1px); }
.rules { margin-top: 18px; font-size: 13px; color: #cfe3d2; line-height: 1.7; }
.rules ul { margin: 6px 0 6px 18px; }
.rules .tip { color: #8fae97; font-style: italic; }
.start-err { margin-top: 12px; min-height: 18px; color: #ff6b6b; font-size: 13px; line-height: 1.5; text-align: center; }
#startBtn:disabled { background: #5a6b50; color: #d6e2cf; cursor: default; }

/* 画布 */
#game { display: block; width: 100vw; height: 100vh; background: #2f5236; cursor: crosshair; }

/* HUD */
.hud { position: fixed; top: 12px; left: 12px; background: var(--panel); border: 1px solid #3a5a40; border-radius: 12px; padding: 10px 14px; z-index: 20; min-width: 200px; }
.hud .me { display: flex; justify-content: space-between; align-items: baseline; }
.hud .me span:first-child { font-weight: 700; color: var(--accent); }
.hud .score { font-size: 15px; } .hud .score b { color: var(--good); font-size: 18px; }
.equip-line { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.equip-chip { font-size: 12px; background: #0e1a12; border: 1px solid #3a5a40; border-radius: 8px; padding: 4px 8px; }
.equip-chip b { color: var(--accent); }

/* 商店 */
.shop { position: fixed; top: 12px; right: 12px; width: 250px; background: var(--panel); border: 1px solid #3a5a40; border-radius: 12px; padding: 12px 14px; z-index: 20; }
.shop h3 { color: var(--accent); margin-bottom: 10px; font-size: 16px; }
.shop-item { background: #0e1a12; border: 1px solid #34503a; border-radius: 10px; padding: 9px 10px; margin-bottom: 9px; }
.shop-item .t { display: flex; justify-content: space-between; font-size: 13px; }
.shop-item .t b { color: #fff; }
.shop-item .cur { font-size: 11px; color: #8fae97; }
.shop-item button { margin-top: 7px; width: 100%; padding: 7px; border: none; border-radius: 8px; background: #2f6b3d; color: #fff; font-size: 13px; cursor: pointer; }
.shop-item button:hover:not(:disabled) { background: #3a8a4c; }
.shop-item button:disabled { background: #2a2a2a; color: #777; cursor: not-allowed; }
.shop-item.maxed button { background: #444; color: #aaa; }

/* 在线玩家 */
.players { position: fixed; bottom: 12px; right: 12px; width: 200px; background: var(--panel); border: 1px solid #3a5a40; border-radius: 12px; padding: 10px 14px; z-index: 20; }
.players h3 { font-size: 14px; color: var(--accent); margin-bottom: 8px; }
.players ul { list-style: none; font-size: 13px; }
.players li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid #233; }
.players li b { color: var(--good); }

/* 提示 */
.toast { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; z-index: 30; pointer-events: none; }
.toast .msg { background: rgba(0,0,0,.75); padding: 8px 16px; border-radius: 20px; font-size: 14px; animation: fade 2.6s forwards; }
.toast .msg.good { color: var(--good); }
.toast .msg.bad { color: var(--danger); }
.toast .msg.info { color: var(--accent); }
@keyframes fade { 0%{opacity:0;transform:translateY(8px)} 12%{opacity:1;transform:none} 80%{opacity:1} 100%{opacity:0} }

.help { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.55); padding: 7px 16px; border-radius: 18px; font-size: 13px; color: #cfe3d2; z-index: 20; }
.players .board-sep { margin: 8px 0 2px; padding-top: 6px; border-top: 1px dashed #355; color: #ffd34d; font-size: 11px; }

/* 关卡进度条 */
.levelbar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); width: min(520px, 86vw); background: var(--panel); border: 1px solid #3a5a40; border-radius: 12px; padding: 8px 14px; z-index: 25; display: flex; align-items: center; gap: 12px; }
.levelbar .lv-left { font-size: 13px; white-space: nowrap; color: #cfe3d2; }
.levelbar .lv-left b { color: var(--accent); font-size: 15px; }
.levelbar .lv-right { font-size: 12px; white-space: nowrap; color: #8fae97; }
.levelbar .lv-track { flex: 1; height: 9px; background: #0e1a12; border-radius: 999px; overflow: hidden; }
.levelbar .lv-fill { height: 100%; width: 0%; background: linear-gradient(90deg,#6fe08a,#ffd34d); border-radius: 999px; transition: width .4s; }
.levelbar.flash { animation: lvflash .9s ease; }
@keyframes lvflash { 0%{ box-shadow: 0 0 0 0 rgba(255,211,77,.9);} 100%{ box-shadow: 0 0 0 22px rgba(255,211,77,0);} }
