/* ==========================================================
   막아막아 (DUO Makak) v20260516_1 — 시각 강화판
   prefix: .mk-
   ========================================================== */

.mk-hidden { display: none !important; }

html { overflow-y: scroll; scrollbar-gutter: stable; }
body { overflow-x: hidden; }

:root {
  --mk-bg: #061215;
  --mk-bg-2: #0c1d22;
  --mk-bg-3: #112a31;
  --mk-panel: #163a44;
  --mk-panel-2: #1f4e5a;
  --mk-line: rgba(80, 230, 180, 0.22);
  --mk-line-strong: rgba(80, 230, 180, 0.5);
  --mk-text: #e0f5ee;
  --mk-text-dim: #aac8c0;
  --mk-text-mute: #6f8c85;
  --mk-accent: #4ee0a8;
  --mk-accent-2: #7af0c4;
  --mk-accent-glow: rgba(78, 224, 168, 0.5);
  --mk-gold: #ffd166;
  --mk-danger: #ff4d6d;
  --mk-success: #66e9a8;
  --mk-cell-bg: #1a3c45;
  --mk-cell-bg-2: #224a55;
  --mk-cell-hover: #2d6373;
  --mk-cell-legal: rgba(78, 224, 168, 0.35);
  --mk-wall-installed: linear-gradient(135deg, #ffd166 0%, #ff9c4a 100%);
  --mk-wall-slot-hover: rgba(255, 209, 102, 0.55);
  /* 팀 컬러 (동서남북) */
  --mk-team-a: #ff6b6b;
  --mk-team-b: #4ecdc4;
  --mk-team-c: #ffd166;
  --mk-team-d: #b87bff;
}

.mk-app {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 12px 40px;
  color: var(--mk-text);
  background:
    radial-gradient(ellipse at top, #1a4a55 0%, transparent 50%),
    linear-gradient(180deg, var(--mk-bg) 0%, var(--mk-bg-2) 100%);
  min-height: calc(100vh - 60px);
  box-sizing: border-box;
}

.mk-screen { display: none; animation: mk-screen-in 0.3s ease-out; }
.mk-screen.active { display: block; }
@keyframes mk-screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 사이드 광고 */
.mk-side-ad { display: none; }
@media (min-width: 1548px) {
  .mk-side-ad { display: block; position: fixed; top: 80px; width: 180px; height: 600px; z-index: 1; }
  .mk-side-ad-left  { left: calc(50% - 746px); }
  .mk-side-ad-right { left: calc(50% + 566px); }
}

/* ===== SETUP / LOBBY ===== */
.mk-setup, .mk-lobby {
  background: linear-gradient(145deg, var(--mk-panel) 0%, var(--mk-panel-2) 100%);
  border: 1px solid var(--mk-line);
  border-radius: 20px;
  padding: 32px 24px;
  margin: 24px auto 0;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 60px rgba(78, 224, 168, 0.08);
  position: relative;
  overflow: hidden;
}
.mk-setup::before, .mk-lobby::before {
  content: "";
  position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(78,224,168,0.06) 90deg, transparent 180deg);
  animation: mk-bg-rotate 25s linear infinite;
  pointer-events: none; z-index: 0;
}
.mk-setup > *, .mk-lobby > * { position: relative; z-index: 1; }
@keyframes mk-bg-rotate { to { transform: rotate(360deg); } }

.mk-setup-emoji {
  font-size: 72px;
  margin-bottom: 8px;
  text-shadow: 0 0 24px var(--mk-accent-glow);
  animation: mk-emoji-float 3s ease-in-out infinite;
}
@keyframes mk-emoji-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.mk-setup-title {
  font-size: 34px; font-weight: 900; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--mk-accent) 0%, var(--mk-accent-2) 50%, var(--mk-gold) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 6px;
}
.mk-setup-sub { font-size: 14px; color: var(--mk-text-dim); margin-bottom: 20px; line-height: 1.55; }
.mk-login-warn {
  margin: 0 0 12px; padding: 10px 14px;
  background: rgba(255, 77, 109, 0.1);
  border: 1px solid rgba(255, 77, 109, 0.35);
  border-radius: 10px; font-size: 12px; color: var(--mk-text-dim);
}
.mk-setup-input {
  width: 100%; padding: 13px 16px; font-size: 15px;
  background: var(--mk-bg-2); color: var(--mk-text);
  border: 1px solid var(--mk-line); border-radius: 11px;
  margin-bottom: 10px; box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.mk-setup-input:focus { outline: none; border-color: var(--mk-accent); box-shadow: 0 0 0 3px var(--mk-accent-glow); }
.mk-setup-btn {
  display: block; width: 100%; max-width: 340px; margin: 10px auto 0;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--mk-accent) 0%, var(--mk-accent-2) 100%);
  color: #061215; font-size: 16px; font-weight: 900;
  border: none; border-radius: 13px; cursor: pointer;
  box-shadow: 0 6px 20px var(--mk-accent-glow);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
}
.mk-setup-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px var(--mk-accent-glow); filter: brightness(1.08); }
.mk-setup-btn:active { transform: translateY(0); }
.mk-setup-btn:disabled { background: var(--mk-panel-2); color: var(--mk-text-mute); cursor: not-allowed; box-shadow: none; transform: none; filter: none; }
.mk-setup-btn-secondary {
  background: var(--mk-panel-2); color: var(--mk-text);
  font-size: 14px; box-shadow: none; border: 1px solid var(--mk-line);
}
.mk-setup-btn-secondary:hover { background: var(--mk-bg-3); }
.mk-setup-hint { margin-top: 16px; font-size: 13px; color: var(--mk-text-mute); line-height: 1.7; }

.mk-lobby-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.mk-lobby-title {
  font-size: 20px; font-weight: 900;
  background: linear-gradient(135deg, var(--mk-accent) 0%, var(--mk-gold) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.mk-btn-ghost { background: transparent; color: var(--mk-text-dim); border: 1px solid var(--mk-line); border-radius: 9px; cursor: pointer; font-size: 13px; padding: 6px 12px; }
.mk-btn-ghost:hover { background: var(--mk-panel-2); color: var(--mk-text); }
.mk-btn-secondary { background: var(--mk-panel-2); color: var(--mk-text); border: 1px solid var(--mk-line); border-radius: 9px; cursor: pointer; font-size: 12px; padding: 5px 10px; }
.mk-btn-secondary:hover { background: var(--mk-bg-3); }
.mk-btn-primary {
  background: linear-gradient(135deg, var(--mk-accent) 0%, var(--mk-accent-2) 100%);
  color: #061215; border: none; border-radius: 11px; padding: 11px 22px;
  font-weight: 900; cursor: pointer;
  box-shadow: 0 4px 14px var(--mk-accent-glow);
}
.mk-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 18px var(--mk-accent-glow); }

.mk-lobby-invite { background: var(--mk-bg-2); border: 1px solid var(--mk-line); border-radius: 13px; padding: 12px 14px; margin-bottom: 16px; }
.mk-lobby-invite-label { font-size: 12px; color: var(--mk-text-mute); margin-bottom: 6px; text-align: left; font-weight: 700; }
.mk-lobby-invite-row { display: flex; gap: 6px; align-items: center; }
.mk-lobby-invite-code { flex: 1; font-size: 24px; font-weight: 900; letter-spacing: 6px; color: var(--mk-accent-2); text-align: center; font-variant-numeric: tabular-nums; text-shadow: 0 0 12px var(--mk-accent-glow); }

.mk-lobby-options { background: var(--mk-bg-2); border: 1px solid var(--mk-line); border-radius: 13px; padding: 14px; margin-bottom: 16px; text-align: left; }
.mk-lobby-opt-label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: var(--mk-text-dim); }
.mk-lobby-opt-hint { margin-top: 10px; font-size: 11px; color: var(--mk-text-mute); }

.mk-lobby-roster-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; color: var(--mk-text-dim); margin-bottom: 8px; }
.mk-lobby-roster { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.mk-roster-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--mk-bg-2); border: 1px solid transparent; border-radius: 10px; font-size: 13px; }
.mk-roster-row.mk-roster-me { border: 1px solid var(--mk-accent); background: rgba(78, 224, 168, 0.06); }
.mk-roster-name { flex: 1; text-align: left; font-weight: 700; }
.mk-roster-tags { display: flex; gap: 4px; }
.mk-roster-host { background: var(--mk-gold); color: #061215; padding: 3px 7px; border-radius: 6px; font-size: 10px; font-weight: 900; }
.mk-roster-guest { background: var(--mk-panel-2); color: var(--mk-text-mute); padding: 3px 7px; border-radius: 6px; font-size: 10px; }

/* ===== PLAY ===== */
.mk-hud {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 16px; padding: 14px 20px;
  background: linear-gradient(135deg, var(--mk-panel) 0%, var(--mk-panel-2) 100%);
  border: 1px solid var(--mk-line); border-radius: 14px;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.mk-hud-item { display: flex; flex-direction: column; align-items: center; }
.mk-hud-label { font-size: 11px; color: var(--mk-text-mute); letter-spacing: 0.5px; text-transform: uppercase; font-weight: 700; }
.mk-hud-val { font-size: 17px; font-weight: 900; }
#mkTurnName {
  background: linear-gradient(135deg, var(--mk-accent) 0%, var(--mk-gold) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

#mkTimer {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 90px; padding: 8px 16px;
  background: var(--mk-bg-2); border: 2px solid var(--mk-line);
  border-radius: 999px;
  font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 900;
  color: var(--mk-accent-2);
  transition: all 0.2s;
}
#mkTimer.mk-timer-warn { border-color: var(--mk-gold); color: var(--mk-gold); animation: mk-timer-pulse 1s ease-in-out infinite; }
#mkTimer.mk-timer-critical { border-color: var(--mk-danger); color: var(--mk-danger); background: rgba(255, 77, 109, 0.15); animation: mk-timer-pulse 0.5s ease-in-out infinite; }
@keyframes mk-timer-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* 플레이어 카드 */
.mk-player-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px; margin-bottom: 14px;
}
.mk-player-card {
  background: linear-gradient(155deg, var(--mk-panel) 0%, var(--mk-panel-2) 100%);
  border: 2px solid var(--mk-line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex; align-items: center; gap: 8px;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.mk-player-card.mk-player-current {
  border-color: var(--mk-accent);
  box-shadow: 0 0 0 2px var(--mk-accent-glow);
  animation: mk-player-glow 2s ease-in-out infinite;
}
@keyframes mk-player-glow {
  0%,100% { box-shadow: 0 0 0 2px var(--mk-accent-glow); }
  50% { box-shadow: 0 0 0 5px var(--mk-accent-glow); }
}
.mk-player-card.mk-player-near-goal { animation: mk-near-goal 1s ease-in-out infinite; }
@keyframes mk-near-goal {
  0%,100% { box-shadow: 0 0 0 1px rgba(255,209,102,0.4); }
  50% { box-shadow: 0 0 0 4px rgba(255,209,102,0.7); }
}
.mk-player-card[data-team="A"] { border-left: 5px solid var(--mk-team-a); }
.mk-player-card[data-team="B"] { border-left: 5px solid var(--mk-team-b); }
.mk-player-card[data-team="C"] { border-left: 5px solid var(--mk-team-c); }
.mk-player-card[data-team="D"] { border-left: 5px solid var(--mk-team-d); }
.mk-player-info { flex: 1; min-width: 0; }
.mk-player-name { font-size: 13px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-player-meta { font-size: 11px; color: var(--mk-text-mute); margin-top: 2px; }
.mk-player-walls-badge { background: var(--mk-bg); padding: 4px 8px; border-radius: 8px; font-size: 11px; font-weight: 800; color: var(--mk-gold); }

/* ===== 보드 ===== */
.mk-play-layout {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 12px;
  align-items: start;
}
@media (max-width: 720px) {
  .mk-play-layout { grid-template-columns: 1fr; }
}

.mk-board-wrap {
  background: linear-gradient(155deg, var(--mk-panel) 0%, var(--mk-panel-2) 100%);
  border: 2px solid var(--mk-line);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

/* 보드: 17 트랙 그리드 (셀 9 + 벽갭 8 교차) — JS가 r*2+1 좌표 사용 */
.mk-board {
  display: grid;
  --mk-cell-size: 44px;
  --mk-wall-gap: 8px;
  grid-template-columns:
    var(--mk-cell-size) var(--mk-wall-gap) var(--mk-cell-size) var(--mk-wall-gap)
    var(--mk-cell-size) var(--mk-wall-gap) var(--mk-cell-size) var(--mk-wall-gap)
    var(--mk-cell-size) var(--mk-wall-gap) var(--mk-cell-size) var(--mk-wall-gap)
    var(--mk-cell-size) var(--mk-wall-gap) var(--mk-cell-size) var(--mk-wall-gap)
    var(--mk-cell-size);
  grid-template-rows:
    var(--mk-cell-size) var(--mk-wall-gap) var(--mk-cell-size) var(--mk-wall-gap)
    var(--mk-cell-size) var(--mk-wall-gap) var(--mk-cell-size) var(--mk-wall-gap)
    var(--mk-cell-size) var(--mk-wall-gap) var(--mk-cell-size) var(--mk-wall-gap)
    var(--mk-cell-size) var(--mk-wall-gap) var(--mk-cell-size) var(--mk-wall-gap)
    var(--mk-cell-size);
  padding: 12px;
  background: linear-gradient(135deg, #0a1f24 0%, #163842 100%);
  border-radius: 12px;
  position: relative;
}
@media (max-width: 720px) {
  .mk-board {
    --mk-cell-size: 32px;
    --mk-wall-gap: 5px;
    padding: 8px;
  }
}

.mk-cell {
  background: var(--mk-cell-bg);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  cursor: default;
  position: relative;
  transition: background 0.15s, transform 0.15s;
}
.mk-cell.mk-cell-clickable { cursor: pointer; }
.mk-cell.mk-cell-clickable:hover { background: var(--mk-cell-hover); transform: scale(1.08); }
.mk-cell.mk-cell-legal {
  background: var(--mk-cell-legal);
  box-shadow: inset 0 0 0 2px var(--mk-accent);
  animation: mk-legal-pulse 1.5s ease-in-out infinite;
}
@keyframes mk-legal-pulse { 0%,100% { opacity: 0.7; } 50% { opacity: 1; } }

/* 결승선 표시 (변별) */
.mk-cell[data-goal="N"] { box-shadow: inset 0 -3px 0 0 var(--mk-team-b); }
.mk-cell[data-goal="S"] { box-shadow: inset 0 3px 0 0 var(--mk-team-a); }
.mk-cell[data-goal="W"] { box-shadow: inset 3px 0 0 0 var(--mk-team-d); }
.mk-cell[data-goal="E"] { box-shadow: inset -3px 0 0 0 var(--mk-team-c); }

/* 말 (player pawn) */
.mk-pawn {
  width: 70%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--mk-pawn-light, #f0f0f0), var(--mk-pawn-color, #888));
  border: 2px solid rgba(0,0,0,0.3);
  box-shadow: 0 3px 8px rgba(0,0,0,0.5), inset 0 -2px 4px rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
  animation: mk-pawn-spawn 0.5s cubic-bezier(.34,1.56,.64,1);
}
.mk-pawn-me { box-shadow: 0 3px 8px rgba(0,0,0,0.5), inset 0 -2px 4px rgba(0,0,0,0.3), 0 0 0 3px var(--mk-accent); }
/* 프로필 사진 micro 아바타 — 4명 동시에도 누가 누구인지 즉시 식별 */
.mk-pawn-photo {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* 사진 위에 팀/사이드 색 ring을 유지하기 위해 border는 inherit + 외곽 ring은 box-shadow */
  text-shadow: none;
  color: transparent;
}
.mk-pawn-photo[data-team="A"],
.mk-pawn-photo[data-side="N"] { box-shadow: 0 3px 8px rgba(0,0,0,0.5), 0 0 0 2.5px #ef4444; }
.mk-pawn-photo[data-team="B"],
.mk-pawn-photo[data-side="S"] { box-shadow: 0 3px 8px rgba(0,0,0,0.5), 0 0 0 2.5px #3b82f6; }
.mk-pawn-photo[data-team="C"],
.mk-pawn-photo[data-side="W"] { box-shadow: 0 3px 8px rgba(0,0,0,0.5), 0 0 0 2.5px #fbbf24; }
.mk-pawn-photo[data-team="D"],
.mk-pawn-photo[data-side="E"] { box-shadow: 0 3px 8px rgba(0,0,0,0.5), 0 0 0 2.5px #22c55e; }
.mk-pawn-photo.mk-pawn-me { box-shadow: 0 3px 8px rgba(0,0,0,0.5), 0 0 0 3px var(--mk-accent); }
@keyframes mk-pawn-spawn {
  0% { transform: scale(0) rotate(180deg); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.mk-pawn.mk-pawn-moved { animation: mk-pawn-move 0.5s ease-out; }
@keyframes mk-pawn-move {
  0% { transform: scale(0.7); filter: brightness(2); }
  100% { transform: scale(1); }
}

/* 팀 컬러 pawn */
.mk-pawn[data-team="A"] { --mk-pawn-color: #c0392b; --mk-pawn-light: #ff8080; }
.mk-pawn[data-team="B"] { --mk-pawn-color: #16a085; --mk-pawn-light: #6ed5c0; }
.mk-pawn[data-team="C"] { --mk-pawn-color: #d4a017; --mk-pawn-light: #ffe070; }
.mk-pawn[data-team="D"] { --mk-pawn-color: #7c3aed; --mk-pawn-light: #c8a8ff; }
.mk-pawn[data-side="N"] { --mk-pawn-color: #c0392b; --mk-pawn-light: #ff8080; }
.mk-pawn[data-side="S"] { --mk-pawn-color: #16a085; --mk-pawn-light: #6ed5c0; }
.mk-pawn[data-side="W"] { --mk-pawn-color: #d4a017; --mk-pawn-light: #ffe070; }
.mk-pawn[data-side="E"] { --mk-pawn-color: #7c3aed; --mk-pawn-light: #c8a8ff; }

/* ===== 벽 슬롯 ===== */
/* 보드 위에 absolute layer로 벽 슬롯 배치 */
.mk-wall-layer {
  position: absolute; inset: 0;
  pointer-events: none;
}
.mk-wall-slot {
  /* grid item으로 배치 (JS가 grid-row/column 지정) — absolute 제거 */
  position: relative;
  pointer-events: auto;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  border-radius: 4px;
  z-index: 5;
  min-width: 4px;
  min-height: 4px;
  /* 벽 모드에서 슬롯이 항상 보이도록 미세한 점선 + 반투명 배경 */
  background: rgba(255, 209, 102, 0.18);
  outline: 1px dashed rgba(255, 209, 102, 0.7);
  outline-offset: -2px;
  animation: mk-slot-breath 1.6s ease-in-out infinite;
}
@keyframes mk-slot-breath {
  0%, 100% { background: rgba(255, 209, 102, 0.18); }
  50% { background: rgba(255, 209, 102, 0.32); }
}
.mk-wall-slot:hover {
  background: var(--mk-wall-slot-hover);
  outline-color: var(--mk-accent-2);
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.6);
  animation: none;
}
.mk-wall-slot.mk-wall-slot-disabled { cursor: not-allowed; }
.mk-wall-slot.mk-wall-slot-disabled:hover { background: rgba(255, 77, 109, 0.35); }

.mk-wall {
  /* grid item으로 배치 — absolute 제거 */
  position: relative;
  background: var(--mk-wall-installed);
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5), inset 0 1px 2px rgba(255,255,255,0.4);
  pointer-events: none;
  z-index: 6;
  animation: mk-wall-place 0.45s cubic-bezier(.34,1.56,.64,1);
}
@keyframes mk-wall-place {
  0% { transform: scaleX(0); filter: brightness(2.5); }
  100% { transform: scaleX(1); filter: brightness(1); }
}
.mk-wall-vertical { animation-name: mk-wall-place-v; }
@keyframes mk-wall-place-v {
  0% { transform: scaleY(0); filter: brightness(2.5); }
  100% { transform: scaleY(1); filter: brightness(1); }
}

/* ===== TOOLS ===== */
.mk-tools {
  background: linear-gradient(155deg, var(--mk-panel) 0%, var(--mk-panel-2) 100%);
  border: 1px solid var(--mk-line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mk-tools-title { font-size: 13px; font-weight: 900; color: var(--mk-accent-2); letter-spacing: 0.5px; }
.mk-tool-buttons { display: flex; gap: 6px; }
.mk-tool-btn {
  flex: 1;
  padding: 10px;
  background: var(--mk-bg-2);
  border: 1px solid var(--mk-line);
  color: var(--mk-text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s;
}
.mk-tool-btn:hover { background: var(--mk-bg-3); }
.mk-tool-btn.active {
  background: linear-gradient(135deg, var(--mk-accent) 0%, var(--mk-accent-2) 100%);
  color: #061215; border-color: var(--mk-accent-2);
  box-shadow: 0 4px 12px var(--mk-accent-glow);
}
.mk-tool-hint { font-size: 11px; color: var(--mk-text-mute); padding: 8px 4px; line-height: 1.5; }
.mk-my-walls {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px;
  background: var(--mk-bg-2);
  border-radius: 8px;
  font-size: 13px; font-weight: 700;
}
.mk-my-walls-count { color: var(--mk-gold); font-size: 16px; font-weight: 900; }

/* ===== 로그 ===== */
.mk-log-box {
  background: linear-gradient(135deg, var(--mk-panel) 0%, var(--mk-panel-2) 100%);
  border: 1px solid var(--mk-line);
  border-radius: 13px;
  padding: 12px 14px;
  max-height: 180px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
}
.mk-log-title { font-size: 13px; font-weight: 900; color: var(--mk-accent-2); margin-bottom: 8px; }
.mk-log-list { list-style: none; padding: 0; margin: 0; flex: 1; overflow-y: auto; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.mk-log-list li { padding: 6px 10px; background: var(--mk-bg-2); border-radius: 7px; }
.mk-log-list li:first-child { animation: mk-log-in 0.3s ease-out; }
@keyframes mk-log-in { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.mk-log-move { border-left: 3px solid var(--mk-accent); }
.mk-log-wall { border-left: 3px solid var(--mk-gold); }
.mk-log-win { background: linear-gradient(90deg, rgba(255,209,102,0.2) 0%, var(--mk-bg-2) 100%) !important; color: var(--mk-gold); font-weight: 800; }

/* 로그 인라인 미니 아바타 */
.mk-log-avatar {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 50%;
  vertical-align: middle;
  margin: 0 2px 0 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(255,255,255,0.2);
  flex: 0 0 auto;
}
.mk-log-avatar-photo {
  font-size: 0;
  color: transparent;
}
.mk-log-avatar-initial {
  background: linear-gradient(135deg, rgba(255,209,102,0.55), rgba(124,106,239,0.45));
  color: #14080a;
  font-size: 9px;
  font-weight: 900;
  line-height: 16px;
  text-align: center;
}

/* 큰 모먼트 */
.mk-moment {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px; font-weight: 900;
  letter-spacing: 4px;
  pointer-events: none; z-index: 1600;
  text-shadow: 0 4px 24px rgba(0,0,0,0.6);
  animation: mk-moment-pop 1.2s cubic-bezier(.34,1.56,.64,1);
}
.mk-moment-win { color: var(--mk-gold); text-shadow: 0 0 24px var(--mk-gold), 0 4px 24px rgba(0,0,0,0.6); }
.mk-moment-mine { color: var(--mk-accent); text-shadow: 0 0 24px var(--mk-accent), 0 4px 24px rgba(0,0,0,0.6); }
@keyframes mk-moment-pop {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  30% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  70% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.1); opacity: 0; }
}

/* ===== END ===== */
.mk-end-card {
  background: linear-gradient(145deg, var(--mk-panel) 0%, var(--mk-panel-2) 100%);
  border: 2px solid var(--mk-gold);
  border-radius: 22px;
  padding: 28px;
  max-width: 520px;
  margin: 24px auto;
  text-align: center;
  box-shadow: 0 16px 48px rgba(255, 209, 102, 0.2);
}
.mk-end-title {
  font-size: 28px; font-weight: 900;
  background: linear-gradient(135deg, var(--mk-gold) 0%, var(--mk-accent) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 20px;
}
.mk-final-ranking { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.mk-final-row {
  display: grid; grid-template-columns: 44px auto 1fr auto;
  gap: 12px; align-items: center;
  padding: 12px 16px; background: var(--mk-bg-2);
  border-radius: 12px; border: 1px solid transparent;
}
.mk-final-row.mk-final-winner { border: 2px solid var(--mk-gold); background: linear-gradient(90deg, rgba(255,209,102,0.2) 0%, var(--mk-bg-2) 100%); }
.mk-final-row.mk-final-me { border: 2px solid var(--mk-accent); }
.mk-final-rank { font-size: 24px; font-weight: 900; text-align: center; }
.mk-final-nick { font-weight: 800; text-align: left; }
.mk-final-status { font-weight: 900; color: var(--mk-accent-2); font-size: 14px; }
.mk-end-actions { display: flex; flex-direction: column; gap: 10px; max-width: 340px; margin: 0 auto; }

/* TOAST */
.mk-toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(10, 24, 28, 0.96); backdrop-filter: blur(8px);
  color: var(--mk-text); padding: 12px 22px;
  border-radius: 999px; font-size: 14px; font-weight: 700;
  border: 1px solid var(--mk-line-strong);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s; z-index: 3000;
}
.mk-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 공통 아바타 */
.duo-avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; color: #fff; font-weight: 800; flex-shrink: 0; vertical-align: middle; text-transform: uppercase; line-height: 1; user-select: none; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.duo-avatar .duo-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.duo-avatar--sm { width: 26px; height: 26px; font-size: 12px; }
.duo-avatar--md { width: 36px; height: 36px; font-size: 16px; }

/* SEO Info */
.mk-info-card {
  max-width: 720px; margin: 24px auto 0; padding: 22px 20px;
  background: var(--mk-panel); border: 1px solid var(--mk-line); border-radius: 14px;
  color: var(--mk-text-dim); line-height: 1.6;
}
.mk-info-card h2 { font-size: 18px; color: var(--mk-accent-2); margin: 0 0 12px; }
.mk-info-card h3 { font-size: 14px; color: var(--mk-text); margin: 16px 0 8px; font-weight: 800; }
.mk-info-card p, .mk-info-card ul, .mk-info-card ol, .mk-info-card dl { font-size: 13px; margin: 6px 0; }
.mk-info-card dl { display: grid; grid-template-columns: 90px 1fr; gap: 4px 12px; }
.mk-info-card dt { color: var(--mk-text-mute); font-weight: 700; }
.mk-info-card dd { margin: 0; }
.mk-info-card ul, .mk-info-card ol { padding-left: 20px; }
.mk-info-card a { color: var(--mk-accent); }
.mk-info-card .seo-info-tags { color: var(--mk-text-mute); font-size: 12px; }
.mk-info-card.is-hidden { display: none; }
@media (max-width: 480px) {
  .mk-info-card { padding: 18px 14px; margin: 16px 8px 0; }
  .mk-info-card dl { grid-template-columns: 80px 1fr; }
}

/* 짧은 뷰포트 컴팩트 */
@media (max-height: 720px){
  .mk-setup, .mk-lobby{ padding: 16px 18px; }
  .mk-setup-emoji{ font-size: 38px; }
  .mk-setup-title{ font-size: 22px; }
  .mk-setup-sub{ font-size: 12px; margin-bottom: 12px; }
  .mk-setup-input{ padding: 8px 10px; font-size: 14px; }
}
@media (max-height: 560px){
  .mk-setup-emoji{ font-size: 26px; }
  .mk-setup-title{ font-size: 18px; }
  .mk-setup-sub{ display: none; }
}
