/* 모아이 블록 블래스트 — 게임 고유 스타일 (공용 토큰은 ../../shared/theme.css) */

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 2vh, 20px);
  max-width: 520px;
  margin: 0 auto;
  padding:
    max(12px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

/* HUD */
#hud {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}
#mascot { width: 56px; height: 56px; flex: 0 0 auto; transform-origin: center bottom; }
#mascot.bob { animation: bob 1.8s ease-in-out infinite; }
#mascot.happy { animation: pop .45s ease; }
#scores { flex: 1; display: flex; gap: 10px; }
.score-box {
  flex: 1;
  background: var(--card);
  border: 1.5px solid var(--b-soft);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  box-shadow: var(--sh-soft);
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.score-box .pixel-label { font-size: 10px; }
.score-box strong { font-size: 20px; color: var(--ink); font-family: var(--f-pixel); }
#newgame { padding: 9px 14px; font-size: 13px; }

/* 보드 */
#board-wrap { position: relative; width: 100%; flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
#board {
  width: min(92vw, 56vh, 440px);
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: clamp(2px, 0.8vw, 4px);
  padding: clamp(6px, 1.6vw, 10px);
  background: var(--card);
  border: 2px solid var(--b);
  border-radius: var(--r);
  box-shadow: var(--sh-card);
  touch-action: none;
}
.cell {
  border-radius: 4px;
  background: var(--bg2);
  box-shadow: inset 0 1px 2px rgba(46, 37, 72, .07);
}
.cell.filled {
  box-shadow: inset 0 -3px 0 rgba(46, 37, 72, .22), inset 0 2px 0 rgba(255, 255, 255, .38);
}
.cell.ghost-ok { outline: 2px dashed rgba(31, 122, 80, .8); outline-offset: -2px; background: var(--ok-bg); }
.cell.ghost-bad { outline: 2px dashed rgba(184, 58, 110, .7); outline-offset: -2px; background: var(--ng-bg); }

/* 트레이 */
#tray {
  width: 100%;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 8px;
  min-height: clamp(72px, 14vh, 110px);
  background: var(--card);
  border: 1.5px solid var(--b-soft);
  border-radius: var(--r);
  padding: 10px;
  box-shadow: var(--sh-soft);
  touch-action: none;
}
.tray-slot {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  touch-action: none;
}
/* 조작성: 트레이 블록 픽업 터치 히트박스를 사방 약 22% 확대(잘못된 블록 선택 방지).
   투명 padding으로 클릭 영역만 키우고 동일 크기 음수 margin으로 시각 위치는 그대로 유지. */
.piece { display: grid; gap: 3px; touch-action: none; cursor: grab; padding: 6px; margin: -6px; }
.piece.dragging-src { opacity: .25; }
.pcell { border-radius: 3px; box-shadow: inset 0 -2px 0 rgba(46, 37, 72, .22), inset 0 2px 0 rgba(255, 255, 255, .4); }

/* 드래그 중 떠있는 조각 */
#float {
  position: fixed;
  left: 0; top: 0;
  z-index: 50;
  display: grid;
  gap: clamp(2px, 0.8vw, 4px);
  pointer-events: none;
  filter: drop-shadow(0 8px 10px rgba(46, 37, 72, .3));
  will-change: transform;
}
#float .pcell { border-radius: 4px; }

/* 콤보 버블 */
.combo-bubble {
  position: absolute;
  top: 8%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--c-primary);
  color: #fff;
  font-family: var(--f-pixel);
  font-size: 14px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 2px solid var(--ink);
  box-shadow: 0 4px 0 rgba(46, 37, 72, .2);
  animation: pop .4s ease;
  pointer-events: none;
  z-index: 20;
}

/* 반짝이 버스트 */
.spark {
  position: fixed;
  width: 8px; height: 8px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 40;
  animation: spark-fly .5s ease-out forwards;
}
@keyframes spark-fly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; }
}

/* 게임오버 */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(46, 37, 72, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.go-card {
  text-align: center;
  max-width: 320px;
  width: 100%;
  animation: fadeInUp .35s ease;
}
#go-mascot { width: 84px; height: 84px; margin: 0 auto 8px; animation: shakeX .5s ease; }
.go-title { font-family: var(--f-display); font-size: 26px; color: var(--ink); margin-bottom: 10px; }
.go-score, .go-best { font-size: 15px; color: var(--ink2); margin: 2px 0; }
.go-score strong, .go-best strong { font-family: var(--f-pixel); font-size: 20px; color: var(--c-purple); margin-left: 6px; }
#restart { margin-top: 16px; width: 100%; }

[hidden] { display: none !important; }
