*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
    sans-serif;
  background: #050712;
  color: #f9fafb;
}

/* Main container */
.ad-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 10px;
  background: radial-gradient(circle at top, #111827 0, #020617 55%, #000 100%);
}

/* Header */
.header {
  padding: 4px 4px 8px;
  text-align: left;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: #e5e7eb;
  margin-bottom: 6px;
}

.title {
  font-size: 18px;
  margin: 0 0 4px;
}

.subtitle {
  font-size: 12px;
  margin: 0;
  line-height: 1.3;
  color: #9ca3af;
}

/* Viewer */
.viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px;
}

/* X-ray frame */
.image-frame {
  position: relative;
  flex: 1;
  min-height: 150px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: radial-gradient(circle at top, #020617 0, #020617 40%, #000 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-image {
  max-width: 100%;
  max-height: 100%;
  display: none;
  object-fit: contain;
}

.placeholder-text {
  font-size: 13px;
  color: #6b7280;
  text-align: center;
}

/* Analyzing overlay */
.analyzing-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.96), #020617);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

.analyzing-overlay p {
  margin: 0;
  font-size: 13px;
  color: #e5e7eb;
}

.spinner {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 3px solid rgba(148, 163, 184, 0.4);
  border-top-color: #38bdf8;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Result panel */
.result-panel {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(51, 65, 85, 0.9);
}

.result-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.result-metrics {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
}

.result-metrics li {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(55, 65, 81, 0.7);
}

.result-metrics li:last-child {
  border-bottom: none;
}

.metric-label {
  color: #9ca3af;
  padding-right: 8px;
}

.metric-value {
  color: #e5e7eb;
  font-weight: 500;
  text-align: right;
}

/* Summary not used now */
.result-summary {
  display: none;
}

/* Thumbnails */
.thumb-strip {
  padding: 4px;
  margin-top: 4px;
  position: relative;
}

.thumb-strip::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;         
  height: 100%;
  pointer-events: none;
  background: linear-gradient(to left, #020617, transparent);
}


.thumb-label {
  margin: 0 0 4px;
  font-size: 11px;
  color: #9ca3af;
}

.thumb-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  touch-action: pan-x;
}

.thumb-card {
  flex: 0 0 32%;
  max-width: 150px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(55, 65, 81, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  /* touch-action: none; */
  transition: transform 0.16s ease-out, box-shadow 0.16s ease-out,
    border-color 0.16s ease-out, background 0.16s ease-out;
}

.thumb-card:active {
  transform: translateY(-4px) scale(0.98);
}

.thumb-card.selected {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
  background: radial-gradient(circle at top, #0b1120, #020617);
}

.thumb-image-wrap {
  width: 100%;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: #020617;
}

.thumb-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain; /* show entire image inside the box */
}

.thumb-caption {
  font-size: 11px;
  color: #e5e7eb;
}

.thumb-scroll-wrapper {
  position: relative;
  display: flex;
  align-items: stretch;
}

/* 좌우 화살표 공통 스타일 */
.scroll-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: radial-gradient(circle at 30% 30%, #1f2933, #020617);
  color: #e5e7eb;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 10px rgba(15, 23, 42, 0.9);
  opacity: 0.9;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.scroll-arrow:hover {
  transform: translateY(-50%) scale(1.05);
}

.scroll-arrow:active {
  transform: translateY(-48%) scale(0.97);
}

/* 왼쪽/오른쪽 위치 */
.scroll-arrow-left {
  left: 2px;
}

.scroll-arrow-right {
  right: 2px;
}

/* 스크롤 끝에서는 자연스럽게 숨기기 */
.hidden-arrow {
  opacity: 0;
  pointer-events: none;
}

/* 오른쪽 페이드 (옆에 더 있다는 느낌) */
.thumb-scroll-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(to left, #020617, transparent);
}


/* CTA */
.footer {
  margin-top: 18px;
  padding: 0 4px 4px;
}

.cta-button {
  width: 100%;
  padding: 10px 16px;
  border-radius: 999px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  color: #020617;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.7);
}

.cta-button:active {
  transform: translateY(1px);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.8);
}

/* Utils */
.hidden {
  display: none !important;
}

/* Small-height screens */
@media (max-height: 640px) {
  .title {
    font-size: 16px;
  }
  .subtitle {
    font-size: 11px;
  }
  .result-title {
    font-size: 13px;
  }
  .result-metrics {
    font-size: 11px;
  }
}
