.ladder-page.page-content {
  max-width: 1400px;
  margin-top: 8px;
  margin-bottom: 8px;
  padding-top: 14px;
  padding-bottom: 10px;
  height: calc(100vh - 100px);
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.ladder-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.line-count-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-sub);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #ffffff;
  border: 2px solid var(--color-base);
  border-radius: var(--radius-full);
  padding: 4px 8px;
}

.stepper-btn {
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  flex-shrink: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#lineCountDisplay {
  min-width: 24px;
  padding: 0 4px;
  text-align: center;
  color: var(--color-text);
  font-size: 1.05rem;
}

.ladder-wrap {
  overflow-x: auto;
  overflow-y: auto;
  padding-bottom: 4px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ladder-row {
  display: flex;
  justify-content: center;
  gap: 0;
  flex-shrink: 0;
}

.start-cell,
.end-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.start-icon-btn {
  width: 64px;
  height: 64px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  transition: transform .12s ease;
}

.start-icon-btn:hover:not(:disabled) {
  transform: scale(1.08);
}

.start-icon-btn:disabled {
  cursor: default;
}

.start-icon-btn img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fdf1f1;
  object-fit: contain;
  padding: 6px;
  box-shadow: 0 2px 6px rgba(244, 168, 195, 0.25);
  transition: opacity .15s ease, box-shadow .15s ease;
}

.start-icon-btn.done img {
  opacity: 0.45;
  box-shadow: none;
}

.start-cell input,
.end-cell input {
  width: 100%;
  max-width: 84px;
  box-sizing: border-box;
  text-align: center;
  padding: 6px 4px;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-base);
  background: #ffffff;
  color: var(--color-text);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.85rem;
}

.ladder-svg-wrap {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 12px auto;
  min-height: 0;
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
}

.ladder-svg-wrap::before {
  content: '"시작" 버튼을 눌러 사다리를 만들어보세요';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-sub-light);
  font-size: 0.9rem;
  text-align: center;
}

.ladder-svg-wrap.revealed::before {
  content: none;
}

.ladder-svg-wrap svg {
  display: block;
}

.ladder-line {
  stroke: var(--color-sub-light);
  stroke-width: 2;
}

.ladder-rung {
  stroke: var(--color-base-deep);
  stroke-width: 3;
  fill: none;
}

.ladder-rung-diag {
  stroke: #c78fd6;
  stroke-width: 3;
  fill: none;
}

.ladder-token {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  background: #ffffff;
  box-shadow: 0 3px 8px rgba(244, 168, 195, 0.4);
  transition: left .14s linear, top .14s linear;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.ladder-path {
  fill: none;
  stroke: #fa6c77;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}

.ladder-path.flash {
  animation: ladderPathFlash .6s ease;
}

@keyframes ladderPathFlash {
  0% { stroke-width: 4; opacity: 0.9; }
  40% { stroke-width: 8; opacity: 1; }
  100% { stroke-width: 4; opacity: 0.9; }
}

.ladder-toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);
  background: #ffffff;
  border: 2px solid var(--color-base);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  color: var(--color-text);
  font-family: 'Noto Sans KR', sans-serif;
  box-shadow: 0 6px 16px rgba(244, 168, 195, 0.3);
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 300;
}

.ladder-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.end-cell.landed input {
  border-color: var(--color-base-deep);
  background: #fdf1f1;
  font-weight: normal;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fdf1f1;
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.result-row img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: contain;
  background: #ffffff;
}

.result-row .result-names {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.result-row .result-arrow {
  color: var(--color-sub);
}

.result-row .result-end {
  color: var(--color-base-deep);
  font-weight: normal;
}

@media (max-width: 700px) {
  .start-cell input,
  .end-cell input {
    max-width: 56px;
    font-size: 0.75rem;
  }
  .start-icon-btn {
    width: 48px;
    height: 48px;
  }
}
