/* v3.6 화면 다듬기 — index.html 인라인 스타일·rank.css·chat.css 뒤에 링크 */

/* 한글 줄바꿈: 글자 중간(「적/어 둬요」)이 아니라 띄어쓰기 단위로 넘김. 아주 긴 영문·숫자만 칸을 넘을 때 끊음 */
body { word-break: keep-all; overflow-wrap: break-word; }  /* anywhere는 칸 최소 폭까지 줄여 하트가 두 줄로 갈라졌음 */
p, li, .say, .notice-dlg, .update-dlg { text-wrap: pretty; }

/* 랭킹 4등부터: 칭호를 이름 아래 둘째 줄로(「대결」·「게임 중」 표시가 붙으면 「죽몽가 갑옷…」처럼 잘렸음, PC) */
#rankList .nm { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 4px; line-height: 1.2; white-space: normal; }
#rankList .nm .face { grid-row: span 2; margin-right: 0; vertical-align: 0; }
#rankList .nm .nmt, #rankList .nm small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#rankList .nm small { margin-left: 0; font-size: 0.7rem; }
/* 단상 이름·칭호도 칸이 좁으면 말줄임 대신 두 줄까지 */
.podium .pn, .podium .ps small { white-space: normal; overflow-wrap: anywhere; text-align: center; line-height: 1.2; }

/* 채팅창: 폰은 220 → 300px, PC는 오른쪽 칸 남는 세로 공간을 채팅이 다 씀(최소 320px) */
.chatlog { height: 300px; }
@media (min-width: 900px) {
  .rightcol { min-height: calc(100vh - 40px); }
  .rightcol > .social { flex: 1; display: flex; flex-direction: column; }
  .rightcol > .social > .sub:has(#chatLog) { flex: 1; min-height: 0; }
  .rightcol #chatLog { flex: 1 1 320px; height: auto; min-height: 320px; }
}
/* 점수판 버튼(꾸미기·미션·자랑)은 한 줄로 — keep-all로 「미션 0/3」이 「미션」만 보인 적 있음 */
.hud button { white-space: nowrap; }

/* 폰 점수판: 콤보 칸이 길어져(「콤보 1 · ×1」) 하트 줄을 넘기면 점수판이 25px 커져 들판이 뽑을 때마다 들썩였음(10/2 우석 「클릭하면 스크롤이 살짝 움직임」)
   → flex-basis 0이라 줄바꿈 계산에선 폭 0, 남는 폭만 차지하고 넘치면 말줄임. 글자도 폰에선 짧게(index.html updateHud) */
@media (max-width: 899px) {
  .hud .right .hearts { letter-spacing: 1px; }
  .hud .right .combo { flex: 1 1 0; min-width: 0; max-width: max-content; overflow: hidden; text-overflow: ellipsis; font-size: 0.78rem; padding-inline: 7px; }
}
/* 좁은 폰(360px 등): 점수판 세 칸 최소 폭 합이 안쪽 폭보다 15px 커서 꾸미기·미션·우리 집·콤보가 테두리에 닿았음 → 여백·간격·버튼 안쪽 여백을 줄임 */
@media (max-width: 389px) {
  .hud { padding-inline: 8px; column-gap: 4px; }
  .hud .right .hearts { letter-spacing: 0; }
  .hud .right .combo { font-size: 0.74rem; padding-inline: 6px; }
  .hud .hud-pair .mission-open, .hud .hud-pair .home-open { padding-inline: 6px; }  /* home.css가 뒤에 링크돼 .hud를 붙여 이김 */
}
/* 아주 좁은 폰(320px): 왼쪽 「최고 기록 자랑」(95px)·오른쪽 꾸미기·미션·우리 집(116px)이 판 안쪽보다 29px 넘쳤음
   → 주인공을 줄이고 버튼 글자·안쪽 여백을 줄임. #bestShareBtn은 duel.css가 id로 정해서 id로 이김 */
@media (max-width: 359px) {
  #mascot { width: 50px; height: 50px; }
  .hud .closet-open, .hud #bestShareBtn { font-size: 0.72rem; padding-inline: 6px; }
  .hud .hud-pair { gap: 3px; }
  .hud .hud-pair .mission-open, .hud .hud-pair .home-open { font-size: 0.72rem; padding-inline: 5px; }
}

/* 규칙 한 줄은 낮은 폰 세로에서만(긴 문단을 뺄 때) */
.rule-mini { display: none; }

/* v4.0 낮은 폰 세로(360x640 등): 시작 카드가 길어 「시험 시작」 버튼이 화면 밖으로 밀림 → 긴 설명 문단은 빼고(그림 설명표가 같은 내용) 간격을 줄임 */
@media (max-width: 899px) and (max-height: 700px) and (orientation: portrait) {
  #startOv .card > p { display: none; }
  #startOv .card:not(.returning) > p.rule-mini { display: block; margin: 0 0 4px; font-size: 0.76rem; color: var(--muted); }  /* 긴 문단 대신 그림표에 없는 규칙 한 줄(10/3) */
  #startOv .card h2 { margin-bottom: 4px; }
  #startOv .vs-banner { margin: 4px auto 6px; padding: 4px 10px; }
  #startOv .vs-banner small { display: none; }
  #startOv .legend { gap: 6px; margin: 6px 0; }
}

/* v4.11 마지막 10초: 시간 막대가 두근두근(5초부터 더 빠르게는 index.html이 들판 테두리로) */
.timebar.low { animation: lowBeat .5s ease-in-out infinite alternate; }
@keyframes lowBeat { from { transform: scaleY(1); } to { transform: scaleY(1.35); } }
@media (prefers-reduced-motion: reduce) { .timebar.low { animation: none; } }

/* v4.11 첫 판 전(최고 기록 없음)엔 점수판·같이 놀기의 곁가지 버튼을 숨겨 「시험 시작」에 집중. 첫 판이 끝나면 보임(index.html rookie 표시) */
html.rookie .hud-pair, html.rookie #bestShareBtn, html.rookie .slot-open, html.rookie .scr-open, html.rookie .duel-open { display: none !important; }
/* 10/12 새 손님 23명 중 5명만 첫 판 시작 → 첫 판 전 시작 카드는 설명 한 줄 + 「시험 시작」만(닉네임은 자동 이름, 첫 판 뒤 바꿈).
   안 쓰이던 도감·리그·고수 판 보기 줄도 첫 판 뒤에(10/1~12 도감 4번·고수 판 1번). 밤송이 경고는 3·2·1 화면에 그림과 함께 나옴 */
.rookie-line { display: none; }
html.rookie #startOv .rookie-line { display: block; margin: 6px 0 14px; font-size: 1.02rem; line-height: 1.5; }
html.rookie #startOv .card > p, html.rookie #startOv .nick, html.rookie #startOv .legend, html.rookie #startOv .mission,
html.rookie .my-row, html.rookie .replay-open { display: none !important; }
/* 10/12 첫 판 결과 카드: 375x667에서 98px 넘쳤고(배지·제친 사람·겨루기·부르기·기록 대결 줄) 처음 온 손님에겐 고를 게 너무 많음
   → 합격 도장·점수·다음 목표·순위·보수 + 「자랑하기」「다시 하기」만. 두 번째 판부터 전부 보임(index.html first-result 표시) */
html.first-result #endOv .badges, html.first-result #endOv .ot-line, html.first-result #endOv .coin-shop,
html.first-result #endOv .quick-row, html.first-result #endOv .rec-pair { display: none !important; }
/* 10/13 제안 줄(겨루기·카톡 부르기·대결 상대 등)은 한 판에 하나만 — 새 지갑 두 번째 판에서 둘이 겹쳐 375x667 33px 넘침, 「기록과 대결」이 버튼 뒤로 */
#endOv .card > .quick-row:not([hidden]) ~ .quick-row { display: none !important; }  /* 앞 줄이 hidden이면 세지 않음(세 줄 모두 미리 만들어 hidden으로 둠) */

/* v4.12 폰 결과 카드: 배지·기록 대결 줄이 붙으면 카드가 들판보다 길어져 「다시 하기」가 잘렸음(10/3 폰 시험 overlay 494 > 432px)
   → 버튼 줄을 카드 맨 아래로 보내고 화면 아래에 붙여 둠. 나머지(기록 대결 버튼 등)는 카드 안에서 스크롤 */
@media (max-width: 899px) {
  #endOv .card > .row { order: 10; position: sticky; bottom: 0; z-index: 1; background: var(--cream); padding-top: 6px; box-shadow: 0 -8px 8px -8px rgba(61, 48, 43, .35); }
}

/* v4.25 폰 결과 카드 넘침(10/5 #425, check_fit 375·360 모두 120px 넘침): 칸이 늘어 코인·부르기·기록 대결 줄이 스크롤 아래로 숨었음
   → 급수 카드를 낮추고, 두 줄로 커지던 다음 목표·순위·함께 출석 줄을 한 줄(넘치면 말줄임)로, 꾸밈 한마디와 바뀌지 않은 최고 기록 줄은 숨김
   (최고 기록 숫자는 순위 줄 앞에 붙임 — resultfold.js). 첫 합격·실격 문구는 그대로 보임 */
@media (max-width: 899px) {
  #endOv .cert { padding: 6px 10px 6px 12px; gap: 0 8px; }
  #endOv .cert .grade { font-size: 1.9rem; }
  #endOv .cert .grade.long { font-size: 1.4rem; }
  #endOv .cert-photo { width: 54px; height: 54px; }
  #endOv .cert .stamp { width: 40px; height: 40px; right: 42px; bottom: -6px; font-size: .7rem; }
  #endOv .grade-msg.flavor, #endOv .best-line:not(.new) { display: none; }
  #endOv .near-line, #endOv .rank-line, #endOv .streak-line { font-size: .8rem; line-height: 1.3; min-height: 0; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #endOv .rank-line .league-tag { font-size: inherit; }
}

/* v4.25 폰 결과 카드 2: 급수 카드 가운데 빈자리(급수 글자와 사진 사이 약 150px)에 점수 네 칸을 2x2로 넣고 따로 있던 점수 줄을 없앰(-41px, 숨기는 정보 없음)
   옮기기는 resultfold.js(폰일 때만 #endOv .stats를 #cert 안으로, PC 폭이 되면 제자리로) */
@media (max-width: 899px) {
  #endOv .cert:has(> .stats) { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 6px; }
  #endOv .cert:has(> .stats) .cert-photo { grid-column: 3; }
  #endOv .cert > .stats { grid-column: 2; grid-row: 1 / span 2; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; margin: 0; align-self: center; position: relative; z-index: 1; }
  #endOv .cert > .stats div { padding: 1px 2px; background: rgba(255, 255, 255, .6); border-radius: 7px; line-height: 1.15; }
  #endOv .cert > .stats span { font-size: .62rem; }
  #endOv .cert > .stats b { font-size: .86rem; }
}

/* v4.25 폰 가로(10/5 #425 넘침 검사에 667x375 추가): 들판이 화면 높이(약 300px)에 맞춰져 시작 카드가 88px, 결과 카드가 8px 넘쳤음
   → 시작 카드는 두 단(왼쪽 제목·미션·닉네임·시작 버튼·최고 기록, 오른쪽 출석·같은 판·함께 출석, 칸을 쪼개지 않고 높이를 나눔),
   결과 카드는 부르기 상자·버튼 줄 위아래 여백을 줄임 */
@media (max-width: 899px) and (orientation: landscape) and (max-height: 500px) {
  #startOv .card { display: block; column-count: 2; column-gap: 14px; max-width: none; text-align: center; }
  #startOv .card > * { break-inside: avoid; margin: 0 0 5px; }
  #startOv .card > .btn { width: 100%; }
  html #endOv .card { gap: 3px; }  /* ghost.css 폰 gap 6px가 index.html 가로 4px를 덮었음 — 「안 오는 친구 부르기」 줄이 생기면 667x375에서 11px 넘침(10/6) */
  #endOv .recall-row { margin-block: 2px 0; padding-block: 3px; }
  #endOv .recall-row:not([hidden]) ~ .rec-pair { display: none; }  /* 부르기 줄이 있으면 보조 버튼 줄(기록과 대결·고수 판 보기)은 가로 폰에서 뺌 — 칭호 배지까지 겹치면 1px 남았음 */
  #endOv .card > .row { padding-top: 3px; }
  #endOv .card > .row .btn { padding-block: 5px; }
}
