:root {
  --bg: #fffaf7;
  --surface: #ffffff;
  --surface-soft: #fff2ec;
  --text: #201a18;
  --muted: #716764;
  --line: rgba(73, 50, 42, 0.11);
  --primary: #ff6b5d;
  --primary-dark: #e85247;
  --cat: #8b78e6;
  --header: rgba(255, 250, 247, 0.82);
  --shadow: 0 28px 80px rgba(100, 55, 39, 0.12);
  --container: 1080px;
}

:root[data-theme="dark"] {
  --bg: #141110;
  --surface: #211d1b;
  --surface-soft: #2a201e;
  --text: #fff9f6;
  --muted: #bdb1ad;
  --line: rgba(255, 255, 255, 0.1);
  --primary: #ff796d;
  --primary-dark: #ff958c;
  --cat: #a493fa;
  --header: rgba(20, 17, 16, 0.82);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: color .3s ease, background-color .3s ease;
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.container { width: min(calc(100% - 40px), var(--container)); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
}
.header-inner, .footer-inner { display: flex; min-height: 58px; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 7px; font-size: 1.05rem; font-weight: 800; letter-spacing: -.04em; }
.logo span { font-size: 1.2rem; }

.theme-toggle {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 8px;
  place-items: center;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}
.theme-toggle:hover, .theme-toggle:focus-visible { background: var(--line); transform: rotate(8deg); }
.theme-toggle svg { grid-area: 1 / 1; width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: opacity .25s, transform .25s; }
.moon-icon, :root[data-theme="dark"] .sun-icon { opacity: 0; transform: scale(.6) rotate(-30deg); }
:root[data-theme="dark"] .moon-icon { opacity: 1; transform: scale(1); }

.hero { padding: clamp(72px, 9vw, 120px) 0 110px; text-align: center; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 22px; padding: 7px 13px; color: var(--primary-dark); background: var(--surface-soft); border: 1px solid rgba(255,107,93,.2); border-radius: 999px; font-size: .78rem; font-weight: 750; }
.hero-badge span { width: 7px; height: 7px; background: var(--primary); border-radius: 50%; box-shadow: 0 0 0 5px rgba(255,107,93,.13); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 22px; font-size: clamp(3rem, 7.5vw, 6.3rem); line-height: 1.02; letter-spacing: -.07em; }
h1 span { color: transparent; background: linear-gradient(90deg, var(--primary), #ff9b55 48%, var(--cat)); background-clip: text; -webkit-background-clip: text; }
.hero-copy { max-width: 600px; margin: 0 auto 48px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.2rem); letter-spacing: -.02em; }

.test-card { max-width: 820px; min-height: 490px; margin: auto; padding: clamp(20px, 4vw, 38px); background: var(--surface); border: 1px solid var(--line); border-radius: 36px; box-shadow: var(--shadow); }
.test-view { display: none; height: 100%; }
.test-view.is-active { display: block; animation: reveal .45s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.drop-zone { padding: 46px 28px 38px; background: var(--surface-soft); border: 2px dashed rgba(255,107,93,.32); border-radius: 26px; transition: border-color .2s, background .2s, transform .2s; }
.drop-zone.is-dragging { border-color: var(--primary); background: rgba(255,107,93,.11); transform: scale(1.01); }
.animal-faces { display: flex; align-items: center; justify-content: center; margin-bottom: 26px; }
.animal-face { display: grid; width: 86px; height: 86px; place-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 12px 28px rgba(70,40,30,.09); font-size: 3.2rem; }
.dog-face { transform: rotate(-6deg); }
.cat-face { transform: rotate(6deg); }
.versus { z-index: 1; margin: 0 -5px; padding: 7px 8px; color: white; background: var(--text); border: 4px solid var(--surface-soft); border-radius: 50%; font-size: .66rem; font-weight: 900; }
.drop-zone h2, #loading-view h2, #error-view h2 { margin-bottom: 9px; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.045em; }
.drop-zone p, #loading-view p, #error-view p { margin-bottom: 24px; color: var(--muted); }
.primary-button, .secondary-button { min-height: 50px; padding: 0 25px; border-radius: 999px; font-weight: 700; cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s; }
.primary-button { color: white; background: var(--primary); border: 0; box-shadow: 0 10px 24px rgba(255,107,93,.25); }
.primary-button:hover, .primary-button:focus-visible { background: var(--primary-dark); transform: translateY(-2px); }
.secondary-button { color: var(--text); background: transparent; border: 1px solid var(--line); }
.secondary-button:hover, .secondary-button:focus-visible { background: var(--surface-soft); transform: translateY(-2px); }
.file-guide { display: block; margin-top: 13px; color: var(--muted); font-size: .75rem; }
.privacy-note { margin: 18px 0 0; color: var(--muted); font-size: .8rem; }

#loading-view { padding: 26px 0 18px; }
.preview-frame { position: relative; overflow: hidden; background: var(--surface-soft); border-radius: 24px; }
.preview-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.loading-preview { width: min(280px, 70vw); aspect-ratio: 1; margin: 0 auto 25px; }
.scan-line { position: absolute; right: 0; left: 0; height: 3px; top: 0; background: linear-gradient(90deg, transparent, var(--primary), transparent); box-shadow: 0 0 14px var(--primary); animation: scan 1.7s ease-in-out infinite alternate; }
@keyframes scan { to { top: calc(100% - 3px); } }
.loader { display: flex; justify-content: center; gap: 6px; margin-bottom: 17px; }
.loader span { width: 7px; height: 7px; background: var(--primary); border-radius: 50%; animation: bounce 1s ease-in-out infinite; }
.loader span:nth-child(2) { animation-delay: .15s; }
.loader span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-7px); opacity: 1; } }

#result-view { padding: 5px; text-align: left; }
.result-grid { display: grid; grid-template-columns: minmax(230px, .85fr) 1.15fr; gap: clamp(28px, 5vw, 50px); align-items: center; }
.result-preview { aspect-ratio: 4 / 5; }
.result-kicker, .section-kicker { margin-bottom: 7px; color: var(--primary); font-size: .72rem; font-weight: 850; letter-spacing: .15em; }
.result-emoji { margin-bottom: 2px; font-size: 3rem; }
.result-content h2 { margin-bottom: 10px; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.1; letter-spacing: -.06em; }
.result-description { margin-bottom: 27px; color: var(--muted); }
.scores { margin-bottom: 28px; }
.score-item + .score-item { margin-top: 17px; }
.score-label { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: .9rem; }
.score-label strong { font-variant-numeric: tabular-nums; }
.score-track { height: 10px; overflow: hidden; background: var(--surface-soft); border-radius: 999px; }
.score-bar { display: block; width: 0; height: 100%; border-radius: inherit; transition: width 1s cubic-bezier(.2,.8,.2,1); }
.dog-bar { background: linear-gradient(90deg, #ff9b55, var(--primary)); }
.cat-bar { background: linear-gradient(90deg, #bd8eff, var(--cat)); }

#error-view { padding: 90px 20px; }
.error-icon { display: grid; width: 64px; height: 64px; margin: 0 auto 20px; place-items: center; color: white; background: var(--primary); border-radius: 50%; font-size: 1.7rem; font-weight: 900; }

.how-it-works { padding: 110px 0; background: var(--surface); text-align: center; }
.how-it-works h2 { margin-bottom: 45px; font-size: clamp(2rem, 4vw, 3.4rem); letter-spacing: -.055em; }
.step-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; text-align: left; }
.step-grid article { position: relative; padding: 30px; background: var(--bg); border: 1px solid var(--line); border-radius: 24px; }
.step-grid article > span { position: absolute; top: 22px; right: 25px; color: var(--muted); font-size: .75rem; font-weight: 800; }
.step-grid article > div { margin-bottom: 30px; font-size: 2rem; }
.step-grid h3 { margin-bottom: 8px; letter-spacing: -.03em; }
.step-grid p { margin-bottom: 0; color: var(--muted); font-size: .9rem; }
.disclaimer { margin: 34px 0 0; color: var(--muted); font-size: .78rem; }
.site-footer { padding: 28px 0; background: var(--surface); border-top: 1px solid var(--line); }
.footer-inner p { margin: 0; color: var(--muted); font-size: .78rem; }

@media (max-width: 700px) {
  .container { width: min(calc(100% - 28px), var(--container)); }
  .hero { padding: 58px 0 80px; }
  h1 { font-size: clamp(2.7rem, 14vw, 4.5rem); }
  .hero-copy { margin-bottom: 32px; }
  .test-card { min-height: 0; padding: 14px; border-radius: 26px; }
  .drop-zone { padding: 38px 16px 30px; border-radius: 20px; }
  .animal-face { width: 72px; height: 72px; border-radius: 22px; font-size: 2.7rem; }
  .result-grid, .step-grid { grid-template-columns: 1fr; }
  #result-view { padding: 0; }
  .result-preview { max-height: 390px; }
  .result-content { padding: 0 8px 10px; text-align: center; }
  .score-label { text-align: left; }
  .secondary-button { width: 100%; }
  .how-it-works { padding: 80px 0; }
  .step-grid article { text-align: center; }
  .footer-inner { flex-direction: column; justify-content: center; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
