/* 체스 공통 */
.chess-page {
  background: #f7f7f5;
  min-height: 100vh;
}

.chess-hero {
  background: linear-gradient(135deg, #2b2b2b 0%, #4a4a4a 100%);
  color: #fff;
  padding: 3.5rem 0 4rem;
  text-align: center;
}

.chess-hero h1 {
  font-size: 2.4rem;
  font-weight: 900;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.chess-hero p {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.82);
  max-width: 640px;
  margin: 0 auto 1.5rem;
}

.chess-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.chess-section {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.chess-section h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.chess-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.chess-info-card {
  border: 1px solid #e8e8e6;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  text-align: center;
}

.chess-info-card strong {
  display: block;
  font-size: 0.78rem;
  color: #666;
  margin-bottom: 0.25rem;
}

.chess-info-card span {
  font-weight: 800;
  font-size: 1.05rem;
}

.chess-piece-info {
  border: 1px solid #ececea;
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  height: 100%;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.chess-piece-info:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.06);
}

.chess-piece-info i {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: #4a4a4a;
}

.chess-piece-info strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.chess-piece-info span {
  font-size: 0.82rem;
  color: #666;
}

.chess-rule-list {
  padding-left: 1.2rem;
}

.chess-rule-list li {
  margin-bottom: 0.6rem;
  line-height: 1.55;
}

.chess-mini-board-demo {
  max-width: 360px;
  margin: 0 auto;
}

/* 보드 */
.chess-board-wrap {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  border: 4px solid #3e3e3e;
  border-radius: 6px;
  overflow: hidden;
  user-select: none;
}

.chess-square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chess-square.light { background: #f0d9b5; }
.chess-square.dark { background: #b58863; }
.chess-square.selected { box-shadow: inset 0 0 0 4px rgba(20, 85, 30, 0.55); }
.chess-square.legal::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  background: rgba(20, 85, 30, 0.35);
  border-radius: 50%;
}
.chess-square.legal.capture::after {
  width: 100%;
  height: 100%;
  border: 5px solid rgba(20, 85, 30, 0.45);
  border-radius: 0;
  background: transparent;
}
.chess-square.last-move { filter: brightness(1.15); }

.chess-piece {
  font-size: clamp(1.6rem, 7vw, 3.2rem);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.25));
  pointer-events: none;
}

.chess-piece.white { color: #fff; text-shadow: 0 0 2px rgba(0,0,0,0.5); }
.chess-piece.black { color: #111; }

/* 런처 */
.chess-launcher-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

.chess-launcher-title {
  font-size: 1.6rem;
  font-weight: 900;
  margin-bottom: 0.25rem;
}

.chess-launcher-lead {
  color: #666;
  margin: 0;
}

.chess-launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.chess-launcher-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chess-launcher-card-media {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4a4a4a, #2b2b2b);
  color: #fff;
  font-size: 2.5rem;
  position: relative;
}

.chess-launcher-card-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255,255,255,0.18);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.chess-launcher-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chess-launcher-card-body h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.chess-launcher-card-body p {
  color: #666;
  font-size: 0.9rem;
  flex: 1;
}

.chess-launcher-card-body button {
  width: 100%;
}

@media (max-width: 991px) {
  .chess-launcher-grid { grid-template-columns: 1fr; }
}

/* 게임 화면 */
.chess-turn-timer {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

.chess-turn-timer .progress { height: 12px; background: #e8e8e6; }
.chess-turn-timer .progress-bar { transition: width 0.1s linear, background-color 0.2s ease; }

.chess-game-stage { display: none; }
.chess-game-stage.is-active { display: block; }

.chess-game-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.chess-game-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chess-turn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  border: 1px solid #e4e4e2;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.chess-turn-pill .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #aaa;
  display: inline-block;
}

.chess-turn-pill .dot.white { background: #fff; border: 2px solid #333; }
.chess-turn-pill .dot.black { background: #222; }

.chess-game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 991px) {
  .chess-game-layout { grid-template-columns: 1fr; }
}

.chess-board-card {
  background: #fff;
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

.chess-side-card {
  background: #fff;
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

.chess-side-card h4 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.chess-player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f0f0ee;
}

.chess-player-row:last-child { border-bottom: none; }

.chess-player-info {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.chess-player-info i { font-size: 1.25rem; }
.chess-player-info i.white { color: #aaa; }
.chess-player-info i.black { color: #222; }

.chess-move-list {
  max-height: 220px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  background: #f9f9f8;
  border-radius: 10px;
  padding: 0.6rem;
}

.chess-form-inline {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chess-code-input {
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 700;
  max-width: 160px;
}

/* 연습 오버레이 */
.chess-practice-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  z-index: 10;
}

.chess-practice-overlay-inner { text-align: center; }

/* 기물 설명 패널 */
.chess-piece-desc-wrap { min-height: 160px; }

.chess-piece-desc .piece-name {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chess-piece-desc .piece-name i {
  font-size: 1.4rem;
  color: #4a4a4a;
}

.chess-piece-desc .piece-desc {
  font-size: 0.92rem;
  color: #444;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.chess-piece-desc .piece-move {
  font-size: 0.85rem;
  color: #666;
  padding: 0.55rem 0.75rem;
  background: #f8f8f7;
  border-radius: 10px;
  border-left: 3px solid #b58863;
}

/* 로비 */
.chess-lobby-stage { display: none; }
.chess-lobby-stage.is-active { display: block; }

.chess-lobby-room-item,
.chess-lobby-invite-item {
  padding: 0.9rem 1rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 0.6rem;
  transition: box-shadow 0.12s ease;
}

.chess-lobby-room-item:hover,
.chess-lobby-invite-item:hover { box-shadow: 0 6px 16px rgba(0,0,0,0.06); }

.chess-lobby-chat-list {
  max-height: 520px;
  min-height: 220px;
  overflow-y: auto;
  background: #f8f8f7;
  border-radius: 12px;
  padding: 0.75rem;
}

.chess-lobby-chat-item { margin-bottom: 0.7rem; max-width: 92%; }
.chess-lobby-chat-item.is-me { margin-left: auto; text-align: right; }
.chess-lobby-chat-meta { display: flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; margin-bottom: 0.15rem; }
.chess-lobby-chat-item.is-me .chess-lobby-chat-meta { justify-content: flex-end; }
.chess-lobby-chat-body {
  display: inline-block;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: #222;
  word-break: break-word;
}
.chess-lobby-chat-item.is-me .chess-lobby-chat-body { background: #4a4a4a; color: #fff; border-color: #4a4a4a; }

/* 관전 */
.chess-spectate-status {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 700;
}
.chess-spectate-status.waiting { background: #fff3cd; color: #856404; }
.chess-spectate-status.playing { background: #d1ecf1; color: #0c5460; }
.chess-spectate-status.finished { background: #d4edda; color: #155724; }

/* 토스트 */
.chess-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1a1a1a;
  color: #fff;
  padding: 0.8rem 1.25rem;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 12px 32px rgba(0,0,0,0.22);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 1080;
}
.chess-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
