/* 사다리타기. 색은 공통 변수를 써서 어두운 화면에서도 맞춰진다. */
.lg {
  margin-top: 22px;
}
.lg-setup,
.lg-board {
  padding: clamp(16px, 4vw, 24px);
}

/* 참가자 수 */
.lg-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.lg-h {
  font-weight: 800;
  font-size: 1.05rem;
}
.lg-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px;
}
.lg-step {
  appearance: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
.lg-step:disabled {
  opacity: 0.4;
  cursor: default;
}
.lg-count {
  min-width: 1.6em;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.lg-unit {
  color: var(--muted);
  font-weight: 700;
  margin-right: 6px;
  margin-left: -4px;
}

/* 이름 · 결과 칸 */
.lg-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.lg-col {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.lg-col legend {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0;
  margin-bottom: 8px;
}
.lg-list {
  display: grid;
  gap: 8px;
}
.lg-field {
  position: relative;
  display: block;
  min-width: 0;
}
.lg-no {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  background: var(--c, var(--brand));
  pointer-events: none;
}
.lg-no.is-res {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
}
.lg-in {
  appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  font: inherit;
  font-size: 1rem; /* 16px: 아이폰에서 누를 때 화면이 확대되지 않게 */
  font-weight: 700;
  color: var(--ink);
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 8px 10px 8px 40px;
  outline: none;
  transition: border-color 0.15s;
}
.lg-in:focus {
  border-color: var(--brand);
  background: var(--surface);
}
.lg-in::placeholder {
  color: var(--muted);
  font-weight: 500;
  opacity: 0.8;
}

.lg-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.lg-presets-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  margin-right: 2px;
}
.lg-presets .chip {
  min-height: 36px;
  font-size: 0.88rem;
}
.lg-check {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 16px;
  font-weight: 700;
  cursor: pointer;
}
.lg-check input {
  width: 20px;
  height: 20px;
  margin: 4px 0 0;
  accent-color: var(--brand);
}
.lg-check .fine {
  font-weight: 500;
}
.lg-make {
  width: 100%;
  margin-top: 18px;
  font-size: 1.08rem;
  min-height: 54px;
}
.lg-note {
  margin: 10px 0 0;
  text-align: center;
}

/* 사다리 판 */
.lg-status {
  text-align: center;
  font-weight: 700;
  margin: 0 0 14px;
}
.lg-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  margin: 0 -6px;
  padding: 0 6px 6px;
}
.lg-inner {
  --n: 4;
  --col: calc(100% / var(--n));
  min-width: calc(var(--n) * 62px);
}
.lg-top,
.lg-bottom {
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
}
.lg-name {
  appearance: none;
  margin: 0 3px;
  min-width: 0;
  min-height: 52px;
  padding: 6px 4px;
  border-radius: 14px;
  border: 2px solid var(--c);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.25;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease;
}
.lg-name:active {
  transform: scale(0.96);
}
.lg-name.is-done {
  background: var(--c);
  color: #fff;
}
.lg-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
}
.lg-name.is-done .lg-dot {
  background: #fff;
}
.lg-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lg-svgwrap {
  position: relative;
}
.lg-svg {
  display: block;
  width: 100%;
}
.lg-rails line {
  stroke: var(--muted);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.55;
}
.lg-rungs line {
  stroke: var(--muted);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.75;
  transition: opacity 0.3s ease;
}
.lg-rungs.is-hidden line {
  opacity: 0;
}
.lg-rungs.is-hidden line.is-on {
  opacity: 0.75;
}
.lg-cover {
  fill: var(--muted);
  opacity: 0.25;
  font-size: 64px;
  font-weight: 800;
}
.lg-path {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lg-runner {
  stroke: var(--surface);
  stroke-width: 3;
}
.lg-res {
  margin: 0 3px;
  min-width: 0;
  min-height: 52px;
  padding: 6px 4px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 2px solid transparent;
  text-align: center;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.lg-res.is-done {
  border-color: var(--c);
  background: var(--surface);
}
.lg-who {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c, var(--muted));
  font-size: 0.74rem;
  font-weight: 800;
}
.lg-who:empty {
  display: none;
}
.lg-swipe {
  text-align: center;
  margin: 8px 0 0;
}
@media (min-width: 700px) {
  .lg-swipe {
    display: none;
  }
}

/* 한 사람 결과 */
.lg-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 18px 0 0;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-2);
  font-size: clamp(1.2rem, 5vw, 1.6rem);
  font-weight: 800;
  text-align: center;
}
.lg-pick-name {
  color: var(--c, var(--ink));
}
.lg-arrow {
  color: var(--muted);
}
.lg-pick strong {
  font-size: 1.15em;
}
.lg-pick.pop {
  animation: lg-pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes lg-pop {
  from {
    transform: scale(0.9);
    opacity: 0.3;
  }
}

/* 전체 결과 */
.lg-all {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.lg-all h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}
.lg-all-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 8px;
  text-align: left;
}
.lg-all-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border-left: 5px solid var(--c);
  min-width: 0;
}
.lg-all-name {
  font-weight: 700;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lg-all-list b {
  flex-shrink: 0;
  max-width: 62%;
  text-align: right;
}

@media (prefers-reduced-motion: reduce) {
  .lg-pick.pop {
    animation: none;
  }
}
