/* 세균전 게임 전용 스타일 */
:root {
  --player:      #4da8ff;
  --player-bg:   rgba(77,168,255,.18);
  --ai:          #ff5a5a;
  --ai-bg:       rgba(255,90,90,.18);
  --obstacle:    rgba(255,255,255,.06);
  --empty:       rgba(255,255,255,.04);
  --valid-bg:    rgba(77,168,255,.22);
  --valid-border:#4da8ff;
  --selected-bg: rgba(77,168,255,.45);
}

/* ── 점수판 ── */
.scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 12px 0 14px;
  margin-bottom: 2px;
}
.score-item { display: flex; align-items: center; gap: 8px; }
.score-dot  { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; }
.player-dot { background: var(--player); box-shadow: 0 0 8px var(--player); }
.ai-dot     { background: var(--ai);     box-shadow: 0 0 8px var(--ai); }
.score-name { font-size: 0.82rem; color: var(--muted); }
.score-num  { font-size: 1.7rem; font-weight: 800; min-width: 2ch; text-align: center; font-family: "Courier New", monospace; }
.score-item.player .score-num { color: var(--player); }
.score-item.ai     .score-num { color: var(--ai); }
.score-vs { font-size: 0.82rem; color: var(--muted); font-weight: 700; }

/* ── 상태 박스 ── */
.status-box {
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
  min-height: 1.4em;
  margin: 8px 0;
}

/* ── 보드 ── */
.board-wrap {
  display: flex;
  justify-content: center;
  margin: 10px 0 8px;
}
.board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  width: min(100%, 360px);
  aspect-ratio: 1;
  background: rgba(0,0,0,.25);
  border-radius: 10px;
  padding: 7px;
  border: 1px solid rgba(255,255,255,.07);
}
.cell {
  border-radius: 5px;
  cursor: pointer;
  transition: background .1s, transform .08s, box-shadow .1s;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05em;
  -webkit-tap-highlight-color: transparent;
}

.cell.empty    { background: var(--empty); }
.cell.obstacle { background: var(--obstacle); cursor: not-allowed; }
.cell.player   { background: var(--player-bg); box-shadow: inset 0 0 0 2px var(--player); }
.cell.ai       { background: var(--ai-bg);     box-shadow: inset 0 0 0 2px var(--ai); }
.cell.selected { background: var(--selected-bg); box-shadow: inset 0 0 0 2px #fff; transform: scale(1.08); }
.cell.valid    { background: var(--valid-bg); box-shadow: inset 0 0 0 2px var(--valid-border); }
.cell.valid:hover { background: rgba(77,168,255,.38); transform: scale(1.05); }

.cell.player::after   { content: '🔵'; font-size: .88em; }
.cell.ai::after       { content: '🔴'; font-size: .88em; }
.cell.selected::after { content: '🔵'; font-size: .88em; }
.cell.obstacle::after { content: ''; display: block; width: 55%; height: 55%; background: rgba(255,255,255,.12); border-radius: 3px; }

/* ── 이동 애니메이션 ── */

/* 점프 출발 시 소스 칸 흐리게 */
.cell.piece-departing {
  opacity: 0.15;
  transition: opacity 60ms;
}

/* 보드 잠금 (애니메이션 중 클릭 차단) */
.board-locked .cell {
  pointer-events: none;
}

/* 날아다니는 오버레이 조각 */
.anim-flying-piece {
  position: fixed;
  border-radius: 5px;
  pointer-events: none;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}
.anim-flying-piece.player {
  background: rgba(77,168,255,.55);
  box-shadow: inset 0 0 0 2px #4da8ff, 0 4px 16px rgba(77,168,255,.4);
}
.anim-flying-piece.ai {
  background: rgba(255,90,90,.55);
  box-shadow: inset 0 0 0 2px #ff5a5a, 0 4px 16px rgba(255,90,90,.4);
}

/* 감염 애니메이션 — 밝게 터진 뒤 안착 */
@keyframes infect {
  0%   { transform: scale(1.55); filter: brightness(2.5) saturate(1.8); }
  55%  { transform: scale(0.88); filter: brightness(1.3); }
  100% { transform: scale(1);    filter: brightness(1); }
}
.cell.infect-anim {
  animation: infect 260ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ── 액션 ── */
.sticky-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* ── 결과 배너 ── */
.result-banner { text-align: center; margin-top: 12px; }
.result-pb     { font-size: .82rem; color: var(--muted); min-height: 1.2em; margin-bottom: 4px; }
.result-pb.new-record { color: var(--lime); font-weight: 700; }
.result-pb.streak     { color: var(--yellow); }
.result-score  { font-size: 2rem; font-weight: 800; color: var(--player); margin-bottom: 4px; font-family: "Courier New", monospace; }
.result-rank   { font-size: .95rem; color: var(--muted); min-height: 1.4em; margin-bottom: 12px; }
.result-rank.top1 { color: var(--yellow); }
.result-rank.top2 { color: #c8d4e8; }
.result-rank.top3 { color: #e0a060; }
.result-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ── 랭킹 ── */
.row.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.rank { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.rank li { padding: 8px 12px; border-radius: 6px; background: rgba(255,255,255,.04); font-size: .84rem; }
.rank li:nth-child(1) { border-left: 3px solid var(--yellow); }
.rank li:nth-child(2) { border-left: 3px solid #c8d4e8; }
.rank li:nth-child(3) { border-left: 3px solid #e0a060; }

/* ── 게임 방법 ── */
.how-to-list { padding-left: 20px; margin: 10px 0 0; line-height: 1.85; font-size: .88rem; color: var(--muted); }
.how-to-list li strong { color: var(--ink); }

/* ── 랭킹 모드 토글 ── */
.rank-mode-toggle { display: flex; gap: 4px; }
.rank-mode-btn {
  padding: 3px 10px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,.15);
  background: transparent; color: var(--muted);
  font-size: .76rem; cursor: pointer;
}
.rank-mode-btn.is-active {
  background: var(--player); color: #0b1220;
  border-color: var(--player); font-weight: 700;
}

/* ── confetti ── */
.confetti-piece {
  position: fixed; top: -10px; border-radius: 2px;
  animation: confettiFall linear forwards;
  pointer-events: none; z-index: 200;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ── 도전장 ── */
.challenge-notice {
  background: rgba(255,184,77,.1);
  border: 1px solid rgba(255,184,77,.3);
  border-radius: 8px; padding: 10px 14px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
  font-size: .84rem;
}
.challenge-result { margin-bottom: 10px; font-size: .88rem; text-align: center; }
.challenge-win  { color: var(--yellow); }
.challenge-lose { color: var(--muted); }
.challenge-tie  { color: var(--lime); }

/* ── 공유 버튼 ── */
.btn.share { background: rgba(255,255,255,.07); color: var(--lime); border: 1px solid var(--lime); }
.btn.share:hover { background: rgba(168,255,93,.12); }
.btn.result-restart { background: rgba(255,255,255,.07); color: var(--ink); border: 1px solid rgba(255,255,255,.14); }
.btn.result-restart:hover { background: rgba(255,255,255,.13); }
