/* 숨바꼭질 화면 (밝은 파스텔). 키트 화면은 kit/kit.css */
:root {
  --bg: #f7fcf3; --card: #ffffff; --line: #e6efe0; --text: #2f3550; --muted: #7a809c;
  --pink: #ff7aa2; --blue: #5fb8ff; --green: #5fc46a; --yellow: #ffbf47; --violet: #8b7cf6; --red: #ff4d6d;
  --bs: var(--kit-btn-scale, 1);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { min-height: 100vh; font-family: "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; color: var(--text); word-break: keep-all;
  background: radial-gradient(ellipse 60% 40% at 0% 0%, #e3f7d6 0%, transparent 70%), radial-gradient(ellipse 55% 40% at 100% 15%, #ffe3ee 0%, transparent 70%), radial-gradient(ellipse 70% 40% at 50% 100%, #dcefff 0%, transparent 70%), var(--bg); background-attachment: fixed; }
body.playing { overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- 처음 화면 ---------- */
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) calc(14px + var(--safe-r)) 6px calc(14px + var(--safe-l)); }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand h1 { margin: 0; font-size: 19px; font-weight: 900; letter-spacing: -.5px; white-space: nowrap; background: linear-gradient(90deg, #4fb35c, #ff6b9d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-ico { width: 30px; height: 28px; flex: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 30'%3E%3Ccircle cx='16' cy='11' r='7.5' fill='%23ff9ec1'/%3E%3Ccircle cx='13.5' cy='10' r='1.3' fill='%232f3550'/%3E%3Ccircle cx='18.5' cy='10' r='1.3' fill='%232f3550'/%3E%3Ccircle cx='8' cy='21' r='8' fill='%236fc46f'/%3E%3Ccircle cx='24' cy='21' r='8' fill='%236fc46f'/%3E%3Ccircle cx='16' cy='22' r='8' fill='%237fd07c'/%3E%3C/svg%3E") center/contain no-repeat; }
.kit-chip { flex-shrink: 0; }

.home-main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 6px 16px calc(18px + var(--safe-b)); display: grid; gap: 14px; align-content: start; }
.hero { position: relative; border-radius: 26px; overflow: hidden; background: #c4eaa8; border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(110, 150, 110, .16); aspect-ratio: 5 / 4; max-height: 42vh; max-height: 42dvh; width: 100%; }
@media (max-aspect-ratio: 3/4) { .home-main { align-content: center; } }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-tag { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0; padding: 7px 14px; border-radius: 99px; background: rgba(255, 255, 255, .92); font-size: 14px; font-weight: 800; white-space: nowrap; box-shadow: 0 4px 14px rgba(80, 60, 120, .14); }
.hero-tag b { color: #ff5a8f; }

.menu { display: grid; gap: 10px; }
.card { display: grid; gap: 12px; padding: 16px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(110, 150, 110, .10); text-align: left; }
.card-h { display: flex; align-items: center; gap: 12px; }
.card h2 { margin: 0; font-size: 19px; font-weight: 900; }
.card p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
button.card { cursor: pointer; border: 1px solid var(--line); grid-template-columns: 1fr auto; align-items: center; transition: transform .12s; }
button.card:active { transform: scale(.98); }
.card.bot { background: linear-gradient(135deg, #effbea, #f4f0ff); }
.card .go { font-size: 30px; font-weight: 900; color: var(--violet); line-height: 1; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.btn { border: 0; border-radius: 16px; padding: 14px 12px; font-weight: 900; font-size: 16px; cursor: pointer; transition: transform .1s, filter .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { color: #fff; background: linear-gradient(135deg, #7fd07c, #4fb3a8); box-shadow: 0 6px 16px rgba(79, 179, 120, .3); }
.btn.soft { background: #ecf8e6; color: #3f9a4c; }
.btn.tile { display: flex; align-items: center; justify-content: center; gap: 8px; background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(110, 150, 110, .08); }
.ico { width: 42px; height: 42px; border-radius: 14px; flex: none; display: inline-block; background-repeat: no-repeat; background-position: center; background-size: 26px; }
.tile .ico { width: 30px; height: 30px; border-radius: 10px; background-size: 20px; }
.ico-friends { background-color: #ffe3ee; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='8' cy='8' r='4' fill='%23ff6b9d'/%3E%3Ccircle cx='16.5' cy='9' r='3.4' fill='%235fb8ff'/%3E%3Cpath d='M1 21c0-4 3-7 7-7s7 3 7 7z' fill='%23ff6b9d'/%3E%3Cpath d='M13 21c0-3 2-6 4-6 3 0 6 2 6 6z' fill='%235fb8ff'/%3E%3C/svg%3E"); }
.ico-bot { background-color: #e1f2ff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='6' width='18' height='14' rx='5' fill='%235fb8ff'/%3E%3Ccircle cx='9' cy='13' r='2.2' fill='%23fff'/%3E%3Ccircle cx='15' cy='13' r='2.2' fill='%23fff'/%3E%3Crect x='11' y='1.5' width='2' height='5' fill='%235fb8ff'/%3E%3Ccircle cx='12' cy='2' r='1.8' fill='%23ffbf47'/%3E%3C/svg%3E"); }
.ico-shop { background-color: #fff3d6; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h16l-1.5 12h-13z' fill='%23ffbf47'/%3E%3Cpath d='M8 9V7a4 4 0 0 1 8 0v2' fill='none' stroke='%23e09a1a' stroke-width='2'/%3E%3C/svg%3E"); }
.ico-how { background-color: #e6f9ef; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='%235fdc9a'/%3E%3Cpath d='M9.2 9.2a2.9 2.9 0 1 1 3.8 2.8c-.7.3-1 .8-1 1.6v.6' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round'/%3E%3Ccircle cx='12' cy='17.6' r='1.3' fill='%23fff'/%3E%3C/svg%3E"); }

@media (min-width: 760px), (orientation: landscape) and (max-height: 520px) {
  .home-main { grid-template-columns: 1.15fr 1fr; align-items: center; align-content: center; }
  .hero { max-height: none; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .top { padding-top: calc(6px + var(--safe-t)); padding-bottom: 2px; }
  .home-main { padding-top: 2px; gap: 12px; }
  .hero { aspect-ratio: auto; height: calc(100dvh - 76px); max-height: 330px; }
  .card { padding: 10px 12px; gap: 8px; border-radius: 18px; }
  .card h2 { font-size: 16px; }
  .card p { font-size: 12px; }
  .ico { width: 34px; height: 34px; background-size: 22px; }
  .btn { padding: 10px; font-size: 15px; }
  .menu { gap: 8px; }
}

/* ---------- 게임 화면 ---------- */
#play { position: fixed; inset: 0; z-index: 10; background: #9ccf86; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.heart { position: absolute; inset: 0; pointer-events: none; opacity: 0; box-shadow: inset 0 0 calc(60px + 4vmin) rgba(255, 70, 110, .75); transition: opacity .15s; }
.hud-tl { position: absolute; top: calc(8px + var(--safe-t)); left: calc(8px + var(--safe-l)); display: flex; gap: 6px; align-items: stretch; pointer-events: none; }
.hud-tl > * { pointer-events: auto; }
/* 터치 버튼은 프로필의 '버튼 크기'(--kit-btn-scale 0.8~1.5)를 따라 커짐 */
.hud-btn { width: calc(40px * var(--bs)); height: calc(40px * var(--bs)); border: 0; border-radius: calc(13px * var(--bs)); background: rgba(255, 255, 255, .92); color: #6b6f8a; display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 12px rgba(50, 70, 50, .18); padding: 0; }
.hud-btn svg { width: calc(19px * var(--bs)); height: calc(19px * var(--bs)); }
.hud-pill { min-width: 66px; padding: 3px 10px; border-radius: 13px; background: rgba(255, 255, 255, .92); box-shadow: 0 4px 12px rgba(50, 70, 50, .18); display: grid; align-content: center; text-align: center; }
.hud-pill small { font-size: 10px; font-weight: 800; color: var(--muted); line-height: 1.1; white-space: nowrap; }
.hud-pill b { font-size: 18px; font-weight: 900; line-height: 1.15; font-variant-numeric: tabular-nums; }
.hud-pill.warn b { color: var(--red); animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .45; } }
.role-badge { position: absolute; left: 50%; transform: translateX(-50%); top: calc(8px + var(--safe-t)); padding: 6px 14px; border-radius: 99px; font-weight: 900; font-size: 14px; white-space: nowrap; background: rgba(255, 255, 255, .94); box-shadow: 0 4px 12px rgba(50, 70, 50, .18); pointer-events: none; }
.role-badge.seek { background: #ff5c7f; color: #fff; }
.role-badge.helper { background: #ff9a5c; color: #fff; }
.role-badge small { font-weight: 800; opacity: .8; margin-left: 4px; }
.board { position: absolute; top: calc(8px + var(--safe-t)); right: calc(8px + var(--safe-r)); margin: 0; padding: 6px; list-style: none; width: 138px; border-radius: 14px; background: rgba(255, 255, 255, .9); box-shadow: 0 4px 12px rgba(50, 70, 50, .18); display: grid; gap: 2px; pointer-events: none; }
.board li { display: grid; grid-template-columns: 12px 1fr auto; gap: 5px; align-items: center; font-size: 12px; font-weight: 700; padding: 2px 4px; border-radius: 8px; }
.board li.me { background: #eef8e9; }
.board .c { width: 12px; height: 12px; border-radius: 50%; background: var(--c); position: relative; }
.board li.r1 .c::after, .board li.r2 .c::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid #ff4d6d; }
.board li.r2 .c::after { border-color: #ff9a5c; }
.board .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .p { font-weight: 900; font-variant-numeric: tabular-nums; }
.feed { position: absolute; left: 50%; transform: translateX(-50%); top: calc(52px + var(--safe-t)); display: grid; gap: 4px; justify-items: center; pointer-events: none; width: min(70vw, 420px); }
.feed div { padding: 5px 12px; border-radius: 99px; background: rgba(47, 53, 80, .78); color: #fff; font-size: 13px; font-weight: 700; animation: feedIn .25s ease-out; max-width: 100%; text-align: center; }
.feed div.out { opacity: 0; transition: opacity .5s; }
.feed i { font-style: normal; color: var(--c); filter: brightness(1.2); font-weight: 900; }
@keyframes feedIn { from { transform: translateY(-6px); opacity: 0; } }
.center-msg { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.center-msg .big { font-size: 46px; font-weight: 900; line-height: 1.05; color: #ff5a8f; -webkit-text-stroke: 8px #fff; paint-order: stroke fill; filter: drop-shadow(0 5px 0 rgba(60, 90, 60, .2)); animation: pop .45s ease-out; white-space: nowrap; }
.center-msg .big.green { color: #3fae55; }
.center-msg .sub { margin-top: 6px; display: inline-block; padding: 6px 14px; border-radius: 99px; background: rgba(255, 255, 255, .92); font-weight: 800; font-size: 15px; box-shadow: 0 4px 12px rgba(50, 70, 50, .16); }
.center-msg .sub em { font-style: normal; color: #ff5a8f; font-weight: 900; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); } }
.blind { position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, #5b4f9a, #2b2550); display: grid; place-items: center; pointer-events: none; }
.blind-in { display: grid; justify-items: center; gap: 8px; color: #fff; text-align: center; }
.blind-in b { font-size: 20px; }
.blind-in em { font-style: normal; font-size: 84px; font-weight: 900; line-height: 1; color: #ffd34d; animation: pop .5s ease-out; }
.blind-in span { opacity: .8; font-weight: 700; }
.round-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(88vw, 360px); max-height: 80vh; overflow: auto; padding: 18px; border-radius: 24px; background: rgba(255, 255, 255, .97); box-shadow: 0 16px 40px rgba(40, 60, 40, .28); text-align: center; animation: pop .35s ease-out; }
.round-card h3 { margin: 0 0 4px; font-size: 22px; font-weight: 900; }
.round-card p { margin: 0 0 10px; color: var(--muted); font-weight: 700; font-size: 14px; }
.round-card ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.round-card li { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 12px; background: #f7faf4; font-weight: 700; font-size: 14px; text-align: left; }
.round-card li.me { background: #eaf7e3; }
.round-card li .c { width: 14px; height: 14px; border-radius: 50%; background: var(--c); }
.round-card li em { font-style: normal; color: #3fae55; font-weight: 900; }
.round-card li b { font-variant-numeric: tabular-nums; }
.round-card .next { margin-top: 10px; font-size: 13px; color: var(--muted); font-weight: 700; }

/* 조이스틱·버튼 */
.stick { position: absolute; width: calc(120px * var(--bs)); height: calc(120px * var(--bs)); margin: calc(-60px * var(--bs)) 0 0 calc(-60px * var(--bs)); border-radius: 50%; background: rgba(255, 255, 255, .28); border: 2px solid rgba(255, 255, 255, .7); pointer-events: none; }
.stick i { position: absolute; left: 50%; top: 50%; width: calc(52px * var(--bs)); height: calc(52px * var(--bs)); margin: calc(-26px * var(--bs)) 0 0 calc(-26px * var(--bs)); border-radius: 50%; background: rgba(255, 255, 255, .92); box-shadow: 0 4px 10px rgba(40, 60, 40, .25); }
.ctl { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(18px + var(--safe-b)); display: flex; align-items: flex-end; gap: calc(10px * var(--bs)); }
.ctl-btn { position: relative; border: 0; border-radius: 50%; padding: 0; cursor: pointer; display: grid; place-items: center; align-content: center; color: #fff; font-weight: 900; box-shadow: 0 6px 14px rgba(40, 60, 40, .28), inset 0 -4px 0 rgba(0, 0, 0, .12); overflow: hidden; touch-action: none; }
.ctl-btn.dash { width: calc(78px * var(--bs)); height: calc(78px * var(--bs)); background: radial-gradient(circle at 35% 30%, #9be3a0, #45b864); }
.ctl-btn.act { width: calc(62px * var(--bs)); height: calc(62px * var(--bs)); margin-bottom: calc(34px * var(--bs)); background: radial-gradient(circle at 35% 30%, #f3c993, #c98f56); }
.ctl-btn.act.seek { background: radial-gradient(circle at 35% 30%, #c6b8ff, #8b7cf6); }
.ctl-btn small { position: relative; font-size: calc(12px * var(--bs)); line-height: 1; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.ctl-btn .ic { position: relative; width: calc(26px * var(--bs)); height: calc(26px * var(--bs)); background: center/contain no-repeat; margin-bottom: 2px; }
.ctl-btn.dash .ic { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 2 L5 13 H11 L10 22 L19 10 H13Z' fill='%23fff'/%3E%3C/svg%3E"); }
.ctl-btn.act .ic { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='5' width='18' height='15' rx='2' fill='%23fff'/%3E%3Cpath d='M5 7 L19 18 M5 7 H19 V18 H5Z' stroke='%23c98f56' stroke-width='1.6' fill='none'/%3E%3C/svg%3E"); }
.ctl-btn.act.seek .ic { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10' cy='10' r='6.5' stroke='%23fff' stroke-width='3' fill='none'/%3E%3Cpath d='M15 15 L21 21' stroke='%23fff' stroke-width='3.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ctl-btn .cd { position: absolute; inset: 0; background: conic-gradient(rgba(40, 40, 70, .55) var(--cd, 0%), transparent 0); pointer-events: none; }
.ctl-btn.off { filter: grayscale(.6); opacity: .65; }
.ctl-btn:active { transform: scale(.94); }
.hint { position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); padding: 8px 16px; border-radius: 99px; background: rgba(47, 53, 80, .78); color: #fff; font-weight: 800; font-size: 14px; white-space: nowrap; pointer-events: none; animation: feedIn .3s; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
body.pc .ctl, body.pc .stick { display: none; }
@media (max-width: 600px) {
  .board { width: 112px; padding: 4px; }
  .board li { font-size: 11px; gap: 4px; padding: 1px 3px; }
  .hud-pill b { font-size: 16px; }
  .hint { bottom: calc(150px * var(--bs) + var(--safe-b)); font-size: 13px; }
  .role-badge { top: calc(14px + 40px * var(--bs) + var(--safe-t)); left: calc(8px + var(--safe-l)); transform: none; font-size: 13px; padding: 5px 11px; }
  .feed { top: auto; bottom: calc(150px * var(--bs) + 62px + var(--safe-b)); width: min(86vw, 420px); }
  .center-msg .big { font-size: 38px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .board li { font-size: 11px; padding: 0 3px; }
  .feed { top: calc(48px + var(--safe-t)); width: min(44vw, 360px); }
  .ctl { bottom: calc(12px + var(--safe-b)); }
  .center-msg { top: 36%; }
}

/* ---------- 창 (결과·설정·놀이 방법) ---------- */
.set-row { display: grid; gap: 6px; margin: 8px 0; }
.set-row > span { font-size: 13px; font-weight: 800; color: var(--muted); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-b { flex: 1; padding: 10px 6px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-weight: 800; font-size: 14px; cursor: pointer; white-space: nowrap; }
.seg-b.on { border-color: transparent; color: #fff; background: linear-gradient(135deg, #7fd07c, #4fb3a8); }
.seg-b:disabled { cursor: default; }
.seg-b:disabled:not(.on) { opacity: .55; }
.res-title { text-align: center; margin: 0 0 4px; font-size: 26px; font-weight: 900; }
.res-sub { text-align: center; margin: 0 0 12px; color: var(--muted); font-weight: 700; }
.res-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.res-list li { display: grid; grid-template-columns: 30px 16px 1fr auto; gap: 8px; align-items: center; padding: 9px 12px; border-radius: 14px; background: #f8fbf5; border: 1px solid var(--line); font-weight: 700; }
.res-list li.me { background: #eaf7e3; border-color: #c9e8bb; }
.res-list .pl { font-weight: 900; font-size: 18px; text-align: center; color: #9aa0bd; }
.res-list li:nth-child(1) .pl { color: #f5a524; }
.res-list li:nth-child(2) .pl { color: #8e9bb5; }
.res-list li:nth-child(3) .pl { color: #d0864f; }
.res-list .c { width: 16px; height: 16px; border-radius: 50%; background: var(--c); box-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.res-list .nm small { color: var(--muted); font-weight: 600; font-size: 12px; margin-left: 4px; }
.res-list .pc { font-weight: 900; font-variant-numeric: tabular-nums; }
.res-gold { margin: 12px 0 0; text-align: center; font-weight: 900; font-size: 17px; color: #c47f00; }
.res-medal { display: block; margin: 0 auto 4px; }
.how { display: grid; gap: 10px; margin: 8px 0 0; padding: 0; list-style: none; }
.how li { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; padding: 10px; border-radius: 16px; background: #f8fbf5; border: 1px solid var(--line); font-size: 14.5px; line-height: 1.5; }
.how li b { color: #ff5a8f; }
.how svg { display: block; }
.how-keys { margin: 12px 0 0; padding: 10px 12px; border-radius: 14px; background: #fff6d6; border: 1px solid #ffe08a; font-size: 14px; line-height: 1.6; }
