:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1c1e26;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --easy: #16a34a;
  --normal: #d97706;
  --hard: #dc2626;
  --phone-colors: #4f46e5, #ec4899, #16a34a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14151c;
    --card: #1d1f29;
    --text: #f0f1f5;
    --text-muted: #9aa0ac;
    --border: #303240;
    --accent-soft: #232544;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  padding: 40px 0 32px;
  text-align: center;
}
.site-header h1 { margin: 0 0 6px; font-size: 1.9rem; }
.site-header .tagline { margin: 0; opacity: 0.9; font-size: 0.95rem; }

main.wrap { padding-top: 28px; padding-bottom: 40px; }

.ad-slot {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 14px;
  margin: 20px 0;
}

.picker-section { margin-bottom: 20px; }
.picker-guide { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 10px; }

.picker-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.phone-picker {
  padding: 12px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.92rem;
  appearance: none;
}

.view-toggle {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.toggle-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.88rem;
}
.toggle-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.calib-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.calib-status {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
}
.calib-status.on { color: var(--easy); }
.calib-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.calib-secondary-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 0.84rem;
  cursor: pointer;
}
.calib-recalibrate {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
}

.calib-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.calib-modal[hidden] { display: none; }
.calib-modal-inner {
  background: var(--card);
  border-radius: 16px;
  padding: 24px 22px;
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.calib-modal-inner h3 { margin: 0 0 10px; font-size: 1.1rem; }
.calib-modal-inner p { font-size: 0.86rem; color: var(--text-muted); margin: 0 0 14px; }
.calib-card-area {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  margin-bottom: 16px;
}
.calib-card {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 2px solid var(--accent);
  border-radius: 10px;
  width: 240px;
  height: 151px;
}
#calibSlider { width: 100%; margin-bottom: 16px; }
.calib-actions { display: flex; gap: 10px; justify-content: flex-end; }
.calib-note { font-size: 0.74rem !important; margin-top: 14px !important; }

.visual-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 16px;
  margin-bottom: 20px;
}

.visual-stage {
  display: flex;
  flex-direction: column;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 18px;
}
.legend span {
  font-size: 0.74rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}

.outline-area {
  min-height: 300px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 28px;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
}
.outline-area.overlay-mode .phone-outline { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); }

.phone-outline {
  position: relative;
  flex-shrink: 0;
  border-radius: 22px;
  border: 3px solid;
  /* 실제 폰 베젤은 화면이 꺼져 있든 켜져 있든 거의 항상 검정에 가까워서, 폰별 슬롯 색상은
     테두리(border)에만 남기고 베젤 채우기는 검정 계열로 통일했다. */
  background: #111114;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: inherit;
  white-space: nowrap;
}

/* 화면 대각선/해상도 비율에서 역산한 베젤 근사치 — 실측 사진이 아닌 계산된 사각형.
   베젤(검정)과 뚜렷이 구분되도록 화면 영역은 밝은 색으로 표시한다. */
.screen-rect {
  position: absolute;
  background: #ffffff;
  border-radius: 14px;
}

/* 실물 사진 대신 카메라 컷아웃 위치를 표시하는 자체 벡터 마크 */
.cam-mark {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: #0b0b0f;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}
.cam-mark.cam-punch {
  border-radius: 50%;
}
/* Z 플립 접은 상태 후면 카메라/플래시 — 검정 절개 위에도, 흰 화면 위에도 보이도록
   회색 링을 둘러 양쪽 배경에서 다 도드라지게 한다. */
.cam-mark.cam-flip-lens {
  border-radius: 50%;
  background: #0b0b0f;
  box-shadow: 0 0 0 1.5px #7c828c;
}
.cam-mark.cam-home {
  top: auto;
  bottom: 6px;
  background: transparent;
  border: 2px solid currentColor;
  opacity: 0.55;
  border-radius: 50%;
}
.phone-outline .label { transform: translateY(20px); color: var(--text); background: var(--card); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); }

/* 겹쳐보기(overlay) 모드 전용 — 각 폰의 테두리 선만 다시 그려서 항상 최상단에 오도록 한다.
   원래는 폰마다 하나의 박스(베젤 채우기 + 테두리)라서, 뒤에 깔린 큰 폰의 테두리가 앞에 겹쳐진
   작은 폰의 불투명한 검정 베젤에 가려져 안 보이는 문제가 있었다. 그래서 채우기 없는 테두리만
   있는 사본을 모든 폰의 베젤보다 위(z-index)에 별도로 그려서, 겹치는 부분에서도 모든 폰의
   실제 테두리가 항상 다 보이게 한다. */
.phone-ring {
  background: transparent !important;
  pointer-events: none;
}

.empty-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 40px 0;
  text-align: center;
}

.scale-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: 14px 0 0;
}

.spec-section { margin-bottom: 28px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
thead th { background: var(--accent-soft); color: var(--accent); font-weight: 700; position: sticky; top: 0; }
tbody th { color: var(--text-muted); font-weight: 600; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: none; }

.grip-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.grip-badge.easy { background: rgba(22,163,74,0.12); color: var(--easy); }
.grip-badge.normal { background: rgba(217,119,6,0.12); color: var(--normal); }
.grip-badge.hard { background: rgba(220,38,38,0.12); color: var(--hard); }

.est-mark { color: var(--text-muted); font-size: 0.72rem; }

.buy-btn {
  display: inline-block;
  margin-top: 4px;
  padding: 6px 12px;
  background: #ff5722;
  color: #fff;
  border-radius: 8px;
  font-size: 0.78rem;
  text-decoration: none;
  font-weight: 600;
}

.info-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 20px;
  margin-bottom: 12px;
}
.info-section h2 { font-size: 1.05rem; margin: 0 0 8px; }
.info-section h2:not(:first-child) { margin-top: 22px; }
.info-section p { color: var(--text-muted); font-size: 0.92rem; margin: 0; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 40px;
}
.site-footer p { color: var(--text-muted); font-size: 0.78rem; margin: 0 0 6px; }
.site-footer .copyright { font-size: 0.72rem; }

@media (max-width: 560px) {
  .picker-row { grid-template-columns: 1fr; }
  .site-header h1 { font-size: 1.5rem; }
}
