:root {
  --ink: #1d1a16;
  --paper: #fff8ea;
  --hazard: #ffc21a;
  --panel: rgba(29, 26, 22, 0.78);
  --text: #fff8ea;
  --muted: #d9ccb4;
  --red: #ff5a4f;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fd3ff; font-family: Nunito, system-ui, sans-serif; color: var(--text); }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: none; }
[hidden] { display: none !important; }

.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20, 30, 40, 0.45); backdrop-filter: blur(3px); z-index: 20; padding: 16px; }
.card { position: relative; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--paper); color: var(--ink); border-radius: 18px; padding: 34px 30px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.stripes { position: absolute; left: 0; right: 0; top: 0; height: 12px; border-radius: 18px 18px 0 0; background: repeating-linear-gradient(-45deg, var(--hazard) 0 16px, var(--ink) 16px 32px); }
h1 { font-family: "Lilita One", Nunito, sans-serif; font-weight: 400; font-size: 40px; margin: 4px 0 10px; letter-spacing: .5px; }
.lead { font-size: 16px; line-height: 1.45; margin: 0 0 10px; }
.lead.small { font-size: 14px; color: #5b5145; }
label { display: block; font-weight: 800; margin: 18px 0 8px; font-size: 14px; }
input { display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 18px; padding: 12px 14px; border-radius: 10px; border: 2px solid #d8ccb7; background: #fff; color: var(--ink); }
input:focus { outline: none; border-color: var(--hazard); }
button { font: inherit; font-weight: 800; font-size: 18px; border: 0; border-radius: 12px; padding: 13px 18px; background: var(--hazard); color: var(--ink); cursor: pointer; width: 100%; margin-top: 12px; box-shadow: 0 4px 0 #c99400; }
button:active { transform: translateY(2px); box-shadow: 0 2px 0 #c99400; }
button.ghost { background: transparent; box-shadow: none; border: 2px solid #d8ccb7; font-size: 14px; padding: 8px 12px; width: auto; margin: 0; }
.invite { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: 14px; color: #5b5145; }
.steps { margin: 16px 0 0; padding-left: 20px; font-size: 13.5px; line-height: 1.45; color: #4a4137; }
.steps li { margin-bottom: 6px; }
#win-table { width: 100%; border-collapse: collapse; margin: 14px 0 4px; font-size: 15px; }
#win-table th, #win-table td { text-align: right; padding: 6px 8px; border-bottom: 1px solid #e6dcc9; }
#win-table th:first-child, #win-table td:first-child { text-align: left; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; box-shadow: 0 0 0 2px rgba(0,0,0,.2); }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#objective { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--panel); border-radius: 14px; padding: 10px 16px 12px; text-align: center; min-width: 280px; max-width: calc(100vw - 32px); border-top: 5px solid var(--hazard); }
#obj-title { font-family: "Lilita One", sans-serif; font-size: 20px; letter-spacing: .3px; }
#obj-chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.chip { display: flex; align-items: center; gap: 7px; background: rgba(255,255,255,.1); border-radius: 999px; padding: 4px 11px 4px 6px; font-weight: 800; font-size: 14px; }
.chip.done { background: rgba(80, 200, 120, .35); }
.chip .bar { width: 70px; height: 7px; border-radius: 4px; background: rgba(255,255,255,.18); overflow: hidden; }
.chip .bar i { display: block; height: 100%; background: var(--hazard); transition: width .25s; }
.sw { width: 16px; height: 16px; border-radius: 4px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }

#team { position: absolute; top: 12px; left: 12px; background: var(--panel); border-radius: 12px; padding: 8px 12px; font-size: 14px; min-width: 170px; }
#team .row { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
#team .row .mini { display: flex; gap: 2px; margin-left: auto; }
#team .row .mini i { width: 8px; height: 8px; border-radius: 2px; display: block; }
#team .me { font-weight: 800; }
#topright { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#timer { background: var(--panel); border-radius: 10px; padding: 6px 12px; font-family: "Lilita One", sans-serif; font-size: 20px; }
#minimap { background: var(--panel); border-radius: 12px; }

#feed { position: absolute; left: 12px; bottom: 96px; display: flex; flex-direction: column; gap: 5px; max-width: min(420px, 60vw); }
.ev { background: var(--panel); padding: 6px 10px; border-radius: 9px; font-size: 14px; animation: evin .25s ease-out; transition: opacity .6s; }
.ev.warn { border-left: 4px solid var(--red); }
.ev.good { border-left: 4px solid #57d38c; }
.ev.gold { border-left: 4px solid var(--hazard); }
@keyframes evin { from { transform: translateX(-20px); opacity: 0; } }

#bottom { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
#hint { background: var(--hazard); color: var(--ink); font-weight: 800; padding: 6px 14px; border-radius: 999px; font-size: 15px; box-shadow: 0 3px 0 #c99400; white-space: nowrap; }
#hint:empty { display: none; }
#carry { display: flex; align-items: center; gap: 12px; background: var(--panel); padding: 8px 12px; border-radius: 12px; }
#carry-items { display: flex; gap: 4px; min-width: 40px; }
#carry-items i { width: 22px; height: 22px; border-radius: 5px; display: block; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); }
#carry-items i.heavy { width: 30px; }
#carry-items .none { color: var(--muted); font-size: 13px; }
#load { width: 80px; height: 9px; background: rgba(255,255,255,.15); border-radius: 5px; overflow: hidden; }
#load-bar { height: 100%; width: 0; background: linear-gradient(90deg, #57d38c, var(--hazard), var(--red)); background-size: 90px 100%; transition: width .2s; }
#buffs { display: flex; gap: 6px; font-size: 13px; font-weight: 800; }
#buffs span { background: rgba(255,255,255,.12); padding: 2px 8px; border-radius: 999px; }
#help { position: absolute; right: 12px; bottom: 14px; background: var(--panel); padding: 7px 11px; border-radius: 10px; font-size: 12px; color: var(--muted); max-width: 330px; line-height: 1.5; }
#help b { color: var(--text); }
#banner { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%) scale(.8); font-family: "Lilita One", sans-serif; font-size: clamp(30px, 6vw, 64px); color: var(--hazard); text-shadow: 0 4px 0 var(--ink), 0 0 30px rgba(0,0,0,.4); opacity: 0; transition: opacity .3s, transform .3s; text-align: center; white-space: nowrap; }
#banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#banner small { display: block; font-family: Nunito, sans-serif; font-weight: 800; font-size: 20px; color: var(--text); text-shadow: 0 2px 6px rgba(0,0,0,.6); margin-top: 4px; }
#flash { position: absolute; inset: 0; background: radial-gradient(transparent 40%, rgba(255, 40, 40, .55)); opacity: 0; transition: opacity .5s; }
#flash.on { opacity: 1; transition: none; }

@media (max-width: 760px) {
  #help, #minimap { display: none; }
  #team { top: auto; bottom: 130px; }
  #objective { top: 8px; min-width: 0; width: calc(100vw - 120px); left: 12px; transform: none; }
}

.lobby-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; align-items: stretch; }
.lobby-row > button { margin: 0; }
.code-join { display: flex; gap: 6px; }
.code-join input { margin: 0; text-transform: uppercase; letter-spacing: 4px; text-align: center; font-weight: 800; min-width: 0; }
.code-join button { margin: 0; width: auto; }
button.secondary { background: #2b2620; color: var(--paper); box-shadow: 0 4px 0 #000; }
#lobby-invite button { margin-top: 4px; }
.error { color: #c0392b; font-weight: 800; font-size: 14px; min-height: 18px; margin-top: 8px; }
.tr-row { display: flex; gap: 8px; align-items: stretch; }
#lobby-badge { background: var(--panel); border-radius: 10px; padding: 6px 10px; font-size: 14px; display: flex; align-items: center; gap: 8px; pointer-events: auto; }
#lobby-badge b { font-family: "Lilita One", sans-serif; letter-spacing: 2px; font-size: 18px; color: var(--hazard); }
.mini-btn { width: auto; margin: 0; padding: 4px 8px; font-size: 12px; border-radius: 7px; box-shadow: none; }
.meter { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 800; }
#stamina, #cooldown { width: 70px; height: 9px; background: rgba(255,255,255,.15); border-radius: 5px; overflow: hidden; }
#stamina-bar { height: 100%; width: 100%; background: #5ef0ff; }
#cooldown-bar { height: 100%; width: 100%; background: #fff8ea; }
#cooldown-bar.ready { background: #57d38c; }
@media (max-width: 760px) { .lobby-row { grid-template-columns: 1fr; } #lobby-badge .mini-btn { display: none; } }
#fps { background: var(--panel); border-radius: 8px; padding: 3px 9px; font-size: 12px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
#fps.good { color: #7ee2a8; } #fps.ok { color: var(--hazard); } #fps.bad { color: var(--red); }
@media (max-width: 1180px) { #help { display: none; } }
#reticle { position: fixed; left: 0; top: 0; width: 34px; height: 34px; margin: -17px 0 0 -17px; pointer-events: none; z-index: 30; will-change: transform; }
#reticle i { position: absolute; inset: 4px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.65), inset 0 0 0 2px rgba(0,0,0,.45); transition: transform .08s; }
#reticle b { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #ffc21a; box-shadow: 0 0 0 2px rgba(0,0,0,.7); }
#reticle.cool i { border-color: rgba(255,255,255,.45); }
#reticle.charging i { border-color: #ffc21a; }
#reticle.off { display: none; }
#tool { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 9px; background: rgba(255,255,255,.08); font-weight: 800; font-size: 13px; min-width: 120px; }
#tool.has { background: rgba(255,194,26,.22); box-shadow: inset 0 0 0 2px var(--hazard); }
#tool .ico { font-size: 18px; }
#tool .empty { color: var(--muted); font-weight: 600; }
#tool kbd { margin-left: auto; background: var(--hazard); color: var(--ink); border-radius: 5px; padding: 1px 6px; font: 800 12px Nunito, sans-serif; }
#ink { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .6s;
  background: radial-gradient(circle at 22% 30%, rgba(27,42,107,.75) 0 7%, transparent 8%), radial-gradient(circle at 75% 65%, rgba(27,42,107,.7) 0 9%, transparent 10%), radial-gradient(circle at 60% 20%, rgba(27,42,107,.6) 0 4%, transparent 5%), radial-gradient(transparent 55%, rgba(27,42,107,.45)); }
#ink.on { opacity: 1; transition: opacity .1s; }
#update { position: absolute; top: 120px; left: 50%; transform: translateX(-50%); background: var(--hazard); color: var(--ink); font-weight: 800; padding: 8px 12px; border-radius: 10px; pointer-events: auto; display: flex; gap: 10px; align-items: center; box-shadow: 0 4px 0 #c99400; }
#update .mini-btn { background: var(--ink); color: var(--paper); }
#ping { background: var(--panel); border-radius: 8px; padding: 3px 9px; font-size: 12px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: auto; cursor: help; }
#ping.good { color: #7ee2a8; } #ping.ok { color: var(--hazard); } #ping.bad { color: var(--red); }
#team .ping { font-size: 11px; font-weight: 800; margin-left: 6px; font-variant-numeric: tabular-nums; }
#team .ping.good { color: #7ee2a8; } #team .ping.ok { color: var(--hazard); } #team .ping.bad { color: var(--red); }
