* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "맑은 고딕", sans-serif;
  background: #f0f2f5;
  color: #2c3e50;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

/* ====== 헤더 ====== */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 14px 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  z-index: 100;
}
.header-inner {
  max-width: 700px;
  margin: 0 auto;
}
header h1 {
  font-size: 20px;
  margin-bottom: 10px;
}

/* ====== 상단 스텝 네비게이션 ====== */
.stepnav {
  display: flex;
  gap: 4px;
}
.stepnav a {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  padding: 8px 12px;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
}
.stepnav a:hover { background: rgba(255,255,255,0.15); }
.stepnav a.active {
  background: rgba(255,255,255,0.25);
  color: #fff;
  font-weight: 700;
}
.stepnav a.done {
  color: rgba(255,255,255,0.9);
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.stepnav a.active .step-num {
  background: #fff;
  color: #667eea;
}
.stepnav a.done .step-num {
  background: #48bb78;
  color: #fff;
}

/* ====== 슬라이더 ====== */
.slider-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
}
.slider-track {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  height: 100%;
  will-change: transform;
}
.slide {
  min-width: 100%;
  width: 100%;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px;
  height: 100%;
}
.slide-inner {
  max-width: 700px;
  margin: 0 auto;
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.slide-inner h2 {
  color: #4a5568;
  font-size: 18px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e8eaf6;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 카드 내 스크롤 가능 영역 */
.slide-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}

/* ====== 슬라이드 하단 이전/다음 ====== */
.slide-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid #edf2f7;
  flex-shrink: 0;
}
.btn-prev, .btn-next {
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-prev {
  background: #edf2f7;
  color: #4a5568;
}
.btn-prev:hover { background: #e2e8f0; }
.btn-next {
  background: #667eea;
  color: #fff;
}
.btn-next:hover { background: #5a67d8; transform: translateY(-1px); }

/* ====== 도움말(?) 버튼 ====== */
.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  background: #edf2f7;
  color: #667eea;
  font-size: 14px;
  font-weight: 700;
  border: 2px solid #667eea;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
  flex-shrink: 0;
}
.help-btn:hover {
  background: #667eea;
  color: #fff;
  transform: scale(1.15);
}

/* ====== 모달 ====== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from{transform:translateY(30px);opacity:0} to{transform:translateY(0);opacity:1} }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid #e8eaf6;
}
.modal-header h3 { font-size: 16px; color: #667eea; }
.modal-close {
  background: none;
  border: none;
  font-size: 26px;
  color: #aaa;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: #e74c3c; }
.modal-body {
  padding: 18px 22px 22px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.7;
}
.modal-body h4 {
  margin: 16px 0 8px;
  color: #4a5568;
  font-size: 15px;
  border-left: 3px solid #667eea;
  padding-left: 10px;
}
.modal-body h4:first-child { margin-top: 0; }
.modal-body p { margin: 0 0 10px; }
.modal-body ul { margin: 0 0 10px; padding-left: 20px; }
.modal-body li { margin-bottom: 4px; }
.modal-body code {
  background: #f0f4ff;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
}
.guide-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: 13px;
}
.guide-table th {
  background: #f0f4ff;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  color: #4a5568;
  font-weight: 600;
}
.guide-table td {
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  vertical-align: top;
}
.guide-table tr:nth-child(even) td { background: #fafbfc; }

/* ====== 폼 요소 ====== */
.input-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.input-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 14px;
}
.input-row .input-group { flex: 1; min-width: 120px; margin-bottom: 0; }

label { font-weight: 600; font-size: 13px; color: #555; }

input[type="number"], input[type="file"], textarea, select {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border 0.2s;
}
input[type="number"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}
textarea {
  font-family: "Consolas", "Menlo", monospace;
  resize: vertical;
}

/* ====== 버튼 ====== */
button { font-family: inherit; }
.btn-primary {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #667eea;
  color: white;
  transition: all 0.2s;
}
.btn-primary:hover:not(:disabled) { background: #5568d3; transform: translateY(-1px); }
.btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #edf2f7;
  color: #667eea;
  transition: all 0.2s;
}
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }
.btn-big { padding: 14px 28px; font-size: 16px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ====== 상태 박스 ====== */
.status-box {
  background: #f7fafc;
  padding: 12px 16px;
  border-radius: 8px;
  margin: 10px 0;
  font-size: 14px;
  border: 1px solid #e2e8f0;
}
.status-box strong { color: #667eea; font-size: 18px; }
.warn { color: #e74c3c; font-size: 13px; margin-top: 4px; }

/* ====== 미리보기 ====== */
.preview { margin-top: 12px; }
.preview summary {
  cursor: pointer;
  padding: 8px 12px;
  background: #f7fafc;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  color: #555;
}
.combo-list {
  max-height: 250px;
  overflow-y: auto;
  padding: 10px;
  background: #fafbfc;
  border-radius: 6px;
  margin-top: 6px;
  font-family: "Consolas", "Menlo", monospace;
  font-size: 13px;
}
.combo-row {
  padding: 3px 0;
  border-bottom: 1px dashed #e5e7eb;
}
.combo-row:last-child { border-bottom: none; }
.combo-idx { color: #999; display: inline-block; width: 36px; }
.combo-nums { color: #2c3e50; }

.set-block {
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
}
.set-block h4 { margin: 0 0 6px; color: #667eea; font-size: 14px; }

/* ====== 프로그레스 ====== */
.progress-wrap { margin: 14px 0; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}
.progress-bar {
  height: 10px;
  background: #e5e7eb;
  border-radius: 5px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  width: 0%;
  transition: width 0.2s;
}

/* ====== 결과 세트 ====== */
.result-set {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}
.result-set-head {
  background: #f0f4ff;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
}
.result-set-body {
  max-height: 220px;
  overflow-y: auto;
  padding: 10px 14px;
  font-family: "Consolas", monospace;
  font-size: 13px;
}

/* ====== 반응형 ====== */
@media (max-width: 600px) {
  header { padding: 10px 14px; }
  header h1 { font-size: 17px; margin-bottom: 8px; }
  .stepnav a { font-size: 11px; padding: 6px 8px; }
  .slide { padding: 10px; }
  .slide-inner { padding: 16px; }
  .input-row { flex-direction: column; gap: 8px; }
  .input-row .input-group { min-width: 100%; }
}
