/* 기본 리셋 */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui,
    "Noto Sans KR", sans-serif;
  background: radial-gradient(circle at top, #1d2b64 0, #090a0f 50%, #000 100%);
  color: #f9fafb;
  display: flex;
  justify-content: center;
  padding: 16px;
}

/* 앱 전체 래퍼 */

.app-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100%;
  background: rgba(10, 14, 25, 0.96);
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6);
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
}

/* 헤더 */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-dot {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #4ade80, #16a34a);
  box-shadow: 0 0 18px rgba(74, 222, 128, 0.8);
}

.logo-text {
  font-weight: 800;
  letter-spacing: 0.03em;
  font-size: 1.2rem;
}

.logo-ai {
  color: #38bdf8;
}

/* 슬로건 */

.slogan {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 4px 0 10px;
  color: #4ade80;
  text-align: center;
}

/* 뱃지 */

.badge-area {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.pill-free {
  background: rgba(59, 130, 246, 0.2);
  color: #bfdbfe;
  border: 1px solid rgba(59, 130, 246, 0.6);
}

.pill-premium {
  background: rgba(234, 179, 8, 0.18);
  color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.8);
}

/* 메인 영역 */

.app-main {
  flex: 1;
  overflow-y: auto;
  padding-top: 4px;
  padding-bottom: 8px;
}

/* 섹션 공통 카드 */

.glass-card {
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.96),
    rgba(15, 23, 42, 0.85)
  );
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  padding: 14px 14px 12px;
  margin-bottom: 12px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.6);
}

/* 텍스트 */

.usage-text {
  font-size: 0.9rem;
  color: #e5e7eb;
  margin-bottom: 4px;
  text-align: center;
}

.helper-text {
  font-size: 0.85rem;
  color: #9ca3af;
  text-align: center;
}

/* 카메라 영역 */

.camera-card {
  margin-top: 8px;
}

.camera-frame {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

#video {
  width: 100%;
  height: auto;
  display: block;
}

#canvas.hidden {
  display: none;
}

/* 안내 오버레이 */

.guide-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.guide-box {
  width: 70%;
  max-width: 260px;
  height: 42%;
  border-radius: 16px;
  border: 2px solid rgba(34, 197, 94, 0.9);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.5);
}

.guide-text {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #e5e7eb;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* 버튼 공통 */

.btn {
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn.primary {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #022c22;
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.6);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(22, 163, 74, 0.7);
}

.btn.secondary {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.btn.secondary:hover {
  background: rgba(15, 23, 42, 1);
}

.btn.outline {
  background: transparent;
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.btn.ghost {
  background: transparent;
  color: #9ca3af;
  border: 1px solid rgba(55, 65, 81, 0.7);
}

.btn.flat {
  background: #1e293b;
  color: #e5e7eb;
}

/* 카메라 버튼 영역 */

.camera-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.camera-actions .btn {
  flex: 1;
}

/* 결과 카드 */

.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.result-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.result-food .label,
.result-kcal .label {
  font-size: 0.8rem;
  color: #9ca3af;
}

.result-food .value {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  margin-top: 4px;
}

.kcal-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #facc15;
  margin-right: 4px;
}

.kcal-unit {
  font-size: 0.85rem;
  color: #e5e7eb;
}

.result-note {
  font-size: 0.78rem;
  color: #9ca3af;
}

/* 섭취 기록 카드 */

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.history-sub {
  font-size: 0.78rem;
  color: #9ca3af;
}

.history-list {
  list-style: none;
  margin-top: 8px;
  margin-bottom: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.9);
}

.history-item:last-child {
  border-bottom: none;
}

.history-main {
  display: flex;
  flex-direction: column;
}

.history-food {
  font-size: 0.9rem;
  font-weight: 500;
}

.history-kcal {
  font-size: 0.78rem;
  color: #facc15;
}

.history-time {
  font-size: 0.75rem;
  color: #9ca3af;
}

.history-footer {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 4px;
}

/* 링크 버튼 */

.link-btn {
  border: none;
  background: transparent;
  color: #60a5fa;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 4px 0;
}

/* PWA 설치 카드 */

.install-card .install-text {
  font-size: 0.82rem;
  color: #9ca3af;
  margin-bottom: 8px;
}

.icon-style-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.icon-style {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.9);
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-style.selected {
  border-color: #4ade80;
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.6);
}

.icon-preview {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

/* 아이콘 스타일별 대충 느낌만 */
.icon-a {
  background: linear-gradient(135deg, #0ea5e9, #22c55e);
}
.icon-b {
  background: linear-gradient(135deg, #22c55e, #166534);
}
.icon-c {
  background: radial-gradient(circle at 30% 30%, #f97316, #ec4899);
}
.icon-d {
  background: linear-gradient(135deg, #020617, #111827);
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.icon-label {
  font-size: 0.8rem;
}

/* 설치 버튼 */

.install-btn {
  width: 100%;
  margin-top: 2px;
}

/* 모달 */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 40;
}

.modal {
  width: 100%;
  max-width: 420px;
  background: #020617;
  border-radius: 18px;
  padding: 16px 16px 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.9);
}

.modal-header {
  margin-bottom: 8px;
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: #9ca3af;
}

.modal-body {
  font-size: 0.85rem;
  margin-top: 4px;
}

.modal-info {
  color: #e5e7eb;
  margin-bottom: 6px;
}

.modal-cta {
  font-size: 0.8rem;
  color: #22c55e;
  margin-bottom: 10px;
}

/* 요금제 카드 */

.plans-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.plan-card {
  background: #020617;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.9);
  padding: 8px 8px 6px;
}

.plan-card.plan-hot {
  border-color: rgba(234, 179, 8, 0.9);
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.4);
}

.plan-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.plan-name {
  font-size: 0.86rem;
  font-weight: 700;
}

.plan-price {
  font-size: 0.78rem;
  color: #facc15;
}

.plan-list {
  list-style: none;
  font-size: 0.75rem;
  color: #9ca3af;
}

.plan-list li + li {
  margin-top: 2px;
}

/* 결제 영역 */

.pay-section {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(31, 41, 55, 0.9);
}

.pay-label {
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.pay-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.btn.pay {
  font-size: 0.8rem;
  padding: 7px 6px;
}

/* 각 결제 버튼 느낌만 살짝 */

.btn.pay.kakao {
  background: #facc15;
  color: #1f2937;
}

.btn.pay.toss {
  background: #2563eb;
  color: #e5e7eb;
}

.btn.pay.card {
  background: #0f172a;
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.7);
}

.btn.pay.paypal {
  background: #0f766e;
  color: #e5e7eb;
}

.pay-selected {
  font-size: 0.78rem;
  color: #e5e7eb;
  margin-bottom: 4px;
}

.pay-note {
  font-size: 0.7rem;
  color: #9ca3af;
}

/* 모달 푸터 */

.modal-footer {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* 푸터 */

.app-footer {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(30, 64, 175, 0.8);
  font-size: 0.7rem;
  color: #9ca3af;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-sub {
  font-size: 0.68rem;
}

/* 공통 유틸 */

.hidden {
  display: none !important;
}

/* 반응형 조금 보정 */

@media (max-width: 480px) {
  .app-shell {
    border-radius: 0;
    max-width: 100%;
  }
}
