/* 폭탄 돌리기 파티 — 밝고 귀여운 파티 느낌. 휴대폰 세로(390×844)가 기본, PC 는 가로 배치 */
:root {
  --bg: #fff4e8; --ink: #2f3550; --muted: #7d7f99; --line: #f1e3d3; --card: #fff;
  --red: #ff5a4e; --orange: #ff9a3c; --yellow: #ffc93c; --pink: #ff7aa2; --purple: #8b7cf6; --mint: #4fd1a5; --sky: #5fb8ff;
}
.kit-root { --kit-accent: #ff6b6b; --kit-accent2: #ffab3d; --kit-soft: #fff1e4; --kit-line: #f3e6da; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  min-height: 100vh; min-height: 100dvh; font-family: "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--ink); word-break: keep-all; overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 122, 162, .18) 0 60px, transparent 61px),
    radial-gradient(circle at 92% 18%, rgba(95, 184, 255, .16) 0 80px, transparent 81px),
    radial-gradient(circle at 80% 92%, rgba(255, 201, 60, .2) 0 90px, transparent 91px),
    radial-gradient(circle at 6% 70%, rgba(79, 209, 165, .15) 0 70px, transparent 71px),
    var(--bg);
  background-attachment: fixed;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; touch-action: manipulation; }
.hidden { display: none !important; }
.screen { min-height: 100vh; min-height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; }

/* ---------- 버튼 ---------- */
.btn { border: 0; border-radius: 16px; padding: 14px 16px; font-weight: 900; font-size: 17px; cursor: pointer; background: #fff; color: var(--ink); border: 2px solid var(--line); transition: transform .1s; }
.btn:active, .tile:active { transform: scale(.96); }
.btn.primary { border: 0; color: #fff; background: linear-gradient(135deg, #ff8a5c, #ff5a7a); box-shadow: 0 6px 0 #d9415f, 0 10px 20px rgba(255, 90, 122, .3); }
.btn.primary:active { box-shadow: 0 2px 0 #d9415f; transform: translateY(4px); }
.btn.ghost { background: #fff; color: #ff5a7a; }
.small-btn { border: 0; background: #fff; border-radius: 12px; padding: 8px 12px; font-weight: 800; font-size: 14px; box-shadow: 0 2px 8px rgba(80, 60, 40, .1); cursor: pointer; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 0; background: #fff; box-shadow: 0 2px 8px rgba(80, 60, 40, .1); cursor: pointer; position: relative; flex: none; }
.muteBtn::before { content: ""; position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; background: var(--ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9h4l5-4v14l-5-4H3z'/%3E%3Cpath d='M16 8.5a5 5 0 0 1 0 7M18.5 6a8.5 8.5 0 0 1 0 12' stroke='black' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9h4l5-4v14l-5-4H3z'/%3E%3Cpath d='M16 8.5a5 5 0 0 1 0 7M18.5 6a8.5 8.5 0 0 1 0 12' stroke='black' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat; }
.muteBtn.off::before { background: #c0c3d4;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9h4l5-4v14l-5-4H3z'/%3E%3Cpath d='M16 9l6 6M22 9l-6 6' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9h4l5-4v14l-5-4H3z'/%3E%3Cpath d='M16 9l6 6M22 9l-6 6' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat; }

/* ---------- 처음 화면 ---------- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px 0; }
.brand { display: flex; align-items: center; gap: 6px; min-width: 0; }
#brandLogo { width: 48px; height: 48px; flex: none; animation: wob 1.6s ease-in-out infinite; }
.brand h1 { margin: 0; font-size: 21px; line-height: 1.05; font-weight: 900; letter-spacing: -.5px; }
.brand h1 em { font-style: normal; background: linear-gradient(90deg, #ff5a7a, #ff9a3c); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 25px; }
@keyframes wob { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }

.hero { position: relative; height: 220px; margin: 6px 0 2px; overflow-x: clip; }
.hero-in { position: absolute; left: 50%; top: 0; width: 360px; height: 220px; margin-left: -180px; transform-origin: 50% 0; }
.hero-table { position: absolute; left: 50%; top: 58%; width: 230px; height: 96px; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, #fff7e0 0 50%, #ffd89a 51% 63%, #f0b86e 64%); box-shadow: 0 12px 0 #d99a55, 0 22px 30px rgba(160, 100, 40, .25); }
.hero-av { position: absolute; width: 74px; height: 74px; }
.hero-av svg { width: 100%; height: 100%; }
.hero-av.h0 { left: calc(50% - 160px); top: 92px; animation: hop 1.1s ease-in-out infinite; }
.hero-av.h1 { left: calc(50% - 100px); top: 4px; animation: hop 1.3s .2s ease-in-out infinite; }
.hero-av.h2 { left: calc(50% + 26px); top: 4px; animation: hop 1.2s .4s ease-in-out infinite; }
.hero-av.h3 { left: calc(50% + 86px); top: 92px; animation: hop 1.4s .1s ease-in-out infinite; }
.hero-bomb { position: absolute; left: calc(50% - 46px); top: 66px; width: 92px; height: 92px; animation: toss 2.4s ease-in-out infinite; filter: drop-shadow(0 8px 6px rgba(60, 40, 20, .25)); }
.hero-bomb svg { width: 100%; height: 100%; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes toss { 0% { transform: translate(-70px, 10px) rotate(-20deg); } 25% { transform: translate(-30px, -50px) rotate(160deg); } 50% { transform: translate(40px, 0) rotate(340deg); } 75% { transform: translate(0, -40px) rotate(200deg); } 100% { transform: translate(-70px, 10px) rotate(340deg); } }
@media (max-width: 370px) { .hero-in { transform: scale(.88); } }

.menu { padding: 0 16px 20px; display: grid; gap: 12px; }
.card { background: var(--card); border-radius: 24px; padding: 16px; box-shadow: 0 10px 30px rgba(160, 100, 60, .12); border: 2px solid #fff; }
.card-h { display: flex; align-items: center; justify-content: space-between; }
.card h2 { margin: 0; font-size: 21px; font-weight: 900; }
.card p { margin: 6px 0 12px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.pill { font-size: 12px; font-weight: 900; padding: 3px 10px; border-radius: 99px; background: #ffe8ef; color: #e0567a; }
.row { display: flex; gap: 8px; }
.row .btn { flex: 1; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { border: 0; border-radius: 20px; padding: 16px 6px 12px; cursor: pointer; display: grid; gap: 2px; text-align: center; color: #fff; box-shadow: 0 5px 0 rgba(0, 0, 0, .12); transition: transform .1s; }
.tile b { font-size: 17px; font-weight: 900; }
.tile small { font-size: 12px; opacity: .92; font-weight: 700; }
.t-practice { background: linear-gradient(140deg, #5fd3a8, #2fb98a); }
.t-shop { background: linear-gradient(140deg, #ffcb4d, #ff9f2e); }
.t-how { background: linear-gradient(140deg, #8fa8ff, #8b7cf6); }
.home-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; color: var(--muted); font-size: 13px; }
#homeStats { display: flex; gap: 10px; flex-wrap: wrap; }
#homeStats b { color: var(--ink); }
#homeEquip { display: flex; align-items: center; gap: 4px; }

/* ---------- 게임 화면 ---------- */
#game { max-width: none; }
.gbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px 0; width: 100%; max-width: 560px; margin: 0 auto; }
.gtitle { font-weight: 900; font-size: 18px; padding: 6px 16px; border-radius: 99px; background: #fff; box-shadow: 0 2px 8px rgba(80, 60, 40, .1); }
.gmain { display: flex; flex-direction: column; align-items: center; flex: 1; width: 100%; }
#tableWrap { width: min(calc(100vw - 8px), 47vh, 47dvh, 560px); aspect-ratio: 1; margin-top: 2px; flex: none; }
#table { position: relative; width: 100%; height: 100%; --av: 20%; }
.felt { position: absolute; inset: 17% 15%; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .7) 0 4px, transparent 5px) 0 0 / 34px 34px,
    radial-gradient(ellipse at 50% 42%, #fff8e8 0 55%, #ffe1b3 56% 70%, #f6c27f 71%);
  box-shadow: inset 0 -8px 0 rgba(200, 130, 60, .25), 0 10px 0 #e0a35e, 0 18px 30px rgba(160, 100, 40, .25); }
#center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 52%; text-align: center; pointer-events: none; z-index: 2; }
.cd { font-size: clamp(48px, 16vw, 80px); font-weight: 900; color: #ff5a7a; text-shadow: 0 4px 0 #fff, 0 6px 14px rgba(255, 90, 122, .4); animation: pop .5s ease-out; }
.cd.go { font-size: clamp(34px, 11vw, 56px); color: #2fb98a; }
.banner { animation: pop .5s ease-out; }
.banner small { display: block; font-size: 14px; font-weight: 900; color: var(--muted); }
.banner b { font-size: clamp(44px, 14vw, 72px); font-weight: 900; color: #ff9a3c; text-shadow: 0 4px 0 #fff; line-height: 1; }
.ctext { display: grid; gap: 2px; font-size: clamp(13px, 3.8vw, 17px); animation: pop .35s ease-out; }
.ctext small { font-weight: 800; color: var(--muted); font-size: 12px; }
.ctext b { font-weight: 900; }
.ctext.boomtxt b { color: #e0342c; font-size: 1.15em; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.1); } }

.seat { position: absolute; width: var(--av); transform: translate(-50%, -50%); text-align: center; z-index: 3; transition: filter .3s, opacity .3s; }
.seat .av { position: relative; width: 100%; aspect-ratio: 1; }
.seat .av svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 4px 3px rgba(60, 40, 20, .2)); }
.seat .nm { display: inline-flex; align-items: center; gap: 2px; max-width: 150%; margin-top: -4px; padding: 2px 7px; border-radius: 99px; background: #fff; border: 2px solid var(--pc); font-size: clamp(10px, 2.9vw, 13px); line-height: 1.25; white-space: nowrap; position: relative; left: 50%; transform: translateX(-50%); }
.seat .nm b { overflow: hidden; text-overflow: ellipsis; max-width: 6.5em; }
.seat .nm em { font-style: normal; font-size: .82em; font-weight: 900; color: #fff; background: var(--pc); border-radius: 99px; padding: 0 5px; }
.seat .nm .sh { display: inline-flex; }
.seat .hearts { display: flex; justify-content: center; gap: 1px; margin-top: 1px; }
.seat .hearts small { font-size: 11px; color: var(--muted); font-weight: 800; }
.hrt { width: clamp(11px, 3.3vw, 16px); fill: #ff4f6d; stroke: #fff; stroke-width: 2; }
.hrt.off { fill: #d9dbe6; }
.seat.me .av::after { content: ""; position: absolute; inset: 4% 4% -2%; border-radius: 50%; border: 3px dashed var(--pc); opacity: .5; animation: spin 8s linear infinite; z-index: -1; }
@keyframes spin { to { transform: rotate(360deg); } }
.seat.hold .av { animation: shiver .25s linear infinite; }
.seat.hold .av::before { content: ""; position: absolute; inset: -6%; border-radius: 50%; background: radial-gradient(circle, rgba(255, 154, 60, .45), transparent 70%); z-index: -1; animation: glow 0.8s ease-in-out infinite; }
@keyframes shiver { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-1.5px) rotate(-2deg); } 75% { transform: translateX(1.5px) rotate(2deg); } }
@keyframes glow { 50% { transform: scale(1.12); opacity: .6; } }
.seat.out { filter: grayscale(.85); opacity: .6; }
.seat.pick { cursor: pointer; z-index: 6; }
.seat.pick .av { animation: hop .6s ease-in-out infinite; }
.seat.pick .av::before { content: "여기!"; position: absolute; left: 50%; top: -18%; transform: translateX(-50%); font-size: 12px; font-weight: 900; color: #fff; background: #2fb98a; padding: 1px 7px; border-radius: 99px; white-space: nowrap; z-index: 2; }
.seat.pick .nm { background: #e6fff4; }

#bombEl { position: absolute; width: 17%; aspect-ratio: 1; left: 50%; top: 50%; z-index: 5; pointer-events: none; filter: drop-shadow(0 6px 4px rgba(40, 20, 10, .3)); will-change: transform, left, top; }
#bombEl svg, .p-bomb svg { width: 100%; height: 100%; overflow: visible; }
.spark { animation: spark .3s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
[data-heat="1"] .spark { animation-duration: .2s; }
[data-heat="2"] .spark { animation-duration: .13s; }
[data-heat="3"] .spark { animation-duration: .08s; }
@keyframes spark { from { transform: scale(.75) rotate(0); } to { transform: scale(1.25) rotate(40deg); } }
[data-heat="3"] .bomb-svg circle:first-of-type { }

#fx { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.boom, .puff { position: absolute; width: 62%; aspect-ratio: 1; transform: translate(-50%, -50%) scale(.1); animation: boomIn 1.4s cubic-bezier(.2, 1.4, .4, 1) forwards; }
.puff { width: 40%; }
.boom svg, .puff svg { width: 100%; height: 100%; }
@keyframes boomIn { 0% { transform: translate(-50%, -50%) scale(.1) rotate(-20deg); } 25% { transform: translate(-50%, -50%) scale(1.1) rotate(5deg); } 70% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.15); opacity: 0; } }
.smoke { position: absolute; width: 9%; aspect-ratio: 1; border-radius: 50%; background: #6b6f86; opacity: .7; transform: translate(-50%, -50%); animation: smoke 1.3s ease-out forwards; }
@keyframes smoke { to { transform: translate(-50%, -50%) rotate(var(--a)) translateX(var(--d)) scale(2.2); opacity: 0; } }
.shield-pop { position: absolute; transform: translate(-50%, -70%); animation: pop .5s ease-out, fade 1.8s 1s forwards; }
@keyframes fade { to { opacity: 0; } }
.float { position: absolute; transform: translate(-50%, -120%); z-index: 9; font-weight: 900; font-size: 15px; color: #fff; background: #5d6f96; padding: 4px 10px; border-radius: 99px; white-space: nowrap; animation: floatUp 1.8s ease-out forwards; pointer-events: none; }
.float.grace { background: linear-gradient(135deg, #7d8fb3, #5d6f96); }
@keyframes floatUp { from { opacity: 0; transform: translate(-50%, -80%); } 15% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -220%); } }
.emote-pop { position: absolute; z-index: 9; transform: translate(-50%, -140%); display: flex; align-items: center; gap: 4px; padding: 5px 10px 5px 6px; border-radius: 99px; background: #fff; box-shadow: 0 6px 16px rgba(60, 40, 20, .2); font-weight: 900; font-size: 14px; white-space: nowrap; animation: emo 2s ease-out forwards; pointer-events: none; }
.emote-pop i { width: 22px; height: 22px; display: grid; }
@keyframes emo { 0% { opacity: 0; transform: translate(-50%, -100%) scale(.5); } 12% { opacity: 1; transform: translate(-50%, -140%) scale(1.1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -190%); } }
#flash { position: fixed; inset: 0; background: #fff6d0; opacity: 0; pointer-events: none; z-index: 50; }
#flash.on { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }
.shake { animation: shake .55s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(5px, -3px); } 30%, 50%, 70% { transform: translate(-8px, 4px); } 40%, 60% { transform: translate(8px, -4px); } }

/* ---------- 아래 칸 ---------- */
#panel { width: 100%; max-width: 560px; padding: 4px 10px calc(12px + env(safe-area-inset-bottom)); flex: 1; display: flex; flex-direction: column; gap: 8px; }
.pn-msg { background: #fff; border-radius: 22px; padding: 14px 16px; text-align: center; box-shadow: 0 8px 24px rgba(160, 100, 60, .1); }
.pn-msg h3 { margin: 0 0 4px; font-size: 18px; font-weight: 900; display: flex; align-items: center; justify-content: center; gap: 6px; }
.pn-msg p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.pn-msg .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.pn-msg.spec { background: #f3f1ff; }
.pn-head { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 12px; border-radius: 16px; font-size: 15px; color: #fff; text-align: center; }
.pn-head.hot { background: linear-gradient(135deg, #ff7a45, #ff4f6d); animation: hotPulse .8s ease-in-out infinite; }
.pn-head.go { background: linear-gradient(135deg, #3fcf98, #22b07c); padding: 12px; font-size: 16px; }
@keyframes hotPulse { 50% { filter: brightness(1.12); } }
.pn-bomb { width: 26px; height: 26px; display: grid; animation: wob .4s ease-in-out infinite; }
.pn-bomb svg { width: 100%; height: 100%; }
.mbox { flex: 1; display: flex; }
.targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.tgt { border: 0; background: #fff; border-radius: 18px; padding: 8px 6px; display: grid; justify-items: center; gap: 2px; cursor: pointer; box-shadow: 0 4px 0 var(--pc), 0 6px 14px rgba(60, 40, 20, .1); border: 2px solid var(--pc); }
.tgt i { width: 54px; height: 54px; display: grid; }
.tgt i svg { width: 100%; height: 100%; }
.tgt b { font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tgt small { font-size: 11px; color: var(--muted); font-weight: 700; }
.tgt:disabled { opacity: .45; box-shadow: none; cursor: default; }
.tgt:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 var(--pc); }
.emotes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.emo { border: 0; background: #fff; border-radius: 14px; padding: 8px 4px; display: flex; align-items: center; justify-content: center; gap: 4px; font-weight: 800; font-size: 13px; cursor: pointer; box-shadow: 0 3px 0 #f1dcc8; }
.emo i { width: 22px; height: 22px; display: grid; flex: none; }
.emo:disabled { opacity: .5; }
.emo:active { transform: translateY(2px); box-shadow: none; }

/* ---------- 미션 ---------- */
.ms { flex: 1; width: 100%; display: flex; flex-direction: column; background: #fff; border-radius: 22px; padding: 10px; box-shadow: 0 10px 26px rgba(160, 100, 60, .14); border: 3px solid #ffe2c2; min-height: 290px; }
.ms.win { border-color: #3fcf98; background: #f0fff8; }
.ms.shake { animation: shake .5s; border-color: #ff6b6b; }
.ms-title { text-align: center; font-size: clamp(16px, 4.6vw, 19px); font-weight: 800; padding: 2px 4px 8px; display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.ms-title b { color: #ff5a4e; }
.m-mini, .m-sw { display: inline-grid; }
.m-sw { width: 18px; height: 18px; border-radius: 6px; border: 2px solid rgba(0, 0, 0, .15); }
.ms-body { flex: 1; position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 230px; user-select: none; -webkit-user-select: none; }
.ms-body.locked { pointer-events: none; opacity: .6; }
.ms-body > div { width: 100%; }
.m-grid { display: grid; gap: 8px; }
.m-grid.c3 { grid-template-columns: repeat(3, 1fr); }
.m-grid.c4 { grid-template-columns: repeat(4, 1fr); }
.m-grid.c5, .m-grid.c6 { grid-template-columns: repeat(3, 1fr); }
.m-opt { border: 0; min-height: 66px; border-radius: 18px; background: #f6f2ff; box-shadow: 0 4px 0 #ddd3f7; cursor: pointer; display: grid; place-items: center; transition: transform .08s; }
.m-opt:active { transform: translateY(3px); box-shadow: 0 1px 0 #ddd3f7; }
.m-opt.num, .m-opt.syl { font-size: 30px; font-weight: 900; color: #4b4f75; }
.m-opt.ok, .m-cell.ok { background: #d4f8e8 !important; box-shadow: 0 0 0 3px #3fcf98 !important; }
.m-opt.no, .m-cell.no { background: #ffe0e0 !important; box-shadow: 0 0 0 3px #ff6b6b !important; }
.m-opt.syl:disabled { opacity: .5; }
/* 연타 */
.m-tap { display: grid; place-items: center; }
.m-tapbtn { position: relative; width: 176px; height: 176px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; background: radial-gradient(circle at 35% 30%, #ffb08a, #ff5a7a); box-shadow: 0 8px 0 #d9415f, 0 14px 28px rgba(255, 90, 122, .35); display: grid; place-content: center; }
.m-tapbtn b { font-size: 56px; font-weight: 900; line-height: 1; }
.m-tapbtn small { font-weight: 800; font-size: 13px; }
.m-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.m-ringv { transition: stroke-dashoffset .08s; }
.bump { animation: bump .15s ease-out; }
@keyframes bump { 50% { transform: scale(.92); } }
.m-tapbtn.bump { animation: tbump .12s ease-out; }
@keyframes tbump { 50% { transform: translateY(5px) scale(.96); box-shadow: 0 3px 0 #d9415f; } }
/* 같은 색 */
.m-color { display: grid; gap: 12px; justify-items: center; }
.m-target { width: 96px; height: 96px; border-radius: 26px; background: #fff7ef; display: grid; place-items: center; border: 3px dashed #ffcf9c; }
.m-color .m-grid { width: 100%; }
/* 화살표 */
.m-arrows { display: grid; gap: 12px; justify-items: center; }
.m-seq { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.m-chip { width: 42px; height: 42px; border-radius: 12px; background: #f1f0f7; color: #a7aac2; display: grid; place-items: center; }
.m-chip.cur { background: #ffe9d6; color: #ff6b3c; box-shadow: 0 0 0 3px #ffb070; transform: scale(1.08); }
.m-chip.done { background: #d4f8e8; color: #2fb98a; }
.m-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 8px; }
.m-pad button { height: 66px; border: 0; border-radius: 18px; background: #5f7cff; color: #fff; box-shadow: 0 5px 0 #3d55c9; cursor: pointer; display: grid; place-items: center; }
.m-pad button:active { transform: translateY(4px); box-shadow: 0 1px 0 #3d55c9; }
/* 덧셈 */
.m-add { display: grid; gap: 14px; }
.m-eq { display: flex; justify-content: center; align-items: flex-start; gap: 10px; font-size: 48px; font-weight: 900; }
.m-eq span { display: grid; justify-items: center; min-width: 40px; }
.m-eq b { color: #ff9a3c; }
.m-eq .q { color: #8b7cf6; }
.m-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 60px; }
.m-dots em { width: 9px; height: 9px; border-radius: 50%; background: #ffc93c; }
/* 숨은 도형 */
.m-find .m-grid { justify-content: center; }
.m-find .g3 { grid-template-columns: repeat(3, 72px); }
.m-find .g4 { grid-template-columns: repeat(4, 62px); gap: 6px; }
.m-cell { border: 0; background: #f7f5fd; border-radius: 16px; aspect-ratio: 1; display: grid; place-items: center; cursor: pointer; }
/* 과녁 */
.m-range { position: relative; height: 230px; border-radius: 18px; overflow: hidden; background: radial-gradient(circle, #e9f6ff 0 2px, transparent 3px) 0 0 / 22px 22px, #f5fbff; }
.m-bull { position: absolute; left: 0; top: 0; border: 0; padding: 0; background: none; cursor: crosshair; border-radius: 50%; touch-action: none; }
.m-bull svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .2)); }
.m-hits { position: absolute; left: 0; right: 0; bottom: 4px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.m-hits i { width: 14px; height: 14px; border-radius: 50%; background: #dfe3ee; }
.m-hits i.on { background: #ff5a5a; }
/* 글자 */
.m-letters { display: grid; gap: 14px; }
.m-word { display: flex; justify-content: center; gap: 6px; }
.m-word span { font-size: 40px; font-weight: 900; width: 58px; height: 64px; border-radius: 16px; display: grid; place-items: center; background: #f6f6fb; color: #b5b8cc; }
.m-word span.cur { background: #fff0dc; color: #ff7a2e; box-shadow: 0 0 0 3px #ffb070; }
.m-word span.done { background: #d4f8e8; color: #2fb98a; }
/* 세기 */
.m-count { display: grid; gap: 10px; }
.m-field { position: relative; height: 150px; border-radius: 18px; background: #fffaf0; }
.m-field span { position: absolute; display: grid; }
/* 전선 */
.m-wire { display: grid; grid-template-columns: 26px 1fr 26px; align-items: stretch; height: 220px; }
.m-box { border-radius: 10px; background: linear-gradient(#8e93ad, #5c6180); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .2); }
.m-wires { display: flex; flex-direction: column; justify-content: space-around; padding: 6px 0; }
.m-w { border: 0; background: none; padding: 0; height: 40px; cursor: pointer; position: relative; }
.m-w svg { width: 100%; height: 100%; display: block; }
.m-w.cut svg { clip-path: polygon(0 0, 46% 0, 46% 100%, 0 100%, 0 0, 54% 0, 100% 0, 100% 100%, 54% 100%); transform: none; }
.m-w.cut::after { content: ""; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; transform: translate(-50%, -50%); background: radial-gradient(circle, #fff 0 30%, #ffd84d 31% 55%, transparent 56%); animation: pop .3s; }
.m-w.no svg { filter: drop-shadow(0 0 4px #ff6b6b); }
/* 숫자 차례 */
.m-numbers { position: relative; height: 230px; }
.m-bub { position: absolute; width: 60px; height: 60px; border-radius: 50%; border: 0; font-size: 28px; font-weight: 900; color: #fff; background: var(--bc); box-shadow: 0 4px 0 rgba(0, 0, 0, .18); cursor: pointer; text-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.m-bub.ok { opacity: .25; transform: scale(.8); }
.m-bub.no { box-shadow: 0 0 0 4px #ff6b6b; }
/* 꾹 누르기 */
.m-hold { display: grid; justify-items: center; gap: 10px; }
.m-holdbtn { position: relative; width: min(100%, 280px); height: 120px; border: 0; border-radius: 30px; overflow: hidden; cursor: pointer; background: #ffe8d6; box-shadow: 0 6px 0 #f0b98e; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.m-holdbtn b { position: relative; font-size: 20px; font-weight: 900; color: #b5522a; }
.m-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #ffb070, #ff6b6b); }
.m-hold small { color: var(--muted); font-weight: 700; }

/* ---------- 연습 ---------- */
.p-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px 6px; }
.p-bomb { width: 110px; height: 110px; flex: none; animation: wob .6s ease-in-out infinite; position: relative; }
.p-bomb[data-heat="3"] { animation-duration: .2s; }
.pboom { position: absolute; inset: -40%; animation: boomIn 1.4s cubic-bezier(.2, 1.4, .4, 1) forwards; }
.pboom svg { width: 100%; height: 100%; }
.p-info { flex: 1; display: grid; gap: 8px; }
.p-count { display: flex; align-items: baseline; gap: 4px; }
.p-count b { font-size: 50px; font-weight: 900; color: #ff5a7a; line-height: 1; }
.p-count span { font-weight: 800; color: var(--muted); }
.p-fuse { --f: 1; position: relative; height: 26px; border-radius: 99px; background: #f1e3d3; overflow: hidden; }
.p-fuse i { position: absolute; inset: 0; width: calc(var(--f) * 100%); background: repeating-linear-gradient(-45deg, #d9a35e 0 8px, #c48943 8px 16px); border-radius: 99px; transition: width .1s linear; }
.p-fuse i::after { content: ""; position: absolute; right: -4px; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); border-radius: 50%; background: radial-gradient(circle, #fff 0 25%, #ffd84d 26% 50%, #ff7a3c 51% 65%, transparent 66%); animation: spark .15s infinite alternate; }
.p-fuse span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 14px; color: #5a3a00; }
.p-panel { flex: 1; display: flex; flex-direction: column; padding: 6px 10px calc(14px + env(safe-area-inset-bottom)); }
.p-panel > .pn-msg { margin: auto 0; }
.cd.big { text-align: center; margin: auto; font-size: 96px; }
.p-res { margin: auto 0; background: #fff; border-radius: 24px; padding: 20px; text-align: center; box-shadow: 0 10px 30px rgba(160, 100, 60, .14); }
.p-res h3 { margin: 0; font-size: 24px; font-weight: 900; color: #ff5a7a; }
.p-big b { font-size: 72px; font-weight: 900; line-height: 1.1; }
.p-big span { font-weight: 800; color: var(--muted); }
.p-res p { margin: 6px 0; }
.p-res .fine { color: var(--muted); font-size: 13px; }

/* ---------- 결과 ---------- */
.overlay { position: fixed; inset: 0; z-index: 8000; display: grid; place-items: center; padding: 16px; background: rgba(70, 40, 60, .35); backdrop-filter: blur(3px); overflow-y: auto; }
.res-card { position: relative; width: 100%; max-width: 440px; background: #fff; border-radius: 28px; padding: 18px 16px 16px; box-shadow: 0 24px 60px rgba(60, 30, 40, .3); animation: kitUp .3s ease-out; overflow: hidden; }
.res-confetti { position: absolute; inset: 0; pointer-events: none; }
.res-confetti i { position: absolute; left: var(--x); top: -12px; width: 8px; height: 14px; border-radius: 2px; background: var(--c); animation: conf 2.6s var(--d) linear infinite; }
@keyframes conf { to { transform: translateY(560px) rotate(720deg); } }
.res-win { position: relative; text-align: center; }
.res-av { width: 110px; height: 110px; margin: 0 auto; animation: hop 1s ease-in-out infinite; }
.res-av svg { width: 100%; height: 100%; overflow: visible; }
.res-win h2 { margin: 2px 0 0; font-size: 26px; font-weight: 900; color: #ff5a7a; }
.res-win p { margin: 4px 0 10px; color: var(--muted); }
.res-list { position: relative; list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-height: 44vh; overflow-y: auto; }
.res-list li { display: grid; grid-template-columns: 28px 40px 1fr auto auto; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 16px; background: #faf7f3; border-left: 5px solid var(--pc); }
.res-list li.me { background: #fff1e4; box-shadow: 0 0 0 2px #ffb070; }
.res-list .rk { font-weight: 900; font-size: 18px; text-align: center; color: var(--muted); }
.res-list li.gold .rk { color: #e09a00; } .res-list li.silver .rk { color: #8a93ad; } .res-list li.bronze .rk { color: #c07a3e; }
.mini-av { width: 40px; height: 40px; display: grid; }
.mini-av svg { width: 100%; height: 100%; overflow: visible; }
.res-list b { font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-list b small { font-size: 11px; color: var(--muted); }
.res-list b em { font-style: normal; font-size: 11px; color: #fff; background: #ff7a45; padding: 0 5px; border-radius: 99px; }
.res-list .hearts { display: flex; }
.res-list .gold { font-weight: 900; color: #d98a00; font-size: 14px; }
.res-btns { position: relative; display: flex; gap: 8px; margin-top: 14px; }
.res-btns .btn { flex: 1; }

/* ---------- 대기실 · 놀이 방법 (키트 창 안) ---------- */
.bot-row { display: flex; flex-wrap: wrap; gap: 6px; }
.bot-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 3px; border-radius: 99px; background: #fff; border: 1.5px solid #f3e6da; font-size: 13px; font-weight: 800; }
.bot-chip i { width: 26px; height: 26px; display: grid; }
.bot-chip i svg { width: 100%; height: 100%; }
.lob-total { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
.lob-total b { color: var(--ink); }
.kit-seg button:disabled { cursor: default; }
.kit-seg button.on:disabled { opacity: 1; }
.how { display: grid; gap: 8px; margin: 8px 0; }
.how-step { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 16px; background: #fff7ef; }
.how-step i { width: 52px; height: 52px; display: grid; place-items: center; }
.how-step i svg { width: 100%; height: 100%; }
.how-step p { margin: 0; font-size: 14px; line-height: 1.5; }
.logo-bomb, .logo-bomb svg { width: 100%; height: 100%; }

/* ---------- PC (가로 화면) ---------- */
@media (min-width: 880px) and (min-aspect-ratio: 5/4) {
  .gmain { flex-direction: row; justify-content: center; align-items: center; gap: 24px; padding: 8px 20px 20px; }
  #tableWrap { width: min(calc(100vh - 90px), calc(100dvh - 90px), 58vw, 720px); }
  #panel { width: 420px; flex: none; justify-content: center; min-height: 420px; }
  .gbar { max-width: 1180px; }
  .seat .nm { font-size: 14px; }
}
@media (min-width: 700px) {
  .hero { height: 290px; } .hero-in { transform: scale(1.3); }
}
/* 키 작은 휴대폰 */
@media (max-height: 700px) and (max-width: 600px) {
  #tableWrap { width: min(calc(100vw - 8px), 44vh); }
  .ms { min-height: 250px; }
  .ms-body { min-height: 196px; }
  .m-range, .m-numbers { height: 190px; }
  .m-wire { height: 190px; }
  .hero { height: 180px; }
}
.p-panel .ms { flex: 0 1 auto; margin: auto 0; min-height: min(420px, 100%); }
.p-panel .ms-body { min-height: 330px; }
/* 키 큰 휴대폰: 처음 화면 그림을 크게 */
@media (min-height: 760px) and (max-width: 600px) {
  .hero { height: 300px; margin: 14px 0 10px; }
  .hero-in { transform: scale(1.3); }
  .menu { gap: 14px; }
}

/* ---------- 컴퓨터와 하기 · 처음 화면 칸 4개 ---------- */
.tiles { grid-template-columns: repeat(2, 1fr); }
.t-solo { background: linear-gradient(140deg, #ff9ab8, #ff6b8e); }
.res-note { margin: 4px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }

/* ---------- 휴대폰 가로 화면: 탁자 왼쪽 · 미션 오른쪽 ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  #game, #practice { max-width: none; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .gbar { max-width: none; padding: 4px 12px 0; }
  .gtitle { font-size: 15px; padding: 4px 12px; }
  .gmain { flex-direction: row; align-items: stretch; justify-content: center; gap: 10px; padding: 2px 10px 4px; min-height: 0; }
  #tableWrap { width: min(calc(100vh - 48px), calc(100dvh - 48px), 46vw); align-self: center; margin: 0; }
  #panel { flex: 1; max-width: 470px; min-width: 0; padding: 0 0 calc(4px + env(safe-area-inset-bottom)); gap: 5px; overflow-y: auto; justify-content: center; }
  .pn-head { padding: 4px 10px; font-size: 13px; }
  .pn-head.go { padding: 6px; font-size: 14px; }
  .pn-msg { padding: 10px 12px; }
  .ms { min-height: 0; padding: 6px 8px; }
  .ms-title { font-size: 15px; padding: 0 4px 4px; }
  .ms-body { min-height: 0; }
  .m-range, .m-numbers { height: min(210px, calc(100dvh - 150px)); }
  .m-wire { height: min(200px, calc(100dvh - 150px)); }
  .m-field { height: 110px; }
  .m-tapbtn { width: 140px; height: 140px; }
  .m-tapbtn b { font-size: 44px; }
  .m-opt { min-height: 50px; }
  .m-pad button { height: 50px; }
  .m-pad { grid-template-columns: repeat(3, 64px); gap: 6px; }
  .m-arrows, .m-color, .m-add, .m-letters, .m-count { gap: 8px; }
  .m-target { width: 70px; height: 70px; }
  .m-target svg { width: 56px; height: 56px; }
  .m-eq { font-size: 36px; }
  .m-word span { font-size: 30px; height: 48px; width: 48px; }
  .m-find .g3 { grid-template-columns: repeat(3, 58px); }
  .m-find .g4 { grid-template-columns: repeat(4, 46px); gap: 5px; }
  .m-holdbtn { height: 96px; }
  .targets { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
  .tgt i { width: 42px; height: 42px; }
  .emo { padding: 6px 4px; }
  /* 연습: 폭탄·숫자 왼쪽, 미션 오른쪽 */
  #practice { display: grid; grid-template-columns: minmax(170px, 34vw) 1fr; grid-template-rows: auto 1fr; }
  #practice .gbar { grid-column: 1 / -1; }
  .p-top { flex-direction: column; justify-content: center; padding: 6px 10px; }
  .p-bomb { width: 90px; height: 90px; }
  .p-info { width: 100%; }
  .p-panel { min-height: 0; overflow-y: auto; padding: 4px 10px calc(6px + env(safe-area-inset-bottom)); }
  .p-panel .ms { min-height: 0; }
  .p-panel .ms-body { min-height: 0; }
  .res-card { max-height: calc(100dvh - 20px); overflow-y: auto; }
}
html { overflow-x: hidden; }
@media (orientation: landscape) and (max-height: 520px) {
  .hero { height: 150px; margin: 0; }
  .hero-in { transform: scale(.7); }
  #home { max-width: 760px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}
