/* HOLIDAY GAME - Result / Login / Save / Ranking / Share
   기준: Figma ver2 (390 x 844) RESULT, GAME_로그인, 로그인 후 팝업, 로그인 후 저장, GAME_랭킹, RESULT_SHARE */

/* ---------- 공통 : 전체 화면 레이어 ---------- */
.screen {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
}

.screen[hidden] {
    display: none;
}

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

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

.btn_line_red {
    color: var(--red);
}

.btn_text {
    display: block;
    margin: 20px auto 0;
    padding: 4px;
    font-family: var(--font-en);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.btn_red.is_disabled,
.btn_red:disabled {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.8);
    color: #c5c5c5;
    line-height: 43px;
    cursor: default;
}

.btn_ko {
    font-family: var(--font-ko);
    font-weight: 500;
    letter-spacing: 0;
}

.icon_close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-right: -13px;
}

/* ---------- RESULT ---------- */
.result {
    align-items: center;
    padding: 80px 40px calc(42px + env(safe-area-inset-bottom));
    text-align: center;
}

.result.is_compare {
    padding-top: 92px;
}

.result_best {
    margin-bottom: 20px;
    color: var(--red);
    font-family: var(--font-en);
    font-size: 13px;
    font-weight: 800;
    line-height: 16px;
    letter-spacing: 0.05em;
}

.result_title {
    font-family: var(--font-en);
    font-size: 32px;
    font-weight: 800;
    line-height: 45px;
    letter-spacing: 0.05em;
}

.result_label {
    margin-top: 40px;
    font-family: var(--font-en);
    font-size: 13px;
    font-weight: 800;
    line-height: 16px;
    letter-spacing: 0.05em;
}

.result_time {
    margin-top: 10px;
    color: var(--red);
    font-family: var(--font-en);
    font-size: 24px;
    font-weight: 800;
    line-height: 35px;
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
}

.result_vs {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 20px;
}

.result_vs em {
    color: var(--red);
    font-family: var(--font-en);
    font-style: normal;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.result_hint {
    margin-top: 20px;
    color: var(--gray);
    font-size: 13px;
    font-weight: 500;
    line-height: 16px;
}

.result_vs[hidden],
.result_hint[hidden],
.result_best[hidden] {
    display: none;
}

/* 일러스트가 공간보다 커서 위아래로 넘칠 때 문구 · 버튼을 덮지 않도록 맨 아래 층에 둔다 (QA 2026-11-12) */
.result_head,
.result_cta {
    position: relative;
    z-index: 1;
}

/* 일러스트 : 화면이 낮으면 줄어든다 */
.result_visual {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 120px;
    padding: 30px 0;
}

.result_visual img {
    width: 310px;
    max-width: 100%;
    height: auto;
    max-height: 292px;
    object-fit: contain;
}

.result.is_compare .result_visual img {
    max-height: 220px;
}

.result_cta {
    width: 100%;
}

.result_cta .btn_red {
    width: 100%;
}

/* ---------- LOGIN (공식몰 로그인 화면과 동일한 형태) ---------- */
.login {
    color: #343434;
}

.login_head {
    position: relative;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    height: 45px;
    border-bottom: 1px solid var(--line);
}

.login_close {
    position: absolute;
    left: 14px;
    top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 6px;
    font-family: var(--font-en);
    font-size: 12px;
    font-weight: 400;
}

.logo_s {
    width: 110px;
    height: 14px;
}

.login_form,
.login_sns,
.login_join {
    padding: 0 20px;
}

.login_title {
    margin: 40px 0 34px;
    font-size: 13px;
    font-weight: 400;
    line-height: 16px;
}

.login_input {
    display: block;
    width: 100%;
    height: 42px;
    margin-bottom: 24px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--gray);
    border-radius: 0;
    background: none;
    font-size: 16px;      /* 16px 미만이면 iOS 가 입력 시 화면을 확대한다 */
    color: #343434;
    outline: none;
    -webkit-appearance: none;
}

.login_input::placeholder {
    color: #999;
    font-size: 12px;
}

.login_input:focus {
    border-bottom-color: var(--ink);
}

.login_error {
    margin: -12px 0 12px;
    color: var(--red);
    font-size: 11px;
}

.login_error[hidden] {
    display: none;
}

.btn_box {
    display: block;
    width: 100%;
    height: 45px;
    margin-top: 16px;
    border: 1px solid var(--gray);
    background: #fff;
    font-size: 11px;
    line-height: 43px;
    text-align: center;
    color: #343434;
}

.login_sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 10px;
    color: #000;
}

.login_sub a {
    text-decoration: underline;
}

.login_sub i {
    margin: 0 4px;
    font-style: normal;
}

.login_check {
    display: flex;
    align-items: center;
    gap: 5px;
}

.login_check input {
    width: 10px;
    height: 10px;
    margin: 0;
    accent-color: var(--ink);
}

.login_sns {
    margin-top: 40px;
    font-size: 12px;
    text-align: center;
    color: #000;
}

.login_sns_btns {
    display: flex;
    justify-content: center;
    gap: 13px;
    margin-top: 13px;
}

/* 카카오 · 네이버가 한 장의 이미지라 위에 투명 버튼 2개를 겹친다 */
.sns_pair {
    position: relative;
    display: flex;
}

.sns_pair button {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
}

.sns_pair button + button {
    left: 50%;
}

.login_join {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--line);
    margin-left: 20px;
    margin-right: 20px;
    padding-left: 0;
    padding-right: 0;
    font-size: 12px;
    text-align: center;
    color: #000;
}

.login_join .btn_box {
    margin-top: 13px;
}

/* ---------- 팝업 카드 (WELCOME / SAVE MY TIME) ---------- */
.card_solid {
    padding: 60px 20px 20px;
    background: #fff;
}

.card_big {
    font-family: var(--font-en);
    font-size: 24px;
    font-weight: 800;
    line-height: 30px;
    letter-spacing: 0.05em;
}

.card_sub {
    margin-top: 20px;
    font-size: 15px;
    font-weight: 500;
    line-height: 18px;
}

.card_sub_multi {
    white-space: pre-line;
}

.card_count {
    margin-top: 30px;
    color: var(--red);
    font-family: var(--font-en);
    font-size: 50px;
    font-weight: 800;
    line-height: 45px;
}

.card_desc_multi {
    margin-top: 40px;
    line-height: 20px;
}

.card_solid > .btn_red {
    margin-top: 60px;
}

/* SAVE MY TIME : 이전 기록 / 이번 기록 / 차이 */
.save_rows {
    width: 174px;
    margin: 40px auto 0;
}

.save_row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 20px;
}

.save_row + .save_row {
    margin-top: 20px;
}

.save_row[hidden] {
    display: none;
}

.save_row dt {
    font-size: 13px;
    font-weight: 500;
}

.save_row dd {
    font-family: var(--font-en);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.save_row_prev {
    color: #c5c5c5;
}

.save_row_this dd,
.save_row_diff dd {
    color: var(--red);
}

.save_row_diff {
    margin-top: 12px !important;
}

.save_left {
    margin-top: 36px;
    color: var(--gray);
    font-size: 13px;
    font-weight: 500;
}

.card_solid .card_btns {
    margin-top: 40px;
}

/* ---------- RANKING ---------- */
.ranking {
    padding: 20px 20px calc(40px + env(safe-area-inset-bottom));
}

.rank_head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rank_title {
    font-family: var(--font-en);
    font-size: 24px;
    font-weight: 800;
    line-height: 45px;
    letter-spacing: 0.05em;
}

.rank_note {
    margin-top: 10px;
    color: var(--gray);
    font-size: 13px;
    font-weight: 500;
    line-height: 16px;
    white-space: pre-line;
}

.rank_sub {
    margin-top: 40px;
    color: var(--red);
    font-family: var(--font-en);
    font-size: 15px;
    font-weight: 800;
    line-height: 25px;
    letter-spacing: 0.05em;
}

.rank_list {
    margin-top: 20px;
    list-style: none;
}

.rank_list li {
    display: flex;
    align-items: center;
    height: 40px;
    border-bottom: 1px solid #c5c5c5;
    font-family: var(--font-en);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.rank_no {
    width: 60px;
}

.rank_name {
    flex: 1;
    min-width: 0;               /* 긴 이름이 줄어들지 않아 기록 숫자가 칸 밖으로 밀려 잘리던 문제 → 이름을 말줄임 */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding-right: 10px;
}

.rank_time {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* TOP 15 : 5명씩 옆으로 넘기는 페이지 (스크롤 스냅, 라이브러리 없음) */
.rank_pager {
    display: flex;
    margin-top: 20px;
    overflow-x: auto;
    overflow-y: hidden;         /* overflow-x 만 주면 세로도 auto 가 되어 위아래 스크롤이 생긴다 */
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

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

.rank_page {
    flex: 0 0 100%;
    min-width: 0;
    margin-top: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;   /* 세게 넘겨도 한 페이지씩 멈춘다 */
}

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

.rank_dots button {
    width: 10px;
    height: 10px;
    padding: 0;
    border-radius: 50%;
    background: var(--line);
}

.rank_dots button.on {
    background: var(--gray);
}

.rank_sub_me {
    margin-top: 60px;
}

.rank_dots + #rankMeWrap .rank_sub_me {
    margin-top: 40px;     /* Figma : 점 아래 40px */
}

.rank_note_me {
    margin-top: 20px;
    line-height: 16px;
}

.rank_empty {
    margin-top: 60px;
    text-align: center;
}

.rank_empty[hidden],
#rankMeWrap[hidden] {
    display: none;
}

.rank_cta {
    margin-top: auto;
    padding: 40px 20px 0;
    text-align: center;
}

.rank_gap {
    margin-bottom: 20px;
    color: var(--gray);
    font-size: 18px;
    font-weight: 500;
    line-height: 23px;
}

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

.rank_gap[hidden] {
    display: none;
}

.rank_cta .btn_red {
    width: 100%;
}

.rank_warn {
    margin-top: 16px;
    color: var(--gray);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
}

/* ---------- SHARE ---------- */
.share {
    z-index: 40;
    justify-content: flex-start;
    overflow-y: auto;
}

.share_inner {
    width: 100%;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
}

.share_head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.share_title_main {
    font-family: var(--font-en);
    font-size: 24px;
    font-weight: 800;
    line-height: 45px;
    letter-spacing: 0.05em;
}

.share_card {
    margin-top: 20px;
    padding: 33px 20px 40px;
    border: 1px solid var(--line);
    background: #fff;
    text-align: center;
}

.share_card_top {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 14px;
}

.share_card_top img {
    width: 110px;
    height: 14px;
}

.share_card_top span {
    position: absolute;
    right: 20px;
    font-family: var(--font-en);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.share_name {
    margin-top: 54px;
    font-family: var(--font-en);
    font-size: 24px;
    font-weight: 800;
    line-height: 30px;
    letter-spacing: 0.05em;
}

.share_visual {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 230px;
    margin-top: 10px;
}

.share_visual img {
    width: 208px;
    max-width: 100%;
    height: auto;
}

.share_rank {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    font-family: var(--font-en);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.share_rank[hidden] {
    display: none;
}

.share_time {
    margin-top: 10px;
    color: var(--red);
    font-family: var(--font-en);
    font-size: 32px;
    font-weight: 800;
    line-height: 45px;
    letter-spacing: 0.05em;
}

.share_beat {
    margin-top: 20px;
    color: var(--gray);
    font-family: var(--font-en);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.share_btns {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
}

/* 언어별로 버튼이 적을 때(영어 4개 · 중국어 2개) : 양 끝으로 벌리지 않고 가운데로 모은다 */
.share_btns.is_few {
    justify-content: center;
    gap: 16px;
}

.share_btns button {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 62px;
    height: 62px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    font-family: var(--font-en);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

/* ---------- 토스트 ---------- */
.toast {
    position: absolute;
    left: 50%;
    bottom: calc(90px + env(safe-area-inset-bottom));
    z-index: 60;
    max-width: calc(100% - 40px);
    padding: 12px 18px;
    border-radius: 8px;
    background: rgba(25, 25, 25, 0.9);
    color: #fff;
    font-size: 13px;
    line-height: 18px;
    text-align: center;
    transform: translateX(-50%);
}

.toast[hidden] {
    display: none;
}

/* 결과 화면(.screen) 위에 뜨는 팝업 */
#welcomePopup,
#savePopup {
    z-index: 45;
}

/* 길게 눌러 저장 (공유 창이 없는 모바일 환경) : 카드 이미지를 크게 띄운다 */
.share_save {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    max-width: var(--app-w);
    margin: 0 auto;
    padding: 56px 24px calc(24px + env(safe-area-inset-bottom));
    background: rgba(25, 25, 25, 0.92);
}

.share_save img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: calc(100% - 60px);
    border-radius: 8px;
    -webkit-touch-callout: default;     /* iOS 길게 누르기 메뉴(사진에 저장) 허용 */
    user-select: auto;
}

.share_save_hint {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 20px;
    text-align: center;
    word-break: keep-all;
}

.share_save .icon_close {
    position: absolute;
    top: 12px;
    right: 12px;
    color: #fff;
}
