/* 사다리타기 — D안(흰 바탕·강조색 #8f2f2a 1개·장식 없음). 테이블에서 폰 하나 돌려 쓰는 상황이라 글자·버튼 크게 */
.ld [hidden] { display: none !important; }
.ld-head { padding-top: 16px; }
.ld-head h1 { font-size: 32px; font-weight: 700; letter-spacing: -1px; line-height: 1.25; }
.ld-head p { color: var(--sub); margin-top: 4px; font-size: 16px; }

.ld-field { margin-top: 28px; }
.ld-label { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.ld-hint { color: var(--sub); font-size: 13.5px; margin: 4px 0 10px; }

/* 인원 ± */
.ld-step { display: flex; align-items: center; gap: 12px; }
.ld-pm { width: 64px; height: 56px; flex: none; border: 0; border-radius: 14px; background: var(--soft); color: var(--text);
  font: inherit; font-size: 30px; font-weight: 600; line-height: 1; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ld-pm:disabled { opacity: .35; cursor: default; }
.ld-count { flex: 1; text-align: center; font-size: 30px; font-weight: 700; letter-spacing: -.5px; }

/* 빠른 설정 */
.ld-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ld-presets button { min-height: 56px; border: 0; border-radius: 14px; background: var(--soft); color: var(--text); padding: 8px 10px;
  font: inherit; font-size: 16px; font-weight: 600; letter-spacing: -.3px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ld-presets button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
@media (prefers-color-scheme: dark) { .ld-presets button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px #e0776e; color: #f0a39a; } }
.ld-presets .ld-custom { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ld-presets .ld-custom small { font-size: 13px; font-weight: 500; color: var(--sub); letter-spacing: -.2px; }
.ld-presets .ld-custom[aria-pressed="true"] small { color: inherit; opacity: .85; }
.ld-preview { color: var(--body); font-size: 15px; margin-top: 10px; }
.ld-preview b { font-weight: 700; }

/* 이름·직접 입력 칸 */
.ld-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ld-in { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ld-in span { flex: none; width: 22px; text-align: right; color: var(--sub); font-size: 14px; font-weight: 600; }
.ld-in input { flex: 1; min-width: 0; height: 52px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text);
  padding: 0 12px; font: inherit; font-size: 17px; }
.ld-in input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.ld-names summary { list-style: none; cursor: pointer; min-height: 52px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 15px; font-weight: 700; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ld-names summary::-webkit-details-marker { display: none; }
.ld-names summary::after { content: '+'; margin-left: auto; font-size: 22px; font-weight: 400; color: var(--sub); }
.ld-names[open] summary::after { content: '−'; }
.ld-names summary span { font-weight: 400; color: var(--sub); font-size: 13.5px; }
.ld-names .ld-grid { margin-top: 4px; }
.ld-go { margin-top: 28px; min-height: 60px; font-size: 19px; }

/* ===== 사다리 ===== */
.ld-play { padding-top: 8px; }
.ld-guide { font-size: 17px; font-weight: 600; text-align: center; margin-bottom: 10px; }
.ld-board { margin: 0 -12px; }
.ld-row { display: flex; }
.ld-row > * { flex: 1 1 0; min-width: 0; margin: 0 2px; }
.ld-svg { display: block; width: 100%; overflow: visible; }

/* 위: 이름 버튼 */
.ld-top { min-height: 52px; border: 0; border-radius: 12px; background: var(--soft); color: var(--text); padding: 6px 2px;
  font: inherit; font-size: 15px; font-weight: 700; line-height: 1.25; letter-spacing: -.4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; text-align: center; word-break: break-all; -webkit-tap-highlight-color: transparent; }
.ld-top.done { background: var(--c); color: var(--t, #fff); }
.ld-top.focus { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--c); }
.ld-top:disabled { cursor: default; }
/* 칸이 좁으면 글자를 세로로 (10명·320폭에서도 이름이 안 잘리게) */
.ld-narrow .ld-top, .ld-narrow .ld-card b { writing-mode: vertical-rl; text-orientation: upright; letter-spacing: -1px; }
.ld-narrow .ld-top { font-size: 14px; padding: 8px 0; }

/* 아래: 결과 칸 (카드 뒤집기) */
.ld-card { position: relative; min-height: 56px; perspective: 400px; }
.ld-card > div { position: absolute; inset: 0; border-radius: 12px; display: flex; align-items: center; justify-content: center; text-align: center;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .45s ease; padding: 4px 1px; }
.ld-card .back { background: var(--soft); color: var(--sub); font-size: 20px; font-weight: 700; }
.ld-card .face { transform: rotateY(180deg); background: var(--soft); color: var(--body); }
.ld-card b { font-size: 15px; font-weight: 700; line-height: 1.2; letter-spacing: -.4px; word-break: break-all; }
.ld-card.main .face { background: var(--accent); color: #fff; }
.ld-card.open .back { transform: rotateY(-180deg); }
.ld-card.open .face { transform: rotateY(0); }
.ld-card.open .face { box-shadow: inset 0 -4px 0 var(--c); }
.ld-narrow .ld-card b { font-size: 14px; }
.ld-narrow .ld-card { min-height: 64px; }

.ld-last { min-height: 64px; display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  font-size: 22px; font-weight: 700; letter-spacing: -.6px; margin: 10px 0 6px; }
.ld-last img { width: 48px; height: auto; flex: none; }
.ld-last em { font-style: normal; color: var(--accent); }

/* 결과 요약 */
.ld-sum { margin-top: 24px; }
.ld-sum h2 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.ld-table { margin: 0 0 18px; border-top: 1px solid var(--line); }
.ld-table div { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ld-table dt { flex: none; min-width: 84px; font-size: 16px; font-weight: 700; color: var(--sub); display: flex; align-items: center; gap: 6px; }
.ld-table dd { margin: 0; flex: 1; min-width: 0; font-size: 17px; color: var(--body); }
.ld-table .main dt { color: var(--accent); }
.ld-table .main dd { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -.6px; }
.ld-table img { width: 34px; height: auto; flex: none; }
/* 요약 표 이름: 누르면 그 사람 경로만 진하게 (밑줄 = 경로색) */
.ld-who { border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; padding: 4px 1px; margin: 0; cursor: pointer;
  border-bottom: 3px solid var(--c); border-radius: 0; -webkit-tap-highlight-color: transparent; }
.ld-who-w { white-space: nowrap; }
.ld-who[aria-pressed="true"] { background: var(--soft); border-radius: 6px 6px 0 0; }
.ld-sum .btn + .btn { margin-top: 8px; }
.ld-again { margin-top: 28px; }
#btnAll { margin-top: 4px; }

@media (prefers-color-scheme: dark) {
  .ld-last em, .ld-table .main dt { color: #f0a39a; }
  .ld-last img, .ld-table img { background: #ece7df; border-radius: 30%; padding: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .ld-card > div { transition: none; }
}
/* 가로 화면: 사다리 높이를 줄임(app.js가 층 높이 계산), 글자 그대로 */
