/* 이름 궁합 — 학교 공책 뒷장처럼
   Layout: 모눈 무늬 바닥 위에 마스킹테이프로 붙인 종이 한 장. 연필 글씨(Gaegu)로 획수 피라미드를 한 줄씩 적어 내려가고,
   결과는 형광펜 숫자와 구간 카드(--c 색). 한 가지 모습으로 고정 */
:root {
  color-scheme: light;
  --bg: #FFF9F0;       /* 공책 바닥 */
  --grid: #E9E1F5;     /* 모눈 선 */
  --paper: #FFFFFF;
  --ink: #2E2A3A;      /* 연필 */
  --muted: #7B7590;
  --line: #EFE7F7;
  --pink: #FF5C8A;     /* 형광펜·버튼 */
  --pink-deep: #D93A6A;
  --hl: #FFF07A;       /* 노란 형광펜 */
  --a: #3A6FE0;        /* 내 이름 글자 */
  --b: #E2457A;        /* 상대 이름 글자 */
  --f-hand: "Gaegu", "Gowun Dodum", cursive;
  --f-display: "Jua", "Gowun Dodum", sans-serif;
  --f-body: "Gowun Dodum", "Apple SD Gothic Neo", sans-serif;
}
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; overflow-x: clip;
  padding-inline: 16px; padding-block: 16px 40px; background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 22px 22px; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.note-wrap { max-width: 460px; margin: 0 auto; display: grid; gap: 18px; }
.tohub { justify-self: start; font-size: 14px; color: var(--muted); text-decoration: none; background: var(--bg); padding: 0 4px; }
.paper { position: relative; background: var(--paper); border-radius: 6px; padding: 30px 18px 22px; display: grid; gap: 16px;
  box-shadow: 0 1px 0 #EDE6F5, 0 10px 24px rgba(46, 42, 58, .08); transform: rotate(-.6deg); }
#v-res > .paper { transform: rotate(.4deg); }
.tape { position: absolute; top: -12px; left: 50%; width: 110px; height: 26px; margin: 0 0 0 -55px; background: rgba(255, 176, 200, .65); transform: rotate(-3deg); border-radius: 2px; }
.title { margin: 0; text-align: center; font-family: var(--f-hand); font-weight: 700; line-height: 1; }
.title .t1 { display: block; font-size: 28px; color: var(--muted); }
.title .t2 { display: inline-block; font-size: clamp(60px, 18vw, 76px); background: linear-gradient(transparent 58%, var(--hl) 58% 90%, transparent 90%); padding: 0 6px; }
.hook { margin: 0; text-align: center; color: var(--muted); text-wrap: balance; }
.form { display: grid; gap: 10px; }
.field { display: grid; gap: 4px; }
.field span { font-family: var(--f-display); font-size: 15px; }
.field input { width: 100%; border: 0; border-bottom: 3px solid var(--line); background: transparent; padding: 6px 4px; font-family: var(--f-hand); font-weight: 700; font-size: 32px; text-align: center; border-radius: 0; }
.field input::placeholder { color: #CFC8DC; font-weight: 400; }
.field input:focus { outline: none; border-bottom-color: var(--pink); }
.heart { justify-self: center; color: var(--pink); font-size: 26px; line-height: 1; animation: beat 1.2s ease-in-out infinite; }
@keyframes beat { 15% { transform: scale(1.25); } 30% { transform: scale(1); } }
.err { margin: 0; text-align: center; color: var(--pink-deep); font-family: var(--f-display); }
.btn { appearance: none; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; width: 100%;
  min-height: 56px; padding: 12px 18px; border-radius: 999px; background: var(--pink); color: #fff; font-family: var(--f-display); font-size: 20px; box-shadow: 0 6px 0 var(--pink-deep); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--pink-deep); }
.btn.ghost { background: var(--paper); color: var(--ink); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); font-size: 18px; }
.actions { display: grid; gap: 10px; }
.privacy { margin: 0; font-size: 13.5px; color: var(--muted); background: #FBF8FF; border-radius: 10px; padding: 10px 12px; }
.privacy b { color: var(--ink); }
.how { font-size: 14px; color: var(--muted); }
.how summary { cursor: pointer; font-family: var(--f-display); color: var(--ink); }
.how p { margin: 6px 0 0; }

/* 피라미드 */
.who { margin: 0; text-align: center; font-family: var(--f-hand); font-weight: 700; font-size: 30px; }
.pyr { --s: 34px; display: grid; gap: 6px; justify-items: center; padding: 6px 0; }
.prow { display: flex; gap: 4px; transition: opacity .3s, transform .3s; }
.prow.wait { opacity: 0; transform: translateY(-6px); }
.cell { width: var(--s); display: grid; justify-items: center; font-family: var(--f-hand); font-weight: 700; line-height: 1.1; }
.cell i { font-style: normal; font-size: calc(var(--s) * .62); }
.cell i.a { color: var(--a); }
.cell i.b { color: var(--b); }
.cell b { font-size: calc(var(--s) * .72); }
.prow.last .cell b { font-size: calc(var(--s) * 1.3); color: var(--pink-deep); background: linear-gradient(transparent 50%, var(--hl) 50%); padding: 0 4px; }
.pyr.done { --s: 26px; opacity: .85; }
.calcmsg { margin: 0; text-align: center; font-family: var(--f-display); font-size: 22px; min-height: 1.6em; }

/* 결과 */
.band { --c: var(--pink); display: grid; gap: 10px; text-align: center; }
.big { margin: 0; }
.pct { display: inline-block; font-family: var(--f-hand); font-weight: 700; font-size: 64px; line-height: 1; }
.pct.num { font-size: clamp(84px, 26vw, 112px); color: var(--c); background: linear-gradient(transparent 60%, var(--hl) 60% 92%, transparent 92%); padding: 0 8px; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { from { transform: scale(.4) rotate(-8deg); opacity: 0; } }
.bname { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: clamp(28px, 8vw, 34px); color: var(--c); line-height: 1.2; }
.bline { margin: 0; font-family: var(--f-hand); font-weight: 700; font-size: 24px; }
.bsum { margin: 0; text-align: left; }
.memo { text-align: left; background: #FFFBEA; border-left: 4px solid var(--c); border-radius: 4px; padding: 10px 14px; }
.memo b { font-family: var(--f-display); font-weight: 400; }
.memo p { margin: 4px 0 0; }
.rev { margin: 0; text-align: center; font-family: var(--f-hand); font-weight: 700; font-size: 21px; color: var(--muted); }
.kick { margin: 0; text-align: center; font-family: var(--f-display); color: var(--muted); }
.ribbon { justify-self: center; margin: 0; padding: 4px 14px; border-radius: 99px; background: var(--pink); color: #fff; font-size: 14px; }
.sec { margin: 6px 0 0; text-align: center; font-family: var(--f-display); font-weight: 400; font-size: 20px; }
.ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ladder a { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; align-items: center; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 2px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.ladder .rng { font-family: var(--f-hand); font-weight: 700; font-size: 20px; color: var(--c); }
.ladder li.on a { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); }
.sharebox { width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 10px; font: inherit; font-size: 14px; resize: none; background: #fff; }
.ad { border: 2px dashed var(--line); border-radius: 12px; min-height: 90px; display: grid; place-items: center; font-size: 12px; letter-spacing: .1em; color: #B8B0C8; background: var(--paper); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 99px; padding: 10px 18px; font-size: 14px; z-index: 5; max-width: calc(100% - 32px); text-align: center; }
.foot { max-width: 460px; margin: 22px auto 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.foot a { color: inherit; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
