:root {
  --bg: #F5F7FA; --card: #fff; --text: #1A2233; --muted: #6B7689; --line: #E4E8EF;
  --pri: #1F6FEB; --danger: #D93036; --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  -webkit-tap-highlight-color: transparent; }
body { display: flex; flex-direction: column; }
#app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
.muted { color: var(--muted); font-size: 14px; }
.splash { margin: auto; text-align: center; color: var(--muted); line-height: 2; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  background: var(--pri); color: #fff; font-weight: 600; padding: 12px 18px; font-size: 16px; text-decoration: none; }
.btn-s { padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn-y { background: var(--pri); }
.btn-ghost { background: #EEF2F8; color: var(--text); }
.btn-on { background: var(--c, var(--pri)); }
.link { background: none; border: 0; color: var(--pri); font-size: 14px; padding: 4px 6px; }
.danger { color: var(--danger); }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(20, 30, 60, .08); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btns { margin-top: 10px; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; display: inline-block; }

/* 로그인 */
.login { margin: auto; max-width: 360px; padding: 32px 24px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.login h1 { margin: 6px 0 0; font-size: 28px; }
.login img { border-radius: 22px; }
.g-btn { background: #fff; color: #1f1f1f; border: 1px solid #DADCE0; width: 100%; margin-top: 8px; }
.invite { text-align: left; line-height: 1.6; width: 100%; background: #EAF2FF; box-shadow: none; }
.test { display: flex; gap: 8px; width: 100%; } .test input { flex: 1; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }

/* 틀 */
.shell { flex: 1; min-height: 0; display: flex; flex-direction: column; }
main { flex: 1; min-height: 0; position: relative; overflow: auto; }
.tabs { display: flex; background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); }
.tabs button.on { color: var(--pri); font-weight: 700; }
.tabs button.on svg { stroke-width: 2.4; }

/* 지도 */
.map-wrap { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; background: #E8ECF2; }
.map-top { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 10px; right: 10px; z-index: 500; display: flex; justify-content: space-between; pointer-events: none; }
.map-top > * { pointer-events: auto; }
.fam { background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.icon-btn svg { width: 20px; height: 20px; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 500; padding: 10px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.sheet > * { pointer-events: auto; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: none; border: 2px solid transparent; background: #fff; border-radius: 14px; padding: 8px 12px; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; text-align: left; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.chip i { grid-row: span 2; align-self: center; width: 14px; height: 14px; border-radius: 50%; background: var(--c); }
.chip small { color: var(--muted); font-size: 12px; }
.chip.on { border-color: var(--c); }
.chip.old i { background: #B8BFCC; }
.detail .row b { font-size: 18px; }
.detail .meta { margin-top: 6px; color: var(--muted); font-size: 14px; gap: 12px; }
.warn { margin-top: 8px; background: #FFF4E5; color: #9A5B00; border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.empty { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.pin-box { background: none; border: 0; }
.pin { width: 44px; height: 44px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); display: grid; place-items: center; }
.pin span { transform: rotate(45deg); color: #fff; font-weight: 700; font-size: 13px; }
.pin.old { background: #9AA3B2; }

/* 가족 */
.page { padding: 16px; padding-top: calc(env(safe-area-inset-top, 0px) + 16px); display: flex; flex-direction: column; gap: 14px; max-width: 640px; margin: 0 auto; }
.title { margin: 4px 0; font-size: 24px; display: flex; align-items: center; gap: 6px; }
.card h2 { margin: 0 0 10px; font-size: 17px; }
.card h3 { margin: 0; font-size: 15px; }
.list { list-style: none; margin: 0 0 12px; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list small { font-size: 13px; }
.av { width: 34px; height: 34px; border-radius: 50%; background: #DCE3EE; flex: none; object-fit: cover; }
.pair { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.pair p { margin: 0; }
.pair input, .modal input[name=name], .invite-link input { padding: 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; width: 100%; }
.pair input[name=code] { letter-spacing: 6px; font-size: 22px; text-align: center; }
.pair input[name=code]::placeholder { letter-spacing: 0; font-size: 16px; }
.invite-link { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
#install { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
#install h2 { margin: 0; }

.modal { position: fixed; inset: 0; background: rgba(10, 20, 40, .4); z-index: 2000; display: grid; place-items: center; padding: 20px; }
.modal form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.modal h2 { margin: 0; }
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.colors label { position: relative; }
.colors input { position: absolute; opacity: 0; }
.colors i { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 0 0 2px transparent; }
.colors input:checked + i { box-shadow: 0 0 0 2px var(--c); }

#toast { position: fixed; left: 50%; bottom: calc(80px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: rgba(20, 28, 45, .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; transition: .25s; pointer-events: none; z-index: 3000; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 설치 안내 띠 */
.pwa-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #EAF2FF; border-bottom: 1px solid #CFE0FF; font-size: 14px; padding-top: calc(env(safe-area-inset-top, 0px) + 8px); }
.pwa-bar img { border-radius: 7px; }
.pwa-txt { flex: 1; }
.pwa-btn { border: 0; background: var(--pri); color: #fff; border-radius: 8px; padding: 6px 12px; font-weight: 600; }
.pwa-x { border: 0; background: none; color: var(--muted); font-size: 16px; }
.pwa-help { position: fixed; inset: 0; background: rgba(10, 20, 40, .45); z-index: 3000; display: grid; place-items: center; padding: 20px; }
.pwa-help-card { background: #fff; border-radius: 16px; padding: 20px; max-width: 360px; width: 100%; }
.pwa-help-card ol { padding-left: 20px; line-height: 1.8; }
.pwa-share { display: inline-block; }
