/* ============================================
   OMOK (오목) GAME - SPECIFIC STYLES
   Common styles are in ../css/common.css
   ============================================ */
/* Omok-specific CSS Variables */
:root {
  --board-bg: #dcb35c;
  --board-line: #000;
}
body.theme-light {
  --board-bg: #dcb35c;
  --board-line: #000;
}

/* ============================================
   LOBBY ACTION COLORS (Omok-only)
   ============================================ */
.lobby-actions .btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 6px 14px rgba(0, 0, 0, 0.24);
}

.lobby-actions .btn:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* 1: Quick Match */
.lobby-actions .btn-primary {
  background: linear-gradient(135deg, #f15f7f 0%, #de3d63 100%);
  color: #fff;
}

/* 2: AI Match */
.lobby-actions .btn-ai {
  background: linear-gradient(135deg, #5f7bff 0%, #3f58d9 100%);
  color: #fff;
}

/* 3: Tutorial */
.lobby-actions .btn-tutorial {
  background: linear-gradient(135deg, #20be87 0%, #109f71 100%);
  color: #fff;
}

.lobby-actions .btn-secondary {
  color: #f7fbff;
}

/* 4: Create Room */
.lobby-actions .btn-secondary:nth-child(4) {
  background: linear-gradient(135deg, #2f74c8 0%, #1f5ba8 100%);
  border-color: rgba(169, 215, 255, 0.45);
}

/* 5: Refresh */
.lobby-actions .btn-secondary:nth-child(5) {
  background: linear-gradient(135deg, #1eaebe 0%, #158694 100%);
  border-color: rgba(162, 244, 255, 0.42);
}

/* 6: My Records */
.lobby-actions .btn-secondary:nth-child(6) {
  background: linear-gradient(135deg, #576f96 0%, #3f5578 100%);
  border-color: rgba(188, 209, 241, 0.38);
}

/* 7: Board */
.lobby-actions .btn-board {
  background: linear-gradient(135deg, #f8ad25 0%, #e88808 100%);
  color: #fff;
}

/* ============================================
   AI MODAL (Omok-specific additions)
   ============================================ */
.ai-color-section {
  margin-top: 16px;
  text-align: center;
}
.ai-color-label {
  color: var(--text-secondary);
  margin: 0 0 10px 0;
  font-size: 14px;
}
.ai-color-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.ai-color-buttons .color-btn.selected {
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

/* ============================================
   GAME OVER MODAL (Omok-only polish)
   ============================================ */
#game-over-modal .modal {
  width: min(560px, 94vw);
}

#game-over-modal .game-over-content h2 {
  font-size: 42px;
  margin-bottom: 14px;
  letter-spacing: -0.4px;
}

#game-over-modal .game-over-content .result {
  margin-bottom: 14px;
}

#game-over-modal .game-over-content .rating-change {
  margin-bottom: 10px;
  font-size: 19px;
}

#game-over-record-status {
  min-height: 24px;
  margin-bottom: 10px;
  color: rgba(224, 237, 255, 0.84) !important;
}

#game-over-modal .modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 6px;
}

#game-over-modal .modal-actions .btn {
  min-height: 58px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 800;
}

#game-over-modal .btn-go-records {
  grid-column: 2;
  grid-row: 1;
  background: linear-gradient(135deg, #2b7fd0 0%, #1e5eaa 100%);
  border: 1px solid rgba(170, 221, 255, 0.45);
  color: #fff;
}

#game-over-record-save-btn {
  grid-column: 1;
  grid-row: 1;
  background: linear-gradient(135deg, #27c383 0%, #179a65 100%);
  border: 1px solid rgba(170, 255, 220, 0.45);
  color: #fff;
}

#game-over-modal .btn-close-gameover {
  grid-column: 2;
  grid-row: 2;
  background: linear-gradient(135deg, #4a5d83 0%, #374968 100%);
  border: 1px solid rgba(202, 219, 245, 0.35);
  color: #f6fbff;
}

#game-over-modal .btn-rematch-gameover {
  grid-column: 1;
  grid-row: 2;
  background: linear-gradient(135deg, #ff607f 0%, #ea3d65 100%);
  border: 1px solid rgba(255, 192, 211, 0.45);
  color: #fff;
}

#game-over-modal .modal-actions .btn:hover {
  filter: brightness(1.06);
}

@media (max-width: 480px) {
  #game-over-modal .game-over-content h2 {
    font-size: 34px;
  }

  #game-over-modal .modal-actions .btn {
    min-height: 52px;
    font-size: 16px;
  }
}
/* ============================================
   RECORDS (Save + Replay)
   ============================================ */
.records-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 30px;
}

.records-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.records-page-header h1 {
  margin: 0;
  font-size: 42px;
  letter-spacing: -0.5px;
}

.records-page-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.records-page-right .lang-select {
  width: 128px;
  min-width: 128px;
  height: 40px;
  padding: 0 34px 0 12px;
  font-size: 14px;
}

.records-main {
  background: linear-gradient(180deg, rgba(20, 33, 82, 0.72), rgba(17, 27, 70, 0.8));
  border: 1px solid rgba(128, 168, 245, 0.22);
  border-radius: 16px;
  padding: 14px;
}

.records-page .record-layout {
  grid-template-columns: minmax(250px, 330px) minmax(0, 1fr);
  gap: 12px;
}

.records-page .record-filters {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
  gap: 10px;
}

.records-page .record-filters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.records-page .record-filters-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.records-page .record-filters-controls select {
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  background: rgba(9, 22, 68, 0.92);
  border-color: rgba(155, 195, 255, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.records-page .record-filters .records-inline-title {
  margin: 0;
  font-size: 42px;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.records-page .record-filters .lang-select {
  width: 128px;
  min-width: 128px;
  height: 40px;
  padding: 0 34px 0 12px;
  font-size: 14px;
  flex: 0 0 auto;
}

.records-page .record-filters-head .btn {
  min-height: 40px;
  padding: 0 16px;
  flex: 0 0 auto;
}

.records-page .record-filters-controls #record-filter-mode,
.records-page .record-filters-controls #record-filter-result {
  min-width: 220px;
  flex: 1 1 260px;
}

.records-page .record-list-panel {
  align-self: start;
  background: linear-gradient(180deg, rgba(27, 43, 108, 0.72), rgba(23, 34, 84, 0.68));
  border: 1px solid rgba(138, 175, 246, 0.24);
  border-radius: 14px;
  padding: 11px;
}

.records-page .record-list-container {
  max-height: min(52vh, 430px);
  min-height: 120px;
  border-radius: 12px;
  background: rgba(15, 27, 77, 0.72);
}

.records-page .record-item {
  border-radius: 10px;
  margin: 7px;
  padding: 13px 14px;
  border: 1px solid rgba(138, 175, 246, 0.2);
  background: rgba(44, 66, 144, 0.2);
}

.records-page .record-item:hover {
  background: rgba(78, 113, 224, 0.28);
}

.records-page .record-item.active {
  background: linear-gradient(135deg, rgba(88, 119, 224, 0.45), rgba(67, 92, 192, 0.34));
  border-color: rgba(181, 211, 255, 0.38);
}

.records-page .record-item .meta {
  font-size: 13px;
  margin-top: 7px;
  color: rgba(224, 237, 255, 0.82);
}

.records-page .record-replay-panel {
  background: linear-gradient(180deg, rgba(27, 43, 108, 0.72), rgba(23, 34, 84, 0.68));
  border: 1px solid rgba(138, 175, 246, 0.24);
  border-radius: 14px;
  padding: 12px;
}

.records-page .record-replay-controls {
  justify-content: flex-start;
  gap: 8px;
}

.records-page .modal-actions .btn {
  min-height: 42px;
  border-radius: 11px;
  font-size: 16px;
  font-weight: 700;
}

.records-page .record-replay-controls .btn.btn-small {
  min-width: 44px;
  min-height: 36px;
  border-radius: 10px;
  font-size: 15px;
}

.records-page #record-replay-speed {
  min-height: 36px;
  border-radius: 10px;
  font-weight: 600;
}

.records-page #record-replay-progress {
  font-size: 15px;
  min-width: 78px;
}

.records-login-required {
  padding: 18px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
  text-align: center;
}

#record-list-modal .modal-large {
  width: min(1080px, 96vw);
  max-width: 1080px;
  min-width: 0;
  padding: 22px;
}

.record-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(430px, 1fr);
  gap: 14px;
  align-items: start;
}
.record-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.record-filters select {
  flex: 1;
  min-height: 38px;
  background: rgba(11, 20, 49, 0.92);
  color: var(--text-primary);
  border: 1px solid rgba(160, 193, 255, 0.35);
  border-radius: 10px;
  padding: 7px 11px;
}
.record-list-panel {
  background: rgba(26, 37, 88, 0.55);
  border: 1px solid rgba(139, 176, 249, 0.18);
  border-radius: 12px;
  padding: 10px;
}
.record-list-container {
  max-height: 450px;
  overflow: auto;
  border: 1px solid rgba(139, 176, 249, 0.2);
  border-radius: 10px;
  background: rgba(16, 26, 64, 0.72);
}
.record-item {
  padding: 12px 13px;
  border-bottom: 1px solid rgba(145, 171, 227, 0.18);
  cursor: pointer;
  transition: background-color 0.16s ease, transform 0.16s ease;
}
.record-item:hover {
  background: rgba(79, 121, 223, 0.2);
  transform: translateY(-1px);
}
.record-item:last-child {
  border-bottom: 0;
}
.record-item.active {
  background: linear-gradient(135deg, rgba(91, 119, 213, 0.36), rgba(63, 83, 163, 0.24));
  box-shadow: inset 0 0 0 1px rgba(170, 204, 255, 0.25);
}
.record-item.record-empty {
  cursor: default;
  text-align: center;
  color: var(--text-secondary);
}
.record-item .meta {
  font-size: 12px;
  color: rgba(222, 234, 255, 0.75);
  margin-top: 5px;
}
.record-replay-board {
  --r-cell: 24px;
  display: grid;
  grid-template-columns: repeat(15, var(--r-cell));
  grid-template-rows: repeat(15, var(--r-cell));
  background: linear-gradient(180deg, #e8c366 0%, #d9b35b 100%);
  border-radius: 10px;
  position: relative;
  padding: calc(var(--r-cell) / 2 + 8px);
  width: fit-content;
  margin: 0 auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32), inset 0 0 0 1px rgba(72, 39, 0, 0.22);
}
.record-replay-panel {
  background: rgba(26, 37, 88, 0.45);
  border: 1px solid rgba(139, 176, 249, 0.16);
  border-radius: 12px;
  padding: 10px;
}
.record-replay-board::before {
  content: '';
  position: absolute;
  top: calc(var(--r-cell) + 8px);
  left: calc(var(--r-cell) + 8px);
  right: calc(var(--r-cell) + 8px);
  bottom: calc(var(--r-cell) + 8px);
  background-image:
    linear-gradient(rgba(40, 20, 0, 0.95) 1px, transparent 1px),
    linear-gradient(90deg, rgba(40, 20, 0, 0.95) 1px, transparent 1px),
    radial-gradient(circle at 25% 25%, rgba(60, 35, 8, 0.35) 1px, transparent 1.1px);
  background-size: var(--r-cell) var(--r-cell);
  pointer-events: none;
}
.record-replay-board::after {
  content: '';
  position: absolute;
  top: calc(var(--r-cell) + 8px);
  left: calc(var(--r-cell) + 8px);
  right: calc(var(--r-cell) + 8px);
  bottom: calc(var(--r-cell) + 8px);
  border: 1px solid rgba(40, 20, 0, 0.96);
  pointer-events: none;
}
.record-replay-cell {
  width: var(--r-cell);
  height: var(--r-cell);
  position: relative;
  z-index: 1;
}
.record-replay-stone {
  width: calc(var(--r-cell) - 4px);
  height: calc(var(--r-cell) - 4px);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
}
.record-replay-stone.black {
  background: radial-gradient(circle at 30% 30%, #444, #111);
}
.record-replay-stone.white {
  background: radial-gradient(circle at 30% 30%, #fff, #ccc);
}
.record-replay-stone.last::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.record-replay-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 7px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.record-replay-controls .btn.btn-small {
  min-width: 42px;
  min-height: 34px;
  border-radius: 9px;
  font-weight: 700;
}
#record-replay-speed {
  min-height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(160, 193, 255, 0.35);
  background: rgba(11, 20, 49, 0.92);
  color: var(--text-primary);
  padding: 0 8px;
}
#record-replay-progress {
  min-width: 66px;
  text-align: right;
  font-weight: 700;
  color: rgba(230, 240, 255, 0.94);
}
@media (max-width: 820px) {
  #record-list-modal .modal-large {
    width: min(760px, 95vw);
    max-width: 760px;
  }
  .record-filters {
    gap: 8px;
  }
  .record-layout {
    grid-template-columns: 1fr;
  }
  .records-page .record-layout {
    grid-template-columns: 1fr;
  }
  .record-list-container {
    max-height: 260px;
  }
  .record-replay-board {
    --r-cell: min(6.2vw, 22px);
  }
  .record-replay-controls {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

@media (max-width: 480px) {
  .records-page {
    padding: 12px 8px 20px;
  }

  .records-page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .records-page-header h1 {
    font-size: 34px;
  }

  .records-page-right {
    justify-content: space-between;
  }

  .records-page-right .lang-select {
    width: 52%;
    min-width: 120px;
  }

  .records-main {
    padding: 10px;
    border-radius: 12px;
  }

  .records-page .record-filters select {
    min-height: 40px;
    font-size: 14px;
  }

  .records-page .record-filters-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .records-page .record-filters .records-inline-title {
    width: 100%;
    font-size: 34px;
    margin-bottom: 2px;
  }

  .records-page .record-filters-head .btn {
    width: 100%;
  }

  .records-page .record-filters-controls #record-filter-mode,
  .records-page .record-filters-controls #record-filter-result {
    min-width: 0;
    flex: 1 1 100%;
  }

  .records-page .record-item {
    margin: 6px;
    padding: 11px 12px;
  }

  .records-page .record-replay-controls {
    justify-content: center;
  }

  #record-list-modal .modal-large {
    width: 96vw;
    max-width: 96vw;
    padding: 14px 10px;
  }

  .record-layout {
    gap: 10px;
  }

  .record-list-panel,
  .record-replay-panel {
    padding: 8px;
  }

  .record-replay-board {
    --r-cell: min(5vw, 19px);
    padding: calc(var(--r-cell) / 2 + 6px);
  }

  .record-replay-board::before,
  .record-replay-board::after {
    top: calc(var(--r-cell) + 6px);
    left: calc(var(--r-cell) + 6px);
    right: calc(var(--r-cell) + 6px);
    bottom: calc(var(--r-cell) + 6px);
  }

  .record-replay-controls {
    gap: 6px;
  }

  .record-replay-controls .btn.btn-small {
    min-width: 40px;
    min-height: 32px;
    padding: 0 8px;
    font-size: 13px;
  }

  #record-replay-speed {
    min-height: 32px;
    padding: 0 6px;
  }
}

/* ============================================
   PLAYER CARD (Omok-specific: stone indicator)
   ============================================ */
.player-card .stone-indicator {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}
.player-card .stone-indicator.black {
  background: #111;
  border: 1px solid #333;
}
.player-card .stone-indicator.white {
  background: #fff;
  border: 1px solid #ccc;
}
/* ============================================
   GAME BOARD - Intersection-based (15x15 Grid)
   ============================================ */
.game-board {
  display: grid;
  grid-template-columns: repeat(15, 44px);
  grid-template-rows: repeat(15, 44px);
  background: var(--board-bg);
  padding: 22px;
  border-radius: 5px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
  position: relative;
}
/* Draw grid lines through intersection points */
.game-board::before {
  content: '';
  position: absolute;
  top: 44px;
  left: 44px;
  right: 44px;
  bottom: 44px;
  background-image:
    linear-gradient(var(--board-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--board-line) 1px, transparent 1px);
  background-size: 44px 44px;
  background-position: 0 0;
  pointer-events: none;
}
/* Border lines (right + bottom only; left/top provided by grid pattern at position 0) */
.game-board::after {
  content: '';
  position: absolute;
  top: 44px;
  left: 44px;
  right: 44px;
  bottom: 44px;
  border: none;
  border-right: 1px solid var(--board-line);
  border-bottom: 1px solid var(--board-line);
  pointer-events: none;
}
.cell {
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.cell:hover::after {
  content: '';
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  position: absolute;
}
/* Hover shadow for white's turn */
.game-board.white-turn .cell:hover::after {
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}
/* Hover shadow for black's turn */
.game-board.black-turn .cell:hover::after {
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}
.cell.disabled {
  cursor: not-allowed;
}
.cell.disabled:hover::after {
  display: none;
}
/* ============================================
   STONES
   ============================================ */
.stone {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  position: relative;
  z-index: 2;
}
.stone.black {
  background: radial-gradient(circle at 30% 30%, #444, #111);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
.stone.white {
  background: radial-gradient(circle at 30% 30%, #fff, #ccc);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.stone.last-move::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}
/* Star points (화점) */
.cell.star-point::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--board-line);
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
/* ============================================
   EVALUATION BAR
   ============================================ */
.eval-bar-container {
  width: 100%;
  max-width: 600px;
  margin-bottom: 10px;
}
.eval-bar {
  height: 20px;
  background: linear-gradient(to right, #111 50%, #fff 50%);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}
.eval-fill {
  height: 100%;
  background: #111;
  transition: width 0.5s ease;
  position: relative;
}
.eval-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
}
.eval-text {
  text-align: center;
  font-size: 12px;
  margin-top: 5px;
  color: var(--text-secondary);
}
/* ============================================
   MOVE NUMBERS ON STONES
   ============================================ */
.stone .move-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: bold;
  z-index: 3;
}
.stone.black .move-number {
  color: #fff;
}
.stone.white .move-number {
  color: #000;
}
/* ============================================
   HINT INDICATOR
   ============================================ */
.hint-indicator {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px dashed var(--success);
  animation: hint-pulse 1s infinite;
  pointer-events: none;
  z-index: 100;
}
@keyframes hint-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.5; }
}
/* ============================================
   MOVE LIST
   ============================================ */
.move-list-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px;
  min-height: 0;
  background: transparent;
  border-radius: 0;
}
.move-list-header {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--text-secondary);
}
.move-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
  overflow-y: auto;
  align-content: flex-start;
}
.move-item {
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
}
.move-item.black {
  border-left: 3px solid #333;
}
.move-item.white {
  border-left: 3px solid #ccc;
}
/* ============================================
   STONE ANIMATIONS
   ============================================ */
@keyframes stone-place {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.stone.animated {
  animation: stone-place 0.3s ease-out;
}
/* Win Line Animation */
@keyframes win-glow {
  0%, 100% { box-shadow: 0 0 10px var(--success); }
  50% { box-shadow: 0 0 25px var(--success), 0 0 50px var(--success); }
}
.stone.winning {
  animation: win-glow 1s infinite;
}
/* ============================================
   BOARD STYLE VARIATIONS
   ============================================ */
.game-board.style-wooden {
  background: linear-gradient(135deg, #deb887 0%, #c9a66b 50%, #b8956d 100%);
}
.game-board.style-green {
  --board-bg: #2d5016;
  --board-line: #000;
  background: #2d5016;
}
/* ============================================
   COORDINATES
   ============================================ */
.board-coordinates {
  position: absolute;
  font-size: 12px;
  color: var(--board-line);
  font-weight: bold;
}
.coord-top, .coord-bottom {
  display: flex;
  justify-content: space-around;
  width: calc(36px * 15);
  left: 18px;
}
.coord-top {
  top: 0;
}
.coord-bottom {
  bottom: 0;
}
.coord-left, .coord-right {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  height: calc(36px * 15);
  top: 18px;
}
.coord-left {
  left: 0;
}
.coord-right {
  right: 0;
}
/* ============================================
   ANALYSIS MODAL (Game-specific)
   ============================================ */
.analysis-content {
  max-height: 500px;
  overflow-y: auto;
}
.analysis-summary {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}
.analysis-stat {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.analysis-moves {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.analysis-move {
  display: flex;
  align-items: center;
  padding: 10px;
  background: var(--bg-card);
  border-radius: 8px;
}
.analysis-move.good {
  border-left: 4px solid var(--success);
}
.analysis-move.bad {
  border-left: 4px solid var(--accent);
}
.analysis-move.neutral {
  border-left: 4px solid var(--text-secondary);
}
.analysis-move-number {
  width: 40px;
  font-weight: bold;
}
.analysis-move-text {
  flex: 1;
}
.analysis-move-eval {
  font-weight: bold;
}
/* ============================================
   TUTORIAL MODAL (Game-specific)
   ============================================ */
.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-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 20px auto;
  padding: 15px;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.tutorial-image canvas {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.tutorial-caption {
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
  text-align: center;
  padding: 8px 16px;
  background: rgba(108, 92, 231, 0.1);
  border-radius: 20px;
  border: 1px solid rgba(108, 92, 231, 0.3);
}
.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);
}
/* ============================================
   RESPONSIVE - Game-specific adjustments
   ============================================ */
/* 1040px: 보드 0.9배 (44px → 40px) */
@media (max-width: 1040px) {
  .game-board {
    grid-template-columns: repeat(15, 40px);
    grid-template-rows: repeat(15, 40px);
    padding: 20px;
  }
  .game-board::before {
    top: 40px;
    left: 40px;
    right: 40px;
    bottom: 40px;
    background-size: 40px 40px;
  }
  .game-board::after {
    top: 40px;
    left: 40px;
    right: 40px;
    bottom: 40px;
    width: auto;
    height: auto;
  }
  .cell {
    width: 40px;
    height: 40px;
  }
  .stone {
    width: 36px;
    height: 36px;
  }
}
/* 970px: 보드 0.89배 (40px → 35px) */
@media (max-width: 970px) {
  .game-board {
    grid-template-columns: repeat(15, 35px);
    grid-template-rows: repeat(15, 35px);
    padding: 18px;
  }
  .game-board::before {
    top: 35.5px;
    left: 35.5px;
    right: 35.5px;
    bottom: 35.5px;
    background-size: 35px 35px;
  }
  .game-board::after {
    top: 35.5px;
    left: 35.5px;
    right: 35.5px;
    bottom: 35.5px;
    width: auto;
    height: auto;
  }
  .cell {
    width: 35px;
    height: 35px;
  }
  .stone {
    width: 31px;
    height: 31px;
  }
}
/* 900px: 보드 0.85배 (35px → 29px) */
@media (max-width: 900px) and (min-width: 821px) {
  .game-board {
    grid-template-columns: repeat(15, 29px);
    grid-template-rows: repeat(15, 29px);
    padding: 15px;
  }
  .game-board::before {
    top: 29.5px;
    left: 29.5px;
    right: 29.5px;
    bottom: 29.5px;
    background-size: 29px 29px;
  }
  .game-board::after {
    top: 29.5px;
    left: 29.5px;
    right: 29.5px;
    bottom: 29.5px;
    width: auto;
    height: auto;
  }
  .cell {
    width: 29px;
    height: 29px;
  }
  .stone {
    width: 25px;
    height: 25px;
  }
}
/* 820px 이하: 게임판 화면 너비 꽉 차게 */
@media (max-width: 820px) {
  .board-container {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0 6px;
    box-sizing: border-box;
  }
  .game-board {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    padding: 3%;
    box-sizing: border-box;
  }
  .game-board::before {
    top: calc(3% + 94% / 30);
    left: calc(3% + 94% / 30);
    right: calc(3% + 94% / 30);
    bottom: calc(3% + 94% / 30);
    background-size: calc(100% / 14) calc(100% / 14);
  }
  .game-board::after {
    top: calc(3% + 94% / 30);
    left: calc(3% + 94% / 30);
    right: calc(3% + 94% / 30);
    bottom: calc(3% + 94% / 30);
    width: auto;
    height: auto;
    border: none;
    border-right: 1px solid var(--board-line);
    border-bottom: 1px solid var(--board-line);
  }
  .cell {
    width: 100%;
    height: 100%;
  }
  .stone {
    width: 85%;
    height: 85%;
  }
  .cell.star-point::before {
    width: 20%;
    height: 20%;
  }
}
/* 600px 이하: 기타 모바일 조정 (게임판은 820px 규칙 사용) */
@media (max-width: 600px) {
  /* Hide move list on mobile */
  .move-list-container {
    display: none !important;
  }
}
/* ============================================
   RECONNECT OVERLAY
   ============================================ */
#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.3);
  border-top-color: #6c5ce7;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}
@keyframes 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: 15px;
}
.reconnect-refresh {
  display: none;
  padding: 12px 24px;
  font-size: 16px;
  background: #6c5ce7;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.reconnect-refresh:hover {
  background: #5b4cdb;
}
/* ============================================
   SPECTATOR MODE STYLES
   ============================================ */
/* Room List - Live Game Styling */
.room-item.room-live {
  border: 2px solid #e74c3c;
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(192, 57, 43, 0.05));
  cursor: default;
}
.room-item.room-live:hover {
  transform: none;
  border-color: #c0392b;
}
.room-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.live-badge {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  animation: live-pulse 1.5s infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
/* ============================================
   CHAT TABS & PARTICIPANT LIST
   ============================================ */
.chat-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}
.chat-tab {
  flex: 1;
  padding: 10px 15px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.chat-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.chat-tab.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  font-weight: 500;
}
.participant-count {
  background: var(--accent);
  color: white;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#chat-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}
#chat-content .chat-messages {
  flex: 1;
}
/* Participants List */
.participants-list {
  padding: 10px;
  overflow-y: auto;
  height: 100%;
}
.participant-section {
  margin-bottom: 15px;
}
.participant-section-header {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-color);
}
.participant-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.participant-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 13px;
}
.participant-item.player {
  border-left: 3px solid var(--accent);
}
.participant-item.host {
  border-left: 3px solid #f1c40f;
}
.participant-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.participant-info {
  flex: 1;
}
.participant-name {
  font-weight: 500;
  color: var(--text-primary);
}
.participant-role {
  font-size: 11px;
  color: var(--text-secondary);
}
.participant-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.participant-badge.host {
  background: #f1c40f;
  color: #000;
}
.participant-badge.black {
  background: #2c3e50;
  color: #fff;
}
.participant-badge.white {
  background: #ecf0f1;
  color: #2c3e50;
}
.empty-participants {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px;
  font-size: 13px;
}

/* Responsive Ads */
@media (max-width: 768px) {
  .ad-pc-only { display: none !important; }
}
@media (min-width: 769px) {
  .ad-mobile-only { display: none !important; }
}

/* Ad Lobby Center */
.ad-lobby {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

/* 게임방 모바일 하단 광고 320x50 (스크롤) */
.ad-mobile-fixed {
  position: static;
  margin: 10px auto;
  width: 320px;
  height: 50px;
}

.ad-mobile-fixed.hidden {
  display: none;
}

/* ============================================
   SIDEBAR TAB (탭 기반 통합 사이드바)
   ============================================ */
.sidebar {
  padding: 1px;
  gap: 1px;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1px;
  flex-shrink: 0;
}

.sidebar-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sidebar-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-tab.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  margin-bottom: -1px;
}

.sidebar-tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  min-height: 0;
}

#sidebar-chat-content .chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: var(--bg-card);
  border-radius: 1px;
  overflow: hidden;
  min-height: 0;
}

#sidebar-chat-content .chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

#sidebar-chat-content .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1px;
  min-height: 150px;
}

#sidebar-chat-content .game-controls {
  padding: 10px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

#sidebar-chat-content .game-controls .btn {
  flex: 1;
  min-width: 80px;
}


.sidebar .ad-sidebar {
  flex-shrink: 0;
  margin-top: auto;
  display: flex;
  justify-content: center;
}

@media (max-width: 820px) {
  .sidebar-tabs {
    display: none;
  }
}

/* Records page replay uses the same game board structure/classes as live game board */
.records-page .record-replay-board.game-board {
  --record-cell-size: 26px;
  grid-template-columns: repeat(15, var(--record-cell-size));
  grid-template-rows: repeat(15, var(--record-cell-size));
  padding: calc(var(--record-cell-size) / 2);
  width: fit-content;
  margin: 0 auto;
  border-radius: 10px;
}

.records-page .record-replay-board.game-board::before {
  top: var(--record-cell-size);
  left: var(--record-cell-size);
  right: var(--record-cell-size);
  bottom: var(--record-cell-size);
  background-size: var(--record-cell-size) var(--record-cell-size);
}

.records-page .record-replay-board.game-board::after {
  top: var(--record-cell-size);
  left: var(--record-cell-size);
  right: var(--record-cell-size);
  bottom: var(--record-cell-size);
}

.records-page .record-replay-board.game-board .cell {
  width: var(--record-cell-size);
  height: var(--record-cell-size);
  cursor: default;
}

.records-page .record-replay-board.game-board .cell:hover::after {
  display: none;
}

.records-page .record-replay-board.game-board .stone {
  width: calc(var(--record-cell-size) - 4px);
  height: calc(var(--record-cell-size) - 4px);
}

.records-page .record-replay-board.game-board .stone.last-move::after {
  width: 6px;
  height: 6px;
}

.records-page .record-replay-board.game-board .cell.star-point::before {
  width: 6px;
  height: 6px;
}

@media (max-width: 820px) {
  .records-page .record-replay-board.game-board {
    --record-cell-size: 22px;
  }
}
