* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1c2c; color: #eee; font-family: "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; background: #9fc4e0; }
#minimap { position: fixed; right: 10px; bottom: 10px; z-index: 6; pointer-events: none; display: none; }
#crosshair { position: fixed; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; z-index: 7; pointer-events: none; }
#crosshair::before, #crosshair::after { content: ""; position: absolute; background: rgba(255,255,255,0.9); box-shadow: 0 0 2px #000; }
#crosshair::before { left: 8px; top: 0; width: 2px; height: 18px; }
#crosshair::after { top: 8px; left: 0; width: 18px; height: 2px; }
#storm-vignette { position: fixed; inset: 0; z-index: 4; pointer-events: none; box-shadow: inset 0 0 160px 40px rgba(200, 20, 20, 0.55); opacity: 0; transition: opacity .4s; }
body.in-storm #storm-vignette { opacity: 1; }
#lock-hint { position: fixed; left: 50%; top: 58%; transform: translateX(-50%); z-index: 7; background: rgba(0,0,0,.6); padding: 6px 14px; border-radius: 6px; pointer-events: none; }
.hidden { display: none !important; }
.muted { color: #9fb3c8; }
.tiny { font-size: 12px; }
.screen { position: fixed; inset: 0; z-index: 10; }
.btn { background: #24466b; color: #fff; border: 1px solid #3c6a9a; border-radius: 6px; padding: 8px 14px; cursor: pointer; font-size: 14px; }
.btn:hover { background: #2f5a88; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.primary { background: #c0392b; border-color: #e74c3c; }
.btn.primary:hover { background: #d9442f; }
.btn.danger { background: #5a2a2a; border-color: #8a3a3a; }
.btn:disabled { opacity: .5; cursor: default; }
input, select { background: #0f2438; color: #fff; border: 1px solid #3c6a9a; border-radius: 6px; padding: 7px 9px; font-size: 14px; }
input[type=number] { width: 80px; }
h1 { margin: 0 0 4px; font-size: 40px; letter-spacing: 1px; text-shadow: 0 2px 8px #000; }
h2 { margin: 0 0 8px; font-size: 20px; }
h3 { margin: 12px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: #9fb3c8; }
.sub { margin: 0 0 18px; color: #9fb3c8; }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.row label { min-width: 90px; }

#screen-menu { display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(11,28,44,.6), rgba(11,28,44,.95)); }
.menu-box { width: min(760px, 95vw); background: rgba(10, 25, 40, .92); border: 1px solid #2a4a6c; border-radius: 12px; padding: 24px 28px; box-shadow: 0 10px 40px #000; max-height: 95vh; overflow: auto; }
.panel { background: rgba(0,0,0,.25); border: 1px solid #2a4a6c; border-radius: 8px; padding: 12px; margin-top: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #1f3a55; }
th { color: #9fb3c8; font-weight: normal; font-size: 12px; text-transform: uppercase; }
.help { margin-top: 14px; color: #cfd8e3; }
.help li { margin: 4px 0; }
#conn-status { margin-top: 10px; font-size: 12px; }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; }
.modal-box { background: #0f2438; border: 1px solid #3c6a9a; border-radius: 10px; padding: 20px 24px; width: min(420px, 95vw); }
.modal-box label { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

#screen-lobby { pointer-events: none; }
#screen-lobby > * { pointer-events: auto; }
.lobby-top { position: absolute; top: 0; left: 0; right: 0; padding: 10px 16px; background: linear-gradient(rgba(0,0,0,.7), rgba(0,0,0,0)); display: flex; justify-content: space-between; align-items: center; }
#lobby-title { font-size: 20px; font-weight: bold; }
#lobby-status { font-size: 18px; padding: 6px 14px; background: rgba(0,0,0,.5); border-radius: 8px; }
#lobby-status.hot { background: #c0392b; }
.lobby-left, .lobby-right { position: absolute; top: 60px; bottom: 40px; width: 270px; background: rgba(8, 20, 34, .88); border: 1px solid #2a4a6c; border-radius: 10px; padding: 10px 12px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2a4a6c #0b1c2c; }
.lobby-right h3 { margin-top: 8px; }
.lobby-right .row { margin: 4px 0; }
.lobby-right .row input { flex: 1; min-width: 0; }
.lobby-left { left: 12px; }
.lobby-right { right: 12px; }
.lobby-left ul, .lobby-right ul { list-style: none; margin: 0; padding: 0; }
.lobby-left li { padding: 4px 6px; border-radius: 4px; display: flex; justify-content: space-between; }
.lobby-left li.me { background: rgba(255,255,255,.08); }
.tag { font-size: 11px; background: #2a4a6c; border-radius: 4px; padding: 1px 6px; margin-left: 4px; }
.lobby-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.lobby-actions .btn { padding: 6px 10px; }
.lobby-hint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.5); padding: 4px 12px; border-radius: 6px; font-size: 12px; color: #cfd8e3; }
#host-settings label { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin: 3px 0; font-size: 12px; }
#host-settings select { padding: 3px 6px; font-size: 12px; }
#host-settings input[type=number] { width: 64px; padding: 4px 6px; }
#lobby-settings { font-size: 12px; line-height: 1.5; }

#screen-teams { display: flex; align-items: center; justify-content: center; background: rgba(5, 12, 20, .85); }
.teams-box { text-align: center; width: min(900px, 95vw); }
.teams-box h2 { font-size: 30px; }
#teams-mine { font-size: 22px; margin: 10px 0 18px; padding: 12px; border-radius: 10px; background: rgba(255,255,255,.08); }
#teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.team-card { border: 2px solid; border-radius: 8px; padding: 8px; background: rgba(0,0,0,.4); text-align: left; }
.team-card.mine { box-shadow: 0 0 16px #fff4; }
.team-card .tname { font-weight: bold; margin-bottom: 4px; }
.team-card .tm { font-size: 13px; }

#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; font-size: 13px; }
#hud-top { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); text-align: center; }
#hud-storm { background: rgba(0,0,0,.55); padding: 4px 14px; border-radius: 6px; font-size: 15px; }
#hud-storm.warn { background: rgba(160, 30, 30, .8); }
#hud-alive { margin-top: 4px; background: rgba(0,0,0,.45); padding: 2px 10px; border-radius: 6px; display: inline-block; }
#hud-feed { position: absolute; top: 8px; left: 10px; width: 320px; }
#hud-feed div { background: rgba(0,0,0,.5); margin-bottom: 3px; padding: 2px 8px; border-radius: 4px; }
#hud-team { position: absolute; top: 8px; right: 10px; width: 210px; }
#hud-team .tm { background: rgba(0,0,0,.5); margin-bottom: 3px; padding: 3px 8px; border-radius: 4px; }
#hud-team .tm.dead { opacity: .55; }
.bar { height: 6px; background: #333; border-radius: 3px; overflow: hidden; margin-top: 2px; }
.bar > i { display: block; height: 100%; background: #2ecc71; }
.bar > i.hull { background: #e67e22; }
#hud-center { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); text-align: center; font-size: 22px; text-shadow: 0 2px 6px #000; }
#hud-center small { display: block; font-size: 14px; color: #cfd8e3; margin-top: 6px; }
#hud-hint { position: absolute; bottom: 130px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); padding: 6px 14px; border-radius: 6px; font-size: 15px; }
#hud-hint:empty { display: none; }
#hud-bottom { position: absolute; bottom: 30px; left: 10px; display: flex; gap: 10px; align-items: flex-end; }
#hud-player, #hud-ship { background: rgba(0,0,0,.55); padding: 8px 12px; border-radius: 8px; min-width: 200px; }
#hud-ship:empty, #hud-team:empty { display: none; }
#hud-ship.storm { outline: 2px solid #e74c3c; }
#hud-controls { position: absolute; bottom: 6px; left: 10px; font-size: 11px; color: #9fb3c8; }
#hud-spec { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); padding: 6px 14px; border-radius: 6px; text-align: center; }
#scoreboard { position: absolute; top: 90px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.8); padding: 12px 16px; border-radius: 8px; min-width: 460px; max-height: 70vh; overflow: auto; }
#scoreboard table td, #scoreboard table th { padding: 3px 8px; }

#screen-results { display: flex; align-items: center; justify-content: center; background: rgba(5, 12, 20, .85); }
.results-box { width: min(700px, 95vw); background: rgba(10,25,40,.95); border: 1px solid #2a4a6c; border-radius: 12px; padding: 20px 24px; text-align: center; }
.results-box h2 { font-size: 28px; }
#results-table table { margin: 10px 0; }

#chat { position: fixed; left: 10px; bottom: 150px; width: 320px; z-index: 20; pointer-events: none; }
#chat-log { max-height: 160px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; font-size: 13px; }
#chat-log div { background: rgba(0,0,0,.45); margin-top: 2px; padding: 2px 8px; border-radius: 4px; word-break: break-word; }
#chat-log .sys { color: #f1c40f; }
#chat-log .team { color: #7fdcff; }
#chat-input { width: 100%; margin-top: 4px; pointer-events: auto; opacity: .55; }
#chat-input:focus { opacity: 1; }
#toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #c0392b; color: #fff; padding: 8px 16px; border-radius: 8px; z-index: 100; }

#hud-weapons { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.wslot { background: rgba(0,0,0,.6); border: 1px solid #3c6a9a; border-radius: 6px; padding: 5px 10px; min-width: 96px; font-size: 13px; position: relative; }
.wslot.sel { border-color: #ffe066; box-shadow: 0 0 8px #ffe06688; background: rgba(40,40,10,.75); }
.wslot.none { opacity: .4; }
.wslot .wn { color: #9fb3c8; margin-right: 6px; font-size: 11px; }
.wslot .wa { float: right; color: #ffe066; margin-left: 8px; }

#spyglass { position: fixed; inset: 0; z-index: 8; pointer-events: none; display: none; background: radial-gradient(circle at center, transparent 0, transparent 37vmin, rgba(0,0,0,.35) 38.5vmin, #000 40vmin); }
#spyglass::before, #spyglass::after { content: ""; position: absolute; left: 50%; top: 50%; background: rgba(0,0,0,.55); }
#spyglass::before { width: 1px; height: 12vmin; margin: -6vmin 0 0 0; }
#spyglass::after { height: 1px; width: 12vmin; margin: 0 0 0 -6vmin; }
#spy-zoom { position: absolute; left: 50%; top: calc(50% + 31vmin); transform: translateX(-50%); color: #e8dcc0; font-size: 13px; text-shadow: 0 0 3px #000; }
body.spy #spyglass { display: block; }
#scope { position: fixed; inset: 0; z-index: 8; pointer-events: none; display: none; background: radial-gradient(circle at center, transparent 0, transparent 40vmin, rgba(0,0,0,.92) 41.2vmin, #000 46vmin); }
#scope-reticle { position: absolute; left: 50%; top: 50%; width: 80vmin; height: 80vmin; transform: translate(-50%, -50%); border-radius: 50%; box-shadow: inset 0 0 6vmin rgba(0,0,0,.55); background:
  radial-gradient(circle at center, rgba(255,60,40,.95) 0, rgba(255,60,40,.95) .3vmin, transparent .34vmin),
  linear-gradient(#0b0b0b, #0b0b0b) center / 1.5px 100% no-repeat,
  linear-gradient(#0b0b0b, #0b0b0b) center / 100% 1.5px no-repeat,
  linear-gradient(#0b0b0b, #0b0b0b) left center / 30% 4px no-repeat,
  linear-gradient(#0b0b0b, #0b0b0b) right center / 30% 4px no-repeat,
  linear-gradient(#0b0b0b, #0b0b0b) center bottom / 4px 32% no-repeat; }
#scope-zoom { position: absolute; left: 50%; top: calc(50% + 42vmin); transform: translateX(-50%); color: #e8dcc0; font-size: 13px; text-shadow: 0 0 3px #000; white-space: nowrap; }
body.scope #scope { display: block; }
body.scope #crosshair { display: none; }
body.spy #crosshair { display: none; }
#bigmap { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 9; pointer-events: none; display: none; border-radius: 8px; box-shadow: 0 0 0 2px #3c6a9a, 0 10px 40px rgba(0,0,0,.6); background: rgba(6,16,28,.92); }
#keys-list { max-height: 56vh; overflow-y: auto; padding-right: 6px; scrollbar-width: thin; }
.keybtn { min-width: 110px; }
.mod { display: flex; gap: 4px; margin-left: auto; padding-left: 6px; }
.btn.mini { padding: 1px 7px; font-size: 11px; }
#bans-box h3 { margin: 10px 0 4px; }
#lobby-bans li { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 12px; }
#loading { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, #143250 0%, #0b1c2c 70%); transition: opacity .4s; }
#loading.done { opacity: 0; pointer-events: none; }
.loading-box { width: min(420px, 80vw); text-align: center; }
.loading-bar { height: 10px; border-radius: 5px; background: rgba(0,0,0,.4); border: 1px solid #2a4a6c; overflow: hidden; }
#loading-fill { height: 100%; width: 0; background: linear-gradient(90deg, #d9a441, #f3d27a); transition: width .2s; }
#loading-text { margin: 14px 0 8px; font-size: 16px; }
.loading-note { margin-top: 12px; font-size: 12px; opacity: .6; }
