/* 블록팝 (Block Pop) — 페이지 스타일 */

* {
    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;
}

#game {
    /* 내부 해상도 376x504, 화면에는 비율 유지 최대 크기로 */
    height: 100%;
    max-height: 100%;
    max-width: 100vw;
    aspect-ratio: 376 / 504;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #0d0f16;
    display: block;
}

/* ------------------------------------------------------------ 터치 조작부 */

#touch-controls {
    flex: 0 0 auto;
    display: none;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #101218;
    border-top: 1px solid #2a2e3a;
}

/* 터치 기기(정밀 포인터 없음)에서만 표시 */
@media (pointer: coarse) {
    #touch-controls {
        display: grid;
    }
}

.tbtn {
    font: inherit;
    font-size: 20px;
    font-weight: 800;
    color: #dfe6f3;
    background: #1d2230;
    border: 2px solid #343b4e;
    border-radius: 12px;
    padding: 14px 0;
    cursor: pointer;
    touch-action: none;
}

.tbtn:active {
    background: #2a3145;
    transform: translateY(1px);
}

.tbtn--accent {
    background: linear-gradient(#3a86ff33, #3a86ff1a);
    border-color: #3a86ff88;
}

.tbtn small {
    display: block;
    font-size: 9px;
    font-weight: 700;
    color: #7d879e;
    margin-top: 2px;
}

/* ------------------------------------------------ 오버레이 (시작/일시정지/게임오버) */

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

.overlay.hidden {
    display: none;
}

.overlay__eyebrow {
    font-size: 11px;
    letter-spacing: 0.3em;
    color: #9adcff;
    font-weight: 700;
}

.overlay__title {
    font-size: clamp(2.4rem, 9vw, 3.2rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    text-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
}

.overlay__title .pop {
    background: linear-gradient(120deg, #6ee7ff, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.overlay__sub {
    font-family: Consolas, monospace;
    font-size: 13px;
    letter-spacing: 0.34em;
    color: #ffd76a;
    font-weight: 700;
}

.overlay__desc {
    font-size: 14px;
    line-height: 1.8;
    color: #dfe6f3;
}

.overlay__hint {
    font-size: 12px;
    color: #93a0b8;
    line-height: 1.7;
}

.overlay__best {
    font-size: 13px;
    color: #ffd76a;
}

.overlay__gameover {
    font-size: clamp(1.7rem, 7vw, 2.4rem);
    font-weight: 900;
    color: #ff6b6b;
    text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5);
}

.overlay__stats {
    background: rgba(0, 0, 0, 0.35);
    border: 2px solid #3d4356;
    border-radius: 10px;
    padding: 14px 26px;
    display: grid;
    gap: 6px;
    font-size: 14px;
    color: #c4cddc;
}

.overlay__stats strong {
    color: #fff;
    font-size: 17px;
    margin-left: 8px;
}

.overlay__newrecord {
    color: #ffd76a;
    font-weight: 700;
    animation: blink 0.9s step-end infinite;
}

.overlay__newrecord.hidden {
    display: none;
}

@keyframes blink {
    50% { opacity: 0.25; }
}

.btn-retro {
    font: inherit;
    font-size: 18px;
    font-weight: 800;
    color: #0e1b2b;
    background: linear-gradient(#8fe3ff, #5aa9ff);
    border: 3px solid #0e1b2b;
    border-radius: 12px;
    box-shadow: 0 5px 0 #0e1b2b;
    padding: 13px 34px;
    cursor: pointer;
    transition: transform 0.06s ease, box-shadow 0.06s ease;
}

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

.overlay__backlink a {
    font-size: 12px;
    color: #93a0b8;
}

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

#ad-bar {
    flex: 0 0 auto;
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #101218;
    border-top: 1px solid #2a2e3a;
    overflow: hidden;
}

.ad-placeholder {
    font-family: Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4em;
    color: rgba(255, 255, 255, 0.16);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 8px 26px 8px 32px;
}
