/* Chalk — 손가락으로 그은 선이 발판이 되는 물리 퍼즐. 폰 세로 한 손 기준. */

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #0a0a0a; color: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

main {
  height: 100%; max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 8px;
  /* 상단 60px는 고정 크롬(← 홈, 타이틀바, 🏆) 자리 — 다른 게임과 같은 규약 */
  padding: max(60px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
}

.score-bar { display: flex; gap: 8px; align-items: stretch; flex: 0 0 auto; }
.score-box {
  flex: 1; background: #161616; border: 1px solid #2a2a2a; border-radius: 12px;
  padding: 6px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 0;
}
.score-label { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: #a0a0a0; }
.score-val, .best-val { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lives-val { font-size: 15px; font-weight: 800; color: #ffd93d; letter-spacing: 0.06em; }
.new-btn {
  flex: 0 0 auto; font: inherit; color: #0a0a0a; background: #4f9eff; border: none;
  border-radius: 12px; padding: 0 16px; min-height: 56px; cursor: pointer;
  font-weight: 700; font-size: 14px; -webkit-tap-highlight-color: transparent;
}
.new-btn:active { background: #3d8ae8; }

.status {
  margin: 0; text-align: center; font-size: 13px; font-weight: 600; color: #a0a0a0;
  min-height: 18px; flex: 0 0 auto;
}
.status.ok { color: #52d97f; }
.status.bad { color: #ff8a8a; }

/* 남은 잉크 — 이 게임의 유일한 자원이라 항상 보이게 둔다 */
.ink-bar {
  flex: 0 0 auto; height: 8px; border-radius: 999px; background: #202020;
  overflow: hidden; border: 1px solid #2a2a2a;
}
.ink-fill { height: 100%; width: 100%; background: #4f9eff; transition: width 0.08s linear; }

#game {
  flex: 1; min-height: 0; border-radius: 16px; overflow: hidden;
  background: #101317; border: 1px solid #2a2a2a;
}
#board { display: block; width: 100%; height: 100%; touch-action: none; }

.controls { flex: 0 0 auto; display: flex; gap: 8px; }
.controls button {
  flex: 1; font: inherit; font-weight: 800; font-size: 16px; border: none;
  border-radius: 14px; min-height: 54px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.undo-btn { flex: 0 0 34%; background: #2a2a2a; color: #f5f5f5; }
.undo-btn:active { background: #343434; }
.drop-btn { background: #4f9eff; color: #0a0a0a; }
.drop-btn:active { background: #3d8ae8; }
.controls button:disabled { background: #1e1e1e; color: #949494; cursor: default; }

.home-link, .hof-link {
  position: fixed; top: max(12px, env(safe-area-inset-top)); z-index: 10;
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: rgba(0, 0, 0, 0.35); color: #fff; text-decoration: none;
  font-size: 20px; font-weight: 600; line-height: 1; border: none; cursor: pointer;
  font-family: inherit; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.home-link { left: max(12px, env(safe-area-inset-left)); }
.hof-link { right: max(12px, env(safe-area-inset-right)); }

.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 20; padding: 20px;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.overlay[hidden] { display: none; }
.overlay-card {
  background: #161616; border: 1px solid #2a2a2a; border-radius: 18px; padding: 24px 22px;
  display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center;
  min-width: 240px; max-width: 320px; width: 100%;
}
.overlay-card h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.overlay-score { margin: 0; font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.overlay-card button {
  font: inherit; color: #fff; background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 999px;
  padding: 12px 20px; min-height: 44px; cursor: pointer; font-weight: 600; font-size: 14px;
  width: 100%; -webkit-tap-highlight-color: transparent;
}
.overlay-card button:active { background: rgba(255, 255, 255, 0.18); }
.overlay-card .save-btn { background: #4f9eff; border-color: #4f9eff; color: #0a0a0a; }
.overlay-card .save-btn:active { background: #3d8ae8; }
