/**
 * Rock-Paper-Scissors 猜拳遊戲樣式
 */

/* 遊戲容器 */
.rps-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

/* 計分板 */
#rps-scoreboard {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.rps-mode {
  font-size: 0.75rem;
  color: var(--text-secondary, #666);
}

.rps-score-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rps-avatar-small {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: bold;
  color: white;
}

.rps-score {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--color-primary, #4A90A4);
}

.rps-round {
  font-size: 0.75rem;
  color: var(--text-secondary, #666);
}

/* 對手區域 */
.rps-opponent-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  position: relative;
  min-height: 0;
}

#rps-opponent-status {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  width: 100%;
  min-height: 0;
}

.rps-waiting-text {
  font-size: 1rem;
  color: var(--text-secondary, #666);
  text-align: center;
  padding: 0.5rem 0;
  min-height: 2rem;
}

.rps-opponent-name {
  font-size: 1.25rem;
  font-weight: bold;
}

/* 人物動畫容器 - 參考 demo */
.man-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
}

.man {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 75%;
  height: 75%;
}

/* 等待動畫 */
.man.wait {
  background-image: url(../images/wait1.png);
  background-size: 100%;
  background-repeat: no-repeat;
  background-position: left bottom;
  animation-name: waitAni;
  animation-duration: 1s;
  animation-iteration-count: infinite;
  animation-timing-function: step-start;
}

@keyframes waitAni {
  0% { background-image: url(../images/wait1.png); }
  50% { background-image: url(../images/wait2.png); }
  100% { background-image: url(../images/wait1.png); }
}

/* 出拳動作 */
.man.go {
  background-image: url(../images/go0.png);
  background-size: 100%;
  background-repeat: no-repeat;
  background-position: left bottom;
}

/* 出拳結果圖片 */
.end-img {
  position: absolute;
}

.end-img.hidden {
  display: none;
}

/* 剪刀 */
.end1 {
  right: 0;
  top: 5%;
  width: 60%;
}

/* 石頭 */
.end2 {
  right: 5%;
  top: 15%;
  width: 50%;
}

/* 布 */
.end3 {
  right: -2%;
  top: 15%;
  width: 60%;
}

/* 自己出拳圖片 - 共用 */
.my-move-img {
  position: absolute;
  right: 0;
  bottom: 0;
}

.my-move-img.hidden {
  display: none;
}

/* 剪刀 */
.my-move-img.me1 {
  width: 35%;
  right: 0;
  bottom: 0;
  rotate: -20deg;
}

/* 石頭 */
.my-move-img.me2 {
  width: 35%;
  right: 0;
  bottom: 0;
  rotate: -20deg;
}

/* 布 */
.my-move-img.me3 {
  width: 45%;
  right: 0;
  bottom: 0;
  rotate: -20deg;
}

/* 分隔線 */
.rps-divider {
  width: 100%;
  height: 1px;
  background: var(--border-color, #ddd);
  margin: 0.5rem 0;
}

/* 我的區域 */
.rps-my-area {
  padding: 1rem;
}

.rps-my-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

#rps-my-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: bold;
  color: white;
}

/* 出拳按鈕區 */
#rps-moves {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.rps-move-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--border-color, #ddd);
  background: white;
  font-size: 2.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rps-move-btn:hover:not(.disabled) {
  border-color: var(--color-primary, #4A90A4);
  transform: scale(1.1);
}

.rps-move-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.rps-move-btn.selected {
  border-color: var(--color-primary, #4A90A4);
  background: var(--color-primary-light, #e3f2fd);
  transform: scale(1.1);
}

/* 底部按鈕區 */
.rps-bottom-actions {
  display: flex;
  justify-content: center;
}

#rps-leave-btn {
  padding: 0.5rem 1.5rem;
}

/* 結果覆蓋層 */
#rps-result-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 100;
}

#rps-result-overlay.active {
  opacity: 1;
  visibility: visible;
}

.rps-result-text {
  font-size: 3rem;
  font-weight: bold;
  padding: 1rem 2rem;
  border-radius: 12px;
  background: white;
}

.rps-result-text.result-win {
  color: #4CAF50;
}

.rps-result-text.result-lose {
  color: #f44336;
}

.rps-result-text.result-draw {
  color: #FF9800;
}

/* 遊戲結束畫面 */
#rps-gameover-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 200;
}

#rps-gameover-screen.active {
  opacity: 1;
  visibility: visible;
}

.rps-gameover-title {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.rps-gameover-title.result-win {
  color: #4CAF50;
}

.rps-gameover-title.result-lose {
  color: #f44336;
}

#rps-gameover-score {
  font-size: 2rem;
  color: white;
  margin-bottom: 2rem;
}

.rps-gameover-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 200px;
}

#rps-rematch-btn {
  padding: 1rem;
  font-size: 1rem;
}

#rps-lobby-btn {
  padding: 1rem;
  font-size: 1rem;
}

/* 隱藏聊天介面 */
.chat-container.hidden {
  display: none;
}
