html, body { margin: 0; overflow: hidden; background: #87ceeb; font-family: system-ui, sans-serif; }
canvas { display: block; }
#hud { position: fixed; top: 12px; left: 12px; color: #fff; font-size: 22px; font-weight: bold; text-shadow: 0 2px 4px #000; line-height: 1.4; }
#msg { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; color: #fff; font-size: 56px; font-weight: bold; text-shadow: 0 3px 8px #000; white-space: pre-line; pointer-events: none; }

button { font-size: 28px; font-weight: bold; padding: 14px 32px; border: 0; border-radius: 14px; background: #ffcc00; color: #222; cursor: pointer; box-shadow: 0 4px 0 #b38f00; }
button:hover { background: #ffd733; }
#start, #end { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #fff; text-align: center; text-shadow: 0 2px 6px #000; padding: 20px; }
#start { background: rgba(0, 0, 0, 0.85); }
#start h1 { font-size: 56px; margin: 0; }
#start p, #end p { font-size: 22px; margin: 0; }
#end { display: none; pointer-events: none; justify-content: flex-end; padding-bottom: 40px; }
#end.show { display: flex; }
#end button { display: none; pointer-events: auto; margin-top: 10px; }
#end.ready button { display: block; animation: pop 0.4s ease-out; }
#medal { width: 130px; height: 130px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 70px; font-weight: bold; color: #222; border: 8px solid rgba(255, 255, 255, 0.7); animation: medal 1.2s ease-out both; }
#end h2 { font-size: 50px; margin: 0; animation: pop 0.6s 0.8s ease-out both; }
#end p { animation: pop 0.6s 1.6s ease-out both; }
.confetti { position: fixed; top: -20px; width: 10px; height: 16px; animation: fall linear forwards; }
@keyframes medal { 0% { transform: scale(0) rotate(-540deg); } 70% { transform: scale(1.3) rotate(20deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes pop { 0% { transform: scale(0); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

#boost { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; color: #fff; font-weight: bold; font-size: 20px; text-shadow: 0 2px 4px #000; pointer-events: none; }
#boostbar { width: 300px; height: 24px; border: 3px solid #fff; border-radius: 14px; background: rgba(0, 0, 0, 0.5); overflow: hidden; }
#boostfill { height: 100%; width: 100%; background: linear-gradient(90deg, #29b6f6, #ffb300); transition: width 0.15s; }
#boostpct { min-width: 56px; }
#boost.on #boostfill { background: linear-gradient(90deg, #ff6d00, #ffeb3b); }
#boost.gain { animation: gain 0.5s ease-out; }
@keyframes gain { 0% { transform: translateX(-50%) scale(1.25); filter: brightness(1.8); } 100% { transform: translateX(-50%) scale(1); } }
#boostlabel { white-space: nowrap; }

#keys { position: fixed; left: 12px; top: 50%; transform: translateY(-50%); padding: 14px 16px; border-radius: 12px; background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 17px; line-height: 1.5; pointer-events: none; }
#keys h3 { margin: 0 0 6px; font-size: 22px; }
#keys p { margin: 0; }

#minimap { position: fixed; top: 12px; right: 12px; background: rgba(20, 30, 20, 0.55); border: 2px solid #fff; border-radius: 10px; pointer-events: none; }
#fireworks { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#start { z-index: 10; }
#start h1 { font-size: 44px; }
#cards { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.card { cursor: pointer; background: rgba(0, 0, 0, 0.5); border: 4px solid transparent; border-radius: 12px; padding: 8px; font-size: 20px; font-weight: bold; }
.card canvas { display: block; border-radius: 8px; margin-bottom: 6px; }
.card:hover { border-color: #aaa; }
.card.sel { border-color: #ffd700; background: rgba(255, 215, 0, 0.25); }
#go { font-size: 34px; padding: 10px 50px; }
#minimap { width: 210px; height: 89px; }

#endbtns { display: flex; gap: 14px; justify-content: center; }
#end.ready #endbtns button { display: block; }
#endbtns button { display: none; pointer-events: auto; }
#lobby { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(0, 0, 0, 0.85); color: #fff; text-align: center; z-index: 12; font-size: 22px; }
#lobby h1 { margin: 0; font-size: 44px; }
#lobby p { margin: 0; }
#lobby > div { display: flex; flex-direction: column; align-items: center; gap: 14px; }
#lobby input { font-size: 30px; width: 130px; text-align: center; border-radius: 10px; border: 3px solid #ffd700; padding: 8px; }
.joinrow { display: flex; gap: 10px; align-items: center; }
#lobby ul { list-style: none; padding: 0; margin: 0; font-size: 24px; }
#lobby button.small { font-size: 18px; padding: 6px 18px; }
#lobbycode { font-size: 44px; color: #ffd700; letter-spacing: 6px; }
#modes { display: flex; gap: 12px; margin: 10px 0; }
#modes button { font-size: 22px; padding: 6px 26px; border: 4px solid transparent; }
#modes button.sel { border-color: #ffd700; background: rgba(255, 215, 0, 0.35); }
#ask { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); display: none; flex-direction: column; gap: 10px; align-items: center; background: rgba(0, 0, 0, 0.9); color: #fff; border: 3px solid #ffd700; border-radius: 12px; padding: 14px 20px; z-index: 20; font-size: 20px; text-align: center; }
#ask p { margin: 0; }
#ask button { margin: 0 6px; }
#askstate { margin: 0; font-size: 20px; min-height: 24px; }
