/* 모내기 미니게임 공통 스타일 — app.css 위에, lib/mini.js 가 만드는 뼈대에 붙어요 */

/* 소개 무대 그림 자리 */
.intro-art { position: absolute; inset: 44px 20px 20px; display: grid; place-items: center; pointer-events: none; }

/* 플레이 무대 */
.stage--mini { padding: 0; cursor: default; }
.stage--mini .num { position: absolute; top: 22px; left: 22px; z-index: 2; }
.live { position: absolute; top: 16px; right: 20px; z-index: 2; font: 400 28px/1 var(--font-pixel); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--on-stage); pointer-events: none; }
.live { transform-origin: right center; }
.live.is-up { animation: live-up 320ms var(--ease-pop, ease-out); }
.live.is-down { animation: live-down 320ms ease-out; }
@keyframes live-up { 35% { transform: scale(1.22); color: var(--sprout); } }
@keyframes live-down { 25% { transform: translateX(-4px); color: var(--p1); } 60% { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .live.is-up, .live.is-down { animation: none; } }
.live small { margin-left: 3px; font: 500 12px/1 var(--font-mono); color: var(--on-stage-muted); }
.mini-body { position: absolute; inset: 56px 20px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.stage--mini .layer--count { z-index: 3; background: var(--stage); }

/* 문제 글자 */
.prompt { margin: 0; font: 400 64px/1.05 var(--font-display); letter-spacing: -0.02em; }
.prompt--num { font-family: var(--font-pixel); font-size: 72px; font-variant-numeric: tabular-nums; }
.prompt-sub { margin: 0; font: 600 15px/22px var(--font-sans); color: var(--on-stage-muted); }
.order { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: var(--radius-pill); background: var(--stage-raised); font: 700 15px/1 var(--font-sans); }
.order.is-win { background: var(--sprout); color: var(--stage); }
.order.is-lose { background: var(--p1); color: var(--stage); }
.order.is-tie { background: var(--grain); color: var(--stage); }

/* 문제마다 줄어드는 시간 막대 */
.qbar { position: absolute; left: 22px; right: 22px; top: 50px; height: 5px; border-radius: 3px; background: var(--stage-raised); overflow: hidden; z-index: 2; }
.qbar i { position: absolute; inset: 0; border-radius: 3px; background: var(--sprout); transform-origin: left; }

/* 맞음·틀림: 무대 테두리가 잠깐 번쩍 + 가운데 표시 (색만으로 알리지 않아요) */
.stage--mini.is-good { box-shadow: var(--shadow-stage), inset 0 0 0 4px var(--sprout); }
.stage--mini.is-bad { box-shadow: var(--shadow-stage), inset 0 0 0 4px var(--p1); animation: mini-shake 240ms var(--ease-out); }
@keyframes mini-shake { 25% { transform: translateX(-5px); } 60% { transform: translateX(4px); } }
.mark { position: absolute; left: 50%; bottom: 18px; translate: -50% 0; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: var(--radius-pill); font: 700 13px/1 var(--font-sans); background: var(--stage-raised); color: var(--on-stage); opacity: 0; transition: opacity 120ms var(--ease-out); pointer-events: none; z-index: 2; white-space: nowrap; }
.mark.is-on { opacity: 1; }
.mark.is-ok { background: var(--sprout); color: var(--stage); }
.mark.is-no { background: var(--p1); color: var(--stage); }

/* 무대 아래 보기 버튼 */
.foot-body { width: 100%; }
.answers { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 8px; width: 100%; }
.ans { position: relative; min-width: 0; height: 68px; padding: 0 6px; border: 0; border-radius: var(--radius-md); background: var(--paper-raised); box-shadow: inset 0 0 0 1.5px var(--line), 0 3px 0 var(--line); color: var(--ink); font: 400 22px/1 var(--font-display); cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; transition: transform 60ms var(--ease-out); }
.ans:active, .ans.is-press { transform: translateY(2px); box-shadow: inset 0 0 0 1.5px var(--line), 0 1px 0 var(--line); }
.ans:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ans kbd { position: absolute; top: 6px; left: 8px; font: 500 11px/1 var(--font-mono); color: var(--ink-muted); display: none; }
.ans svg { width: 40px; height: 40px; display: block; margin: 0 auto; }
.ans__t { display: block; margin-top: 2px; font: 600 12px/1 var(--font-sans); color: var(--ink-muted); }
@media (hover: hover) and (pointer: fine) { .ans kbd { display: block; } .ans:hover { background: var(--paper-overlay); } }

/* 결과: 점 20개 + 숫자 셋 */
.dots { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.dot { aspect-ratio: 1; border-radius: 6px; background: var(--line); }
.dot.is-ok { background: var(--sprout); }
.dot.is-slow { background: var(--grain); }
.dot.is-no { background: none; box-shadow: inset 0 0 0 2px var(--p1); position: relative; }
.dot.is-no::after { content: ''; position: absolute; inset: 28%; background: var(--p1); border-radius: 50%; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat { display: grid; gap: 6px; justify-items: center; padding: 16px 0 14px; border-radius: var(--radius-md); background: var(--paper-raised); box-shadow: inset 0 0 0 1.5px var(--line); }
.stat__v { font: 600 22px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.stat__k { font-size: 12px; line-height: 16px; color: var(--ink-muted); }


/* 문제 풀이 틀 */
.notice { margin: 0; padding: 12px 18px; border-radius: var(--radius-md); background: var(--stage-raised); font: 700 17px/24px var(--font-sans); }
.ans.is-right { box-shadow: inset 0 0 0 3px var(--sprout), 0 3px 0 var(--sprout); }
.ans.is-wrong { box-shadow: inset 0 0 0 3px var(--p1), 0 3px 0 var(--p1); }
.ans.is-wrong::after { content: '×'; position: absolute; top: 2px; right: 8px; font: 700 18px/1 var(--font-sans); color: var(--p1); }
.ans.is-right::after { content: '○'; position: absolute; top: 4px; right: 8px; font: 700 14px/1 var(--font-sans); color: var(--sprout); }


/* 숫자·기억 판 */
.board { display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); grid-auto-rows: var(--cell); gap: var(--gap, 8px); justify-content: center; }
.tile { position: relative; min-width: 0; padding: 0; border: 0; border-radius: 14px; background: var(--stage-raised); color: var(--on-stage); font: 400 calc(var(--cell) * 0.42)/1 var(--font-pixel); font-variant-numeric: tabular-nums; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; transition: transform 70ms var(--ease-out), opacity 120ms var(--ease-out), background 120ms var(--ease-out); }
.tile:active { transform: scale(0.94); }
.tile:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tile.is-done { opacity: 0.22; pointer-events: none; }
.tile.is-wrong { background: var(--p1); animation: mini-shake 240ms var(--ease-out); }

@media (max-height: 700px) {
  .prompt { font-size: 52px; }
  .prompt--num { font-size: 58px; }
  .ans { height: 60px; }
}
@media (min-width: 960px) and (min-height: 620px) {
  .app[data-game] .foot-body { max-width: 640px; }
  .live { top: 20px; right: 26px; font-size: 36px; }
  .stage--mini .num { top: 26px; left: 28px; }
  .qbar { left: 28px; right: 28px; top: 58px; }
  .mini-body { inset: 72px 32px 32px; gap: 20px; }
  .prompt { font-size: 96px; }
  .prompt--num { font-size: 104px; }
  .prompt-sub { font-size: 17px; }
  .ans { height: 76px; font-size: 26px; }
  .mark { bottom: 28px; height: 34px; font-size: 14px; }
  .dots { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { .stage--mini.is-bad { animation: none; } }
