/* 둘이서 한판: 공용 /common/nin.css(토큰·카드·알약·입력칸·모달) 다음에 읽는다.
   메뉴 화면은 다른 Gamepio 게임과 같은 클래스·배치(.screen.nin · .card · #lobby-players …)에 커버(cover.svg)의 줄 공책 낙서 화풍을 입힌다:
   미색 종이 · 파란 가로줄 · 빨간 여백선 · 바인더 구멍 배경, 손글씨 로고 + 빨강/파랑 펜 밑줄, 손으로 그린 듯 들쭉날쭉한 볼펜 테두리 카드·알약(마스킹 테이프),
   HUD 는 스티커(이름) · 형광펜 띠(라운드 · 시간 · 안내). 빨강 #e63946 = seat 0 · 파랑 #3a86ff = seat 1 · 볼펜 남색 #1f3a93.
   게임 화면(#hud)은 화면 가득 2D 캔버스(#stage — 16×9 월드 letterbox, 월드 사각형은 --wx · --wy · --ww · --wh) 위에
   위 가운데 점수판(.board: 이름 · 큰 점수 · 이름) · 라운드 · 남은 초, 오른쪽 위 모드 · 나가기, 소개 카드 #intro, 안내 알약 #hint,
   같은 기기 둘이서 좌/우 절반(#halves), 연출 층(#fx), 라운드 승자 색 번쩍임(#flash). 세로 화면은 점수판을 위 여백, 소개 카드를 아래 여백에 둔다
   (혼자 · 온라인 세로 화면은 #hud.port 세로 전용 배치 — 월드가 화면 높이를 채우고 카메라가 따라간다) */
:root {
  /* 팔레트 (커버): 공책 종이 · 가로줄 · 여백선 · 구멍, 볼펜 남색 · 연필 먹, 빨간 펜 · 파란 펜 · 형광펜 노랑 */
  --p-paper: #fdfbf2; --p-rule: #a9cbe8; --p-margin: #e88f8f; --p-hole: #e9e4d6; --p-pen: #1f3a93; --p-lead: #222;
  --p-red: #e63946; --p-blue: #3a86ff; --p-hl: #ffe066;
  --hand: "Comic Sans MS", "Chalkboard SE", "Marker Felt", "Segoe Print", var(--ui), cursive;
  --sketch: 255px 14px 225px 16px / 16px 225px 14px 255px;   /* 손으로 그린 사각 테두리 (들쭉날쭉 모서리) */
  --red: var(--p-red); --red-d: #a3202c;      /* 주 버튼(다음 ▶ · 혼자 하기 · 시작) = seat 0 빨간 펜 */
  --blue: var(--p-blue); --blue-d: #2459b8;   /* 보조(방 만들기 · 입력칸 테두리) = seat 1 파란 펜 */
  --yellow: var(--p-hl); --yellow-d: #c9a514;
  --purple: #7a4cff; --purple-d: #5330c4;
  --sky1: var(--p-paper); --sky2: var(--p-paper);
  --shade: #1f3a9333; --shade-far: #1f3a9322;
  --txt-sh: transparent;
  --card-sh: 3px 4px 0 #1f3a9326;
  --cream: var(--p-paper); --deep: var(--p-lead); --ink: var(--p-lead);
  --logo: var(--hand);
  /* 공책 종이: 바인더 구멍(왼쪽) · 빨간 여백선 · 파란 가로줄 */
  --notebook:
    radial-gradient(circle at 26px 70px, var(--p-hole) 0 9px, transparent 10px) 0 0 / 52px 150px repeat-y,
    linear-gradient(90deg, transparent 62px, var(--p-margin) 62px 64px, transparent 64px),
    repeating-linear-gradient(180deg, transparent 0 33px, var(--p-rule) 33px 34px),
    var(--p-paper);
}
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: var(--p-paper); color: var(--p-lead);
  font-family: ui-rounded, "Arial Rounded MT Bold", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-user-select: none; user-select: none; touch-action: none;
}
.hidden { display: none !important; }
.pill.purple { --bg: var(--purple); --sh: var(--purple-d); }

/* ---------- 게임 화면 ---------- */
#hud { position: fixed; inset: 0; overflow: hidden; background: #e9e4d6; touch-action: none; cursor: pointer; -webkit-touch-callout: none; --wy: 0px; --wh: 100vh; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* 위 가운데 점수판: 🔴 이름 · 2 : 1 · 이름 🔵 (가로 화면은 월드 위에 얹고, 세로 화면은 위 여백 가운데) */
.hud-top {
  position: absolute; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 3; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; font-family: var(--ui); color: var(--p-lead); max-width: calc(100% - 20px);
}
.board { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto minmax(0, 1fr); align-items: center; gap: 10px; width: min(640px, calc(100vw - 20px)); }
/* 이름: 살짝 기운 스티커 (흰 종이 + 자리 색 볼펜 테두리) */
.pn { font-size: 18px; padding: 2px 12px; border-radius: var(--sketch); background: #fff; color: var(--c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 2.5px solid var(--c); box-shadow: 2px 3px 0 #1f3a9326; }
.pn.s0 { --c: var(--red); justify-self: end; rotate: -2deg; } .pn.s1 { --c: var(--blue); justify-self: start; rotate: 2deg; }
.pn:empty { visibility: hidden; }
/* 점수: 펜으로 크게 쓴 숫자 (흰 종이 테두리로 줄 위에서도 또렷하게) */
.sc { font-family: var(--hand); font-weight: 700; font-size: 62px; line-height: 1; -webkit-text-stroke: 6px #fff; paint-order: stroke fill; display: inline-block; min-width: .7em; text-align: center; }
.sc.s0 { color: var(--red); } .sc.s1 { color: var(--blue); }
.sc.bump { animation: bump .45s ease-out; }
.colon { font-style: normal; font-family: var(--hand); font-size: 44px; color: var(--p-pen); -webkit-text-stroke: 5px #fff; paint-order: stroke fill; }
@keyframes bump { 30% { transform: scale(1.5); } }
.hud-sub { display: flex; gap: 8px; margin-top: 4px; }
/* 라운드 · 남은 초: 형광펜으로 그은 띠 */
#hud-round, #hud-time { font-size: 15px; padding: 1px 12px; border-radius: 3px 8px 4px 9px; color: var(--p-lead); background: linear-gradient(176deg, transparent 12%, #ffe066d0 14% 88%, transparent 90%); white-space: nowrap; }
#hud-round:empty { display: none; }
#hud-time.low { background: linear-gradient(176deg, transparent 12%, #ff8a95d0 14% 88%, transparent 90%); animation: throb .5s ease-in-out infinite alternate; }
@keyframes throb { to { transform: scale(1.08); } }
.hud-opts { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 10px; z-index: 4; display: flex; align-items: center; gap: 8px; }
#hud-mode { font-family: var(--ui); font-size: 11px; color: var(--p-pen); background: #fff; border: 1.5px solid var(--p-pen); border-radius: var(--sketch); padding: 2px 10px; white-space: nowrap; }
.hud-leave { margin: 0; }
/* 라운드 소개 카드: 그림 · 라운드 · 미니 이름(큰 글씨) · 한 줄 조작법 · 줄어드는 막대 (2초) */
#intro {
  position: absolute; left: 50%; top: calc(var(--wy) + var(--wh) * .56); transform: translate(-50%, -50%); z-index: 5; pointer-events: none;
  width: min(460px, calc(100vw - 32px)); padding: 14px 22px 18px; border-radius: var(--sketch); text-align: center;
  background: var(--notebook); color: var(--deep); border: 2.5px solid var(--p-pen); box-shadow: 4px 5px 0 #1f3a9330, 0 16px 40px #1f3a9340;
  font-family: var(--ui); animation: popin .35s cubic-bezier(.2, 1.4, .4, 1);
}
/* 마스킹 테이프 (소개 카드 · 이름 카드 · 창 위 가운데) */
#intro::before, #title .card::before, .modal .card::before, .fx-banner::before {
  content: ""; position: absolute; left: 50%; top: -12px; width: 96px; height: 24px; translate: -50% 0; rotate: -4deg; pointer-events: none;
  background: repeating-linear-gradient(90deg, #ffe066b0 0 6px, #ffe066c8 6px 12px); box-shadow: 0 1px 2px #0002;
}
#intro .ic { font-size: 54px; line-height: 1.1; }
#intro .ir { font-size: 15px; color: var(--p-pen); }
#intro .in { font-family: var(--hand); font-weight: 700; font-size: clamp(30px, 7vmin, 44px); line-height: 1.15; color: var(--p-lead); word-break: keep-all; text-decoration: underline wavy var(--p-red); text-decoration-thickness: 2px; text-underline-offset: 8px; }
#intro .ih { font-size: 18px; line-height: 1.35; margin-top: 6px; word-break: keep-all; }
#intro .bar { display: block; height: 7px; margin-top: 12px; border-radius: 4px; background: #1f3a931c; overflow: hidden; }
#intro .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--blue)); animation: drain 2s linear forwards; }
@keyframes drain { from { width: 100%; } to { width: 0; } }
@keyframes popin { from { transform: translate(-50%, -50%) scale(.5); opacity: 0; } }
/* 안내 알약 (혼자 · 온라인, 처음 몇 초) */
#hint {
  position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 5; pointer-events: none;
  max-width: calc(100% - 32px); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: #fff linear-gradient(176deg, transparent 10%, #ffe066d8 12% 90%, transparent 92%); color: var(--deep); border: 2px solid var(--p-pen); border-radius: var(--sketch); padding: 5px 18px;
  font-family: var(--ui); font-size: 17px; box-shadow: 3px 4px 0 #1f3a9330; animation: hint-pulse 1s ease-in-out infinite alternate;
}
@keyframes hint-pulse { to { transform: translateX(-50%) scale(1.05); } }
/* 같은 기기 둘이서: 좌/우 절반 (누르면 자리 색으로 밝아짐), 아래 귀퉁이에 A · L 안내 */
#halves { position: absolute; inset: 0; z-index: 2; display: flex; pointer-events: none; }
.half { flex: 1; display: flex; align-items: flex-end; padding: 0 12px max(16px, env(safe-area-inset-bottom)); transition: background .08s; }
.half.r { justify-content: flex-end; }
.half span { font-family: var(--ui); font-size: 16px; color: var(--c); background: #fff; border: 2.5px solid var(--c); border-radius: var(--sketch); padding: 3px 14px; white-space: nowrap; box-shadow: 2px 3px 0 #1f3a9326; }
.half.l { --c: var(--red); } .half.r { --c: var(--blue); }
.half.on { background: linear-gradient(transparent 40%, color-mix(in srgb, var(--c) 35%, transparent)); }
.half.on span { background: var(--c); color: #fff; }
#toast {
  position: absolute; left: 50%; top: 120px; transform: translateX(-50%); pointer-events: none; white-space: nowrap; z-index: 5;
  background: #fff; color: var(--deep); border: 2px solid var(--p-pen); border-radius: var(--sketch); padding: 3px 16px; font-family: var(--ui); font-size: 16px; opacity: 0; transition: opacity .25s;
}
#toast.show { opacity: 1; }
/* 라운드 승자 색 번쩍임 */
#flash { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; background: radial-gradient(circle, transparent 35%, var(--c, #fff)); }
#flash.on { animation: flash .8s ease-out; }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }

/* 연출 층 (fx.js): 둥근 배너 · +1 팝업 */
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.fx-banner {
  position: absolute; left: 50%; top: calc(var(--wy) + var(--wh) * .5); min-width: min(70vw, 260px); max-width: 90vw; border-radius: var(--sketch);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; padding: 14px 30px 16px;
  background: #fff; border: 3px solid var(--p-pen); box-shadow: 5px 6px 0 #1f3a9330, 0 16px 40px #1f3a9333;
  color: var(--p-lead); font-family: var(--ui); transform: translate(-50%, -50%);
  animation: slam var(--dur, 1.4s) cubic-bezier(.2, 1.4, .4, 1) forwards;
}
/* 스티커 배너: 흰 종이에 자리 색 펜 글씨 + 형광펜 칠 */
.fx-banner.s0 { color: var(--red); border-color: var(--red); background: #fff linear-gradient(176deg, transparent 8%, #ffd6da 10% 90%, transparent 92%); }
.fx-banner.s1 { color: var(--blue); border-color: var(--blue); background: #fff linear-gradient(176deg, transparent 8%, #d9e7ff 10% 90%, transparent 92%); }
.fx-banner.go { background: #fff linear-gradient(176deg, transparent 8%, #ffe066d8 10% 90%, transparent 92%); }
.fx-banner.gold { background: #fff linear-gradient(176deg, transparent 8%, #ffd23f 10% 90%, transparent 92%); color: #5a3a06; }
.fx-banner .ic { font-size: 50px; line-height: 1.1; }
.fx-banner .big { font-family: var(--hand); font-weight: 700; font-size: clamp(28px, 7vmin, 46px); line-height: 1.1; word-break: keep-all; }
.fx-banner .sub { font-size: clamp(14px, 3.2vmin, 18px); opacity: .95; }
@keyframes slam {
  0% { transform: translate(-50%, -50%) scale(2) rotate(-12deg); opacity: 0; }
  14% { transform: translate(-50%, -50%) scale(.94) rotate(2deg); opacity: 1; }
  22%, 80% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(.6); opacity: 0; }
}
.fx-pop { position: absolute; transform: translate(-50%, -50%); font-family: var(--hand); font-weight: 700; font-size: 46px; color: var(--p-lead); -webkit-text-stroke: 6px #fff; paint-order: stroke fill; white-space: nowrap; animation: pop 1s ease-out forwards; filter: drop-shadow(2px 3px 0 #1f3a9333); }

.fx-pop.s0 { color: var(--red); } .fx-pop.s1 { color: var(--blue); }
@keyframes pop {
  0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; }
  20% { transform: translate(-50%, -20%) scale(1.4); opacity: 1; }
  100% { transform: translate(-50%, 40%) scale(1); opacity: 0; }
}

/* 세로 화면: 월드 위 여백에 점수판, 아래 여백에 소개 카드 (여백이 넉넉할 때) */
@media (orientation: portrait) {
  .hud-top { top: max(calc(env(safe-area-inset-top) + 56px), calc(var(--wy) / 2 - 30px)); }
  .board { grid-template-columns: 1fr auto auto auto 1fr; gap: 6px; }
  .pn { font-size: 14px; padding: 2px 8px; border-width: 2px; }
  #intro { top: calc(var(--wy) + var(--wh) + max(var(--wy) / 2, 110px)); }
}
/* 세로 전용 배치(#hud.port — render.js 가 붙인다, 같은 기기 둘이서는 아님): 월드가 점수판 아래 ~ 안내 알약 위를 채우니
   점수판은 화면 위(나가기 버튼 아래)에 고정, 소개 카드는 월드 가운데 */
#hud.port .hud-top { top: calc(env(safe-area-inset-top) + 56px); }
#hud.port #intro { top: calc(var(--wy) + var(--wh) * .5); }
/* ══ 메뉴 화면: 닌텐도풍 (둥근 알약 버튼, 흰 카드) ══ */
.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  overflow-y: auto; text-align: center; padding: 20px 16px; z-index: 10;
}
.screen.nin, .modal { font-family: var(--ui); text-shadow: none; color: var(--p-lead); line-height: 2; touch-action: manipulation; }
/* 배경: 줄 공책 한 장 (구멍 · 여백선 · 가로줄) */
.screen.nin { background: var(--notebook); }
.modal { background: #1f3a9340; }

/* 로고: 커버처럼 연필 손글씨(살짝 기울임) + 빨간 펜 · 파란 펜 두 줄 밑줄 낙서, 위에 볼펜 막대 인형(인라인 SVG) */
.logo-wrap { position: relative; margin: 4px 0 6px; max-width: 100%; padding-bottom: 16px; }
.logo-wrap::after {
  content: ""; position: absolute; left: 6%; right: 6%; bottom: 0; height: 18px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 18' preserveAspectRatio='none'%3E%3Cpath d='M4,6C60,1 180,2 236,6' stroke='%23e63946' stroke-width='3.5' fill='none' stroke-linecap='round' opacity='.85'/%3E%3Cpath d='M12,13C80,9 170,10 230,14' stroke='%233a86ff' stroke-width='3' fill='none' stroke-linecap='round' opacity='.8'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.logo-ic { width: 168px; height: 80px; line-height: 0; animation: hopRun .5s ease-in-out infinite alternate; display: inline-block; }
.logo-ic svg { width: 100%; height: 100%; display: block; overflow: visible; }
@keyframes hopRun { from { transform: rotate(-4deg); } to { transform: translateY(-4px) rotate(3deg); } }
.logo {
  font-family: var(--hand); font-weight: 700; font-size: 88px; line-height: 1.08; letter-spacing: 3px; color: var(--p-lead);
  text-shadow: 1px 1px 0 #2228, -1px 0 0 #2224; transform: rotate(-2deg);
}
.logo span { display: inline-block; transform: rotate(3deg) translateY(4px); }
.tagline { font-size: 21px; margin: 34px 0; }
.tagline b { font-weight: normal; color: var(--p-lead); background: linear-gradient(176deg, transparent 18%, #ffe066c8 20% 88%, transparent 90%); padding: 0 4px; }

/* 카드: 흰 공책 쪽지 — 연한 모눈 + 손으로 그린 볼펜 테두리 + 연필 그림자, 위에 마스킹 테이프 */
.card {
  position: relative; color: var(--p-lead); border: 2.5px solid var(--p-pen); border-radius: 20px 6px 24px 8px / 8px 24px 6px 20px;
  background: repeating-linear-gradient(0deg, #a9cbe833 0 1px, transparent 1px 22px), repeating-linear-gradient(90deg, #a9cbe833 0 1px, transparent 1px 22px), #fffef8;
}
#title .card { rotate: -1deg; }
.nin .card, .modal .card {
  box-shadow: var(--card-sh);
  display: flex; flex-direction: column; align-items: center; width: 400px; max-width: 100%;
}
.card-title { margin-bottom: 10px; font-family: var(--hand); font-weight: 700; }
.nin-input { font-size: 22px; padding: 12px 16px; margin-bottom: 10px; background: #fff; border: 2px solid var(--p-pen); border-radius: var(--sketch); }
.nin-input:focus { border-color: var(--p-red); background: #fff; }
select.nin-input { background-color: #fff; }
/* 알약: 손으로 그린 테두리 + 마커 칠 + 어긋난 연필 그림자 (눌리면 그림자 쪽으로) */
.pill { margin: 14px 0; border: 2.5px solid var(--p-lead); border-radius: var(--sketch); box-shadow: 4px 4px 0 var(--p-lead); }
.pill:hover { box-shadow: 5px 6px 0 var(--p-lead); }
.pill:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--p-lead); }
.pill.white { --bg: #fff; color: var(--p-lead); }
.pill.yellow { color: var(--p-lead); }
.pill.hud-leave { box-shadow: 2px 2px 0 var(--p-lead); }
.pill.hud-leave:hover { box-shadow: 3px 3px 0 var(--p-lead); }
.pill.hud-leave:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--p-lead); }
.pill.big { font-size: 26px; padding: 14px 0; }
.screen > .pill.big { width: 340px; max-width: 100%; }
.link { font-size: 21px; padding: 11px 30px; min-height: 50px; margin-top: 16px; color: var(--p-pen); background: #fffef8; border: 2px dashed var(--p-pen); border-radius: var(--sketch); box-shadow: none; }
.link:hover { background: #fff; box-shadow: 2px 3px 0 #1f3a9333; }
.link:active { box-shadow: none; }
.card .link, .modal .link { color: var(--p-pen); background: #fff; border-color: var(--p-pen); box-shadow: none; }
.msg { min-height: 22px; margin-top: 20px; color: var(--red-d); font-size: 17px; }
.card .msg { color: var(--red-d); }
#name-msg { margin-top: 10px; }
#name-msg:empty { display: none; }
.controls { font-size: 15px; opacity: .9; color: var(--p-pen); }
.controls b { font-weight: normal; color: var(--p-red); }

/* 방 목록 위 인사 한 줄: 안녕, 이름! · ◀ 닉네임 바꾸기 · ℹ️ 게임 소개 */
.hello.small { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 14px; font-size: 22px; line-height: 1.4; margin: -10px 0 10px; }
.hello b { font-weight: normal; color: var(--p-red); }
.hello .link { font-size: 15px; padding: 4px 14px; min-height: 0; margin: 0; box-shadow: 0 3px 0 var(--shade); }
#rooms > .pill.big { margin: 8px 0; }
.nin h2 {
  font-family: var(--hand); font-weight: 700; font-size: 46px; line-height: 1.15; margin: 0 0 28px; color: var(--p-lead); padding: 0 10px;
  background: linear-gradient(176deg, transparent 52%, #ffe066c0 54% 90%, transparent 92%); rotate: -1.5deg;
}

/* 방 목록 위 내 전적 한 줄 */
.best-line { font-size: 17px; line-height: 1.4; margin: 0 0 12px; padding: 2px 16px; border-radius: var(--sketch); background: #fff; border: 2px solid var(--p-pen); color: var(--p-pen); rotate: 1deg; }

/* 방 목록 */
#room-list { width: 520px; max-height: 34vh; overflow-y: auto; gap: 20px; padding: 14px; margin-bottom: 12px; }
#room-list .empty { color: #6b7280; padding: 18px 0; font-size: 18px; }
#room-list button.room {
  font: inherit; color: var(--ink); cursor: pointer; width: 100%; display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center;
  text-align: left; font-size: 19px; padding: 12px 16px; border: 2px solid var(--p-pen); border-radius: var(--sketch); background: #fff;
  box-shadow: 3px 3px 0 #1f3a9333; transition: transform .08s;
}
#room-list button.room:hover { border-color: var(--red); transform: translateY(-2px); }
#room-list button.room.full { opacity: .5; cursor: default; transform: none; }
#room-list .rname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#room-list .rhost { font-size: 15px; color: #6b7280; }
#room-list .rcount { font-size: 16px; color: #fff; background: var(--blue); border-radius: var(--sketch); padding: 3px 10px; text-align: center; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0 28px; font-size: 19px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); }

/* 로비 */
.room-title { font-size: 28px; margin-bottom: 18px; font-family: var(--hand); }
.lobby-hint { font-size: 15px; opacity: .95; }
.invite { display: flex; gap: 12px; margin: 28px 0 34px; width: 640px; max-width: 100%; }
.inv-code, .inv-link {
  font: inherit; color: var(--ink); cursor: pointer; border: 2.5px solid var(--p-pen); border-radius: var(--sketch); background: #fff;
  box-shadow: 4px 4px 0 #1f3a9333; padding: 10px 16px; display: flex; flex-direction: column; align-items: center; gap: 9px;
  transition: transform .08s, box-shadow .08s;
}
.inv-code:hover, .inv-link:hover { transform: translateY(-2px); box-shadow: 5px 6px 0 #1f3a9333; border-color: var(--p-red); }
.inv-code:active, .inv-link:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #1f3a9333; }
.inv-label { font-size: 14px; color: #6b7280; }
.inv-code b { font-family: var(--logo); font-weight: 700; font-size: 46px; letter-spacing: 8px; line-height: 1.1; color: var(--red); }
.inv-link { flex: 1; min-width: 0; }
#lobby-link-text { font-size: 20px; color: var(--blue-d); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-copy { font-size: 15px; color: #fff; background: var(--blue); border-radius: 999px; padding: 3px 14px; margin-top: 4px; }
.copied .inv-copy, .inv-code.copied .inv-label { background: var(--red); color: #fff; border-radius: 999px; padding: 3px 14px; }
/* 2칸 (왼쪽 빨강 · 오른쪽 파랑): 국기 · 이름, 연결 중 칸(깜빡임), 빈 칸은 점선(AI 가 채운다) */
#lobby-players { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; width: 520px; max-width: 100%; }
#lobby-players .pl.t0 { --c: var(--red); } #lobby-players .pl.t1 { --c: var(--blue); }
#lobby-players .pl {
  font-size: 20px; line-height: 1.5; padding: 10px 14px; border-radius: var(--sketch); background: var(--c); color: #fff; border: 2.5px solid var(--p-lead);
  box-shadow: 4px 4px 0 var(--p-lead); text-shadow: 0 1px 0 rgba(0,0,0,.25); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#lobby-players .pl.me { outline: 3px solid var(--ink); outline-offset: 2px; }
#lobby-players .pl.empty, #lobby-players .pl.pending { background: #fffef8; color: var(--p-pen); border: 2.5px dashed var(--p-pen); box-shadow: none; text-shadow: none; }
#lobby-players .pl.pending { color: var(--p-lead); animation: pl-pulse 1.2s ease-in-out infinite; }
@keyframes pl-pulse { 50% { opacity: .5; } }
#lobby-status { margin: 24px 0 14px; font-size: 18px; }

/* 결과: 승/패 · 큰 점수 "5 : 3" · 두 사람 줄(자리 색 · 국기 이름 · 점수) · 내 전적 (.rrow.solo) */
.res-hero { font-size: 70px; line-height: 1.1; }
.res-title { font-family: var(--hand); font-weight: 700; font-size: 46px; line-height: 1.3; color: var(--p-lead); text-decoration: underline wavy var(--c, var(--p-pen)); text-decoration-thickness: 2px; text-underline-offset: 10px; }
.res-score { display: flex; align-items: center; gap: 14px; font-family: var(--hand); font-weight: 700; font-size: 72px; line-height: 1.1; -webkit-text-stroke: 6px #fff; paint-order: stroke fill; }
.res-score .s0 { color: var(--red); } .res-score .s1 { color: var(--blue); } .res-score i { font-style: normal; color: var(--p-pen); font-size: 52px; }
#res-table { width: 460px; margin: 14px 0 22px; gap: 8px; line-height: 1.4; }
.rrow { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; color: var(--ink); font-size: 20px; padding: 6px 12px; border-radius: 4px; background: transparent; border-left: 5px solid var(--c, var(--p-pen)); border-bottom: 1.5px dashed #a9cbe8; box-sizing: border-box; }
.rrow.solo { grid-template-columns: minmax(0, 1fr) auto; font-size: 17px; }
.rrow.win { background: linear-gradient(176deg, transparent 10%, #ffe066b0 12% 88%, transparent 90%); outline: none; }
.rrow.me .rn::after { content: " ✦"; color: var(--red); }
.rrow .rk { font-size: 20px; text-align: center; }
.rrow .rn { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .rv { font-size: 20px; color: var(--deep); white-space: nowrap; }
#res-hint { font-size: 18px; margin: -12px 0 14px; }
.res-row { display: flex; gap: 12px; justify-content: center; flex-wrap: nowrap; margin: 12px 0; }
.res-row .pill { margin: 0; font-size: 22px; padding: 14px 30px; }

/* 모달 */
.modal .card { animation: popin2 .25s cubic-bezier(.3, 1.5, .5, 1); }
#lang-list { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-bottom: 6px; }
#lang-list .pill { margin: 0; }
.lang-opt.on { --bg: var(--yellow); --sh: var(--yellow-d); color: var(--ink); }

/* 이용약관·개인정보처리방침: 타이틀 화면 오른쪽 아래 구석 */
.legal-links .ll { display: inline-block; white-space: nowrap; }
#title .legal-links { text-align: right; position: absolute; right: 14px; bottom: 10px; margin: 0; color: #1f3a93b0; font-size: 13px; line-height: 1.5; }
#title .privacy-link { color: #1f3a93b0; text-decoration: underline; }
#title .privacy-link:hover { color: var(--p-pen); }

/* 구석 버튼: 오른쪽 위 언어, 왼쪽 위 Gamepio 홈 · 계정 (포털 아래에서만) */
.corner { position: absolute; top: 14px; right: 14px; margin: 0; z-index: 3; }
.corner-l { position: absolute; top: 14px; left: 14px; z-index: 3; display: flex; gap: 8px; max-width: calc(100% - 180px); }
.corner-l .pill { margin: 0; white-space: nowrap; }
#account-btn { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* 낮은 화면(1280×720 등): 타이틀·방 목록·로비가 스크롤 없이 */
@media (min-width: 641px) and (max-height: 799px) {
  #title { line-height: 1.5; } #title .logo { font-size: 76px; } #title .tagline { margin: 10px 0 14px; } #title .card { padding: 14px 20px; }
  #title .pill { margin: 8px 0; } #title .nin-input { margin-bottom: 8px; } #name-msg { line-height: 1.4; }
  #rooms h2 { margin-bottom: 12px; font-size: 36px; } #rooms > .pill.big { margin: 4px 0; font-size: 21px; padding: 8px 0; } #room-list { max-height: 20vh; padding: 10px; margin-bottom: 6px; }
  .res-hero { font-size: 50px; } .res-score { font-size: 56px; } #res-table { margin: 8px 0 12px; }
  #lobby h2 { margin-bottom: 8px; } .room-title { margin-bottom: 6px; } .invite { margin: 12px 0 16px; } #lobby-players { gap: 10px; } #lobby .lobby-hint { line-height: 1.6; } #lobby-status { margin: 12px 0 8px; }
}
@media (max-width: 640px) {
  .logo { font-size: 54px; }
  .logo-ic { width: 100px; height: 48px; }
  .logo-wrap { padding-bottom: 0; } .logo-wrap::after { bottom: -8px; height: 14px; }
  #title .card { padding: 14px 16px; } #title .pill { margin: 10px 0; } #title .nin-input { margin-bottom: 8px; }
  .tagline { font-size: 17px; margin: 24px 0; }
  .nin h2 { font-size: 32px; }
  .link { font-size: 18px; padding: 10px 24px; min-height: 46px; }
  #room-list button.room { font-size: 15px; }
  .invite { flex-direction: column; }
  .inv-code b { font-size: 38px; }
  #lobby-link-text { font-size: 15px; }
  #lobby-players { gap: 10px; }
  #lobby-players .pl { font-size: 15px; padding: 8px 10px; }
  .res-title { font-size: 32px; }
  #res-table { width: 100%; }
  .rrow { font-size: 16px; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 6px; padding: 5px 8px; }
  .res-row { gap: 7px; } .res-row .pill { font-size: 17px; padding: 12px 18px; }
  .corner.pill, .corner-l .pill { font-size: 13px; padding: 7px 12px; } /* .pill.small 보다 구체적이어야 둘 다 같은 크기 */
  .corner { top: 10px; right: 10px; }
  .corner-l { top: 10px; left: 10px; max-width: calc(100% - 130px); }
  #title .logo-wrap { margin-top: 56px; }
  #rooms h2 { margin-top: 30px; } /* 왼쪽 위 포털 버튼 · 오른쪽 위 언어 버튼 아래로 */
  .hello.small { font-size: 18px; }
  #title .legal-links { text-align: center; position: static; margin-top: 4px; font-size: 12px; }
  /* 게임 화면: 점수 작게, 모드 숨김 */
  .sc { font-size: 48px; -webkit-text-stroke-width: 5px; }

  .colon { font-size: 34px; }
  #hud-mode { display: none; }
  #hint { font-size: 14px; padding: 5px 12px; }
  .half span { font-size: 13px; padding: 3px 10px; }
  #intro .ih { font-size: 16px; }
  #toast { top: 104px; }
  .res-score { font-size: 56px; }
}
