:root {
  --bg: #1b232c;
  --bg2: #28333f;
  --surface: #2f3b47;
  --card: #2f3b47;
  --panel: #2f3b47;
  --text: #e8edf2;
  --muted: #9aa7b4;
  --accent: #4f9dde;
  --accent-soft: rgba(79, 157, 222, .16);
  --gold: #f5c518;
  --danger: #cc3344;
  --danger-bright: #ff5566;
  --danger-soft: rgba(204, 51, 68, .15);
  --success: #3dd168;
  --success-bright: #4dd97a;
  --offline: #888;
  --white: #fff;
  --black: #000;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .30);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .38);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .50);
  /* 호버/유리 효과 (흰색 반투명) */
  --hover-weak: rgba(255, 255, 255, .08);
  --hover: rgba(255, 255, 255, .10);
  --hover-strong: rgba(255, 255, 255, .16);
  /* 검정 반투명 오버레이 (숫자 = 불투명도 %) */
  --overlay-25: rgba(0, 0, 0, .25);
  --overlay-45: rgba(0, 0, 0, .45);
  --overlay-50: rgba(0, 0, 0, .50);
  --overlay-55: rgba(0, 0, 0, .55);
  --overlay-60: rgba(0, 0, 0, .60);
  --overlay-78: rgba(0, 0, 0, .78);
  --overlay-82: rgba(0, 0, 0, .82);
  --overlay-intro: rgba(10, 14, 18, .92);
  /* 배경 그라디언트 / 화면별 배경 */
  --bg-grad-1: #1f2933;
  --bg-grad-2: #11181f;
  --home-bg: #c8ccd4;
  --home-bg-1: #eef0f5;
  --home-bg-2: #d3d7e0;
  --home-checker: rgba(0, 0, 0, .03);
  --home-frame: rgba(40, 50, 70, .25);
  /* 명예의전당 금판 — 밝은 아이보리 글자 + 진한 갈색 외곽선(금색 배경 위 가독성) */
  --plaque-text: #fff6dc;
  --plaque-sub: #ffe9b8;
  --plaque-emboss:
    0 1px 2px rgba(60, 35, 0, .9), 0 -1px 2px rgba(60, 35, 0, .9),
    1px 0 2px rgba(60, 35, 0, .9), -1px 0 2px rgba(60, 35, 0, .9),
    0 0 8px rgba(60, 35, 0, .6);
  --plaque-emboss-sub:
    0 1px 2px rgba(60, 35, 0, .85), 0 -1px 2px rgba(60, 35, 0, .85),
    1px 0 2px rgba(60, 35, 0, .85), -1px 0 2px rgba(60, 35, 0, .85);
  /* 브랜드/기타 */
  --google-red: #ea4335;
  --google-text: #2b3744;
  --intro-text: #bfe0f2;
  /* 로그인 유리 카드 */
  --login-glass: rgba(20, 28, 40, .58);
  --login-title-1: #f2f6ff;
  --login-title-2: #9db4d6;
  /* 둥글기 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  /* 캔버스(체스판) 팔레트 — app.js의 THEME 로더가 읽어감 */
  --board-light: #e9e2d0;
  --board-dark: #9b7b56;
  /* 계절별 보드 틴트 — 기본 톤에서 은은하게 변주 */
  --board-light-spring: #e4e9cf;
  --board-dark-spring: #8b9058;
  --board-light-summer: #dfe8d2;
  --board-dark-summer: #6f8a55;
  --board-light-autumn: #ecdfc4;
  --board-dark-autumn: #a3714a;
  --board-light-winter: #e2e7ec;
  --board-dark-winter: #7d8b9b;
  --sq-last: rgba(245, 197, 24, .35);
  --sq-check: rgba(204, 51, 68, .5);
  --sq-dim: rgba(15, 22, 30, .82);
  --sq-move: rgba(79, 157, 222, .45);
  --sq-capture: rgba(79, 157, 222, .7);
  --piece-white-fill: #f6f6f4;
  --piece-white-stroke: #2a2a2a;
  --piece-black-fill: #202428;
  --piece-black-stroke: #f0f0f0;
  --ground-ice: rgba(150, 210, 235, .55);
  --ground-ice-line: rgba(255, 255, 255, .7);
  --ice-top: rgba(220, 245, 255, .55);
  --ice-bottom: rgba(120, 175, 210, .45);
  --ice-rim: rgba(210, 235, 250, .7);
  --ice-crack: rgba(255, 255, 255, .55);
  --ice-sheen: rgba(255, 255, 255, .28);
  --tint-rain: rgba(70, 120, 170, .24);
  --tint-snow: rgba(220, 235, 250, .18);
  /* 기후 효과 — 절차적 드로잉용 (rgb 값은 캔버스에서 알파를 조합해 사용) */
  --fog-rgb: 216, 220, 228;
  --particle-rain-rgb: 180, 210, 240;
  --particle-snow-rgb: 255, 255, 255;
  --rain-splash: rgba(190, 215, 245, .55);
  --leaf-1: #cf7a2c;
  --leaf-2: #b0501e;
  --leaf-3: #97742d;
  --leaf-vein: rgba(60, 35, 15, .55);
  --soil-top: #6d543e;
  --soil-bottom: #46342a;
  --rock-light: #93826e;
  --rock-mid: #6e5d4c;
  --rock-dark: #453729;
  --ice-crystal: rgba(205, 240, 255, .95);
  --frozen-tint: rgba(150, 215, 245, .30);
  --frozen-rim: rgba(220, 245, 255, .75);
  --ice-badge-bg: rgba(18, 50, 80, .62);
  --bonus-tint: rgba(240, 185, 60, .26);
  --bonus-rim: rgba(255, 214, 110, .85);
  --bonus-badge-bg: rgba(92, 52, 10, .68);
  --result-draw: #44aa77;
  --result-win: var(--gold);
  --result-loss: var(--danger);
  /* 승리 연출 */
  --win-gold-1: #fff3c4;
  --win-gold-2: #f5c518;
  --win-gold-3: #c9920e;
  --win-glow: rgba(245, 197, 24, .45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow-x: hidden;
  font-family: "맑은 고딕", "Malgun Gothic", system-ui, sans-serif;
  background: linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2));
  color: var(--text);
  overscroll-behavior: none;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }

/* 노치·홈 인디케이터(safe area)를 피해 콘텐츠 배치 — viewport-fit=cover 대응.
   box-sizing: border-box라 패딩이 100dvh 안쪽으로 들어간다. */
.screen {
  min-height: 100dvh; display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* 버튼 */
.btn {
  border: 1px solid transparent; border-radius: var(--radius-md); padding: 12px 18px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--white);
  box-shadow: var(--shadow-sm);
  transition: filter .15s, transform .05s, background .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.btn-ghost {
  background: var(--hover); color: var(--text);
  border-color: var(--border); box-shadow: none;
}
.btn-ghost:hover { background: var(--hover-strong); filter: none; }
.login-btns { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
/* 언어 선택 */
.login-lang {
  position: relative; z-index: 1; margin-top: 14px;
  padding: 8px 16px; font-size: 13px;
  background: var(--login-glass); border: 1px solid var(--border-strong);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.btn-lang { white-space: nowrap; }
.lang-card { max-width: 320px; width: 86%; }
.lang-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.lang-row { width: 100%; }
.lang-cur { outline: 2px solid var(--gold); }
.btn-google {
  background: var(--white); color: var(--google-text); border-color: transparent;
  display: inline-flex; align-items: center; gap: 10px;
}
.g-icon {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--google-red); color: var(--white); font-weight: 800;
}
/* 카카오·네이버 — 각 브랜드 가이드 색상 */
.btn-kakao {
  background: #FEE500; color: rgba(0, 0, 0, .85); border-color: transparent;
  display: inline-flex; align-items: center; gap: 10px;
}
.k-icon {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(0, 0, 0, .85); color: #FEE500; font-weight: 800;
}
.btn-naver {
  background: #03C75A; color: var(--white); border-color: transparent;
  display: inline-flex; align-items: center; gap: 10px;
}
.n-icon {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--white); color: #03C75A; font-weight: 800;
}
/* 애플 — 브랜드 가이드: 검정 배경 + 흰 로고/텍스트 */
.btn-apple {
  background: #000; color: var(--white); border-color: transparent;
  display: inline-flex; align-items: center; gap: 10px;
}
.a-icon {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  font-size: 18px; line-height: 1;
}

/* 로그인 */
#screen-login {
  position: relative; align-items: center; justify-content: center;
  overflow: hidden;
}
.login-bg {
  position: absolute; inset: -24px;
  background: url('/static/img/home_scene.png?v=34') center 32% / cover no-repeat;
  filter: blur(7px) brightness(.5) saturate(.9);
}
.login-card {
  position: relative;
  background: var(--login-glass); padding: 40px 36px; border-radius: var(--radius-lg);
  text-align: center; box-shadow: var(--shadow-lg); border: 1px solid var(--border-strong);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  max-width: 360px; width: 90%;
}
.login-title {
  margin: 4px 0 6px; font-size: 32px; letter-spacing: 2px; font-weight: 800;
  background: linear-gradient(180deg, var(--login-title-1), var(--login-title-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 10px rgba(160, 190, 230, .25));
}
.tagline { color: var(--muted); margin-bottom: 26px; }
#login-note { margin-top: 16px; font-size: 12px; }

/* 상단바 */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: var(--overlay-25); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 18px; }
.user-box {
  display: flex; align-items: center; gap: 8px; font-size: 14px;
  cursor: pointer; flex-shrink: 0;
}
.user-box .user-name { white-space: nowrap; }
.user-box .nick-edit { font-size: 12px; opacity: .6; }
.user-box:hover .nick-edit { opacity: 1; }
.boss-name { font-weight: 700; }
.btn-icon { padding: 10px 14px; font-size: 18px; line-height: 1; }

/* 체스시계 (PvP 피셔 방식) */
.clock {
  position: relative;
  font-family: Consolas, "Courier New", monospace;
  font-size: 17px; font-weight: 800; letter-spacing: .5px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 10px; color: var(--muted);
  min-width: 74px; text-align: center;
}
.clock.ticking { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.clock.urgent {
  color: var(--danger-bright); border-color: var(--danger-bright); background: var(--danger-soft);
  animation: clock-blink 1s step-end infinite;
}
@keyframes clock-blink { 50% { opacity: .45; } }
.inc-pop {
  position: absolute; left: 50%; top: -6px; transform: translateX(-50%);
  color: var(--success-bright); font-size: 13px; font-weight: 800; pointer-events: none;
  animation: inc-rise .9s ease-out forwards;
}
@keyframes inc-rise {
  0% { opacity: 0; top: -2px; }
  25% { opacity: 1; }
  100% { opacity: 0; top: -22px; }
}
.my-name {
  font-weight: 700; font-size: 15px; margin-left: 4px;
  max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 닉네임 모달 */
#nick-input {
  width: 100%; box-sizing: border-box; margin-top: 12px;
  background: var(--card); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 15px; text-align: center;
}
#nick-input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
#nick-msg { min-height: 16px; margin: 8px 0 0; }

/* 공통 — 일러스트 위 메뉴 라벨 타이포 */
.scene-label {
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: clamp(13px, 3vw, 18px);
  white-space: nowrap;
  background: linear-gradient(180deg, var(--win-gold-1) 0%, var(--win-gold-2) 45%, var(--win-gold-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .85)) drop-shadow(0 0 10px var(--win-glow));
}

/* 메인 메뉴 — 일러스트 위 오버레이 버튼 */
.home-body {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  background: #101926;
}
.home-scene {
  position: relative;
  flex: none;
  width: min(100%, 512px, calc((100dvh - 72px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 512 / 954));
  margin: 0 auto;
}
.home-scene-img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
}
.home-nav {
  position: absolute;
  left: 0; right: 0; bottom: 4.5%;
  display: flex;
  justify-content: center;
  gap: 4%;
  padding: 0 5%;
}
.home-nav-btn {
  flex: 1;
  max-width: 150px;
  min-height: 46px;
  padding: 10px 8px;
  border: 1px solid rgba(245, 197, 24, .45);
  border-radius: 999px;
  background: rgba(10, 18, 30, .66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .12);
  touch-action: manipulation;
  /* 버튼 배경이 .scene-label 그라데이션을 덮어 background-clip:text가
     어두운 색을 글자에 입히므로, 버튼은 단색 금색 텍스트로 렌더링 */
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: var(--win-gold-2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
  filter: none;
}
.home-nav-btn:hover {
  background: rgba(10, 18, 30, .82);
  border-color: rgba(245, 197, 24, .7);
  filter: brightness(1.08);
}

/* 명예의전당 — 진입 씬(도서관 일러스트 576x1024) */
.hall-scene {
  position: relative;
  flex: none;
  width: min(100%, 460px, calc((100dvh - 72px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 576 / 1024));
  margin: 0 auto;
}
.hall-scene-img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
}
.hall-nav {
  /* 삼각형 배치 — 위 중앙 '기보', 아래 좌우 '보스'/'플레이어' */
  position: absolute;
  left: 0; right: 0; top: 38%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0 10%;
}
.hall-nav-row {
  display: flex;
  justify-content: center;
  gap: 6%;
  width: 100%;
}
.hall-nav .home-nav-btn { max-width: 160px; }

/* 명예의전당 — 월 카드 그리드 (4x3 + 빈 4) */
.month-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: min(100%, 520px);
  margin: 0 auto;
}
.month-card {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 0.85;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--surface), var(--bg2));
  box-shadow: var(--shadow-sm);
  font-weight: 800;
  font-size: clamp(14px, 3.4vw, 20px);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.month-card:hover {
  border-color: rgba(245, 197, 24, .6);
  filter: brightness(1.12);
}
.month-card.empty {
  opacity: .35;
  cursor: default;
  background: var(--bg2);
  border-style: dashed;
}
.month-card.empty:hover { border-color: var(--border-strong); filter: none; }

/* 대전 화면 — 카드 라벨 (액자 좌표와 동기) */
.play-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.play-card-label {
  position: absolute;
  transform: translate(-50%, -100%);
}
/* 세로형 4액자 그림(576x947) — 라벨은 각 액자 상단 장식 위에 */
.play-card-label[data-card="lessons"] { left: 14.2%; top: 22.6%; }
.play-card-label[data-card="boss"] { left: 37.9%; top: 22.6%; }
.play-card-label[data-card="online"] { left: 61.9%; top: 22.6%; }
.play-card-label[data-card="replays"] { left: 85.6%; top: 22.6%; }

/* 온라인 4계절/일반 선택 (online_scene.png 576x1024) */
.play-card-label[data-card="season"] { left: 32.8%; top: 17.2%; }
.play-card-label[data-card="classic"] { left: 73.8%; top: 18.2%; }

/* 대전 히트 영역 — 액자 3개는 직사각형 SVG로 충분 */
.hit-svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.hit-svg polygon {
  fill: transparent; cursor: pointer;
  outline: none; /* 클릭 포커스 시 바운딩 박스(사각형) 링 방지 */
  -webkit-tap-highlight-color: transparent;
}
.hit-svg polygon:hover { fill: var(--hover-strong); }
/* 키보드 접근(Tab) 표시는 실루엣 채움으로 유지.
   :hover와 분리 — :focus-visible 미지원 브라우저가 셀렉터 리스트 전체를 버리는 것 방지 */
.hit-svg polygon:focus-visible { fill: var(--hover-strong); }

/* 대국 선택 화면 — 일러스트 + 액자 3개 히트 영역 */
.play-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 8px 0 24px;
  background: var(--home-bg);
}
.play-scene {
  position: relative;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}
/* 세로형(576x947) 그림 — 데스크톱에서 화면 높이를 넘지 않게 폭 제한 */
.play-scene-portrait {
  max-width: none;
  width: min(100%, 460px, calc((100dvh - 72px - 32px
    - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 576 / 947));
}
.play-scene-img {
  display: block; width: 100%; height: auto;
  user-select: none; pointer-events: none;
}

/* 랭킹(Top5) 목록 — 승리 오버레이·명예의전당 공용 */
.rank-list {
  background: var(--overlay-45); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 16px; margin-top: 10px;
  min-width: 260px; max-width: 92%; text-align: left;
}
.rank-title { font-weight: 800; text-align: center; margin-bottom: 8px; }
.rank-row {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 4px; font-size: 14px; border-radius: var(--radius-sm);
}
/* 내 기록 행 — 볼드 없이 색으로만 구분(글자 폭이 같아야 열이 맞음) */
.rank-row.me { background: var(--accent-soft); }
.rank-row.me .rank-name { color: var(--accent); }
.rank-no { width: 26px; text-align: center; }
.rank-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 수·날짜 열은 뒤쪽(오른쪽) 기준 정렬 — 행마다 줄이 맞게 */
.rank-moves {
  font-weight: 700; color: var(--gold);
  text-align: right; min-width: 68px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.rank-date {
  font-size: 11px; color: var(--muted);
  text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums;
}

/* 명예의전당 */
#hall-grid { max-width: 560px; margin: 18px auto 0; }
#hall-grid .boss-card.no-record img { filter: grayscale(.8) brightness(.6); }
.hall-detail-body {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 24px 16px 60px;
}
.trophy-wrap {
  position: relative; width: min(440px, 92vw); margin: 4px auto 18px;
}
.trophy-img {
  width: 100%; display: block; border-radius: 16px; box-shadow: var(--shadow-md);
}
.trophy-plate {
  /* 트로피 컵 몸통 중앙(가로 50%, 세로 34%)에 이름을 새긴 듯 오버레이 */
  position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%);
  width: 30%; text-align: center;
}
.trophy-name {
  /* 음각 효과: 어두운 청동색 + 아래쪽 밝은 하이라이트 */
  color: var(--plaque-text); font-weight: 800; font-size: clamp(13px, 4.2vw, 21px);
  text-shadow: var(--plaque-emboss);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trophy-name.me { color: var(--accent); }   /* 내가 1등이면 이름을 강조색으로 */
.trophy-moves {
  color: var(--plaque-sub); font-size: clamp(10px, 2.6vw, 13px); margin-top: 2px;
  text-shadow: var(--plaque-emboss-sub);
}
.hall-detail-body .rank-list { width: 100%; max-width: 460px; background: var(--bg2); }

/* 월간 랭킹 — 계절 ↔ 일반 스와이프 페이저 (기본 계절, 스와이프로 일반) */
.month-pager {
  display: flex; width: 100%; max-width: 520px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;               /* Firefox 스크롤바 숨김 */
}
.month-pager::-webkit-scrollbar { display: none; }
.month-page {
  flex: 0 0 100%; min-width: 0; scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.month-page .col-title { font-weight: 800; font-size: 16px; margin-bottom: 8px; }
.month-page .rank-list { width: 100%; max-width: 460px; background: var(--bg2); }
/* 페이지 인디케이터 — 현재 페이지는 채워진 흰 동그라미 */
.month-dots {
  display: flex; gap: 10px; justify-content: center; margin-top: 14px;
}
.month-dots .dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid #fff; background: transparent;
  cursor: pointer; transition: background .2s;
}
.month-dots .dot.filled { background: #fff; }

/* 저장된 대국(복기) */
.replays-body { padding: 20px 16px 60px; max-width: 560px; margin: 0 auto; width: 100%; }
#replays-msg { min-height: 16px; margin: 8px 0; }
.replay-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 14px; margin: 10px 0;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, border-color .15s, box-shadow .15s;
}
.replay-row:hover {
  transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-md);
}
.replay-badge {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800; color: var(--white);
}
.replay-badge-win { background: var(--result-win); color: var(--google-text); }
.replay-badge-loss { background: var(--result-loss); }
.replay-badge-draw { background: var(--result-draw); }
.replay-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.replay-label { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.replay-meta { font-size: 12px; color: var(--muted); }
/* 자물쇠 — 잠김(금색 채움)과 열림(흐린 고스트)이 한눈에 구분되게 */
.replay-lock { flex: none; padding-left: 8px; padding-right: 8px; opacity: .45; }
.replay-lock.replay-locked {
  opacity: 1;
  background: var(--gold);
  border-color: var(--gold);
  color: var(--google-text, #1a1a1a);
  box-shadow: 0 0 6px rgba(245, 197, 24, .55);
}
.replay-row button[disabled] { opacity: .35; cursor: not-allowed; }

/* 포인트 한도 확장 바 (친구·기보 공용) */
.expand-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.expand-bar:empty { display: none; }
.limit-count { font-weight: 700; font-size: 14px; }

/* 복기 컨트롤 바 */
.replay-bar {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 16px; background: var(--bg2); border-bottom: 1px solid var(--border);
}
.replay-counter { font-weight: 700; font-size: 15px; min-width: 72px; text-align: center; }
.replay-ctrl { font-size: 13px; padding: 7px 12px; min-width: 52px; }
#replay-auto.replay-playing { color: var(--accent); }

/* 친구 */
.friends-body { padding: 20px 16px 60px; max-width: 560px; margin: 0 auto; width: 100%; }
.friends-add { display: flex; gap: 10px; }
.friends-add input {
  flex: 1; background: var(--card); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 10px 12px; font-size: 15px;
}
.friends-add input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
#friends-msg { min-height: 16px; margin: 8px 0; }
.friend-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 14px; margin: 8px 0;
}
.friend-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
/* 극단적으로 긴 닉네임 보험 — 이름만 …으로 줄이고 점·승률·날짜·버튼은 유지 */
.friend-name > span:not(.status-dot):not(.friend-last-seen):not(.friend-rate) {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
/* 아이디 바로 뒤 승률 — 작고 흐리게, 이름과 구분 */
.friend-rate { font-size: 12px; font-weight: 400; color: var(--muted); flex-shrink: 0; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--offline); }
.friend-prog { flex-shrink: 0; font-size: 12px; color: var(--muted); }
/* 도전장 모드 뱃지(4계절/일반) — 별도 span이라 i18n 텍스트 노드 치환이 그대로 먹는다 */
.friend-mode { display: block; font-size: 11px; color: var(--muted); }
.btn-small { padding: 7px 12px; font-size: 13px; }
/* 대전 종료 화면 친구신청 알림 */
.friend-req-toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: 10px; align-items: center;
  background: var(--login-glass); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); padding: 14px 18px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg); max-width: 92vw;
}
.friend-req-toast .frq-text { font-size: 14px; font-weight: 600; text-align: center; }
.friend-req-toast .frq-mode { font-size: 12px; color: var(--muted); margin-top: -6px; }
.friend-req-toast .frq-btns { display: flex; gap: 8px; }
.challenge-row { border-color: var(--accent); background: var(--accent-soft); }
.friend-expire {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  font-size: 11px; border-radius: var(--radius-sm);
  color: var(--muted); border: 1px solid var(--border);
}
.friend-last-seen {
  font-size: 11px; font-weight: 400; color: var(--muted);
  white-space: nowrap; flex-shrink: 0;
}

/* 보스 선택 */
.select-body { padding: 20px 16px 60px; max-width: 980px; margin: 0 auto; width: 100%; }
.select-body h2 { margin: 8px 0 4px; }
.boss-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px;
}
.boss-card {
  position: relative; background: var(--card); border-radius: 14px; overflow: hidden;
  aspect-ratio: 3/4; cursor: pointer; border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: transform .12s, border-color .15s, box-shadow .15s;
}
.boss-card.unlocked:hover {
  transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-md);
}
.boss-card img { width: 100%; height: 100%; object-fit: cover; }
.boss-card .code {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 8px;
  background: linear-gradient(transparent, var(--overlay-78)); color: var(--white);
  font-size: 13px; font-weight: 700; text-align: center;
}
.boss-card.locked {
  cursor: not-allowed; color: var(--muted);
  background: var(--bg); box-shadow: none;
}
.boss-card.locked .lock { font-size: 30px; opacity: .6; }
.boss-card.locked .code { color: var(--muted); background: none; }
.boss-card.cleared { border-color: var(--gold); }
.boss-card.cleared::after {
  content: "✔"; position: absolute; top: 6px; right: 8px; color: var(--gold);
  font-size: 18px; text-shadow: 0 1px 3px var(--black);
}

/* 설정 모달 */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 4px; font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.toggle-btn {
  min-width: 74px; padding: 7px 12px; font-size: 13px; font-weight: 700;
  background: var(--bg2); color: var(--muted);
  border: 1px solid var(--border); box-shadow: none;
}
.toggle-btn.on {
  color: var(--accent); border-color: var(--accent); background: var(--accent-soft);
}
.btn-danger {
  background: var(--danger-soft); color: var(--danger-bright);
  border: 1px solid var(--danger); box-shadow: none;
}
.btn-danger:hover { background: var(--danger); color: var(--white); filter: none; }

/* 모달 */
.modal {
  position: fixed; inset: 0; background: var(--overlay-60);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-card {
  background: var(--card); padding: 28px; border-radius: 18px; text-align: center;
  width: 90%; max-width: 360px; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.color-row { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.color-btn { background: var(--bg2); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.color-btn:hover { background: var(--hover-weak); filter: none; }

/* 게임 */
.game-body { flex: 1; display: flex; gap: 16px; padding: 14px; align-items: flex-start; justify-content: center; }
/* PvP 플레이어 바 — 상단(상대)·하단(나): 턴 동그라미 + 이름 + 승률 + 시계 */
.pvp-bar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pvp-bottom { width: min(100%, 70vh, 640px); width: min(100%, 70svh, 640px); padding: 2px 4px; flex-shrink: 0; }
.pvp-name {
  font-weight: 700; font-size: 15px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pvp-rate { font-size: 13px; color: var(--muted); white-space: nowrap; }
.pvp-conn { font-size: 12px; font-weight: 700; color: var(--danger-bright); white-space: nowrap; }
.pvp-name.disconnected { color: var(--danger-bright); }

/* 보스 진행도 등급 프레임 — bronze(copper)/silver/gold/platinum */
.tier-frame {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  border: 2px solid transparent; line-height: 1.5;
}
.tier-bronze {
  border-color: #b87333;
  background: rgba(184, 115, 51, .12);
  box-shadow: 0 0 6px rgba(184, 115, 51, .35);
}
.tier-silver {
  border-color: #c0c0c8;
  background: rgba(192, 192, 200, .12);
  box-shadow: 0 0 6px rgba(192, 192, 200, .35);
}
.tier-gold {
  border-color: #f5c518;
  background: rgba(245, 197, 24, .12);
  box-shadow: 0 0 8px rgba(245, 197, 24, .45);
}
.tier-platinum {
  border: none; border-radius: 0;
  padding: 7px 22px;
  background: url('/static/img/tier_platinum.png') center / 100% 100% no-repeat;
  filter: drop-shadow(0 0 5px rgba(255, 210, 110, .75));
  animation: platinumShine 2.4s ease-in-out infinite;
}
@keyframes platinumShine {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 210, 110, .55)); }
  50% { filter: drop-shadow(0 0 10px rgba(255, 230, 150, .95)); }
}

/* 대국 중 받은 친구 대전 신청 배지 — 화면 우측 아래, 방해 없이 표시만 */
.challenge-badge {
  position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  padding: 8px 12px; border-radius: 12px;
  background: rgba(20, 24, 34, .85); border: 1px solid var(--border-strong);
  backdrop-filter: blur(6px); pointer-events: none;
}
.challenge-badge .cb-label {
  font-size: 13px; font-weight: 800; color: var(--danger-bright);
  white-space: nowrap;
}
.challenge-badge .cb-name {
  font-size: 12px; color: var(--text); white-space: nowrap;
}
.turn-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  background: var(--offline);
}
.turn-dot.turn-on { background: var(--success); }
.turn-dot.turn-off { background: var(--danger-bright); }
/* PvP 모드: 계절/날씨 패널 숨김, 보드+내 정보 바 세로 배치 */
#screen-game.pvp-mode .game-body { flex-direction: column; align-items: center; gap: 8px; }
#screen-game.pvp-mode .side-panel { display: none; }
#screen-game.pvp-mode #my-name,
#screen-game.pvp-mode #boss-name { display: none; }
#screen-game.pvp-mode #btn-resign { display: none; }
/* 대국 화면 고정 — 페이지 스크롤·주소창 이동으로 체스판이 밀리는 것 방지.
   기후 패널만 내부 스크롤(pan-y) 허용, 나머지 터치는 스크롤을 만들지 않는다. */
#screen-game {
  height: 100dvh; min-height: 0; overflow: hidden; touch-action: none;
}
#screen-game .game-body { min-height: 0; overflow: hidden; }
/* 폭은 컨테이너(100%) 기준 — vw 기반 계산이 패딩과 겹쳐 좌우가 잘리는 것 방지.
   svh(작은 뷰포트 높이)는 주소창 표시 여부와 무관해 크기가 흔들리지 않는다. */
.board-wrap {
  position: relative; flex-shrink: 1; min-width: 0;
  width: min(100%, 70vh, 640px);   /* svh 미지원 구형 브라우저 폴백 */
  width: min(100%, 70svh, 640px);
}
#board { width: 100%; height: auto; display: block; border-radius: var(--radius-sm); touch-action: none; box-shadow: var(--shadow-md); }
.side-panel {
  width: 260px; flex-shrink: 0; background: var(--card); border-radius: 14px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  min-height: 0; overflow-y: auto; touch-action: pan-y;
}
.weather-head { font-size: 18px; font-weight: 700; }
.weather-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.weather-tags .tag { background: var(--bg2); padding: 4px 10px; border-radius: var(--radius-lg); font-size: 12px; border: 1px solid var(--border); }
.forecast {
  min-height: 40px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 1.4;
}
.turn-info { font-size: 14px; color: var(--muted); }

/* 오버레이 */
.center-alert {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: var(--overlay-82); color: var(--white); padding: 18px 28px; border-radius: 14px;
  font-size: 20px; font-weight: 700; text-align: center; white-space: pre-line;
  pointer-events: none; z-index: 20; box-shadow: 0 8px 30px var(--overlay-50);
}
.win-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  background: var(--overlay-55); border-radius: var(--radius-sm); z-index: 30; text-align: center; padding: 20px;
  color: var(--white);
}
.win-overlay { animation: ov-fade .45s ease-out; }
.win-overlay .big {
  font-size: 46px; font-weight: 800;
  animation: ov-pop .55s cubic-bezier(.2, 1.4, .4, 1);
}
.win-overlay .big-win {
  background: linear-gradient(180deg, var(--win-gold-1) 20%, var(--win-gold-2) 55%, var(--win-gold-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 14px var(--win-glow));
}
@keyframes ov-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ov-pop {
  0% { transform: scale(.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.confetti-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 35;
}
.win-overlay .sub { font-size: 18px; white-space: pre-line; }
.win-overlay .hint { font-size: 13px; color: var(--muted); margin-top: 12px; }
.intro-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; z-index: 40;
  background: var(--overlay-intro); border-radius: var(--radius-sm); text-align: center; color: var(--white);
}
.intro-overlay img { width: 62%; max-width: 320px; border-radius: 14px; box-shadow: 0 10px 40px var(--overlay-60); }
.intro-overlay video { max-width: 94%; max-height: 82%; border-radius: 14px; box-shadow: 0 10px 40px var(--overlay-60); }
.intro-overlay .iname { font-size: 22px; font-weight: 800; color: var(--gold); white-space: pre-line; }
.intro-overlay .itop { font-size: 15px; color: var(--intro-text); }

/* 승격 */
.promo-modal {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: var(--card); border-radius: 14px; padding: 14px; z-index: 45;
  display: flex; gap: 8px; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.promo-modal button { font-size: 30px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; width: 56px; height: 56px; cursor: pointer; display: grid; place-items: center; padding: 4px; }
.promo-modal button img { width: 100%; height: 100%; object-fit: contain; }

/* 온라인 대전(PvP) */
.win-overlay .ov-btns { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }

/* 반응형 (모바일 세로) */
@media (max-width: 760px) {
  .game-body { flex-direction: column; align-items: center; padding: 10px; }
  .board-wrap { width: min(100%, 58vh); width: min(100%, 58svh); }
  .pvp-bottom { width: min(100%, 58vh); width: min(100%, 58svh); }
  .side-panel { width: min(100%, 460px); }
  .boss-grid { grid-template-columns: repeat(4, 1fr); gap: 7px; }
  .boss-card .code { font-size: 11px; padding: 4px; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .brand { font-size: 15px; }
  .clock { font-size: 14px; min-width: 60px; padding: 4px 7px; }
  .my-name { max-width: 22vw; }
}
@media (max-width: 480px) {
  .boss-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── 포인트 획득 플로팅 연출 (승리 오버레이 위) ── */
.pts-pop {
  position: absolute; left: 50%; top: 30%;
  display: flex; align-items: baseline; gap: 8px;
  pointer-events: none; z-index: 5; white-space: nowrap;
  animation: pts-float 2.6s ease-out forwards;
}
.pts-pop .pts-amt {
  font-size: 26px; font-weight: 800;
  background: linear-gradient(180deg, var(--win-gold-1) 20%, var(--win-gold-2) 55%, var(--win-gold-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 8px var(--win-glow));
}
.pts-pop .pts-kind {
  font-size: 15px; font-weight: 700; color: var(--white);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}
@keyframes pts-float {
  0% { opacity: 0; transform: translate(-50%, 14px) scale(.7); }
  14% { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
  22% { transform: translate(-50%, 0) scale(1); }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -46px) scale(1); }
}

/* ── 수 판정 배지 (일반 대전) — 착수 칸 위 1.5초 플로팅 후 페이드 ── */
.judge-pop {
  position: absolute; z-index: 30;
  display: flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 14px; font-weight: 800; white-space: nowrap;
  pointer-events: none;
  background: rgba(16, 22, 30, .90);
  border: 1.5px solid var(--border-strong);
  box-shadow: 0 3px 12px rgba(0, 0, 0, .40);
  animation: judge-float 1.5s ease-out forwards;
}
.judge-pop .judge-ico { font-size: 15px; line-height: 1; }
.judge-pop .judge-label { text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.judge-best { border-color: #f5c518; color: #ffe27a; }      /* 금 */
.judge-good { border-color: #3dd168; color: #7fe8a2; }      /* 녹 */
.judge-inacc { border-color: #e8c33b; color: #f2d878; }     /* 노랑 */
.judge-mistake { border-color: #f08c3a; color: #ffb87a; }   /* 주황 */
.judge-blunder { border-color: #e5484d; color: #ff8b8f; }   /* 빨강 */
@keyframes judge-float {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(.6); }
  16% { opacity: 1; transform: translate(-50%, -100%) scale(1.08); }
  26% { transform: translate(-50%, -100%) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(1); }
}
@media (max-width: 700px) {
  .judge-pop { font-size: 12px; padding: 3px 9px; }
  .judge-pop .judge-ico { font-size: 13px; }
}
/* ── 일반 대전 5단계 (순차 해금) ── */
.classic-levels {
  display: flex; flex-direction: column; gap: 8px; margin: 16px 0;
}
.classic-level-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 100%; padding: 11px 14px;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); box-shadow: none;
}
.classic-level-btn:hover { background: var(--hover-weak); filter: none; }
.classic-level-btn.passed { border-color: var(--gold); }
.classic-level-btn.locked {
  color: var(--muted); cursor: not-allowed; opacity: .65;
}
.classic-level-btn.locked:hover { background: var(--bg2); }
.classic-level-btn .cl-lock-note {
  font-size: 11px; font-weight: 400; color: var(--muted);
}

/* ── 체스 교실 (레슨 목록·플레이어) ── */
.lessons-body {
  flex: 1; padding: 16px 16px 60px;
  max-width: 560px; margin: 0 auto; width: 100%; box-sizing: border-box;
}
.lesson-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 14px; margin: 10px 0;
  box-shadow: var(--shadow-sm); cursor: pointer;
  color: var(--text); font: inherit; text-align: left;
  transition: transform .12s, border-color .15s, box-shadow .15s;
}
.lesson-row:hover {
  transform: translateY(-2px); border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.lesson-row.done { border-color: rgba(245, 197, 24, .45); }
.lesson-badge { flex: none; font-size: 15px; }
.lesson-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lesson-title {
  font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lesson-sub {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lesson-check { flex: none; width: 22px; text-align: center; }

/* 레슨 플레이어 */
.lp-head { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 10px; }
.lp-title { flex: 1; min-width: 0; font-weight: 800; font-size: 15px; }
.lp-level { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; }
.lp-step {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: 10px;
}
.lp-step-num {
  font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--accent);
  margin-bottom: 4px;
}
.lp-step-text { font-size: 14px; line-height: 1.5; min-height: 42px; }
.lp-step-text.todo { color: var(--text); font-weight: 600; }
.lp-step-text.ok { color: var(--success-bright, #6fdc8c); }
.lp-step-text.ai, .lp-step-text.ai-wait { color: var(--muted); }
.lp-step-text.done { color: var(--gold); font-weight: 800; font-size: 16px; }
.lp-board-wrap {
  position: relative; width: min(100%, 58vh, 460px);
  margin: 0 auto;
}
#lesson-board {
  display: block; width: 100%; height: auto; aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  touch-action: manipulation;
}
.lp-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--overlay-60); color: var(--white);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  padding: 12px 18px; font-size: 14px; font-weight: 700; text-align: center;
  pointer-events: none; z-index: 5; max-width: 86%;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: ov-fade .25s ease-out;
}
.lp-controls {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  margin: 12px 0;
}
.lp-desc-title {
  font-size: 12px; font-weight: 800; color: var(--muted); margin: 14px 0 6px;
}
.lp-desc {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 14px;
  font-size: 13px; line-height: 1.6; color: var(--text);
  white-space: pre-line; max-height: 240px; overflow-y: auto;
}

/* ── 내 스탯 (명예의 전당) ───────────────────────────── */
.mystats-body {
  padding: 20px 16px 60px; max-width: 800px; margin: 0 auto; width: 100%;
  box-sizing: border-box;
}
.mystats-inner {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  width: min(100%, 760px); margin: 0 auto;
}
/* 프로필·플레이 스타일은 한 줄 전체, 친구/온라인은 데스크톱 2열 */
.mystats-inner > .ms-profile, .mystats-inner > .ms-style { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .mystats-inner { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.ms-in { animation: ms-in .4s ease-out both; }
@keyframes ms-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.ms-skel {
  animation: ms-skel 1.2s ease-in-out infinite;
  background: var(--card);
}
@keyframes ms-skel { 0%, 100% { opacity: .55; } 50% { opacity: .95; } }
.ms-error { grid-column: 1 / -1; text-align: center; padding: 32px 18px; }
.ms-error p { margin: 0 0 14px; color: var(--muted); }
.ms-title { margin: 0 0 12px; font-size: 16px; }
.ms-note { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.ms-empty { margin: 8px 0; color: var(--muted); font-size: 14px; text-align: center; }
.ms-win { color: var(--result-win); }
.ms-draw { color: var(--result-draw); }
.ms-loss { color: var(--result-loss); }

/* 프로필 요약 */
.ms-profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ms-avatar {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border-strong, var(--border)); flex: none;
}
.ms-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: 22px; font-weight: 800;
}
.ms-profile-name { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ms-nick { font-size: 17px; font-weight: 800; align-self: flex-start; }
.ms-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* 등급 이름 배지 — 브론즈~플래티넘은 tier-frame/tier-* 색 프레임을 그대로 쓰고,
   노멀(테두리 클래스 없음)만 회색 기본 프레임을 입힌다 */
.ms-tier {
  display: inline-block; font-size: 12px; font-weight: 800;
  color: var(--text); line-height: 1.5;
}
.ms-tier:not(.tier-frame) {
  padding: 1px 8px; border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .22);
}
.ms-joined { font-size: 12px; color: var(--muted); }
.ms-profile-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
@media (max-width: 480px) { .ms-profile-grid { grid-template-columns: repeat(2, 1fr); } }
.ms-pitem {
  background: rgba(255, 255, 255, .04); border-radius: 10px;
  padding: 10px 8px; text-align: center;
}
.ms-plabel { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.ms-pnum { font-size: 18px; font-weight: 800; }

/* 플레이 스타일 오각형 차트 */
.ms-radar-wrap { position: relative; width: min(100%, 380px); margin: 0 auto; }
.ms-radar { display: block; width: 100%; height: auto; }
.ms-grid { fill: none; stroke: rgba(255, 255, 255, .10); stroke-width: 1; }
.ms-axis { stroke: rgba(255, 255, 255, .14); stroke-width: 1; }
.ms-data {
  fill: rgba(79, 157, 222, .28); stroke: var(--accent); stroke-width: 2;
  stroke-linejoin: round;
}
.ms-dot { fill: var(--accent); stroke: #fff; stroke-width: 1; }
.ms-hit { fill: transparent; cursor: pointer; }
.ms-axis-name { fill: var(--text); font-size: 12px; font-weight: 700; }
.ms-axis-score { fill: var(--gold); font-size: 12px; font-weight: 800; }
.ms-tip {
  position: absolute; transform: translate(-50%, -100%);
  background: rgba(10, 18, 30, .92); border: 1px solid var(--border-strong, var(--border));
  border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 700;
  white-space: nowrap; pointer-events: none; z-index: 5;
}

/* 모드별 전적 카드 (친구/온라인 공용) */
.ms-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .ms-mode-grid { grid-template-columns: 1fr; } }
.ms-mode-card {
  background: rgba(255, 255, 255, .04); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px;
}
.ms-mode-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 800; margin-bottom: 10px;
}
.ms-mode-ico { font-size: 16px; }
.ms-mode-body { display: flex; align-items: center; gap: 14px; }
.ms-ring { width: 76px; height: 76px; flex: none; }
.ms-ring-bg { fill: none; stroke: rgba(255, 255, 255, .10); stroke-width: 6; }
.ms-ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 32px 32px;
  transition: stroke-dashoffset .6s ease-out;
}
.ms-ring-num { fill: var(--text); font-size: 12px; font-weight: 800; }
.ms-ring-sub { fill: var(--muted); font-size: 8px; }
.ms-mode-rows { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ms-mode-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 6px; font-size: 13px; color: var(--muted);
}
.ms-mode-row span { white-space: nowrap; }
.ms-mode-row b { font-size: 15px; color: var(--text); }
.ms-mode-row b.ms-win { color: var(--result-win); }
.ms-mode-row b.ms-draw { color: var(--result-draw); }
.ms-mode-row b.ms-loss { color: var(--result-loss); }
