/* HOLIDAY GAME - Game screen (Countdown / Map clear / All found)
   기준: Figma ver2 390 x 844  →  HUD 162 / MAP 620 / BAR 62 */

.game {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* ---------- HUD : TIMER + 타겟 원 5개 ---------- */
.hud {
    flex: none;
    height: 162px;
    padding-top: 34px;
    background: #fff;
    text-align: center;
}

.timer {
    display: block;
    height: 38px;
    font-family: var(--font-en);
    font-size: 32px;
    font-weight: 800;
    line-height: 38px;
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
}

.targets {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

/* 힌트 썸네일 (hint_1~5, 모든 맵 공용) — 2026-11-12 시안
   못 찾음 : 선명하게 100% + 연한 테두리 1px / 찾음 : 진한 테두리 2px + 이미지 흐리게 + 가운데 체크 */
.targets li {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow);
}

.targets img {
    max-width: 36px;
    max-height: 40px;
    transition: opacity 0.2s;
}

/* 정사각 힌트 썸네일 : 원 안에 꽉 채운다 */
.targets img.is_crop {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 50%;
    object-fit: cover;
}

.targets li.is_found {
    border: 2px solid var(--ink);
}

.targets li.is_found img {
    opacity: 0.4;
}

.target_check {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 9px;
    fill: none;
    stroke: var(--ink);
    stroke-width: 3;
    stroke-linecap: square;
    stroke-linejoin: miter;
    animation: target_check_in 0.25s ease-out;
}

@keyframes target_check_in {
    from {
        transform: scale(0.4);
        opacity: 0;
    }
}

/* ---------- MAP : 높이를 맞추고 가로 스크롤 ---------- */
.map {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: var(--line);
}

.map_scroll {
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x pinch-zoom;     /* 가로 스크롤 + 브라우저 두 손가락 확대 허용 (QA 389:311) */
    scrollbar-width: none;      /* 기본 스크롤바는 숨기고 아래 4px 바로 표시 */
}

.map_scroll::-webkit-scrollbar {
    display: none;
}

.map_inner {
    position: relative;
    width: max-content;
    height: 100%;
}

.map_img {
    width: auto;
    max-width: none;
    height: 100%;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}

/* 하단 4px 가로 스크롤바 : 회색 막대 = 현재 보이는 범위 */
.map_bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: var(--line);
    pointer-events: none;
}

.map_bar b {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--gray);
}

/* ---------- 정답 / 오답 표시 (터치 영역 60 x 60) ---------- */
.mark {
    position: absolute;
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    border-radius: 50%;
    pointer-events: none;
}

/* 찾음 : 빨간 원 60% + 같은 색 2px 테두리 (QA 389:311 Ellipse 7) */
.mark_ok {
    border: 2px solid rgb(183, 3, 6);
    background: rgba(183, 3, 6, 0.6);
    animation: mark_in 0.2s ease-out;
}

/* 오답 : X 표시 후 페이드 아웃 (기획안 17p, 시간 패널티 없음) */
.mark_ng {
    border: 2px solid var(--line);
    background: rgba(234, 234, 234, 0.6);
    animation: mark_ng 0.5s ease-in forwards;
}

.mark_ng::before,
.mark_ng::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 28px;
    height: 4px;
    margin: -2px 0 0 -14px;
    border-radius: 2px;
    background: #ddd;
    transform: rotate(45deg);
}

.mark_ng::after {
    transform: rotate(-45deg);
}

@keyframes mark_in {
    from {
        transform: scale(0.6);
        opacity: 0;
    }
}

@keyframes mark_ng {
    0%,
    60% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* TODO(remove): ?debug 일 때만 보이는 정답 영역 */
.mark_debug {
    border: 2px dashed #00c853;
    border-radius: 0;
}

/* ---------- 하단 바 ---------- */
.bar {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 62px;
    padding: 0 12px 0 15px;
    background: #fff;
}

.bar_space {
    font-family: var(--font-en);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.bar_btns {
    display: flex;
    gap: 10px;
}

.bar_btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    background: var(--red-btn);
    color: #fff;
    box-shadow: 2px 2px 20px rgba(128, 128, 128, 0.12), inset 0 4px 6px rgba(255, 255, 255, 0.25);
}

/* SOUND : 켜짐 = 소리 아이콘(sound.svg) / 꺼짐 = 음소거 아이콘(mute.svg). 기본 켜짐 */
.bar_btn .icon_on {
    display: none;
}

.bar_btn[aria-pressed="true"] .icon_on {
    display: block;
}

.bar_btn[aria-pressed="true"] .icon_off {
    display: none;
}

/* ---------- Dim (Countdown / Clear / All found / Restart) ---------- */
.dim {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(234, 234, 234, 0.92);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .dim {
        background: rgba(234, 234, 234, 0.8);
        -webkit-backdrop-filter: blur(5px);
        backdrop-filter: blur(5px);
    }

    #countdown {
        background: rgba(234, 234, 234, 0.7);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
    }
}

.dim[hidden] {
    display: none;
}

.dim_full {
    top: 0;
}

.dim_below_hud {
    top: 162px;
    padding-bottom: 120px;
}

/* Countdown : 라벨 13px / 숫자 128px (자간 10%) */
.cd_label,
.card_label {
    font-family: var(--font-en);
    font-size: 13px;
    font-weight: 800;
    line-height: 25px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#countdown {
    padding-bottom: 40px;
}

.cd_order {
    margin-top: 10px;
}

.cd_num {
    margin-top: 40px;
    font-family: var(--font-en);
    font-size: 128px;
    font-weight: 800;
    line-height: 154px;
    letter-spacing: 0.05em;
    text-indent: 0.1em;     /* 자간 때문에 한쪽으로 쏠리는 것 보정 */
}

.cd_num.pop {
    animation: cd_pop 0.9s ease-out;
}

@keyframes cd_pop {
    from {
        opacity: 0;
        transform: scale(1.3);
    }
    25% {
        opacity: 1;
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ---------- 카드 (MAP CLEAR / ALL FOUND / RESTART) : 반투명 흰 카드 ---------- */
.card {
    width: calc(100% - 40px);
    padding: 40px 20px 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    text-align: center;
}

.card_title {
    margin: 20px 0 10px;
    font-family: var(--font-en);
    font-size: 24px;
    font-weight: 800;
    line-height: 25px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.card_time {
    color: var(--red);
    font-style: normal;
}

.card > .btn_red {
    width: 100%;
    margin-top: 40px;
}

/* RESTART 확인 팝업 (Figma GAME PLAY_RETRY) */
.card_msg {
    font-size: 15px;
    font-weight: 500;
    line-height: 18px;
    white-space: pre-line;
    word-break: keep-all;
}

.card_desc {
    margin-top: 20px;
    font-size: 13px;
    font-weight: 500;
    line-height: 16px;
    white-space: pre-line;
    word-break: keep-all;
}

.card_btns {
    display: flex;
    gap: 10px;
    margin-top: 40px;
}

.card_btns > * {
    flex: 1;
    min-width: 0;
}

/* 다시 하기 Countdown 안내 문구 */
.cd_msg {
    margin-top: 20px;
    font-size: 13px;
    font-weight: 500;
    line-height: 20px;
}

.cd_msg[hidden] {
    display: none;
}

/* ALL FOUND 컨페티 */
.confetti {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.confetti + .card {
    position: relative;
}
