/* 받침 연쇄 - mobile-first, 320px ~ desktop (centered 480px) */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%;
  overflow: hidden;
  background: #141226;
  color: #f2efff;
  font-family: -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
#app {
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 10px env(safe-area-inset-bottom);
}

#hud {
  display: flex;
  gap: 6px;
  padding: 10px 0 8px;
  align-items: stretch;
}
.hud-chip {
  flex: 1;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-height: 44px;
  justify-content: center;
}
.hud-label { font-size: 11px; color: #b9b3d9; }
.hud-value { font-size: 17px; font-weight: 800; }
.icon-btn { flex: 0 0 46px; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1); color: inherit; font-size: 18px; cursor: pointer; }

#play-area { flex: 1; min-height: 0; display: flex; }
#board-wrap { position: relative; flex: 1; display: flex; justify-content: center; }
#board-canvas { display: block; border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,0.5); }

#next-box {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(10, 8, 26, 0.75);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 5px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.next-label { font-size: 10px; color: #b9b3d9; }
#next-jamo { font-size: 24px; font-weight: 800; line-height: 1.1; }

#board-toast {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(10, 8, 26, 0.85);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
  pointer-events: none;
  white-space: nowrap;
}
#board-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#controls {
  display: flex;
  gap: 8px;
  padding: 10px 0 12px;
}
.ctl-btn {
  flex: 1;
  min-height: 56px;
  border: none;
  border-radius: 14px;
  background: #2f5cff;
  color: white;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.ctl-btn:active { transform: scale(0.94); filter: brightness(1.2); }
.ctl-btn.wide { flex: 1.6; background: #ff9f1c; }
.ctl-sub { font-size: 11px; font-weight: 600; opacity: 0.9; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 26, 0.8);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}
.overlay.open { display: flex; }
.overlay-card {
  background: #221f3d;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 26px 22px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.overlay-card h1 { font-size: 30px; margin-bottom: 12px; }
.overlay-card h2 { font-size: 24px; margin-bottom: 14px; }
.tagline { font-size: 13.5px; line-height: 1.65; color: #c8c3e8; margin-bottom: 16px; }
.best-record { display: flex; justify-content: center; gap: 10px; align-items: baseline; margin-bottom: 18px; }
.record-label { font-size: 12px; color: #b9b3d9; }
.record-value { font-size: 20px; font-weight: 800; color: #ffd166; }
.result-score-box { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.result-score { font-size: 40px; font-weight: 900; color: #ffd166; }
.new-best { color: #7bf178; font-weight: 700; margin-bottom: 4px; }
.result-meta { font-size: 13px; color: #b9b3d9; margin-bottom: 18px; }
.overlay-actions { display: flex; flex-direction: column; gap: 8px; }
.btn-primary {
  min-height: 50px;
  border: none;
  border-radius: 14px;
  background: #2f5cff;
  color: white;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}
.btn-primary:active { transform: scale(0.97); filter: brightness(1.15); }

@media (max-width: 340px) {
  .hud-value { font-size: 15px; }
  .ctl-btn { min-height: 50px; font-size: 19px; }
}
