.blockchain-demo4-wrap {
  max-width: 860px;
  margin: 40px auto;
  padding: 0 16px;
}

.blockchain-demo4-button-list {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 10px;
  margin-bottom: 18px;
}

.blockchain-demo4-button {
  border: 1px solid rgb(190, 218, 218);
  background: #fff;
  padding: 20px 30px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

.blockchain-demo4-button.active {
  background: #29a2b3;
  color: #fff;
}

.blockchain-demo4-card {
  background: #fff;
  padding: 24px;
}

.blockchain-demo4-title-box {
  border-radius: 15px;
  background: #DCE6F3;
  padding: 20px;
}

.blockchain-demo4-title {
  margin: 0 0 8px;
  font-size: 25px;
  font-weight: 700;
  color: #111827;
}

.blockchain-demo4-desc {
  margin: 0 0 24px;
  color: #6b7280;
  line-height: 1.6;
  font-size: 13px;
}

.blockchain-demo4-section {
  border-radius: 10px;
  margin: 15px 0;
  box-shadow: 1px 1px 8px #00000027;
  padding: 20px;
}

.blockchain-demo4-section-title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
  color: #000;
}

.blockchain-demo4-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: center;
}

.blockchain-demo4-field {
  margin-bottom: 16px;
}

.blockchain-demo4-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.blockchain-demo4-field input,
.blockchain-demo4-field textarea,
.blockchain-demo4-field select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  font-size: 15px;
  background: #fff;
  text-align: center;
}

.blockchain-demo4-field.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.blockchain-demo4-field.row label {
  margin-bottom: 0;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 13px;
}

.blockchain-demo4-field.row select,
.blockchain-demo4-field.row input {
  flex: 1;
  height: 44px;
}

.bd4-select {
  border-radius: 5px !important;
  border: 1.5px solid #3485EF !important;
  padding: 5px 12px !important;
}

.bd4-label {
  color: #004AAB;
}

.blockchain-demo4-box {
  border-radius: 10px;
  background-color: #F1F1F1;
  padding: 20px;
}

.blockchain-demo4-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: #111827;
  color: #fff;
  margin-top: 20px;
}

.blockchain-demo4-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.blockchain-demo4-result {
  margin-top: 18px;
  padding: 16px;
  border-radius: 16px;
  background: #f9fafb;
  min-height: 60px;
  line-height: 1.65;
  word-break: break-word;
}

.blockchain-demo4-main-box1,
.blockchain-demo4-main-box2,
.blockchain-demo4-main-box3,
.blockchain-demo4-main-box4 {
  display: none;
}

.blockchain-demo4-main-box1.active,
.blockchain-demo4-main-box2.active,
.blockchain-demo4-main-box3.active,
.blockchain-demo4-main-box4.active {
  display: block;
}

.bd4-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bd4-field label {
  white-space: nowrap;
  font-weight: 600;
  flex-shrink: 0;
}

.bd4-field input {
  flex: 1;
  height: 35px;
  border-radius: 4px;
}

.bd4-p-row-1 {
  margin-bottom: 12px;
}

.bd4-p-row-2,
.bd4-p-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.bd4-p-row-4 .full {
  width: 100%;
}

.blockchain-demo4-info-box2 {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bd4-field2 {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bd4-field2 label {
  font-weight: 700;
  font-size: 14px;
}

.bd4-field2 textarea {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 12px;
  background: #D2D2D2;
  resize: none;
  font-size: 13px;
  line-height: 1.5;
  box-sizing: border-box;
}

.bd4-f-row-1 textarea,
.bd4-f-row-2 textarea {
  height: 100px;
  overflow-y: auto;
}

.bd4-f-row-2 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.bd4-food-ingredients-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}

.bd4-food-ingredients-table th,
.bd4-food-ingredients-table td {
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
}

.safe {
  color: #047857;
  font-weight: 800;
}

.danger {
  color: #b91c1c;
  font-weight: 800;
}

.bd4-success {
  color: #047857;
  font-weight: 700;
  margin-bottom: 8px;
}

.bd4-error {
  color: #b91c1c;
  font-weight: 700;
  margin-bottom: 8px;
}

.bd4-warn {
  color: #b45309;
  font-weight: 700;
  margin-bottom: 8px;
}

.bd4-meta {
  margin-bottom: 6px;
}

.bd4-details {
  margin-top: 10px;
}

.bd4-pre {
  margin-top: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  background: #111827;
  color: #f9fafb;
  padding: 12px;
  border-radius: 12px;
  font-size: 13px;
  max-height: 420px;
  overflow: auto;
}

.bd4-result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 12px 0 16px;
}

.bd4-result-tabs {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bd4-tab-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 16px;
  font-weight: 800;
  padding: 0 18px 8px;
  border-bottom: 3px solid #d1d5db;
  cursor: pointer;
}

.bd4-tab-btn.active {
  color: #111827;
  border-bottom-color: #111827;
}

.bd4-explorer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 7px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #004AAB;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.bd4-tab-panel {
  display: none;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}

.bd4-tab-panel.active {
  display: block;
}

.bd4-info-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  margin-bottom: 7px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.bd4-info-row:last-child {
  margin-bottom: 0;
}

.bd4-info-label {
  color: #6b7280;
  font-size: 13px;
  font-weight: 700;
}

.bd4-info-value {
  color: #111827;
  font-size: 14px;
  font-weight: 700;
  word-break: break-word;
}

.bd4-json-area {
  margin-top: 18px;
  padding: 18px;
  border-radius: 14px;
  background: #f9fafb;
}

.bd4-json-area summary {
  cursor: pointer;
  font-weight: 700;
  color: #374151;
}

#bd4-result.bd4-empty .bd4-result-head,
#bd4-result.bd4-empty .bd4-tab-panel,
#bd4-result.bd4-empty .bd4-json-area {
  display: none;
}

/* 기본 (아이콘 상태) */
.blockchain-demo4-info-box-img-box {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 120px;
  border-radius: 10px;
  background-color: #F1F1F1;
  overflow: hidden;
}

/* 아이콘 */
.bd4-icon {
  width: 60px;
  height: auto;
}

/* 이미지 선택된 상태 */
.blockchain-demo4-info-box-img-box.has-image {
  height: 240px;
  padding: 0;
}

/* 선택된 이미지 */
.blockchain-demo4-info-box-img-box.has-image img {
  width: 180px;
  height: auto;
  object-fit: cover;
}

.bd4-preview {
  width: 240px; 
  height: auto;
}

.blockchain-demo4-menu-box {
  margin-top: 10px;
  display: flex;
  gap: 20px;
  align-items: stretch;
}

.blockchain-demo4-menu-box-left {
  flex: 1;
}

.blockchain-demo4-menu-box-left ul {
  padding-left: 18px;
  margin: 0;
}

.blockchain-demo4-menu-box-left li {
  margin-bottom: 6px;
  font-size: 14px;
}

.blockchain-demo4-menu-box-right {
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nutrition-information {
  background: #f3f4f6;
  border-radius: 12px;
  padding: 12px;
}

.bd4-food-nutrition-information-table {
  width: 100%;
  text-align: center;
}

.bd4-food-nutrition-information-table thead th {
  font-size: 16px;
  font-weight: 800;
}

.bd4-food-nutrition-information-table tbody th {
  font-size: 12px;
  color: #6b7280;
}

.blockchain-demo4-disease {
  border: 2px solid #f87171;
  background: #fee2e2;
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
}

.blockchain-demo4-disease > div:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #b91c1c;
  margin-bottom: 6px;
}

.blockchain-demo4-allergy {
  border: 2px solid #fb923c;
  background: #ffedd5;
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
}

.blockchain-demo4-allergy > div:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #c2410c;
  margin-bottom: 6px;
}

.bd4-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.bd4-modal-overlay.open {
  display: flex;
}

.bd4-modal-box {
  background: #fff;
  border-radius: 16px;
  width: 620px;
  max-width: 95%;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.bd4-modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bd4-modal-title {
  font-size: 18px;
  font-weight: 700;
}

.bd4-btn-close {
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.bd4-modal-sub {
  font-size: 13px;
  color: #9ca3af;
  margin: 10px 0 20px;
}

.bd4-img-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.bd4-img-thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
}

.bd4-img-thumb.selected {
  border-color: #3b82f6;
}

.bd4-img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bd4-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.bd4-btn-confirm {
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
}

.bd4-btn-confirm:disabled {
  background: #bfdbfe;
}

.bd4-btn-cancel {
  background: #f1f5f9;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
}

#blockchain-demo4-section-result {
  display: none;
}

.bd4-tx-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
}

.bd4-tx-modal.active {
  display: block;
}

.bd4-tx-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}

.bd4-tx-modal-card {
  position: relative;
  width: min(760px, calc(100% - 32px));
  max-height: calc(100vh - 80px);
  overflow: auto;
  margin: 40px auto;
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.bd4-tx-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.bd4-tx-modal-head h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #111827;
}

.bd4-tx-modal-close {
  border: none;
  background: #f3f4f6;
  color: #111827;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
}

.bd4-tx-modal-body {
  line-height: 1.6;
}

@media (max-width: 640px) {
  .blockchain-demo4-grid,
  .bd4-p-row-2,
  .bd4-p-row-3,
  .bd4-f-row-2 {
    grid-template-columns: 1fr;
  }

  .blockchain-demo4-button-list,
  .bd4-result-head,
  .blockchain-demo4-menu-box {
    flex-direction: column;
    align-items: stretch;
  }

  .bd4-result-tabs {
    width: 100%;
  }

  .bd4-tab-btn {
    flex: 1;
    padding-left: 8px;
    padding-right: 8px;
  }

  .bd4-explorer-btn {
    width: 100%;
  }

  .bd4-info-row {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .blockchain-demo4-menu-box-right {
    width: 100%;
  }

  .bd4-tx-modal-card {
    margin: 20px auto;
    max-height: calc(100vh - 40px);
  }
}

#blockchain-demo4-history-section {
  display: none;
}



/*추가 css*/

.bd4-origin-wrap {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 24px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.bd4-origin-wrap h4 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 800;
  color: #111827;
}

.bd4-origin-card {
  background: #f1f1f1;
  border-radius: 12px;
  padding: 16px 22px;
}

.bd4-origin-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 6px 0;
  font-size: 14px;
}

.bd4-origin-row span {
  color: #374151;
}

.bd4-origin-row strong {
  color: #111827;
  font-weight: 700;
}

.bd4-origin-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 14px;
  color: #374151;
}

.bd4-origin-history-row span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bd4-origin-link-btn {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 6px;
  background: #9ca3af;
  color: #fff;
  cursor: pointer;
}

@media (max-width: 640px) {
  .bd4-origin-wrap {
    grid-template-columns: 1fr;
  }
}

/*기존 이력 내용*/
#blockchain-demo4-history-section {
  display: none !important;
}


/*2단계 내용임*/
.bd4-progress-bar {
  position: relative;
  height: 10px;
  background: #333;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 20px;
}

#bd4-progress-fill {
  position: absolute;
  left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #fb923c, #22c55e, transparent);
  animation: bd4ScanBar 1.4s linear infinite;
}

.bd4-complete #bd4-progress-fill {
  animation: none;
  left: 0;
  width: 100%;
  background: #22c55e;
}

.bd4-log-box {
  height: 220px;
  overflow-y: auto;
  background: #020617;
  padding: 12px;
  border-radius: 14px;
  font-family: monospace;
  font-size: 13px;
}

.bd4-log-line {
  color: #86efac;
  margin-bottom: 4px;
}

@keyframes bd4ScanBar {
  0% { left: -40%; }
  100% { left: 100%; }
}



/* 상단 배너 전체 컨테이너 */
.bd4-banner-wrap {
    width: 100%;
    max-width: 860px;
    margin: 0 auto 30px;
    background-image: url('https://safeean.club/wordpress/btp/silverbutton2.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 0; 
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between; 
    min-height: 280px; 
}

/* 상단 슬로건 텍스트 */
.bd4-banner-top-text {
    padding: 60px 0 0 50px; 
    font-size: 26px;
    line-height: 1.4;
    color: #333;
    border-radius: 0;
}

.bd4-banner-top-text strong {
    font-weight: 800;
}

/* 하단 버튼 영역 (높이 차이 구현 핵심) */
.bd4-banner-button-area {
    display: flex;
    align-items: flex-end; /* 자식 요소들을 바닥에 밀착시켜 단차 생성 */
    background: transparent; /* 배경을 투명하게 해야 단차가 보임 */
    margin-top: auto; 
}

/* [수정] 왼쪽 메인 파란색 버튼 (높게 유지) */
.bd4-main-action-btn {
    background-color: #004AAB;
    color: #fff;
    padding: 30px 40px; /* 패딩을 늘려 높이를 키움 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 250px;
    border-radius: 0; 
    box-sizing: border-box;
}

.bd4-main-action-btn .main-label {
    font-size: 20px;
    font-weight: 700;
}

.bd4-main-action-btn .sub-label {
    font-size: 13px;
    opacity: 0.9;
    margin-top: 5px;
}

/* [수정] 오른쪽 단계 버튼 그룹 (높이를 낮게 고정) */
.bd4-step-buttons {
    display: flex;
    flex: 1;
    height: 85px; /* 파란 버튼보다 낮은 높이 설정 (원하는 만큼 조절) */
    background: #fff; /* 단계 버튼들만 흰색 배경 적용 */
    border-top: 1px solid #ccc;
    box-sizing: border-box;
}

/* 개별 단계 버튼 스타일 */
.blockchain-demo4-button {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 10px; /* 세로 패딩 제거 (부모 height를 따름) */
    cursor: pointer;
    background: #fff;
    border-right: 1px solid #ddd;
    border-radius: 0 !important; 
    transition: background 0.2s;
    box-sizing: border-box;
}

.blockchain-demo4-button:last-child {
    border-right: none;
}

.blockchain-demo4-button .step-no {
    font-size: 11px;
    color: #888;
    margin-bottom: 3px;
}

.blockchain-demo4-button .step-name {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    text-align: center;
}

/* 활성화 상태 (하단 파란 바 스타일) */
.blockchain-demo4-button.active {
    background-color: #fff !important;
    position: relative;
    box-shadow: inset 0 -5px 0 #004AAB; 
}

.blockchain-demo4-button.active .step-name,
.blockchain-demo4-button.active .step-no {
    color: #004AAB;
}

/* 래퍼 패딩 초기화 */
.blockchain-demo4-wrap { padding: 0; }

/*로딩 스피너 */



.bd4-loading-box {
  text-align: center;
  padding: 48px 20px;
  background: #fff;
  border-radius: 18px;
}

.bd4-spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border: 5px solid #e5e7eb;
  border-top: 5px solid #111827;
  border-radius: 50%;
  animation: bd4-spin 1s linear infinite;
}

.bd4-loading-box p {
  margin: 0;
  font-weight: 800;
  color: #111827;
}

.bd4-loading-sub {
  margin-top: 8px !important;
  font-size: 13px;
  font-weight: 500 !important;
  color: #6b7280 !important;
}

@keyframes bd4-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}