/* 샤봇 블록 낙하 — 네온 공장 */

/* ── 공통 틀(퍼즐 6종이 같이 쓰는 모양): 제목 화면 · PLAY 단추 · HUD 알약 · 결과 별 · 손가락 안내 ──
   게임마다 바꾸는 색: --k-a(로고 위) --k-b(로고 아래) --k-edge(로고 테두리) --k-glow(빛) */
.k-title { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 18px 16px; text-align: center; overflow: hidden; }
.k-title[hidden] { display: none; }
.k-title > * { position: relative; z-index: 2; }
.k-title .k-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.k-bot { width: 86px; height: 86px; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.35)); animation: k-bob 2.4s ease-in-out infinite; }
@keyframes k-bob { 50% { transform: translateY(-9px) rotate(-3deg); } }
.k-logo { position: relative; margin: 0; font-family: 'Black Han Sans', var(--title); font-weight: 400; font-size: clamp(42px, 8.4vw, 82px); line-height: 1; letter-spacing: -0.01em; white-space: nowrap; }
.k-logo span { position: relative; display: inline-block; background: linear-gradient(180deg, #fff 8%, var(--k-a, #ffe27a) 46%, var(--k-b, #ff9a3c) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.k-logo::before { content: attr(data-t); position: absolute; inset: 0; z-index: -1; -webkit-text-stroke: 12px var(--k-edge, #3a1d6e); color: var(--k-edge, #3a1d6e); text-shadow: 0 8px 0 var(--k-edge, #3a1d6e), 0 16px 26px rgba(0, 0, 0, 0.45); }
.k-logo small { display: block; font-size: 0.34em; margin-top: 6px; }
.k-sub { margin: -4px 0 2px; max-width: 420px; font-size: 15px; line-height: 1.45; color: rgba(255, 255, 255, 0.86); text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); }
@media (max-width: 420px) { .k-logo { font-size: clamp(36px, 11vw, 54px); } .k-bot { width: 70px; height: 70px; } }

/* 크고 도톰한 입체 단추 (모든 게임 같은 금빛) */
.k-play { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-width: 230px; padding: 15px 44px 17px; border: 0; border-radius: 24px; cursor: pointer; overflow: hidden;
  font-family: 'Black Han Sans', var(--title); font-size: 32px; line-height: 1; color: #fff; letter-spacing: 0.02em; text-shadow: 0 3px 0 rgba(150, 60, 0, 0.55);
  background: linear-gradient(180deg, #ffe066 0%, #ffb21e 52%, #ff8a00 100%);
  box-shadow: 0 8px 0 #c25e00, 0 14px 26px rgba(0, 0, 0, 0.38), inset 0 3px 0 rgba(255, 255, 255, 0.65), inset 0 -4px 0 rgba(200, 80, 0, 0.35);
  animation: k-breathe 1.8s ease-in-out infinite; transition: transform 0.08s, box-shadow 0.08s; }
.k-play::before { content: ''; position: absolute; left: 10px; right: 10px; top: 5px; height: 42%; border-radius: 18px 18px 40% 40%; background: linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0)); pointer-events: none; }
.k-play::after { content: ''; position: absolute; top: -20%; bottom: -20%; width: 34%; left: -50%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.75), transparent); transform: skewX(-18deg); animation: k-shine 2.8s ease-in-out infinite; pointer-events: none; }
.k-play svg { width: 0.9em; height: 0.9em; fill: #fff; filter: drop-shadow(0 3px 0 rgba(150, 60, 0, 0.55)); }
.k-play:hover { filter: brightness(1.06); }
.k-play:active { transform: translateY(6px) scale(0.98); box-shadow: 0 2px 0 #c25e00, 0 6px 12px rgba(0, 0, 0, 0.3), inset 0 3px 0 rgba(255, 255, 255, 0.65); animation: none; }
.k-play.small { min-width: 0; font-size: 24px; padding: 12px 26px 14px; border-radius: 18px; }
.k-play.wide { width: 100%; }
@keyframes k-breathe { 50% { transform: scale(1.045); } }
@keyframes k-shine { 0%, 55% { left: -50%; } 100% { left: 130%; } }

.k-ghost[hidden], .k-play[hidden], .k-best[hidden], .k-link[hidden] { display: none; }
/* 작은 보조 단추 · 고르기 칩 */
.k-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 16px; border: 2px solid rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.1); color: #fff; font-family: var(--title); font-size: 17px; cursor: pointer; text-decoration: none; backdrop-filter: blur(4px); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25); }
.k-ghost:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.k-link { display: inline-block; margin-top: 2px; font-size: 14px; color: rgba(255, 255, 255, 0.72); text-decoration: underline; text-underline-offset: 3px; }

/* HUD 알약: 아이콘 + 숫자 */
.k-pill { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 4px; border-radius: 999px; background: linear-gradient(180deg, rgba(20, 16, 50, 0.72), rgba(20, 16, 50, 0.55)); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14), 0 4px 10px rgba(0, 0, 0, 0.25); color: #fff; }
.k-pill i { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(180deg, var(--ic1, #ffd75e), var(--ic2, #ff9d1c)); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), inset 0 -3px 0 rgba(0, 0, 0, 0.2); }
.k-pill i svg { width: 19px; height: 19px; fill: #fff; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.3)); }
.k-pill b { font-family: 'Black Han Sans', var(--title); font-weight: 400; font-size: 22px; line-height: 1; min-width: 1.2em; text-align: center; letter-spacing: 0.01em; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.k-pill small { font-size: 11px; opacity: 0.7; margin-left: -2px; }
.k-pill.k-hot b { color: #ffd75e; }
.k-pop { animation: k-pop 0.36s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes k-pop { 0% { transform: scale(1); } 35% { transform: scale(1.32) translateY(-2px); } 100% { transform: scale(1); } }
.k-best { display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px 7px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.28); box-shadow: inset 0 0 0 2px rgba(255, 215, 94, 0.45); color: #ffe7a0; font-family: var(--title); font-size: 17px; }
.k-best i { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(#ffe27a, #ffa41c); }
.k-best i svg { width: 17px; height: 17px; fill: #fff; }
.k-best b { font-family: 'Black Han Sans', var(--title); font-weight: 400; font-size: 21px; color: #fff; }

/* 결과 화면 카드 */
.k-res { position: absolute; inset: 0; z-index: 12; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at 50% 40%, rgba(40, 30, 90, 0.55), rgba(10, 8, 30, 0.86)); backdrop-filter: blur(3px); }
.k-res[hidden] { display: none; }
.k-card { position: relative; width: min(380px, 100%); max-height: 100%; overflow: auto; padding: 16px 22px 20px; border-radius: 28px; text-align: center; color: #fff;
  background: linear-gradient(180deg, var(--k-card1, #3b2f86) 0%, var(--k-card2, #231a5c) 100%); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.16), inset 0 3px 0 rgba(255, 255, 255, 0.25), 0 26px 60px rgba(0, 0, 0, 0.5);
  animation: k-card-in 0.45s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes k-card-in { from { transform: translateY(40px) scale(0.85); opacity: 0; } }
.k-card h2 { margin: 0 0 2px; font-family: 'Black Han Sans', var(--title); font-weight: 400; font-size: 34px; line-height: 1.1; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); }
.k-card p { margin: 0 0 10px; color: rgba(255, 255, 255, 0.78); font-size: 15px; }
.k-stars { display: flex; justify-content: center; align-items: flex-end; gap: 2px; margin: 0 0 4px; }
.k-stars span { width: 62px; height: 62px; display: block; }
.k-stars span:nth-child(2) { width: 82px; height: 82px; margin-bottom: 12px; }
.k-stars svg { width: 100%; height: 100%; overflow: visible; }
.k-stars .bg { fill: #1a1446; stroke: rgba(255, 255, 255, 0.25); stroke-width: 1.4; }
.k-stars .fg { fill: url(#k-gold); stroke: #b86a00; stroke-width: 1.4; transform-origin: 12px 12px; transform: scale(0); }
.k-stars .on .fg { animation: k-stamp 0.42s cubic-bezier(.3, 1.9, .5, 1) forwards; }
@keyframes k-stamp { 0% { transform: scale(2.4) rotate(-30deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.k-score { display: block; margin: 4px 0 2px; font-family: 'Black Han Sans', var(--title); font-weight: 400; font-size: 56px; line-height: 1.05; background: linear-gradient(#fff, #ffe48a); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.35)); }
.k-rows { display: grid; gap: 6px; margin: 8px 0 12px; }
.k-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); font-size: 15px; }
.k-row b { font-family: 'Black Han Sans', var(--title); font-weight: 400; font-size: 20px; }
.k-next { margin: 0 0 12px; padding: 8px 12px; border-radius: 14px; background: rgba(255, 215, 94, 0.14); box-shadow: inset 0 0 0 1.5px rgba(255, 215, 94, 0.4); color: #ffe7a0; font-size: 14px; }
.k-next:empty { display: none; }
.k-ribbon { position: relative; display: inline-block; margin: 2px 0 8px; padding: 6px 26px; font-family: 'Black Han Sans', var(--title); font-size: 20px; color: #fff; background: linear-gradient(#ff5d8f, #e0245e); box-shadow: 0 4px 0 #9c1240; border-radius: 6px; transform: rotate(-3deg); animation: k-ribbon 0.6s 0.3s cubic-bezier(.3, 1.8, .5, 1) both; }
.k-ribbon[hidden] { display: none; }
@keyframes k-ribbon { from { transform: rotate(-3deg) scale(0); } }
.k-card .k-play { margin-top: 4px; }
.k-card .k-link { margin-top: 12px; }

/* 손가락 안내 */
.k-hand { position: absolute; left: 0; top: 0; z-index: 9; width: 58px; height: 58px; pointer-events: none; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.4)); }
.k-hand svg { width: 100%; height: 100%; transform-origin: 30% 8%; }
.k-hand.press svg { transform: scale(0.85); }
.k-tap { position: absolute; z-index: 8; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; border: 4px solid #fff; pointer-events: none; animation: k-tap 0.6s ease-out forwards; }
@keyframes k-tap { from { transform: scale(0.3); opacity: 0.9; } to { transform: scale(1.4); opacity: 0; } }
.k-tipbox { position: absolute; left: 50%; z-index: 9; transform: translateX(-50%); padding: 8px 16px; border-radius: 14px; background: rgba(15, 10, 40, 0.82); color: #fff; font-family: var(--title); font-size: 17px; white-space: nowrap; pointer-events: none; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); animation: k-tip-in 0.4s ease-out both; }
@keyframes k-tip-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* 콤보 글자 */
.sb-float.k-combo { font-family: 'Black Han Sans', var(--title); -webkit-text-stroke: 7px rgba(40, 10, 70, 0.92); letter-spacing: 0.02em; }
@media (prefers-reduced-motion: reduce) { .k-play, .k-bot { animation: none; } }

.stage.bf { padding: 8px; touch-action: none; overscroll-behavior: none;
  background: radial-gradient(120% 80% at 50% 0%, #2a2f6e 0%, #1a1e44 55%, #12152e 100%); }
.stage.bf::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.55;
  background: radial-gradient(40% 30% at 12% 85%, rgba(23, 179, 155, 0.13), transparent 70%), radial-gradient(40% 30% at 88% 18%, rgba(255, 200, 61, 0.09), transparent 70%); }

.bf-main { position: relative; z-index: 1; display: grid; grid-template-areas: "cv"; gap: 10px; align-items: center; justify-items: center; }
.bf-wrap { grid-area: cv; position: relative; }
.bf-cv { display: block; touch-action: none; }
.bf-pause { position: absolute; left: 81.4%; width: 18.6%; top: 91.5%; height: 8.5%; display: grid; place-items: center; padding: 0;
  border: 1px solid rgba(143, 150, 255, 0.28); border-radius: 12px; background: rgba(255, 255, 255, 0.06); color: #cfd3ff; cursor: pointer; }
.bf-pause:hover { background: rgba(255, 255, 255, 0.12); }
.bf-pause svg { width: 46%; height: 60%; fill: currentColor; }

/* 화면 단추 (터치 기기에서만) */
.bf-pl, .bf-pr { display: none; gap: 8px; }
.bf.touch .bf-pl, .bf.touch .bf-pr { display: grid; }
.bf-b { display: grid; place-items: center; padding: 0; border-radius: 16px; touch-action: none; cursor: pointer; -webkit-touch-callout: none;
  border: 1px solid rgba(143, 150, 255, 0.35); background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05)); color: #e8eaff;
  box-shadow: 0 4px 0 rgba(8, 10, 30, 0.55); transition: transform 0.05s, filter 0.05s; }
.bf-b svg { width: 52%; height: 52%; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.bf-b span { font-family: var(--title); font-size: 17px; line-height: 1; white-space: nowrap; overflow: hidden; max-width: 92%; }
.bf-b.on { transform: translateY(3px); box-shadow: 0 1px 0 rgba(8, 10, 30, 0.55); filter: brightness(1.25); }
.bf-b-hold { grid-area: hold; color: #b9fff0; border-color: rgba(23, 179, 155, 0.6); background: linear-gradient(180deg, rgba(23, 179, 155, 0.3), rgba(23, 179, 155, 0.12)); }
.bf-b-l { grid-area: l; } .bf-b-r { grid-area: r; } .bf-b-d { grid-area: d; }
.bf-b-drop { grid-area: drop; color: #ffd9d4; border-color: rgba(255, 107, 90, 0.6); background: linear-gradient(180deg, rgba(255, 107, 90, 0.32), rgba(255, 107, 90, 0.12)); }
.bf-b-rot { grid-area: rot; color: #fff; border-color: rgba(123, 108, 255, 0.8); background: linear-gradient(135deg, #7b6cff, #4f5bea); }

/* 세로 폰: 판 아래 한 줄 */
.bf.port .bf-main { grid-template-areas: "cv cv" "pl pr"; grid-template-columns: 1fr 1fr; }
.bf.port .bf-pl { grid-template-areas: "hold l r"; }
.bf.port .bf-pr { grid-template-areas: "d drop rot"; }
.bf.port .bf-pl, .bf.port .bf-pr { width: 100%; grid-template-columns: repeat(3, 1fr); }
.bf.port .bf-b { height: var(--bh, 60px); }

/* 가로 폰: 판 양옆 */
.bf.land .bf-main { grid-template-areas: "pl cv pr"; gap: 12px; }
.bf.land .bf-pl { grid-template-areas: "hold hold" "l r"; }
.bf.land .bf-pr { grid-template-areas: "rot rot" "d drop"; }
.bf.land .bf-pl, .bf.land .bf-pr { grid-template-columns: var(--bs, 60px) var(--bs, 60px); grid-auto-rows: var(--bs, 60px); }

/* 공장 바닥의 움직이는 네온 격자 */
.stage.bf { --k-a: #8fe9ff; --k-b: #7b6cff; --k-edge: #0d0c38; --k-card1: #2a2a78; --k-card2: #15153f; }
.stage.bf::after { content: ''; position: absolute; left: -10%; right: -10%; bottom: 0; height: 45%; pointer-events: none; opacity: 0.35;
  background-image: linear-gradient(rgba(123, 108, 255, 0.55) 1.5px, transparent 1.5px), linear-gradient(90deg, rgba(123, 108, 255, 0.55) 1.5px, transparent 1.5px);
  background-size: 48px 48px; transform: perspective(300px) rotateX(58deg); transform-origin: 50% 100%; animation: bf-floor 2.4s linear infinite;
  -webkit-mask: linear-gradient(transparent, #000 70%); mask: linear-gradient(transparent, #000 70%); }
@keyframes bf-floor { to { background-position: 0 48px; } }
.bf-pause { z-index: 3; }
.bf .k-pill { pointer-events: none; }

/* 제목 화면 */
.bf .ov-start { background: radial-gradient(60% 50% at 50% 35%, rgba(123, 108, 255, 0.45), transparent 70%), linear-gradient(180deg, #232766 0%, #15183f 60%, #0d0f2a 100%); }
.bf-grid { position: absolute; left: -10%; right: -10%; bottom: 0; height: 50%; opacity: 0.5;
  background-image: linear-gradient(rgba(143, 233, 255, 0.5) 1.5px, transparent 1.5px), linear-gradient(90deg, rgba(143, 233, 255, 0.5) 1.5px, transparent 1.5px);
  background-size: 56px 56px; transform: perspective(320px) rotateX(60deg); transform-origin: 50% 100%; animation: bf-floor2 1.6s linear infinite;
  -webkit-mask: linear-gradient(transparent, #000 75%); mask: linear-gradient(transparent, #000 75%); }
@keyframes bf-floor2 { to { background-position: 0 56px; } }
.bf-rain { position: absolute; top: -60px; width: 26px; height: 26px; border-radius: 6px; opacity: 0.8;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 55%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 55%, #000));
  box-shadow: 0 0 18px var(--c), inset 0 2px 0 rgba(255, 255, 255, 0.5); animation: bf-rain linear infinite; }
.bf-rain::after { content: ''; position: absolute; inset: 7px; border-radius: 3px; background: rgba(16, 17, 40, 0.55); }
@keyframes bf-rain { 0% { transform: translateY(0) rotate(0); } 100% { transform: translateY(115vh) rotate(180deg); } }
.bf-robot { display: block; width: 200px; height: auto; filter: drop-shadow(0 0 24px rgba(123, 108, 255, 0.55)); animation: k-bob 2.6s ease-in-out infinite; }
.bf .k-logo { font-size: clamp(40px, 7.6vw, 76px); }
.bf-keys { margin: -6px 0 0; max-width: 460px; font-size: 13px; line-height: 1.5; color: #a9afd6; }
.bf.touch .r-pc, .bf:not(.touch) .r-touch { display: none; }
.bf-bestline[hidden] { display: none; }
.bf-tip { top: auto; bottom: 22%; }
.bf .ov-pause .k-card { padding-top: 26px; }
@media (max-height: 600px) { .bf-robot { width: 130px; } .bf .k-sub { display: none; } }
@media (max-height: 420px) { .bf-robot { display: none; } .bf-keys { display: none; } }
@media (max-width: 420px) { .bf .k-logo { font-size: 40px; } .bf-robot { width: 150px; } }
