* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #111; font-family: "Segoe UI", "Arial Rounded MT Bold", Arial, sans-serif; color: #fff; user-select: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- MENU ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 20;
  background: radial-gradient(circle at 30% 20%, #3aa0ff 0%, #1d4fb8 45%, #0d1b4a 100%); overflow-y: auto; }
.menu-inner { width: min(1100px, 96vw); padding: 18px 0; }
.logo { text-align: center; font-size: 64px; margin: 0; letter-spacing: 3px; font-weight: 900;
  text-shadow: 0 6px 0 #0b2a6e, 0 10px 18px rgba(0,0,0,0.5); }
.logo span { color: #ffd43b; }
.subtitle { text-align: center; opacity: 0.9; margin-bottom: 16px; font-weight: 600; }
.menu-cols { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
.panel { background: rgba(10, 20, 50, 0.55); border: 2px solid rgba(255,255,255,0.15); border-radius: 16px; padding: 14px 16px; }
.panel h2 { margin: 0 0 10px; font-size: 22px; }
.avatar-row { display: flex; gap: 12px; }
#preview { background: radial-gradient(circle, #6ec6ff 0%, #2a6fd6 100%); border-radius: 12px; flex: none; width: 240px; height: 300px; }
.avatar-side { flex: 1; }
.avatar-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.av-card { background: rgba(255,255,255,0.1); border: 3px solid transparent; border-radius: 12px; padding: 6px; cursor: pointer; text-align: center; font-weight: 700; transition: transform .1s; }
.av-card:hover { transform: scale(1.04); background: rgba(255,255,255,0.18); }
.av-card.sel { border-color: #ffd43b; background: rgba(255,212,59,0.2); }
.av-card img { width: 100%; aspect-ratio: 1; display: block; border-radius: 8px; background: rgba(0,0,0,0.15); }
.av-card .star { color: #ffd43b; }
.cat-colors-box { margin-top: 10px; }
.small-title { font-size: 13px; opacity: .85; margin-bottom: 4px; }
.cat-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.4); cursor: pointer; }
.swatch.sel { border-color: #ffd43b; transform: scale(1.12); }
.nick { display: block; margin-top: 12px; font-weight: 700; }
.nick input { margin-left: 8px; padding: 7px 10px; border-radius: 8px; border: none; font-size: 16px; font-weight: 700; width: 200px; }
.map-list { display: flex; flex-direction: column; gap: 8px; }
.map-card { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; cursor: pointer; border: 3px solid transparent; background: rgba(255,255,255,0.1); }
.map-card:hover { background: rgba(255,255,255,0.18); }
.map-card.sel { border-color: #ffd43b; background: rgba(255,212,59,0.18); }
.map-swatch { width: 54px; height: 54px; border-radius: 10px; flex: none; border: 2px solid rgba(255,255,255,0.5); }
.map-card .mname { font-weight: 800; font-size: 17px; }
.map-card .mdesc { font-size: 13px; opacity: 0.85; }
.map-card .mprog { font-size: 12px; color: #ffd43b; font-weight: 700; }
.menu-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.coins-menu { font-size: 22px; font-weight: 800; }
.btn-play { background: #00b06b; color: #fff; font-size: 30px; font-weight: 900; border: none; border-radius: 14px; padding: 12px 40px; cursor: pointer;
  box-shadow: 0 6px 0 #007a4a; letter-spacing: 1px; }
.btn-play:hover { background: #00c97a; }
.btn-play:active { transform: translateY(4px); box-shadow: 0 2px 0 #007a4a; }
.controls-help { margin-top: 14px; text-align: center; font-size: 14px; opacity: 0.9; background: rgba(0,0,0,0.25); padding: 8px; border-radius: 10px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud button, #hud input { pointer-events: auto; }
#chat { position: absolute; left: 12px; top: 12px; width: 380px; }
#chatLog { background: rgba(0,0,0,0.3); border-radius: 10px 10px 0 0; padding: 8px 10px; height: 190px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
  font-size: 15px; font-weight: 600; text-shadow: 0 1px 2px #000; }
#chatLog .msg { margin: 1px 0; word-wrap: break-word; }
#chatLog .sys { color: #9be59b; }
#chatInput { width: 100%; border: none; border-radius: 0 0 10px 10px; padding: 7px 10px; font-size: 15px; background: rgba(0,0,0,0.5); color: #fff; outline: none; font-weight: 600; }
#chatInput:focus { background: rgba(255,255,255,0.92); color: #111; }
#topCenter { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); text-align: center; background: rgba(0,0,0,0.35); padding: 6px 22px 8px; border-radius: 12px; min-width: 260px; }
#mapName { font-size: 13px; opacity: 0.85; font-weight: 700; }
#stageText { font-size: 26px; font-weight: 900; text-shadow: 0 2px 3px #000; }
.bar { height: 8px; background: rgba(255,255,255,0.2); border-radius: 4px; overflow: hidden; margin: 3px 0; }
#stageBar { height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, #ffd43b); }
#timer { font-size: 14px; font-weight: 700; opacity: 0.9; }
#rightTop { position: absolute; right: 12px; top: 12px; width: 230px; }
#coins { background: rgba(0,0,0,0.4); border-radius: 10px; padding: 6px 12px; font-size: 22px; font-weight: 900; text-align: right; margin-bottom: 6px; }
#board { background: rgba(0,0,0,0.35); border-radius: 10px; overflow: hidden; font-size: 14px; }
.board-head { display: flex; justify-content: space-between; padding: 5px 10px; background: rgba(0,0,0,0.35); font-weight: 800; }
.board-row { display: flex; justify-content: space-between; padding: 3px 10px; font-weight: 600; }
.board-row.me { background: rgba(255,212,59,0.25); }
#hotbar { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.slot { width: 64px; height: 64px; background: rgba(0,0,0,0.45); border: 3px solid rgba(255,255,255,0.25); border-radius: 10px; position: relative;
  display: flex; align-items: center; justify-content: center; font-size: 30px; pointer-events: auto; cursor: pointer; }
.slot.eq { border-color: #4dabf7; background: rgba(77,171,247,0.35); }
.slot .num { position: absolute; left: 4px; top: 1px; font-size: 12px; font-weight: 800; }
.slot .lbl { position: absolute; bottom: 1px; left: 0; right: 0; font-size: 9px; text-align: center; font-weight: 700; white-space: nowrap; overflow: hidden; }
#prompt { position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%); background: rgba(0,0,0,0.6); padding: 10px 18px; border-radius: 10px; font-weight: 800; font-size: 18px; }
#prompt b { background: #fff; color: #111; padding: 1px 8px; border-radius: 5px; }
#flyInfo { position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); background: rgba(40,120,255,0.6); padding: 5px 14px; border-radius: 10px; font-weight: 800; }
#sideBtns { position: absolute; left: 12px; bottom: 14px; display: flex; gap: 6px; }
#sideBtns button { width: 48px; height: 48px; border-radius: 10px; border: none; background: rgba(0,0,0,0.45); color: #fff; font-size: 22px; cursor: pointer; }
#sideBtns button:hover { background: rgba(0,0,0,0.65); }
#toasts { position: absolute; left: 50%; top: 120px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.toast { background: rgba(0,0,0,0.6); padding: 8px 18px; border-radius: 10px; font-weight: 800; font-size: 18px; animation: toastIn .3s ease-out; }
.toast.gold { color: #ffd43b; font-size: 26px; }
@keyframes toastIn { from { transform: translateY(-14px) scale(0.8); opacity: 0; } to { transform: none; opacity: 1; } }
#crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; background: #fff; border-radius: 50%; box-shadow: 0 0 3px #000; }
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }

/* ---------- MODALE ---------- */
.modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.35); }
.modal-box { background: #232a3a; border: 3px solid rgba(255,255,255,0.15); border-radius: 18px; padding: 18px 22px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal h2 { margin: 0 0 12px; }
.coins-big { font-size: 24px; font-weight: 900; }
.shop-box { width: min(760px, 94vw); }
.shop-items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.item { background: rgba(255,255,255,0.08); border-radius: 12px; padding: 10px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.item .ico { font-size: 40px; }
.item .iname { font-weight: 800; }
.item .idesc { font-size: 12px; opacity: 0.8; flex: 1; }
.item .price { font-weight: 900; color: #ffd43b; }
.btn { display: block; width: 100%; padding: 10px; margin: 6px 0; border: none; border-radius: 10px; font-size: 17px; font-weight: 800; cursor: pointer;
  background: #00b06b; color: #fff; box-shadow: 0 4px 0 #007a4a; }
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #007a4a; }
.btn.gray { background: #59606e; box-shadow: 0 4px 0 #3a3f49; }
.btn.red { background: #e03b3b; box-shadow: 0 4px 0 #9e2323; }
.btn.blue { background: #2f7fe0; box-shadow: 0 4px 0 #1d58a3; }
.item .btn { font-size: 14px; padding: 7px; margin: 0; }
.close-btn { background: #59606e; box-shadow: 0 4px 0 #3a3f49; }
.pause-box, .win-box { width: 340px; text-align: center; }
#emotes { background: transparent; }
.emote-wheel { position: relative; width: 380px; height: 380px; border-radius: 50%; background: rgba(0,0,0,0.5); }
.emote-btn { position: absolute; width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.3); background: rgba(30,40,60,0.9);
  color: #fff; cursor: pointer; font-weight: 800; font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.emote-btn span { font-size: 34px; }
.emote-btn:hover { background: #2f7fe0; transform: scale(1.08); }
.emote-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; font-weight: 800; opacity: 0.85; }
