/* ============================================================
   게임 페이지 — 한알한알
   ============================================================
   사이트 공통 변수(--bg-secondary 등)를 그대로 씁니다.
   테마가 바뀌어도 게임 판이 따라가도록 캔버스 배경도 JS에서
   같은 변수를 읽어 칠합니다.
   ============================================================ */

.game-wrap {
    max-width: 760px;
    margin: 0 auto;
}

.game-head {
    text-align: center;
    margin-bottom: 24px;
}

.game-head h1 {
    font-size: 1.9rem;
    margin-bottom: 8px;
}

.game-head p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* ── 점수판 ── */
.game-stats {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.game-stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 18px;
    min-width: 96px;
    text-align: center;
}

.game-stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.game-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;   /* 숫자가 바뀌어도 폭이 흔들리지 않게 */
}

/* ── 판 ── */
.game-board {
    position: relative;
    width: 360px;
    max-width: 100%;
    margin: 0 auto;
}

#mergeCanvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    cursor: pointer;
    touch-action: none;      /* 판 위 스와이프를 브라우저 제스처에 뺏기지 않게 */
}

/* ── 종료 화면 ── */
.game-over {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(0, 0, 0, 0.72);
    border-radius: var(--radius-md);
    text-align: center;
    padding: 20px;
}

.game-over[hidden] { display: none; }

.game-over h2 {
    font-size: 1.4rem;
    margin: 0;
}

.game-over p {
    margin: 0;
    color: var(--text-muted);
}

.game-over strong {
    font-size: 1.8rem;
    color: var(--accent-primary);
    display: block;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

.game-btn {
    background: var(--accent-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 11px 26px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.game-btn:hover { filter: brightness(1.1); }

/* ── 조작 안내 ── */
.game-help {
    margin: 22px auto 0;
    max-width: 560px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 22px;
}

.game-help h2 {
    font-size: 1rem;
    margin: 0 0 10px;
}

.game-help ul {
    margin: 0;
    padding-left: 18px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.9;
}

.game-help kbd {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.82rem;
    font-family: var(--font-mono, monospace);
}

/* ── 열매 단계표 ── */
.game-tiers {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.game-tier {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* 캔버스는 JS가 넣습니다. 여기서 크기를 정하지 않습니다 —
   실제 반지름은 FRUITS 하나에서만 옵니다. */
.game-tier canvas {
    display: block;
    margin: 0 auto 4px;
}

.game-tier span {
    display: block;
}

@media (max-width: 480px) {
    .game-head h1 { font-size: 1.5rem; }
    .game-stat { min-width: 80px; padding: 8px 14px; }
}

/* ── 수박 달성 배너 ──
   게임을 멈추지 않으므로 판을 가리지 않게 위쪽에 얇게 겹칩니다. */
.game-win {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: var(--accent-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 8px 18px;
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    pointer-events: none;      /* 배너 때문에 판이 안 눌리면 안 됩니다 */
}

.game-win[hidden] { display: none; }

.game-win span {
    display: block;
    font-weight: 400;
    font-size: 0.76rem;
    opacity: 0.9;
}

.game-result {
    font-size: 0.9rem;
    color: var(--accent-primary) !important;
    font-weight: 600;
}
