/* Golf Solitaire — 3분 러시. 폰 세로 한 손 기준. */
* { 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: 10px;
  /* 상단 60px는 고정 크롬(← 홈, 타이틀바, 🏆) 자리 — 다른 게임과 같은 규약 */
  padding: max(60px, env(safe-area-inset-top)) 10px max(14px, env(safe-area-inset-bottom));
}
.score-bar { display: flex; gap: 6px; align-items: stretch; flex: 0 0 auto; }
.score-box {
  flex: 1; background: #161616; border: 1px solid #2a2a2a; border-radius: 12px;
  padding: 6px 6px; 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, .time-val { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.new-btn {
  flex: 0 0 auto; font: inherit; color: #0a0a0a; background: #4f9eff; border: none;
  border-radius: 12px; padding: 0 14px; min-height: 56px; cursor: pointer;
  font-weight: 700; font-size: 14px;
}
.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; }

/* 보드와 더미를 한 덩어리로 세로 중앙에 모은다. space-between으로 두면 폰 화면에서
   둘 사이에 200px 넘는 빈 공간이 생겨 시선이 끊긴다. */
#game {
  flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 26px;
  /* 카드 테이블 느낌의 바탕. 보드와 더미를 합쳐도 화면보다 짧아 빈 공간이 남는데,
     맨바닥이면 허전해 보인다. */
  background: radial-gradient(120% 80% at 50% 42%, #16241c 0%, #101613 55%, #0d0f0e 100%);
  border: 1px solid #23282a; border-radius: 18px; padding: 12px 8px;
}

/* 태블로 7열. 각 열은 카드가 20px씩 겹쳐 내려온다 — 마지막 장만 낼 수 있으므로
   맨 아래가 항상 온전히 보여야 한다. */
.gf-board { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; flex: 0 0 auto; }
.gf-col {
  position: relative; height: 164px; background: none; border: none; padding: 0;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.gf-col:disabled { cursor: default; }
.gf-col:focus-visible { outline: 2px solid #4f9eff; outline-offset: 2px; border-radius: 8px; }
.gf-card {
  position: absolute; left: 0; right: 0; height: 68px;
  background: #f4f1ea; color: #16181d; border-radius: 7px;
  border: 1px solid #cfc9bb; box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 2px; line-height: 1.05; overflow: hidden;
}
.gf-card.red { color: #c62828; }        /* 카드 바탕 대비 4.98:1 — AA 통과 */
.gf-r { font-size: 15px; font-weight: 800; }
.gf-s { font-size: 13px; }
/* 낼 수 있는 카드는 테두리로 표시 — 색만 쓰면 색각 이상에서 안 보인다 */
.gf-card.ok { border: 2px solid #4f9eff; box-shadow: 0 0 0 2px rgba(79,158,255,0.35); }

.gf-piles { display: flex; align-items: center; justify-content: center; gap: 22px; flex: 0 0 auto; }
.gf-stock {
  width: 64px; height: 88px; border-radius: 10px; border: 2px solid #4f9eff;
  background: #16243a; color: #cfe0ff; font: inherit; font-size: 20px; font-weight: 800;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.gf-stock:active { background: #1d3050; }
.gf-stock.empty { border-color: #2a2a2a; background: #141414; color: #949494; cursor: default; }
.gf-waste { width: 64px; height: 88px; display: flex; align-items: center; justify-content: center; }
.gf-card.big {
  position: static; width: 64px; height: 88px; border-radius: 10px;
  justify-content: center; gap: 2px; padding-top: 0;
}
.gf-card.big .gf-r { font-size: 26px; }
.gf-card.big .gf-s { font-size: 20px; }

@keyframes gf-shake {
  0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.gf-board.shake { animation: gf-shake 0.24s; }

.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);
}
.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; }
.overlay-score { margin: 0; font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.overlay-sub { margin: -4px 0 0; font-size: 14px; font-weight: 600; color: #a0a0a0; }
.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%;
}
.overlay-card button:active { background: rgba(255,255,255,0.18); }
.overlay-card .save-btn { background: #4f9eff; border-color: #4f9eff; color: #0a0a0a; }
