/* 보키 스타일 — 간격은 8px 단위로 맞춤 */
@font-face { font-family: 'Fredoka'; font-weight: 500; font-display: swap; src: url('../fonts/fredoka-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: swap; src: url('../fonts/fredoka-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 500; font-display: swap; src: url('../fonts/nunito-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 700; font-display: swap; src: url('../fonts/nunito-latin-700-normal.woff2') format('woff2'); }

:root {
  --bg: #FFF8F0;
  --card: #FFFFFF;
  --ink: #4B3A35;
  --ink-soft: #85726B;
  --line: #EFE3D6;
  --accent: #F2876B;
  --accent-dark: #DB6E52;
  --accent-soft: #FDE3DA;
  --radius: 24px;
  --gap: 24px;
  --display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.55;
  text-wrap: pretty;
}
h1, h2, p { margin: 0; }
a { color: inherit; }

.app {
  max-width: 440px;
  margin: 0 auto;
  padding: 24px 24px calc(32px + env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* 화면 전환 */
.screen { display: none; flex-direction: column; align-items: center; text-align: center; gap: var(--gap); flex: 1; }
.screen.is-active { display: flex; animation: fade-in .35s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 로고 */
.brand { display: flex; align-items: center; justify-content: center; gap: 8px; }
.brand-mark { width: 24px; height: 28px; background: url('../favicon.svg') center / contain no-repeat; }
.brand-name { font-family: var(--display); font-weight: 600; font-size: 24px; letter-spacing: .5px; }

/* 글자 */
.title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.2;
  text-wrap: balance;
}
.lead { color: var(--ink-soft); font-size: 17px; text-wrap: balance; }
.lead strong { color: var(--ink); }
.fine { color: var(--ink-soft); font-size: 13px; text-wrap: balance; }
.section-title { font-family: var(--display); font-weight: 600; font-size: 20px; }
.kicker { font-family: var(--display); font-weight: 500; font-size: 16px; color: var(--accent-dark); letter-spacing: .5px; }

/* 알 */
.egg-stage, .hatch-stage { position: relative; width: 200px; height: 200px; }
.egg { width: 100%; height: 100%; }
.egg svg, .pet svg { display: block; width: 100%; height: 100%; }
.wobble { animation: wobble 2.4s ease-in-out infinite; transform-origin: 50% 92%; }
@keyframes wobble {
  0%, 60%, 100% { transform: rotate(0); }
  68% { transform: rotate(-6deg); }
  76% { transform: rotate(5deg); }
  84% { transform: rotate(-3deg); }
  92% { transform: rotate(1deg); }
}

/* 버튼 */
.btn {
  appearance: none;
  border: 0;
  width: 100%;
  min-height: 56px;
  padding: 0 24px;
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 0 var(--accent-dark); }
.btn-primary:active { box-shadow: 0 2px 0 var(--accent-dark); transform: translateY(2px); }
.btn-secondary { background: var(--card); color: var(--ink); border: 2px solid var(--line); }
.btn-secondary:disabled { color: var(--ink-soft); cursor: default; }
.btn-secondary:disabled:active { transform: none; }
.btn-text { background: none; color: var(--ink-soft); min-height: 48px; font-size: 16px; }
.soon { font-size: 12px; background: var(--accent-soft); color: var(--accent-dark); padding: 2px 8px; border-radius: 999px; }
.btn:focus-visible, select:focus-visible, input:focus-visible, .back:focus-visible { outline: 3px solid #7FB3E0; outline-offset: 2px; }

/* 펫 라인업 */
.lineup { width: 100%; display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.lineup-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.lineup-grid .mini { background: var(--card); border-radius: 16px; aspect-ratio: 1; padding: 4px; }
.lineup-grid .mini svg { display: block; width: 100%; height: 100%; }

/* 입력 */
.back {
  align-self: flex-start;
  width: 44px; height: 44px;
  margin: -4px 0 -8px -8px;
  border: 0; background: none; color: var(--ink);
  display: grid; place-items: center;
  border-radius: 999px; cursor: pointer;
}
.form { width: 100%; display: flex; flex-direction: column; gap: 24px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-weight: 700; font-size: 15px; }
.optional { font-weight: 500; color: var(--ink-soft); font-size: 13px; margin-left: 4px; }
.date-row { display: grid; grid-template-columns: 1.3fr 1fr 1.2fr; gap: 8px; }
select, input[type="time"], input[type="text"] {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  font: 500 16px var(--body);
  appearance: none;
  -webkit-appearance: none;
}
select {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2385726B' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
}
input[type="time"] { display: block; }
input:disabled { opacity: .45; }
input::placeholder { color: #B5A69F; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; min-height: 32px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.hint { color: var(--ink-soft); font-size: 13px; }
.error { color: var(--accent-dark); font-weight: 700; font-size: 14px; text-align: center; min-height: 0; }
.error:empty { display: none; }

/* 탄생 연출 */
#screen-hatch { justify-content: center; }
.shake { animation: shake .5s ease-in-out infinite; transform-origin: 50% 92%; }
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-7deg); }
  75% { transform: rotate(7deg); }
}
.crack { position: absolute; inset: 0; opacity: 0; }
.hatch-stage.cracked .crack { opacity: 1; transition: opacity .15s; }
.hatch-stage.cracked .egg { animation: shake .18s ease-in-out infinite; }
.hatch-text { font-family: var(--display); font-weight: 500; font-size: 20px; }

/* 결과 */
.pet-stage {
  width: 240px; height: 240px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft);
}
.pet { width: 200px; height: 200px; }
.pop { animation: pop .6s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.pet-name { font-family: var(--display); font-weight: 600; font-size: 34px; line-height: 1.1; margin-top: -8px; }
.pet-tagline { color: var(--ink-soft); font-size: 17px; margin-top: -16px; text-wrap: balance; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: -8px; }
.chip { font-size: 14px; font-weight: 700; padding: 6px 14px; border-radius: 999px; background: var(--card); border: 2px solid var(--line); }

.card {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  text-align: left;
  display: flex; flex-direction: column; gap: 16px;
}
.card-title { font-family: var(--display); font-weight: 600; font-size: 19px; }
.about { font-size: 16px; }
.note { font-size: 15px; color: var(--ink-soft); }

.bars { display: flex; flex-direction: column; gap: 12px; }
.bar { display: grid; grid-template-columns: 56px 1fr 40px; align-items: center; gap: 12px; font-size: 14px; font-weight: 700; }
.bar-track { height: 12px; background: #F6EFE7; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; width: 0; transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.bar-value { text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.strengths { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.strengths li { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.strengths li::before { content: ''; width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 12.5l3.2 3L17 9' fill='none' stroke='%23DB6E52' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 24px no-repeat; }
.watch { background: #FBF6F0; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.watch-label { font-size: 13px; font-weight: 700; color: var(--accent-dark); text-transform: uppercase; letter-spacing: .8px; }
.watch p { font-size: 15px; }

.actions { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.app-soon { width: 100%; border: 2px dashed var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.app-soon p { color: var(--ink-soft); font-size: 15px; text-wrap: balance; }

/* 바닥글 */
.footer { margin-top: 40px; text-align: center; color: var(--ink-soft); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.footer a { color: var(--ink-soft); }

/* 공유 모달 */
.modal { position: fixed; inset: 0; background: rgba(75, 58, 53, .45); display: grid; place-items: center; padding: 24px; z-index: 10; }
.modal[hidden] { display: none; }
.modal-box { width: 100%; max-width: 360px; max-height: calc(100dvh - 48px); overflow: auto; background: var(--bg); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.modal-box img { width: 100%; max-width: 220px; border-radius: 16px; box-shadow: 0 4px 16px rgba(75, 58, 53, .12); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
