:root {
  --bg: #f6efe4;
  --card: #fffaf2;
  --ink: #3a2e25;
  --muted: #8a7a6b;
  --line: #e6d9c6;
  --accent: #e98a5d; /* 살구 */
  --accent-ink: #fff;
  --leaf: #7fb38a; /* 연녹색 */
  --male: #6f95c9;
  --female: #e0849a;
  --danger: #c4513f;
  --shadow: 0 6px 20px rgba(80, 55, 30, 0.12);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button { font: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11px; }
.strong { font-weight: 700; }
.error { color: var(--danger); min-height: 1em; font-size: 13px; }

.screen { min-height: 100%; }
/* (게임 밖 화면 배치는 파일 끝 "게임 밖 화면" 부분) */
.card { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 22px 18px; width: 100%; }
.narrow { max-width: 420px; }
.logo { margin: 0 0 8px; font-size: 32px; letter-spacing: -1px; color: var(--accent); }
.logo small { display: block; font-size: 13px; color: var(--muted); letter-spacing: 0; font-weight: 500; }

form label { display: block; margin: 12px 0; font-size: 14px; color: var(--muted); }
form input:not([type=radio]):not([type=file]) { display: block; width: 100%; margin-top: 4px; padding: 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
.seg { display: flex; gap: 8px; margin: 12px 0; }
.seg label { flex: 1; margin: 0; text-align: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); cursor: pointer; }
.seg input { display: none; }
.seg label:has(input:checked) { border-color: var(--accent); background: #fdeadf; font-weight: 700; }
.photo-pick { display: grid !important; place-items: center; width: 120px; height: 120px; margin: 12px auto !important; border-radius: 50%;
  border: 2px dashed var(--line); background: #fff; overflow: hidden; cursor: pointer; position: relative; }
.photo-pick input { position: absolute; opacity: 0; inset: 0; }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }

.btn { display: block; width: 100%; padding: 13px 16px; margin-top: 10px; border-radius: 14px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 600; cursor: pointer; min-height: 46px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { width: auto; min-height: 38px; padding: 8px 12px; margin: 0; }
.btn:disabled { opacity: .5; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; }

.me-row { display: flex; gap: 12px; align-items: center; margin: 14px 0; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: #eee; border: 2px solid #fff; box-shadow: var(--shadow); }
.queue-box { background: #fff; border-radius: 16px; padding: 14px; border: 1px solid var(--line); }
.queue-counts { display: flex; gap: 12px; }
.queue-counts > div { flex: 1; text-align: center; font-size: 26px; font-weight: 800; }
.queue-counts small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.install { margin-top: 14px; padding: 12px; border-radius: 14px; background: #eef6ef; border: 1px solid #d5e8d8; }
.install p { margin: 6px 0 0; }

/* ── 게임 ── */
#screen-game { position: fixed; inset: 0; overflow: hidden; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hud { position: absolute; top: 0; left: 0; right: 0; padding: calc(10px + var(--safe-t)) 12px 0; display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: start; pointer-events: none; }
.loc-pill { justify-self: start; display: flex; align-items: center; gap: 8px; background: rgba(255,251,244,.95); padding: 8px 14px; border-radius: 999px; box-shadow: var(--shadow); font-size: 13px; white-space: nowrap; max-width: 100%; overflow: hidden; }
.loc-pill b { font-size: 16px; letter-spacing: -0.5px; }
.loc-pill .sep { width: 1px; height: 16px; background: var(--line); }
.phase-badge { display: flex; align-items: center; gap: 8px; background: #f8cd4a; color: #3a2e25; padding: 8px 16px; border-radius: 999px; box-shadow: 0 4px 0 #d9a92a, var(--shadow); font-weight: 900; font-size: 16px; white-space: nowrap; }
.phase-badge.date { background: #f6b3bf; box-shadow: 0 4px 0 #d98b99, var(--shadow); }
.phase-badge .timer { font-variant-numeric: tabular-nums; background: rgba(255,255,255,.65); padding: 2px 8px; border-radius: 999px; font-size: 14px; }
.map-wrap { justify-self: end; display: flex; flex-direction: column; align-items: center; gap: 4px; }
#minimap { width: 92px; height: 74px; border-radius: 16px; border: 3px solid #fffaf2; box-shadow: var(--shadow); }
.map-wrap .count { background: rgba(255,251,244,.95); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; box-shadow: var(--shadow); }
.sub-row { position: absolute; top: calc(58px + var(--safe-t)); left: 12px; right: 112px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; }
#phase-sub { font-size: 12px; background: rgba(255,251,244,.88); padding: 4px 10px; border-radius: 999px; color: var(--muted); }
#phase-sub:empty { display: none; }
.voice-badge { font-size: 12px; background: rgba(255,251,244,.95); padding: 5px 10px; border-radius: 999px; box-shadow: var(--shadow); }
.voice-badge:empty { display: none; }
.voice-badge.on { background: #59c27a; color: #fff; }
.voice-badge.tap { pointer-events: auto; cursor: pointer; }
.joystick { position: absolute; left: 20px; bottom: calc(166px + var(--safe-b)); width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.35); border: 3px solid rgba(255,255,255,.8); touch-action: none; z-index: 4; }
.joystick .knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: #f8cd4a; box-shadow: 0 4px 0 #d9a92a; }
.toast { position: absolute; top: calc(120px + var(--safe-t)); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 14px; border-radius: 14px; font-size: 14px; max-width: calc(100% - 32px); text-align: center; z-index: 5; }

.intro-stage { position: absolute; top: calc(118px + var(--safe-t)); left: 12px; right: 12px; display: flex; gap: 10px; align-items: center;
  background: var(--card); border-radius: 16px; padding: 10px; box-shadow: var(--shadow); }
.intro-stage img { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.intro-stage .who { font-weight: 800; }
.intro-stage .facts { font-size: 12px; color: var(--muted); }
.intro-stage .order { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }

.panel { position: absolute; left: 0; right: 0; bottom: calc(160px + var(--safe-b)); padding: 0 12px; max-height: 42vh; overflow: auto; }
.panel:empty { display: none; }
.panel .box { background: var(--card); border-radius: 18px; padding: 12px; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 6px; font-size: 15px; }
.panel p { margin: 4px 0; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.pcard { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 6px; text-align: center; cursor: pointer; font-size: 13px; position: relative; }
.pcard img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.pcard.sel { border-color: var(--accent); background: #fdeadf; }
.pcard.off { opacity: .35; pointer-events: none; }
.pcard .tag { position: absolute; top: 4px; left: 4px; background: var(--ink); color: #fff; font-size: 10px; padding: 2px 5px; border-radius: 6px; }
.row { display: flex; gap: 8px; }
.row .btn { flex: 1; }
.tapzone { height: 150px; border-radius: 16px; display: grid; place-items: center; font-size: 22px; font-weight: 800; user-select: none; cursor: pointer; margin-top: 8px; }
.tapzone.wait { background: #e9dfd0; color: var(--muted); }
.tapzone.go { background: var(--leaf); color: #fff; }
.tapzone.done { background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: 16px; }
ol.rank { margin: 6px 0 0; padding-left: 22px; font-size: 13px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-size: 12px; margin: 2px; }
.pill.m { border-color: var(--male); }
.pill.f { border-color: var(--female); }

.chat { position: absolute; left: 0; right: 0; bottom: 0; height: calc(150px + var(--safe-b)); background: rgba(255,251,244,.92); backdrop-filter: blur(6px); border-radius: 18px 18px 0 0;
  box-shadow: 0 -4px 16px rgba(80,55,30,.08); display: flex; flex-direction: column; padding: 6px 10px calc(8px + var(--safe-b)); }
.chat-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.chat-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 10px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.chat-tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chat-log { flex: 1; overflow-y: auto; font-size: 13px; line-height: 1.45; }
.chat-log .m b { margin-right: 4px; }
.chat-log .m.sys { color: var(--muted); font-size: 12px; }
.chat-form { display: flex; gap: 6px; }
.chat-form input { flex: 1; min-width: 0; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--line); font-size: 16px; }

.sheet { position: absolute; left: 12px; right: 12px; bottom: calc(196px + var(--safe-b)); background: #fff; border-radius: 20px; box-shadow: var(--shadow); padding: 14px; z-index: 6; }
.sheet .top { display: flex; gap: 12px; align-items: center; }
.sheet img { width: 84px; height: 84px; border-radius: 16px; object-fit: cover; }
.sheet dl { margin: 10px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 14px; }
.sheet dt { color: var(--muted); }
.sheet dd { margin: 0; }
.conn { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); background: var(--ink); color: #fff; padding: 14px 18px; border-radius: 14px; z-index: 9; }
.update-bar { position: fixed; bottom: 0; left: 0; right: 0; background: var(--ink); color: #fff; font-size: 13px; padding: 8px 12px calc(8px + var(--safe-b)); text-align: center; z-index: 20; }

@media (min-width: 900px) {
  .panel { right: auto; left: 50%; transform: translateX(-50%); width: clamp(380px, calc(100% - 784px), 560px); bottom: 16px; max-height: 60vh; }
  .joystick { bottom: 24px; }
  #minimap { width: 140px; height: 112px; }
  .chat { left: auto; right: 16px; bottom: 16px; width: 360px; height: 300px; border-radius: 18px; }
  .sheet { left: auto; right: 16px; width: 360px; bottom: 330px; }
  .intro-stage { left: 50%; right: auto; transform: translateX(-50%); min-width: 380px; }
}

/* 가로 화면 (폰 가로) — 시안처럼 3D 장면을 넓게 */
@media (orientation: landscape) and (max-height: 560px) {
  .panel { left: 50%; right: auto; transform: translateX(-50%); width: min(460px, max(300px, calc(100% - 2 * (min(320px, 38vw) + 16px)))); bottom: 12px; max-height: calc(100% - 112px); }
  .panel .box { padding: 10px; }
  .grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .chat { left: auto; right: 12px; bottom: 12px; width: min(320px, 38vw); height: 132px; border-radius: 18px; padding-bottom: 8px; }
  .chat-log { font-size: 12px; }
  .joystick { bottom: 16px; left: 16px; width: 104px; height: 104px; }
  .sheet { left: auto; right: 12px; width: min(320px, 38vw); bottom: 152px; }
  .intro-stage { top: calc(60px + var(--safe-t)); left: 50%; right: auto; transform: translateX(-50%); min-width: 300px; }
  .sub-row { right: auto; }
  .toast { top: auto; bottom: 156px; }
  .btn { min-height: 40px; padding: 9px 12px; }
}

/* 앉기·눕기·점프 버튼 */
.actions { position: absolute; right: 16px; bottom: calc(166px + var(--safe-b)); display: flex; flex-direction: column; gap: 10px; z-index: 4; }
.actions .act { width: 68px; height: 68px; border-radius: 50%; border: 3px solid #fffaf2; background: #e98a5d; color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 4px 0 #c86f45, var(--shadow); touch-action: manipulation; }
.actions .act.jump { background: #6f95c9; box-shadow: 0 4px 0 #557ab0, var(--shadow); }
.actions .act:active { transform: translateY(3px); box-shadow: none; }
@media (orientation: landscape) and (max-height: 560px) {
  .actions { right: calc(min(320px, 38vw) + 28px); bottom: 16px; flex-direction: row; }
  .actions .act { width: 60px; height: 60px; }
}
/* 폰 세로: 가로로 돌리라고 막지 않고 세로 화면 그대로 플레이한다 (가로로 돌리면 가로 배치) */
.rotate-hint { display: none !important; }
@media (orientation: portrait) and (max-width: 760px) {
  /* 위: 장소 알약은 장소만 (좁아서 '나솔너솔'이 잘리던 것) */
  .loc-pill { padding: 6px 10px; font-size: 12px; gap: 6px; }
  .loc-pill b, .loc-pill .sep { display: none; }
  /* 방송 자막은 안내(토스트) 아래, 화면 위쪽 1/4 쯤 (토스트·카드·채팅과 겹치지 않게) */
  .bcap, #screen-game:has(#panel:not(:empty)) .bcap { top: calc(215px + var(--safe-t, 0px)); bottom: auto; }
  /* 조이스틱·점프 버튼이 보일 때는 안내 카드를 그 위로 */
  #screen-game:has(#joystick:not([hidden])) .panel { bottom: calc(300px + var(--safe-b)); max-height: calc(100% - 430px); }
  .toast { max-width: calc(100% - 24px); font-size: 12px; padding: 7px 12px; line-height: 1.4; }
  /* 선택 카드(사진 6장 + 버튼)가 스크롤 없이 다 보이게 */
  .panel { max-height: calc(100% - 300px); }
  .panel .grid { gap: 6px; }
  .panel .pcard { padding: 4px; font-size: 12px; }
}

/* 채팅 접기 */
.chat-head { display: flex; align-items: center; gap: 6px; }
.chat-head .chat-tabs { flex: 1; min-width: 0; }
.chat-toggle { flex: none; border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 4px 6px; cursor: pointer; }
.chat-toggle .unread { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 99px; background: #e98a5d; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.chat.min { left: auto !important; right: 12px; bottom: calc(12px + var(--safe-b)) !important; width: auto !important; height: auto !important; border-radius: 99px !important; padding: 4px 6px !important; }
.chat.min .chat-log, .chat.min .chat-form, .chat.min .chat-tabs { display: none; }
.chat.min .chat-toggle { color: var(--ink); font-weight: 700; font-size: 13px; padding: 6px 10px; }
#screen-game:has(.chat.min) .panel { bottom: calc(60px + var(--safe-b)); }
#screen-game:has(.chat.min) .actions { right: 16px; bottom: calc(70px + var(--safe-b)); }
#screen-game:has(.chat.min) .sheet { bottom: 70px; }
@media (orientation: landscape) and (max-height: 560px) {
  #screen-game:has(.chat.min) .actions { right: 16px; bottom: 64px; flex-direction: column; }
  #screen-game:has(.chat.min) .toast { bottom: 64px; }
  #screen-game:has(.chat.min) .panel { bottom: 12px; }
}

/* 개발 도구 (DEV_TOOLS=1 일 때만) */
.dev-bar { position: absolute; top: calc(58px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 6; }
.dev-bar button { border: 1px dashed #b98a5a; background: rgba(255,250,242,.9); color: #7a5634; border-radius: 99px; padding: 4px 10px; font-size: 12px; font-weight: 700; cursor: pointer; }
.dev-bar button.on { background: #7a5634; color: #fff; border-style: solid; }
/* 가로 화면: 조이스틱이 보이면 안내 패널을 그 위로 */
@media (orientation: landscape) and (max-height: 560px) {
  #screen-game:has(#joystick:not([hidden])) .panel { bottom: 132px; max-height: calc(100% - 200px); }
}
.chat-log .m.notice { color: #b4602f; font-weight: 700; }

/* ── 폰 가로: UI 를 작게 (3D 장면을 가리지 않게) ── */
@media (orientation: landscape) and (max-height: 560px) {
  .hud { padding: calc(6px + var(--safe-t)) 10px 0; }
  .loc-pill { padding: 4px 10px; font-size: 11px; gap: 6px; }
  .loc-pill b { font-size: 13px; }
  .phase-badge { padding: 4px 12px; font-size: 13px; box-shadow: 0 3px 0 #d9a92a, var(--shadow); }
  .phase-badge .timer { font-size: 12px; padding: 1px 6px; }
  #minimap { width: 72px; height: 58px; border-radius: 12px; border-width: 2px; }
  .map-wrap .count { font-size: 10px; padding: 1px 8px; }
  .sub-row { top: calc(36px + var(--safe-t)); gap: 4px; }
  #phase-sub, .voice-badge { font-size: 11px; padding: 2px 8px; }
  .dev-bar { top: calc(36px + var(--safe-t)); }
  .dev-bar button { font-size: 10px; padding: 2px 8px; }
  .toast { font-size: 12px; padding: 6px 10px; }
  .intro-stage { top: calc(40px + var(--safe-t)); padding: 6px 10px; min-width: 240px; gap: 8px; }
  .intro-stage img { width: 30px; height: 30px; border-radius: 8px; }
  .intro-stage .facts, .intro-stage .order { font-size: 11px; }

  /* 선택·사다리 카드는 화면 가운데 아래 (채팅은 오른쪽) */
  .panel { width: min(460px, max(300px, calc(100% - 2 * (min(250px, 30vw) + 14px)))); left: 50%; transform: translateX(-50%); bottom: 8px; padding: 0; max-height: calc(100% - 92px); }
  .panel .box { padding: 8px; border-radius: 14px; }
  .panel h3 { font-size: 13px; margin-bottom: 2px; }
  .panel p { font-size: 12px; margin: 2px 0; }
  .grid { grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 4px; }
  .pcard { padding: 2px; border-radius: 8px; border-width: 1.5px; font-size: 11px; line-height: 1.3; }
  .pcard img { border-radius: 6px; }
  .pcard .tag { font-size: 8px; padding: 1px 3px; }
  .panel .btn, .row .btn { min-height: 30px; padding: 5px 8px; font-size: 12px; border-radius: 10px; }
  .tapzone { height: 80px; font-size: 16px; margin-top: 4px; }
  ol.rank { font-size: 11px; }
  .pill { font-size: 10px; padding: 1px 6px; }

  .chat { width: min(250px, 30vw); height: 104px; right: 8px; bottom: 8px; padding: 4px 8px 6px; border-radius: 14px; }
  .chat-tabs button { font-size: 10px; padding: 2px 7px; }
  .chat-toggle { font-size: 10px; padding: 2px 4px; }
  .chat-log { font-size: 12px; line-height: 1.35; }
  .chat-form { gap: 4px; }
  .chat-form input { padding: 4px 8px; font-size: 16px; border-radius: 9px; height: 28px; }
  .chat-form .btn { min-height: 28px; padding: 3px 8px; font-size: 11px; }
  .sheet { width: min(250px, 30vw); right: 8px; bottom: 120px; }

  .joystick { width: 88px; height: 88px; left: 12px; bottom: 12px; }
  .joystick .knob { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
  .actions { right: calc(min(250px, 30vw) + 18px); bottom: 10px; gap: 8px; }
  .actions .act { width: 50px; height: 50px; font-size: 12px; border-width: 2px; }
  #screen-game:has(#joystick:not([hidden])) .panel { bottom: 106px; max-height: calc(100% - 196px); }
  #screen-game:has(.chat.min) .actions { right: 10px; bottom: 48px; }
  #screen-game:has(.chat.min) .toast { bottom: 48px; }
  .toast { bottom: 118px; }
}
.intro-stage .qtag { font-size: 10px; font-weight: 700; background: #f8cd4a; color: #3a2e25; border-radius: 99px; padding: 1px 6px; margin-left: 4px; vertical-align: middle; }

/* 사다리타기 */
.ladder-svg { width: 100%; height: auto; display: block; margin-top: 4px; }
.ladder-svg .lv { stroke: #b99a7a; stroke-width: 3; stroke-linecap: round; }
.ladder-svg .lh { stroke: #b99a7a; stroke-width: 3; stroke-linecap: round; animation: lh-in .4s ease-out both; }
.ladder-svg .lpath { fill: none; stroke: #e98a5d; stroke-width: 5; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: lpath 3s .5s ease-in-out forwards; }
.ladder-svg .lslot rect { fill: #fff; stroke: var(--line); stroke-width: 1.5; }
.ladder-svg .lslot text { font-size: 10px; text-anchor: middle; fill: var(--ink); font-weight: 700; }
.ladder-svg .lslot.can { cursor: pointer; }
.ladder-svg .lslot.can rect { stroke: #e98a5d; }
.ladder-svg .lslot.taken rect { fill: #efe6da; }
.ladder-svg .lslot.taken text { fill: var(--muted); font-weight: 500; }
.ladder-svg .lslot.mine rect { fill: #e98a5d; stroke: #c86f45; }
.ladder-svg .lslot.mine text { fill: #fff; }
@keyframes lpath { to { stroke-dashoffset: 0; } }
@keyframes lh-in { from { opacity: 0; } to { opacity: 1; } }

/* 점프·앉기 버튼: 채팅창 오른쪽 위 */
.actions { flex-direction: row-reverse; right: 16px; bottom: calc(166px + var(--safe-b)); }
@media (min-width: 900px) {
  .actions { right: 16px; bottom: 328px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .actions { right: 8px; bottom: 120px; flex-direction: row-reverse; }
  .actions .act { width: 50px; height: 50px; }
  #screen-game:has(.chat.min) .actions { right: 8px; bottom: 52px; flex-direction: row-reverse; }
  .toast { bottom: auto; top: calc(64px + var(--safe-t)); }
  #screen-game:has(.chat.min) .toast { bottom: auto; }
}

/* 가입: 만나고 싶은 나이 */
.age-range { border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px 6px; margin: 0; }
.age-range legend { font-size: 13px; padding: 0 4px; }
.age-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 14px; }
.age-range .age-row input { width: 60px !important; flex: none; display: inline-block; margin: 0 !important; text-align: center; padding: 8px 6px; }

/* 소리 켜기/끄기 */
.sound-btn { pointer-events: auto; border: 0; background: rgba(255,251,244,.95); border-radius: 999px; width: 34px; height: 34px; font-size: 16px; box-shadow: var(--shadow); cursor: pointer; }
@media (orientation: landscape) and (max-height: 560px) {
  .sound-btn { width: 28px; height: 28px; font-size: 13px; }
}

/* 간편 로그인 · 입장권 */
.social { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin: 10px 0 12px; background: #fff; }
.social-btns { display: flex; flex-direction: column; gap: 8px; align-items: stretch; margin: 8px 0 4px; }
.social-btns.small-btns { flex-direction: row; flex-wrap: wrap; align-items: center; }
.sbtn { border: 0; border-radius: 10px; padding: 11px 12px; font-size: 15px; font-weight: 700; cursor: pointer; }
.small-btns .sbtn { padding: 7px 10px; font-size: 13px; }
.sbtn.kakao { background: #fee500; color: #191600; }
.sbtn.apple { background: #000; color: #fff; }
.social.ok { border-color: var(--leaf); background: #eef8ef; }
.wallet, .account { margin-top: 12px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.wallet-head { display: flex; justify-content: space-between; align-items: center; }
.wallet-head #wallet-sum { font-weight: 800; color: var(--accent); }
.wallet.empty { border-color: #e98a5d; box-shadow: 0 0 0 3px rgba(233,138,93,.18); }
.shop { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.shop button { border: 1px solid var(--line); background: #fffaf2; border-radius: 12px; padding: 8px 4px; cursor: pointer; font-size: 12px; line-height: 1.35; }
.shop button b { display: block; font-size: 14px; }
.shop button .best { display: inline-block; font-size: 10px; background: #e98a5d; color: #fff; border-radius: 99px; padding: 0 6px; margin-top: 2px; }
.card { position: relative; }
.lobby-sound { position: absolute; top: 14px; right: 14px; }

/* 사이트 하단: 약관 링크 + 사업자 정보 (legal/business.js 가 채움) */
footer.site-foot { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.foot-links { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; font-size: 12px; }
.foot-links a { color: var(--ink); text-decoration: none; }
.foot-links span { color: var(--muted); }
.foot-biz { text-align: center; font-size: 11px; color: var(--muted); line-height: 1.6; margin: 6px 0 0; }
.foot-biz a { color: var(--muted); }

/* ════════════════════════════════════════════════════════════════
   게임 밖 화면 (시작 · 프로필 · 로비) — 벚꽃 노을 테마 (2026-11-26 시안)
   ════════════════════════════════════════════════════════════════ */
:root {
  --pk: #f0628f;          /* 진분홍 (주 버튼) */
  --pk-2: #ff93b5;        /* 연분홍 */
  --pk-soft: #fde7ef;
  --plum: #4a1e34;        /* 글자 (자두색) */
  --plum-2: #7b5568;
  --glass: rgba(255, 250, 252, .86);
  --glass-line: rgba(255, 255, 255, .9);
  --pk-shadow: 0 10px 30px rgba(186, 72, 120, .18);
}

/* 공통 배경: 가로 화면은 넓은 그림, 세로 화면은 세로 그림 */
.out-bg { position: fixed; inset: 0; z-index: -1; background: #f4d8e6 url(/img/bg-wide.webp) center / cover no-repeat; }
.out-bg::after { content: ''; position: absolute; inset: 0; background: transparent; transition: background .3s; }
@media (orientation: portrait) { .out-bg { background-image: url(/img/bg-tall.webp); background-position: center top; } }
body[data-screen="screen-game"] .out-bg, body[data-screen="screen-game"] .topbar { display: none; }
body[data-screen="screen-lobby"] .out-bg::after,
body[data-screen="screen-signup"] .out-bg::after { background: linear-gradient(180deg, rgba(253, 236, 245, .78), rgba(250, 232, 244, .9)); backdrop-filter: blur(3px); }
html { background: #f7dce9; }
body { background: transparent !important; }
body:not([data-screen="screen-game"]) { color: var(--plum); }

/* 상단 바 */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: calc(8px + var(--safe-t)) clamp(12px, 3vw, 28px) 8px; background: rgba(255, 246, 250, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .7); box-shadow: 0 2px 14px rgba(186, 72, 120, .08); }
.tb-logo img { display: block; height: 38px; width: auto; }
.tb-tag { font-size: 14px; font-weight: 600; color: var(--plum-2); white-space: nowrap; }
.tb-nav { display: none; gap: 6px; margin-left: 12px; }
body[data-screen="screen-lobby"] .tb-nav { display: flex; }
.tb-nav button { border: 0; background: transparent; color: var(--plum); font: inherit; font-weight: 700; font-size: 15px; padding: 9px 18px; border-radius: 999px; cursor: pointer; }
.tb-nav button.on { background: linear-gradient(180deg, var(--pk-2), var(--pk)); color: #fff; box-shadow: 0 4px 12px rgba(240, 98, 143, .35); }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid #fff; background: rgba(255, 255, 255, .85); font-size: 18px; cursor: pointer; box-shadow: 0 2px 8px rgba(186, 72, 120, .12); }
.vol { -webkit-appearance: none; appearance: none; width: 120px; height: 8px; border-radius: 99px; cursor: pointer;
  background: linear-gradient(90deg, var(--pk) 0 var(--p, 80%), #ead7e2 var(--p, 80%) 100%); }
.vol::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid #f3c6d7; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.vol::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid #f3c6d7; }
body[data-screen="screen-start"] .tb-logo, body[data-screen="screen-start"] .tb-tag { visibility: hidden; }
body[data-screen="screen-start"] .topbar { background: transparent; border: 0; box-shadow: none; backdrop-filter: none; }

/* ── 시작 화면 ── */
#screen-start { min-height: calc(100% - 56px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px 16px 24px; gap: 14px; }
.start-hero { display: none; text-align: center; }
.start-card { width: min(520px, 100%); text-align: center; background: rgba(255, 248, 251, .9); backdrop-filter: blur(6px);
  border: 2px solid rgba(255, 255, 255, .95); border-radius: 44px; padding: 30px clamp(20px, 5vw, 48px) 22px; box-shadow: var(--pk-shadow); }
.start-logo { display: block; width: min(300px, 70%); height: auto; margin: 0 auto; filter: drop-shadow(0 0 6px rgba(255, 255, 255, .95)) drop-shadow(0 2px 8px rgba(255, 255, 255, .8)); }
.start-tag { margin: 2px 0 0; font-size: 18px; font-weight: 800; color: var(--plum); letter-spacing: .5px; }
.start-tag::after { content: ''; display: block; width: 150px; height: 3px; margin: 6px auto 0; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--pk), transparent); }
.start-head { margin: 18px 0 6px; font-size: 22px; color: #6b1f43; letter-spacing: -.3px; }
.start-desc { margin: 0; font-size: 14px; color: var(--plum-2); line-height: 1.6; }
.start-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 14px; color: var(--pk); }
.start-divider::before, .start-divider::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #f2b2c8); }
.start-divider::after { background: linear-gradient(90deg, #f2b2c8, transparent); }
.social-col { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.social-col .sbtn, .g-wrap { width: min(400px, 100%); }
.social-col .sbtn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; border-radius: 999px; font-size: 17px; font-weight: 800; box-shadow: 0 4px 10px rgba(0, 0, 0, .08); }
.social-col .sbtn .ico { width: 22px; height: 22px; flex: none; }
.sbtn.apple { background: #231f20; }
.g-wrap { display: flex; justify-content: center; min-height: 44px; }
.g-wrap:empty { display: none; }
.start-msg { min-height: 1em; margin: 8px 0 0; color: var(--danger); }
.start-age { margin: 8px 0 4px; }
.start-links { display: flex; justify-content: center; gap: 12px; font-size: 14px; margin-top: 8px; }
.start-links a { color: var(--plum); text-decoration: none; font-weight: 600; }
.start-links span { color: #d9b8c7; }
#btn-guest { display: block; margin: 6px auto 0; color: var(--plum-2); text-decoration: underline; }
.start-foot { border: 0 !important; margin-top: 4px !important; background: rgba(255, 248, 251, .7); border-radius: 16px; padding: 8px 14px !important; }

/* 세로 화면(폰): 로고는 하늘에, 버튼 카드는 아래쪽 */
@media (orientation: portrait) and (max-width: 760px) {
  #screen-start { justify-content: space-between; padding-top: 0; }
  .start-hero { display: block; margin-top: 2vh; }
  .start-hero .start-logo { width: min(330px, 78vw); }
  .start-card .in-card { display: none; }
  .start-card { margin-top: auto; border-radius: 32px; padding: 20px 18px 16px; background: rgba(255, 246, 250, .93); }
  .start-head { margin-top: 0; font-size: 21px; }
  .start-desc br { display: none; }
}

/* ── 프로필 만들기 ── */
#screen-signup { display: flex; justify-content: center; align-items: flex-start; padding: 20px 16px 32px; }
.pf-card { border-radius: 28px; background: rgba(255, 250, 252, .95); box-shadow: var(--pk-shadow); }
.pf-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.pf-head h2 { margin: 0; font-size: 20px; color: #6b1f43; }
.pf-head .link { color: var(--plum-2); font-size: 14px; }
.pf-ok { background: #eef8ef; border: 1px solid #cfe7d3; border-radius: 12px; padding: 8px 10px; font-size: 13px; margin: 6px 0; }
.pf-card .btn.primary, .pf-card .seg label:has(input:checked) { --accent: var(--pk); }
.pf-card .btn.primary { background: linear-gradient(180deg, var(--pk-2), var(--pk)); border: 0; border-radius: 999px; font-size: 16px; box-shadow: 0 6px 14px rgba(240, 98, 143, .3); }
.pf-card .seg label:has(input:checked) { border-color: var(--pk); background: var(--pk-soft); }

/* ── 로비 ── */
#screen-lobby { display: block; padding: 18px clamp(12px, 2.4vw, 28px) 28px; }
.lobby { display: grid; grid-template-columns: minmax(240px, 290px) minmax(0, 1fr) minmax(250px, 320px); gap: 18px; max-width: 1500px; margin: 0 auto; align-items: start; }
.lb-left, .lb-right, .lb-center { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pcard-lg { background: var(--glass); border: 1px solid var(--glass-line); border-radius: 24px; padding: 16px 18px; box-shadow: var(--pk-shadow); backdrop-filter: blur(6px); }
.pcard-lg.wallet, .pcard-lg.account { margin: 0; }

.me-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; }
.me-card .avatar { width: 76px; height: 76px; border: 3px solid #fff; box-shadow: 0 4px 12px rgba(186, 72, 120, .2); grid-row: span 2; }
.me-name { font-size: 20px; font-weight: 900; color: var(--plum); }
.me-sub { font-size: 13px; color: var(--plum-2); line-height: 1.45; }
.me-edit { grid-column: 1 / -1; margin-top: 8px; border: 1px solid #f3cfdc; background: #fff; color: var(--plum); font: inherit; font-weight: 700; font-size: 14px; border-radius: 14px; padding: 10px; cursor: pointer; text-align: left; }
.me-edit::before { content: '💎 '; }

.wallet-head strong { font-size: 16px; }
.wallet-head #wallet-sum { color: var(--pk); font-weight: 900; }
.wallet.empty { border-color: var(--pk); box-shadow: 0 0 0 3px rgba(240, 98, 143, .2), var(--pk-shadow); }
.shop { grid-template-columns: 1fr; gap: 8px; }
.shop button { display: flex; align-items: center; justify-content: space-between; gap: 6px; background: #fff; border: 1px solid #f3d3df; border-radius: 14px; padding: 10px 12px; font-size: 13px; text-align: left; color: var(--plum); }
.shop button b { display: inline; font-size: 15px; order: 2; }
.shop button br { display: none; }
.shop button .best { background: var(--pk); margin: 0 0 0 6px; }

.hero { position: relative; border-radius: 30px; overflow: hidden; min-height: 560px; display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  padding: 28px 20px 26px; background: #f4d8e6 url(/img/bg-wide.webp) center 60% / cover no-repeat; box-shadow: var(--pk-shadow); border: 3px solid rgba(255, 255, 255, .9); }
.hero-plate { width: min(380px, 92%); text-align: center; background: rgba(255, 249, 252, .84); backdrop-filter: blur(4px); border: 2px solid #fff; border-radius: 120px 120px 34px 34px; padding: 24px 22px 16px; box-shadow: 0 8px 24px rgba(186, 72, 120, .15); }
.hero-logo { width: 82%; height: auto; display: block; margin: 0 auto; }
.hero-tag { margin: 0 0 12px; font-weight: 800; font-size: 16px; }
.wait-box { background: rgba(255, 255, 255, .92); border-radius: 22px; padding: 12px 14px 10px; border: 1px solid #f7dbe6; }
.wait-title { font-weight: 900; font-size: 16px; margin-bottom: 8px; }
.wait-counts { display: flex; justify-content: center; gap: 0; font-size: 15px; font-weight: 700; }
.wait-counts span { flex: 1; padding: 4px 6px; }
.wait-counts span + span { border-left: 1px solid #f1d6e1; }
.wait-counts .m i { filter: hue-rotate(160deg) saturate(1.4); font-style: normal; }
.wait-counts .f i { font-style: normal; }
.wait-counts .m { color: #5a6fb0; }
.wait-counts .f { color: #d24f7d; }
.wait-counts b { color: var(--plum); font-size: 18px; margin-left: 4px; }
.wait-msg { margin: 8px 0 0; font-size: 13px; color: var(--plum-2); line-height: 1.45; }
.hero-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.enter-btn { width: min(380px, 92%); height: 74px; border-radius: 999px; border: 3px solid rgba(255, 255, 255, .9); cursor: pointer;
  background: linear-gradient(180deg, #ff9fc0 0%, #f6709b 55%, #ea5687 100%); color: #fff; font: inherit; font-size: 28px; font-weight: 900; letter-spacing: 1px;
  box-shadow: 0 10px 24px rgba(234, 86, 135, .45), inset 0 2px 0 rgba(255, 255, 255, .5); text-shadow: 0 1px 2px rgba(150, 30, 70, .35); transition: transform .12s; }
.enter-btn:hover { transform: translateY(-2px); }
.enter-btn:active { transform: translateY(1px); }
.enter-btn.waiting { background: linear-gradient(180deg, #fff, #fde3ec); color: var(--pk); font-size: 22px; text-shadow: none; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 6px 30px rgba(240, 98, 143, .55), inset 0 2px 0 #fff; } }
.mic-check { display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 6px 10px; width: min(380px, 92%); padding: 8px 12px; border-radius: 16px; background: rgba(255, 255, 255, .88); box-shadow: var(--shadow); font-size: 13px; color: var(--ink); }
.mic-check[hidden] { display: none; }
.mic-check.ok .mic-status { color: #2f8f50; font-weight: 700; }
.mic-check.bad .mic-status { color: #c4463a; font-weight: 700; }
.mic-meter { flex: 1 1 90px; height: 8px; border-radius: 999px; background: #eee3da; overflow: hidden; min-width: 80px; }
.mic-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #59c27a, #f8cd4a 70%, #e9604a); transition: width .08s linear; }
.mic-btn { border: 0; border-radius: 999px; padding: 6px 12px; background: var(--accent); color: #fff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.dev-btn { border: 1px dashed #c58aa2; background: rgba(255, 255, 255, .8); color: var(--plum-2); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 12px; cursor: pointer; }

.steps-title { font-weight: 900; font-size: 17px; margin-bottom: 10px; }
.steps-list { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.steps-list li { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; background: #fff; border-radius: 18px; padding: 12px; border: 1px solid #f7dbe6; }
.steps-list li i { grid-row: span 2; width: 44px; height: 44px; border-radius: 50%; background: var(--pk-soft); display: grid; place-items: center; font-style: normal; font-size: 20px; }
.steps-list li b { font-size: 15px; }
.steps-list li span { font-size: 12px; color: var(--plum-2); line-height: 1.4; }
.steps-list li + li::before { content: '›'; position: absolute; left: -9px; top: 50%; transform: translateY(-50%); color: #d79bb2; font-size: 18px; font-weight: 900; }

.account .social-btns { margin-top: 10px; }
.account .sbtn { border-radius: 999px; }
.note-title { font-weight: 900; font-size: 16px; margin-bottom: 6px; }
.note-card ul { margin: 0 0 6px; padding: 0; list-style: none; }
.note-card li { font-size: 13px; line-height: 1.5; padding-left: 20px; position: relative; margin: 4px 0; }
.note-card li::before { content: '✔'; position: absolute; left: 0; color: var(--pk); font-weight: 900; }
.install { margin: 0; background: rgba(240, 250, 242, .9); }
.lobby-foot { max-width: 900px; margin: 22px auto 0 !important; border-top-color: rgba(255, 255, 255, .7) !important; }

/* 창 (게임 안내 · 설정) */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(74, 30, 52, .35); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: min(560px, 100%); max-height: 86vh; overflow: auto; background: #fff9fb; border-radius: 26px; padding: 22px 22px 18px; box-shadow: 0 20px 50px rgba(74, 30, 52, .3); color: var(--plum); }
.narrow-modal { width: min(380px, 100%); }
.modal-card h2 { margin: 0 0 8px; font-size: 20px; }
.modal-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--pk-soft); color: var(--plum); font-size: 15px; cursor: pointer; }
.guide-list { padding-left: 22px; margin: 10px 0; }
.guide-list li { font-size: 14px; line-height: 1.5; margin: 6px 0; }
.guide-list b { color: #b8336a; margin-right: 4px; }
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f3dbe4; }
.set-links { display: flex; gap: 14px; justify-content: center; margin-top: 14px; font-size: 13px; }
.set-links a { color: var(--plum-2); }

/* ── 태블릿 ── */
@media (max-width: 1180px) {
  .lobby { grid-template-columns: minmax(230px, 280px) minmax(0, 1fr); }
  .lb-right { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .steps-list { grid-template-columns: repeat(2, 1fr); }
  .steps-list li + li::before { display: none; }
}

/* ── 폰 (세로) ── */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding-bottom: 6px; }
  .tb-logo img { height: 30px; }
  .tb-tag { display: none; }
  .vol { width: 84px; }
  .icon-btn { width: 36px; height: 36px; font-size: 16px; }
  body[data-screen="screen-lobby"] .tb-nav { order: 3; width: 100%; margin: 0; }
  .tb-nav button { flex: 1; padding: 8px 10px; font-size: 14px; background: rgba(255, 255, 255, .6); }
  #screen-lobby { padding: 12px 12px 24px; }
  .lobby { display: flex; flex-direction: column; gap: 12px; }
  .lb-left, .lb-center, .lb-right { display: contents; }
  .me-card { order: 1; grid-template-columns: auto 1fr auto; padding: 10px 14px; }
  .me-card .avatar { width: 54px; height: 54px; grid-row: auto; }
  .me-name { font-size: 17px; }
  .me-text { min-width: 0; }
  .me-edit { grid-column: auto; margin: 0; padding: 8px 10px; font-size: 12px; white-space: nowrap; }
  .me-edit::before { content: ''; }
  /* 폰: 로고는 하늘, 캐릭터는 가운데, 입장 버튼과 대기 현황은 아래 */
  .hero { order: 2; min-height: 600px; justify-content: flex-start; padding: 16px 12px 14px; border-radius: 26px; background-image: url(/img/bg-tall.webp); background-position: center 30%; }
  .hero-plate { display: contents; }
  .hero-logo { order: 1; width: 66%; filter: drop-shadow(0 0 5px rgba(255, 255, 255, .95)) drop-shadow(0 0 2px #fff); }
  .hero-tag { order: 2; margin: 2px 0 0; text-shadow: 0 0 6px #fff, 0 0 2px #fff; }
  .hero-actions { order: 3; margin-top: auto; }
  .wait-box { order: 4; width: 100%; margin-top: 12px; background: rgba(255, 255, 255, .93); }
  .enter-btn { height: 64px; font-size: 24px; }
  .wallet { order: 3; }
  .steps { order: 4; }
  .account { order: 5; }
  .note-card { order: 6; }
  .install { order: 7; }
  .steps-list { grid-template-columns: 1fr 1fr; }
  .shop { grid-template-columns: repeat(3, 1fr); }
  .shop button { flex-direction: column; align-items: center; text-align: center; padding: 8px 4px; }
  .shop button b { order: 0; }
}
@media (max-width: 380px) {
  .vol { display: none; }
  .hero { min-height: 540px; }
}

/* ── 친구 · 나의 인연 · 메시지 ── */
.tb-nav button { position: relative; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 99px; background: #ff3d6e; color: #fff; font-size: 11px; font-style: normal; font-weight: 800; vertical-align: 2px; }
.tb-nav button.on .badge { background: #fff; color: var(--pk); }
.badge[hidden] { display: none; }

.friends-card { order: -1; }
.fc-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.fc-head strong { font-size: 16px; }
.chip-pk { margin-left: auto; border: 1px solid #f6c1d3; background: #fff; color: var(--pk); font: inherit; font-weight: 800; font-size: 13px; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.people { display: flex; flex-direction: column; }
.person { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid #f6e1ea; }
.person:last-child { border-bottom: 0; }
.person img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(186, 72, 120, .15); background: #f3e3ea; }
.p-text { flex: 1; min-width: 0; font-size: 12px; line-height: 1.45; }
.p-name { font-size: 15px; font-weight: 800; color: var(--plum); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-age { font-size: 12px; font-weight: 600; color: var(--plum-2); }
.g.male { color: #4f7fd6; }
.g.female { color: #e0507f; }
.st { font-size: 12px; color: var(--plum-2); }
.st.on::before, .st.off::before, .st.game::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: #bbb; vertical-align: 1px; }
.st.on { color: #2e9b55; }
.st.on::before { background: #34c26b; }
.st.game { color: #d1662f; }
.st.game::before { background: #ff9a3d; }
.p-text .last { display: inline-block; max-width: 100%; color: var(--plum); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.p-acts { display: flex; gap: 6px; align-items: center; flex: none; }
.ic { width: 36px; height: 36px; border-radius: 50%; border: 1px solid #f3d3df; background: #fff; cursor: pointer; font-size: 16px; }
.pill-btn { border: 1px solid #f3cfdc; background: #fff; color: var(--plum); font: inherit; font-size: 13px; font-weight: 700; padding: 7px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.pill-btn.pk { background: linear-gradient(180deg, var(--pk-2), var(--pk)); border-color: transparent; color: #fff; }
.pill-btn:disabled { opacity: .5; }
.tag { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: #f4ecf0; color: var(--plum-2); }
.tag.pk { background: var(--pk); color: #fff; }
.empty { text-align: center; color: var(--plum-2); font-size: 13px; padding: 18px 8px; margin: 0; line-height: 1.6; }
.hint { font-size: 12px; color: var(--plum-2); background: #fff3f7; border-radius: 12px; padding: 8px 10px; margin: 0 0 6px; }

.social-card { width: min(520px, 100%); display: flex; flex-direction: column; height: min(680px, 86vh); }
.social-card .soc-body { flex: 1; overflow: auto; margin: 0 -6px; padding: 0 6px; }
.seg-tabs { display: flex; background: #f8e7ee; border-radius: 999px; padding: 4px; margin: 4px 0 10px; }
.seg-tabs[hidden] { display: none; }
.seg-tabs button { flex: 1; border: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 700; color: var(--plum-2); padding: 8px 6px; border-radius: 999px; cursor: pointer; }
.seg-tabs button.on { background: linear-gradient(180deg, var(--pk-2), var(--pk)); color: #fff; box-shadow: 0 3px 8px rgba(240, 98, 143, .3); }
.seg-tabs button { white-space: nowrap; font-size: 13px; padding: 8px 4px; }
.p-handle { font-size: 11px; font-weight: 700; color: var(--plum-2); opacity: .8; }
.soc-sec { margin: 10px 2px 2px; font-size: 13px; color: var(--plum-2); }
.soc-sec:first-child { margin-top: 0; }
.ic.sm { width: 30px; height: 30px; font-size: 13px; }
/* 아이디 */
.handle-in { display: flex; align-items: center; gap: 2px; border: 1px solid #f0cfdc; border-radius: 12px; background: #fff; padding: 0 10px; flex: 1; min-width: 0; }
.handle-in i { font-style: normal; font-weight: 800; color: var(--pk); }
.handle-in input { border: 0 !important; outline: 0; box-shadow: none !important; background: transparent; padding: 10px 2px !important; margin: 0 !important; flex: 1; min-width: 0; font: inherit; }
.handle-field small { display: block; margin-top: 4px; color: var(--plum-2); font-weight: 500; }
.birth-field small { display: block; margin-top: 4px; font-weight: 600; }
.birth-field small.ok { color: #2e9b55; }
.birth-field small.bad { color: #d64545; }
.birth-field input[hidden] { display: none; }
.birth-locked { display: block; margin-top: 6px; padding: 10px 12px; border-radius: 12px; background: #f8eef2; color: var(--plum); font-weight: 700; }
.birth-locked[hidden] { display: none; }
.birth-btn { margin-left: 6px; border: 1px solid var(--pk); background: #fff; color: var(--pk); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.adult-consent { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1px solid #f0cfdc; border-radius: 12px; background: #fff7fa; font-size: 12.5px; line-height: 1.5; color: var(--plum); font-weight: 500; cursor: pointer; }
.adult-consent[hidden] { display: none !important; }
form .adult-consent input[type=checkbox] { display: inline-block; width: 18px; height: 18px; padding: 0; margin: 1px 0 0; flex: none; accent-color: var(--pk); }
.adult-consent span { flex: 1; min-width: 0; }
.handle-field small.ok, .add-friend .ok { color: #2e9b55; }
.handle-field small.bad, .add-friend .bad { color: #d64545; }
.add-friend { display: flex; flex-direction: column; gap: 12px; padding-top: 2px; }
.af-me { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #fff7fa; border: 1px solid #f6dbe6; border-radius: 14px; padding: 10px 12px; }
.af-me > .muted { flex-basis: 100%; }
.af-handle { font-size: 18px; color: var(--plum); margin-right: auto; }
.af-row { display: flex; gap: 8px; align-items: center; width: 100%; }
.af-me p { margin: 0; flex-basis: 100%; }
.me-handle { font-size: 12px; font-weight: 700; color: var(--plum-2); margin-left: 4px; }
button.me-handle.need { border: 1px dashed var(--pk); background: #fff; color: var(--pk); border-radius: 999px; padding: 2px 8px; cursor: pointer; font: inherit; font-size: 12px; font-weight: 800; }
.leave-note { margin: 0 0 8px; padding: 8px 12px; border-radius: 12px; background: #fff1f0; border: 1px solid #f5c6c2; color: #a83a32; font-size: 13px; font-weight: 600; line-height: 1.45; text-align: center; }
#modal-messages-body .person, .soc-body .person { cursor: default; }
#soc-body .person:has(.last) { cursor: pointer; }

.dm { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.dm[hidden] { display: none; }
.dm-head { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid #f3dbe4; }
.dm-photo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.dm-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dm-who b { font-size: 15px; }
.dm-more { border: 0; background: #f8e7ee; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 18px; color: var(--plum); }
.dm-menu { display: flex; gap: 8px; justify-content: flex-end; padding: 8px 0; }
.dm-menu[hidden] { display: none; }
.dm-menu button { border: 1px solid #f3cfdc; background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.dm-menu .danger { color: #c4314f; border-color: #f2b8c3; }
.dm-log { flex: 1; overflow-y: auto; padding: 12px 2px; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 78%; display: flex; align-items: flex-end; gap: 6px; }
.bubble .txt { padding: 9px 12px; border-radius: 18px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.bubble time { font-size: 10px; color: var(--plum-2); flex: none; }
.bubble.you { align-self: flex-start; }
.bubble.you .txt { background: #fff; border: 1px solid #f3dbe4; border-bottom-left-radius: 6px; }
.bubble.me { align-self: flex-end; flex-direction: row-reverse; }
.bubble.me .txt { background: linear-gradient(180deg, var(--pk-2), var(--pk)); color: #fff; border-bottom-right-radius: 6px; }
.dm-form { display: flex; gap: 8px; padding-top: 8px; border-top: 1px solid #f3dbe4; }
.dm-form[hidden] { display: none; }
.dm-form input { flex: 1; min-width: 0; border: 1px solid #f0cfdc; border-radius: 999px; padding: 11px 14px; font-size: 16px; background: #fff; color: var(--plum); }
.dm-send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: linear-gradient(180deg, var(--pk-2), var(--pk)); color: #fff; font-size: 18px; cursor: pointer; }
.dm-note { margin: 6px 0 0; text-align: center; }

.lobby-toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60;
  background: var(--plum); color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 14px; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center; }
.lobby-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .tb-nav { overflow-x: auto; gap: 4px; }
  .tb-nav button { padding: 8px 6px; font-size: 13px; white-space: nowrap; }
  .tb-nav .lg { display: none; }
  .friends-card { order: 4; }
  .social-card { height: 88vh; padding: 18px 14px 14px; }
  .modal { padding: 8px; align-items: end; }
}

/* ── 동반 입장 ── */
.party-bar { display: flex; justify-content: center; width: 100%; }
.party-btn { border: 2px solid rgba(255, 255, 255, .95); background: rgba(255, 250, 252, .9); color: var(--plum); font: inherit; font-weight: 800; font-size: 14px; padding: 8px 18px; border-radius: 999px; cursor: pointer; box-shadow: 0 4px 12px rgba(186, 72, 120, .15); }
.party-on { display: flex; align-items: center; gap: 6px; background: rgba(255, 250, 252, .94); border: 2px solid #fff; border-radius: 999px; padding: 5px 6px 5px 14px; box-shadow: 0 4px 12px rgba(186, 72, 120, .18); max-width: 100%; }
.party-on img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; margin-left: -8px; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.party-on img:first-of-type { margin-left: 0; }
.pt-label { font-weight: 900; font-size: 13px; color: var(--pk); white-space: nowrap; }
.pt-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-x { border: 0; background: #f8e7ee; color: var(--plum); font: inherit; font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 999px; cursor: pointer; }
.party-note .chip-pk { margin: 6px 0 0; }
.party-card .people { max-height: 50vh; overflow: auto; }

.party-invite { position: fixed; left: 50%; top: calc(76px + var(--safe-t)); transform: translateX(-50%); z-index: 55; display: flex; align-items: center; gap: 12px;
  width: min(460px, calc(100% - 24px)); background: #fff9fb; border: 2px solid #ffd3e2; border-radius: 22px; padding: 12px 14px; box-shadow: 0 14px 40px rgba(74, 30, 52, .25); color: var(--plum); animation: pi-in .25s ease-out; }
.party-invite[hidden] { display: none; }
@keyframes pi-in { from { transform: translate(-50%, -12px); opacity: 0; } }
.party-invite img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; flex: none; }
.pi-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 1.4; }
.pi-text b { font-size: 15px; }
.pi-text small { color: var(--plum-2); font-size: 11px; }
.pi-acts { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 760px) {
  .party-invite { top: calc(100px + var(--safe-t)); }
}

/* ── 신고 · 회원 탈퇴 ── */
.top-modal { z-index: 70; }
.rp-reasons { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 10px; }
.rp-reasons label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border: 1px solid #f3d3df; border-radius: 12px; background: #fff; color: var(--plum); font-size: 14px; cursor: pointer; }
.rp-reasons label:has(input:checked) { border-color: var(--pk); background: var(--pk-soft); font-weight: 700; }
#rp-detail { width: 100%; border: 1px solid #f0cfdc; border-radius: 12px; padding: 10px; font: inherit; font-size: 15px; resize: vertical; color: var(--plum); }
.rp-block { display: flex !important; gap: 8px; align-items: flex-start; font-size: 13px !important; color: var(--plum) !important; margin: 8px 0 !important; }
.rp-block[hidden] { display: none !important; }
.rp-send { background: linear-gradient(180deg, #ff8a8a, #e0455a) !important; border: 0 !important; }
.report-link { display: block; margin: 10px 0 0 auto; border: 0; background: none; color: #c4314f; font: inherit; font-size: 13px; cursor: pointer; }
.ic.sm { width: 30px; height: 30px; font-size: 13px; opacity: .7; }
.danger-link { display: block; margin: 16px auto 0; border: 0; background: none; color: #b0475d; font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.danger-link[hidden] { display: none; }
.rp-block input { width: auto !important; display: inline-block !important; margin: 2px 0 0 !important; padding: 0 !important; flex: none; accent-color: var(--pk); }
.start-msg.ban-msg { white-space: pre-line; color: #b3263f; background: #fff0f3; border: 1px solid #f6c3cd; border-radius: 14px; padding: 10px 12px; font-size: 13px; line-height: 1.5; }

/* ── 데이트권 보물찾기 ── */
.panel .box.mg-compact { padding: 8px 12px; }
.panel .box.mg-compact h3 { margin: 0 0 2px; font-size: 14px; }
.panel .box.mg-compact p { margin: 2px 0; }
.celebrate { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none; z-index: 30;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 26px; border-radius: 24px; text-align: center;
  background: linear-gradient(180deg, #fff8e1, #ffe7a8); border: 3px solid #fff; box-shadow: 0 12px 40px rgba(160, 110, 20, .35); color: #5a3a00; }
.celebrate b { font-size: 30px; letter-spacing: -.5px; }
.celebrate span { font-size: 14px; }
.celebrate.show { animation: celebrate 3.2s ease-out forwards; }
@keyframes celebrate {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
  10% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  18% { transform: translate(-50%, -50%) scale(1); }
  85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(.96); }
}

/* ── 방송 자막 (연애 예능 자막: 상자 없이 굵은 둥근 글씨 + 두꺼운 테두리, 강조는 노랑) ── */
@font-face { font-family: "Cafe24Ssurround"; src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2105_2@1.0/Cafe24Ssurround.woff") format("woff"); font-weight: 400 900; font-display: swap; }
.bcap { position: absolute; left: 50%; bottom: calc(26px + var(--safe-b, 0px)); transform: translateX(-50%); z-index: 60; width: min(94vw, 900px); text-align: center; pointer-events: none; opacity: 0; }
.bcap.show { animation: bcap-in .45s cubic-bezier(.2, 1.4, .4, 1) forwards; }
.bcap:not(.show) { transition: opacity .35s; opacity: 0; }
.bcap-in { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  font-family: "Cafe24Ssurround", "Pretendard", "Apple SD Gothic Neo", sans-serif; font-weight: 900; color: #fff; letter-spacing: -0.02em; line-height: 1.22; word-break: keep-all; }
.bcap-in span { -webkit-text-stroke: 6px #1c1424; paint-order: stroke fill; filter: drop-shadow(0 3px 0 rgba(20, 10, 25, .55)) drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); }
.bcap-in .l1 { font-size: clamp(15px, 2.3vw, 24px); -webkit-text-stroke-width: 5px; }
.bcap-in .l2 { font-size: clamp(21px, 3.6vw, 40px); }
.bcap-in b { color: #ffd93b; font-weight: 900; }
.bcap-tag { align-self: flex-start; margin: 0 0 2px 2px; padding: 3px 12px 4px; border-radius: 999px; background: #ff5fa0; color: #fff; font-style: normal; font-size: clamp(12px, 1.6vw, 16px); font-weight: 800; letter-spacing: 0; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
@keyframes bcap-in { 0% { opacity: 0; transform: translateX(-50%) scale(.86); } 60% { opacity: 1; transform: translateX(-50%) scale(1.04); } 100% { opacity: 1; transform: translateX(-50%) scale(1); } }
@media (max-width: 760px) { .bcap-in span { -webkit-text-stroke-width: 4px; } .bcap-in .l1 { -webkit-text-stroke-width: 3.5px; } }
/* 게임 끝 안내 (n초 뒤 대기실로) */
.end-popup { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(20, 14, 30, .35); animation: endIn .35s ease-out; }
.end-popup[hidden] { display: none; }
.end-card { width: min(360px, 86vw); background: #fffaf2; border-radius: 22px; padding: 18px 18px 16px; text-align: center; box-shadow: 0 12px 40px rgba(40, 20, 30, .35); }
.end-title { font-size: 19px; font-weight: 800; color: var(--ink); }
.end-sub { margin: 6px 0 2px; font-size: 13px; color: var(--muted); word-break: break-all; }
.end-count { margin: 10px 0 12px; font-size: 14px; }
.end-count b { font-size: 22px; color: var(--accent); margin-right: 2px; }
.end-card .btn { width: 100%; }
@keyframes endIn { from { opacity: 0; } to { opacity: 1; } }
@media (orientation: landscape) and (max-height: 560px) {
  .end-card { padding: 12px 14px; }
  .end-title { font-size: 16px; }
  .end-count { margin: 6px 0 8px; }
}
/* 선택·사다리 카드(가운데 아래)가 떠 있을 때는 방송 자막을 위쪽으로 올려 버튼을 가리지 않게 */
#screen-game:has(#panel:not(:empty)) .bcap { bottom: auto; top: calc(18% + var(--safe-t, 0px)); }
@media (orientation: landscape) and (max-height: 560px) {
  #screen-game:has(#panel:not(:empty)) .bcap { top: calc(64px + var(--safe-t, 0px)); }
}
.end-card .btn + .btn { margin-top: 8px; }
/* 폰 세로: 방송 자막은 늘 안내(토스트) 아래 (카드가 떠 있을 때 규칙보다 뒤에 두어 우선) */
@media (orientation: portrait) and (max-width: 760px) {
  #screen-game .bcap, #screen-game:has(#panel:not(:empty)) .bcap { top: calc(215px + var(--safe-t, 0px)); bottom: auto; }
}
/* ── 상단 메뉴가 좁을 때 (폰 가로·작은 태블릿): 글자가 한 자씩 세로로 꺾이지 않게 ── */
.tb-nav button { white-space: nowrap; }
.tb-nav { min-width: 0; }
@media (max-width: 1100px) {
  .tb-tag { display: none; }
  .tb-nav .lg { display: none; }
  .tb-nav button { padding: 8px 12px; }
}
/* 폰 가로 (높이가 낮은 화면): 상단 바를 한 줄로 얇게, 대기실은 두 칸 그대로 */
@media (orientation: landscape) and (max-height: 560px) {
  .topbar { padding: calc(4px + var(--safe-t)) 12px 4px; gap: 8px; }
  .tb-logo img { height: 26px; }
  .tb-nav { margin-left: 4px; gap: 2px; overflow-x: auto; }
  .tb-nav button { padding: 6px 10px; font-size: 13px; }
  .icon-btn { width: 32px; height: 32px; font-size: 15px; }
  .vol { width: 72px; }
  #screen-lobby { padding: 10px 12px 20px; }
}
/* 앉을 수 있는 가구 근처: 화면 가운데 큰 '앉기' 버튼 */
.seat-prompt { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); z-index: 5; border: 3px solid #fffaf2; border-radius: 999px;
  background: linear-gradient(180deg, #ff86ad, #f0628f); color: #fff; font: inherit; font-size: 18px; font-weight: 800; padding: 12px 26px;
  box-shadow: 0 5px 0 #c94a73, 0 10px 24px rgba(160, 50, 90, .3); cursor: pointer; touch-action: manipulation; animation: seatPulse 1.4s ease-in-out infinite; }
.seat-prompt[hidden] { display: none; }
.seat-prompt:active { transform: translate(-50%, calc(-50% + 3px)); box-shadow: 0 2px 0 #c94a73; }
@keyframes seatPulse { 0%, 100% { scale: 1; } 50% { scale: 1.06; } }
@media (orientation: landscape) and (max-height: 560px) { .seat-prompt { top: 62%; font-size: 15px; padding: 9px 20px; } }
/* 데이트권 지목(내 차례): 사진 6장을 한 줄로 작게 → 스크롤 없이 */
.box.pick-mine .grid { grid-template-columns: repeat(6, 1fr); gap: 5px; }
.box.pick-mine .pcard { padding: 3px; font-size: 11px; border-radius: 10px; }
.box.pick-mine .pcard img { border-radius: 7px; }
.box.pick-mine p { margin: 2px 0 4px; }
.box.pick-mine .btn { width: 100%; margin-top: 8px; }
