/* ============================================
   COMMON CSS - God Game Platform
   Shared styles for all games (Janggi, Omok, Pool, etc.)
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* ============================================
   CSS VARIABLES - Dark Mode (Default)
   ============================================ */
:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #0f3460;
  --accent: #e94560;
  --accent-hover: #ff6b6b;
  --text-primary: #eee;
  --text-secondary: #aaa;
  --success: #4ade80;
  --warning: #fbbf24;
}

/* ============================================
   CSS VARIABLES - Light Mode
   ============================================ */
body.theme-light {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-card: #e8ecf0;
  --accent: #e94560;
  --accent-hover: #d63050;
  --text-primary: #1a1a2e;
  --text-secondary: #555;
  --success: #22c55e;
  --warning: #f59e0b;
}

/* ============================================
   BASE STYLES
   ============================================ */
html, body {
  height: 100%;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  background: var(--bg-secondary);
  padding: clamp(8px, 2vw, 15px) clamp(10px, 3vw, 30px);
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--accent);
  gap: clamp(8px, 2vw, 20px);
}

.home-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(32px, 4vw, 40px);
  height: clamp(32px, 4vw, 40px);
  background: var(--bg-card);
  border-radius: 8px;
  text-decoration: none;
  font-size: clamp(16px, 2vw, 20px);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.home-btn:hover {
  background: var(--accent);
  transform: scale(1.1);
}

.logo {
  font-size: clamp(16px, 2.5vw, 24px);
  font-weight: bold;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.logo span {
  color: var(--text-primary);
}

.stats-bar {
  display: flex;
  gap: clamp(8px, 2vw, 20px);
  font-size: clamp(11px, 1.5vw, 14px);
  flex: 1;
  justify-content: center;
  white-space: nowrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: clamp(3px, 0.5vw, 5px);
  white-space: nowrap;
}

.stat-item .dot {
  width: clamp(6px, 1vw, 8px);
  height: clamp(6px, 1vw, 8px);
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.header-buttons {
  display: flex;
  gap: clamp(4px, 1vw, 10px);
  flex-shrink: 0;
}

.lang-select {
  padding: clamp(4px, 0.8vw, 6px) clamp(6px, 1vw, 10px);
  font-size: clamp(11px, 1.3vw, 13px);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--bg-card);
  cursor: pointer;
}

.btn-icon {
  padding: clamp(5px, 1vw, 8px) clamp(6px, 1vw, 10px);
  font-size: clamp(14px, 1.5vw, 16px);
}

.user-info {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.5vw, 15px);
  flex-shrink: 0;
}

.user-name {
  cursor: pointer;
  padding: clamp(3px, 0.5vw, 5px) clamp(6px, 1vw, 10px);
  border-radius: 5px;
  transition: background 0.2s;
  white-space: nowrap;
  font-size: clamp(12px, 1.4vw, 14px);
}

.user-name:hover {
  background: var(--bg-card);
}

.user-rating {
  color: var(--warning);
  font-weight: bold;
  font-size: clamp(12px, 1.4vw, 14px);
  white-space: nowrap;
}

#user-info {
  display: flex;
  align-items: center;
}

#guest-info,
#logged-in-info {
  display: flex;
  align-items: center;
  gap: clamp(5px, 1vw, 10px);
}

.btn-login,
.btn-logout {
  padding: clamp(5px, 1vw, 8px) clamp(10px, 1.5vw, 16px);
  font-size: clamp(11px, 1.3vw, 13px);
  white-space: nowrap;
}

/* ============================================
   MAIN CONTAINER
   ============================================ */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ============================================
   LOBBY
   ============================================ */
.lobby {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
}

.lobby-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--text-secondary);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-ai {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-ai:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  transform: translateY(-2px);
}

.btn-small {
  padding: 8px 12px;
  font-size: 14px;
}

.btn-icon {
  padding: 8px 12px;
  background: var(--bg-card);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--bg-primary);
  transform: scale(1.1);
}

.btn-tutorial {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.btn-tutorial:hover {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  transform: translateY(-2px);
}

.btn-login {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  margin-left: 10px;
}

.btn-login:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
}

.btn-logout {
  background: var(--bg-card);
  color: var(--text-secondary);
  margin-left: 10px;
}

.btn-logout:hover {
  background: var(--accent);
  color: white;
}

/* ============================================
   AI DIFFICULTY OPTIONS
   ============================================ */
.ai-difficulty-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-difficulty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.btn-difficulty .difficulty-name {
  font-size: 18px;
  font-weight: bold;
}

.btn-difficulty .difficulty-rating {
  font-size: 12px;
  opacity: 0.8;
}

.btn-difficulty.easy {
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  color: white;
}

.btn-difficulty.easy:hover {
  border-color: #4ade80;
  transform: scale(1.02);
}

.btn-difficulty.medium {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: white;
}

.btn-difficulty.medium:hover {
  border-color: #fbbf24;
  transform: scale(1.02);
}

.btn-difficulty.hard {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.btn-difficulty.hard:hover {
  border-color: #ef4444;
  transform: scale(1.02);
}

/* AI Player indicator */
.player-card .ai-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: bold;
}

/* AI Level Slider */
.ai-level-slider {
  padding: 20px;
  text-align: center;
}

.ai-level-slider input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #4ade80, #fbbf24, #ef4444);
  outline: none;
  -webkit-appearance: none;
}

.ai-level-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.ai-level-display {
  margin-top: 15px;
}

.ai-level-number {
  display: block;
  font-size: 48px;
  font-weight: bold;
  color: var(--accent);
}

.ai-level-name {
  display: block;
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.ai-level-rating {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
}

.ai-level-presets {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}

/* ============================================
   ROOM LIST
   ============================================ */
.room-list-container {
  flex: 1;
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.room-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--bg-card);
}

.room-list-header h2 {
  font-size: 18px;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 5px;
}

.room-list::-webkit-scrollbar {
  width: 6px;
}

.room-list::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 3px;
}

.room-list::-webkit-scrollbar-thumb {
  background: var(--bg-card);
  border-radius: 3px;
}

.room-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.room-item {
  background: var(--bg-card);
  padding: 15px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.room-item:hover {
  background: var(--bg-primary);
  transform: translateX(5px);
}

.room-info h3 {
  font-size: 16px;
  margin-bottom: 5px;
}

.room-info p {
  font-size: 12px;
  color: var(--text-secondary);
}

.room-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.room-players {
  font-size: 14px;
  color: var(--text-secondary);
}

.room-status .playing {
  color: var(--success);
  font-size: 12px;
}

.room-status .waiting {
  color: var(--warning);
  font-size: 12px;
}

.empty-message {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: 300px;
  background: var(--bg-secondary);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-left: 1px solid var(--bg-card);
}

.panel {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 15px;
}

.panel h3 {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.player-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-stats .stat-row {
  display: flex;
  justify-content: space-between;
}

.player-stats .stat-value {
  font-weight: bold;
}

.player-stats .wins { color: var(--success); }
.player-stats .losses { color: var(--accent); }
.player-stats .draws { color: var(--text-secondary); }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  padding: 30px;
  border-radius: 15px;
  min-width: 400px;
  max-width: 90%;
}

.modal h2 {
  margin-bottom: 20px;
  text-align: center;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 14px;
  color: var(--text-secondary);
}

.form-group input,
.form-group select {
  padding: 10px;
  border: 1px solid var(--bg-card);
  border-radius: 5px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

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

.modal-actions .btn {
  flex: 1;
}

.modal-large {
  min-width: 500px;
  max-width: 700px;
}

/* Moves/Log Modal */
#moves-modal .move-list-container,
#log-modal .game-log-container,
#history-modal .hand-history {
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}

#moves-modal .move-list,
#log-modal .game-log,
#history-modal .hand-history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ============================================
   GAME ROOM
   ============================================ */
.game-room {
  display: none;
  flex: 1;
  padding: 10px;
  overflow-y: auto;
}

.game-room.active {
  display: flex;
  gap: 10px;
}

.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 640px;
}

/* ============================================
   PLAYER CARD
   ============================================ */
.player-card {
  background: var(--bg-card);
  padding: 8px 12px;
  border-radius: 8px;
  min-width: 160px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-card.active {
  border: 2px solid var(--accent);
}

.player-card .player-row-1 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-card .player-row-2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.player-card .name {
  font-weight: bold;
  font-size: 14px;
}

.player-card .rating {
  font-size: 13px;
  color: var(--warning);
  font-weight: bold;
}

.player-card .timer {
  font-family: monospace;
  font-size: 14px;
  font-weight: bold;
}

.player-card .timer.warning {
  color: var(--warning);
  animation: pulse 1s infinite;
}

.player-card .timer.danger {
  color: var(--accent);
  animation: pulse 0.5s infinite;
}

.vs-text {
  font-size: 18px;
  font-weight: bold;
  color: var(--text-secondary);
}

/* ============================================
   BOARD CONTAINER (Common)
   ============================================ */
.board-container {
  position: relative;
}

/* ============================================
   GAME CONTROLS
   ============================================ */
.game-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-top: 10px;
}

.game-controls .btn {
  flex: 1;
  min-width: 70px;
  white-space: nowrap;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px;
  text-align: center;
  overflow: hidden;
}

/* ============================================
   GAME CONTROLS MOBILE (820px 이하 전용)
   ============================================ */
.game-controls-mobile {
  display: none; /* 기본: 숨김 */
}

/* ============================================
   MOBILE CHAT SLIDE PANEL (820px 이하 전용)
   ============================================ */
.chat-overlay {
  display: none;
}

.chat-slide-panel {
  display: none;
}

/* ============================================
   CHAT
   ============================================ */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-panel {
  flex: 2;
  width: 300px;
  background: var(--bg-secondary);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-section {
  flex: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-bottom: 1px solid var(--bg-card);
}

.ad-chat-bottom {
  flex: 1;
  width: 300px;
  background: var(--bg-secondary);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

.chat-header {
  padding: 15px;
  border-bottom: 1px solid var(--bg-card);
  font-weight: bold;
}

.chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.chat-message {
  font-size: 14px;
}

.chat-message .sender {
  font-weight: bold;
  color: var(--accent);
}

.chat-message .text {
  color: var(--text-primary);
}

.chat-message.system {
  color: var(--text-secondary);
  font-style: italic;
}

.chat-input-container {
  padding: 8px 10px;
  border-top: 1px solid var(--bg-card);
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.chat-input-container input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--bg-card);
  border-radius: 5px;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.chat-input-container .btn {
  padding: 6px 12px;
  white-space: nowrap;
}

.chat-input-container input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ============================================
   WAITING OVERLAY
   ============================================ */
.waiting-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 20px;
  z-index: 10;
  border-radius: 5px;
}

.waiting-overlay.active {
  display: flex;
}

.waiting-overlay h3 {
  font-size: 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--bg-card);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================
   GAME OVER MODAL
   ============================================ */
.game-over-content {
  text-align: center;
}

.game-over-content .result {
  font-size: 36px;
  font-weight: bold;
  margin-bottom: 20px;
}

.game-over-content .result.win {
  color: var(--success);
}

.game-over-content .result.lose {
  color: var(--accent);
}

.game-over-content .result.draw {
  color: var(--warning);
}

.game-over-content .rating-change {
  font-size: 18px;
  margin-bottom: 20px;
}

.rating-change .positive {
  color: var(--success);
}

.rating-change .negative {
  color: var(--accent);
}

/* ============================================
   SETTINGS MODAL
   ============================================ */
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.setting-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg-card);
}

.setting-group label {
  font-size: 14px;
}

.setting-group select {
  padding: 8px 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--bg-card);
  border-radius: 5px;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-card);
  transition: 0.3s;
  border-radius: 26px;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
}

/* ============================================
   RANKING MODAL
   ============================================ */
.ranking-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.ranking-tab {
  flex: 1;
  padding: 10px;
  background: var(--bg-card);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.ranking-tab.active {
  background: var(--accent);
  color: white;
}

.ranking-list {
  max-height: 400px;
  overflow-y: auto;
}

.ranking-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 8px;
  margin-bottom: 8px;
}

.ranking-position {
  width: 40px;
  font-size: 20px;
  font-weight: bold;
  color: var(--text-secondary);
}

.ranking-position.gold { color: #ffd700; }
.ranking-position.silver { color: #c0c0c0; }
.ranking-position.bronze { color: #cd7f32; }

.ranking-info {
  flex: 1;
}

.ranking-name {
  font-weight: bold;
}

.ranking-stats {
  font-size: 12px;
  color: var(--text-secondary);
}

.ranking-rating {
  font-size: 18px;
  font-weight: bold;
  color: var(--warning);
}

/* Mini Ranking in Sidebar */
.mini-ranking {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-ranking-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.mini-ranking-item .position {
  color: var(--warning);
  font-weight: bold;
  width: 20px;
}

.mini-ranking-item .name {
  flex: 1;
  margin-left: 8px;
}

.mini-ranking-item .rating {
  color: var(--text-secondary);
}

/* ============================================
   TUTORIAL MODAL
   ============================================ */
.tutorial-content {
  min-height: 300px;
  padding: 20px;
}

.tutorial-step {
  text-align: center;
}

.tutorial-step h3 {
  font-size: 24px;
  margin-bottom: 20px;
  color: var(--accent);
}

.tutorial-step p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.tutorial-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--bg-card);
}

.tutorial-progress {
  color: var(--text-secondary);
}

/* ============================================
   SPECTATE LIST
   ============================================ */
.spectate-list {
  max-height: 300px;
  overflow-y: auto;
}

.spectate-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: var(--bg-card);
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.spectate-item:hover {
  background: var(--bg-primary);
}

.spectate-players {
  font-size: 14px;
}

.spectate-status {
  color: var(--success);
  font-size: 12px;
}

.loading-text {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px;
}

/* ============================================
   AUTH STYLES
   ============================================ */
.auth-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--bg-card);
}

.auth-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.2s;
  position: relative;
}

.auth-tab.active {
  color: var(--accent);
}

.auth-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.auth-tab:hover {
  color: var(--text-primary);
}

.auth-form {
  padding: 10px 0;
}

.auth-error {
  color: var(--accent);
  font-size: 14px;
  text-align: center;
  margin: 10px 0;
  min-height: 20px;
}

.input-hint {
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

.input-hint.available {
  color: var(--success);
}

.input-hint.taken {
  color: var(--accent);
}

.logged-in-badge {
  background: var(--success);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 5px;
}

/* Profile dropdown */
.user-menu {
  position: relative;
}

.user-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-card);
  border-radius: 8px;
  padding: 10px 0;
  min-width: 150px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 100;
}

.user-menu-dropdown.active {
  display: block;
}

.user-menu-item {
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.2s;
}

.user-menu-item:hover {
  background: var(--bg-card);
}

/* Password strength indicator */
.password-strength {
  height: 4px;
  border-radius: 2px;
  margin-top: 5px;
  background: var(--bg-card);
  overflow: hidden;
}

.password-strength-fill {
  height: 100%;
  transition: width 0.3s, background 0.3s;
}

.password-strength-fill.weak {
  width: 33%;
  background: var(--accent);
}

.password-strength-fill.medium {
  width: 66%;
  background: var(--warning);
}

.password-strength-fill.strong {
  width: 100%;
  background: var(--success);
}

/* ============================================
   HAMBURGER MENU (Mobile)
   ============================================ */
.hamburger-btn {
  display: none;
  background: var(--bg-card);
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s;
}

.hamburger-btn:hover {
  background: var(--accent);
}

.hamburger-menu {
  display: none;
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100vh;
  background: var(--bg-secondary);
  z-index: 1001;
  transition: right 0.3s ease;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}

.hamburger-menu.active {
  right: 0;
}

.hamburger-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
}

.hamburger-overlay.active {
  display: block;
}

.hamburger-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid var(--bg-card);
}

.hamburger-header h3 {
  font-size: 16px;
  color: var(--text-primary);
}

.hamburger-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
}

.hamburger-close:hover {
  color: var(--accent);
}

.hamburger-content {
  padding: 15px;
}

.hamburger-section {
  margin-bottom: 20px;
}

.hamburger-section h4 {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--bg-card);
}

.hamburger-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hamburger-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.hamburger-stat-row .label {
  color: var(--text-secondary);
}

.hamburger-stat-row .value {
  font-weight: bold;
}

.hamburger-stat-row .value.wins { color: var(--success); }
.hamburger-stat-row .value.losses { color: var(--accent); }
.hamburger-stat-row .value.draws { color: var(--text-secondary); }

.hamburger-ranking {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hamburger-ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 13px;
}

.hamburger-ranking-item .position {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  border-radius: 50%;
  font-weight: bold;
  font-size: 12px;
}

.hamburger-ranking-item .position.gold { color: #ffd700; }
.hamburger-ranking-item .position.silver { color: #c0c0c0; }
.hamburger-ranking-item .position.bronze { color: #cd7f32; }

.hamburger-ranking-item .name {
  flex: 1;
}

.hamburger-ranking-item .rating {
  color: var(--warning);
  font-weight: bold;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-top: 2px solid var(--accent);
  padding: 12px 30px;
  flex-shrink: 0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  font-size: 12px;
  color: var(--text-secondary);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-brand .logo-text {
  font-weight: bold;
  color: var(--accent);
}

.footer-brand .logo-text span {
  color: var(--text-primary);
}

.footer-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.footer-links {
  display: flex;
  gap: 15px;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
  padding: 4px 8px;
  border-radius: 4px;
}

.footer-links a:hover {
  color: var(--accent);
  background: var(--bg-card);
}

.footer-social {
  display: flex;
  gap: 10px;
}

.footer-social a {
  color: var(--text-secondary);
  font-size: 16px;
  transition: color 0.2s;
}

.footer-social a:hover {
  color: var(--accent);
}

.footer-copyright {
  color: var(--text-secondary);
  opacity: 0.7;
}

.footer-credits {
  display: block;
}

/* ============================================
   ADVERTISEMENT STYLES
   ============================================ */
.ad-container {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-game-mobile {
  display: none;
}

.ad-sidebar {
  margin-top: auto;
}

.ad-lobby {
  margin-top: 15px;
  min-height: 90px;
}

.ad-container ins {
  width: 100%;
}

/* ============================================
   LANGUAGE SELECTOR
   ============================================ */
.lang-select {
  width: 50px;
  padding: 6px 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--bg-primary);
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
  text-overflow: clip;
}

.lang-select:hover {
  background: var(--bg-primary);
  border-color: var(--accent);
}

.lang-select:focus {
  outline: none;
  border-color: var(--accent);
}

.lang-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ============================================
   SCROLLBAR STYLES
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-card);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ============================================
   LOADING STATES
   ============================================ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-secondary) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-card {
  height: 80px;
  margin-bottom: 10px;
}

/* Button loading state */
.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 8px;
}

/* ============================================
   TOUCH-FRIENDLY IMPROVEMENTS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets on touch devices */
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .btn-small {
    min-height: 36px;
  }

  .btn-icon {
    min-width: 44px;
    min-height: 44px;
  }

  .room-item {
    padding: 18px 15px;
  }

  .form-group input,
  .form-group select {
    min-height: 44px;
    font-size: 16px; /* Prevents iOS zoom on focus */
  }

  .lang-select {
    min-height: 44px;
  }

  /* Prevent double-tap zoom on buttons */
  .btn, button {
    touch-action: manipulation;
  }
}

/* ============================================
   SAFE AREA (Notch support)
   ============================================ */
@supports (padding: env(safe-area-inset-top)) {
  .header {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    padding-left: max(30px, env(safe-area-inset-left));
    padding-right: max(30px, env(safe-area-inset-right));
  }

  .modal {
    padding-bottom: max(30px, env(safe-area-inset-bottom));
  }

  @media (max-width: 820px) {
    .chat-slide-panel {
      padding-bottom: env(safe-area-inset-bottom);
    }

    .game-controls-mobile {
      padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
  }
}

/* ============================================
   PULL TO REFRESH INDICATOR
   ============================================ */
.pull-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: var(--accent);
  color: white;
  padding: 8px 16px;
  border-radius: 0 0 8px 8px;
  font-size: 12px;
  transition: transform 0.3s;
  z-index: 1000;
}

.pull-indicator.visible {
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   ERROR STATE
   ============================================ */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.error-container .error-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.error-container .error-message {
  font-size: 16px;
  margin-bottom: 20px;
}

.error-container .btn-retry {
  background: var(--accent);
  color: white;
}

/* ============================================
   RESPONSIVE - Desktop to Tablet (1200px)
   ============================================ */
/* @media (max-width: 1200px) {
  .sidebar {
    display: none;
  }
} */

/* ============================================
   RESPONSIVE - Tablet/Mobile (820px) - Mobile layout starts here
   ============================================ */
@media (max-width: 820px) {
  html, body {
    overflow-x: hidden;
    max-width: 100%;
  }

  .game-room.active {
    flex-direction: column;
  }

  .chat-panel {
    width: 100%;
  }

  /* Show hamburger menu from tablet */
  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .hamburger-menu {
    display: block;
  }

  /* Header - simplified layout */
  .header {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px 12px;
    justify-content: space-between;
    align-items: center;
  }

  .home-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
    margin-right: 8px;
  }

  .logo {
    font-size: 14px;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Hide stats bar */
  .stats-bar {
    display: none;
  }

  /* Hide language select - move to hamburger menu */
  .lang-select {
    display: none;
  }

  .header-buttons .btn-icon[onclick*="Ranking"] {
    display: none;
  }

  .header-buttons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
  }

  /* User info simplified */
  .user-info {
    gap: 6px;
    flex-shrink: 0;
  }

  #guest-info,
  #logged-in-info {
    gap: 6px;
  }

  .user-name {
    display: none;
  }

  .user-rating {
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    background: var(--bg-card);
    border-radius: 4px;
  }

  .btn-small {
    padding: 6px 8px;
    font-size: 11px;
  }

  .btn-login {
    padding: 6px 10px;
    font-size: 11px;
  }

  .btn-icon {
    padding: 6px 8px;
    font-size: 14px;
  }

  /* LOBBY MOBILE LAYOUT */
  .main-container {
    flex-direction: column;
    overflow-y: auto;
  }

  .lobby {
    padding: 10px;
    gap: 10px;
    overflow: visible;
    flex: 1;
  }

  .lobby-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .lobby-actions .btn {
    width: 100%;
    padding: 12px 8px;
    font-size: 13px;
    white-space: nowrap;
  }

  .room-list-container {
    min-height: 120px;
    flex: 1;
  }

  /* Hide sidebar on mobile in game room */
  .sidebar {
    display: none !important;
  }

  .ad-lobby {
    min-height: 60px;
    margin-top: 10px;
  }

  /* GAME ROOM LAYOUT */
  .game-room {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .game-room.active {
    padding: 0;
    gap: 0;
    flex-direction: column;
    overflow-y: auto;
    width: 100%;
  }

  .game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start !important;
    gap: 6px;
    padding: 6px;
    padding-top: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex: 1;
  }

  /* Player card - 상단 배치 */
  .game-header {
    max-width: 100%;
    width: 100%;
    gap: 8px;
    padding: 6px;
    margin: 0;
    flex-direction: row;
    align-items: stretch;
    flex-shrink: 0;
    order: -1;
  }

  .player-card {
    padding: 8px 10px;
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .player-card.active {
    box-shadow: 0 0 0 2px var(--accent), 0 0 10px rgba(233, 69, 96, 0.3);
  }

  .player-card .player-row-1 {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .player-card .piece-indicator,
  .player-card .stone-indicator,
  .player-card .color-indicator {
    font-size: 16px;
    flex-shrink: 0;
  }

  .player-card .name {
    font-size: 13px;
    font-weight: bold;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .player-card .player-row-2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .player-card .rating {
    font-size: 12px;
    color: var(--warning);
  }

  .player-card .timer {
    font-size: 16px;
    font-weight: bold;
    font-family: monospace;
  }

  .player-card .ai-badge {
    font-size: 8px;
    padding: 2px 5px;
    top: -4px;
    right: -4px;
  }

  .vs-text {
    font-size: 14px;
    flex-shrink: 0;
    align-self: center;
  }

  /* 820px 이하: chat-wrapper 숨김 */
  .chat-wrapper {
    display: none !important;
  }

  /* 820px 이하: 모바일 전용 게임 컨트롤 표시 (1줄) */
  .game-controls-mobile {
    display: flex;
    flex-direction: row;
    gap: 4px;
    width: 100%;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-top: 6px;
  }

  .game-controls-mobile .btn {
    flex: 1;
    padding: 10px 4px;
    font-size: 11px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
  }

  .game-controls-mobile .btn-chat {
    flex: 0 0 44px;
    font-size: 16px;
  }

  .ad-game-mobile {
    display: block !important;
    width: 100%;
    min-height: 50px;
    margin-top: 6px;
  }

  /* 슬라이드 업 채팅 패널 */
  .chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  .chat-overlay.active {
    display: block;
  }

  .chat-slide-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45vh;
    background: var(--bg-secondary);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .chat-slide-panel.active {
    display: flex;
    transform: translateY(0);
  }

  .chat-slide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--bg-card);
  }

  .chat-slide-header h4 {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
  }

  .chat-slide-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
  }

  .chat-slide-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .chat-slide-input {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--bg-card);
  }

  .chat-slide-input input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 20px;
    border: 1px solid var(--bg-card);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
  }

  .chat-slide-input button {
    padding: 10px 16px;
    border-radius: 20px;
  }

  /* FOOTER - Single line */
  .footer {
    padding: 6px 12px;
  }

  .footer-content {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    flex-wrap: wrap;
  }

  .footer-brand {
    gap: 4px;
  }

  .footer-brand .logo-text {
    font-size: 11px;
  }

  .footer-info {
    flex-direction: row;
    gap: 4px;
  }

  .footer-links {
    gap: 6px;
  }

  .footer-links a {
    padding: 2px 4px;
    font-size: 10px;
  }

  .footer-credits {
    display: none;
  }

  .ad-sidebar {
    display: none;
  }

  /* Modal adjustments */
  .modal {
    min-width: auto;
    width: 95%;
    max-width: 400px;
    padding: 20px;
    margin: 10px;
  }

  .modal-large {
    min-width: auto;
    max-width: 95%;
  }
}

/* ============================================
   RESPONSIVE - Small Mobile (480px)
   ============================================ */
@media (max-width: 480px) {
  .header {
    padding: 6px 8px;
  }

  .home-btn {
    width: 28px;
    height: 28px;
    font-size: 14px;
    margin-right: 4px;
  }

  .logo {
    font-size: 11px;
  }

  .btn-small {
    padding: 5px 6px;
    font-size: 10px;
  }

  .btn-icon {
    padding: 5px 6px;
    font-size: 12px;
  }

  .lobby-actions .btn {
    padding: 10px 6px;
    font-size: 12px;
  }

  .game-room.active {
    padding: 4px;
    gap: 4px;
  }

  .game-area {
    gap: 4px;
  }

  .game-header {
    gap: 4px;
  }

  .player-card {
    padding: 4px 6px;
  }

  .player-card .name {
    font-size: 11px;
  }

  .player-card .rating {
    font-size: 10px;
  }

  .vs-text {
    font-size: 12px;
  }

  .game-controls .btn {
    padding: 8px 4px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }
}

/* ============================================
   RESPONSIVE - Extra Small Phones (380px)
   ============================================ */
@media (max-width: 380px) {
  .header {
    padding: 5px 6px;
    gap: 4px;
  }

  .home-btn {
    width: 26px;
    height: 26px;
    font-size: 12px;
    margin-right: 2px;
  }

  .logo {
    font-size: 10px;
  }

  .game-room.active {
    padding: 3px;
    gap: 3px;
  }

  .game-area {
    gap: 3px;
  }

  .game-header {
    gap: 3px;
  }

  .player-card {
    padding: 3px 5px;
  }

  .player-card .name {
    font-size: 10px;
  }

  .player-card .rating {
    font-size: 9px;
  }

  .player-card .timer {
    font-size: 12px;
  }

  .vs-text {
    font-size: 10px;
  }

  .footer {
    padding: 4px 6px;
  }

  .footer-content {
    font-size: 8px;
  }

  .game-controls .btn {
    padding: 6px 3px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }
}

/* ============================================
   SPECTATOR MODE (Common for all games)
   ============================================ */

.spectator-count-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.btn-spectate {
  background: linear-gradient(135deg, #9b59b6, #8e44ad);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-spectate:hover {
  background: linear-gradient(135deg, #8e44ad, #7d3c98);
  transform: scale(1.05);
}

/* Spectator Badge */
.spectator-badge {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* Spectator Info (count) */
.spectator-info {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
}

/* Leave Spectate Button */
.btn-spectate-leave {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-spectate-leave:hover {
  background: linear-gradient(135deg, #c0392b, #a93226);
  transform: scale(1.05);
}

/* Spectator mode adjustments */
.game-room.spectator-mode .game-controls button:not(.btn-spectate-leave) {
  display: none !important;
}

.game-room.spectator-mode #chat-input {
  opacity: 0.5;
  pointer-events: none;
}

/* Spectator in participant list */
.participant-item.spectator {
  border-left: 3px solid #9b59b6;
}

/* ============================================
   RECONNECT OVERLAY
   Shows when WebSocket connection is lost
   ============================================ */
#reconnect-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

#reconnect-overlay.active {
  display: flex;
}

.reconnect-content {
  text-align: center;
  color: white;
  padding: 30px;
  background: rgba(50, 50, 50, 0.9);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.reconnect-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent, #e94560);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: reconnect-spin 1s linear infinite;
}

@keyframes reconnect-spin {
  to {
    transform: rotate(360deg);
  }
}

.reconnect-text {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
}

.reconnect-attempt {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 20px;
}

.reconnect-refresh {
  padding: 10px 25px;
  background: var(--accent, #e94560);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reconnect-refresh:hover {
  background: var(--accent-hover, #ff6b6b);
  transform: scale(1.05);
}
