html, body {
  height: 100%;
  margin: 0;
  background: #000;
  color: #e8eef7;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

#app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #0b1220;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.title { font-weight: 700; letter-spacing: 0.2px; }
.status { opacity: 0.85; font-size: 14px; }

.main {
  height: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.screen {
  width: min(560px, 92vw);
  padding: 12px;
}

.screen.hidden{display:none !important;}

.card {
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 12px;
  padding: 14px;
  align-items: center;
  backdrop-filter: blur(6px);
}

h2 { margin: 0 0 10px 0; font-size: 18px; }

.row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

input, select, button {
  font: inherit;
  color: inherit;
}

input, select {
  background: #000;
  border: 1px solid #fff;
  border-radius: 0;
  padding: 10px 12px;
  outline: none;
}

button {
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  border-radius: 0;
  padding: 10px 12px;
}

button.primary {
  background: rgba(80, 160, 255, 0.20);
  border-color: rgba(80, 160, 255, 0.45);
}

button:active { transform: translateY(1px); }

.split {
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.hint {
  margin: 10px 0 0;
  opacity: 0.85;
  font-size: 14px;
  line-height: 1.3;
}

.code {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 3px;
}

.label { opacity: 0.85; font-size: 12px; }
.lobbyRow {
  display:flex;
  justify-content: space-between;
  align-items:flex-end;
  gap: 10px;
  margin-bottom: 10px;
}
.lobbyRow .right { text-align: right; }
.players {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}
.playerChip {
  display:flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  font-size: 14px;
}

/* Game screen */
#screen-game {
  /* Ensure the live game always fills the viewport (restores original layout) */
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  -ms-touch-action: none;
  overscroll-behavior: none;
}

.controls {
  position: absolute;
  inset: auto 0 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 14px;
  pointer-events: none;
}

.joyZone {
  position: relative;
  width: 44vw;
  max-width: 260px;
  aspect-ratio: 1 / 1;
  pointer-events: auto;
  touch-action: none;
}

.joyBase, .joyStick {
  position: absolute;
  border-radius: 999px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.joyBase {
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
}

.joyStick {
  width: 44%;
  height: 44%;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
}

.fireBtn {
  pointer-events: auto;
  width: 26vw;
  max-width: 160px;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  background: rgba(255, 80, 80, 0.18);
  border-color: rgba(255, 80, 80, 0.40);
  font-weight: 800;
  letter-spacing: 0.8px;
}

.hud {
  z-index: 20;
  position: absolute;
  inset: 12px 12px auto 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
  font-size: 14px;
  opacity: 0.95;
  text-shadow: 0 1px 0 rgba(0,0,0,0.6);
}

.banner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-weight: 800;
  font-size: 22px;
  background: linear-gradient(to bottom, rgba(5,7,10,0.0), rgba(5,7,10,0.35), rgba(5,7,10,0.0));
}

.banner.hidden{display:none !important;}


.joyZoneRight {
  justify-self: end;
}


.hud {
  z-index: 20;
  position: absolute;
  inset: 10px 10px auto 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.hudLeft, .hudRight {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 10px 12px;
  backdrop-filter: blur(6px);
}

.hudLeft { max-width: 55%; }
.hudRight { width: 44%; max-width: 340px; }

.hudLine {
  font: 13px system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: rgba(255,255,255,0.92);
  line-height: 1.25;
  margin: 2px 0;
}

.hudTitle {
  font: 12px system-ui, -apple-system, Segoe UI, Roboto, Arial;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.8);
  margin-bottom: 6px;
}

#scoreboard {
  display: grid;
  gap: 4px;
  min-height: 60px;
}

.scoreRow {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  font: 12px system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: rgba(255,255,255,0.9);
}

.scoreRow .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scoreRow .k { color: rgba(180,255,180,0.95); text-align: right; min-width: 34px; }
.scoreRow .d { color: rgba(255,190,190,0.95); text-align: right; min-width: 34px; }

.finalTable {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.finalRow {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  font: 13px system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: rgba(255,255,255,0.92);
}

.finalRow .rank { width: 28px; text-align: right; color: rgba(255,255,255,0.75); }
.finalRow .k { color: rgba(180,255,180,0.95); text-align: right; min-width: 42px; }
.finalRow .d { color: rgba(255,190,190,0.95); text-align: right; min-width: 42px; }


.lobbyPlayers {
  display: grid;
  gap: 6px;
}

.lobbyPlayerPill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.92);
  font: 13px system-ui, -apple-system, Segoe UI, Roboto, Arial;
  width: fit-content;
  max-width: 100%;
}

.waitingStart {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.82);
  font: 13px system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.respawnOverlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.95);
  font: 22px system-ui, -apple-system, Segoe UI, Roboto, Arial;
  text-align: center;
  pointer-events: none;
  z-index: 30;
}

.scoreRow { grid-template-columns: 1fr auto auto auto; }
.scoreRow .p { color: rgba(210,210,255,0.95); text-align: right; min-width: 42px; }

.gameoverOverlay{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  background: rgba(0,0,0,0.6);
  z-index: 50;
}

.gameoverOverlay.hidden{display:none !important;}




/* Aim stick lock indicator (red ring around the centre knob) */
.joyStick.locked {
  box-shadow: 0 0 14px rgba(255, 0, 0, 0.40), inset 0 0 10px rgba(255, 0, 0, 0.25);
  border-color: rgba(255, 0, 0, 0.45);
}

.stick.locked{ box-shadow: 0 0 0 4px rgba(255,0,0,0.45), 0 0 22px rgba(255,0,0,0.5); }

.stick.autofire{ box-shadow: 0 0 0 4px rgba(255,0,0,0.55), 0 0 26px rgba(255,0,0,0.6); }

#toast{
  position: fixed;
  top: 16%;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 18px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#toast.show{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

  15%{opacity:1;transform:translateX(-50%) translateY(0) scale(1);}
  80%{opacity:1;transform:translateX(-50%) translateY(0) scale(1);}
  100%{opacity:0;transform:translateX(-50%) translateY(6px) scale(0.99);}
}

/* banner fade behaviour */
.banner{opacity:0; transition:opacity 220ms ease-in-out;}
.banner.show{opacity:1;}

.joyStick.autofire{
  box-shadow: 0 0 14px rgba(255, 0, 0, 0.40), inset 0 0 10px rgba(255, 0, 0, 0.25);
  border-color: rgba(255, 0, 0, 0.45);
}

.val{padding:8px 10px;border-radius:10px;background:rgba(255,255,255,0.06);}

.hostOptions{margin:12px 0;display:grid;gap:10px;}
.hostOptions .row{display:flex;align-items:center;justify-content:space-between;gap:12px;}
.hostOptions .lbl{opacity:0.9;}
.sel{padding:8px 10px;border-radius:10px;background:rgba(255,255,255,0.06);color:#fff;border:1px solid rgba(255,255,255,0.14);}

.select{width:100%;padding:10px;border-radius:10px;background:rgba(255,255,255,0.06);color:#fff;border:1px solid rgba(255,255,255,0.15);}

.splashWrap{display:flex;flex-direction:column;gap:16px;align-items:center;justify-content:center;height:100%;padding:20px;box-sizing:border-box;}
.splashImg{width:min(640px, 120vw);max-height:70vh;object-fit:cover;border-radius:18px;border:1px solid rgba(255,255,255,0.12);
}
.splashBtnsRow{display:flex;gap:14px;width:min(520px, 92vw);justify-content:center;}
.splashBtnsRow .btn{flex:1;}
.panel{width:min(520px, 92vw);margin:0 auto;padding:18px;border-radius:18px;background:rgba(0,0,0,0.35);border:1px solid rgba(255,255,255,0.12);}
.panelTitle{font-weight:700;letter-spacing:0.06em;margin-bottom:12px;}
.row{display:flex;align-items:center;gap:12px;margin:10px 0;}
.lbl{flex:0 0 120px;opacity:0.85;}
.input,.select{flex:1;min-width:0;}
.btnRow{display:flex;gap:12px;margin-top:16px;align:center;}
.btnRow .btn{flex:1;}
.hint{min-height:18px;margin-top:10px;opacity:0.85;font-size:14px;}

.hudLeft #hudTime{font-size:28px;font-weight:900;letter-spacing:0.5px;}
.hudLeft{gap:6px;}
#hudRightTitle{margin-bottom:6px;font-size:16px;font-weight:800;}
.scoreRow{display:flex;gap:10px;align-items:center;justify-content:space-between;padding:6px 8px;}
.scoreRow .name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.scoreRow .p{width:52px;text-align:right;font-weight:800;}
.scoreRow.me{background:rgba(255,255,255,0.06);border-radius:10px; outline:1px solid rgba(255,255,255,0.08);}

.banner.big{font-size:64px;font-weight:900;letter-spacing:2px;text-shadow:0 0 18px rgba(255,255,255,0.15);}
.finalRow.head{opacity:0.85;font-weight:900;}
.finalRow.me{background:rgba(255,255,255,0.06);border-radius:10px;}


/* Image buttons */
.imgBtn{
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  justify-items: center;
}
.imgBtn img{
  display: block;
  /* Reduce image button footprint (~50% smaller than previous build) */
  width: min(180px, 40vw);
  height: auto;
}

/* Splash screen: full black and no extra framing */
.splashWrap{
  background: transparent;
}
.splashImg{
  border: none !important;
  box-shadow: none !important;
}

/* Options screen panel: remove border box */
.optionsPanel{
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* End buttons on Game Over */
.endBtns{
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: 14px;
}

/* HUD: remove timer box border/background */
.hudLeft{
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

#hostTitle{ text-align:center; }

.finalRow .p, .finalRow .k, .finalRow .d { text-align: center !important; }
