/* /var/www/html/assets/css/ladder.css : 사다리 게임 도구 전용 스타일 (파스텔 톤) */

.ld-tool {
  margin-top: 8px;
  --ld-cols: 4;
}

/* ---------- 상단 설정 바 ---------- */
.ld-setup {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 16px 18px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(142, 202, 230, 0.12), transparent 62%),
    linear-gradient(180deg, rgba(200, 214, 240, 0.16), rgba(200, 214, 240, 0.06));
  border: 1px solid rgba(142, 160, 210, 0.2);
  border-radius: 20px;
}
.ld-count { justify-self: start; }
.ld-complexity { justify-self: center; }
.ld-actions { justify-self: end; }

/* 참가자 수 */
.ld-count {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.ld-count-label {
  font-weight: 800;
  font-size: 0.9rem;
  color: #fff;
  white-space: nowrap;
}
.ld-stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 4px;
}
.ld-step {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: transparent;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: #14161a;
  transition: background 0.12s ease, transform 0.08s ease;
}
.ld-step:hover { background: rgba(0, 0, 0, 0.06); }
.ld-step:active { transform: scale(0.9); }
.ld-step:disabled { opacity: 0.3; cursor: not-allowed; }

.ld-count-input {
  width: 46px;
  height: 34px;
  text-align: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #14161a;
  border: none;
  background: transparent;
  -moz-appearance: textfield;
  appearance: textfield;
}
.ld-count-input::-webkit-outer-spin-button,
.ld-count-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ld-count-input:focus { outline: none; }

/* 사다리 설정 (복잡도) - 중앙 */
.ld-complexity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.ld-cx-label {
  font-weight: 800;
  font-size: 0.9rem;
  color: #fff;
}
.ld-cx-btns {
  display: inline-flex;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 4px;
  gap: 2px;
}
.ld-cx {
  border: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.85rem;
  color: #5a6478;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.ld-cx:hover { background: rgba(0, 0, 0, 0.05); }
.ld-cx.is-active {
  background: linear-gradient(135deg, #9cd3ef, #b9b3ee);
  color: #2f3a4d;
  box-shadow: 0 2px 8px rgba(150, 175, 225, 0.4);
}
.ld-cx:disabled { opacity: 0.45; cursor: not-allowed; }

.ld-actions { display: flex; }
.ld-actions-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.ld-actions-group[hidden] { display: none; }
.ld-actions-group .btn[hidden] { display: none; }

@media (max-width: 900px) {
  .ld-setup { grid-template-columns: 1fr; justify-items: center; }
  .ld-count, .ld-complexity, .ld-actions { justify-self: center; }
  .ld-count { align-items: center; }
}

/* 설정 바의 버튼들을 부드러운 알약 형태로 */
.ld-setup .btn {
  border-radius: 999px;
  padding: 11px 20px;
  font-weight: 700;
  border: 1px solid rgba(142, 160, 210, 0.28);
  box-shadow: 0 2px 8px rgba(142, 160, 210, 0.18);
  transition: transform 0.08s ease, filter 0.12s ease, box-shadow 0.12s ease;
}
.ld-setup .btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(142, 160, 210, 0.28); }
.ld-setup .btn:active { transform: scale(0.97); }

.ld-actions .btn-primary {
  background-image: linear-gradient(135deg, #9cd3ef, #b9b3ee);
  border: none;
  color: #2f3a4d;
  box-shadow: 0 4px 14px rgba(150, 175, 225, 0.45);
}
.ld-actions .btn-primary:hover { filter: brightness(1.05); }

/* ---------- 사다리 보드 ---------- */
.ld-board {
  position: relative;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(142, 202, 230, 0.14), transparent 62%),
    linear-gradient(180deg, rgba(200, 214, 240, 0.14), rgba(200, 214, 240, 0.05));
  border: 1px solid rgba(142, 160, 210, 0.2);
  border-radius: 24px;
  padding: 16px 14px 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 12px 32px rgba(150, 170, 210, 0.14);
}

/* 인원이 많을 때 가로 스크롤 */
.ld-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
}
.ld-scroll::-webkit-scrollbar { height: 8px; }
.ld-scroll::-webkit-scrollbar-thumb { background: rgba(142, 160, 210, 0.4); border-radius: 999px; }

.ld-track {
  min-width: max(100%, calc(var(--ld-cols) * 46px));
}

.ld-row {
  display: grid;
  grid-template-columns: repeat(var(--ld-cols), 1fr);
  gap: 8px;
}

.ld-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

/* ---------- 입력 칩 ---------- */
.ld-chip {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 11px 6px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #43434f;
  min-width: 0;
  box-shadow: 0 3px 9px rgba(150, 160, 190, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.1s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.ld-chip::placeholder { color: rgba(60, 60, 80, 0.42); font-weight: 600; }
.ld-chip:focus { outline: 2px solid rgba(120, 140, 190, 0.6); outline-offset: 2px; }

/* 하단 결과 칩 */
.ld-chip--result {
  background: linear-gradient(135deg, #eef0f8, #e3e6f2);
  color: #4a4a58;
  cursor: text;
}
.ld-chip--result.is-win {
  background: linear-gradient(135deg, #ffd7c2, #f9c2d1);
  color: #8a3350;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7), 0 8px 18px rgba(240, 170, 190, 0.5);
  transform: translateY(-3px);
  animation: ld-pop 0.45s ease;
}

@keyframes ld-pop {
  0% { transform: scale(0.82); }
  60% { transform: scale(1.1); }
  100% { transform: scale(1) translateY(-3px); }
}

/* 개별 타기 버튼 */
.ld-go {
  margin-top: 6px;
  border: 1px solid rgba(142, 160, 210, 0.32);
  background: rgba(255, 255, 255, 0.8);
  color: #5a6478;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, transform 0.08s ease;
}
.ld-go:hover { background: linear-gradient(135deg, #bde3f4, #d9d4f5); color: #2f3a4d; transform: translateY(-1px); }
.ld-go:active { transform: scale(0.95); }
.ld-go:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- 캔버스 + 가림막 ---------- */
.ld-canvas-wrap {
  position: relative;
  margin: 8px 0;
}

/* 카드 내부는 스크롤하지 않는다. 사다리가 길면 카드가 그대로 길어지고 페이지가 스크롤된다 */
.ld-viewport {
  overflow: visible;
  border-radius: 16px;
}

#ld-canvas {
  display: block;
  width: 100%;
  height: 360px;
  touch-action: manipulation;
}

/* 우측 하단 플로팅 - 애니메이션이 오래 걸릴 때 노출 */
.ld-skip-float {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 900;
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 800;
  font-size: 0.95rem;
  color: #2f3a4d;
  background: linear-gradient(135deg, #9cd3ef, #b9b3ee);
  box-shadow: 0 10px 26px rgba(90, 110, 160, 0.4);
  cursor: pointer;
  animation: ld-fade 0.25s ease;
}
.ld-skip-float[hidden] { display: none; }
.ld-skip-float:hover { filter: brightness(1.05); }
.ld-skip-float:active { transform: scale(0.97); }

.ld-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 16px;
  border: 2px dashed rgba(142, 160, 210, 0.4);
  border-radius: 20px;
  background: rgba(200, 214, 240, 0.12);
  backdrop-filter: blur(3px);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.ld-cover.is-hidden { opacity: 0; visibility: hidden; }

/* 순수 CSS 사다리 모양 아이콘 */
.ld-cover-mark {
  position: relative;
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: linear-gradient(135deg, #9cd3ef, #c3bcf0);
  box-shadow: 0 6px 16px rgba(150, 175, 225, 0.45);
}
.ld-cover-mark::before,
.ld-cover-mark::after {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  width: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.92);
}
.ld-cover-mark::before { left: 15px; }
.ld-cover-mark::after { right: 15px; }

.ld-cover-title { font-weight: 800; font-size: 1rem; margin: 0; }
.ld-cover-sub { font-size: 0.85rem; color: #7a8296; margin: 0; }

/* ---------- 결과 배너 ---------- */
.ld-banner {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ld-banner[hidden] { display: none; }

.ld-result-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(200, 214, 240, 0.18);
  border: 1px solid rgba(142, 160, 210, 0.24);
  font-size: 0.9rem;
  font-weight: 600;
  animation: ld-fade 0.35s ease;
}
.ld-result-pill .ld-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.ld-result-pill .ld-arrow { color: #a2acc2; }
.ld-result-pill .ld-to { font-weight: 800; }

@keyframes ld-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ld-status {
  margin-top: 12px;
  font-size: 0.95rem;
  color: #667085;
  min-height: 1.4em;
}

/* ---------- 한 번에 입력하기 버튼 (가림막 안) ---------- */
.ld-quick-btn {
  margin-top: 12px;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #2f3a4d;
  background: linear-gradient(135deg, #9cd3ef, #b9b3ee);
  box-shadow: 0 4px 14px rgba(150, 175, 225, 0.45);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.12s ease;
}
.ld-quick-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.ld-quick-btn:active { transform: scale(0.97); }

/* ---------- 모달 (한 번에 입력 / 결과 표시) ---------- */
.ld-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ld-modal[hidden] { display: none; }

.ld-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 26, 38, 0.5);
  backdrop-filter: blur(3px);
}

.ld-modal-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  color: #1c1e26;
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  animation: ld-fade 0.25s ease;
}

.ld-modal-body {
  overflow-y: auto;
  padding: 30px 24px 24px;
}

/* 우측 상단 고정 닫기 버튼 (내용이 스크롤돼도 자리 유지) */
.ld-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(20, 22, 30, 0.06);
  color: #4a4a58;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, color 0.12s ease, transform 0.08s ease;
}
.ld-modal-close:hover { background: rgba(20, 22, 30, 0.12); color: #14161a; }
.ld-modal-close:active { transform: scale(0.92); }

/* 빠른 입력 */
.ld-qe-head { text-align: center; margin-bottom: 16px; }
.ld-qe-title { font-weight: 800; font-size: 1.2rem; margin: 0; }
.ld-qe-progress { font-size: 0.85rem; color: #8a92a4; margin: 4px 0 0; }

.ld-qe-input {
  width: 100%;
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  padding: 14px 16px;
  border-radius: 14px;
  border: 2px solid #d7dceb;
  background: #f7f9fc;
  color: #1c1e26;
}
.ld-qe-input:focus { outline: none; border-color: #9cc7ef; background: #fff; }

.ld-qe-hint {
  text-align: center;
  font-size: 0.8rem;
  color: #9aa2b2;
  margin: 10px 0 0;
}

.ld-qe-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 16px;
}
.ld-qe-chip {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #eef0f8;
  color: #4a4a58;
  cursor: pointer;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ld-qe-chip.is-current { outline: 2px solid #14161a; outline-offset: 1px; }

/* 한 번에 입력 - 슬롯 목록 */
.ld-qe-label {
  font-weight: 800;
  font-size: 0.8rem;
  color: #8a92a4;
  margin: 16px 0 8px;
}
.ld-qe-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.ld-qe-cellinput {
  flex: 1 1 150px;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid #d7dceb;
  background: #f7f9fc;
  color: #1c1e26;
  font-weight: 600;
  text-align: center;
}
.ld-qe-cellinput:focus { outline: none; border-color: #9cc7ef; background: #fff; }
.ld-qe-tool {
  flex: none;
  border: 1px solid rgba(142, 160, 210, 0.3);
  background: #fff;
  color: #5a6478;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.ld-qe-tool:hover { background: linear-gradient(135deg, #bde3f4, #d9d4f5); color: #2f3a4d; }
.ld-qe-tool:active { transform: scale(0.95); }

.ld-qe-status {
  text-align: center;
  font-size: 0.78rem;
  color: #8a92a4;
  min-height: 1.1em;
  margin-top: 10px;
}

.ld-qe-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}
.ld-qe-actions .btn {
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 700;
  border: 1px solid rgba(142, 160, 210, 0.28);
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.08s ease;
}
.ld-qe-actions .btn:hover { filter: brightness(1.03); transform: translateY(-1px); }
.ld-qe-actions .btn:active { transform: scale(0.97); }
.ld-qe-actions .btn-primary {
  background-image: linear-gradient(135deg, #9cd3ef, #b9b3ee);
  border: none;
  color: #2f3a4d;
  box-shadow: 0 4px 14px rgba(150, 175, 225, 0.4);
}
.ld-qe-actions .btn-ghost { background: #fff; color: #5a6478; }

/* 중앙 결과 */
.ld-res-title { text-align: center; font-weight: 800; font-size: 1.25rem; margin: 0 0 16px; }
.ld-res-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ld-res-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(200, 214, 240, 0.18);
  border: 1px solid rgba(142, 160, 210, 0.2);
  font-size: 0.95rem;
}
.ld-res-row .ld-dot { width: 13px; height: 13px; border-radius: 50%; flex: none; }
.ld-res-row .ld-arrow { color: #a2acc2; }
.ld-res-row .ld-res-from { font-weight: 600; }
.ld-res-row .ld-res-to { font-weight: 800; margin-left: auto; }

/* ---------- 안내 섹션 ---------- */
.ld-guide { margin-top: 34px; }
.ld-guide h2 { margin-bottom: 12px; }
.ld-guide h3 { margin: 18px 0 4px; font-size: 1rem; }
.ld-guide ol,
.ld-guide ul { padding-left: 20px; line-height: 1.7; }
.ld-guide li { margin-bottom: 4px; }

/* ---------- 모바일 ---------- */
@media (max-width: 560px) {
  .ld-setup { justify-content: center; }
  .ld-actions { width: 100%; justify-content: center; }
  .ld-chip { font-size: 0.78rem; padding: 9px 3px; border-radius: 11px; }
  .ld-go { font-size: 0.7rem; padding: 3px 9px; }
  #ld-canvas { height: 320px; }
  .ld-row { gap: 5px; }
  .ld-cover-title { font-size: 0.92rem; }
  .ld-cover-sub { font-size: 0.78rem; }
}

/* ---------- 다크 모드 ---------- */
@media (prefers-color-scheme: dark) {
  .ld-setup { background: #1e1f24; border-color: rgba(255, 255, 255, 0.12); box-shadow: none; }
  .ld-count-label, .ld-cx-label { color: #eef1f6; }
  .ld-modal-card { background: #23242b; color: #e8ebf2; }
  .ld-modal-close { background: rgba(255, 255, 255, 0.1); color: #cdd2dc; }
  .ld-modal-close:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
  .ld-qe-input { background: #17181c; color: #e8ebf2; border-color: rgba(255, 255, 255, 0.18); }
  .ld-qe-input:focus { background: #1c1d22; border-color: #6f9fd0; }
  .ld-qe-chip { background: rgba(255, 255, 255, 0.1); color: #cdd2dc; }
  .ld-qe-chip.is-current { outline-color: #fff; }
  .ld-res-row { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.12); }
  .ld-qe-cellinput { background: #17181c; color: #e8ebf2; border-color: rgba(255, 255, 255, 0.18); }
  .ld-qe-cellinput:focus { background: #1c1d22; border-color: #6f9fd0; }
  .ld-qe-tool { background: rgba(255, 255, 255, 0.08); color: #cdd2dc; border-color: rgba(255, 255, 255, 0.16); }
  .ld-qe-tool:hover { color: #1a1a1e; }
  .ld-qe-actions .btn-ghost { background: rgba(255, 255, 255, 0.08); color: #cdd2dc; }
  .ld-qe-label { color: #9aa2b2; }
  .ld-stepper, .ld-cx-btns { background: #17181c; border-color: rgba(255, 255, 255, 0.14); }
  .ld-step { background: transparent; color: #e8ebf2; }
  .ld-step:hover { background: rgba(255, 255, 255, 0.08); }
  .ld-count-input { background: transparent; color: #f0f2f6; }
  .ld-cx { color: #c3c9d4; }
  .ld-cx:hover { background: rgba(255, 255, 255, 0.08); }
  .ld-status { color: #9aa0aa; }
  .ld-cover-sub { color: #8b93a5; }
  .ld-go { background: rgba(255, 255, 255, 0.08); color: #c3c9d4; }
  .ld-go:hover { color: #1a1a1e; }
  .ld-board { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 12px 32px rgba(0, 0, 0, 0.3); }
  .ld-chip--result { background: linear-gradient(135deg, #34343c, #2b2b33); color: #cdd2dc; }
}
