/* 쭉쭉 땅따먹기 화면 (밝은 파스텔). 키트 화면은 kit/kit.css */
:root {
  --bg: #fff7fb; --card: #ffffff; --line: #efe7f3; --text: #2f3550; --muted: #7a809c;
  --pink: #ff7aa2; --blue: #5fb8ff; --green: #5fdc9a; --yellow: #ffbf47; --violet: #8b7cf6;
  --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%, #ffe0ec 0%, transparent 70%), radial-gradient(ellipse 55% 40% at 100% 15%, #dcefff 0%, transparent 70%), radial-gradient(ellipse 70% 40% at 50% 100%, #dcf8e9 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, #ff6b9d, #8b7cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-ico { position: relative; width: 28px; height: 26px; flex: none; }
.brand-ico i { position: absolute; width: 17px; height: 17px; border-radius: 5px; background: var(--pink); box-shadow: 0 3px 0 #e2557f; left: 0; top: 0; }
.brand-ico i + i { background: var(--blue); box-shadow: 0 3px 0 #3b95e0; left: 11px; top: 7px; }
.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: #fff; border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(140, 110, 180, .14); aspect-ratio: 1 / 1; max-height: 44vh; max-height: 44dvh; 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, .9); 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(140, 110, 180, .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, #f0fbff, #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, #ff8fb8, #8b7cf6); box-shadow: 0 6px 16px rgba(139, 124, 246, .3); }
.btn.soft { background: #f3f0ff; color: #6a5ae0; }
.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(140, 110, 180, .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: #efeaf8; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.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; }
.hud-btn { width: 40px; height: 40px; border: 0; border-radius: 13px; background: rgba(255, 255, 255, .92); color: #6b6f8a; display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 12px rgba(80, 60, 120, .16); }
.hud-pill { min-width: 62px; padding: 3px 10px; border-radius: 13px; background: rgba(255, 255, 255, .92); box-shadow: 0 4px 12px rgba(80, 60, 120, .16); display: grid; align-content: center; text-align: center; }
.hud-pill small { font-size: 10px; font-weight: 800; color: var(--muted); line-height: 1.1; }
.hud-pill b { font-size: 18px; font-weight: 900; line-height: 1.15; font-variant-numeric: tabular-nums; }
.hud-pill.me b { color: var(--mc, #ff6b9d); }
.hud-pill.warn b { color: #ff4d6d; animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .45; } }
.board { position: absolute; top: calc(8px + var(--safe-t)); right: calc(8px + var(--safe-r)); margin: 0; padding: 6px; list-style: none; width: 148px; border-radius: 14px; background: rgba(255, 255, 255, .9); box-shadow: 0 4px 12px rgba(80, 60, 120, .16); display: grid; gap: 2px; pointer-events: none; }
.board li { display: grid; grid-template-columns: 14px 10px 1fr auto; gap: 5px; align-items: center; font-size: 12px; font-weight: 700; padding: 2px 4px; border-radius: 8px; }
.board li.me { background: #f3f0ff; }
.board li.dead { opacity: .45; }
.board .r { color: var(--muted); font-weight: 900; text-align: center; }
.board .c { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.board .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .p { font-weight: 900; font-variant-numeric: tabular-nums; }
.mini-wrap { position: absolute; left: calc(8px + var(--safe-l)); bottom: calc(8px + var(--safe-b)); padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, .9); box-shadow: 0 4px 12px rgba(80, 60, 120, .16); pointer-events: none; line-height: 0; }
#mini { width: 104px; height: 104px; border-radius: 10px; display: block; }
.snd { position: absolute; right: calc(8px + var(--safe-r)); bottom: calc(8px + var(--safe-b)); }
.feed { position: absolute; left: 50%; transform: translateX(-50%); top: calc(58px + var(--safe-t)); display: grid; gap: 4px; justify-items: center; pointer-events: none; width: min(92vw, 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.15); font-weight: 900; }
@keyframes feedIn { from { transform: translateY(-6px); opacity: 0; } }
.center-msg { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.center-msg .count { font-size: 96px; font-weight: 900; line-height: 1; color: #8b7cf6; -webkit-text-stroke: 10px #fff; paint-order: stroke fill; filter: drop-shadow(0 6px 0 rgba(90, 70, 160, .2)); animation: pop .5s ease-out; }
.center-msg .go { font-size: 68px; color: #ff5a8f; white-space: nowrap; }
.center-msg .dead { padding: 16px 22px; border-radius: 22px; background: rgba(255, 255, 255, .94); box-shadow: 0 12px 30px rgba(80, 60, 120, .22); animation: pop .35s ease-out; }
.center-msg .dead b { display: block; font-size: 22px; font-weight: 900; color: #ff4d6d; }
.center-msg .dead span { display: block; margin-top: 4px; font-size: 15px; font-weight: 700; color: var(--muted); }
.center-msg .dead em { font-style: normal; font-size: 30px; font-weight: 900; color: #8b7cf6; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); } }
.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; }
@media (max-width: 600px) {
  .board { width: 128px; padding: 4px; }
  .board li { font-size: 11px; grid-template-columns: 12px 9px 1fr auto; gap: 4px; padding: 1px 3px; }
  #mini { width: 88px; height: 88px; }
  .hud-pill b { font-size: 16px; }
  .hint { bottom: 24%; font-size: 13px; }
  .feed { top: auto; bottom: calc(118px + var(--safe-b)); }
}
@media (orientation: landscape) and (max-height: 520px) {
  #mini { width: 78px; height: 78px; }
  .board li { font-size: 11px; padding: 0 3px; }
  .feed { top: calc(8px + var(--safe-t)); width: min(44vw, 360px); }
  .hint { bottom: calc(10px + var(--safe-b)); }
}

/* ---------- 창 (결과·설정·놀이 방법) ---------- */
.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; }
.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; }
.seg-b.on { border-color: transparent; color: #fff; background: linear-gradient(135deg, #ff8fb8, #8b7cf6); }
.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: 34px 16px 1fr auto; gap: 8px; align-items: center; padding: 9px 12px; border-radius: 14px; background: #faf8fd; border: 1px solid var(--line); font-weight: 700; }
.res-list li.me { background: #f3f0ff; border-color: #d8cffc; }
.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: 5px; 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: #faf8fd; 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; }
