:root {
  --ink: #2a3236; --ink2: #5b676c; --mute: #8b969a;
  --paper: #fffdf6; --paper2: #f4f1e8; --line: #e6e1d4;
  --teal: #1aa4a2; --teal-d: #12807e; --coral: #e8604c; --sun: #f4c542; --cop: #2d4f8f; --thief: #e1574a; --leaf: #3e8f5d;
  --sign: "Black Han Sans", "Do Hyeon", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --soft: "Jua", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --body: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --shadow: 0 18px 50px rgba(30, 50, 70, .22), 0 2px 8px rgba(30, 50, 70, .12);
  font-family: var(--body); color: var(--ink); background: #9fcdf0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
kbd { font-family: var(--body); font-size: .78em; font-weight: 800; background: #fff; border: 1px solid #d9d4c6; border-bottom-width: 3px; border-radius: 6px; padding: 1px 6px; }
.hidden { display: none !important; }
#app { position: relative; width: 100%; height: 100%; overflow: hidden; }
#scene, #labels { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#scene { touch-action: none; }
#labels { pointer-events: none; }
.veil { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(255, 252, 240, .82) 0%, rgba(255, 252, 240, .35) 38%, rgba(255, 252, 240, 0) 62%); transition: opacity .5s; }
body.inRoom .veil { opacity: 0; }

/* top bar */
.topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 22px; z-index: 10; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; }
.brandSign { font-family: var(--sign); font-size: 30px; line-height: 1; color: #fff; background: var(--teal); padding: 8px 14px 7px; border-radius: 10px; box-shadow: 0 4px 0 var(--teal-d), var(--shadow); letter-spacing: 1px; }
.brandSign b { color: var(--sun); font-weight: 400; }
.brandSub { font-family: var(--soft); font-size: 13px; line-height: 1.25; color: var(--ink); background: rgba(255, 253, 246, .9); padding: 5px 10px; border-radius: 10px; box-shadow: 0 3px 10px rgba(30, 50, 70, .12); }
.topRight { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.chip { display: flex; align-items: center; gap: 8px; background: rgba(255, 253, 246, .92); border: 1px solid #fff; border-radius: 99px; padding: 7px 8px 7px 14px; font-size: 12px; font-weight: 600; box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.chip.status { padding-right: 14px; }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: #bbb; box-shadow: 0 0 0 3px #eee; }
.chip i.on { background: #39b36b; box-shadow: 0 0 0 3px #cdeed8; }
.roomChip strong { font-family: var(--sign); font-weight: 400; font-size: 18px; letter-spacing: 3px; color: var(--teal-d); }
.roomChip span { color: var(--mute); }
.chipBtn { background: var(--teal); color: #fff; border-radius: 99px; padding: 6px 12px; font-size: 12px; font-weight: 800; }

/* join */
.joinScreen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 90px 6vw 40px; gap: 40px; z-index: 5; }
.intro { max-width: 560px; }
.eyebrow { font-family: var(--soft); color: var(--coral); font-size: 17px; margin: 0 0 10px; }
.nowrap { white-space: nowrap; }
.intro h1 { font-family: var(--sign); font-weight: 400; font-size: clamp(48px, 6.2vw, 96px); line-height: 1.05; margin: 0 0 18px; color: var(--ink); text-shadow: 0 3px 0 #fff; }
.mark { color: #fff; background: var(--coral); padding: 0 .12em; border-radius: 12px; box-shadow: 0 6px 0 #b8443a; display: inline-block; transform: rotate(-3deg); }
.lead { font-size: 17px; line-height: 1.75; color: var(--ink2); font-weight: 600; margin: 0 0 20px; }
.rules { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.rules li { background: rgba(255, 253, 246, .9); border: 1px solid #fff; border-radius: 14px; padding: 10px 14px; font-size: 14px; color: var(--ink2); box-shadow: 0 4px 14px rgba(30, 50, 70, .08); width: fit-content; }
.rules b { color: var(--ink); margin-right: 6px; }
.card { background: rgba(255, 253, 246, .97); border: 1px solid #fff; border-radius: 22px; box-shadow: var(--shadow); }
.joinCard { width: min(420px, 100%); padding: 24px; flex-shrink: 0; max-height: calc(100% - 20px); overflow: auto; }
.joinCard h2 { font-family: var(--sign); font-weight: 400; font-size: 26px; margin: 0 0 14px; }
.label { display: block; font-size: 12px; font-weight: 800; color: var(--ink2); margin: 14px 0 7px; }
.field { width: 100%; height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; padding: 0 14px; font-size: 15px; font-weight: 600; outline: none; }
.field:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(26, 164, 162, .15); }
.avatarGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.avatar { border: 2px solid var(--line); border-radius: 14px; background: linear-gradient(#eaf4fb, #fff); padding: 2px 0 6px; display: flex; flex-direction: column; align-items: center; transition: transform .15s, border-color .15s; }
.avatar img { width: 82px; height: 82px; object-fit: cover; }
.avatar span { font-family: var(--soft); font-size: 14px; color: var(--ink2); }
.avatar:hover { transform: translateY(-2px); }
.avatar.on { border-color: var(--teal); background: linear-gradient(#d9f2f1, #fff); box-shadow: 0 0 0 3px rgba(26, 164, 162, .18); }
.avatar.on span { color: var(--teal-d); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--line); }
.swatch.on { box-shadow: 0 0 0 3px var(--teal); }
.inviteHint { margin-top: 14px; background: #fff3d6; border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 600; }
.btn { border-radius: 14px; font-weight: 800; transition: transform .12s, filter .12s; }
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn.primary { width: 100%; margin-top: 18px; min-height: 54px; background: var(--coral); color: #fff; font-family: var(--sign); font-weight: 400; font-size: 21px; box-shadow: 0 5px 0 #b8443a; letter-spacing: .5px; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.05); }
.fine { text-align: center; font-size: 12px; color: var(--mute); margin: 12px 0 0; }

/* lobby panel */
.lobbyPanel { position: absolute; right: 20px; top: 76px; width: 330px; z-index: 8; padding: 0; overflow: hidden; max-height: calc(100% - 96px); display: flex; flex-direction: column; }
.lobbyToggle { width: 100%; text-align: left; padding: 12px 18px; font-family: var(--sign); font-size: 17px; background: var(--teal); color: #fff; display: flex; justify-content: space-between; }
.lobbyToggle span { font-family: var(--body); font-weight: 800; font-size: 13px; background: rgba(255, 255, 255, .22); padding: 2px 10px; border-radius: 99px; }
.lobbyBody { padding: 14px 18px 18px; overflow: auto; }
.lobbyPanel.collapsed .lobbyBody { display: none; }
.lobbyHead { display: flex; justify-content: space-between; align-items: center; }
.lobbyHead h2 { font-family: var(--soft); font-weight: 400; font-size: 18px; margin: 0; }
.badge { font-size: 11px; font-weight: 800; background: #e2f4ea; color: var(--leaf); padding: 4px 10px; border-radius: 99px; }
.roster { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.slot { border-radius: 12px; background: var(--paper2); min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 2px 2px 5px; position: relative; overflow: hidden; }
.slot img { width: 54px; height: 54px; object-fit: cover; }
.slot span { font-size: 10.5px; font-weight: 800; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 3px; }
.slot.me { background: #fff3d6; box-shadow: inset 0 0 0 2px var(--sun); }
.slot.empty { color: #c7c1b2; justify-content: center; font-size: 20px; }
.slot .crown { position: absolute; top: 2px; left: 4px; font-size: 13px; }
.slot .bot { position: absolute; top: 2px; right: 4px; font-size: 11px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--paper2); border-radius: 12px; padding: 3px; }
.segmented button { padding: 8px 0; border-radius: 9px; font-size: 13px; font-weight: 800; color: var(--ink2); }
.segmented button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.toggleRow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; cursor: pointer; }
.toggleRow b { display: block; font-size: 13px; }
.toggleRow small { display: block; font-size: 11.5px; color: var(--mute); margin-top: 2px; }
.toggleRow input { display: none; }
.switch { width: 44px; height: 26px; border-radius: 99px; background: #d6d1c3; position: relative; flex-shrink: 0; transition: background .2s; }
.switch:after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.toggleRow input:checked + .switch { background: var(--teal); }
.toggleRow input:checked + .switch:after { transform: translateX(18px); }
.toggleRow input:disabled + .switch { opacity: .5; }
.lobbyHint { position: absolute; top: 80px; left: 50%; transform: translateX(-50%); z-index: 6; background: rgba(42, 50, 54, .78); color: #fff; font-size: 13px; padding: 8px 16px; border-radius: 99px; white-space: nowrap; pointer-events: none; }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.hud section { pointer-events: auto; }
.timerPill { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; background: rgba(255, 253, 246, .96); border-radius: 99px; padding: 8px 10px 8px 16px; box-shadow: var(--shadow); }
.timerPill .phase { font-size: 12px; font-weight: 800; color: var(--coral); }
.timerPill strong { font-family: var(--sign); font-weight: 400; font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.timerPill .teams { display: flex; gap: 6px; }
.timerPill em { font-style: normal; font-size: 13px; font-weight: 800; padding: 5px 10px; border-radius: 99px; }
.timerPill .cop { background: #e3ebf8; color: var(--cop); }
.timerPill .thief { background: #fbe4e0; color: var(--thief); }
.roleCard { position: absolute; left: 20px; top: 82px; display: flex; gap: 10px; align-items: center; background: rgba(255, 253, 246, .96); border-radius: 18px; padding: 10px 16px 10px 10px; box-shadow: var(--shadow); max-width: 280px; }
.roleEmoji { font-size: 28px; width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; background: #fbe4e0; }
.roleCard.police .roleEmoji { background: #e3ebf8; }
.roleCard small { font-size: 11px; color: var(--mute); font-weight: 800; }
.roleCard strong { display: block; font-family: var(--sign); font-weight: 400; font-size: 22px; line-height: 1.1; color: var(--thief); }
.roleCard.police strong { color: var(--cop); }
.roleCard p { margin: 2px 0 0; font-size: 12px; color: var(--ink2); }
.mapCard { position: absolute; right: 20px; top: 76px; background: rgba(255, 253, 246, .96); border-radius: 18px; padding: 8px; box-shadow: var(--shadow); }
#minimap { width: 180px; height: 180px; display: block; border-radius: 12px; }
.mapLegend { display: flex; justify-content: space-around; font-size: 11px; font-weight: 700; color: var(--ink2); margin-top: 6px; }
.lg { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.lg.me { background: #ffd23f; box-shadow: 0 0 0 1.5px #333; } .lg.team { background: var(--teal); } .lg.cop { background: var(--cop); } .lg.thf { background: var(--thief); } .lg.jail { background: transparent; box-shadow: inset 0 0 0 2px var(--coral); border-radius: 2px; }
.actionDock { position: absolute; right: 20px; bottom: 22px; width: 280px; }
.stamina { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 800; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); margin-bottom: 8px; }
.stamina .bar { flex: 1; height: 10px; border-radius: 99px; background: rgba(0, 0, 0, .3); border: 2px solid rgba(255, 255, 255, .8); overflow: hidden; }
#staminaFill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--sun), #ffe28a); transition: width .15s; }
.actionButtons { display: flex; gap: 8px; }
.btn.sprint, .btn.action { flex: 1; min-height: 62px; color: #fff; font-family: var(--sign); font-weight: 400; font-size: 19px; display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: none; user-select: none; -webkit-user-select: none; }
.btn small { font-family: var(--body); font-size: 10px; font-weight: 800; opacity: .8; }
.btn.sprint { background: #f0a73a; box-shadow: 0 5px 0 #c27f20; }
.btn.sprint.active { transform: translateY(3px); box-shadow: 0 2px 0 #c27f20; }
.btn.action { flex: 1.3; background: var(--thief); box-shadow: 0 5px 0 #a83b31; }
.btn.action.police { background: var(--cop); box-shadow: 0 5px 0 #1b3360; }
.btn.action.ready { animation: pulse 1s infinite; }
@keyframes pulse { 50% { filter: brightness(1.18); transform: scale(1.03); } }

/* social */
.social { position: absolute; left: 20px; bottom: 20px; width: min(360px, 40vw); z-index: 7; }
.chatLines { display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; max-height: 130px; overflow: hidden; margin-bottom: 6px; -webkit-mask-image: linear-gradient(transparent, #000 30%); mask-image: linear-gradient(transparent, #000 30%); }
.chatLine { font-size: 13px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
.chatLine b { color: #ffe08a; margin-right: 5px; }
.chatLine.team b { color: #9fe3e1; }
.chatLine.sys { color: #fff7d6; font-weight: 700; }
.chatForm { display: flex; gap: 4px; align-items: center; background: rgba(255, 253, 246, .96); border-radius: 14px; padding: 4px; box-shadow: var(--shadow); }
.chatForm input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 14px; padding: 8px 6px; }
.chatForm button { padding: 8px 10px; border-radius: 10px; font-weight: 800; font-size: 13px; }
.chatMode { background: var(--paper2); }
.chatMode.team { background: #d9f2f1; color: var(--teal-d); }
.emotes { display: flex; gap: 6px; margin-top: 6px; }
.emotes button { width: 38px; height: 38px; border-radius: 12px; background: rgba(255, 253, 246, .92); font-size: 19px; box-shadow: 0 3px 10px rgba(0, 0, 0, .12); }
.emotes button:active { transform: scale(.92); }
.keysGuide { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); z-index: 5; pointer-events: none; white-space: nowrap; }
.keysGuide kbd { color: var(--ink); text-shadow: none; }

/* notices */
.eventToasts { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 9; pointer-events: none; }
.eventToast { background: rgba(255, 253, 246, .97); border-radius: 99px; padding: 9px 18px; font-size: 14px; font-weight: 800; box-shadow: var(--shadow); animation: drop .3s both; white-space: nowrap; }
.eventToast.capture { color: var(--cop); } .eventToast.rescue { color: var(--thief); } .eventToast.go { color: var(--coral); }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }
.centerNotice { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); text-align: center; background: rgba(255, 253, 246, .97); border-radius: 24px; padding: 22px 40px; box-shadow: var(--shadow); z-index: 9; animation: pop .25s both; pointer-events: none; }
.centerNotice > div { font-size: 46px; }
.centerNotice strong { display: block; font-family: var(--sign); font-weight: 400; font-size: 34px; margin-top: 4px; }
.centerNotice p { margin: 6px 0 0; color: var(--ink2); font-weight: 600; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -45%) scale(.9); } }
.jailNotice { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: rgba(255, 244, 232, .97); border-radius: 18px; padding: 12px 20px; box-shadow: var(--shadow); z-index: 8; }
.jailNotice span { font-size: 30px; } .jailNotice b { font-family: var(--sign); font-weight: 400; font-size: 20px; } .jailNotice p { margin: 2px 0 0; font-size: 13px; color: var(--ink2); }
.jailNotice.spectate { background: rgba(232, 244, 255, .97); }
.resultsScreen { position: absolute; inset: 0; z-index: 12; display: grid; place-items: center; background: rgba(30, 45, 55, .45); backdrop-filter: blur(6px); }
.resultPanel { width: min(440px, 92%); padding: 26px; text-align: center; }
.resultIcon { font-size: 54px; }
.resultPanel h2 { font-family: var(--sign); font-weight: 400; font-size: 40px; margin: 6px 0; }
.resultPanel > p { color: var(--ink2); margin: 0; }
.resultStats { margin: 16px 0 4px; display: grid; gap: 6px; text-align: left; }
.resultRow { display: flex; align-items: center; gap: 10px; background: var(--paper2); border-radius: 12px; padding: 6px 12px 6px 6px; }
.resultRow img { width: 40px; height: 40px; }
.resultRow .nm { flex: 1; font-weight: 800; font-size: 14px; }
.resultRow .nm small { display: block; font-weight: 600; color: var(--mute); font-size: 11.5px; }
.resultRow .pt { font-family: var(--sign); font-size: 18px; }
.toast { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); background: rgba(42, 50, 54, .92); color: #fff; border-radius: 99px; padding: 10px 18px; font-size: 14px; font-weight: 700; z-index: 20; max-width: 90%; text-align: center; }

/* mobile */
.mobilePad { position: absolute; left: 24px; bottom: 34px; z-index: 7; touch-action: none; }
.padBase { width: 132px; height: 132px; border-radius: 50%; background: rgba(255, 255, 255, .35); border: 2px solid rgba(255, 255, 255, .85); position: relative; backdrop-filter: blur(4px); }
.padThumb { position: absolute; left: calc(50% - 28px); top: calc(50% - 28px); width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 253, 246, .97); box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
body.touch .keysGuide, body.touch .lobbyHint b { display: none; }
@media (max-width: 860px) {
  .joinScreen { flex-direction: column; justify-content: flex-start; overflow: auto; padding: 80px 16px 24px; gap: 14px; }
  .veil { background: rgba(255, 252, 240, .55); }
  .intro h1 { font-size: 50px; margin-bottom: 8px; }
  .intro h1 br { display: none; }
  .lead { font-size: 14px; margin-bottom: 8px; } .lead br { display: none; }
  .rules { display: none; }
  .joinCard { max-height: none; overflow: visible; padding: 18px; }
  .avatar img { width: 64px; height: 64px; }
  .topbar { padding: 12px; }
  .brandSign { font-size: 22px; padding: 6px 10px 5px; } .brandSub { font-size: 11px; }
  .roomChip > span { display: none; }
  .chip.status { display: none; }
  .brandSub { display: none; }
  .lobbyPanel { left: 12px; right: 12px; width: auto; top: auto; bottom: 12px; max-height: 58%; }
  .lobbyPanel.collapsed { left: auto; width: 170px; }
  .lobbyHint { display: none; }
  .timerPill { top: 62px; gap: 8px; padding: 6px 8px 6px 12px; } .timerPill strong { font-size: 22px; } .timerPill .phase { display: none; }
  .roleCard { top: 112px; left: 10px; padding: 6px 10px 6px 6px; } .roleEmoji { width: 38px; height: 38px; font-size: 22px; } .roleCard strong { font-size: 17px; } .roleCard p { display: none; }
  .mapCard { top: 112px; right: 10px; padding: 5px; } #minimap { width: 110px; height: 110px; } .mapLegend { display: none; }
  .actionDock { right: 12px; bottom: 18px; width: 200px; } .btn.sprint, .btn.action { min-height: 64px; font-size: 16px; }
  .eventToasts { top: 168px; } .eventToast { font-size: 12px; white-space: normal; text-align: center; max-width: 80vw; }
  .jailNotice { bottom: 190px; width: max-content; max-width: 90vw; }
  .centerNotice { padding: 16px 24px; } .centerNotice strong { font-size: 26px; }
}

/* ── v2: 빠른 채팅, 모바일 조이스틱, 구출 진행, 대시 ── */
.quickChat { display: flex; gap: 5px; overflow-x: auto; margin-bottom: 6px; scrollbar-width: none; }
.quickChat::-webkit-scrollbar { display: none; }
.quickChat button { flex-shrink: 0; background: rgba(42, 50, 54, .72); color: #fff; font-size: 12.5px; font-weight: 700; padding: 7px 11px; border-radius: 99px; }
.quickChat button:active { transform: scale(.95); background: var(--teal); }
.btn.action.thiefBtn { background: linear-gradient(90deg, #e1574a var(--rp, 0%), #c9a49f var(--rp, 0%)); box-shadow: 0 5px 0 #a83b31; opacity: 1; cursor: default; }
.btn.action.thiefBtn.rescuing { animation: pulse .6s infinite; }
.btn.action:disabled.police { opacity: .7; }
.mobilePad { left: 22px; bottom: 30px; pointer-events: none; }
.mobilePad .padBase { pointer-events: auto; opacity: .55; transition: opacity .15s; }
.mobilePad.active .padBase { opacity: 1; }
.mobilePad.run .padBase { border-color: #ffd23f; box-shadow: 0 0 0 4px rgba(255, 210, 63, .45); }
.mobilePad.run .padThumb { background: #ffd23f; }
.padHint { display: block; margin-top: 6px; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); width: 170px; }
.mobilePad.active .padHint { display: none; }
body.touch #sprintButton { display: none; }
body.touch .actionDock { width: 132px; }
body.touch .btn.action { min-height: 84px; border-radius: 22px; font-size: 20px; }
body.touch .chatLine { font-size: 12px; }
@media (max-width: 860px) {
  body.touch .actionDock { right: 14px; bottom: 26px; width: 120px; }
  body.touch .stamina span { display: none; }
}
body.touch .quickChat button { font-size: 11.5px; padding: 6px 9px; }
body.touch .emotes { gap: 5px; margin-top: 5px; }
body.touch .emotes button { width: 34px; height: 34px; font-size: 16px; border-radius: 10px; }

/* ── v3: 공개 채널 · 순위 · 이벤트 · 신고 ── */
.liveLine { display: inline-flex; align-items: center; gap: 8px; background: rgba(255, 253, 246, .92); border-radius: 99px; padding: 8px 14px; font-size: 14px; font-weight: 700; margin: 0 0 12px; box-shadow: 0 4px 14px rgba(30, 50, 70, .08); }
.liveDot { width: 9px; height: 9px; border-radius: 50%; background: #39b36b; box-shadow: 0 0 0 4px rgba(57, 179, 107, .2); animation: pulse 1.6s infinite; }
.eventBanner { background: linear-gradient(90deg, #ff7a59, #f4c542); color: #fff; border-radius: 16px; padding: 10px 14px; font-weight: 800; font-size: 14px; margin-bottom: 12px; box-shadow: 0 6px 18px rgba(232, 96, 76, .3); width: fit-content; max-width: 100%; }
.eventBanner small { display: block; font-weight: 600; opacity: .9; font-size: 12px; }
.rankCard { background: rgba(255, 253, 246, .95); border-radius: 18px; padding: 12px 14px; box-shadow: 0 6px 20px rgba(30, 50, 70, .1); max-width: 440px; }
.rankHead { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.rankHead b { font-family: var(--sign); font-weight: 400; font-size: 18px; }
.rankTabs { display: flex; gap: 4px; }
.rankTabs button { font-size: 12px; font-weight: 800; padding: 5px 9px; border-radius: 99px; color: var(--ink2); background: var(--paper2); }
.rankTabs button.on { background: var(--ink); color: #fff; }
.rankList { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.rankList li { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; padding: 5px 4px; border-bottom: 1px dashed var(--line); }
.rankList li:last-child { border-bottom: 0; }
.rankList li i { font-style: normal; width: 24px; text-align: center; }
.rankList li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rankList li em { font-style: normal; font-family: var(--sign); color: var(--coral); }
.rankList li.empty { color: var(--mute); font-weight: 600; font-size: 13px; border: 0; }
.subButtons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.btn.ghost { background: #fff; border: 1.5px solid var(--line); padding: 10px 6px; font-size: 13px; color: var(--ink); }
.btn.ghost:hover { border-color: var(--teal); }
.btn.ghost.wide { width: 100%; margin-top: 8px; }
.joinCard .btn.primary + .btn.primary { margin-top: 10px; }
.channelList { margin-top: 10px; display: grid; gap: 6px; max-height: 210px; overflow: auto; }
.channelList button { display: flex; justify-content: space-between; align-items: center; background: var(--paper2); border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 700; }
.channelList button:hover { background: #e8f6f5; }
.channelList button em { font-style: normal; font-size: 12px; color: var(--mute); font-weight: 600; }
.channelList button.full { opacity: .5; pointer-events: none; }
.channelList button.event { background: #fff1e4; }
.channelList .empty { font-size: 13px; color: var(--mute); text-align: center; padding: 8px; }
.autoLine { background: #e8f6f5; color: var(--teal-d); border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 800; margin-bottom: 12px; }
.autoLine small { display: block; font-size: 12px; font-weight: 600; color: var(--ink2); margin-top: 2px; }
.slot.clickable { cursor: pointer; }
.chatLine b[data-pid] { cursor: pointer; text-decoration: underline dotted rgba(255, 255, 255, .5); }
.modMenu { position: absolute; left: 50%; bottom: 200px; transform: translateX(-50%); z-index: 15; display: flex; align-items: center; gap: 6px; background: rgba(255, 253, 246, .98); border-radius: 16px; padding: 8px 10px; box-shadow: var(--shadow); }
.modMenu b { font-size: 14px; margin: 0 6px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modMenu button { padding: 8px 10px; border-radius: 10px; background: var(--paper2); font-weight: 800; font-size: 13px; }
.modMenu #reportButton { background: #fde3df; color: #b8443a; }
.debug { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); z-index: 30; background: rgba(0, 0, 0, .72); color: #9ff7c8; font: 12px/1.5 ui-monospace, Menlo, monospace; padding: 6px 10px; border-radius: 8px; pointer-events: none; white-space: pre; }
@media (max-width: 860px) {
  .rankCard { display: none; }
  .liveLine { font-size: 12px; padding: 6px 12px; margin-bottom: 6px; }
  .eventBanner { font-size: 12px; padding: 8px 12px; margin-bottom: 6px; }
  .modMenu { bottom: auto; top: 46%; }
}
.roleNote { text-align: left; margin: 12px 0 0; color: var(--ink2); font-weight: 600; }
#leaveButton { margin-top: 10px; color: var(--ink2); }
/* 타이틀 한 줄 */
.intro h1.oneLine { white-space: nowrap; font-size: clamp(44px, 6.2vw, 90px); }
@media (max-width: 860px) { .intro h1.oneLine { font-size: clamp(36px, 11vw, 50px); } }
.intro { flex: 1; min-width: 0; }

/* 공개 채널: 다음 판까지 남은 시간 (화면 가운데 큰 숫자) */
.bigCount { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 9; pointer-events: none; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; width: min(560px, calc(100% - 32px)); }
body:not(.lobby) .bigCount { display: none; }
.bigCount small { font-family: var(--sign); font-weight: 400; font-size: 26px; color: #fff; background: var(--teal-d); padding: 6px 18px; border-radius: 999px; box-shadow: var(--shadow); letter-spacing: .5px; }
.bigCount b { font-family: var(--sign); font-weight: 400; font-size: 150px; line-height: 1; color: var(--teal-d); text-shadow: 4px 0 0 #fff, -4px 0 0 #fff, 0 4px 0 #fff, 0 -4px 0 #fff, 3px 3px 0 #fff, -3px 3px 0 #fff, 3px -3px 0 #fff, -3px -3px 0 #fff, 0 10px 0 rgba(0, 0, 0, .12), 0 16px 30px rgba(0, 0, 0, .2); animation: countPop .45s cubic-bezier(.2, 1.6, .4, 1) both; font-variant-numeric: tabular-nums; margin-top: 4px; }
.bigCount span { font-size: 15px; font-weight: 800; color: var(--ink); background: rgba(255, 253, 246, .94); padding: 7px 14px; border-radius: 12px; box-shadow: var(--shadow); }
.bigCount span:empty { display: none; }
.bigCount.soon b { color: var(--coral); font-size: 180px; }
.bigCount.soon small { background: var(--coral); }
@keyframes countPop { 0% { transform: scale(1.4); } 100% { transform: scale(1); } }
/* 모바일: 아래쪽 대기실 패널 위 빈 화면 가운데 */
@media (max-width: 860px) {
  .bigCount { top: 21%; }
  .bigCount small { font-size: 18px; padding: 5px 14px; }
  .bigCount b { font-size: 96px; }
  .bigCount.soon b { font-size: 112px; }
  .bigCount span { font-size: 12.5px; padding: 6px 11px; }
}

/* ── v4: 모바일 최적화 ── */
:root { --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); --kb: 0px; }
html, body, #app { height: 100%; height: 100dvh; }
/* 브라우저 창 확대·드래그 선택 막기 (스크롤이 필요한 곳만 세로 스크롤 허용) */
body { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
input, textarea { -webkit-user-select: text; user-select: text; }
.joinScreen, .lobbyBody, .channelList, .resultsScreen, .resultPanel { touch-action: pan-y; }
body.touch input, body.touch .field { font-size: 16px !important; }   /* iOS: 16px 보다 작으면 입력할 때 화면이 확대됨 */

/* 상단: 💬 버튼 · 초대 링크 접기 */
.chatFab, .roomToggle, .roleChip, .chatClose { display: none; }
body.touch.inRoom .chatFab { display: grid; place-items: center; position: relative; width: 42px; height: 42px; border-radius: 14px; background: rgba(255, 253, 246, .95); box-shadow: 0 4px 14px rgba(30, 50, 70, .18); font-size: 20px; }
body.touch.chatOpen .chatFab { background: var(--teal); }
.chatFab .dot { position: absolute; top: -3px; right: -3px; width: 13px; height: 13px; border-radius: 50%; background: var(--coral); border: 2px solid #fff; }
body.touch .roomToggle { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--paper2); font-size: 15px; flex-shrink: 0; }
body.touch .roomChip { padding: 5px 6px 5px 5px; gap: 6px; }
body.touch .roomChip.folded { padding: 5px; }
body.touch .roomChip.folded > :not(.roomToggle) { display: none; }
body.touch .roomChip.folded .roomToggle { background: none; }

@media (max-width: 860px) {
  .topbar { padding: calc(var(--sat) + 10px) calc(var(--sar) + 12px) 0 calc(var(--sal) + 12px); }
  body.touch.inRoom .brand { gap: 8px; }
  body.touch.playing .brandSign { display: none; }
  .roomChip strong { font-size: 16px; letter-spacing: 2px; }

  /* 게임 중 위쪽: [💬]  [역할 · 시간 · 인원]  [🔗] / 미니맵은 오른쪽 아래에 작게 (누르면 크게) */
  body.touch .timerPill { top: calc(var(--sat) + 10px); padding: 4px 5px 4px 4px; gap: 6px; max-width: calc(100% - 128px); }
  body.touch .timerPill strong { font-size: 20px; letter-spacing: 0; }
  body.touch .timerPill .teams { gap: 4px; }
  body.touch .timerPill em { font-size: 12px; padding: 4px 7px; }
  body.touch .roleChip { display: block; font-size: 12.5px; font-weight: 800; padding: 6px 9px; border-radius: 99px; white-space: nowrap; background: #fbe4e0; color: var(--thief); }
  body.touch .roleChip.police { background: #e3ebf8; color: var(--cop); }
  body.touch .roleChip.none { background: var(--paper2); color: var(--ink2); }
  body.touch .roleCard { display: none; }
  body.touch .mapCard { top: calc(var(--sat) + 62px); right: calc(var(--sar) + 10px); padding: 4px; border-radius: 14px; transition: none; }
  body.touch #minimap { width: 92px; height: 92px; border-radius: 10px; }
  body.touch .mapCard.big #minimap { width: min(64vw, 260px); height: min(64vw, 260px); }

  /* 알림: 미니맵 왼쪽 빈 곳에 작게, 최대 2개 */
  body.touch .eventToasts { top: calc(var(--sat) + 62px); left: calc(var(--sal) + 12px); right: calc(var(--sar) + 114px); transform: none; }
  body.touch .eventToast { font-size: 12px; padding: 6px 12px; white-space: normal; text-align: center; max-width: 100%; }
  body.touch .eventToast:nth-child(n+3) { display: none; }
  body.touch .jailNotice { top: calc(var(--sat) + 136px); bottom: auto; left: calc(var(--sal) + 12px); right: calc(var(--sar) + 114px); width: auto; max-width: none; transform: none; padding: 8px 12px; gap: 8px; border-radius: 14px; }
  body.touch .jailNotice span { font-size: 20px; } body.touch .jailNotice b { font-size: 15px; } body.touch .jailNotice p { font-size: 11.5px; line-height: 1.35; }
  body.touch .centerNotice { top: 40%; padding: 12px 22px; max-width: 78vw; border-radius: 20px; }
  body.touch .centerNotice > div { font-size: 34px; } body.touch .centerNotice strong { font-size: 22px; } body.touch .centerNotice p { font-size: 13px; }
  .centerNotice:not(.hidden) ~ .jailNotice { visibility: hidden; }   /* "잡혔다!" 가 떠 있는 동안은 감옥 안내를 잠깐 숨김 */
  body.touch .toast { bottom: calc(var(--sab) + 200px); }
  body.touch .modMenu { top: 42%; bottom: auto; }

  /* 아래: 조이스틱(왼쪽) · 행동 버튼(오른쪽) 높이 맞춤 */
  body.touch .mobilePad { left: calc(var(--sal) + 18px); bottom: calc(var(--sab) + 46px); }
  body.touch .padHint { position: absolute; left: 0; top: 100%; width: 132px; margin-top: 6px; text-align: center; font-size: 11px; line-height: 1.35; }
  body.touch .mobilePad.used .padHint { display: none; }
  body.touch .actionDock { right: calc(var(--sar) + 18px); bottom: calc(var(--sab) + 70px); width: 112px; }
  body.touch .btn.action { min-height: 84px; border-radius: 24px; font-size: 19px; }
  body.touch .stamina { margin-bottom: 8px; }

  /* 대기실 패널 · 카운트다운 */
  .lobbyPanel { bottom: calc(var(--sab) + 12px); max-height: 56%; }
}

/* 채팅: 평소엔 최근 3줄만 잠깐 보였다 사라지고, 💬 를 누르면 아래에서 채팅창이 올라옴 */
body.touch .social { left: calc(var(--sal) + 12px); right: auto; top: auto; bottom: calc(var(--sab) + 210px); width: min(64vw, 320px); transform: none; pointer-events: none; z-index: 7; }
body.touch.lobby .social { top: calc(var(--sat) + 62px); bottom: auto; }
body.touch .chatLines { max-height: 58px; margin-bottom: 0; pointer-events: none; }
body.touch .chatLine { font-size: 12px; }
body.touch:not(.chatOpen) .chatLine { animation: lineFade 9s forwards; }
@keyframes lineFade { 0%, 82% { opacity: 1; } 100% { opacity: 0; } }
body.touch:not(.chatOpen) .quickChat, body.touch:not(.chatOpen) .chatForm, body.touch:not(.chatOpen) .emotes { display: none; }
body.touch.chatOpen .social { left: 0; right: 0; width: auto; top: auto !important; bottom: var(--kb); pointer-events: auto; z-index: 14; background: rgba(255, 253, 246, .98); border-radius: 22px 22px 0 0; padding: 16px calc(var(--sar) + 12px) calc(var(--sab) + 12px) calc(var(--sal) + 12px); box-shadow: 0 -10px 40px rgba(20, 40, 60, .22); animation: sheetUp .2s ease-out both; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
body.touch.chatOpen .chatClose { display: grid; place-items: center; position: absolute; top: 10px; right: calc(var(--sar) + 10px); width: 34px; height: 34px; border-radius: 50%; background: var(--paper2); font-size: 15px; font-weight: 800; color: var(--ink2); }
body.touch.chatOpen .chatLines { max-height: 112px; margin: 0 44px 10px 2px; pointer-events: auto; -webkit-mask-image: none; mask-image: none; overflow-y: auto; touch-action: pan-y; }
body.touch.chatOpen .chatLine { color: var(--ink); text-shadow: none; font-size: 13px; }
body.touch.chatOpen .chatLine b { color: var(--teal-d); }
body.touch.chatOpen .chatLine.sys { color: var(--mute); }
body.touch.chatOpen .quickChat { gap: 6px; margin-bottom: 8px; touch-action: pan-x; }
body.touch.chatOpen .quickChat button { background: var(--paper2); color: var(--ink); font-size: 13.5px; padding: 9px 13px; }
body.touch.chatOpen .emotes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 0 0 8px; }
body.touch.chatOpen .emotes button { width: auto; height: 46px; font-size: 22px; border-radius: 14px; background: var(--paper2); box-shadow: none; }
body.touch.chatOpen .chatForm { display: flex; box-shadow: none; border: 1.5px solid var(--line); background: #fff; }
body.touch.chatOpen .chatForm input { padding: 10px 6px; }
body.touch.chatOpen .mobilePad, body.touch.chatOpen .actionDock { visibility: hidden; }
body.touch.chatOpen .bigCount { display: none; }
body.touch.chatOpen .social { display: flex; flex-direction: column; }
body.touch.chatOpen .emotes { order: 3; } body.touch.chatOpen .chatForm { order: 4; }
@media (max-width: 860px) { body.touch .toast { bottom: calc(var(--sab) + 290px); } }
/* 모바일: 초대 링크를 펼치면 버튼 아래로 작은 카드가 내려옴 (시간 표시를 가리지 않게) */
@media (max-width: 860px) {
  body.touch .topRight { position: relative; width: 42px; height: 42px; }
  body.touch .roomChip { position: absolute; top: 0; right: 0; }
  body.touch .roomChip.folded { width: 42px; height: 42px; justify-content: center; }
  body.touch .roomChip:not(.folded) { flex-wrap: wrap; width: 232px; border-radius: 18px; padding: 5px 5px 10px 12px; row-gap: 8px; z-index: 11; }
  body.touch .roomChip:not(.folded) > span { display: block; order: -3; font-size: 12px; }
  body.touch .roomChip:not(.folded) strong { order: -2; flex: 1; font-size: 18px; }
  body.touch .roomChip:not(.folded) .roomToggle { order: -1; }
  body.touch .roomChip:not(.folded) .chipBtn { flex: 0 0 calc(100% - 7px); padding: 9px 12px; font-size: 13px; }
  body.touch.lobby .padHint { display: none; }
}

/* ── v4.1: 가로로 눕힌 폰 (높이가 낮은 화면) ── */
@media (orientation: landscape) and (max-height: 500px) {
  .joinScreen { flex-direction: row; align-items: flex-start; justify-content: center; padding: calc(var(--sat) + 56px) calc(var(--sar) + 16px) 16px calc(var(--sal) + 16px); gap: 16px; overflow: auto; }
  .intro { max-width: none; }
  .intro h1, .intro h1.oneLine { font-size: 40px; }
  .lead, .rankCard { display: none; }
  .joinCard { width: min(360px, 46vw); max-height: none; overflow: visible; padding: 16px; }
  .avatar img { width: 52px; height: 52px; }

  /* 대기실: 오른쪽 세로 패널 → 왼쪽 화면에 캐릭터와 카운트다운 */
  .lobbyPanel { left: auto; right: calc(var(--sar) + 10px); top: calc(var(--sat) + 56px); bottom: calc(var(--sab) + 8px); width: min(46vw, 400px); max-height: none; }
  .lobbyPanel.collapsed { bottom: auto; width: 170px; }
  .lobbyBody { padding: 10px 12px 12px; }
  .slot { min-height: 58px; } .slot img { width: 40px; height: 40px; }
  body.touch.lobby .social { top: calc(var(--sat) + 56px); width: min(40vw, 300px); }

  /* 게임 중 */
  body.touch .mapCard { top: calc(var(--sat) + 56px); }
  body.touch .eventToasts { top: calc(var(--sat) + 56px); left: 50%; right: auto; width: min(420px, 50vw); transform: translateX(-50%); }
  body.touch .jailNotice { top: auto; bottom: calc(var(--sab) + 14px); left: 50%; right: auto; width: min(380px, 48vw); transform: translateX(-50%); }
  body.touch .social { bottom: calc(var(--sab) + 196px); width: min(32vw, 280px); }
  body.touch .mobilePad { bottom: calc(var(--sab) + 40px); }
  body.touch .actionDock { bottom: calc(var(--sab) + 64px); }
  body.touch .centerNotice { top: 42%; }
  body.touch.chatOpen .social { left: 50%; right: auto; width: min(560px, 100%); transform: translateX(-50%); }
  body.touch.chatOpen .chatLines { max-height: 56px; }
  body.touch.chatOpen .emotes button { height: 38px; }
}

/* ── v5: 빠른 말 막대 · 배경음악 버튼 · 접근 경고 ── */
.resultPanel #toLobby + .fine { margin-top: 18px; }
.musicBtn { display: none; }
body.inRoom .musicBtn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 253, 246, .94); box-shadow: var(--shadow); font-size: 17px; border: 1px solid #fff; }
.musicBtn.off { opacity: .75; }
/* 빠른 말: 모바일은 왼쪽 위에 작게 항상 (채팅창을 열면 그 안에도 있음) */
.quickBar { display: none; }
body.touch.inRoom:not(.chatOpen) .quickBar { display: flex; flex-wrap: wrap; gap: 5px; position: absolute; z-index: 8; top: calc(var(--sat) + 60px); left: calc(var(--sal) + 12px); right: calc(var(--sar) + 114px); pointer-events: none; }
body.touch .quickBar button { pointer-events: auto; background: rgba(42, 50, 54, .7); color: #fff; font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 99px; line-height: 1.25; backdrop-filter: blur(4px); }
body.touch .quickBar button:active, body.touch .quickBar button.sent { background: var(--teal); transform: scale(.95); }
/* 접근 경고: 화면 가장자리가 빨갛게(경찰 접근) / 파랗게(도둑 근처) 깜빡 + 방향 화살표 */
.nearWarn { position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0; display: none; }
.nearWarn.on { display: block; }
/* 가장자리 색은 미리 그려두고 투명도만 깜빡 → 휴대폰이 화면 전체를 다시 그리지 않아도 됨 */
.nearWarn::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 52%, var(--nw, rgba(232, 50, 40, .85)) 100%); animation: nearPulse 1.1s ease-in-out infinite; will-change: opacity; }
.nearWarn.danger::after { animation-duration: .5s; }
.nearWarn.cop { --nw: rgba(232, 50, 40, .85); }
.nearWarn.thief { --nw: rgba(40, 110, 230, .8); }
@keyframes nearPulse { 50% { opacity: .4; } }
.nearTag { position: absolute; left: 0; top: 0; z-index: 9; pointer-events: none; display: none; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 99px; color: #fff; font-size: 13px; font-weight: 800; white-space: nowrap; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.nearTag.on { display: flex; }
.nearTag.cop { background: #e3463a; } .nearTag.thief { background: #2a6fe0; }
.nearTag i { font-style: normal; width: 24px; height: 24px; border-radius: 50%; background: rgba(255, 255, 255, .25); display: grid; place-items: center; font-size: 12px; }

@media (max-width: 860px) {
  /* 위쪽 줄: [💬] [시간] ...... [🎵][🔗] */
  body.touch .topRight { width: 90px; justify-content: flex-start; }
  body.touch.inRoom .musicBtn { width: 42px; height: 42px; font-size: 19px; }
  body.touch .timerPill { left: calc(var(--sal) + 62px); transform: none; max-width: calc(100% - 62px - 104px); gap: 4px; }
  body.touch .timerPill em { padding: 4px 6px; }
  body.touch .roleChip { padding: 6px 8px; }
  /* 빠른 말 막대 아래로 알림·감옥 안내·대기실 채팅을 내림 */
  body.touch .eventToasts { top: calc(var(--sat) + 122px); }
  body.touch .jailNotice { top: calc(var(--sat) + 190px); }
  body.touch.lobby .social { top: calc(var(--sat) + 122px); }
  body.touch.lobby .quickBar { right: calc(var(--sar) + 12px); }
  .nearTag { font-size: 12px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  body.touch.inRoom:not(.chatOpen) .quickBar { top: calc(var(--sat) + 56px); right: auto; width: 30vw; }
  body.touch .eventToasts { top: calc(var(--sat) + 56px); width: min(360px, 36vw); }
  body.touch .jailNotice { top: auto; }
  body.touch.lobby .social { top: calc(var(--sat) + 120px); }
  body.touch .timerPill { left: 50%; transform: translateX(-50%); max-width: none; }
}
/* 큰 터치 화면(아이패드 가로 등): 빠른 말은 왼쪽 아래 채팅 위에 */
@media (min-width: 861px) and (min-height: 501px) {
  body.touch.inRoom:not(.chatOpen) .quickBar { top: auto; bottom: calc(var(--sab) + 276px); right: auto; width: min(64vw, 340px); }
}
/* 제목 "경도" 글자: 흰 그림자를 빼서 획이 뭉치지 않고 또렷하게 */
.intro h1 .mark { text-shadow: 0 2px 0 rgba(120, 30, 20, .22); letter-spacing: .03em; padding: .02em .16em 0; margin-right: .12em; }
/* 제목 "경도": 획이 가는 Do Hyeon 글꼴로 더 또렷하게, "경도할" 붙여서 */
.intro h1 .mark { font-family: "Do Hyeon", var(--sign); font-weight: 400; text-shadow: none; letter-spacing: .01em; padding: .04em .12em 0; margin-right: .03em; }

/* 성능: 3D 화면 위의 흐림(blur) 효과는 매 프레임 다시 계산돼서 휴대폰에서 끊김을 만듦 → 끄고 조금 더 불투명한 배경으로 */
.chip, .padBase, .quickBar button, .resultsScreen, body.touch .quickBar button { -webkit-backdrop-filter: none; backdrop-filter: none; }
.chip { background: rgba(255, 253, 246, .96); }
.padBase { background: rgba(255, 255, 255, .42); }
body.touch .quickBar button { background: rgba(42, 50, 54, .78); }
.resultsScreen { background: rgba(30, 45, 55, .58); }
.nearTag { will-change: transform; }
/* 중간 폭 PC 창(861~1180px): 오른쪽 위 버튼들과 겹치지 않게 시간 표시를 한 줄 아래로 */
@media (min-width: 861px) and (max-width: 1180px) {
  body:not(.touch) .timerPill { top: 76px; }
  body:not(.touch) .eventToasts { top: 136px; }
}

/* 첫 화면 아래 가운데: © The VISL / For Leah */
.credit { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--sab) + 12px); width: max-content; text-align: center; font-size: 12px; line-height: 1.6; font-weight: 700; letter-spacing: .04em; color: rgba(42, 50, 54, .78); text-shadow: 0 0 6px rgba(255, 253, 246, .95), 0 1px 0 #fff; pointer-events: none; }
@media (max-width: 860px) {
  .credit { position: static; transform: none; width: 100%; flex-shrink: 0; padding: 6px 0 calc(var(--sab) + 4px); }
}
@media (orientation: landscape) and (max-height: 500px) {
  .joinScreen { flex-wrap: wrap; }
  .credit { position: static; transform: none; flex-basis: 100%; padding: 4px 0 8px; }
}

/* 첫 화면: 친구 방 코드로 입장 */
.codeRow { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin-top: 12px; padding: 10px; background: var(--paper2); border-radius: 14px; }
.codeLabel { font-size: 13px; font-weight: 800; color: var(--ink2); white-space: nowrap; }
.codeRow .field { height: 40px; font-family: var(--sign); font-weight: 400; font-size: 18px; letter-spacing: .18em; text-transform: uppercase; text-align: center; padding: 0 8px; min-width: 0; }
.codeRow .field::placeholder { font-family: var(--body); font-size: 13px; letter-spacing: 0; color: #b3ad9f; }
.codeBtn { height: 40px; padding: 0 16px; background: var(--teal); color: #fff; font-size: 14px; box-shadow: 0 3px 0 var(--teal-d); }
.codeMsg { margin: 6px 2px 0; font-size: 12px; font-weight: 700; color: var(--teal-d); min-height: 0; }
.codeMsg:empty { display: none; }
.codeMsg.err { color: #c2402f; }
@media (max-width: 400px) { .codeRow { grid-template-columns: 1fr auto; } .codeLabel { grid-column: 1 / -1; } }

.roomCodeBig { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px; background: #fff3d6; border-radius: 14px; }
.roomCodeBig span { font-size: 12px; font-weight: 800; color: var(--ink2); line-height: 1.3; flex: 1; }
.roomCodeBig b { font-family: var(--sign); font-weight: 400; font-size: 24px; letter-spacing: .14em; color: var(--ink); }

/* ── v6: 설정 패널 · 친구 초대 팝업 · 조이스틱 위치 ── */
.settingsPanel { position: absolute; z-index: 16; top: calc(var(--sat) + 64px); right: calc(var(--sar) + 12px); width: min(320px, calc(100% - 24px)); padding: 14px 16px 16px; }
.setHead { display: flex; justify-content: space-between; align-items: center; }
.setHead b { font-family: var(--sign); font-weight: 400; font-size: 20px; }
.setHead button { width: 30px; height: 30px; border-radius: 50%; background: var(--paper2); font-weight: 800; color: var(--ink2); }
.setRow { margin-top: 16px; display: grid; gap: 8px; }
.setRow > b { font-size: 13px; }
.setRow small { font-size: 11.5px; color: var(--mute); }
.setRow .segmented button { padding: 10px 0; }
body:not(.touch) .touchOnly { display: none; }
.slot.invite { cursor: pointer; flex-direction: column; gap: 0; border: 1.5px dashed #d8d1c0; color: var(--teal-d); font-weight: 800; transition: background .15s; }
.slot.invite small { font-size: 10.5px; color: var(--teal-d); font-weight: 800; margin-top: -2px; }
.slot.invite:hover, .slot.invite:active { background: #e8f6f5; border-color: var(--teal); }
.invitePop { position: absolute; inset: 0; z-index: 18; display: grid; place-items: center; background: rgba(30, 45, 55, .45); padding: 16px; }
.invitePanel { position: relative; width: min(360px, 100%); padding: 22px 20px 20px; text-align: center; animation: popIn .2s both; }
.inviteX { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; background: var(--paper2); font-weight: 800; color: var(--ink2); }
.inviteIcon { font-size: 34px; }
.invitePanel small { display: block; font-size: 12px; font-weight: 800; color: var(--ink2); margin-top: 4px; }
.invitePanel b { display: block; font-family: var(--sign); font-weight: 400; font-size: 46px; letter-spacing: .18em; padding-left: .18em; color: var(--ink); margin: 2px 0 6px; user-select: text; -webkit-user-select: text; }
.invitePanel p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--teal-d); font-weight: 700; }
.invitePanel .btn.primary { margin-top: 14px; font-size: 18px; min-height: 50px; }
@keyframes popIn { from { opacity: 0; transform: scale(.94); } }

/* 조이스틱 위치: 가운데 / 오른쪽(이때 구출·대시 버튼은 왼쪽으로) */
body.touch.pad-center .mobilePad { left: calc(50% - 66px); }
body.touch.pad-right .mobilePad { left: auto; right: calc(var(--sar) + 18px); }
body.touch.pad-right .actionDock { right: auto; left: calc(var(--sal) + 18px); }
@media (orientation: landscape) and (max-height: 500px) {
  body.touch.pad-center .jailNotice { top: calc(var(--sat) + 104px); bottom: auto; }
}
body.touch.pad-center .mobilePad { left: calc(50% - 59px); }
body.touch.pad-center .padBase { width: 118px; height: 118px; }
body.touch.pad-center .padHint { width: 118px; }
body.touch.pad-center .actionDock { width: 96px; }
body.touch.pad-center .btn.action { font-size: 17px; }
@media (max-width: 380px) { body.touch.pad-center .actionDock { right: calc(var(--sar) + 10px); width: 88px; } body.touch.pad-center .btn.action { font-size: 16px; } }
