/* 모아이 낱말맞히기 — 게임 스타일 */
#app {
  display: flex; flex-direction: column;
  height: 100vh; height: 100svh; overflow: hidden;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
#hud { display: flex; align-items: center; gap: 12px; padding: 4px 4px 6px; }
#mascot { width: 40px; height: 40px; flex: 0 0 auto; }
.title { flex: 1; font-size: 16px; }
#newgame { padding: 8px 12px; font-size: 13px; }

#stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 8px; }

#board { display: grid; grid-template-rows: repeat(6, 1fr); gap: 6px; margin-top: 6px; }
.row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.row.shake { animation: shakeX .4s ease; }
.tile {
  width: clamp(44px, 13vw, 58px); height: clamp(44px, 13vw, 58px);
  border: 2px solid var(--b); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-pixel); font-size: clamp(22px, 6vw, 28px); color: var(--ink);
  background: var(--card); text-transform: uppercase;
}
.tile.filled { border-color: var(--c-purple); animation: pop .15s ease; }
.tile.correct { background: #7BD0A6; border-color: #5FB98C; color: #14331f; }
.tile.present { background: #F5C24B; border-color: #D9A82E; color: #3a2c00; }
.tile.absent { background: #B6AECB; border-color: #9890B0; color: #fff; }

#msg { min-height: 18px; font-family: var(--f-pixel); font-size: 12px; color: var(--c-purple); }

#kbd { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 6px; padding-bottom: 4px; }
.krow { display: flex; justify-content: center; gap: 5px; }
.key {
  flex: 0 1 52px; width: 52px; min-width: 48px; height: 48px; border: 1.5px solid var(--ink); border-radius: 7px;
  background: var(--card); color: var(--ink); font-family: var(--f-body); font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 0 rgba(46, 37, 72, .15);
  touch-action: none; user-select: none; cursor: pointer;
}
.key:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(46, 37, 72, .15); }
.key.wide { flex-basis: 74px; width: 74px; max-width: 74px; font-size: 12px; }
.key.correct { background: #7BD0A6; border-color: #5FB98C; color: #14331f; }
.key.present { background: #F5C24B; border-color: #D9A82E; color: #3a2c00; }
.key.absent { background: #B6AECB; border-color: #9890B0; color: #fff; }

.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; }
#over-mascot { width: 84px; height: 84px; margin: 0 auto 10px; }
#over-mascot.sad { animation: shakeX .5s ease; }
#over-mascot.happy { animation: pop .5s ease; }
.go-title { font-family: var(--f-display); font-size: 24px; color: var(--ink); }
.go-ans { font-family: var(--f-pixel); font-size: 18px; color: var(--c-purple); margin-top: 6px; text-transform: uppercase; }
#restart { margin-top: 16px; width: 100%; }
[hidden] { display: none !important; }

@media (max-height: 700px) {
  #stage { gap: 4px; }
  #board { gap: 4px; margin-top: 2px; }
  .row { gap: 4px; }
  .tile { width: 40px; height: 40px; font-size: 20px; }
  #kbd { gap: 4px; }
  .krow { gap: 4px; }
}
