/* ========== Word Guess (猜词派对) ========== */

/* ========== Room List View ========== */
.wg-room-list {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  overflow: hidden;
  padding: 16px;
  max-width: 1920px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.wg-grid-wrap {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 16px 0px;
  flex: 1;
  overflow-y: auto;
  position: relative;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 16px);
  mask-image: linear-gradient(to bottom, transparent 0px, black 16px);
}

.wg-room-list h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.wg-room-list h2 svg {
  color: var(--primary);
}

.wg-subtitle {
  color: var(--text-light);
  font-size: 16px;
  margin: 16px 0 0;
}

.wg-rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: 160px;
  gap: 16px;
}

@media (max-width: 1200px) {
  .wg-rooms-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

.wg-room-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
  position: relative;
}

.wg-room-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);
  border-color: var(--primary);
}

.wg-room-card.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(var(--primary-rgb, 124,158,255), 0.08), rgba(var(--primary-rgb, 124,158,255), 0.02));
}

.wg-room-status {
  font-size: 14px;
  color: var(--text-light);
}

.wg-room-status .playing {
  color: #4caf50;
  font-weight: 600;
}

.wg-room-status .idle {
  color: #999;
}

.wg-room-players {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  color: var(--text-secondary);
}

.wg-room-players svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.wg-room-join {
  margin-top: auto;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.wg-room-join:hover {
  opacity: 0.9;
}

.wg-room-join.disabled {
  background: #ccc;
  cursor: not-allowed;
  pointer-events: none;
}

.wg-create-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(124, 158, 255, 0.4);
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  box-sizing: border-box;
  width: 100%;
}

.wg-create-card:hover {
  border-color: var(--primary);
  background: rgba(124, 158, 255, 0.06);
}

.wg-create-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(124, 158, 255, 0.15), rgba(168, 237, 234, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.wg-create-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-top: 10px;
}

.wg-create-room-bar {
  margin-bottom: 20px;
  margin-top: 4px;
}

.wg-room-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.wg-room-char-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.wg-room-random-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a8edea, #fed6e3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.wg-room-info {
  flex: 1;
  min-width: 0;
}

.wg-room-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wg-room-char-label {
  font-size: 13px;
  color: var(--primary);
  margin-top: 2px;
}

.wg-room-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

/* ========== Create Room Modal ========== */
.wg-create-modal {
  width: 420px;
  max-width: 90vw;
}

.wg-create-modal h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

.wg-create-modal .form-group {
  margin-bottom: 14px;
}

.wg-create-modal label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.wg-char-select-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}

.wg-char-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.wg-char-option:hover {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb, 124,158,255), 0.06);
}

.wg-char-option.selected {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb, 124,158,255), 0.12);
  box-shadow: 0 0 0 1px var(--primary);
}

.wg-char-option-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, #a8edea, #fed6e3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.wg-char-option-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  word-break: break-all;
  line-height: 1.3;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* ========== Game View ========== */
.wg-game-view {
  display: flex;
  gap: 16px;
  padding: 16px 24px;
  height: calc(100vh - 60px);
  box-sizing: border-box;
  max-width: 1920px;
  margin: 0 auto;
  width: 100%;
}

/* ========== Left: Character Panel ========== */
.wg-char-side {
  width: 400px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  position: relative;
  flex-shrink: 0;
}

#wgCharLeftPanel {
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

/* AI Dialogue Bubble */
.wg-ai-bubble {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 300px;
  pointer-events: auto;
  animation: wg-bubble-in 0.3s ease-out;
}

@keyframes wg-bubble-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.wg-ai-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.8);
}

.wg-ai-text {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  padding: 10px 14px;
  border-radius: 14px 14px 14px 4px;
  font-size: 16px;
  color: var(--text);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  line-height: 1.5;
}

/* ========== Center: Guess Ranking ========== */
.wg-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}

.wg-glass {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 200px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  position: relative;
}

.wg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: relative;
}

.wg-header .back-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.wg-header .back-btn:hover {
  background: rgba(0,0,0,0.05);
}

.wg-header .back-btn svg {
  display: block;
}

.wg-room-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-dark);
  white-space: nowrap;
}

.wg-timer-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 17px;
  color: var(--text-secondary);
}

.wg-timer {
  font-weight: 700;
  color: var(--primary);
  min-width: 28px;
  text-align: center;
}

.wg-timer.urgent {
  color: #f44336;
  animation: wg-timer-pulse 1s infinite;
}

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

/* Hint Bar */
.wg-ai-hint-bar {
  padding: 10px 20px;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(139, 195, 74, 0.05));
  border-bottom: 1px solid rgba(76, 175, 80, 0.2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.wg-ai-hint-label {
  font-size: 16px;
  font-weight: 700;
  color: #2e7d32;
  background: rgba(76, 175, 80, 0.15);
  padding: 2px 8px;
  border-radius: 6px;
}

.wg-ai-hint-text {
  font-size: 18px;
  color: var(--text);
}

.wg-hint-bar {
  padding: 10px 20px;
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 152, 0, 0.05));
  border-bottom: 1px solid rgba(255, 193, 7, 0.2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.wg-hint-label {
  font-size: 16px;
  font-weight: 700;
  color: #f57c00;
  background: rgba(255, 152, 0, 0.15);
  padding: 2px 8px;
  border-radius: 6px;
}

.wg-hint-text {
  font-size: 18px;
  color: var(--text);
}

.wg-length-hint {
  font-size: 15px;
  font-weight: 600;
  color: #f57c00;
  background: rgba(255, 152, 0, 0.12);
  border: 1px solid rgba(255, 152, 0, 0.25);
  padding: 2px 10px;
  border-radius: 8px;
  margin-left: 4px;
  white-space: nowrap;
}

.wg-word-hint {
  font-size: 15px;
  font-weight: 600;
  color: #1976d2;
  background: rgba(25, 118, 210, 0.1);
  border: 1px solid rgba(25, 118, 210, 0.25);
  padding: 2px 10px;
  border-radius: 8px;
  margin-left: 4px;
  white-space: nowrap;
}

.wg-first-char-hint {
  font-size: 15px;
  font-weight: 600;
  color: #7b1fa2;
  background: rgba(123, 31, 162, 0.1);
  border: 1px solid rgba(123, 31, 162, 0.25);
  padding: 2px 10px;
  border-radius: 8px;
  margin-left: 4px;
  white-space: nowrap;
}

/* Rank List */
.wg-rank-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.wg-danmaku-layer {
  position: absolute;
  top: 120px;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 10;
}

.wg-danmaku-item {
  position: absolute;
  white-space: nowrap;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  font-size: 18px;
  font-weight: 500;
  left: 100%;
  top: 0;
  animation: wg-danmaku-move 9s linear forwards;
  display: block;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  opacity: 1;
  visibility: visible;
  z-index: 11;
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.wg-danmaku-item img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
  border: 1px solid rgba(255,255,255,0.3);
}

.wg-danmaku-item span {
  color: #ffffff !important;
  display: inline-block;
  vertical-align: middle;
  font-size: 18px;
  line-height: 26px;
}

@keyframes wg-danmaku-move {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-100vw - 120%));
  }
}

.wg-empty-hint {
  text-align: center;
  color: var(--text-light);
  padding: 40px 20px;
  font-size: 18px;
}

.wg-rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  margin-bottom: 8px;
  transition: all 0.3s;
  animation: wg-fly-in 0.5s ease-out;
}

.wg-rank-item:nth-child(1) {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 193, 7, 0.08));
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.wg-rank-item:nth-child(2) {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.12), rgba(169, 169, 169, 0.06));
  border: 1px solid rgba(192, 192, 192, 0.3);
}

.wg-rank-item:nth-child(3) {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.12), rgba(184, 115, 51, 0.06));
  border: 1px solid rgba(205, 127, 50, 0.3);
}

@keyframes wg-fly-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.wg-rank-pos {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 24px;
  text-align: center;
}

.wg-rank-item:nth-child(1) .wg-rank-pos { color: #ffc107; }
.wg-rank-item:nth-child(2) .wg-rank-pos { color: #9e9e9e; }
.wg-rank-item:nth-child(3) .wg-rank-pos { color: #cd7f32; }

.wg-rank-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.8);
}

.wg-rank-info {
  flex: 1;
  min-width: 0;
}

.wg-rank-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wg-rank-badge {
  display: inline-block;
  font-size: 15px;
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 6px;
  font-weight: 600;
  vertical-align: middle;
}

.wg-rank-word {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.wg-rank-similarity {
  font-size: 22px;
  font-weight: 700;
  min-width: 70px;
  text-align: right;
}

.wg-rank-similarity.high { color: #4caf50; }
.wg-rank-similarity.medium { color: #ff9800; }
.wg-rank-similarity.low { color: #9e9e9e; }
.wg-rank-similarity.correct {
  color: #4caf50;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.4);
}

/* Input Area */
.wg-input-area {
  flex-shrink: 0;
  order: 1;
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.wg-input-box {
  display: flex;
  gap: 8px;
}

.wg-input-box input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  font-size: 17px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s;
  outline: none;
}

.wg-input-box input:focus {
  border-color: var(--primary);
}

.wg-send-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.wg-send-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.wg-send-btn:active {
  transform: translateY(0);
}

.wg-input-hint {
  font-size: 16px;
  color: var(--text-light);
  margin-top: 6px;
  text-align: center;
}

/* ========== Right: Score Leaderboard ========== */
.wg-score-panel {
  width: 320px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.wg-score-header {
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  gap: 8px;
}

.wg-score-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.wg-score-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  transition: background 0.15s;
}

.wg-score-item:hover {
  background: rgba(0,0,0,0.03);
}

.wg-score-pos {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 20px;
  text-align: center;
}

.wg-score-item:nth-child(1) .wg-score-pos { color: #ffc107; }
.wg-score-item:nth-child(2) .wg-score-pos { color: #9e9e9e; }
.wg-score-item:nth-child(3) .wg-score-pos { color: #cd7f32; }

.wg-score-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.wg-score-info {
  flex: 1;
  min-width: 0;
}

.wg-score-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wg-score-rank {
  font-size: 15px;
  font-weight: 600;
}

.wg-score-points {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
}

/* Mobile rank toggle - hidden by default */
.wg-rank-toggle,
.wg-rank-sidebar,
.wg-rank-backdrop {
  display: none;
}

/* ========== Settlement Modal ========== */
.wg-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: wg-modal-in 0.3s ease-out;
}

@keyframes wg-modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.wg-modal-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: wg-modal-scale 0.3s ease-out;
}

@keyframes wg-modal-scale {
  from { transform: scale(0.9); }
  to { transform: scale(1); }
}

.wg-modal-header {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary-dark);
  text-align: center;
  margin-bottom: 16px;
}

.wg-modal-winner {
  text-align: center;
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
}

.wg-modal-target {
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
}

.wg-modal-scores {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.wg-modal-score-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: rgba(0,0,0,0.03);
}

.wg-modal-score-item:nth-child(1) {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 193, 7, 0.08));
}

.wg-modal-score-word {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.wg-modal-score-sim {
  font-size: 16px;
  color: var(--text-secondary);
}

.wg-modal-score-pts {
  margin-left: auto;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.wg-modal-footer {
  text-align: center;
  font-size: 16px;
  color: var(--text-light);
}

/* AI closing remark in settlement modal */
.wg-settle-remark {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.wg-settle-remark-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.wg-settle-remark-bubble {
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 10px 14px;
  border-radius: 14px 14px 14px 4px;
  font-size: 15px;
  line-height: 1.5;
  max-width: 80%;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ========== Game Type Tabs ========== */
.wg-game-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 0;
  justify-content: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 4px;
}

.wg-game-tabs::-webkit-scrollbar {
  display: none;
}

/* ========== Room Type Tags ========== */
.wg-room-type-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
  vertical-align: middle;
  margin-left: 4px;
}

.wg-room-type-tag.guess {
  background: rgba(33, 150, 243, 0.12);
  color: #2196f3;
}

.wg-room-type-tag.draw {
  background: rgba(255, 152, 0, 0.12);
  color: #ff9800;
}

.wg-room-type-tag.pvp {
  background: rgba(76, 175, 80, 0.12);
  color: #4caf50;
}

.wg-room-type-tag.pve {
  background: rgba(156, 39, 176, 0.12);
  color: #9c27b0;
}

/* ========== Responsive ========== */
@media (max-width: 1100px) {
  .wg-char-side {
    width: 280px;
  }
  .wg-score-panel {
    width: 260px;
  }
}

@media (max-width: 900px) {
  .wg-game-view {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 60px);
  }

  .wg-char-side {
    width: 100%;
    height: 200px;
    flex-direction: row;
  }

  #wgCharLeftPanel {
    width: 200px;
    height: 100%;
  }

  .wg-ai-bubble {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    margin: auto;
  }

  .wg-center {
    flex: 1;
    min-height: 400px;
  }

  .wg-score-panel {
    width: 100%;
    max-height: 300px;
  }
}

@media (max-width: 600px) {
  .site-footer {
    display: none;
  }

  body.wg-active .global-topbar {
    display: none;
  }

  body.wg-active .chat-bg {
    display: none;
  }

  .wg-mobile-back {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
  }
  .wg-mobile-back:active {
    background: rgba(0, 0, 0, 0.12);
  }

  body.wg-active .wg-mobile-back {
    display: inline-flex;
  }

  body.wg-active .wg-game-view {
    margin-top: 0;
    height: 100dvh;
  }

  .wg-game-view {
    padding: 0;
    gap: 0;
    margin-top: 60px;
    height: calc(100dvh - 60px);
    flex-direction: column;
    position: relative;
    overflow: hidden;
  }

  .main {
    padding-top: 0;
  }

  .wg-room-list {
    height: 100dvh;
    padding: 76px 16px 0 16px;
  }

  .wg-grid-wrap {
    padding: 16px 16px 40px;
    width: 100%;
  }

  .wg-rooms-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 150px;
    gap: 10px;
    width: 100%;
    justify-items: stretch;
  }

  .wg-room-card,
  .wg-create-card {
    padding: 14px;
    border-radius: 12px;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0;
    width: 100%;
    flex-shrink: 0;
  }

  .wg-room-card {
    justify-content: space-between;
    border: 1px solid rgba(255, 255, 255, 0.5);
  }

  .wg-create-card {
    justify-content: center;
    border: 2px dashed rgba(124, 158, 255, 0.4);
  }

  .wg-room-status {
    font-size: 13px;
  }

  .wg-room-players {
    font-size: 14px;
  }

  .wg-room-join {
    padding: 8px;
    font-size: 14px;
    margin-top: 8px;
  }

  .wg-create-modal {
    width: 90vw;
    max-width: none;
  }

  .wg-char-select-list {
    grid-template-columns: repeat(3, 1fr);
    max-height: 200px;
  }

  .wg-char-side {
    display: none;
  }

  #wgCharLeftPanel {
    width: 100% !important;
  }

  .wg-game-area {
    flex: 1;
    position: relative;
    min-height: 0;
    overflow: hidden;
  }

  .wg-mobile-char {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 1;
    background: linear-gradient(180deg, #e8f0fe 0%, #dce8f8 100%);
  }

  .wg-mobile-char .clp-info-card,
  .wg-mobile-char .clp-affection-bar,
  .wg-mobile-char .clp-like-row,
  .wg-mobile-char .status {
    display: none !important;
  }

  .wg-mobile-char .clp-panel {
    height: 100%;
    gap: 0;
  }

  .wg-mobile-char .clp-portrait-wrap {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100%;
    align-self: stretch;
  }

  .wg-mobile-char .char-live2d-canvas,
  .wg-mobile-char .char-live2d-canvas canvas {
    background: transparent !important;
  }

  .wg-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
  }

  .wg-score-panel {
    display: none;
  }

  .wg-score-header {
    padding: 8px 10px;
    font-size: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
  }

  .wg-score-header svg {
    width: 16px;
    height: 16px;
  }

  .wg-score-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .wg-score-list .wg-score-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 6px 8px;
    gap: 6px;
    margin-bottom: 0;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
  }

  .wg-score-list .wg-score-pos {
    display: none;
  }

  .wg-score-list .wg-score-avatar {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border: none;
  }

  .wg-score-list .wg-score-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .wg-score-list .wg-score-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
  }

  .wg-score-list .wg-score-rank {
    display: none;
  }

  .wg-score-list .wg-score-points {
    font-size: 14px;
    min-width: 28px;
    flex-shrink: 0;
    font-weight: 700;
    color: var(--primary-dark);
    text-align: right;
    line-height: 1.2;
  }

  .wg-glass {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    position: relative;
  }

  .wg-header {
    padding: 6px 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 20;
  }

  .wg-header .back-btn {
    padding: 4px;
  }

  .wg-room-title {
    font-size: 13px;
  }

  .wg-timer-wrap {
    font-size: 13px;
    flex-shrink: 0;
  }

  .wg-hint-bar,
  .wg-ai-hint-bar {
    padding: 8px 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 6px;
    position: relative;
    z-index: 20;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .wg-hint-label,
  .wg-ai-hint-label {
    font-size: 14px;
  }

  .wg-hint-text,
  .wg-ai-hint-text {
    font-size: 14px;
  }

  .wg-length-hint,
  .wg-word-hint,
  .wg-first-char-hint {
    font-size: 13px;
    padding: 2px 6px;
  }

  .wg-room-list h2 {
    font-size: 20px;
    margin-bottom: 4px;
  }

  .wg-grid-wrap {
    padding: 16px 0px 40px;
  }

  .wg-subtitle {
    font-size: 14px;
  }

  .wg-room-title {
    font-size: 14px;
  }

  .wg-timer-wrap {
    font-size: 14px;
    flex-shrink: 0;
  }

  .wg-hint-bar,
  .wg-ai-hint-bar {
    padding: 6px 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .wg-hint-label,
  .wg-ai-hint-label {
    font-size: 14px;
  }

  .wg-hint-text,
  .wg-ai-hint-text {
    font-size: 14px;
  }

  .wg-length-hint,
  .wg-word-hint,
  .wg-first-char-hint {
    font-size: 14px;
    padding: 2px 6px;
  }

  .wg-input-area {
    order: 0;
    flex-shrink: 0;
    z-index: 100;
    margin-top: 0;
    padding: 8px 12px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: none;
  }

  .wg-input-box {
    gap: 8px;
  }

  .wg-input-box input {
    font-size: 16px;
    padding: 10px 12px;
    min-height: 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
  }

  .wg-send-btn {
    padding: 10px 18px;
    font-size: 15px;
  }

  .wg-input-hint {
    display: none;
  }

  .wg-modal-content {
    padding: 20px;
    max-width: 95%;
  }

  .wg-modal-header {
    font-size: 22px;
  }

  .wg-modal-target {
    font-size: 26px;
  }

  .wg-danmaku-layer {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 1100;
    pointer-events: none;
    overflow: hidden;
  }

  body.wg-active .wg-danmaku-layer {
    display: block;
  }

  /* Collapsible Rank Sidebar - hidden in lobby, shown in room */
  .wg-rank-toggle {
    display: none;
  }

  body.wg-active .wg-rank-toggle {
    display: flex;
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    width: 28px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-right: none;
    border-radius: 8px 0 0 8px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  }

  .wg-rank-toggle:active {
    transform: translateY(-50%) scale(0.95);
  }

  .wg-rank-toggle svg {
    width: 14px;
    height: 14px;
    color: var(--primary);
    transition: transform 0.3s ease;
  }

  .wg-rank-toggle.open svg {
    transform: rotate(180deg);
  }

  .wg-rank-sidebar {
    display: none;
  }

  body.wg-active .wg-rank-sidebar {
    display: flex;
    position: fixed;
    right: -280px;
    top: 0;
    bottom: 0;
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 199;
    transition: right 0.3s ease;
    flex-direction: column;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
  }

  body.wg-active .wg-rank-sidebar.open {
    right: 0;
  }

  .wg-rank-backdrop {
    display: none;
  }

  body.wg-active .wg-rank-backdrop.visible {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 198;
    -webkit-tap-highlight-color: transparent;
  }

  .wg-rank-sidebar .wg-score-header {
    padding: 12px 14px;
    font-size: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }

  .wg-rank-sidebar .wg-score-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .wg-rank-sidebar .wg-score-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 8px 10px;
    gap: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
  }

  .wg-rank-sidebar .wg-score-pos {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 18px;
  }

  .wg-rank-sidebar .wg-score-item:nth-child(1) .wg-score-pos { color: #ffc107; }
  .wg-rank-sidebar .wg-score-item:nth-child(2) .wg-score-pos { color: #9e9e9e; }
  .wg-rank-sidebar .wg-score-item:nth-child(3) .wg-score-pos { color: #cd7f32; }

  .wg-rank-sidebar .wg-score-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  .wg-rank-sidebar .wg-score-info {
    flex: 1;
    min-width: 0;
  }

  .wg-rank-sidebar .wg-score-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .wg-rank-sidebar .wg-score-rank {
    font-size: 12px;
  }

  .wg-rank-sidebar .wg-score-points {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-dark);
    min-width: 30px;
    text-align: right;
  }

  .wg-rank-list {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    border-left: none;
  }

  .wg-rank-list .wg-empty-hint {
    display: none;
  }

  .wg-rank-list .wg-rank-item {
    padding: 8px 10px;
    gap: 8px;
    margin-bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
  }

  .wg-rank-list .wg-rank-pos {
    font-size: 16px;
    font-weight: 700;
    min-width: 20px;
  }

  .wg-rank-list .wg-rank-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  .wg-rank-list .wg-rank-info {
    flex: 1;
    min-width: 0;
  }

  .wg-rank-list .wg-rank-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    line-height: 1.2;
  }

  .wg-rank-list .wg-rank-badge {
    font-size: 11px;
    padding: 1px 5px;
  }

  .wg-rank-list .wg-rank-word {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
  }

  .wg-rank-list .wg-rank-similarity {
    font-size: 16px;
    min-width: 45px;
    flex-shrink: 0;
    font-weight: 700;
    color: var(--primary);
    text-align: right;
    margin-left: auto;
  }
}

@media (min-width: 601px) {
  .wg-danmaku-item {
    animation-duration: 14s;
  }
}

@media (max-width: 480px) {
  .wg-game-tabs {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 0;
  }
  .wg-game-tabs .filter-btn {
    padding: 5px 10px;
    font-size: 13px;
    white-space: nowrap;
  }
}
