/* Base layout */
body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background-color: #1e1e2f;
  color: #eee;
  height: 100vh;
  overflow: hidden;
}

/* Room Setup */
#room-setup input {
  padding: 0.5rem;
  border-radius: 4px;
  border: none;
  width: 200px;
  margin-left: 0.5rem;
}

#room-setup button {
  padding: 0.6rem 1rem;
  margin: 0 0.5rem;
  background-color: #4a90e2;
  border: none;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}

#room-setup button:hover {
  background-color: #357ab8;
}

.language-selector {
  position: absolute;
  top: 10px;
  right: 10px;
}
.language-btn {
  margin: 0 5px;
  padding: 5px 10px;
  text-decoration: none;
  background: #509cec;
  color: white;
  border-radius: 3px;
}
.language-btn.active {
  color: rgb(218, 217, 217);
  background: #949ba3;
}
/* Game Area Layout */
#game-area {
  position: relative;
  /*width: 100vw;
  */
  width: 80vw;
  height: 100vh;
}
.room-name {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, 0.6);
  padding: 5px 5px;
  border-radius: 6px;
  font-size: 1.2rem;
  color: #04c967;
  text-align: center;
  border: 2px solid #b37a08bc;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 2px rgb(106, 139, 148);
} 

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}
.hidden{
  display:none;
}
.modal-content {
  background: #222;
  color: #eee;
  padding: 20px 30px;
  border-radius: 10px;
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.modal-buttons {
  margin-top: 20px;
}

.modal-buttons button {
  margin: 0 10px;
  padding: 8px 16px;
  border: none;
  background: #444;
  color: white;
  border-radius: 5px;
  cursor: pointer;
}

.modal-buttons button:hover {
  background: #666;
}

/* Notification styling */
.notification-container {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.notification {
  background-color: #333;
  border: 1px solid #555;
  padding: 10px 20px;
  border-radius: 10px;
  margin-bottom: 10px;
  color: #fff;
  box-shadow: 0 0 10px rgba(255,255,255,0.1);
  text-align: center;

}

.notification button {
  margin: 5px;
  padding: 5px 10px;
  background-color: #007bff;
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
}

.notification button:hover {
  background-color: #0056b3;
}

.waiting-box {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #222;
  color: #eee;
  padding: 20px 40px;
  border: 2px solid #666;
  border-radius: 8px;
  font-size: 1.2em;
  z-index: 900;
  text-align: center;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.waiting-box.hidden {
  display: none;
}
.hidden{
  display:none;
}
/* Spinner animation */
.spinner {
  border: 4px solid #444;
  border-top: 4px solid #00aaff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.xiangqi-container {
  position:absolute;
  top: 50%;
  left: 50%;  
  transform: translate(-50%, -50%);  
  display: flex;
  justify-content: center;
  margin-top: -20px;
}
.xiangqi-board {
  position: relative;
  width: 450px;   /* 9 files × 50px */
  height: 500px;  /* 10 ranks × 50px */
  background: url('/xiangQi/images/xiangqi-board.png') no-repeat center center;
  background-size: cover;
}
.xiangqi-board-h {
  position: relative;
  width: 500px;   /* horizontal  */
  height: 450px;  /*  */
  background: url('/xiangQi/images/xiangqi-board-h.png') no-repeat center center;
  background-size: cover;
}

/* transparent grid */
.grid {
  position: absolute;
  top: 2px;   /* adjust so the centers align with intersections */
  left: 2px;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(9, 50px);
  grid-template-rows: repeat(10, 50px);
  pointer-events: none; /* so board drag passes through, unless overridden */
}
/* horizontal */
.grid-h {
  position: absolute;
  top: 2px;   /* adjust so the centers align with intersections */
  left: 2px;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(10, 50px);
  grid-template-rows: repeat(9, 50px);
  pointer-events: none; /* so board drag passes through, unless overridden */
}

.square {
  position: relative;
  pointer-events: auto; /* re-enable drop targeting */
}
.square.selected::after{
  content:'';
  position:absolute;
  inset:0;
  outline:3px solid gold;
  box-shadow: inset 0 0 0 9999px var(--sel);
  pointer-events:none;
}
/* piece sits inside a square */
.piece {
  width: 45px;
  height: 45px;
  pointer-events: auto;
  cursor: grab;
  user-select: none;
}

.piece:active {
  cursor: grabbing;
}


.player-tag {
  position: absolute;
  background-color: rgba(0, 0, 0, 0.6);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #fff;
  text-align: center;
}
#top-player {
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  border: 2px solid;
}
#left-player {
  top: 40%;
  left: 30px;
  transform-origin: bottom left;
  transform: rotate(90deg) translateY(-50%);
  border: 2px solid;
}
#right-player {
  top: 40%;
  right: 30px;
  transform-origin: bottom right;
  transform: rotate(270deg) translateY(-50%);
  border: 2px solid;
}
#bottom-player {
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  border: 2px solid;
}
.actions {
  position: absolute;
  bottom: 20px;
  left: 5%;
  display: flex;
  gap: 8px;
}
.actions button{
  background-color: #3e3e5e;  
  color:#eee;
  border:1px solid #444;
  padding:8px 12px;
  border-radius:6px;
  cursor:pointer;
}
.actions button:hover{ background:#333; }

.mic-button{
  position: absolute; 
  bottom: 20px;
  right: 30px;
}

.icon-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: #fb0909;
  padding: 8px;
  border-radius: 5px;
  transition: background 0.2s;
    display: flex;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.icon-button.muted i {
  color: #13ef22;
}

.tooltip-btn {
  position: relative;
  cursor: pointer;
}

.tooltip-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #333;
  color: #fff;
  padding: 6px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  font-size: 0.85em;
  z-index: 10;
}

.tooltip-btn:hover::after {
  opacity: 1;
}

.button-spacer {
  width: 24px; /* adjust spacing between groups */
}

/* MOBILE: move clocks under board */
@media (max-width: 768px) {
.xiangqi-container {
  position:absolute;
  top: 100px;
  left:50%;
  transform: translateX(-40%);
  display: flex;
  justify-content: center;
}
.actions {
  position: fixed;
  bottom: 20px;
  display: flex;
  gap: 8px;
}
.mic-button{
  position: fixed; 
  bottom: 50px;
  right: 0;
}
}