:root {
  --bg: #f6f2ea; --card: #ffffff; --ink: #1c1917; --muted: #78716c; --line: #e7e0d4; --soft: #f1ebe0;
  --accent: #c2410c;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
fieldset { min-width: 0; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  line-height: 1.6; word-break: keep-all;
}
#app { max-width: 480px; margin: 0 auto; padding: 0 16px 40px; }
a { color: inherit; text-decoration: none; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 8px; }
.logo { font-weight: 800; letter-spacing: -0.02em; }
.crumb { font-size: 13px; color: var(--muted); }

/* 홈 */
.hero { text-align: center; padding: 36px 0 24px; }
.hero .yy { font-size: 56px; line-height: 1; animation: spin 12s linear infinite; display: inline-block; }
.hero h1 { font-size: 34px; margin: 14px 0 6px; letter-spacing: -0.04em; }
.hero p { color: var(--muted); margin: 0; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card {
  background: var(--card); border-radius: 20px; padding: 18px 16px; display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--line); position: relative; overflow: hidden; transition: transform .15s;
}
.card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.card:active { transform: scale(.97); }
.card .em { font-size: 30px; }
.card b { font-size: 16px; letter-spacing: -0.02em; }
.card small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }

/* 테스트 첫 화면 */
.intro { text-align: center; padding: 22px 0 18px; }
.intro .em { font-size: 52px; }
.intro h1 { margin: 6px 0 2px; font-size: 28px; letter-spacing: -0.04em; }
.intro p { margin: 0; color: var(--muted); }

.form { background: var(--card); border-radius: 22px; padding: 18px; border: 1px solid var(--line); display: grid; gap: 14px; scroll-margin-top: 12px; }
.who { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.who legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.row label, .hour { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
select, .name {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--soft); border: 1px solid transparent;
  border-radius: 12px; padding: 11px 10px; appearance: none; -webkit-appearance: none; min-width: 0;
}
.hour select { flex: 1; min-width: 0; }
.row select { padding-right: 4px; }
select:focus, .name:focus { outline: none; border-color: var(--ink); }

button { font: inherit; cursor: pointer; }
.go {
  width: 100%; border: 0; border-radius: 16px; padding: 16px; font-size: 17px; font-weight: 700; color: #fff;
  background: var(--c, var(--ink)); box-shadow: 0 6px 18px -8px var(--c, #000);
}
.go:active { transform: translateY(1px); }
.ghost { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 14px; font-size: 15px; font-weight: 600; color: var(--ink); }

/* 결과 */
#out { scroll-margin-top: 12px; }
.box, .friend { margin-top: 18px; }
.result { background: var(--card); border-radius: 24px; padding: 26px 20px; border: 1px solid var(--line); text-align: center; animation: pop .45s ease-out; }
.result h2 { font-size: 26px; margin: 4px 0 6px; letter-spacing: -0.04em; line-height: 1.25; }
.result .big { font-size: 72px; line-height: 1.1; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 14px; font-weight: 600; }
.who-line { margin: -6px 0 12px; font-size: 12px; color: var(--muted); }
.lead { font-size: 16px; text-align: left; margin: 14px 0; }
.tag { margin: 0; color: var(--accent); font-weight: 700; }
.sym { font-size: 15px; color: var(--muted); font-weight: 600; }
.chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.chips span { background: var(--soft); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 600; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; margin: 14px 0; }
.two > div, .rows > div { background: var(--soft); border-radius: 16px; padding: 12px 14px; }
.two h4, .rows h4 { margin: 0 0 4px; font-size: 14px; }
.two p, .rows p { margin: 0; font-size: 14px; line-height: 1.5; }
.rows { display: grid; gap: 10px; text-align: left; margin: 14px 0; }
.mate { background: #fff7ed; border: 1px dashed #fdba74; border-radius: 16px; padding: 14px; margin-top: 12px; }
.mate small { display: block; color: var(--muted); font-size: 12.5px; }
.mate b { font-size: 18px; }
.mate p { margin: 4px 0 0; font-size: 14px; }
.warn-note, .small { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; }

.pillars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 18px 0 14px; }
.pl { display: grid; gap: 6px; }
.pl small { font-size: 12px; color: var(--muted); }
.pl i {
  font-style: normal; color: #fff; border-radius: 14px; aspect-ratio: 1; display: grid; place-items: center;
  font-size: 26px; font-weight: 700; line-height: 1; position: relative; padding-top: 4px;
}
.pl i em { font-style: normal; font-size: 11px; font-weight: 600; opacity: .9; margin-top: -10px; }
.pl.me i:first-of-type { outline: 3px solid var(--ink); outline-offset: 2px; }
.pl.none i { background: var(--soft); color: var(--muted); }
.bars { display: grid; gap: 7px; margin: 6px 0 4px; }
.bar { display: grid; grid-template-columns: 54px 1fr 18px; align-items: center; gap: 8px; font-size: 13.5px; }
.bar > div { background: var(--soft); border-radius: 99px; height: 12px; overflow: hidden; }
.bar b { display: block; height: 100%; border-radius: 99px; transition: width .8s; }
.lucky { text-align: left; background: var(--soft); border-radius: 16px; padding: 14px; margin-top: 12px; }
.lucky h4 { margin: 0 0 4px; }
.lucky p { margin: 0 0 10px; font-size: 14px; }
.lucky ul, .pills { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lucky li, .pills li { background: var(--card); border-radius: 12px; padding: 8px; text-align: center; font-weight: 700; font-size: 14px; }
.pills li { background: var(--soft); }
.lucky li small, .pills li small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }

.score { position: relative; width: 132px; height: 132px; margin: 6px auto 10px; }
.score svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score circle { fill: none; stroke-width: 11; stroke-linecap: round; }
.score .bg { stroke: var(--soft); }
.score .fg { stroke: #2f74e8; animation: draw 1s ease-out; }
.score.love .fg { stroke: #ef4b7a; }
.score b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 40px; letter-spacing: -0.04em; }
.score small { position: absolute; left: 0; right: 0; bottom: 30px; font-size: 12px; color: var(--muted); }
.why { list-style: none; padding: 0; margin: 12px 0; text-align: left; display: grid; gap: 8px; }
.why li { background: var(--soft); border-radius: 12px; padding: 10px 12px 10px 34px; font-size: 14px; position: relative; }
.why li::before { position: absolute; left: 12px; top: 9px; font-weight: 800; }
.why .plus::before { content: '+'; color: #16a34a; }
.why .minus::before { content: '−'; color: #dc2626; }

.sets { display: grid; gap: 10px; margin: 16px 0; }
.set { display: flex; align-items: center; justify-content: center; gap: 6px; }
.set small { width: 16px; color: var(--muted); font-weight: 700; }
.ball {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25); box-shadow: inset -3px -4px 0 rgba(0, 0, 0, .12); animation: pop .4s ease-out backwards;
}
.set .ball:nth-child(3) { animation-delay: .05s; } .set .ball:nth-child(4) { animation-delay: .1s; }
.set .ball:nth-child(5) { animation-delay: .15s; } .set .ball:nth-child(6) { animation-delay: .2s; } .set .ball:nth-child(7) { animation-delay: .25s; }

.actions { display: grid; gap: 10px; margin-top: 12px; }
.friend { border: 2px solid var(--ink); }
.badge { display: inline-block; background: var(--ink); color: #fff; border-radius: 99px; padding: 3px 12px; font-size: 12.5px; font-weight: 700; margin: 0 0 8px; }
.cta { display: inline-block; margin-top: 4px; font-weight: 700; border-bottom: 2px solid var(--ink); }

.loading { text-align: center; padding: 40px 0; }
.loading .spin { font-size: 52px; display: inline-block; animation: spin 1s linear infinite; }
.loading p { color: var(--muted); }

.others { margin-top: 32px; }
.others h3 { font-size: 18px; margin: 0 0 12px; }
.ad { margin: 28px auto; max-width: 100%; overflow: hidden; text-align: center; }
.ad:empty { display: none; }
footer { margin-top: 36px; text-align: center; color: var(--muted); font-size: 12px; }
footer p { margin: 4px 0; }
footer .foot-links a { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 18px;
  border-radius: 14px; font-size: 14px; opacity: 0; transition: .25s; z-index: 10; width: max-content; max-width: calc(100% - 32px);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes draw { from { stroke-dasharray: 0 999; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* 정보 페이지 (일주·십신·띠궁합 등) */
.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.crumbs a { text-decoration: underline; text-underline-offset: 2px; }
.doc { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 24px 20px; }
.doc h1 { font-size: 25px; line-height: 1.3; letter-spacing: -0.04em; margin: 0 0 6px; }
.doc h2 { font-size: 18px; letter-spacing: -0.03em; margin: 26px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.doc p, .doc li { font-size: 15.5px; }
.doc .sub { color: var(--accent); font-weight: 700; margin: 0 0 10px; font-size: 14px; }
.doc .lead { font-size: 16.5px; text-align: left; }
.doc .tags { color: var(--muted); font-weight: 600; }
.doc ul { padding-left: 18px; }
.doc a { color: var(--accent); }
.doc .links { display: flex; flex-wrap: wrap; gap: 6px; }
.doc .links a, .cards a { background: var(--soft); color: var(--ink); border-radius: 10px; padding: 5px 10px; font-size: 14px; }
.doc .note { background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.doc .more { font-size: 14px; }
.doc h3 { font-size: 16px; margin: 16px 0 4px; }
.doc .dream-q { margin: 6px 0 4px; }
.doc .links a[hidden] { display: none; }
.cards { list-style: none; padding: 0 !important; display: grid; gap: 8px; }
.cards a { display: block; padding: 12px 14px; font-size: 15px; }
.meter { background: var(--soft); border-radius: 99px; height: 12px; overflow: hidden; }
.meter b { display: block; height: 100%; background: linear-gradient(90deg, #f5a524, #ef4b7a); border-radius: 99px; }
.ttable { overflow-x: auto; margin: 0 -8px; }
.ttable table { border-collapse: collapse; font-size: 12px; min-width: 100%; }
.ttable th, .ttable td { padding: 6px 4px; text-align: center; white-space: nowrap; }
.ttable td a { color: var(--ink); font-weight: 700; display: block; border-radius: 6px; }
.ttable .s9 a { background: #fde2e8; } .ttable .s8 a { background: #fef0d6; } .ttable .s7 a { background: #eef2f6; }
.ttable .s5 a { background: #e6e1d8; } .ttable .s6 a { background: #e6e1d8; }
.cta-box { margin-top: 16px; background: var(--ink); color: #fff; border-radius: 22px; padding: 20px; text-align: center; }
.cta-box p { margin: 4px 0 12px; color: #d6d3d1; font-size: 14px; }
.cta-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cta-links a { background: #fff; color: var(--ink); border-radius: 12px; padding: 10px; font-weight: 700; font-size: 14px; }
.hubs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 28px; font-size: 13px; }
.hubs a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }


/* ---------------------------------------------------------------- 새 테스트 */
.gender { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gender label { position: relative; }
.gender input { position: absolute; opacity: 0; }
.gender span { display: block; text-align: center; padding: 11px; border-radius: 12px; background: var(--soft); font-weight: 600; color: var(--muted); cursor: pointer; }
.gender input:checked + span { background: var(--ink); color: #fff; }
.hl { background: linear-gradient(transparent 60%, #fde68a 60%); padding: 0 2px; }
.result .note { background: #fffbeb; border-radius: 12px; padding: 10px 12px; font-size: 14px; text-align: left; }
.chart { width: 100%; height: auto; margin: 8px 0 4px; overflow: visible; }
.chart .grid-l { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .ax { font-size: 11px; text-anchor: middle; fill: var(--muted); }
.chart .ax.on { fill: var(--ink); font-weight: 800; }
.chart .crown { font-size: 14px; text-anchor: middle; }
.chart .line { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: dash 1.4s ease-out forwards; }
@keyframes dash { to { stroke-dashoffset: 0; } }
.dw { display: grid; gap: 8px; margin-top: 14px; text-align: left; }
.dw-row { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; background: var(--soft); border-radius: 14px; padding: 12px; }
.dw-row.now { background: #e0f2fe; outline: 2px solid #0ea5e9; }
.dw-age { font-weight: 800; font-size: 15px; }
.dw-age small { font-weight: 500; color: var(--muted); }
.dw-body b { display: block; font-size: 15px; }
.dw-body small { color: var(--muted); font-size: 12px; }
.dw-body p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; }
.mini { height: 6px; background: #fff; border-radius: 99px; margin-top: 6px; overflow: hidden; }
.mini i { display: block; height: 100%; border-radius: 99px; }
.mbars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; align-items: end; height: 170px; margin: 14px 0 6px; }
.mb { display: flex; flex-direction: column; align-items: center; height: 100%; }
.mb > div { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.mb i { display: block; width: 100%; background: #bbf7d0; border-radius: 6px 6px 3px 3px; animation: grow .8s ease-out; transform-origin: bottom; }
.mb.best i { background: #16a34a; } .mb.worst i { background: #fca5a5; } .mb.now i { outline: 2px solid var(--ink); }
.mb .v { font-size: 10.5px; color: var(--muted); }
.mb .m { font-size: 11px; margin-top: 4px; font-weight: 600; }
@keyframes grow { from { transform: scaleY(0); } }
.months { display: grid; gap: 6px; text-align: left; margin-top: 12px; }
.mrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) 34px; gap: 8px; align-items: center; background: var(--soft); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.mrow.now { outline: 2px solid #16a34a; }
.mrow em { font-style: normal; font-weight: 800; text-align: right; }
.level { display: flex; justify-content: center; gap: 8px; margin: 8px 0; font-size: 26px; }
.level span { filter: grayscale(1); opacity: .35; }
.level span.on { filter: none; opacity: 1; }
.cnt { float: right; color: var(--accent); }
.tris { display: grid; gap: 12px; margin: 14px 0; }
.tri { background: var(--soft); border-radius: 16px; padding: 14px 8px; }
.tri-names, .tri-row { display: flex; justify-content: center; gap: 6px; }
.tri-names span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; font-weight: 800; color: #fff; background: #f97316; }
.tri-names span.b { background: #8b5cf6; }
.tri-row { margin-top: 4px; animation: pop .35s ease-out backwards; }
.tri-row span { width: 30px; text-align: center; font-weight: 700; font-size: 15px; }
.tri-row:last-of-type span { color: #f97316; font-size: 20px; }
.tri-pct { margin-top: 8px; font-size: 14px; color: var(--muted); }
.tri-pct b { color: var(--ink); font-size: 18px; }
.more-links { margin-top: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.more-links h4 { width: 100%; margin: 0 0 4px; font-size: 14px; }
.more-links a + h4, .more-links p + h4 { margin-top: 8px; }
.more-links a { background: var(--soft); border-radius: 10px; padding: 7px 11px; font-size: 13.5px; font-weight: 600; }
.more-links p { width: 100%; margin: 0; font-size: 13px; color: var(--muted); }
.more-links small { font-weight: 400; opacity: .7; }

.cal { display: flex; align-items: center; gap: 6px; }
.cal label { position: relative; }
.cal input[type=radio] { position: absolute; opacity: 0; }
.cal span { display: block; padding: 7px 14px; border-radius: 99px; background: var(--soft); font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.cal input:checked + span { background: var(--ink); color: #fff; }
.cal .leap { margin-left: auto; font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.cal .leap[hidden] { display: none; }
.cal .leap input { width: 18px; height: 18px; accent-color: var(--ink); }

.capturing, .capturing * { animation: none !important; transition: none !important; }
.capturing .line { stroke-dashoffset: 0 !important; }
.watermark { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 13px; font-weight: 800; color: var(--muted); }
.actions button:disabled { opacity: .6; }

/* ---------------------------------------------------------------- PC·태블릿 */
.placeholder { display: none; }
@media (min-width: 760px) {
  #app { max-width: 1040px; padding: 0 32px 56px; }
  .top { padding: 22px 0 10px; }
  .hero { padding: 64px 0 40px; }
  .hero h1 { font-size: 48px; }
  .hero p { font-size: 18px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .card { padding: 24px 22px; }
  .card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px -16px rgba(0, 0, 0, .25); }
  .card .em { font-size: 38px; }
  .card b { font-size: 18px; }
  .card small { font-size: 14px; }

  .intro { padding: 36px 0 28px; }
  .intro h1 { font-size: 36px; }
  .friend { max-width: 640px; margin: 0 auto 24px; }
  .stage { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 28px; align-items: start; }
  .stage .form { position: sticky; top: 20px; }
  .stage #out .box { margin-top: 0; }
  .placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
    min-height: 420px; border: 2px dashed var(--line); border-radius: 24px; color: var(--muted);
  }
  .placeholder p { margin: 0; }
  .pillars, .bars { max-width: 460px; margin-left: auto; margin-right: auto; }
  .pl i { font-size: 30px; }
  .placeholder .em { font-size: 56px; opacity: .5; }
  .result { padding: 36px 40px; }
  .result h2 { font-size: 32px; }
  .actions { grid-template-columns: 1fr 1fr; }
  .others { margin-top: 48px; }

  .page-doc #app { max-width: 760px; }
  .doc { padding: 40px 48px; }
  .doc h1 { font-size: 32px; }
  .cta-links { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ttable table { font-size: 13.5px; }
}
.ttable .ytable td { white-space: normal; text-align: left; vertical-align: top; padding: 8px 6px; font-size: 14px; border-top: 1px solid var(--soft); }
.ttable .ytable td:first-child { white-space: nowrap; font-weight: 700; }
.ytabs { display: flex; gap: 6px; justify-content: center; margin: 0 0 10px; }
.ytabs button { border: 1px solid var(--soft); background: #fff; color: var(--muted); border-radius: 999px; padding: 6px 16px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.ytabs button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.result h4.sec { margin: 18px 0 8px; font-size: 15px; text-align: left; }
.pl-sub { font-size: 12px; font-weight: 600; color: var(--ink); background: var(--soft); border-radius: 8px; padding: 3px 0; text-align: center; }
.pl.none .pl-sub { color: var(--muted); font-weight: 400; }
.dw-body small a { color: inherit; text-decoration: underline; }
