* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #7ec8f0; font-family: "Avenir Next", "Nunito", "Segoe UI", system-ui, sans-serif; color: #24331b; -webkit-user-select: none; user-select: none; touch-action: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

.panel { background: rgba(255, 251, 238, .82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: 18px; box-shadow: 0 6px 24px rgba(30, 60, 20, .22); padding: 12px 16px; }
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button, #hud canvas { pointer-events: auto; }
#me { position: absolute; top: 14px; left: 14px; min-width: 170px; }
#me .row { display: flex; align-items: center; gap: 8px; font-size: 15px; }
#me .big { font-size: 38px; font-weight: 800; line-height: 1.1; color: #2f5d1e; }
#me .big small { font-size: 14px; font-weight: 600; color: #6a7d5c; }
#me .sub { font-size: 13px; color: #5b6b4d; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; box-shadow: inset 0 -2px 3px rgba(0,0,0,.25); }

#board { position: absolute; top: 14px; right: 14px; min-width: 190px; max-width: 240px; font-size: 14px; }
#board .title { font-weight: 800; margin-bottom: 6px; color: #3c5a26; }
#board ol { list-style: none; }
#board li { display: flex; align-items: center; gap: 7px; padding: 3px 0; }
#board li .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#board li .sc { font-weight: 800; }
#board li.me .nm { font-weight: 800; }
#board li.dead { opacity: .45; }

#feed { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.toast { background: rgba(255, 251, 238, .9); padding: 7px 16px; border-radius: 99px; font-size: 14px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.15); animation: toast 4s forwards; white-space: nowrap; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-10px) scale(.9); } 8% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-6px); } }

#minimap { position: absolute; right: 14px; bottom: 14px; width: 176px; height: 176px; border-radius: 18px; box-shadow: 0 6px 24px rgba(30, 60, 20, .3); border: 3px solid rgba(255, 251, 238, .85); }
#buttons { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 8px; }
#buttons button { width: 46px; height: 46px; border-radius: 14px; border: 0; font-size: 20px; background: rgba(255, 251, 238, .85); box-shadow: 0 4px 14px rgba(0,0,0,.18); cursor: pointer; }
#buttons button:active { transform: scale(.93); }
#hint { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); font-size: 13px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.6); white-space: nowrap; transition: opacity 1s; }

#deathMsg { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); text-align: center; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.6); animation: pop .4s; }
#deathText { font-size: 30px; font-weight: 800; }
#deathCount { font-size: 18px; margin-top: 6px; opacity: .9; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }

.touchzone { position: absolute; top: 0; bottom: 0; width: 50%; pointer-events: auto; }
#touchL { left: 0; } #touchR { right: 0; }
#hud > *:not(.touchzone) { z-index: 2; }
#hurtFx { position: fixed; inset: 0; pointer-events: none; opacity: 0; z-index: 1; background: radial-gradient(ellipse at center, rgba(200, 0, 0, 0) 50%, rgba(190, 0, 0, .55) 100%); }
.hearts { margin-left: auto; padding-left: 10px; font-size: 15px; letter-spacing: 1px; white-space: nowrap; }
#btnSprint { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: 76px; height: 76px; border-radius: 50%; border: 0; font-size: 34px; background: rgba(255, 251, 238, .85); box-shadow: 0 4px 14px rgba(0,0,0,.25); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#btnSprint.on { background: #ffd23a; box-shadow: 0 0 0 4px rgba(255, 210, 58, .45), 0 4px 14px rgba(0,0,0,.25); }

#lobby { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(ellipse at center, rgba(255,255,255,0) 30%, rgba(20,50,10,.35)); overflow-y: auto; }
#lobby .card { width: min(640px, 100%); background: rgba(255, 251, 238, .9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-radius: 28px; padding: 28px 30px; box-shadow: 0 20px 60px rgba(20, 50, 10, .35); animation: rise .7s cubic-bezier(.2,1.4,.4,1); max-height: calc(100vh - 32px); overflow-y: auto; }
@keyframes rise { from { transform: translateY(40px) scale(.95); opacity: 0; } }
h1 { font-size: 46px; font-weight: 900; letter-spacing: -1px; color: #2f6b1e; line-height: 1; }
h1 span { color: #e8892b; }
.tag { margin: 8px 0 18px; color: #556b45; font-size: 15px; }
label, .label { display: block; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: #6a7d5c; margin-bottom: 6px; }
input { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font-size: 18px; border-radius: 14px; border: 2px solid #cfdcb9; background: #fff; font-family: inherit; color: #24331b; outline: none; text-transform: none; letter-spacing: 0; font-weight: 600; -webkit-user-select: text; user-select: text; }
input:focus { border-color: #6fbf4a; }
label { margin-bottom: 16px; }
#colors { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
#colors button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: inset 0 -4px 6px rgba(0,0,0,.25), 0 3px 8px rgba(0,0,0,.15); transition: transform .15s; }
#colors button.sel { border-color: #24331b; transform: scale(1.15); }
.primary { width: 100%; padding: 16px; font-size: 22px; font-weight: 800; border: 0; border-radius: 18px; cursor: pointer; color: #fff; font-family: inherit; background: linear-gradient(180deg, #7fd156, #4a9d2e); box-shadow: 0 6px 0 #357a1f, 0 10px 24px rgba(40, 100, 20, .35); transition: transform .1s; }
.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #357a1f; }
#online { text-align: center; margin: 12px 0 18px; font-size: 14px; color: #556b45; min-height: 18px; }
.cols { display: grid; grid-template-columns: 1fr 1.3fr; gap: 22px; }
#hsList { list-style: none; font-size: 14px; }
#hsList li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
#hsList li .nm { flex: 1; } #hsList li b { font-weight: 800; }
.muted { color: #8a9a7d; }
.help p { font-size: 13px; line-height: 1.45; color: #4b5d3e; margin-bottom: 6px; }
#conn { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #fff8e0; padding: 10px 18px; border-radius: 99px; box-shadow: 0 4px 14px rgba(0,0,0,.2); font-weight: 600; }

@media (max-width: 640px) {
  h1 { font-size: 36px; }
  .cols { grid-template-columns: 1fr; }
  #lobby .card { padding: 22px 18px; }
  #board { min-width: 0; font-size: 12px; padding: 8px 10px; }
  #me { min-width: 0; padding: 8px 12px; }
  #me .big { font-size: 28px; }
  #minimap { width: 110px; height: 110px; bottom: 74px; }
  #hint { display: none; }
}
