/* ══════════════════════════════════════════════════════
   기억기억 — shadcn/ui Redesign
   Design System: Dark, sharp, glass-morphism, crisp typography
   ══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500;700&family=Geist:wght@300;400;500;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── 토큰 시스템 (shadcn/ui 기반) ── */
:root {
  /* 배경 계층 */
  --bg:      #f8f8f8;
  --bg2:     #efefef;
  --bg3:     #e8e8e8;
  --bg4:     #e0e0e0;

  /* 보더 */
  --bdr:     hsl(0 0% 82%);
  --bdr2:    hsl(0 0% 76%);
  --bdr3:    hsl(0 0% 70%);

  /* 텍스트 */
  --txt:     #121212;
  --txt2:    hsl(0 0% 28%);
  --dim:     hsl(0 0% 48%);
  --dim2:    hsl(0 0% 68%);

  /* 액센트 — 라임 그린 (기존 정체성 유지) */
  --acc:     #121212;
  --acc-fg:  #f8f8f8;
  --acc2:    rgba(18,18,18,0.07);
  --acc3:    rgba(18,18,18,0.12);

  /* 상태 색상 */
  --red:     hsl(0 75% 60%);
  --red2:    hsla(0, 75%, 60%, 0.1);
  --green:   hsl(142, 79%, 47%);
  --green2:  hsla(142, 70%, 55%, 0.1);
  --relay:   #121212;
  --relay2:  rgba(18,18,18,0.07);

  /* 티어 색상 */
  --gold:    hsl(45 100% 55%);
  --silv:    hsl(220 20% 72%);
  --brnz:    hsl(30 52% 50%);

  /* 반경 */
  --r-sm:    4px;
  --r-md:    8px;
  --r-lg:    12px;
  --r-xl:    16px;

  /* 그림자 */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.07);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.15), 0 4px 16px rgba(0,0,0,0.10);
  --shadow-acc: 0 0 0 3px rgba(18,18,18,0.2);

  /* 폰트 */
  --font-base: 'Geist', 'Noto Sans KR', sans-serif;
  --font-mono: 'Geist Mono', 'Space Mono', monospace;
}

html, body {
  height: 100%;
  background: #ffffff;
  color: var(--txt);
  font-family: var(--font-base);
  font-size: 15px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 움직이는 파스텔 그라데이션 배경 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 72% 62% at 11% 20%, rgba(255,178,212,0.56) 0%, transparent 65%),
    radial-gradient(ellipse 68% 72% at 30% 58%, rgba(190,168,245,0.50) 0%, transparent 62%),
    radial-gradient(ellipse 72% 68% at 62% 40%, rgba(144,222,228,0.44) 0%, transparent 64%),
    radial-gradient(ellipse 66% 72% at 86% 34%, rgba(206,244,172,0.44) 0%, transparent 62%),
    radial-gradient(ellipse 62% 66% at 96% 76%, rgba(228,248,156,0.40) 0%, transparent 56%),
    #ffffff;
  animation: gradientDrift 18s ease-in-out infinite alternate;
}

@keyframes gradientDrift {
  0% {
    background:
      radial-gradient(ellipse 72% 62% at 11% 20%, rgba(255,178,212,0.56) 0%, transparent 65%),
      radial-gradient(ellipse 68% 72% at 30% 58%, rgba(190,168,245,0.50) 0%, transparent 62%),
      radial-gradient(ellipse 72% 68% at 62% 40%, rgba(144,222,228,0.44) 0%, transparent 64%),
      radial-gradient(ellipse 66% 72% at 86% 34%, rgba(206,244,172,0.44) 0%, transparent 62%),
      radial-gradient(ellipse 62% 66% at 96% 76%, rgba(228,248,156,0.40) 0%, transparent 56%),
      #ffffff;
  }
  25% {
    background:
      radial-gradient(ellipse 68% 74% at 22% 38%, rgba(255,178,212,0.50) 0%, transparent 65%),
      radial-gradient(ellipse 72% 66% at 18% 72%, rgba(190,168,245,0.46) 0%, transparent 62%),
      radial-gradient(ellipse 66% 72% at 74% 28%, rgba(144,222,228,0.48) 0%, transparent 64%),
      radial-gradient(ellipse 70% 68% at 92% 52%, rgba(206,244,172,0.42) 0%, transparent 62%),
      radial-gradient(ellipse 66% 62% at 84% 88%, rgba(255,210,160,0.38) 0%, transparent 56%),
      #ffffff;
  }
  50% {
    background:
      radial-gradient(ellipse 74% 66% at 8%  54%, rgba(200,170,255,0.52) 0%, transparent 65%),
      radial-gradient(ellipse 66% 74% at 44% 42%, rgba(255,200,220,0.46) 0%, transparent 62%),
      radial-gradient(ellipse 70% 66% at 68% 62%, rgba(160,230,210,0.44) 0%, transparent 64%),
      radial-gradient(ellipse 68% 70% at 80% 22%, rgba(220,248,160,0.42) 0%, transparent 62%),
      radial-gradient(ellipse 64% 68% at 90% 60%, rgba(144,222,228,0.40) 0%, transparent 56%),
      #ffffff;
  }
  75% {
    background:
      radial-gradient(ellipse 70% 60% at 18% 28%, rgba(255,190,180,0.52) 0%, transparent 65%),
      radial-gradient(ellipse 74% 68% at 36% 66%, rgba(180,160,255,0.48) 0%, transparent 62%),
      radial-gradient(ellipse 68% 70% at 56% 48%, rgba(150,230,220,0.44) 0%, transparent 64%),
      radial-gradient(ellipse 64% 74% at 78% 38%, rgba(210,248,168,0.42) 0%, transparent 62%),
      radial-gradient(ellipse 68% 64% at 94% 82%, rgba(255,220,140,0.38) 0%, transparent 56%),
      #ffffff;
  }
  100% {
    background:
      radial-gradient(ellipse 66% 70% at 14% 44%, rgba(255,178,212,0.48) 0%, transparent 65%),
      radial-gradient(ellipse 70% 62% at 26% 50%, rgba(190,168,245,0.52) 0%, transparent 62%),
      radial-gradient(ellipse 74% 66% at 70% 36%, rgba(144,222,228,0.46) 0%, transparent 64%),
      radial-gradient(ellipse 62% 68% at 88% 26%, rgba(206,244,172,0.44) 0%, transparent 62%),
      radial-gradient(ellipse 60% 70% at 98% 68%, rgba(228,248,156,0.40) 0%, transparent 56%),
      #ffffff;
  }
}


/* ── 스크롤바 ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bdr2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--bdr3); }

/* ══════════════════════════════════════════
   스크린 / 레이아웃
   ══════════════════════════════════════════ */
.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.on { display: flex; animation: screenIn .25s cubic-bezier(.4,0,.2,1); }
#s-lobby.on, #s-login.on { animation: none; }

/* 로비 화면 110% 스케일, 스크롤 방지 */
#s-lobby { zoom: 1.1; overflow: hidden; height: 100vh; }
@-moz-document url-prefix() {
  #s-lobby { zoom: 1; transform: scale(1.1); transform-origin: top left; width: calc(100% / 1.1); overflow: hidden; height: 100vh; }
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════
   로그인 화면
   ══════════════════════════════════════════ */
#s-login {
  align-items: center;
  justify-content: center;
  background: transparent;
  position: relative;
  overflow: hidden;
}
#s-login::before {
  display: none;
}

.logo {
  text-align: center;
  margin-bottom: 48px;
  position: relative;
}
.logo-title {
  font-family: var(--font-base);
  font-size: 56px;
  font-weight: 900;
  letter-spacing: -3px;
  line-height: 1;
}
.logo-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--dim);
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-top: 12px;
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
#s-login .logo { animation: loginFadeIn .6s cubic-bezier(.4,0,.2,1) both; }
#s-login .btn-acc { animation: loginFadeIn .6s cubic-bezier(.4,0,.2,1) .15s both; }
#s-login > div > div > div:last-child { animation: loginFadeIn .6s cubic-bezier(.4,0,.2,1) .3s both; }

/* ══════════════════════════════════════════
   공통 컴포넌트 — shadcn 스타일
   ══════════════════════════════════════════ */

/* 버튼 베이스 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s cubic-bezier(.4,0,.2,1);
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-acc);
}
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn:active { transform: translateY(1px); }

/* Primary */
.btn-acc {
  background: var(--acc);
  border-color: var(--acc);
  color: var(--acc-fg);
  font-weight: 600;
}
.btn-acc:hover {
  background: #2a2a2a;
  border-color: #d8d8d8;
  box-shadow: 0 0 20px rgba(18,18,18,0.12);
}

/* 방 만들기 버튼 */
.btn-create {
  background: var(--acc);
  border-color: transparent;
  color: var(--acc-fg);
  font-weight: 600;
  box-shadow: 0 0 20px rgba(18,18,18,0.10);
}
.btn-create:hover {
  background: transparent;
  border-color: var(--acc);
  color: var(--acc);
  box-shadow: 0 0 28px rgba(18,18,18,0.08);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  border-color: var(--bdr2);
  color: var(--txt2);
}
.btn-ghost:hover {
  background: var(--bg3);
  border-color: var(--bdr3);
  color: var(--txt);
}

/* Destructive */
.btn-red {
  background: transparent;
  border-color: hsl(0 40% 30%);
  color: var(--red);
}
.btn-red:hover {
  background: var(--red2);
  border-color: var(--red);
}

/* 입력 필드 */
.field {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-md);
  color: var(--txt);
  font-family: var(--font-base);
  font-size: 15px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field:focus {
  border-color: hsl(0 0% 45%);
  box-shadow: 0 0 0 3px hsla(0,0%,50%,0.1);
}
.field:focus.acc-focus { border-color: var(--acc); box-shadow: var(--shadow-acc); }
.field::placeholder { color: var(--dim2); }

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--dim);
  margin-bottom: 8px;
  text-transform: uppercase;
}

/* 에러 메시지 */
.err {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
  min-height: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.divider {
  border: none;
  border-top: 1px solid var(--bdr);
  margin: 20px 0;
}

/* 배지 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border: 1px solid;
}
.badge-acc   { color: var(--acc);   border-color: var(--acc);   background: var(--acc2); }
.badge-red   { color: var(--red);   border-color: var(--red);   background: var(--red2); }
.badge-relay { color: var(--relay); border-color: var(--relay); background: var(--relay2); }
.badge-dim   { color: var(--dim);   border-color: var(--bdr2);  background: var(--bg3); }

/* 카드 */
.card {
  background: var(--bg2);
  border: 1px solid var(--bdr);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--bdr); }
.card-body   { padding: 16px 20px; }

/* ══════════════════════════════════════════
   사이드바 (상단 수평 네비)
   ══════════════════════════════════════════ */
.lobby-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

.left-sidebar {
  width: 100%;
  height: 52px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.07);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  gap: 2px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 175;
}

.sidebar-btn {
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  position: relative;
}
.sidebar-btn:hover {
  color: var(--txt);
  background: var(--bg3);
  border-color: var(--bdr2);
}
.sidebar-btn.active {
  color: var(--acc);
  background: var(--acc2);
  border-color: rgba(18,18,18,0.10);
}
.sidebar-btn.active.orange { color: var(--relay); background: var(--relay2); border-color: rgba(18,18,18,0.10); }

/* ── 사이드바 PNG 아이콘 컬러 필터 ── */
.sidebar-btn img {
  opacity: 0.45;
  transition: opacity .15s, filter .15s;
  pointer-events: none;
}
.sidebar-btn:hover img {
  opacity: 0.85;
}
.sidebar-btn.active img {
  opacity: 1;
  filter: brightness(0) invert(1);
}
.sidebar-btn.active.orange img {
  opacity: 1;
  filter: brightness(0) saturate(100%) invert(72%) sepia(60%) saturate(600%) hue-rotate(340deg) brightness(105%);
}

.sidebar-notif {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  background: var(--red);
  border-radius: 50%;
  border: 1px solid var(--bg);
}

.sb-tooltip {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px);
  background: var(--bg4);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-sm);
  color: var(--txt);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  white-space: nowrap;
  padding: 5px 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s, transform .15s;
  z-index: 9999;
  text-transform: uppercase;
  box-shadow: var(--shadow-md);
}
.sidebar-btn:hover .sb-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════════════
   로비 슬라이더
   ══════════════════════════════════════════ */
.lobby-slider-outer {
  flex: 1;
  overflow: hidden;
  margin-top: 52px;
}
.lobby-slider {
  display: flex;
  width: 200%;
  transition: transform .38s cubic-bezier(.4,0,.2,1);
}
.lobby-slide {
  width: 50%;
  height: calc(100vh / 1.1);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 24px;
  position: relative;
}
.lobby-main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0;
}
.lobby-box { width: 100%; max-width: 420px; }

/* 레트로 그리드 배경 — 소프트 그라데이션 배경으로 교체됨 */
.lobby-retro-grid { display: none; }
.lobby-retro-grid-inner { display: none; }
.lobby-retro-grid-glow { display: none; }
.lobby-retro-grid-fade { display: none; }

/* 로비 컨텐츠 z-index */
.lobby-main { position: relative; z-index: 1; }

/* 인게임 레트로 그리드 배경 — 소프트 그라데이션 배경으로 교체됨 */
.game-retro-grid { display: none; }
.game-retro-grid-inner { display: none; }
.game-retro-grid-fade { display: none; }
.game-hdr,
.bar-wrap,
.game-body,
#btn-game-leave { position: relative; z-index: 1; }

/* 유저 정보 카드 */
#user-stats { visibility: hidden; margin-bottom: 20px; }

/* 아바타/프로필 영역 */
#avatar-wrap {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
#avatar-img {
  width: 52px;
  height: 52px;
  border: 1px solid var(--bdr2);
  border-radius: var(--r-md);
  overflow: visible;
  background: var(--bg3);
  position: relative;
}
#avatar-img img {
  border-radius: calc(var(--r-md) - 2px);
}

/* 버튼 행 */
.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

/* 참가 패널 */
.join-panel { margin-top: 20px; display: none; }
.join-panel.on { display: block; }
.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

/* ══════════════════════════════════════════
   슬라이딩 패널 (공통)
   ══════════════════════════════════════════ */
.panel-base {
  position: fixed;
  top: 52px;
  height: calc(100vh - 52px);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  z-index: 150;
  pointer-events: none;
}
.panel-base.on { pointer-events: auto; }

/* 왼쪽 패널 */
.left-panel {
  position: fixed;
  top: 52px;
  left: 0;
  width: 360px;
  height: calc(100vh - 52px);
  background: var(--bg2);
  border-right: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  z-index: 150;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.left-panel.on { transform: translateX(0); pointer-events: auto; }

/* 오른쪽 패널 */
.right-panel {
  position: fixed;
  top: 52px;
  right: 0;
  width: 360px;
  height: calc(100vh - 52px);
  background: var(--bg2);
  border-left: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  z-index: 150;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.right-panel.on { transform: translateX(0); pointer-events: auto; }

/* 상점 패널 */
.shop-panel {
  position: fixed;
  top: 52px;
  right: 0;
  width: 360px;
  height: calc(100vh - 52px);
  background: var(--bg2);
  border-left: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  z-index: 150;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.shop-panel.on { transform: translateX(0); pointer-events: auto; }

/* 미션 패널 */
.mission-panel {
  position: fixed;
  top: 52px;
  left: 0;
  width: 360px;
  height: calc(100vh - 52px);
  background: var(--bg2);
  border-right: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  z-index: 150;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.mission-panel.on { transform: translateX(0); pointer-events: auto; }

/* 패널 헤더 */
.shop-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
  background: var(--bg2);
}
.panel-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 패널 탭 */
.shop-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
  background: var(--bg);
}
.shop-panel-tab {
  flex: 1;
  padding: 10px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--dim);
  cursor: pointer;
  transition: color .15s, border-color .15s;
  font-family: var(--font-base);
}
.shop-panel-tab.active {
  border-bottom-color: var(--acc);
  color: var(--acc);
}
.shop-panel-tab:hover:not(.active) { color: var(--txt2); }

.shop-panel-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.shop-panel-balance { font-size: 12px; color: var(--dim); text-align: right; margin-bottom: 12px; }

/* 닫기 버튼 */
.modal-close {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.modal-close:hover {
  background: var(--bg3);
  border-color: var(--bdr2);
  color: var(--txt);
}

/* ══════════════════════════════════════════
   방 대기 화면
   ══════════════════════════════════════════ */
#s-room { padding: 0; }

.room-hdr {
  height: 56px;
  border-bottom: 1px solid var(--bdr);
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: hsla(0,0%,97%,0.9);
  backdrop-filter: blur(8px);
}

.room-code-row { display: flex; align-items: center; gap: 12px; }
.code-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
}
.room-code {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--acc);
  letter-spacing: 5px;
}

.room-name-center { display: flex; align-items: center; gap: 7px; justify-content: center; }
.room-name-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--txt);
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-name-edit-btn {
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 3px;
  border-radius: var(--r-sm);
  transition: color .15s;
}
.room-name-edit-btn:hover { color: var(--acc); }
.room-name-input {
  background: var(--bg3);
  border: 1px solid var(--acc);
  border-radius: var(--r-sm);
  color: var(--txt);
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 10px;
  outline: none;
  width: 150px;
  text-align: center;
}

.room-body {
  display: grid;
  grid-template-columns: 7fr 3fr;
  flex: 1;
  height: calc(100vh - 56px);
}
.room-settings {
  border-right: 1px solid var(--bdr);
  padding: 20px 24px;
  overflow-y: auto;
}
.room-players { padding: 20px; display: flex; flex-direction: column; }

.sec-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-blk {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--bdr);
}
.setting-blk:last-child { border-bottom: none; margin-bottom: 0; }

.setting-lbl {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--txt2);
}

.opts { display: flex; gap: 6px; flex-wrap: wrap; }
.opt {
  padding: 7px 14px;
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: var(--r-sm);
  color: var(--dim);
  font-family: var(--font-base);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.opt:hover:not(.on):not(.relay-on) {
  border-color: var(--bdr3);
  color: var(--txt2);
  background: var(--bg4);
}
.opt.on {
  background: var(--acc2);
  border-color: rgba(18,18,18,0.22);
  color: var(--acc);
  font-weight: 600;
}
.opt.relay-on {
  background: var(--relay2);
  border-color: rgba(18,18,18,0.20);
  color: var(--relay);
  font-weight: 600;
}
.opt.mode-catchcard.on, .opt.mode-catchcard.relay-on {
  background: var(--relay2);
  border-color: rgba(18,18,18,0.20);
  color: var(--relay);
}

.num-ctrl { display: flex; align-items: center; gap: 10px; }
.num-btn {
  width: 30px;
  height: 30px;
  background: var(--bg3);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-sm);
  color: var(--txt2);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  font-family: var(--font-mono);
}
.num-btn:hover { border-color: var(--bdr3); color: var(--txt); background: var(--bg4); }
.num-val {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  min-width: 30px;
  text-align: center;
}

.player-list { flex: 1; overflow-y: auto; }
.p-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bdr);
}
.p-avatar {
  width: 34px;
  height: 34px;
  background: var(--bg3);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--acc);
  flex-shrink: 0;
  overflow: hidden;
}
.p-name { font-weight: 500; font-size: 14px; flex: 1; }
.p-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid var(--acc);
  color: var(--acc);
  border-radius: var(--r-sm);
  background: var(--acc2);
}
.p-slot {
  padding: 10px 0;
  border-bottom: 1px solid var(--bdr);
  color: var(--dim2);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.room-foot { padding-top: 14px; margin-top: auto; }
.wait-msg { text-align: center; color: var(--dim); font-size: 13px; padding: 12px; line-height: 1.6; }
.readonly .opt { cursor: default; pointer-events: none; }
.readonly .num-btn { cursor: default; pointer-events: none; opacity: .4; }

/* 모드 배너 */
.mode-banner {
  display: flex;
  gap: 10px;
  align-items: center;
  border: none;
  border-left: 2px solid;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 12px;
  line-height: 1.5;
  padding: 10px 14px;
  margin-bottom: 16px;
}
.mode-banner.green {
  background: linear-gradient(to right, var(--acc2), transparent);
  border-color: var(--acc);
  color: var(--acc);
}
.mode-banner.orange {
  background: linear-gradient(to right, var(--relay2), transparent);
  border-color: var(--relay);
  color: var(--relay);
}
.mode-banner.red {
  background: linear-gradient(to right, var(--relay2), transparent);
  border-color: var(--relay);
  color: var(--relay);
}

/* 암기 서브 옵션 */
.memorize-sub-opts {
  margin-top: 8px;
  padding: 0 12px;
  border: 1px solid var(--bdr2);
  border-left: 2px solid var(--acc);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--acc2);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .3s cubic-bezier(.4,0,.2,1), opacity .25s, padding .3s;
  padding-top: 0;
  padding-bottom: 0;
}
.memorize-sub-opts.visible {
  max-height: 120px;
  opacity: 1;
  padding: 10px 12px;
}
.memorize-sub-opts.relay-color { border-left-color: var(--relay); background: var(--relay2); }
.sub-opts-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--acc);
  margin-bottom: 8px;
  transition: color .2s;
}
.memorize-sub-opts.relay-color .sub-opts-label { color: var(--relay); }
.opt.sub-opt { padding: 6px 12px; font-size: 12px; }

/* ══════════════════════════════════════════
   게임 화면
   ══════════════════════════════════════════ */
#s-game {
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  background: var(--bg);
}

.game-hdr {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0 24px;
  height: 64px;
  border-bottom: 1px solid var(--bdr);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: hsla(0,0%,97%,0.9);
  backdrop-filter: blur(8px);
}

.round-ind {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 2px;
}
.round-ind strong { color: var(--txt); font-size: 15px; }

.timer {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 700;
  color: var(--txt);
  min-width: 60px;
  text-align: center;
  line-height: 1;
}
.timer.hot { color: var(--red); animation: blink .5s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.35} }

.mode-lbl {
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: right;
}

.bar-wrap {
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--bdr);
}
.bar {
  height: 100%;
  background: var(--acc);
  transition: width 1s linear;
  border-radius: 1px;
}
.bar.relay-bar { background: var(--relay); }

.game-body {
  max-width: 720px;
  width: 100%;
  text-align: center;
  margin-top: 88px;
}

.phase { display: none; flex-direction: column; align-items: center; width: 100%; }
.phase.on { display: flex; animation: fadeUp .4s cubic-bezier(.4,0,.2,1); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ph-lbl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 암기 단계 */
.words-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 4px 0 20px;
  align-items: stretch;
}
.word-chip {
  padding: 14px 12px;
  background: var(--bg2);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-md);
  font-size: 20px;
  font-weight: 700;
  color: var(--txt);
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 56px;
  word-break: keep-all;
  line-height: 1.2;
  overflow: hidden;
}
.word-chip.used { opacity: .3; text-decoration: line-through; }
.sentence-box {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.8;
  color: var(--txt);
  padding: 28px 36px;
  background: var(--bg2);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-lg);
  margin: 4px 0 20px;
}
.memo-note { font-size: 13px; color: var(--dim); line-height: 1.7; }

/* 타이핑 단계 */
.type-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-md);
  color: var(--txt);
  font-family: var(--font-base);
  font-size: 20px;
  padding: 18px 20px;
  outline: none;
  text-align: center;
  transition: border-color .15s, box-shadow .15s;
  resize: none;
}
.type-input:focus { border-color: var(--acc); box-shadow: var(--shadow-acc); }
.type-input.shk { animation: shakeX .28s ease; }
@keyframes shakeX {
  0%,100%{transform:translateX(0)}
  20%,60%{transform:translateX(-6px)}
  40%,80%{transform:translateX(6px)}
}

.word-submit-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  margin-top: 14px;
  min-height: 34px;
}
.wsub-chip {
  padding: 7px 14px;
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--txt);
}
.wsub-chip.correct { border-color: var(--green); color: var(--green); background: var(--green2); }
.wsub-chip.wrong   { border-color: var(--red); color: var(--red); background: var(--red2); }

.type-hint { font-size: 13px; color: var(--dim); margin-bottom: 14px; line-height: 1.7; }
.sub-row { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.sub-status { font-size: 14px; color: var(--dim); flex: 1; text-align: left; }
.sub-ok { color: var(--acc); }

/* 제출 상태 표시 */
.sub-indicators {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
}
.sub-ind {
  padding: 5px 12px;
  background: var(--bg2);
  border: 1px solid var(--bdr);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 5px;
}
.sub-ind.done { border-color: var(--acc); color: var(--acc); background: var(--acc2); }

/* 실시간 점수 */
.rt-score { font-family: var(--font-mono); font-size: 48px; font-weight: 700; color: var(--acc); line-height: 1; }
.rt-score-lbl { font-size: 11px; color: var(--dim); margin-bottom: 18px; margin-top: 4px; }

/* 점수 팝업 */
.score-pop {
  position: fixed;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
  animation: scoreFloat 1.2s ease forwards;
}
@keyframes scoreFloat {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-36px); }
}

@keyframes timerIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.timer.in { animation: timerIn .3s ease forwards; }

/* ══════════════════════════════════════════
   릴레이 / 덧붙임 모드
   ══════════════════════════════════════════ */
.relay-arena { width: 100%; max-width: 620px; margin: 0 auto; }

.relay-turn-banner {
  padding: 14px 24px;
  margin-bottom: 20px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-align: center;
  border: 1px solid var(--bdr2);
  border-radius: var(--r-md);
  background: var(--bg2);
  transition: all .25s;
}
.relay-turn-banner.my-turn {
  border-color: rgba(18,18,18,0.22);
  background: var(--relay2);
  color: var(--relay);
  animation: pulseBorder .8s ease infinite alternate;
}
@keyframes pulseBorder {
  from { box-shadow: 0 0 0 0 rgba(255,149,0,0); }
  to   { box-shadow: 0 0 0 4px rgba(255,149,0,0.15); }
}
.relay-turn-banner.wait-turn { color: var(--dim); border-color: var(--bdr); }

.relay-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  min-height: 42px;
  margin-bottom: 18px;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--bdr);
  border-radius: var(--r-md);
}
.relay-chain-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
}
.chain-word {
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--bdr2);
  border-radius: var(--r-sm);
  background: var(--bg3);
  color: var(--txt);
  display: flex;
  align-items: center;
  gap: 5px;
}
.chain-word .chain-who { font-size: 10px; color: var(--dim); }
.chain-word.latest {
  border-color: rgba(18,18,18,0.22);
  color: var(--relay);
  background: var(--relay2);
}
.chain-arrow { color: var(--dim2); font-size: 16px; line-height: 1; align-self: center; }

.relay-inp-wrap { position: relative; }
.relay-inp {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-md);
  color: var(--txt);
  font-family: var(--font-base);
  font-size: 24px;
  padding: 18px 20px;
  outline: none;
  text-align: center;
  transition: border-color .15s, box-shadow .15s;
  font-weight: 700;
}
.relay-inp:focus { border-color: var(--relay); box-shadow: 0 0 0 3px var(--relay2); }
.relay-inp.shk { animation: shakeX .28s ease; border-color: var(--red); }
.relay-inp:disabled { opacity: .35; cursor: not-allowed; }

/* ══════════════════════════════════════════
   라운드 결과 / 최종 결과
   ══════════════════════════════════════════ */
.res-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 24px;
}
.score-list { width: 100%; max-width: 520px; }
.score-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--bdr);
  border-radius: var(--r-md);
  margin-bottom: 7px;
  background: var(--bg2);
  animation: fadeUp .3s ease both;
}
.s-rank { font-family: var(--font-mono); font-size: 15px; font-weight: 700; width: 36px; text-align: center; color: var(--dim); }
.s-rank.g { color: var(--gold); }
.s-rank.s { color: var(--silv); }
.s-rank.b { color: var(--brnz); }
.s-name { flex: 1; font-weight: 600; font-size: 15px; }
.s-pts { font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: var(--acc); }
.s-ptlbl { font-size: 11px; color: var(--dim); margin-left: 2px; }
.next-cd { font-size: 13px; color: var(--dim); margin-top: 18px; }

/* 대기 */
.wait-spin {
  width: 28px;
  height: 28px;
  border: 2px solid var(--bdr2);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 최종 결과 */
#s-results { align-items: center; justify-content: center; padding: 36px 24px; }
.res-inner { max-width: 520px; width: 100%; text-align: center; }
.trophy-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  border: 1px solid var(--gold);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  background: hsla(45,100%,55%,0.05);
}
.final-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 28px;
}
.final-list { margin-bottom: 28px; display: flex; flex-direction: column; gap: 7px; }
.final-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border: 1px solid var(--bdr);
  border-radius: var(--r-md);
  background: var(--bg2);
  animation: fadeUp .4s ease both;
}
.final-item.winner {
  border-color: hsla(45,100%,55%,0.4);
  background: hsla(45,100%,55%,0.04);
}
.f-rank { font-family: var(--font-mono); font-size: 14px; font-weight: 700; width: 36px; text-align: center; color: var(--dim); }
.f-name { flex: 1; font-weight: 700; font-size: 16px; }
.f-pts { font-family: var(--font-mono); font-size: 26px; font-weight: 700; color: var(--acc); }
.result-btns { display: flex; gap: 10px; justify-content: center; }

/* ══════════════════════════════════════════
   방 목록
   ══════════════════════════════════════════ */
.room-list-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.room-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: var(--r-md);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all .15s;
}
.room-card:hover { border-color: rgba(18,18,18,0.15); background: var(--acc2); }
.rc-code { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--acc); letter-spacing: 2px; flex-shrink: 0; }
.rc-mid { flex: 1; min-width: 0; }
.rc-players { font-size: 13px; font-weight: 600; color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-meta { font-size: 11px; color: var(--dim); margin-top: 2px; }
.rc-count { font-family: var(--font-mono); font-size: 12px; color: var(--dim); flex-shrink: 0; }
.room-card.in-game { border-color: hsla(142,70%,55%,0.3); background: hsla(142,70%,55%,0.04); }
.room-card.in-game:hover { background: hsla(142,70%,55%,0.08); }
.rc-live-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: var(--r-sm);
  padding: 2px 6px;
  flex-shrink: 0;
  animation: livePulse 1.8s ease-in-out infinite;
}
@keyframes livePulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.spectator-banner {
  position: absolute;
  top: 66px;
  left: 0;
  right: 0;
  padding: 4px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 55;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--green);
  pointer-events: none;
  animation: spectatorBlink 2.2s ease-in-out infinite;
}
@keyframes spectatorBlink { 0%,100%{opacity:1} 50%{opacity:.2} }
.spectator-input-block { pointer-events: none !important; opacity: .4 !important; }

/* ══════════════════════════════════════════
   토스트
   ══════════════════════════════════════════ */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 999;
  pointer-events: none;
}
.toast-item {
  background: var(--bg3);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-md);
  padding: 10px 20px;
  font-size: 13px;
  color: var(--txt);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}
.toast-item.on { opacity: 1; transform: translateY(0) scale(1); }
.toast-item.hiding {
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  margin-bottom: -44px;
  transition: opacity .3s ease, transform .3s ease, margin-bottom .3s cubic-bezier(.4,0,.2,1);
}

/* ══════════════════════════════════════════
   설정 / 미션 / 친구 패널 내부
   ══════════════════════════════════════════ */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--bdr);
}
.setting-row:last-child { border-bottom: none; }
.setting-row-label { font-size: 14px; font-weight: 500; color: var(--txt); }
.setting-row-sub { font-size: 12px; color: var(--dim); margin-top: 2px; }

.vol-ctrl { display: flex; align-items: center; gap: 10px; }
.vol-btn {
  width: 28px;
  height: 28px;
  background: var(--bg3);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-sm);
  color: var(--txt);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.vol-btn:hover { border-color: var(--bdr3); background: var(--bg4); }
.vol-val { font-family: var(--font-mono); font-size: 13px; font-weight: 700; min-width: 32px; text-align: center; }

.toggle-btn {
  width: 42px;
  height: 24px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-btn.on { background: #3a7d44; }
.toggle-btn.off { background: var(--bdr2); }
.toggle-btn::after {
  content: '';
  position: absolute;
  top: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: left .2s;
}
.toggle-btn.on::after { left: 21px; }
.toggle-btn.off::after { left: 3px; }

/* 미션 */
.mission-item { padding: 14px 0; border-bottom: 1px solid var(--bdr); }
.mission-item:last-child { border-bottom: none; }
.mission-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.mission-name { font-size: 13px; font-weight: 500; color: var(--txt); }
.mission-reward { display: flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 12px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.mission-reward.xp { color: var(--dim); }
.mission-reward.coin { color: var(--acc); }
.mission-prog-bar { height: 3px; background: var(--bg3); border-radius: 2px; margin-bottom: 5px; overflow: hidden; }
.mission-prog-fill { height: 100%; background: var(--acc); border-radius: 2px; transition: width .4s ease; }
.mission-prog-fill.done { background: var(--green); }
.mission-count { font-size: 11px; color: var(--dim); }
.mission-claim-btn {
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--green2);
  border: 1px solid var(--green);
  border-radius: var(--r-sm);
  color: var(--green);
  cursor: pointer;
  font-family: var(--font-base);
  transition: all .15s;
}
.mission-claim-btn:hover { background: hsla(142,70%,55%,0.2); }
.mission-claim-btn:disabled { opacity: .3; cursor: not-allowed; }

/* 친구 */
.friend-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--bdr); }
.friend-item:last-child { border-bottom: none; }
.friend-avatar { width: 34px; height: 34px; overflow: visible; border: 1px solid var(--bdr2); border-radius: var(--r-sm); flex-shrink: 0; cursor: pointer; position: relative; background-size: cover; background-position: center; }
.friend-avatar::before { content: ''; position: absolute; inset: 0; border-radius: calc(var(--r-sm) - 1px); background: inherit; background-size: cover; background-position: center; z-index: 0; }
.friend-avatar img { width: calc(100% - 5px); height: calc(100% - 5px); object-fit: cover; display: block; border-radius: calc(var(--r-sm) - 2px); position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 1; }
.friend-info { flex: 1; min-width: 0; }
.friend-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-sub { font-size: 11px; color: var(--dim); margin-top: 2px; }
.friend-btn { padding: 4px 10px; font-size: 11px; font-weight: 600; font-family: var(--font-base); cursor: pointer; border-radius: var(--r-sm); transition: all .15s; }
.friend-req-item { padding: 11px 0; border-bottom: 1px solid var(--bdr); }
.friend-req-item:last-child { border-bottom: none; }
.friend-req-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(18,18,18,0.04);
  border: 1px solid rgba(18,18,18,0.10);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all .15s;
  margin-top: 12px;
}
.friend-req-banner:hover { background: var(--relay2); }
.friend-req-banner-text { flex: 1; font-size: 12px; color: var(--relay); font-weight: 500; }
.friend-req-count { background: var(--relay); color: #000; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 9999px; }
.friend-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  margin-bottom: 14px;
  font-family: var(--font-base);
  transition: color .15s;
}
.friend-back-btn:hover { color: var(--txt); }
.friend-view { display: none; }
.friend-view.on { display: block; }

/* ══════════════════════════════════════════
   모달 오버레이
   ══════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 160;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.modal-overlay.on { opacity: 1; pointer-events: auto; }
.modal-box {
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  background: var(--bg2);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.9) translateY(8px);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.on .modal-box { transform: scale(1) translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
}
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }

/* 초대 모달 */
.invite-modal-overlay {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 160;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.invite-modal-overlay.on { opacity: 1; pointer-events: auto; }
.invite-modal-box {
  width: 100%;
  max-width: 400px;
  max-height: 70vh;
  background: var(--bg2);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(16px);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-lg);
}
.invite-modal-overlay.on .invite-modal-box { transform: translateY(0); }

/* ══════════════════════════════════════════
   프로필 모달
   ══════════════════════════════════════════ */
.profile-overlay {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 20, 30, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 160;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.profile-overlay.on { opacity: 1; pointer-events: auto; visibility: visible; }
.profile-box {
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  background: var(--bg2);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.9) translateY(12px);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  box-shadow: var(--shadow-lg);
}
.profile-overlay.on .profile-box { transform: scale(1) translateY(0); }

.profile-banner { width: 100%; height: 140px; position: relative; flex-shrink: 0; overflow: visible; margin-bottom: 28px; }
.profile-banner-inner { position: absolute; inset: 0; overflow: hidden; border-radius: var(--r-xl) var(--r-xl) 0 0; }
.profile-avatar-area {
  position: absolute;
  bottom: -28px;
  left: 20px;
  width: 60px;
  height: 60px;
  border: 3px solid var(--bg2);
  border-radius: var(--r-md);
  background: var(--bg3);
  z-index: 2;
}
.profile-avatar-area img.pa-main { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: calc(var(--r-md) - 2px); }
.profile-close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--r-sm);
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  z-index: 3;
}
.profile-close-btn:hover { background: rgba(0,0,0,0.35); color: #fff; }
.profile-body { padding: 0 20px 20px; overflow-y: auto; flex: 1; }
.profile-name-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.profile-name { font-size: 18px; font-weight: 700; }
.profile-stats-row { display: flex; gap: 8px; margin-bottom: 16px; }
.profile-stat-card {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: var(--r-md);
  padding: 10px 12px;
  text-align: center;
}
.profile-stat-label { font-size: 10px; color: var(--dim); margin-bottom: 4px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.profile-stat-value { font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: var(--txt); }
.profile-bio-area { font-size: 13px; color: var(--txt2); line-height: 1.6; }
.profile-bio-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-md);
  color: var(--txt);
  font-family: var(--font-base);
  font-size: 13px;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}
.profile-bio-input:focus { border-color: var(--bdr3); }

/* ══════════════════════════════════════════
   글로벌 채팅
   ══════════════════════════════════════════ */
.gchat-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 360px;
  z-index: 120;
  display: none;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .4s cubic-bezier(.25,0,.2,1);
}
.gchat-wrap.gchat-lobby { display: flex; }
.gchat-wrap.gchat-lobby.gchat-visible { transform: translateY(0); }
.gchat-wrap.gchat-lobby.gchat-visible.gchat-hidden {
  transform: translateY(calc(100% + 4px));
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.gchat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg2);
  border: 1px solid var(--bdr);
  border-bottom: none;
  border-radius: var(--r-md) var(--r-md) 0 0;
  cursor: pointer;
  user-select: none;
}
.gchat-header-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 7px;
}
.gchat-unread {
  background: var(--acc);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 9999px;
  display: none;
}
.gchat-unread.on { display: inline-block; }
.gchat-body {
  background: var(--bg2);
  border: 1px solid var(--bdr);
  border-bottom: none;
  display: flex;
  flex-direction: column;
  height: 240px;
  transition: height .2s ease, opacity .2s ease;
  overflow: hidden;
}
.gchat-body.collapsed { height: 0; opacity: 0; pointer-events: none; }
.gchat-msgs { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.gchat-msg { font-size: 12px; line-height: 1.5; }
.gchat-msg-name { font-weight: 600; margin-right: 5px; }
.gchat-msg-text { color: var(--txt2); }
.gchat-input-row { display: flex; border-top: 1px solid var(--bdr); flex-shrink: 0; }
.gchat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--txt);
  font-family: var(--font-base);
  font-size: 12px;
  padding: 8px 12px;
}
.gchat-input::placeholder { color: var(--dim2); }
.gchat-send {
  background: transparent;
  border: none;
  border-left: 1px solid var(--bdr);
  color: var(--dim);
  cursor: pointer;
  padding: 0 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  transition: color .15s;
}
.gchat-send:hover { color: var(--acc); }

/* ══════════════════════════════════════════
   전리품 / 보상 패널
   ══════════════════════════════════════════ */
.reward-panel {
  position: fixed;
  top: 53px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(250, 250, 252, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 160;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .38s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
  border-top: 1px solid var(--bdr);
}
.reward-panel.on { transform: translateY(0); pointer-events: auto; }

.reward-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  background: rgba(245, 245, 248, 0.70);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.reward-hdr-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.reward-close-btn {
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid var(--bdr2);
  border-radius: var(--r-sm);
  color: var(--dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.reward-close-btn:hover { border-color: var(--dim); color: var(--txt); }

.reward-body { flex: 1; overflow-y: auto; }
.reward-content { display: flex; flex-direction: column; height: 100%; }
.reward-section { display: none; flex-direction: column; height: 100%; }
.reward-section.on { display: flex; }
.reward-section-title { font-size: 16px; font-weight: 700; color: var(--txt); }
.reward-section-sub { font-size: 10px; color: var(--dim); letter-spacing: 2px; text-transform: uppercase; margin-top: 4px; }
.reward-sidebar-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  background: var(--acc);
  border-radius: 50%;
  border: 1px solid var(--bg);
  display: none;
}
.reward-sidebar-dot.on { display: block; }

/* 상자 결과 */
.chest-result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(200, 200, 220, 0.22);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
}
.chest-result-overlay.on { display: flex; }
.chest-result-box {
  background: rgba(250, 250, 252, 0.88);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(0,0,0,0.09);
  border-radius: var(--r-xl);
  padding: 36px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: scaleIn .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes scaleIn {
  from { transform: scale(.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.chest-result-label { font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--dim); }
.chest-result-icon { font-size: 48px; margin: 8px 0; }
.chest-result-rarity { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.chest-result-name { font-size: 20px; font-weight: 800; color: var(--txt); }
.chest-result-type { font-size: 12px; color: var(--dim); }
.chest-result-close {
  margin-top: 8px;
  padding: 10px 28px;
  background: var(--acc);
  border: none;
  border-radius: var(--r-md);
  color: var(--acc-fg);
  font-family: var(--font-base);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.chest-result-close:hover { background: #2a2a2a; color: var(--bg); }

/* ══════════════════════════════════════════
   도움말 패널
   ══════════════════════════════════════════ */
.help-panel {
  position: fixed;
  top: 53px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(250, 250, 252, 0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 160;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .38s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
  border-top: 1px solid var(--bdr);
}
.help-panel.on { transform: translateY(0); pointer-events: auto; }

.help-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  background: rgba(245, 245, 248, 0.70);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.help-hdr-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.help-close-btn {
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid var(--bdr2);
  border-radius: var(--r-sm);
  color: var(--dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.help-close-btn:hover { border-color: var(--dim); color: var(--txt); }

.help-body { display: flex; flex: 1; overflow: hidden; }
.help-tabs {
  width: 180px;
  border-right: 1px solid var(--bdr);
  overflow-y: auto;
  flex-shrink: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg2);
}
.help-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--dim);
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-base);
  transition: all .15s;
  width: 100%;
  position: relative;
}
.help-tab-btn:hover { color: var(--txt2); background: var(--bg3); }
.help-tab-btn.active { color: var(--txt); background: var(--bg4); font-weight: 600; }
.htab-icon { width: 14px; height: 14px; flex-shrink: 0; }
.help-tab-dot {
  width: 6px;
  height: 6px;
  background: var(--acc);
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: auto;
  display: none;
}

.help-content { flex: 1; overflow-y: auto; padding: 28px 32px; }
.help-section { display: none; }
.help-section.on { display: block; }

.help-section-title { font-size: 22px; font-weight: 800; color: var(--txt); margin-bottom: 4px; }
.help-section-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 24px;
}

.help-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 1px solid;
  margin-bottom: 10px;
}
.help-badge.green { color: var(--acc); border-color: var(--acc); background: var(--acc2); }
.help-badge.orange { color: var(--relay); border-color: var(--relay); background: var(--relay2); }
.help-badge.dim { color: var(--dim); border-color: var(--bdr2); background: var(--bg3); }

.help-block {
  background: var(--bg2);
  border: 1px solid var(--bdr);
  border-radius: var(--r-md);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.help-block p { font-size: 13px; color: var(--txt2); line-height: 1.7; }
.help-block ul { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.help-block li { font-size: 13px; color: var(--txt2); line-height: 1.6; }
.help-block strong { color: var(--txt); font-weight: 600; }
.help-block-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--txt);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.help-block-title.dim { color: var(--dim); }
.help-block-title.orange { color: var(--relay); }
.help-credit-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--bdr); }
.help-credit-row:last-child { border-bottom: none; }
.help-credit-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); width: 80px; }
.help-credit-val { font-size: 13px; color: var(--txt); }
.help-terms-text { font-size: 13px; color: var(--txt2); line-height: 1.7; }
.help-terms-text h3 { font-size: 13px; font-weight: 700; color: var(--txt); margin: 16px 0 8px; }
.help-terms-text h3:first-child { margin-top: 0; }
.help-terms-text ul { padding-left: 18px; margin-top: 6px; }
.help-terms-text li { margin-bottom: 4px; }

/* ══════════════════════════════════════════
   스켈레톤
   ══════════════════════════════════════════ */
.skeleton {
  background: var(--bg3);
  border-radius: var(--r-sm);
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, hsla(0,0%,100%,0.04) 50%, transparent 100%);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}
.skel-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--bdr); }
.skel-row:last-child { border-bottom: none; }

/* ══════════════════════════════════════════
   나가기 확인 모달
   ══════════════════════════════════════════ */
.leave-confirm-wrap {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.38);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.leave-confirm-wrap.on { display: flex; }
.leave-confirm-modal {
  width: 100%;
  max-width: 360px;
  background: var(--bg2);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-xl);
  padding: 24px 22px 20px;
  box-shadow: var(--shadow-lg);
}
.leave-confirm-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--txt);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.leave-confirm-body { font-size: 13px; color: var(--dim); line-height: 1.6; margin-bottom: 20px; }
.leave-confirm-btns { display: flex; gap: 8px; }

/* ══════════════════════════════════════════
   쿠키 모달
   ══════════════════════════════════════════ */
.cookie-modal-wrap {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 999;
}
.cookie-modal-wrap.on { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.cookie-modal {
  background: var(--bg2);
  border: 1px solid var(--bdr2);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  max-width: 520px;
  width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-lg);
}
.cookie-modal-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--txt);
  display: flex;
  align-items: center;
  gap: 7px;
}
.cookie-modal-body { font-size: 12px; color: var(--dim); line-height: 1.6; }
.cookie-modal-btns { display: flex; gap: 8px; justify-content: flex-end; }
.cookie-terms-link { color: var(--acc) !important; }

/* ══════════════════════════════════════════
   캐치 카드 게임
   ══════════════════════════════════════════ */
.cc-wrap { width: 100%; max-width: 680px; margin: 0 auto; }
.cc-header { margin-bottom: 12px; }
.cc-table {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cc-sum { text-align: center; margin-bottom: 12px; font-family: var(--font-mono); font-size: 14px; color: var(--dim); }
.cc-flash {
  min-height: 32px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  border-radius: var(--r-sm);
}
.cc-divider { height: 1px; background: var(--bdr); margin: 14px 0; }
.cc-my-area { display: flex; justify-content: center; margin-bottom: 16px; }
.cc-my-card { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.cc-btns { display: flex; gap: 10px; justify-content: center; }
.cc-draw-btn { padding: 12px 32px; }
.cc-action-btn { padding: 12px 32px; }
.cc-hint-text { font-size: 11px; color: var(--dim); text-align: center; margin-top: 8px; letter-spacing: 0.5px; }

/* ══════════════════════════════════════════
   릴레이 피드백 오버레이
   ══════════════════════════════════════════ */
#relay-feedback {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s ease;
}
#relay-feedback-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transform: scale(0.6);
  opacity: 0;
  transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
}

/* ══════════════════════════════════════════
   설정 잠금 오버레이
   ══════════════════════════════════════════ */
.settings-locked { position: relative; pointer-events: none; }
.settings-locked::after {
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(2px);
  background: hsla(0,0%,97%,0.2);
  z-index: 10;
  border-radius: var(--r-md);
}
.settings-lock-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
}

/* ══════════════════════════════════════════
   모바일 차단
   ══════════════════════════════════════════ */
#mobile-block {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 99999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  gap: 16px;
}
@media (max-width: 900px) {
  #mobile-block { display: flex; }
}
.mb-icon { color: var(--dim); }
.mb-icon-img { height: 80px; width: auto; display: block; margin: 0 auto; }
.mb-title { font-size: 20px; font-weight: 800; color: var(--txt); }
.mb-sub { font-size: 14px; color: var(--dim); line-height: 1.7; }

/* ══════════════════════════════════════════
   클릭 리플 효과
   ══════════════════════════════════════════ */
.click-ripple-ring {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  border: 1.5px solid rgba(18,18,18,0.15);
  border-radius: 50%;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%) scale(0);
  animation: rippleExpand .6s cubic-bezier(0,0,.4,1) forwards;
}
.click-ripple-ring.r2 { animation-delay: .05s; border-color: rgba(18,18,18,0.10); }
.click-ripple-ring.r3 { animation-delay: .1s; border-color: rgba(18,18,18,0.06); }
@keyframes rippleExpand {
  to { width: 60px; height: 60px; opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* ══════════════════════════════════════════
   끝말잇기 전용
   ══════════════════════════════════════════ */
.wordchain-chain-wrap { width: 100%; margin-bottom: 14px; }

/* ══════════════════════════════════════════
   인게임 나가기 모달
   ══════════════════════════════════════════ */
#ingame-leave-wrap {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#ingame-leave-wrap.on { display: flex; }

/* ══════════════════════════════════════════
   마켓 / 시장 전용
   ══════════════════════════════════════════ */
.market-elim-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,68,68,0.08);
  pointer-events: none;
  z-index: 100;
  animation: failFlash .8s ease forwards;
}
.relay-fail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,68,68,0.1);
  pointer-events: none;
  z-index: 100;
  animation: failFlash .5s ease forwards;
}
@keyframes failFlash { 0%{opacity:1} 100%{opacity:0} }

.market-word-popup {
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--relay);
  border-radius: var(--r-lg);
  padding: 20px 44px;
  z-index: 150;
  pointer-events: none;
  text-align: center;
  box-shadow: 0 0 40px rgba(18,18,18,0.07);
  animation: fadeUp .25s cubic-bezier(.4,0,.2,1) both;
}
.market-word-popup .popup-who {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--relay);
  margin-bottom: 8px;
}
.market-word-popup .popup-word { font-size: 28px; font-weight: 900; color: var(--txt); }
.market-word-popup .popup-count { font-size: 11px; color: var(--dim); margin-top: 6px; }

.relay-player-status {
  padding: 7px 14px;
  background: var(--bg2);
  border: 1px solid var(--bdr);
  border-radius: var(--r-sm);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 76px;
  transition: all .25s;
}
.relay-player-status.active-turn { border-color: rgba(18,18,18,0.22); background: var(--relay2); }
.relay-player-status.failed { border-color: hsla(0,75%,60%,0.5); background: var(--red2); opacity: .6; }
.rps-name { font-size: 12px; font-weight: 600; color: var(--txt); }
.rps-pts { font-family: var(--font-mono); font-size: 11px; color: var(--acc); }
@keyframes turnFlash {
  0%   { opacity: 0; transform: scale(.88); }
  50%  { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}
.turn-flash { animation: turnFlash .35s ease forwards; }




#avatar-panel {
  display: block !important;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transition: max-height .32s cubic-bezier(.4,0,.2,1), opacity .22s ease;
}
#avatar-panel.open {
  max-height: 80vh;
  opacity: 1;
  pointer-events: auto;
  display: flex !important;
  flex-direction: column;
}

/* ══════════════════════════════════════════
   상자 UI
   ══════════════════════════════════════════ */
.chest-center-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 340px;
  gap: 20px;
}
.chest-big-img { width: 280px; height: 280px; display: flex; align-items: center; justify-content: center; }
.chest-big-img img { width: 280px; height: 280px; object-fit: contain; image-rendering: auto; display: block; }
.chest-big-img svg { display: none; }
.chest-big-count { font-size: 13px; font-weight: 500; color: var(--dim); }
.chest-big-open-btn {
  padding: 12px 48px;
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--acc);
  background: var(--acc2);
  color: var(--acc);
  border-radius: var(--r-md);
  transition: all .2s;
  letter-spacing: .3px;
}
.chest-big-open-btn:hover:not(:disabled) { background: var(--acc); color: #fff; }
.chest-big-open-btn:disabled { border-color: var(--bdr2); background: transparent; color: var(--dim2); cursor: default; }

/* 모두 열기 버튼 */
.chest-open-all-btn {
  padding: 12px 28px;
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--bdr2);
  background: transparent;
  color: var(--dim);
  border-radius: var(--r-md);
  transition: all .2s;
  letter-spacing: .3px;
}
.chest-open-all-btn:hover { border-color: var(--acc); color: var(--acc); background: var(--acc2); }
.chest-open-all-btn.stopping { border-color: var(--red); color: var(--red); background: rgba(200,60,60,0.06); }

/* 자동 열기 버튼 행 */
.chest-btn-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

/* 자동 열기 진행 표시 */
.chest-auto-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 220px;
}
.chest-auto-progress-bar-track {
  width: 100%;
  height: 3px;
  background: var(--bdr2);
  border-radius: 2px;
  overflow: hidden;
}
.chest-auto-progress-bar-fill {
  height: 100%;
  background: var(--acc);
  border-radius: 2px;
  transition: width .4s ease;
}
.chest-auto-progress-label {
  font-size: 11px;
  color: var(--dim);
  font-family: var(--font-mono);
}

/* 자동 열기 중 결과 오버레이 타이머 바 */
.chest-result-auto-timer {
  width: 100%;
  height: 2px;
  background: var(--bdr2);
  border-radius: 1px;
  overflow: hidden;
  margin-top: 8px;
  display: none;
}
.chest-result-auto-timer.on { display: block; }
.chest-result-auto-timer-fill {
  height: 100%;
  background: var(--acc);
  border-radius: 1px;
  width: 100%;
  transition: width linear;
}

/* 상자 결과 희귀도 */
.chest-result-rarity {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  padding: 2px 10px;
  border: 1px solid;
  border-radius: var(--r-sm);
}
.chest-result-rarity.common   { color: var(--dim);  border-color: var(--bdr2); }
.chest-result-rarity.rare     { color: #5bc8ff;     border-color: #5bc8ff; }
.chest-result-rarity.epic     { color: #c87cff;     border-color: #c87cff; }
.chest-result-rarity.legendary{ color: var(--gold); border-color: var(--gold); }

/* 신규 배지 */
.chest-new-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--acc);
  color: var(--acc-fg);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: var(--r-sm);
  animation: newBadgePop .4s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
  z-index: 2;
}
@keyframes newBadgePop {
  0%   { transform: scale(.5) translateY(-4px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.chest-result-box { position: relative; }

#sb-reward .reward-sidebar-dot { display: none; }
#sb-reward.has-reward .reward-sidebar-dot { display: block !important; }

/* ══════════════════════════════════════════
   캐치 카드 전용 (CC)
   ══════════════════════════════════════════ */
.cc-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 8px 10px 16px;
  gap: 0;
}
.cc-table {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  padding: 14px 10px 10px;
  gap: 10px;
  flex-wrap: wrap;
  background: none;
  border: none;
}
.cc-player-pile { display: flex; flex-direction: column; align-items: center; gap: 0; position: relative; transition: opacity .2s, transform .2s; }
.cc-player-pile.cc-pile-out { opacity: .25; }
.cc-pile-wrap { position: relative; width: 100px; height: 146px; display: flex; align-items: center; justify-content: center; transition: transform .2s, filter .2s; zoom: calc(1 / 1.1); }
.cc-pile-top-card { position: relative; width: 100px; height: 146px; object-fit: contain; border-radius: var(--r-md); border: 2px solid #d1d1d1; box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06); z-index: 5; image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; }
.cc-pile-placeholder { width: 100px; height: 146px; border: 1.5px solid rgba(18,18,18,0.18); border-radius: var(--r-md); background: rgba(18,18,18,0.03); }
.cc-pile-info-row { display: flex; align-items: center; gap: 5px; margin-top: 6px; max-width: 100px; }
.cc-pile-avatar { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.cc-pile-name { font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62px; }
.cc-pile-count { font-family: var(--font-mono); font-size: 10px; color: var(--dim2); letter-spacing: .5px; margin-top: 2px; }
.cc-turn-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--relay); animation: ccPulse .7s ease infinite; flex-shrink: 0; }
@keyframes ccPulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(.6)} }
.cc-out-label { font-size: 9px; font-weight: 900; letter-spacing: 1px; color: var(--red); }
.cc-my-area { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 10px 12px 12px; gap: 16px; }
.cc-my-card { display: flex; align-items: center; gap: 14px; flex: 1; flex-direction: row; }
.cc-my-card-img-wrap { position: relative; flex-shrink: 0; zoom: calc(1 / 1.1); }
.cc-card-img { width: 80px; height: 116px; object-fit: contain; border: 2px solid #d1d1d1; border-radius: var(--r-md); background: var(--bg3); image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; }
.cc-top-card { width: 82px; height: 120px; box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06); image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; }
.cc-my-info { display: flex; flex-direction: column; gap: 6px; }
.cc-my-label { font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--dim2); }
.cc-my-count { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--txt); line-height: 1; }
.cc-my-count-sub { font-size: 13px; color: var(--dim); margin-left: 3px; font-weight: 700; font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif; }
.cc-my-turn-badge { display: inline-block; font-size: 10px; font-weight: 900; letter-spacing: 1.5px; color: var(--relay); border: 1px solid var(--relay); border-radius: var(--r-sm); padding: 2px 8px; margin-top: 2px; }
.cc-elim-msg { font-size: 13px; font-weight: 700; letter-spacing: 2px; color: var(--dim2); padding: 30px 0; width: 100%; text-align: center; }
.cc-btns { display: flex; gap: 8px; width: 100%; padding: 0 0 2px; }
.cc-draw-btn, .cc-action-btn { flex: 1; padding: 15px 0; font-size: 14px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; transition: opacity .2s, transform .1s; }
.cc-draw-btn:disabled, .cc-action-btn:disabled { opacity: .28; cursor: not-allowed; }
.cc-btn-active { opacity: 1 !important; }
.cc-action-btn.cc-btn-active:active { transform: scale(.97); }
.cc-flash { font-size: 14px; font-weight: 700; letter-spacing: 1px; text-align: center; min-height: 20px; opacity: 0; transition: opacity .35s, transform .35s; width: 100%; }
.cc-sum { display: none !important; }
.cc-header { display: none; }
.cc-table-label, .cc-hand-label { display: none; }
.cc-col, .cc-col-name, .cc-col-cards, .cc-col-count, .cc-table-empty, .cc-pile-info, .cc-pile-empty, .cc-pile-empty-icon, .cc-pile-drawer { display: none; }
.cc-pile-avatar-wrap { display: none; }
.cc-card-hint { display: none; }

.cc-my-card-fade { opacity: 0; transition: opacity .25s ease; }
.cc-my-card-fade.cc-img-loaded { opacity: 1; }

@keyframes ccCardDrop {
  0%   { opacity:0; transform:translateY(-28px) scale(.88) rotate(-3deg); }
  65%  { transform:translateY(4px) scale(1.02) rotate(.5deg); }
  100% { opacity:1; transform:translateY(0) scale(1) rotate(0); }
}
@keyframes ccCardDropMe {
  0%   { opacity:0; transform:translateY(-22px) scale(.9); }
  65%  { transform:translateY(3px) scale(1.04); }
  100% { opacity:1; transform:none; }
}
.cc-card-draw-anim { animation: ccCardDrop .3s cubic-bezier(.22,.61,.36,1) both; }
.cc-pile-mine-anim { animation: ccCardDropMe .28s cubic-bezier(.22,.61,.36,1) both; }

@keyframes ccCardFlyAway {
  0%   { opacity:1; transform:translateY(0) scale(1) rotate(0); }
  40%  { opacity:.6; transform:translateY(-28px) scale(1.08) rotate(-6deg); }
  100% { opacity:0; transform:translateY(-70px) scale(.7) rotate(12deg); }
}
.cc-card-flyaway { animation: ccCardFlyAway .38s cubic-bezier(.4,0,.6,1) forwards; pointer-events: none; }

/* ══════════════════════════════════════════
   반응형
   ══════════════════════════════════════════ */
@media (min-width: 900px) {
  .lobby-slide { padding: 32px 32px; }
  .help-content { padding: 36px 48px; }
}