:root {
  --bg: #f3efe6;
  --paper: #fbf9f4;
  --ink: #1d1b17;
  --ink2: #5d584e;
  --ink3: #8f897c;
  --line: #d9d2c3;
  --wall: #1d1b17;
  --off: #d3ccbc;
  --me: #e5432a;
  --me-soft: #f6d3c9;
  --nt: #7a5fd0;
  --nf: #2f9a6b;
  --sj: #2c7bc9;
  --sp: #d6931a;
  --nodata: #e6e0d2;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15140f;
    --paper: #1e1c16;
    --ink: #f1ede2;
    --ink2: #b5ae9f;
    --ink3: #857f72;
    --line: #38342a;
    --wall: #f1ede2;
    --off: #45413a;
    --me: #ff5a3d;
    --me-soft: #5a2418;
    --nt: #9c86ee;
    --nf: #4dbb8a;
    --sj: #5aa2e8;
    --sp: #e8ad3c;
    --nodata: #2a2720;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}
button, select { font: inherit; color: inherit; }
.num, .big, .pct, .bars, .cards b, .tops, .legend, .ratio, .indep { font-variant-numeric: tabular-nums; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px max(16px, calc((100vw - 1040px) / 2));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand i { width: 12px; height: 12px; border-radius: 50%; background: var(--me); }
.top nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.top nav::-webkit-scrollbar { display: none; }
.top nav a { padding: 4px 10px; border-radius: 99px; color: var(--ink2); text-decoration: none; font-size: 14px; white-space: nowrap; }
.top nav a:hover { background: var(--paper); color: var(--ink); }

main { max-width: 1040px; margin: 0 auto; padding: 0 16px 96px; }
section { padding-top: 88px; }
h1 { font-size: clamp(30px, 5.4vw, 58px); line-height: 1.18; letter-spacing: -0.035em; font-weight: 800; margin: 0 0 36px; text-wrap: balance; }
h1 em { font-style: normal; color: var(--me); }
h2 { font-size: clamp(24px, 3.4vw, 36px); line-height: 1.25; letter-spacing: -0.03em; font-weight: 800; margin: 0 0 10px; text-wrap: balance; }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 10px; color: var(--ink2); }
h3.sub { font-size: 21px; color: var(--ink); letter-spacing: -0.02em; margin: 56px 0 8px; }
.lead { max-width: 62ch; color: var(--ink2); margin: 0 0 28px; }
.lead b { color: var(--ink); }
.eyebrow { font-size: 14px; font-weight: 600; color: var(--ink3); letter-spacing: 0.02em; margin: 0 0 18px; }

.hero { padding-top: 64px; }
.picker { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 24px 40px; }
.letters { display: grid; grid-template-columns: repeat(4, auto); gap: 10px; }
.pair { display: grid; gap: 6px; }
.pair button {
  width: 76px; padding: 8px 0 6px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper);
  cursor: pointer; display: grid; justify-items: center; line-height: 1.1; transition: background .15s, border-color .15s, color .15s;
}
.pair button b { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.pair button span { font-size: 12px; color: var(--ink3); }
.pair button:hover { border-color: var(--ink3); }
.pair button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pair button[aria-pressed="true"] span { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.country { display: grid; gap: 6px; font-size: 13px; color: var(--ink3); }
.country select {
  appearance: none; min-width: 220px; padding: 12px 40px 12px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238f897c' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center;
  font-size: 17px; font-weight: 600; color: var(--ink); cursor: pointer;
}
button:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--me); outline-offset: 2px; }

/* ---- 방 ---- */
.room-sec { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 40px; align-items: start; padding-top: 56px; }
.answer { position: sticky; top: 84px; }
.big { display: flex; align-items: baseline; gap: 6px; line-height: 1; color: var(--me); }
.big b { font-size: clamp(96px, 15vw, 168px); font-weight: 800; letter-spacing: -0.06em; }
.big span { font-size: 34px; font-weight: 800; }
#ans-line { margin: 14px 0 0; color: var(--ink2); }
#ans-line b { color: var(--ink); }

.plan-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.plan-name { font-size: 14px; font-weight: 700; color: var(--ink2); }
.seg { display: inline-flex; padding: 3px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 5px 14px; border-radius: 99px; font-size: 14px; color: var(--ink2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 600; }

.floor {
  position: relative; background: var(--paper);
  border: 5px solid var(--wall); border-radius: 3px;
  padding: clamp(12px, 3vw, 28px);
}
/* 문: 벽을 끊고 여닫이 호를 그린다 */
.floor::before { content: ""; position: absolute; left: 44px; bottom: -5px; width: 56px; height: 5px; background: var(--bg); }
.grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: clamp(4px, 1.6vw, 18px) clamp(3px, 1.2vw, 14px); }
.p { all: unset; display: block; aspect-ratio: 1; cursor: pointer; border-radius: 6px; position: relative; -webkit-tap-highlight-color: transparent; }
.p svg { display: block; width: 100%; height: 100%; overflow: visible; }
.p .body { fill: var(--off); transition: fill .25s; }
.p .head { fill: var(--off); stroke: var(--paper); stroke-width: 1.6; transition: fill .25s; }
.p.me .body, .p.me .head { fill: var(--me); }
.p.sel .body, .p.sel .head { fill: var(--ink2); }
.p.me.sel .body, .p.me.sel .head { fill: var(--me); }
.p:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.p.pop { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes pop { from { transform: scale(.4); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .p.pop { animation: none; } html { scroll-behavior: auto; } }

.rows { display: grid; gap: 6px; }
.row { display: grid; grid-template-columns: 52px 30px 1fr; align-items: center; gap: 6px; }
.row .code { font-weight: 700; font-size: 14px; letter-spacing: 0.02em; color: var(--ink2); }
.row .cnt { font-size: 14px; color: var(--ink3); text-align: right; }
.row.me .code, .row.me .cnt { color: var(--me); }
.row .ppl { display: flex; flex-wrap: wrap; gap: 2px; min-height: 22px; }
.row .p { width: clamp(18px, 3.6vw, 26px); }
.row .none { font-size: 13px; color: var(--ink3); }
.g-nt .body, .g-nt .head { fill: var(--nt); }
.g-nf .body, .g-nf .head { fill: var(--nf); }
.g-sj .body, .g-sj .head { fill: var(--sj); }
.g-sp .body, .g-sp .head { fill: var(--sp); }
.rows .p:not(.me):not(.sel) .body, .rows .p:not(.me):not(.sel) .head { opacity: .5; }
.rows .p.me .body, .rows .p.me .head { fill: var(--me); }
.peek { min-height: 1.65em; margin: 12px 0 0; font-size: 14px; color: var(--ink3); }
.peek b { color: var(--ink); }

/* ---- 일상 ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 20px 20px 18px; }
.card .where { font-size: 14px; font-weight: 600; color: var(--ink3); margin: 0 0 8px; }
.card b { display: block; font-size: 38px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; }
.card b small { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin-left: 2px; }
.card p { margin: 8px 0 0; font-size: 15px; color: var(--ink2); line-height: 1.5; }

/* ---- 막대 ---- */
.bars { display: grid; gap: 7px; }
.bar { display: grid; grid-template-columns: 52px 1fr 56px; align-items: center; gap: 10px; }
.bar .code { font-weight: 700; font-size: 14px; letter-spacing: 0.02em; color: var(--ink2); }
.bar .track { position: relative; height: 22px; }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--off); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.bar .pct { font-size: 14px; color: var(--ink2); text-align: right; }
.bar.me .code, .bar.me .pct { color: var(--me); font-weight: 700; }
.bar.me .fill { background: var(--me); }
.bars.two .track { height: 26px; }
.bars.two .fill { height: 12px; bottom: auto; background: var(--ink); }
.bars.two .fill.b { top: 14px; background: var(--me); }
.bars.two .bar.me .fill { background: var(--ink); }
.bars.two .bar.me .fill.b { background: var(--me); }
.bars.wide .bar { grid-template-columns: 132px 1fr 110px; }
.bars.wide .bar .code { letter-spacing: 0; font-weight: 600; }
.bars.wide .fill { opacity: .85; }
.bar .moe { position: absolute; top: 50%; height: 2px; margin-top: -1px; background: var(--ink); }
.bar .moe::before, .bar .moe::after { content: ""; position: absolute; top: -4px; width: 2px; height: 10px; background: var(--ink); }
.bar .moe::before { left: 0; } .bar .moe::after { right: 0; }
.bar .pct small { color: var(--ink3); font-size: 12px; margin-left: 4px; }
.bars.two .bar { grid-template-columns: 52px 1fr 104px; }
.key { margin: 16px 0 0; font-size: 13px; color: var(--ink3); }
.k { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin: 0 5px 0 10px; }
.k:first-child { margin-left: 0; }
.k-me { background: var(--me); } .k-etc { background: var(--off); } .k-ink { background: var(--ink); }
.k-avg { width: 2px; border-radius: 0; background: var(--ink); }

/* ---- 지도 ---- */
.mapwrap { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 12px 12px 10px; }
#map { display: block; width: 100%; height: auto; }
#map .sphere { fill: none; stroke: var(--line); }
#map .land { fill: var(--nodata); stroke: var(--paper); stroke-width: .5; }
#map .has { cursor: pointer; }
#map .has:hover, #map .has.on { stroke: var(--ink); stroke-width: 1.2; }
#map .sel { stroke: var(--ink); stroke-width: 1.6; }
.tip { position: absolute; z-index: 3; pointer-events: none; transform: translate(-50%, -115%); background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: 13px; white-space: nowrap; }
.tip b { font-weight: 700; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink3); padding: 6px 4px 0; }
.legend > i { width: 120px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--me) 10%, var(--paper)), var(--me)); }
.legend .nodata { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.legend .nodata i { width: 12px; height: 12px; border-radius: 3px; background: var(--nodata); }
/* ---- 네 글자 ---- */
.splits { display: grid; gap: 14px; max-width: 760px; }
.split { display: grid; grid-template-columns: 78px 1fr 78px; align-items: center; gap: 12px; }
.split .side { font-size: 14px; color: var(--ink3); line-height: 1.25; }
.split .side b { display: block; font-size: 22px; font-weight: 800; color: var(--ink2); }
.split .side.r { text-align: right; }
.split .side.on b, .split .side.on { color: var(--me); }
.split .tr { display: flex; height: 30px; gap: 2px; }
.split .tr i { display: flex; align-items: center; padding: 0 8px; font-style: normal; font-size: 13px; font-weight: 700; background: var(--off); color: var(--ink2); min-width: 0; }
.split .tr i:first-child { border-radius: 6px 0 0 6px; }
.split .tr i:last-child { border-radius: 0 6px 6px 0; justify-content: flex-end; }
.split .tr i.on { background: var(--me); color: #fff; }

.indep { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; max-width: 760px; margin-bottom: 32px; }
.indep .card b { font-size: 34px; }
.indep .card.hot b { color: var(--me); }
.ratio { display: grid; gap: 6px; max-width: 760px; }
.rt { display: grid; grid-template-columns: 52px 1fr 60px; align-items: center; gap: 10px; }
.rt .code { font-weight: 700; font-size: 14px; color: var(--ink2); }
.rt .track { position: relative; height: 18px; }
.rt .track::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink3); }
.rt .fill { position: absolute; top: 0; bottom: 0; background: var(--off); border-radius: 3px; }
.rt .pct { font-size: 14px; color: var(--ink2); text-align: right; }
.rt.me .code, .rt.me .pct { color: var(--me); font-weight: 700; }
.rt.me .fill { background: var(--me); }
.pairs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.pairs .card p { margin: 0; font-size: 16px; color: var(--ink); }
.pairs .card p + p { margin-top: 10px; font-size: 14px; color: var(--ink2); }
.pairs .card em { font-style: normal; font-weight: 800; color: var(--me); }

/* ---- 저장 ---- */
.sharebox { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 32px; align-items: center; margin-top: 20px; }
#card { width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line); display: block; }
.shareact { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.shareact p { flex-basis: 100%; margin: 0 0 6px; color: var(--ink2); }
.shareact button { padding: 12px 20px; border-radius: 12px; border: 1.5px solid var(--ink); background: var(--ink); color: var(--bg); font-weight: 700; cursor: pointer; }
.shareact button.ghost { background: none; color: var(--ink); }
.shareact .done { min-height: 1.5em; font-size: 14px; color: var(--me); margin: 0; }

/* ---- 자료 ---- */
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 12px; margin-top: 20px; }
.notes p { margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 20px; font-size: 15px; color: var(--ink2); }
.notes b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.src { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink3); max-width: 80ch; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  section { padding-top: 64px; }
  .hero { padding-top: 36px; }
  .top nav a { padding: 4px 8px; }
  .letters { gap: 6px; width: 100%; grid-template-columns: repeat(4, 1fr); }
  .pair button { width: 100%; }
  .country, .country select { width: 100%; }
  .room-sec { grid-template-columns: 1fr; gap: 20px; padding-top: 36px; }
  .answer { position: static; }
  .big b { font-size: 104px; }
  .floor { border-width: 4px; }
  .floor::before { bottom: -4px; height: 4px; left: 28px; width: 40px; }
  .bars.wide .bar { grid-template-columns: 96px 1fr 92px; }
  .bars.wide .bar .code { font-size: 13px; }
  .sharebox { grid-template-columns: 1fr; }
  #card { max-width: 300px; }
  .split { grid-template-columns: 58px 1fr 58px; gap: 8px; }
  .bars.two .bar { grid-template-columns: 46px 1fr 92px; }
}

/* 둘이 만날 확률 · 남녀 */
.country.mate { max-width: 220px; margin: 0 0 20px; }
#meet .answer { position: static; margin-bottom: 20px; }
#meet-line { margin: 14px 0 0; color: var(--ink2); max-width: 62ch; }
.cgrid { display: grid; grid-template-columns: repeat(10, 1fr); gap: clamp(6px, 1.8vw, 18px) clamp(4px, 1.4vw, 16px); }
.cgrid .c { display: flex; gap: 0; }
.cgrid .c svg { width: 50%; height: auto; display: block; }
.cgrid .c .body, .cgrid .c .head { fill: var(--off); }
.cgrid .c .head { stroke: var(--paper); stroke-width: 1.6; }
.cgrid .c.on .body, .cgrid .c.on .head { fill: var(--me); }
.bars.two .bar .code { white-space: nowrap; }
#gen-letters .bar { grid-template-columns: 4.5em 1fr 76px; }
:lang(en) #gen-letters .bar { grid-template-columns: 8.2em 1fr 76px; }
#gen-bars .bar .pct, #cmp-bars .bar .pct { white-space: nowrap; }
.age { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; max-width: 72ch; }
.age li { color: var(--ink2); font-size: 15px; line-height: 1.6; }
.age li b { color: var(--ink); margin-right: 6px; }
.age li:not(.on) { opacity: .65; }
.quip { font-size: clamp(19px, 2.6vw, 24px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.45; margin: 0 0 18px; max-width: 30em; text-wrap: balance; }
.meetact { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 20px; }
.meetact button { padding: 12px 22px; border-radius: 12px; border: 1.5px solid var(--me); background: var(--me); color: #fff; font-weight: 700; cursor: pointer; }
.meetact button.ghost { background: none; color: var(--me); }
.quip2 { margin: -8px 0 18px; font-size: 16px; font-weight: 600; color: var(--ink2); max-width: 36em; }
.hshare { flex: none; padding: 6px 14px; border-radius: 99px; border: 1.5px solid var(--ink); background: none; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.hshare:hover { background: var(--ink); color: var(--bg); }
#meet-msg { font-size: 14px; color: var(--ink2); }
.lead.rare { margin-top: 18px; }
