/* Global reset & font */
* {
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #170821;
}

/* Starfield background */
#starfield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  background: #170821;
  z-index: 0;
}

/* Full‑screen game canvas */
#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  z-index: 1;
}

/* Main title */
#gameTitle {
  width: 100%;
  text-align: center;
  color: #fff;
  font-size: 3rem;
  letter-spacing: 0;
  text-shadow: 0 0 10px rgba(0,0,0,0.7);
  margin: 0;
  z-index: 1;
}

/* Lobby container */
#lobby {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #fefefe;
  text-align: center;
  z-index: 2;
}

/* Name input */
#lobby input {
  display: block;
  margin: 0 auto 12px;
  padding: 8px;
  width: 240px;
  text-align: center;
  font-size: 1rem;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 4px;
  outline: none;
  cursor: text;
}
#lobby input::placeholder {
  color: rgba(255,255,255,0.7);
}

#lobby select {
  display: block;
  width: 100%;
  padding: 8px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 4px;
  outline: none;
}

#lobby select option {
  color: #10151d;
}

.lobby-settings {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  text-align: left;
}

.lobby-settings label {
  display: grid;
  gap: 5px;
  color: rgba(255,255,255,0.86);
  font-size: 0.9rem;
}

.lobby-settings span {
  font-weight: 700;
}

.lobby-instructions {
  max-width: 320px;
  margin: 10px auto 4px;
  color: rgba(255,255,255,0.72);
  font-size: 0.88rem;
  line-height: 1.35;
}

/* Lobby buttons */
#lobby button {
  margin: 8px;
  padding: 8px 12px;
  font-size: 1rem;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s;
}
#lobby button:hover {
  background: rgba(255,255,255,0.3);
}

/* Start Game button (in‑game host) */
#startBtn {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  font-size: 1rem;
  background: rgba(0,0,0,0.8);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  z-index: 10;
}
#startBtn:hover {
  background: rgba(255,255,255,0.2);
}

/* HUD & minimap */
#hud {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
#minimapContainer {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, calc(100vw - 32px));
  padding: 16px;
  background: rgba(6, 10, 16, 0.84);
  border: 1px solid rgba(190, 215, 245, 0.42);
  border-radius: 8px;
  color: #fff;
  text-align: center;
  z-index: 100;
  pointer-events: auto;
  box-shadow: 0 18px 48px rgba(0,0,0,0.5);
}
#status {
  font-size: 1.2rem;
  margin-bottom: 12px;
}
#tasksSection {
  text-align: left;
  margin-bottom: 12px;
}
#tasksSection h4 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  border-bottom: 1px solid #555;
  padding-bottom: 4px;
}
#taskList {
  list-style: disc inside;
  padding: 0;
  margin: 0;
  max-height: 120px;
  overflow-y: auto;
}
#minimapCanvas {
  display: block;
  margin: 0 auto;
  width: min(620px, calc(100vw - 96px));
  height: min(520px, calc(100vh - 220px));
  border: 2px solid rgba(235,245,255,0.82);
  background: rgba(0,0,0,0.45);
}

/* Role reveal overlay */
#roleOverlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #000;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-size: 2rem;
  visibility: hidden;
  z-index: 200;
  transition: visibility 0s linear 2s;
}
#roleOverlay.visible {
  visibility: visible;
  transition-delay: 0s;
}
#roleOverlay #overlayText {
  margin: 0.5em;
}

/* Role colors */
.impostor {
  color: red;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(0,0,0,0.5);
}
.crewmate {
  color: blue;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(0,0,0,0.5);
}

/* Task container (mini‑game modal) */
#task-container.hidden {
  visibility: hidden;
}


#task-container.open {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: inline-block;              /* shrink‑wrap to content */
  background: #707379;
  border: 4px solid #49494b;
  border-radius: 8px;
  padding: 16px;                       /* a bit more padding */
  box-sizing: content-box;
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
  color: #fff;
  font-family: sans-serif;
  z-index: 1000;
  visibility: visible;

  /* never exceed viewport */
  max-width: 90vw;
  max-height: 90vh;
}

#task-container.open.security-modal {
  width: min(900px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 32px));
  padding: 12px;
  box-sizing: border-box;
}


.close-btn {
  display: none;
  position: absolute;
  top: 8px; right: 8px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 999;
}

#task-container.open > .close-btn {
  display: block;
}

#task-container.hidden > .close-btn,
#task-container:not(.open) > .close-btn {
  display: none;
}

.task-body {
  position: relative;
  margin: 0;
  width: auto;
  height: auto;
  transform-origin: top left;
}

#task-container.open.security-modal .task-body {
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
}

/* Emergency meeting flash */
#emergencyFlash {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 500;
}
#emergencyFlash.flash {
  animation: flashAnim 1s forwards;
}
@keyframes flashAnim {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Meeting/voting UI */
#meetingUI {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 501;
  pointer-events: auto;
}
.meeting-panel {
  background: rgba(255,255,255,0.6);
  padding: 24px;
  border-radius: 8px;
  width: 60%;
  max-width: 1000px;
  height: auto;
  max-height: 800px;
  text-align: center;
  display: flex;
  flex-direction: column;
}
.meeting-panel h2 {
  margin-top: 0;
  text-align: left;
  font-size: 1.5rem;
  padding-bottom: 5px;
}
#voteList {
  text-align: left;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 12px;
}
#voteListWrapper {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  margin-bottom: 30px;
}
#voteList1,
#voteList2 {
  display: flex;
  flex-direction: column;
  max-height: 240px;
  margin: 0 8px;
  width: 45%;
}
.vote-avatar-wrapper {
  display: flex;
  align-items: center;
  margin-right: 8px;
}
.vote-btn {
  width: 64px;
  height: 64px;
  color: rgb(255,49,49);
  background-color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  border: 0;
  float: right;
}
.vote-btn:hover {
  background: rgba(255,255,255,0.3);
}
.vote-option {
  display: inline-flex;
  justify-content: space-between;
  padding: 8px 12px;
  margin: 4px;
  background: rgba(255,255,255,0.7);
  font-weight: bold;
  float: right;
}
.skip-wrapper,
#skipWrapper {
  display: flex;
  flex-direction: row;
  max-width: 250px;
  height: 60px;
  margin-left: 3.33%;
}
#skipVoteBtn {
  background-color: rgba(255,255,255,0.8);
  margin-bottom: 15px;
  padding: 8px 12px;
  width: 100px;
  height: 60px;
  border-radius: 0;
  border-width: 0;
  cursor: pointer;
}
#skipVoteBtn:hover {
  background-color: rgba(255,255,255,0.3);
}

.die {
    color: rgb(255, 58, 58);
    font-weight: bold;
}

#voteTimer {
  font-size: 0.9rem;
  color: #333;
  height: 50%;
  margin-top: 8%;
  margin-left: 5%;
}

/* Completed task styling */
.completed {
  text-decoration: line-through;
  color: rgb(0, 238, 0);
  font-style: italic;
}

.name-tag {
  font-size: 1rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 5px rgba(0,0,0,0.7);
  white-space: nowrap;
}

#taskBarProgress {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

#taskBarProgressFill {
  width: 0%;                /* start empty */
  height: 100%;
  background: #4caf50;       /* green fill */
  transition: width 0.3s ease;
}

#inGameUI {
  display: none;
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  pointer-events: none;   /* allow clicks only on children */
  z-index: 2000;
}

/* TASK BAR */
#taskBar {
  pointer-events: auto;
  background: rgba(0,0,0,0.5);
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  max-width: 200px;
}
#taskBarTitle {
  font-weight: bold;
  margin-bottom: 4px;
}

#ghostNotice {
  display: none;
  margin: 3px 0 7px;
  color: #9fe8ff;
  font-size: 0.82rem;
  line-height: 1.25;
}

#taskBar.ghost #ghostNotice {
  display: block;
}

#inGameTaskList {
  list-style: none;
  margin: 0;
  padding: 0;
}
#inGameTaskList li {
  font-size: 0.9rem;
  margin: 2px 0;
}
#inGameTaskList li.completed {
  text-decoration: line-through;
  opacity: 0.6;
}

#minimapBtn {
  position: absolute;
  top: 0;
  right: 76px;
  pointer-events: auto;
  padding: 8px 12px;
  background: rgba(10, 14, 20, 0.86);
  color: #dcecff;
  border: 1px solid rgba(160, 200, 255, 0.45);
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}

#minimapBtn:hover,
#minimapBtn.active {
  background: #d9a441;
  color: #111;
  border-color: #ffe1a0;
}

/* ACTION BUTTONS */
#actionButtons {
  position: absolute;
  bottom: 10px;
  right: 10px;
  pointer-events: auto;
}
#actionButtons button {
  margin-left: 8px;
  padding: 8px 12px;
  font-size: 1rem;
  background: #555;
  color: #eee;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
}
#actionButtons button:not(:disabled) {
  opacity: 1;
}
#actionButtons button:disabled {
  cursor: default;
}

#killBtn.kill-ready {
  background: #b93333;
  color: #fff;
  opacity: 1;
  box-shadow: 0 0 12px rgba(255, 68, 68, 0.45);
}

#debugPanel {
  display: none;
  position: fixed;
  left: 12px;
  bottom: 12px;
  pointer-events: none;
  background: rgba(5, 8, 12, 0.72);
  color: #d9f0ff;
  border: 1px solid rgba(150, 210, 255, 0.35);
  border-radius: 4px;
  padding: 8px 10px;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  line-height: 1.4;
  min-width: 180px;
  z-index: 2600;
}
#debugTitle {
  color: #8fd6ff;
  font-weight: bold;
  margin-bottom: 3px;
}

/* Home and lobby refresh */
#homeScreen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(22px, 4vh, 44px);
  padding: clamp(28px, 6vh, 72px) 16px;
  overflow-y: auto;
  background: #170821;
  z-index: 0;
}

#heroContent {
  position: relative;
  width: min(760px, calc(100vw - 32px));
  color: #fff;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}

#gameTitle {
  position: static;
  width: auto;
  color: #fff;
  font-size: 4.3rem;
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 0 10px 30px rgba(0,0,0,0.75);
  margin: 0;
}

#gameSubtitle {
  max-width: 520px;
  margin: 14px auto 0;
  color: rgba(231, 241, 255, 0.82);
  font-size: 1rem;
  line-height: 1.45;
}

#lobby {
  position: relative;
  top: auto;
  bottom: auto;
  left: auto;
  transform: none;
  flex: 0 0 auto;
  width: min(380px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 220px));
  overflow-y: auto;
  background: rgba(8, 13, 22, 0.82);
  padding: 18px;
  border-radius: 8px;
  border: 1px solid rgba(175, 215, 255, 0.35);
  z-index: 20;
  box-shadow: 0 18px 48px rgba(0,0,0,0.45);
  backdrop-filter: blur(10px);
}

.lobby-heading {
  display: grid;
  gap: 5px;
  margin-bottom: 14px;
}

.lobby-heading span {
  font-weight: 700;
  font-size: 1.15rem;
}

.lobby-heading small,
.code-label {
  color: rgba(221, 236, 255, 0.68);
  font-size: 0.85rem;
}

#lobby input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(210,230,255,0.42);
}

#lobby input:focus {
  border-color: #8fd6ff;
  box-shadow: 0 0 0 3px rgba(143,214,255,0.14);
}

.server-url-field {
  display: grid;
  gap: 5px;
  margin: 0 0 12px;
  text-align: left;
}

.server-url-field span {
  color: rgba(221,236,255,0.78);
  font-size: 0.8rem;
  font-weight: 700;
}

.server-url-field small {
  color: rgba(221,236,255,0.58);
  font-size: 0.76rem;
  line-height: 1.25;
}

.server-url-field small.error {
  color: #ffb4a8;
}

.server-url-field small.ok {
  color: #9ef0c0;
}

.lobby-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#lobby button {
  margin: 0;
  padding: 10px 12px;
  background: rgba(120, 170, 220, 0.22);
  border: 1px solid rgba(210,230,255,0.45);
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
}

#lobby button:hover {
  background: rgba(145, 198, 255, 0.3);
  border-color: rgba(230,245,255,0.72);
  transform: translateY(-1px);
}

#createBtn,
#enterBtn,
#confirmJoinBtn {
  background: #d4a94a;
  color: #15120b;
  border-color: #ffe0a0;
  font-weight: 700;
}

#enterBtn {
  width: 100%;
  margin-top: 12px;
}

#gameCode {
  margin: 8px 0 10px;
  padding: 12px;
  border: 1px solid rgba(255, 224, 160, 0.55);
  border-radius: 6px;
  background: rgba(255, 213, 101, 0.12);
  color: #ffe09c;
  font-size: 2.4rem;
  letter-spacing: 0;
}

body.home-view #lobby,
body.lobby-created-view #lobby {
  display: block;
}

@media (max-height: 680px) {
  #homeScreen {
    gap: 18px;
    justify-content: flex-start;
    padding-top: 34px;
    padding-bottom: 20px;
  }

  #gameTitle {
    font-size: 3.35rem;
  }

  #gameSubtitle {
    margin-top: 10px;
  }

  #lobby {
    max-height: calc(100vh - 190px);
    padding: 16px;
  }
}

@media (max-height: 540px) {
  #homeScreen {
    gap: 14px;
    padding-top: 22px;
    padding-bottom: 14px;
  }

  #gameTitle {
    font-size: 2.65rem;
    line-height: 1;
  }

  #gameSubtitle {
    display: none;
  }

  #lobby {
    max-height: calc(100vh - 130px);
    padding: 14px;
  }

  .lobby-heading {
    margin-bottom: 10px;
  }

  .lobby-heading span {
    font-size: 1.05rem;
  }

  .lobby-heading small,
  .code-label,
  .lobby-instructions {
    font-size: 0.8rem;
  }

  #lobby input,
  #lobby select,
  #lobby button {
    padding: 8px 10px;
  }

  .lobby-settings {
    gap: 8px;
    margin: 10px 0;
  }
}

@media (max-width: 520px) {
  #heroContent {
    width: calc(100vw - 24px);
  }

  #gameTitle {
    font-size: 2.4rem;
  }

  #lobby {
    width: calc(100vw - 24px);
  }

  .lobby-actions {
    grid-template-columns: 1fr;
  }
}

#startBtn {
  display: none;
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  font-size: 1rem;
  background: #d4a94a;
  color: #15120b;
  border: 1px solid #ffe0a0;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  z-index: 2300;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0,0,0,0.32);
}

#startBtn:hover {
  background: #ecc369;
}

#startBtn:disabled {
  opacity: 0.45;
  cursor: default;
}

#preGamePanel {
  display: none;
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2300;
  min-width: 260px;
  padding: 10px 14px;
  border: 1px solid rgba(160, 205, 255, 0.35);
  border-radius: 6px;
  background: rgba(7, 12, 20, 0.78);
  color: #edf6ff;
  text-align: center;
  backdrop-filter: blur(8px);
}

.pre-game-label {
  color: #9edaff;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

#preGameCode {
  margin-top: 2px;
  color: #ffe09c;
  font-weight: 800;
  font-size: 1.8rem;
  letter-spacing: 0.18em;
}

#preGameStatus {
  color: rgba(231,241,255,0.72);
  font-size: 0.82rem;
}

#propEditorToggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 2800;
  pointer-events: auto;
  background: rgba(10, 14, 20, 0.86);
  color: #dcecff;
  border: 1px solid rgba(160, 200, 255, 0.45);
  border-radius: 4px;
  padding: 8px 11px;
  font-size: 13px;
  cursor: pointer;
}

body:not(.game-view) #propEditorToggle,
body:not(.game-view) #propEditorPanel,
body:not(.debug-view) #propEditorToggle,
body:not(.debug-view) #propEditorPanel {
  display: none !important;
}

#propEditorToggle.active {
  background: #d9a441;
  color: #111;
  border-color: #ffe1a0;
}

#propEditorPanel {
  position: fixed;
  top: 52px;
  right: 12px;
  width: min(430px, calc(100vw - 24px));
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  display: none;
  z-index: 2801;
  pointer-events: auto;
  background: rgba(10, 14, 20, 0.94);
  color: #ecf4ff;
  border: 1px solid rgba(160, 200, 255, 0.38);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  padding: 12px;
}

#propEditorPanel.open {
  display: block;
}

.prop-editor-mapbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  margin: 8px 0 10px;
}

.prop-editor-mapbar label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #d9e8ff;
}

.prop-editor-header,
.prop-editor-footer,
.prop-editor-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.prop-editor-header {
  justify-content: space-between;
  margin-bottom: 10px;
}

.prop-editor-buttons,
.prop-editor-footer {
  margin-top: 10px;
}

.prop-editor-tools {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(160, 200, 255, 0.22);
  border-radius: 6px;
  background: rgba(255,255,255,0.045);
}

.prop-editor-tool-title {
  color: #cce6ff;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.prop-editor-nudge {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.prop-editor-inline {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  gap: 6px;
  align-items: stretch;
}

.prop-editor-inline label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  color: #9fc4e6;
  font-size: 11px;
}

.prop-editor-hint {
  margin-top: 8px;
  color: rgba(215,235,255,0.64);
  font-size: 11px;
  line-height: 1.35;
}

#propEditorPanel button,
#propEditorPanel select,
#propEditorPanel input {
  background: rgba(255,255,255,0.09);
  color: #f3f8ff;
  border: 1px solid rgba(190, 215, 245, 0.36);
  border-radius: 4px;
}

#propEditorPanel button {
  padding: 6px 8px;
  cursor: pointer;
  min-height: 30px;
}

#propEditorPanel button:hover {
  background: rgba(255,255,255,0.18);
}

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

#propEditorList {
  width: 100%;
  min-height: 164px;
  padding: 4px;
  font-size: 12px;
}

#propEditorFields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.prop-editor-field {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: #9fc4e6;
}

.prop-editor-field input,
.prop-editor-field select {
  min-width: 0;
  padding: 6px;
  font-size: 13px;
}

.prop-editor-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

#propEditorStatus {
  min-height: 18px;
  margin-top: 10px;
  font-size: 12px;
  color: #9be0a4;
}

#propEditorStatus.error {
  color: #ff9d9d;
}

#ejectOverlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 3000;
  overflow: hidden;
}

/* our little starfield in the overlay */
#ejectOverlay canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#ejectOverlay #ejectAvatarCanvas {
  top: 50%;
  left: 50%;
  width: 260px;
  height: 260px;
  margin-left: -130px;
  margin-top: -130px;
  filter: drop-shadow(0 0 14px rgba(180,220,255,0.28));
  transform-origin: center;
  z-index: 1;
}

/* center the text */
#ejectText {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 2rem;
  white-space: nowrap;
  text-shadow: 0 3px 0 #000, 0 0 18px rgba(255,255,255,0.28);
  z-index: 2;
}

/* ————— Meeting Header ————— */
.meeting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid #ccc;
}
.meeting-header h2 {
  margin: 0;
}
.chat-toggle-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ————— Chat Pane ————— */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  text-align: left;
  font-size: 0.9rem;
  background-color: rgba(255, 255, 255, 0.8);
}

.messageContainer {
  background-color: white;
  height: 80px;
  padding-bottom: 5px;
}

.userLabel {
  text-align: center;
  font-weight: bold;
}

.fromDiv {
  display: flex;
  flex-direction: column;
}


.chat-input-wrapper {
  display: flex;
  border-top: 1px solid #ddd;
}

#chatToggleBtn {
  background-color: #fff;
}

.chat-input {
  flex: 1;
  padding: 6px 8px;
  border: none;
  outline: none;
  font-size: 0.9rem;
}
.send-chat-btn {
  padding: 6px 12px;
  border: none;
  background: #4caf50;
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
}











/* 1) ensure the panel is the containing block for absolute children */
.meeting-panel {
  position: relative; /* ← added */
  background: rgba(255,255,255,0.6);
  padding: 24px;
  border-radius: 8px;
  width: 60%;
  max-width: 800px;       /* tighten overall width */
  height: auto;
  max-height: 800px;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.pfp {
  width: 48px;
  height: 48px;
}

.messageContainer {
  margin-bottom: 10px;
  display: flex;
  flex-direction: row;
}

.messageContainer.ghost-message,
.messageContainer.ghost-message .userLabel,
.messageContainer.ghost-message .messageText {
  color: #8c8c8c;
}

/* 2) chat pane now absolute *inside* the panel */
.chat-pane {
  position: absolute;
  top: 3.5rem;            /* below header */
  left: 1.5rem;           /* inside panel padding */
  right: 1.5rem;          /* inside panel padding */
  bottom: 4.5rem;         /* above skip/timer */
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid #aaa;
  border-radius: 6px;
  display: none;
  flex-direction: column;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  max-width: calc(100% - 3rem); /* never exceed panel’s width */
  margin: 0 auto;
  height: 500px;               /* centered if panel is wider */
}

/* rest of your chat styling unchanged */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.chat-message {
  display: flex;
  align-items: flex-end;
  margin-bottom: 6px;
}
.chat-message .avatar {
  width: 24px; height: 24px;
  background: #ddd;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}
.chat-message .bubble {
  background: #fff;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.chat-input-wrapper {
  display: flex;
  border-top: 1px solid #ccc;
}
.chat-input {
  flex: 1;
  border: none;
  padding: 15px;
  font-size: 0.9rem;
  border-radius: 0 0 0 6px;
  outline: none;
}
.send-chat-btn {
  border: none;
  background: #4caf50;
  color: white;
  padding: 0 16px;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 0 0 6px 0;
}

/* Refined scalable voting layout */
#meetingUI .meeting-panel {
  width: min(920px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 32px));
  background: rgba(245, 248, 252, 0.94);
  color: #17202b;
  border: 1px solid rgba(20, 32, 46, 0.22);
  box-shadow: 0 24px 70px rgba(0,0,0,0.38);
}

#voteListWrapper {
  display: block;
  overflow-y: auto;
  margin: 0 0 18px;
  padding-right: 4px;
}

.vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.vote-option {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 10px;
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(75, 91, 112, 0.22);
  border-radius: 8px;
  color: #17202b;
  float: none;
}

.vote-option.selected {
  border-color: #ffd76b;
  background: rgba(255, 211, 77, 0.18);
}

.vote-option.locked:not(.selected) {
  opacity: 0.7;
}

.vote-option.dead {
  opacity: 0.44;
}

.vote-option.voted:not(.dead) {
  box-shadow: inset 0 0 0 2px rgba(39, 174, 96, 0.34);
}

.vote-avatar-wrapper {
  min-width: 0;
  margin: 0;
  gap: 10px;
}

.vote-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vote-label.impostor-name {
  color: #e92525;
  text-shadow: none;
}

.vote-btn {
  width: 52px;
  min-width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 6px;
  background: #e5b84b;
  color: #15100a;
  font-size: 0.86rem;
  font-weight: 800;
}

.vote-btn:disabled {
  cursor: default;
  opacity: 0.76;
}

#skipWrapper {
  width: 100%;
  max-width: none;
  height: auto;
  margin: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#voteStatus {
  flex: 1;
  text-align: left;
  color: #1f2f44;
  font-weight: 700;
}

#skipVoteBtn {
  width: auto;
  min-width: 110px;
  height: 42px;
  margin: 0;
  border-radius: 6px;
}

#skipVoteBtn.selected {
  background: #ffd76b;
  color: #111;
}

#voteTimer {
  margin: 0;
  height: auto;
  color: #333;
  white-space: nowrap;
}

#playerLineupOverlay {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
  z-index: 11000;
  pointer-events: auto;
  animation: lineupFadeIn 220ms ease-out both;
}

#playerLineupOverlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center 55%, rgba(95, 210, 230, 0.16), rgba(0, 0, 0, 0) 28%),
    radial-gradient(ellipse at center 57%, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0) 40%);
  z-index: 0;
}

#playerLineupOverlay[data-variant="impostor"]::before {
  background:
    radial-gradient(ellipse at center 55%, rgba(190, 28, 35, 0.22), rgba(0, 0, 0, 0) 28%),
    radial-gradient(ellipse at center 57%, rgba(255, 255, 255, 0.09), rgba(0, 0, 0, 0) 40%);
}

#playerLineupCanvas {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

#playerLineupTitle {
  position: absolute;
  top: clamp(34px, 8vh, 86px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: #47a8ff;
  font-size: clamp(2.5rem, 8vw, 6.8rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: 0.08em;
  text-align: center;
  text-shadow: 0 0 18px rgba(71, 168, 255, 0.62), 0 4px 0 #051423;
  white-space: nowrap;
}

#playerLineupOverlay[data-variant="impostor"] #playerLineupTitle {
  color: #ff4a4a;
  text-shadow: 0 0 18px rgba(255, 74, 74, 0.62), 0 4px 0 #230505;
}

#playerLineupSubtitle {
  position: absolute;
  top: clamp(102px, 21vh, 178px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255,255,255,0.84);
  font-size: clamp(0.95rem, 2.2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #000;
  white-space: nowrap;
}

#playAgainBtn {
  position: absolute;
  left: 50%;
  bottom: clamp(28px, 7vh, 76px);
  transform: translateX(-50%);
  z-index: 3;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 6px;
  background: rgba(255,255,255,0.92);
  color: #10151d;
  padding: 10px 22px;
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(255,255,255,0.22);
}

#playAgainBtn:hover {
  background: #fff;
  transform: translateX(-50%) translateY(-1px);
}

@keyframes lineupFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Final gameplay polish overrides */
#gameCanvas {
  background: #170821;
}

body.game-view {
  background: #170821;
}

body.home-view,
body.lobby-created-view {
  background: #170821;
}

html,
body,
body.home-view,
body.lobby-created-view,
body.game-view,
#homeScreen {
  background-color: #170821 !important;
}

#starfield {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

#task-container:not(.open) > .close-btn,
#task-container.hidden > .close-btn {
  display: none !important;
}

#task-container.open > .close-btn {
  display: block !important;
}

#debugPanel {
  display: none;
}

#meetingUI {
  background: rgba(0, 0, 0, 0.68);
}

#meetingUI .meeting-panel {
  width: clamp(760px, 70vw, 900px);
  max-width: calc(100vw - 32px);
  min-height: min(560px, calc(100vh - 32px));
  max-height: min(720px, calc(100vh - 32px));
  padding: clamp(16px, 2.5vw, 24px);
  background: rgba(226, 229, 234, 0.94);
  color: #10151d;
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.42);
}

#meetingUI .meeting-header {
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(0,0,0,0.22);
}

#meetingUI .meeting-header h2 {
  color: #10151d;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  font-weight: 800;
}

#chatToggleBtn {
  background: #fff;
  color: #111;
  border: 0;
  padding: 2px 8px;
  font-size: 1.15rem;
}

#voteListWrapper {
  display: flex;
  gap: clamp(20px, 5vw, 40px);
  justify-content: center;
  overflow-y: auto;
  max-height: min(390px, calc(100vh - 210px));
  margin: 0 0 14px;
  padding: 8px clamp(8px, 3vw, 28px) 10px;
}

.vote-list {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
}

.vote-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  align-items: center;
  gap: 10px;
  min-height: 80px;
  margin: 0;
  padding: 8px 10px;
  background: rgba(255,255,255,0.28);
  border: 0;
  border-radius: 0;
  color: #10151d;
  font-weight: 800;
  float: none;
}

.vote-option.selected {
  background: rgba(255, 221, 105, 0.34);
  outline: 2px solid rgba(177, 134, 25, 0.52);
}

.vote-option.locked:not(.selected) {
  opacity: 0.72;
}

.vote-option.dead {
  opacity: 0.36;
  filter: grayscale(0.85);
}

.vote-option.voted:not(.dead) {
  box-shadow: inset 0 0 0 2px rgba(39, 174, 96, 0.38);
}

.vote-avatar-wrapper {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0;
  gap: 10px;
}

.vote-avatar {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
}

.vote-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #10151d;
}

.vote-label.impostor-name {
  color: #d02b2b;
}

.vote-btn {
  width: 64px;
  min-width: 64px;
  height: 64px;
  border: 0;
  border-radius: 0;
  background: rgba(255,255,255,0.38);
  color: #941b22;
  font-size: 0.96rem;
  font-weight: 900;
}

.vote-btn:disabled {
  opacity: 0.72;
}

#skipWrapper {
  display: flex;
  width: 100%;
  max-width: none;
  height: auto;
  margin: 0;
  align-items: center;
  gap: 14px;
}

#voteStatus {
  flex: 1;
  text-align: left;
  color: #1c2938;
  font-weight: 800;
}

#skipVoteBtn {
  width: auto;
  min-width: 100px;
  height: 48px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: rgba(255,255,255,0.82);
  color: #111;
}

#skipVoteBtn.selected {
  background: #f0c24a;
}

#voteTimer {
  height: auto;
  margin: 0;
  color: #333;
  white-space: nowrap;
}

.chat-pane {
  top: 64px;
  left: clamp(16px, 2.5vw, 24px);
  right: clamp(16px, 2.5vw, 24px);
  bottom: 76px;
  height: auto;
  min-height: 280px;
  max-width: none;
  margin: 0;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 0;
  box-shadow: none;
}

.chat-messages {
  min-height: 210px;
  background: #fff;
  color: #111;
}

.messageContainer {
  min-height: 54px;
  height: auto;
  padding: 8px;
  background: #fff;
}

.send-chat-btn {
  min-width: 42px;
}

@media (max-width: 650px) {
  #voteListWrapper {
    flex-direction: column;
    max-height: min(430px, calc(100vh - 210px));
  }

  .vote-option {
    grid-template-columns: minmax(0, 1fr) 56px;
    min-height: 68px;
  }

  .vote-avatar {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .vote-btn {
    width: 56px;
    min-width: 56px;
    height: 52px;
  }

  #skipWrapper {
    align-items: stretch;
    flex-wrap: wrap;
  }
}
