body {
  font-family: Arial, sans-serif;
  color: white;
  margin: 0;
  padding: 0;
  background-color: #f4f4f4;
}

header {
  background-color: #333;
  color: #fff;
  text-align: center;
  padding: 1rem 0;
}

main {
  padding: 1rem;
}

button {
  display: block;
  margin: 1rem auto;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background-color: #007BFF;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

button:hover {
  background-color: #0056b3;
}

#room-list {
  margin-top: 2rem;
}

#rooms {
  list-style: none;
  padding: 0;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: white;
  padding: 2rem;
  border-radius: 10px;
  text-align: center;
  width: 90%;
  max-width: 400px;
}

.close {
  position: absolute;
  top: 10px;
  right: 20px;
  cursor: pointer;
  font-size: 1.5rem;
}

/* 게임방 스타일 */
.game-room {
  background-color: #2a2a2a;
  border-radius: 15px;
  padding: 2rem;
  margin-top: 2rem;
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #3a3a3a;
}

.room-title h2 {
  color: #ff4444;
  margin-bottom: 0.5rem;
}

.room-info {
  color: white;
}

.exit-btn {
  background-color: #3a3a3a;
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.exit-btn:hover {
  background-color: #ff4444;
}

.game-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.players-section {
  background-color: #1a1a1a;
  padding: 1.5rem;
  border-radius: 10px;
}

.players-section h3 {
  margin-bottom: 1.5rem;
  color: #ff4444;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
}

.player-card {
  color: white;
  background-color: #2a2a2a;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  transition: transform 0.3s;
}

.player-card:hover {
  transform: translateY(-5px);
}

.player-card img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 0.5rem;
}

.player-card h4 {
  margin-bottom: 0.3rem;
}

.role {
  font-size: 0.8rem;
  color: #ff4444;
}

.game-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.start-btn,
.result-btn,
.reset-btn,
.reconfirm-btn,
.drawing-btn {
  padding: 1rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background-color 0.3s;
}

.start-btn {
  background-color: #44ff44;
  color: #1a1a1a;
}

.result-btn {
  background-color: #ff4444;
  color: white;
}

.reset-btn {
  background-color: #ffaa00;
  color: #1a1a1a;
}

.reconfirm-btn {
  background-color: #4488ff;
  color: white;
}

.drawing-btn {
  background-color: #8844ff;
  color: white;
}

.start-btn:hover,
.result-btn:hover,
.reset-btn:hover,
.reconfirm-btn:hover,
.drawing-btn:hover {
  opacity: 0.9;
}

.chat-box {
  background-color: #1a1a1a;
  border-radius: 8px;
  margin-top: 1rem;
  height: 300px;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex-grow: 1;
  padding: 1rem;
  overflow-y: auto;
}

.chat-box input {
  background-color: #2a2a2a;
  border: none;
  padding: 1rem;
  color: white;
  border-radius: 0 0 8px 8px;
}

.chat-box input:focus {
  outline: none;
  background-color: #3a3a3a;
}

/* 로딩 메시지 스타일 */
.loading-message {
  text-align: center;
  padding: 2rem;
  color: #888;
}

.loading-message i {
  margin-right: 10px;
}

/* 모달 스타일 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: #2a2a2a;
  color: white;
  padding: 2rem;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  text-align: center;
}

.modal-content h3 {
  color: #ff4444;
  margin-bottom: 1rem;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.agree-btn,
.disagree-btn {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

.agree-btn {
  background-color: #44ff44;
  color: #1a1a1a;
}

.disagree-btn {
  background-color: #ff4444;
  color: white;
}

.agreement-status {
  color: white;
  margin-top: 1rem;
}

/* 결과 모달 스타일 */
.result-content {
  max-width: 600px;
  width: 90%;
  margin: 20px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.result-teams {
  display: block;
  margin: 1rem 0;
  overflow-y: auto;
  flex: 1;
  padding-right: 10px;
}

/* 스크롤바 스타일링 */
.result-teams::-webkit-scrollbar {
  width: 6px;
}

.result-teams::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.result-teams::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.team.mafia {
  background-color: #1a1a1a;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.team-members {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.member {
  background-color: #2a2a2a;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.member .missions-list {
  margin-top: 1rem;
  padding-left: 1rem;
  border-left: 2px solid #ff4444;
}

.mission-item {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: #ddd;
}

/* 닫기 버튼 컨테이너 */
.button-container {
  padding-top: 1rem;
  border-top: 1px solid #333;
  margin-top: 1rem;
  position: sticky;
  bottom: 0;
  background-color: #2a2a2a;
}

.close-btn {
  background-color: #3a3a3a;
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.close-btn:hover {
  background-color: #4a4a4a;
}

/*역할 확인 모달 디자인 */
.role-info {
  text-align: center;
  padding: 20px;
}

.role-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.role-icon .fa-user-secret {
  color: #dc3545;
}

.role-icon .fa-user {
  color: #28a745;
}

.mission-list {
  margin-top: 20px;
  text-align: left;
}

.mission-item {
  margin: 10px 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 5px;
}

.mission-item i {
  color: #28a745;
  margin-right: 10px;
}

/* 마피아 미션과 시민 미션 구분 스타일 */
.mission-item.mafia-mission {
  background-color: rgba(220, 53, 69, 0.1);
  border-left: 4px solid #dc3545;
  margin-bottom: 15px;
}

.mission-item.citizen-mission {
  background-color: rgba(40, 167, 69, 0.1);
  border-left: 4px solid #28a745;
  margin-bottom: 15px;
}

.mission-item.mafia-mission i {
  color: #dc3545;
}

.mission-item.citizen-mission i {
  color: #28a745;
}

/* 언어 선택 탭 스타일 */
.language-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 1rem 0;
  border: 1px solid #444;
  border-radius: 8px;
  overflow: hidden;
  background-color: #1a1a1a;
}

.lang-tab {
  flex: 1;
  padding: 0.8rem 1.5rem;
  border: none;
  background-color: transparent;
  color: #888;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  margin: 0;
}

.lang-tab:first-child {
  border-right: 1px solid #444;
}

.lang-tab.active {
  background-color: #ff4444;
  color: white;
  font-weight: bold;
}

.lang-tab:hover:not(.active) {
  background-color: #2a2a2a;
  color: white;
}

/* 기본 스타일 */
.user-id-display {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: #444;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  font-size: 0.9rem;
  z-index: 1000;
}

/* 유저 제거 관련 css */
.player-card {
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.player-card[data-dead="true"] {
  opacity: 0.6;
}

.player-card span {
  display: inline-block;
}

/* 죽은 플레이어 취소선 스타일 */
.player-card[data-dead="true"] span {
  text-decoration: line-through;
  color: #ff0000;
}

/* 연결 끊김 플레이어 스타일 */
.player-card[data-disconnected="true"] {
  border: 2px solid #ffaa00;
  opacity: 0.8;
}

.disconnected-indicator {
  position: absolute;
  bottom: -10px;
  left: 0;
  right: 0;
  background-color: #ffaa00;
  color: #000;
  font-size: 10px;
  padding: 2px 0;
  border-radius: 0 0 8px 8px;
}

/* 방장 표시 스타일 */
.owner-card {
  border: 2px solid #ff4444;
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
  position: relative;
  overflow: visible;
  z-index: 1;
}

.owner-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 8px;
  background: linear-gradient(45deg, #ff4444, transparent, #ff4444);
  z-index: -1;
  animation: border-glow 2s ease-in-out infinite;
  opacity: 0.5;
}

@keyframes border-glow {
  0% { opacity: 0.5; }
  50% { opacity: 0.8; }
  100% { opacity: 0.5; }
}

.owner-indicator {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #ff4444;
  color: white;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: bold;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}


/* 강제 퇴출 관련 스타일 */
.long-pressing {
  background-color: #ff4444;
  transform: scale(0.98);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.kick-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background-color: #ffcc00;
  width: 0%;
  transition: width 0.1s linear;
  box-shadow: 0 0 5px rgba(255, 204, 0, 0.7);
  z-index: 5;
}

.kick-instruction {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.9rem;
  z-index: 1000;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  max-width: 90%;
}


/* 모바일 대응 스타일 */
@media (max-width: 768px) {
  .result-content {
    width: 95%;
    padding: 1rem;
  }

  .team.mafia {
    padding: 1rem;
  }

  .member {
    padding: 0.8rem;
  }

  .mission-item {
    font-size: 0.8rem;
  }

  .close-btn {
    width: 100%;
    margin-top: 1rem;
  }
  
  .kick-instruction {
    font-size: 0.8rem;
    padding: 8px 15px;
    bottom: 15px;
  }
}

.mafia-list {
  margin: 10px 0;
  font-size: 1.1em;
}

.mission-info {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.mission-item p {
  margin: 8px 0;
}

/* 그림 그리기 모달 스타일 - 반응형으로 수정 */
.drawing-content {
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 15px;
}

.drawing-tools {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 600px) {
  .drawing-tools {
    flex-direction: column;
    align-items: center;
  }

  .tool-group,
  .color-group,
  .size-group {
    width: 100%;
    justify-content: center;
    margin-bottom: 10px;
  }
}

.tool-group,
.color-group,
.size-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tool-btn {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  border: 1px solid #ccc;
  background-color: #007BFF;
  /* 회색 대신 파란색으로 변경 */
  color: white;
  /* 아이콘 색상을 흰색으로 */
  cursor: pointer;

  display: flex;
  /* 추가: 플렉스박스 사용 */
  justify-content: center;
  /* 추가: 가로 중앙 정렬 */
  align-items: center;
  /* 추가: 세로 중앙 정렬 */
}

.tool-btn.active {
  background-color: red;
  /* 활성화됐을 때는 더 진한 파란색 */
  border-color: darkred;
  color: white;
}

.tool-btn:hover {
  background-color: red;
  /* 호버 시 색상 변경 */
}

.tool-btn i {
  display: block;
  /* 추가: 블록 요소로 변경 */
  font-size: 16px;
  /* 추가: 아이콘 크기 조정 (필요에 따라 조정) */
}

.color-preset {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 1px solid #ccc;
  cursor: pointer;
}

#color-picker {
  height: 25px;
  width: 40px;
  padding: 0;
  border: none;
  cursor: pointer;
}

.canvas-container {
  border: 1px solid #ccc;
  margin: 0 auto;
  background-color: white;
  width: 100%;
  height: auto;
  max-height: 60vh;
  overflow: hidden;
}

#drawing-canvas {
  display: block;
  cursor: crosshair;
  width: 100%;
  height: 100%;
  touch-action: none;
  /* 모바일에서 스크롤이나 확대 방지 */
}

.size-group {
  display: flex;
  align-items: center;
}

#brush-size {
  width: 100px;
}

#size-value {
  min-width: 40px;
  text-align: left;
}

/* 모바일 최적화 버튼 크기 */
@media (max-width: 480px) {
  .tool-btn {
    width: 35px;
    height: 35px;
  }

  .color-preset {
    width: 20px;
    height: 20px;
  }

  .modal-buttons button {
    padding: 8px 16px;
    margin: 5px;
  }
}