:root {
  --primary-color: #4a69bd;
  --board-bg: #e4a76c;
  --board-line: #573312;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f0f2f5;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 10px;
}

/* 登入介面 */
#lobby {
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  margin-top: 30px;
}

#lobby h2 {
  text-align: center;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 15px;
}

label {
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
  color: #333;
}

input[type="text"], select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 16px;
}

button.btn {
  width: 100%;
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

button.btn:active {
  transform: scale(0.98);
}

/* 遊戲對戰區塊 (RWD) */
#game-container {
  display: none;
  width: 100%;
  max-width: 550px;
  flex-direction: column;
  align-items: center;
}

.header-info {
  width: 100%;
  background: white;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  text-align: center;
  font-size: 14px;
}

.disp-opponent-txt {
  color: #666;
  margin-top: 3px;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: bold;
  margin-top: 5px;
  background: #eee;
}

/* 棋盤容器 */
.board-wrapper {
  position: relative;
  width: 100%;
  max-width: 500px;
  aspect-ratio: 1 / 1;
  background: var(--board-bg);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  touch-action: none;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 控制列 */
.controls {
  width: 100%;
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.controls button {
  flex: 1;
  padding: 10px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

.btn-undo {
  background: #f39c12;
  color: white;
  display: none;
}

.btn-surrender {
  background: #e74c3c;
  color: white;
}

.btn-rematch {
  background: #2ecc71;
  color: white;
  display: none;
}

/* 彈跳視窗 Modal */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: white;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 320px;
  text-align: center;
}

.modal-box p {
  margin-top: 10px;
  color: #555;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.modal-actions button {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

.btn-accept {
  background: #2ecc71;
  color: white;
}

.btn-reject {
  background: #95a5a6;
  color: white;
}
