* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Noto Sans KR", sans-serif;
}

body {
  background-color: #1a1a1a;
  color: #ffffff;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Improved header layout */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  color: #ff4444;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
}

.header-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 1rem;
  width: 100%;
}

/* Improved search container */
.search-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px auto;
  width: 100%;
  max-width: 500px;
}

#room-search {
  flex: 1;
  padding: 12px 15px;
  border: none;
  border-radius: 25px 0 0 25px;
  font-size: 14px;
  background-color: #2a2a2a;
  color: white;
  transition: all 0.3s;
}

#room-search:focus {
  outline: none;
  background-color: #333;
}

#room-search::placeholder {
  color: #888;
}

#search-btn {
  padding: 12px 20px;
  background-color: #ff4444;
  color: white;
  border: none;
  border-radius: 0 25px 25px 0;
  cursor: pointer;
  transition: all 0.3s;
}

#search-btn:hover {
  background-color: #ff6666;
  transform: translateX(2px);
}

/* Unified button styling */
.btn {
  background-color: #ff4444;
  color: white;
  border: none;
  padding: 12px 20px;
  font-size: 1rem;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn:hover {
  background-color: #ff6666;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

.btn i {
  margin-right: 8px;
}

.btn-primary {
  background-color: #ff4444;
}

.btn-secondary {
  background-color: #3a3a3a;
}

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

.guide-btn {
  background-color: #3498db;
  padding: 12px 20px;
  border-radius: 25px;
  font-size: 0.9rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.guide-btn i {
  margin-right: 6px;
}

.guide-btn:hover {
  background-color: #2980b9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.create-room-btn {
  background-color: #ff4444;
  color: white;
  border: none;
  padding: 12px 25px;
  font-size: 1.1rem;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  margin: 0 auto;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.create-room-btn i {
  margin-right: 10px;
}

.create-room-btn:hover {
  background-color: #ff6666;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.create-room-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

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

.room-card {
  background-color: #2a2a2a;
  border-radius: 15px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.3s, box-shadow 0.3s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.room-card:hover {
  transform: translateX(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.header h1 i {
  color: #ff4444;
  margin-right: 10px;
}

.room-info {
  display: flex;
  align-items: center;
}

.room-icon {
  margin-right: 1rem;
  font-size: 1.5rem;
  color: #ff4444;
}

.room-details h3 {
  margin-bottom: 0.5rem;
}

.room-details p {
  color: #888;
  font-size: 0.9rem;
}

.room-status {
  background-color: #3a3a3a;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.status-waiting {
  color: #44ff44;
}

.status-playing {
  color: #ff4444;
}

/* 모달 관련 css */

/* 모달 공통 스타일 */
.modal {
  display: none; /* 기본적으로 숨김 */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #2a2a2a;
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  width: 90%;
  max-width: 500px;
  color: #ffffff;
  /* 수직 배치를 위한 flex 추가 */
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal .modal-content {
  width: 100%;
}

/* 환영 메시지 스타일 */
.welcome-message {
  background: linear-gradient(135deg, rgba(255, 68, 68, 0.1), rgba(68, 255, 68, 0.1));
  border-left: 4px solid #ff4444;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.welcome-message p {
  margin: 0;
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.welcome-message i {
  color: #ff4444;
  font-size: 1.1rem;
  animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(20deg); }
  75% { transform: rotate(-10deg); }
}

.modal h2, .modal h3 {
  width: 100%;
  margin-bottom: 1.5rem;
  text-align: center;
  color: #ff4444;
}

.modal input[type="text"],
.modal input[type="password"],
.modal input[type="number"] {
  width: 100%;
  margin-bottom: 1.5rem;
  padding: 12px 15px;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  color: #000000;
  background-color: #ffffff;
  transition: all 0.3s;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal input:focus {
  outline: none;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
}

.modal-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.modal-buttons button {
  flex: 1;
  padding: 12px;
  font-size: 1rem;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.modal-buttons button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.modal-buttons button:active {
  transform: translateY(0);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

.modal-buttons button#submit-name, .modal button#submit-room {
  background-color: #ff4444;
  color: white;
}

.modal-buttons button#submit-name:hover, .modal button#submit-room:hover {
  background-color: #ff6666;
}

.modal-buttons button#close-name-modal, .modal button#close-create-room-modal {
  background-color: #444;
  color: white;
}

.modal-buttons button#close-name-modal:hover, .modal button#close-create-room-modal:hover {
  background-color: #666;
}

/* 버튼 컨테이너 추가 */
.button-container {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.button-container button {
  flex: 1;
  padding: 12px;
  font-size: 1rem;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.button-container button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.button-container button:active {
  transform: translateY(0);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

/* 배경 흐림 효과 */
.modal-background {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 999; /* 모달 바로 아래 */
}

/* 모달 활성화 */
.modal.active,
.modal-background.active {
  display: block;
}

/* 숨겨진 상태 스타일 */
.hidden {
  display: none;
}

/* 기본 스타일 */
.user-id-display {
  position: absolute;
  top: 15px;
  right: 15px;
  background-color: #ff4444;
  color: white;
  padding: 8px 16px;
  border-radius: 25px;
  font-size: 0.9rem;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: all 0.3s;
}

/* 이름변경 관련 클릭 관련 css */
.clickable {
  cursor: pointer;
}

.clickable:hover {
  background-color: #ff6666;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* 모바일 화면에서의 모든 스타일 변경사항 */
@media (max-width: 768px) {
  .header {
    margin-bottom: 1.5rem;
  }
  
  .header h1 {
    font-size: 2rem; /* 모바일에서 제목 크기 조정 */
    margin-bottom: 1rem;
  }

  .header-buttons {
    flex-direction: column;
    gap: 10px;
  }
  
  .guide-btn, .create-room-btn {
    width: 100%;
    justify-content: center;
    font-size: 0.9rem;
    padding: 10px 15px;
  }

  .search-container {
    flex-direction: row; /* 유지 */
    max-width: 100%;
  }

  #room-search {
    padding: 10px;
    font-size: 0.9rem;
  }

  #search-btn {
    padding: 10px 15px;
  }

  .modal {
    width: 90%;
    padding: 1.5rem;
  }

  .modal h2, .modal h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
  }

  .modal input[type="text"],
  .modal input[type="password"],
  .modal input[type="number"] {
    font-size: 0.9rem;
    padding: 10px;
    margin-bottom: 1rem;
  }

  .modal-buttons button, .button-container button {
    font-size: 0.9rem;
    padding: 10px;
  }

  .user-id-display {
    font-size: 0.8rem;
    padding: 6px 12px;
    top: 10px;
    right: 10px;
  }
  
  .room-card {
    padding: 1rem;
  }
  
  .room-details h3 {
    font-size: 1rem;
  }
  
  .room-details p {
    font-size: 0.8rem;
  }
  
  .room-status {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}
