/* 퇴근 런 (After-Work Run) — 페이지 스타일 */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    background: #1a1c22;
    overflow: hidden;
    font-family: "Pretendard", -apple-system, "Segoe UI", "Noto Sans KR", "Malgun Gothic", sans-serif;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    display: flex;
    flex-direction: column;
}

#stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

#game {
    width: 100%;
    max-width: 900px;
    max-height: 100%;
    aspect-ratio: 800 / 400;
    background: #0d0f16;
    display: block;
    border-radius: 8px;
    touch-action: none;   /* 터치 조작이 스크롤로 새지 않게 */
}

/* ------------------------------------------------------------ 오버레이 */

.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    background: rgba(10, 12, 18, 0.88);
    color: #e8eaf2;
    padding: 24px;
}

.overlay.hidden { display: none; }
.hidden { display: none !important; }

.overlay__eyebrow { font-size: 11px; letter-spacing: 3px; color: #8a8fa3; }
.overlay__title { font-size: 42px; font-weight: 900; color: #ffd76a; }
.overlay__title .pop { color: #ff9d76; }
.overlay__sub { font-size: 13px; letter-spacing: 6px; color: #8a8fa3; }
.overlay__desc { font-size: 14px; line-height: 1.8; color: #b9bdcc; }
.overlay__hint { font-size: 12px; line-height: 1.8; color: #8a8fa3; }
.overlay__best { font-size: 13px; color: #ffd76a; }
.overlay__gameover { font-size: 26px; font-weight: 900; color: #ff9d76; }
.overlay__gameover-sub { font-size: 14px; color: #b9bdcc; }
.overlay__stats { display: grid; gap: 4px; font-size: 15px; color: #b9bdcc; }
.overlay__stats strong { color: #ffd76a; }
.overlay__newrecord { color: #63d4a8; font-weight: 800; }
.overlay__backlink { font-size: 13px; }
.overlay__backlink a { color: #7fc4ff; }

.btn-retro {
    margin-top: 6px;
    padding: 13px 34px;
    font-size: 16px;
    font-weight: 900;
    color: #1a1c22;
    background: #ffd76a;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 4px 0 #b98f2e;
    cursor: pointer;
}

.btn-retro:active { transform: translateY(3px); box-shadow: 0 1px 0 #b98f2e; }

/* 세로로 좁은 화면(모바일 세로)에서는 힌트 글자를 줄여 오버레이가 넘치지 않게 */
@media (max-height: 520px) {
    .overlay { gap: 6px; }
    .overlay__title { font-size: 30px; }
    .overlay__desc, .overlay__hint { font-size: 11px; line-height: 1.5; }
}

/* ------------------------------------------------------------ 터치 조작 버튼 */

/* 키보드가 있는 환경에서는 그리지 않는다. 주 입력이 터치인 기기에서만 나타난다. */
#touch-controls { display: none; }

@media (pointer: coarse) {
    #touch-controls {
        display: flex;
        justify-content: space-between;
        position: absolute;
        inset: auto 12px 12px 12px;
        gap: 12px;
        pointer-events: none;   /* 버튼 사이 빈 공간은 캔버스 터치가 그대로 통하게 */
    }

    .touch-btn {
        pointer-events: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        width: 96px;
        height: 76px;
        border: 2px solid rgba(255, 215, 106, 0.55);
        border-radius: 18px;
        background: rgba(20, 22, 30, 0.55);
        color: #ffd76a;
        font-family: inherit;
        font-size: 13px;
        font-weight: 800;
        touch-action: none;
        -webkit-tap-highlight-color: transparent;
    }

    .touch-btn:active {
        background: rgba(255, 215, 106, 0.28);
        transform: translateY(2px);
    }

    .touch-btn__icon { font-size: 22px; line-height: 1; }
}

/* 화면이 아주 낮으면 버튼도 같이 작아진다 (가로 모드 소형 기기) */
@media (pointer: coarse) and (max-height: 420px) {
    .touch-btn { width: 82px; height: 60px; font-size: 12px; }
    .touch-btn__icon { font-size: 18px; }
}

/* ------------------------------------------------------------ 하단 배너 광고 */

#ad-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #101218;
    border-top: 1px solid #2a2e3a;
}

.ad-placeholder { font-size: 11px; letter-spacing: 3px; color: #3a3f4e; }
