* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f7f2;
  color: #1f2a1f;
}

.app {
  width: min(960px, 92vw);
  margin: 0 auto;
  padding: 48px 0;
}

.hero {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: #3f7d3c;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.1;
}

.description {
  max-width: 680px;
  margin: 0;
  font-size: 18px;
  line-height: 1.6;
  color: #4c5c4c;
}

.card {
  background: white;
  border: 1px solid #dce8d8;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(40, 80, 40, 0.08);
}

.card h2 {
  margin-top: 0;
}

#statusText {
  font-weight: 700;
}

pre {
  overflow-x: auto;
  background: #102010;
  color: #d9ffd9;
  padding: 16px;
  border-radius: 12px;
}

/* ===== 공통 박스 ===== */
.notice-box {
  margin: 12px 0;
  padding: 12px;
  border-radius: 12px;
  line-height: 1.5;
}

.notice-green {
  background: #f4f7f2;
  border: 1px solid #d8e6d2;
  color: #40543b;
}

.notice-yellow {
  background: #fff8e8;
  border: 1px solid #ead7a4;
  color: #555;
}

/* ===== 버튼 ===== */
.action-button {
  padding: 9px 13px;
  border-radius: 10px;
  border: 1px solid #cfdcc8;
  background: white;
  cursor: pointer;
}

.action-button:hover {
  background: #f4f7f2;
}

/* ===== 카드 ===== */
.timeline-card {
  border: 1px solid #ddd;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  background: white;
}

/* ===== 흐름 구분선 ===== */
.flow-block {
  border-left: 4px solid #ddd;
  padding-left: 12px;
  margin-bottom: 14px;
}

.flow-observation {
  border-color: #d8e6d2;
}

.flow-question {
  border-color: #ead7a4;
}

.flow-next {
  border-color: #cfdcc8;
}

/* ===== 타임라인 전체 ===== */
.timeline-wrapper {
  position: relative;
  padding-left: 28px;
}

/* 세로 라인 */
.timeline-wrapper::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #d8e6d2;
}

/* 각 카드 위치 */
.timeline-item {
  position: relative;
}

/* 동그라미 포인트 */
.timeline-item::before {
  content: '';
  position: absolute;
  left: -18px;
  top: 18px;
  width: 12px;
  height: 12px;
  background: #55724c;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 2px #d8e6d2;
}

/* ===== 단계 접기 UI ===== */
.explore-step {
  transition: all 0.2s ease;
}

.explore-step.collapsed > *:not(h2) {
  display: none;
}

.explore-step h2 {
  cursor: pointer;
  user-select: none;
}

.explore-step h2::after {
  content: ' 접기';
  font-size: 13px;
  color: #777;
  margin-left: 8px;
}

.explore-step.collapsed h2::after {
  content: ' 열기';
}

/* ===== 상단 단계 표시 ===== */
.step-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  padding: 10px 0;
  background: #f7f7f2;
}

.step-nav button {
  flex: 1;
  padding: 10px 8px;
  border-radius: 999px;
  border: 1px solid #cfdcc8;
  background: white;
  cursor: pointer;
  font-weight: 600;
  color: #555;
}

.step-nav button.active {
  background: #55724c;
  color: white;
  border-color: #55724c;
}

/* ===== 시간 범위 버튼 ===== */
.range-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;               /* 🔥 버튼 간격 균일 */
  margin: 0;
}

.range-buttons button {
  padding: 6px 10px;      /* 🔥 살짝 컴팩트하게 */
  border-radius: 999px;
  border: 1px solid #cfdcc8;
  background: white;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: #555;
}

.range-buttons button.active {
  background: #55724c;
  color: white;
  border-color: #55724c;
}

.graph-range-panel.compact {
  margin: 10px 0 12px 0;
  padding: 10px;
}

.range-buttons button:hover {
  background: #eef7ea;
}

.graph-range-panel {
  margin: 8px 0 10px 0;
  padding: 0;              /* 🔥 좌측 붙이기 */
  background: transparent; /* 🔥 박스 느낌 제거 */
  border: none;
}

.graph-range-title {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin: 0 0 6px 0;      /* 🔥 위쪽 붙이고 아래만 여백 */
  padding-left: 2px;      /* 🔥 살짝만 들여쓰기 */
}

/* ===== 카메라 이미지 UX ===== */
.node-camera-box {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  align-items: center;
}

.node-camera-img {
  width: 150px;
  height: 105px;
  object-fit: cover;
  border-radius: 12px;
  border: none;
}

.node-camera-meta {
  font-size: 12px;
  color: #777;
  line-height: 1.5;
}

.compare-photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.compare-photo-img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 12px;
  border: none;
  background: transparent;
}

.compare-photo-img {
  background: #fafafa;
}

/* ===== 모바일 공간 절약 ===== */
@media (max-width: 640px) {
  .app {
    width: min(100%, 94vw);
    padding: 24px 0;
  }

  .card {
    padding: 16px;
    border-radius: 14px;
  }

  .hero {
    margin-bottom: 18px;
  }

  h1 {
    font-size: 30px;
  }

  .description {
    font-size: 15px;
  }

  .node-camera-box {
    grid-template-columns: 96px 1fr;
    gap: 10px;
  }

  .node-camera-img {
    width: 96px;
    height: 72px;
    border-radius: 10px;
  }

  .node-camera-meta {
    font-size: 11px;
  }

  .compare-photo-grid {
    gap: 8px;
  }

  .compare-photo-img {
    max-height: 120px;
    object-fit: contain;
  }

  .step-nav {
    gap: 4px;
  }

  .step-nav button {
    font-size: 12px;
    padding: 8px 4px;
  }
}

/* ===== 사진 확대 모달 ===== */
.image-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.image-modal.open {
  display: flex;
}

.image-modal-content {
  position: relative;
  max-width: min(920px, 96vw);
  max-height: 92vh;
}

.image-modal-content img {
  width: 100%;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 14px;
  background: white;
}

.image-modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: white;
  font-size: 24px;
  cursor: pointer;
}

.photo-time-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}

.photo-time-hint strong {
  color: #55724c;
}

.mini-action-button {
  margin-top: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid #cfdcc8;
  background: white;
  font-size: 11px;
  cursor: pointer;
}

.mini-action-button:hover {
  background: #f4f7f2;
}

/* ===== 사진 히스토리 모달 ===== */
.photo-history-content {
  position: relative;
  width: min(920px, 96vw);
  max-height: 88vh;
  overflow-y: auto;
  background: white;
  border-radius: 18px;
  padding: 18px;
}

.photo-history-content h3 {
  margin-top: 0;
}

.photo-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.photo-history-item {
  cursor: pointer;
}

.photo-history-item img {
  width: 100%;
  height: 95px;
  object-fit: cover;
  border-radius: 10px;
  background: #f4f4f4;
}

.photo-history-time {
  margin-top: 4px;
  font-size: 11px;
  color: #666;
}

/* 사진 히스토리 위에 확대 모달이 뜨도록 조정 */
#photoHistoryModal {
  z-index: 1000;
}

#imageModal {
  z-index: 1100;
}

#imageModal .image-modal-close {
  z-index: 1101;
}