/* ========== iCado Web App Styles ========== */

:root {
  --bg-light: #FFF6EF;
  --card-white: #FFFFFF;
  --card-peach: #FEEADE;
  --accent-orange: #E8956A;
  --accent-teal: #5BB5A2;
  --text-dark: #2C2C2C;
  --text-mid: #8B8B8B;
  --text-light: #BBBBBB;
  --label-cat: #E8956A;
  --label-dog: #7DBDD9;
  --soft-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --bottom-space: calc(env(safe-area-inset-bottom, 0px) + 80px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg-light);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  justify-content: center;
}

button, input { font: inherit; }
button { border: 0; background: transparent; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ========== App Shell ========== */

.app-shell {
  width: 100%;
  display: flex;
  justify-content: center;
}

.app-frame {
  position: relative;
  width: min(100vw, 480px);
  min-height: 100vh;
  background: var(--bg-light);
  overflow: hidden;
}

.app-background {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 5%, rgba(232, 149, 106, 0.12), transparent 40%),
    radial-gradient(circle at 80% 95%, rgba(254, 234, 222, 0.3), transparent 40%);
  pointer-events: none;
}

/* ========== Screen Management ========== */

.screen {
  position: relative;
  display: none;
  min-height: 100vh;
  padding-bottom: var(--bottom-space);
}

.screen.active { display: block; }
.app-screen { background: transparent; }

.screen-body {
  position: relative;
  padding: 16px 16px var(--bottom-space);
}

.screen-body.centered {
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
}

/* ========== Top Bars ========== */

.topbar, .sub-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  background: rgba(255, 246, 239, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge, .app-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
}

.brand-copy {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-toggle, .icon-button, .back-button, .ghost-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  border-radius: 999px;
  background: var(--card-white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  font-size: 0.8rem;
  font-weight: 700;
}

.icon-button { font-size: 1.3rem; }
.back-button { font-size: 1.1rem; }

.sub-topbar h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

/* ========== Card Base ========== */

.card-base,
.hero-card, .daily-highlight, .pet-card, .promo-card,
.stat-card, .product-card, .profile-card,
.summary-card, .long-card, .detail-card,
.breed-card-single, .store-hero, .meter-card,
.daily-detail-tip-card, .daily-detail-message-card {
  background: var(--card-white);
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
}

/* ========== Upload Card ========== */

.upload-card {
  background: linear-gradient(180deg, #FFF2EA 0%, #FFF8F4 100%);
  border: 1.5px solid #FFD7C5;
  padding: 24px 20px;
  text-align: center;
}

.upload-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.upload-card > p {
  color: var(--text-mid);
  font-size: 0.9rem;
  line-height: 1.4;
}

.upload-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  margin: 20px auto 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFD6C2 0%, #FFC6AA 100%);
  box-shadow: 0 8px 24px rgba(232, 149, 106, 0.25);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.upload-circle:active { transform: scale(0.95); }

.upload-icon { font-size: 2rem; }

.upload-support {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
}

/* ========== Ad Banner Placeholder ========== */

.ad-banner-placeholder {
  width: 320px;
  height: 50px;
  margin: 16px auto;
  border-radius: 8px;
  background: #E8E8E8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #AAAAAA;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ========== Section Head ========== */

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.section-head.solo { margin-top: 24px; }

.section-head h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.section-head p,
.center-subtitle {
  margin: 0;
  color: var(--text-mid);
  font-size: 0.85rem;
  line-height: 1.4;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ========== Daily Highlight ========== */

.daily-highlight {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #FFF3EE 0%, #FFF7F2 100%);
  border: 1px solid #FFDACF;
}

.daily-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #FFF, #FFE7DB);
  font-size: 1.4rem;
  flex-shrink: 0;
}

.daily-copy { min-width: 0; }

.daily-main {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-orange);
}

.daily-sub {
  font-size: 0.85rem;
  color: var(--text-mid);
  margin-top: 2px;
}

/* ========== Pet Cards ========== */

.pet-picks, .promo-stack, .store-products, .stack-list, .detail-stack, .figure-stack {
  display: grid;
  gap: 12px;
}

.pet-card, .product-card, .profile-card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  cursor: pointer;
}

.pet-card img, .product-card img {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  object-fit: cover;
}

.pet-card-copy { min-width: 0; }

.pet-card-copy strong, .product-card strong {
  display: block;
  font-size: 0.95rem;
  margin-top: 4px;
}

.pet-card-copy p, .product-card p {
  margin: 4px 0 0;
  color: var(--text-mid);
  font-size: 0.82rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chevron {
  color: var(--text-light);
  font-size: 1.4rem;
  flex-shrink: 0;
}

/* ========== Stats Grid ========== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0 8px;
}

.stat-card {
  padding: 16px 12px;
  text-align: center;
}

.stat-laurel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.laurel {
  width: 24px;
  height: 24px;
  opacity: 0.3;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-orange);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-mid);
  margin-top: 4px;
}

/* ========== Promo Cards ========== */

.promo-card {
  position: relative;
  padding: 20px 18px 18px;
  overflow: hidden;
  color: white;
}

.promo-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.promo-card p {
  font-size: 0.85rem;
  line-height: 1.4;
  opacity: 0.9;
}

.premium-card {
  background: linear-gradient(135deg, #292829 0%, #383237 60%, #403a3d 100%);
  color: #FFF4EC;
}

.pet-card-accent {
  background: linear-gradient(135deg, #57C95F 0%, #A4EC90 50%, #9DE0C0 100%);
}

.figure-card {
  background: linear-gradient(135deg, #9F59C4 0%, #F48B74 100%);
}

.promo-heart, .promo-paws, .promo-spark {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 1.15rem;
  opacity: 0.85;
}

.soft-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  margin-top: 14px;
}

/* ========== Splash ========== */

.splash-screen {
  overflow: hidden;
  background: var(--bg-light);
}

.splash-inner {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 56px;
  text-align: center;
}

.splash-icon {
  width: 100px;
  height: 100px;
  border-radius: 28px;
  box-shadow: 0 12px 32px rgba(232, 149, 106, 0.2);
}

.tagline {
  margin: 16px 0 6px;
  font-size: 1.15rem;
  font-weight: 800;
}

.subtitle {
  color: var(--text-mid);
  font-size: 0.9rem;
}

.splash-footer {
  margin-top: auto;
  width: 100%;
}

.loading-copy {
  margin-bottom: 10px;
  color: var(--text-mid);
  font-size: 0.85rem;
  font-style: italic;
}

.meter, .ratio-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #E8E4DF;
  overflow: hidden;
}

.meter-fill {
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-orange), #F0A87C);
  border-radius: inherit;
  animation: pulseMeter 1.8s ease-in-out infinite;
}

.meter.tall { max-width: 220px; }

.paw {
  margin-top: 12px;
  color: var(--accent-orange);
  font-size: 1.2rem;
}

@keyframes pulseMeter {
  0% { width: 15%; }
  50% { width: 85%; }
  100% { width: 55%; }
}

.splash-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(50px);
  opacity: 0.35;
}

.orb-1 {
  top: 40px;
  left: 20px;
  width: 100px;
  height: 100px;
  background: rgba(232, 149, 106, 0.6);
}

.orb-2 {
  right: -20px;
  bottom: 80px;
  width: 120px;
  height: 120px;
  background: rgba(254, 234, 222, 0.8);
}

/* ========== Analyzing Screen ========== */

.analyzing-preview {
  width: 180px;
  height: 240px;
  border-radius: 20px;
  background: center/cover no-repeat #E8E4DF;
  box-shadow: var(--soft-shadow);
}

.analysis-steps {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 300px;
}

.analysis-step {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--card-white);
  box-shadow: var(--soft-shadow);
  text-align: left;
}

.analysis-step strong {
  font-size: 0.9rem;
}

.analysis-step p {
  color: var(--text-mid);
  font-size: 0.8rem;
  margin-top: 4px;
}

.analysis-step.current {
  border: 1.5px solid var(--accent-orange);
}

.analysis-step.done {
  opacity: 0.5;
}

/* ========== Result Screen ========== */

.result-screen { padding-bottom: calc(var(--bottom-space) + 20px); }

.result-photo-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: var(--soft-shadow);
}

.result-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.type-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
}

.type-badge.dog-type {
  background: var(--label-dog);
}

.type-badge.cat-type {
  background: var(--label-cat);
}

.meter-card, .summary-card, .long-card {
  margin-top: 16px;
  padding: 16px;
}

.meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.meter-head strong { font-size: 0.9rem; }
.meter-head span { font-size: 0.8rem; color: var(--text-mid); }

.ratio-bar {
  margin: 8px 0 6px;
  display: flex;
  height: 8px;
}

.ratio-cat { background: var(--label-cat); border-radius: 999px 0 0 999px; }
.ratio-dog { background: var(--label-dog); border-radius: 0 999px 999px 0; }

.ratio-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-mid);
}

.copy-block h1 {
  margin: 20px 0 8px;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.copy-block p {
  color: var(--text-mid);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Detail Cards (no scores) */

.detail-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px;
}

.detail-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.detail-icon.orange { background: var(--accent-orange); }
.detail-icon.blue { background: var(--label-dog); }
.detail-icon.purple { background: #A87CCF; }

.detail-copy strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.detail-copy p {
  color: var(--text-mid);
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 0;
}

/* Breed Card (single) */

.breed-card-single {
  display: flex;
  gap: 14px;
  padding: 14px;
  align-items: flex-start;
}

.breed-card-single img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  object-fit: cover;
  flex-shrink: 0;
}

.breed-info { min-width: 0; }

.breed-info strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 6px;
}

.breed-info p {
  color: var(--text-mid);
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0;
}

/* AI Disclaimer */

.ai-disclaimer {
  margin-top: 28px;
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.5;
  white-space: pre-line;
}

/* ========== Store Screen ========== */

.store-hero {
  padding: 20px;
  text-align: center;
}

.store-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  margin: 0 auto 12px;
}

.store-hero h2 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.store-hero p {
  color: var(--text-mid);
  font-size: 0.85rem;
  line-height: 1.4;
}

.pill-buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-orange);
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.pill-free {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-teal);
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.store-footer {
  padding: 24px 8px 0;
  text-align: center;
  color: var(--text-mid);
  font-size: 0.8rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
  flex-wrap: wrap;
  font-size: 0.8rem;
}

.footer-links a { text-decoration: underline; }

/* ========== My Page ========== */

.profile-card {
  grid-template-columns: auto 1fr auto;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--card-peach);
  font-size: 1.3rem;
}

.profile-card strong { font-size: 0.85rem; }
.profile-card p { color: var(--text-mid); font-size: 0.8rem; margin-top: 2px; }

.ghost-chip {
  padding: 0 12px;
  font-size: 0.75rem;
}

.stack-item {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--card-white);
  box-shadow: var(--soft-shadow);
}

.stack-item strong { display: block; font-size: 0.9rem; }
.stack-item span { display: block; margin-top: 4px; color: var(--text-mid); font-size: 0.8rem; }

.empty-state {
  padding: 24px;
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
}

/* ========== Daily Pet Detail ========== */

.daily-detail-photo-wrap {
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--soft-shadow);
  border: 3px solid var(--card-peach);
}

.daily-detail-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.daily-detail-name {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.daily-detail-personality {
  color: var(--text-mid);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

.daily-detail-tip-card, .daily-detail-message-card {
  padding: 16px;
  margin-bottom: 12px;
}

.daily-detail-tip-card .eyebrow,
.daily-detail-message-card .eyebrow {
  margin-bottom: 8px;
  color: var(--accent-orange);
}

.daily-detail-tip-card p,
.daily-detail-message-card p {
  color: var(--text-dark);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ========== Bottom Navigation ========== */

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100vw, 480px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 10px);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
  z-index: 6;
}

.nav-item {
  display: grid;
  justify-items: center;
  gap: 3px;
  color: var(--text-light);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 4px 0;
}

.nav-item.active { color: var(--accent-orange); }

.nav-icon { font-size: 1.2rem; }

/* ========== Toast ========== */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 90px);
  transform: translateX(-50%) translateY(12px);
  min-width: 160px;
  max-width: calc(min(100vw, 480px) - 32px);
  padding: 10px 16px;
  border-radius: var(--radius);
  background: rgba(44, 44, 44, 0.92);
  color: white;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: 160ms ease;
  z-index: 9;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== Menu Overlay ========== */

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.menu-overlay.active { display: flex; }

.menu-sheet {
  width: min(100vw, 480px);
  background: var(--card-white);
  border-radius: 16px 16px 0 0;
  padding: 8px 0 calc(env(safe-area-inset-bottom, 0px) + 8px);
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.menu-item {
  display: block;
  width: 100%;
  padding: 14px 20px;
  text-align: left;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.menu-item:active { background: #F5F5F5; }

.menu-cancel { color: var(--text-mid); }

.menu-divider {
  height: 1px;
  background: #F0F0F0;
  margin: 4px 16px;
}

/* ========== Responsive ========== */

@media (min-width: 481px) {
  .app-frame {
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
    border-left: 1px solid #F0ECE8;
    border-right: 1px solid #F0ECE8;
  }
}
