* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: #1e1e24;
  color: #eee;
}

.lobby-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 100px;
}

.lobby-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.lobby-header h1 {
  font-size: 22px;
  margin: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  background: #33333d;
  color: #eee;
  font-size: 14px;
  cursor: pointer;
}

.btn.primary {
  background: #4c8dff;
  color: #fff;
  font-weight: 600;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.look-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 아이콘만 있는 버튼(새로고침 등) */
.icon-btn {
  padding: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-btn img {
  width: 18px;
  height: 18px;
  /* 원본 아이콘이 검정색이라 어두운 배경에서 보이도록 흰색으로 반전 */
  filter: invert(1);
  pointer-events: none;
}

.icon-btn.spinning img {
  animation: icon-spin 0.6s linear;
}

@keyframes icon-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 아이콘 출처 표기 (Flaticon 라이선스 요구사항) */
.icon-credit {
  text-align: center;
  font-size: 11px;
  color: #555;
  margin: 28px 0 0;
}

.icon-credit a {
  color: #666;
}

.room-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-item {
  background: #2a2a33;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
}

.room-item:active {
  background: #35353f;
}

.room-item.playing {
  background: #232328;
  color: #999;
}

.room-info { display: flex; flex-direction: column; gap: 4px; }

.room-name { font-size: 16px; font-weight: 600; }
.room-item.playing .room-name { color: #aaa; }

.room-sub { font-size: 12px; color: #888; }

.room-status-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #3a3a44;
  color: #ccc;
}
.room-item.playing .room-status-badge { background: #3a3a3a; color: #888; }

.empty-msg {
  text-align: center;
  color: #777;
  margin-top: 60px;
  font-size: 14px;
}

/* 모달 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal {
  background: #2a2a33;
  border-radius: 16px;
  padding: 22px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.modal label {
  font-size: 12px;
  color: #999;
  margin-top: 8px;
}

.modal input, .modal select {
  background: #1e1e24;
  border: 1px solid #444;
  color: #eee;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
}

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

.error-msg {
  color: #ff6b6b;
  font-size: 12px;
  min-height: 16px;
  margin: 4px 0 0;
}

/* ===================== 방(게임) 화면 ===================== */

.waiting-wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 60px 20px;
  text-align: center;
}

.room-title { font-size: 20px; margin: 0 0 8px; }
.room-rule-summary { font-size: 13px; color: #999; margin: 0 0 24px; }
.waiting-status { font-size: 14px; color: #ccc; margin-bottom: 24px; }

/* 대기(준비) 화면: 왼쪽=방장, 가운데=준비 버튼, 오른쪽=도전자 */
.ready-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ready-player {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
}

.ready-player-name {
  font-size: 15px;
  font-weight: 600;
  color: #eee;
  word-break: break-all;
}

.ready-check {
  font-size: 18px;
  color: #4caf50;
  font-weight: bold;
}

.ready-center-btn {
  flex: 0 0 auto;
  align-self: center;
  min-width: 100px;
}

.leave-waiting-btn {
  margin-top: 28px;
}

/* =========================================================
   게임 화면 크기 체계
   - iPad (M3) 11형 가로모드(뷰포트 약 1194 x 834 CSS px)를 "기준 화면"으로 삼아
     그 비율에서 보드 한 칸(--cell)이 60px이 되도록 잡고, 그 값을 화면의
     세로/가로 길이에 비례한 clamp()로 계산함. 그래서:
       - 기준 화면(아이패드 가로)에서는 지금까지와 동일한 60px 보드가 나오고
       - 그보다 작은 화면(폰 등)에서는 화면 크기에 맞춰 비율대로 줄어듦
   - 보드/플레이어 줄/드래그 고스트/이동 가능 표시가 전부 이 --cell 하나만
     바꾸면 같이 줄어들도록 값들을 var(--cell) 기준으로 다시 씀.
========================================================= */
:root {
  --cell: 60px;
}

/* 가로모드: 세로(vh)가 부족한 게 문제이므로 vh 기준으로 계산.
   기준화면(834px 높이)에서 60px가 나오도록 7.2vh로 설정 → 계산: 0.072 * 834 ≈ 60px
   → 왼쪽 버튼 열이 사라지고 하단 바로 옮겨가면서 보드 쪽 공간이 넓어져서
     기준 비율을 8.4vh로 올려 보드를 더 크게 표시함 */
@media (orientation: landscape) {
  :root {
    --cell: clamp(30px, 8.4vh, 76px);
  }
}

/* 세로모드: 가로(vw)가 부족한 게 문제이므로 vw 기준으로 계산.
   기준화면(834px 너비, 아이패드 세로)에서도 60px 근처가 나오도록 11vw로 설정,
   일반 폰 너비(약 390~430px)에서는 자연스럽게 43~47px 정도로 줄어듦 */
@media (orientation: portrait) {
  :root {
    --cell: clamp(30px, 11vw, 60px);
  }
}

.game-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 12px 60px;
}

.game-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: center;
}

.left-col {
  display: flex;
  flex-direction: column;
  padding-top: 40px;
  gap: 8px;
  order: 3;
}

.resign-btn {
  background: #4a2a2a;
  color: #ffb3b3;
}

.board-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  order: 2;
}

/* 판 위, 왼쪽=방장 / 오른쪽=도전자 (보는 사람과 무관하게 고정) */
.player-row {
  width: calc(var(--cell) * 8);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  order: 1;
}

.player-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.player-block-left { align-items: flex-start; }
.player-block-right { align-items: flex-end; }

.player-name {
  font-size: 15px;
  font-weight: 600;
  color: #ccc;
  transform-origin: center;
  transition: transform 0.2s ease, color 0.2s ease;
  max-width: calc(var(--cell) * 3.6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-block-left .player-name { transform-origin: left center; }
.player-block-right .player-name { transform-origin: right center; }

.player-name.turn-active {
  transform: scale(1.15);
  color: #fff;
}

/* 내 닉네임(me) — 항상 주황색으로 강조 (턴 활성 상태여도 유지) */
.player-name.me,
.player-name.turn-active.me {
  color: #ff9800;
}
.player-name .me-tag {
  font-size: 0.7em;
  margin-left: 2px;
}

.player-time { font-size: 13px; color: #888; }

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, var(--cell));
  grid-template-rows: repeat(8, var(--cell));
  border: 4px solid #363431;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.cell {
  width: var(--cell);
  height: var(--cell);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: calc(var(--cell) * 0.633);
  cursor: pointer;
  user-select: none;
  position: relative;
  touch-action: none; /* 드래그 중 페이지 스크롤/줌 방지 */
}

/* 기물: 유니코드 텍스트 대신 SVG 이미지(cburnett 세트)를 배경으로 표시 */
.cell.has-piece {
  background-repeat: no-repeat;
  background-position: center;
  background-size: 82%;
}

.white-cell { background-color: #ebecd0; color: #000; }
.black-cell { background-color: #739552; color: #000; }

.possible-move::after {
  content: '';
  width: calc(var(--cell) * 0.3);
  height: calc(var(--cell) * 0.3);
  background-color: rgba(20, 85, 30, 0.5);
  border-radius: 50%;
  position: absolute;
}

.possible-capture { background-color: #e57373 !important; }
.selected { background-color: #bbc742 !important; }
.last-move { box-shadow: inset 0 0 0 4px rgba(76, 141, 255, 0.75); }

/* AI(스톡피시) 힌트 — 나에게만 보이는 표시. 승진 기물 선택 모달에서
   AI가 추천하는 기물을 표시할 때도 같은 파란색 테두리를 재사용함 */
.ai-suggest-piece { box-shadow: inset 0 0 0 999px rgba(64, 132, 255, 0.35); }
.possible-move-ai::after {
  content: '';
  width: calc(var(--cell) * 0.3);
  height: calc(var(--cell) * 0.3);
  background-color: rgba(220, 60, 60, 0.55);
  border-radius: 50%;
  position: absolute;
}

/* ===================== 드래그앤드롭 ===================== */

.drag-ghost {
  position: fixed;
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--cell);
  height: var(--cell);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 82%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 2000;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
}

.cell.dragging-origin { opacity: 0.35; }

.cell.drop-hover { background-color: rgba(20, 133, 60, 0.45) !important; }

.chess-board.dragging-active .cell { cursor: grabbing; }

.game-status { font-size: 13px; color: #999; margin-top: 4px; }

.right-col {
  width: 160px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  order: 4;
}

.log-panel {
  height: 480px;
  aspect-ratio: 1 / 3;
  overflow-y: auto;
  background: #262421;
  border: 1px solid #363431;
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-btn {
  background: #312e2b;
  color: #e0e0e0;
  border: 1px solid #403d39;
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
}

.log-btn.active { background: #bbc742; color: #000; border-color: #bbc742; font-weight: bold; }

/* 수 품질 표시(✅🤫❌❓) — 기보 텍스트 옆에 살짝 띄워서 표시 */
.move-quality {
  margin-left: 4px;
  font-size: 12px;
}

.history-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.nav-btn { flex: 1; }

.full-width-btn { width: 100%; }

/* =========================================================
   가로모드 전용 레이아웃 (chess.com 앱 느낌 참고)
   - 왼쪽 버튼 열(left-col)을 없애고, 이름/로그가 있던 오른쪽 칸도
     해체해서 전부 하나의 4열 그리드 위에 재배치함
   - 보드가 왼쪽 3칸을 다 차지해서 커지고, 오른쪽 1칸 위쪽엔 이름,
     아래쪽엔 로그(크게)가 배치됨
   - 맨 아래에 옵션(무르기/최신수 토글) · 기권 · 이전 · 다음, 4개 버튼을
     가로로 나란히 배치(chess.com 하단 바의 옵션/기권/힌트/실행취소 자리에 대응)
========================================================= */
@media (orientation: landscape) {
  :root {
    /* 버튼 줄이 오른쪽 컬럼 안으로 들어가면서 보드가 그 자리까지 침범해
       세로로 더 커지므로, 기준 비율도 그만큼 올림 */
    --cell: clamp(32px, 12vh, 104px);
  }

  .game-wrap {
    /* 이전엔 max-width:900px + margin:0 auto 로 가운데 정렬돼서, 화면이 900px보다
       넓은 기기(태블릿 등)에서는 왼쪽에 빈 여백이 생겨 보드가 "완전히 왼쪽"에
       붙지 못했음. 그리고 html/body에 뷰포트 높이 기준 레이아웃이 없어서 내용이
       늘어나면 페이지 자체가 스크롤됐음.
       -> position:fixed로 뷰포트에 직접 고정해서 폭 100%(왼쪽 끝까지) + 높이도
          뷰포트로 못박아서, 안쪽 그리드의 1fr 행이 실제 남는 공간을 정확히
          계산하게 되고 페이지 스크롤 자체가 생길 일이 없어짐 */
    position: fixed;
    inset: 0;
    max-width: none;
    margin: 0;
    padding: 4px 4px 4px 0;
    box-sizing: border-box;
    overflow: hidden;
  }

  .game-layout {
    display: grid;
    height: 100%;
    min-height: 0;
    /* 왼쪽(보드) : 오른쪽(이름/로그/버튼) = 3 : 2.
       오른쪽은 버튼 4개를 나열할 수 있도록 다시 4칸으로 잘게 쪼갬(합 2fr) */
    grid-template-columns: 3fr 0.5fr 0.5fr 0.5fr 0.5fr;
    grid-template-rows: auto 1fr auto auto;
    grid-template-areas:
      "board names  names  names  names"
      "board log    log    log    log"
      "board opt    resign prev   next"
      "admin admin  admin  admin  admin";
    gap: 8px;
    align-items: stretch;
    justify-content: stretch;
  }

  /* 이 래퍼들은 시각적 박스가 아니라 그리드 배치를 위한 통로 역할만 함 */
  .left-col, .right-col, .history-nav {
    display: contents;
  }

  .board-col {
    grid-area: board;
    /* 이름+로그+버튼 3줄 높이를 전부 합친 만큼(=옛 버튼 자리까지) 세로로
       꽉 채우고, 가로로는 왼쪽에 붙도록 함 */
    padding-top: 0;
    align-items: flex-start;
  }

  .player-row {
    grid-area: names;
    width: auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
  }
  .player-block-left, .player-block-right {
    align-items: flex-start;
  }
  .player-row .player-name {
    max-width: 100%;
  }

  #logPanel {
    grid-area: log;
    /* 이제 .game-layout이 뷰포트에 고정된 실제 높이를 가지므로, 1fr 행이
       진짜 남는 공간을 계산해줌 -> 로그판은 딱 그 공간만큼만 채워지고,
       내용이 넘치면(수가 많아지면) 내부에서만 스크롤됨(페이지 스크롤 없음) */
    height: auto;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    width: 100%;
    overflow-y: auto;
  }

  /* 버튼 4개(옵션/기권/이전/다음)를 로그판 바로 아래, 같은 폭 안에서
     한 줄로 나열. 슬롯이 좁아지므로 아이콘/글자 크기를 더 줄임 */
  #prevBtn, #nextBtn, #resignBtn, #latestBtn, .xeon-controls .xeon-btn {
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #ccc;
    font-size: 10px;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 14px 2px;
    transition: background 0.12s ease;
  }
  #prevBtn::before, #nextBtn::before, #resignBtn::before,
  #latestBtn::before, .xeon-controls .xeon-btn::before {
    font-size: 16px;
    line-height: 1;
  }
  #prevBtn:active, #nextBtn:active, #resignBtn:active, #latestBtn:active,
  .xeon-controls .xeon-btn:active {
    background: rgba(255,255,255,0.1);
  }
  #prevBtn.look-disabled, #nextBtn.look-disabled {
    background: transparent;
  }
  #resignBtn {
    color: #ff9a9a;
  }
  #prevBtn::before { content: "◀"; }            /* 이전 */
  #nextBtn::before { content: "▶"; }            /* 다음 */
  #latestBtn::before { content: "⏩"; }          /* 최신 수로 */
  .xeon-controls .xeon-btn::before { content: "↩"; } /* 무르기 */

  /* 이전/다음 버튼은 이모지만 남기고 원래 글자는 감춤 */
  #prevBtn, #nextBtn { font-size: 0; }
  #prevBtn::before, #nextBtn::before { font-size: 20px; }

  #prevBtn { grid-area: prev; margin: 0; height: 100%; }
  #nextBtn { grid-area: next; margin: 0; height: 100%; }
  #resignBtn { grid-area: resign; margin: 0; height: 100%; }

  #latestBtn {
    grid-area: opt;
    margin: 0;
    width: 100%;
    height: 100%;
  }

  .xeon-controls {
    grid-area: opt;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    gap: 2px;
    margin-top: 0 !important;
    height: 100%;
  }
  .xeon-controls .xeon-btn {
    width: 100%;
    flex: 1;
  }
  .xeon-undo-status {
    font-size: 10px;
    justify-content: center;
    text-align: center;
    color: #999;
  }

  #adminDeleteBtn {
    grid-area: admin;
    margin-top: 0;
    width: 100%;
  }
}

/* =========================================================
   세로모드 전용 레이아웃 (가로모드와 동일한 그리드 구조를 세로로 재배치)
   - 맨 위: 이름/닉네임 줄
   - 그 아래: 보드(화면 폭에 맞춰 크게)
   - 그 아래: 로그(가로모드처럼 숨기지 않고 그대로 표시)
   - 맨 아래: 옵션(무르기/최신수) · 기권 · 이전 · 다음, 4버튼 한 줄
     (가로모드 하단 바와 동일한 grid-area 이름을 그대로 재사용)
========================================================= */
@media (orientation: portrait) {
  :root {
    --cell: clamp(32px, 12vw, 72px);
  }

  .game-wrap {
    padding: 8px 8px 24px;
  }

  .game-layout {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto auto auto auto auto;
    grid-template-areas:
      "names names names names"
      "board board board board"
      "log   log   log   log"
      "opt   resign prev  next"
      "admin admin admin admin";
    gap: 10px;
    align-items: stretch;
    justify-items: stretch;
  }

  /* 이 래퍼들은 가로모드와 마찬가지로 시각적 박스가 아니라
     그리드 배치를 위한 통로 역할만 함 */
  .left-col, .right-col, .history-nav {
    display: contents;
  }

  .board-col {
    grid-area: board;
    width: 100%;
    padding-top: 0;
  }

  .chess-board {
    margin: 0 auto;
  }

  /* 이름(닉네임) 줄 — 캐릭터/닉네임이 보이는 자리, 가장 눈에 띄게 크게 */
  /* 이름(닉네임) 줄 — 캐릭터가 있던 자리를 대신해서 맨 위로 옮기고,
     아바타 아이콘 + 닉네임을 크게 키워서 눈에 띄게 표시 */
  .player-row {
    grid-area: names;
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 6px 4px 2px;
  }

  .player-name {
    font-size: 20px;
  }

  .player-time {
    font-size: 13px;
  }

  #logPanel {
    grid-area: log;
    height: 180px;
    aspect-ratio: auto;
    width: 100%;
  }

  /* 하단 4버튼(옵션/기권/이전/다음) — 가로모드와 동일하게 배경 없이
     녹아있다가 눌렀을 때만 살짝 밝아지는 스타일 */
  #prevBtn, #nextBtn, #resignBtn, #latestBtn, .xeon-controls .xeon-btn {
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #ccc;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 6px;
    transition: background 0.12s ease;
  }
  #prevBtn:active, #nextBtn:active, #resignBtn:active, #latestBtn:active,
  .xeon-controls .xeon-btn:active {
    background: rgba(255,255,255,0.1);
  }
  #prevBtn.look-disabled, #nextBtn.look-disabled {
    background: transparent;
  }
  #resignBtn {
    color: #ff9a9a;
  }

  #prevBtn { grid-area: prev; margin: 0; }
  #nextBtn { grid-area: next; margin: 0; }
  #resignBtn { grid-area: resign; margin: 0; }

  #latestBtn {
    grid-area: opt;
    margin: 0;
    width: 100%;
    height: 100%;
  }

  .xeon-controls {
    grid-area: opt;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 4px;
    margin-top: 0 !important;
  }
  .xeon-controls .xeon-btn {
    width: 100%;
  }
  .xeon-undo-status {
    font-size: 11px;
    justify-content: center;
    text-align: center;
    color: #999;
  }

  #adminDeleteBtn {
    grid-area: admin;
    margin-top: 0;
    width: 100%;
  }
}

/* ===================== 관리자 기능 ===================== */

.admin-corner {
  position: fixed;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  z-index: 999;
  cursor: default;
  background: transparent;
}

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

.room-delete-btn {
  background: #4a2a2a;
  color: #ff8a8a;
  border: none;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  font-size: 13px;
  cursor: pointer;
}

.admin-delete-btn {
  margin-top: 8px;
  background: #4a2a2a;
  color: #ff8a8a;
  font-size: 12px;
}

/* ===================== 이전 게임 돌아가기 배너 ===================== */

.resume-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: #24283a;
  border-bottom: 1px solid #3a3f5c;
  font-size: 13px;
  color: #ccc;
}

.resume-banner span {
  margin-right: 4px;
}

.resume-banner .btn {
  padding: 7px 14px;
  font-size: 13px;
}

/* ===================== 로그인 상태(좌상단) ===================== */

.auth-corner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #202027;
  border-bottom: 1px solid #333;
  font-size: 13px;
  color: #ccc;
  flex-wrap: wrap;
}

.auth-status {
  color: #bbb;
}

.auth-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

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

/* ===================== 프로필 박스(로비 맨 왼쪽 하단) ===================== */

.profile-box {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 998;
  background: #2a2a33;
  border: 1px solid #3a3a44;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  text-align: left;
  user-select: none;
  transition: background 0.15s;
  max-width: 220px;
}

.profile-box:hover {
  background: #33333d;
}

.profile-box:active {
  background: #3a3a44;
}

.profile-nickname {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-record {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

.profile-hint {
  font-size: 10px;
  color: #666;
  margin-top: 2px;
}

/* ===================== 프로모션(승진) 선택 모달 ===================== */

.promo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  padding: 16px;
}

.promo-box {
  background: #2a2a33;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
}

.promo-title {
  font-size: 14px;
  color: #ccc;
  margin: 0 0 14px;
}

.promo-choices {
  display: flex;
  flex-direction: row;
  gap: 10px;
}

.promo-piece-btn {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #1e1e24;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 78%;
  border: 2px solid #444;
  border-radius: 10px;
  cursor: pointer;
  color: inherit;
}

.promo-piece-btn:active {
  background: #33333d;
}

/* AI가 추천하는 승진 기물 — 판 위 힌트와 동일한 파란 테두리로 표시 */
.promo-piece-btn.ai-suggest-piece {
  border-color: rgba(64, 132, 255, 0.9);
}
