:root { font-family: Arial, Helvetica, sans-serif; color: #14151b; background: #fff; font-synthesis: none; --muted: #82828e; --yellow: #ffd630; --border: #eeeeef; }
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; color: inherit; border: 0; background: none; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .42; }
button, input, select { touch-action: manipulation; }
button:focus-visible, input:focus-visible, select:focus-visible, .station:focus-visible { outline: 3px solid #198afa; outline-offset: 3px; }
button:not(:disabled):active { filter: brightness(.96); }
.icon { width: 22px; height: 22px; flex-shrink: 0; }
.icon-button { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; flex-shrink: 0; }
.icon-button .icon { opacity: .55; }
.app { height: 100svh; height: 100dvh; min-height: 560px; display: grid; grid-template-rows: auto minmax(170px, 1fr) auto; overflow: hidden; }
.header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: max(16px, env(safe-area-inset-top)) 20px 13px; z-index: 2; background: white; }
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 0; }
.brand img { width: 39px; height: 39px; object-fit: contain; }
.brand h1 { margin: 0; font-size: 30px; letter-spacing: -.8px; line-height: 1.08; font-weight: 750; }
.brand p { margin: 3px 0 0; color: #93939a; font-size: 14px; }
.route-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 30px; grid-template-rows: 50px; gap: 8px; }
.route-field { min-width: 0; display: flex; align-items: center; background: #f5f5f6; border-radius: 12px; }
.route-a { grid-area: 1 / 1; } .route-b { grid-area: 1 / 2; }
.route-choose { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 7px 4px 7px 9px; flex: 1; height: 100%; text-align: left; }
.badge { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: white; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.badge-a { background: #ef2439; } .badge-b { background: #0095ef; }
.route-label { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-clear { width: 28px; height: 42px; } .route-clear .icon { width: 18px; height: 18px; }
.swap { grid-area: 1 / 3; height: 100%; width: 30px; }
.swap .icon { width: 25px; height: 25px; transform: rotate(90deg); }
.map-area { position: relative; min-height: 0; overflow: hidden; }
.map-host, .family-map { width: 100%; height: 100%; display: block; }
.family-map { touch-action: none; user-select: none; cursor: grab; }
.family-map:active { cursor: grabbing; }
.station { cursor: pointer; outline: none; }
.station:focus-visible .station-hit { stroke: #198afa; stroke-width: 2; }
.station-label { font-size: 18px; font-weight: 500; fill: #202132; paint-order: stroke; stroke: white; stroke-width: 5px; stroke-linejoin: round; }
.station-label.emphasized { font-weight: 700; }
.map-controls { position: absolute; right: 15px; bottom: 15px; display: grid; gap: 7px; }
.zoom-button { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.96); border-radius: 13px; box-shadow: 0 3px 18px #21212d12; }
.zoom-button img { width: 25px; height: 25px; opacity: .7; }
.map-hint { pointer-events: none; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); background: #fff6cf; box-shadow: 0 4px 20px #32321b12; border-radius: 20px; padding: 9px 15px; white-space: nowrap; font-size: 13px; opacity: 0; }
.map-hint.visible { opacity: 1; }
.panel { background: #fff; border-radius: 23px 23px 0 0; box-shadow: 0 -4px 24px #28233209; display: flex; flex-direction: column; min-height: 0; z-index: 3; max-height: 58dvh; overflow: hidden; }
.panel-content { position: relative; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 17px 20px max(17px, env(safe-area-inset-bottom)); }
.route-dock { flex-shrink: 0; padding: 0 16px 14px; border-bottom: 1px solid var(--border); background: white; }
.panel-handle { height: 5px; width: 41px; border-radius: 5px; background: #dddde0; margin: 9px auto 13px; }
.results { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 15px; }
.result-column { min-width: 0; }
.result-column + .result-column { padding-left: 17px; border-left: 1px solid #e6e6e9; }
.result-caption { color: #858591; margin: 0 0 8px; font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; }
.result-title { font-size: 29px; line-height: 1.02; font-weight: 750; letter-spacing: -.8px; margin: 0; overflow-wrap: anywhere; }
.result-title.long { font-size: 22px; line-height: 1.12; letter-spacing: -.4px; }
.result-description { margin: 7px 0 0; color: #767680; font-size: 12px; line-height: 1.3; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 5px; padding: 10px 0 12px; border-top: 1px solid #ededee; font-size: 13px; color: #82828e; line-height: 1.35; }
.breadcrumb-person { padding: 2px 0; text-align: left; color: inherit; }
.route-arrow { color: #9999a3; }
.primary { min-height: 47px; padding: 12px; width: 100%; background: var(--yellow); border-radius: 12px; font-weight: 700; font-size: 16px; }
.empty-title { font-size: 23px; margin: 0 0 8px; }
.muted { color: var(--muted); line-height: 1.4; font-size: 14px; }
.person-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.person-title { font-size: 23px; line-height: 1.15; margin: 0; letter-spacing: -.4px; overflow-wrap: anywhere; }
.close-panel { margin: -9px -8px 0 0; }
.person-role { margin: 5px 0 0; }
.name-form { display: flex; align-items: center; gap: 8px; margin: 10px 0 11px; border: 1px solid #dcdce1; border-radius: 10px; padding: 3px 11px; background: #fff; }
.name-form:focus-within { border-color: #198afa; outline: 2px solid #198afa22; }
.name-input:focus-visible { outline: none; }
.name-form .icon { width: 16px; opacity: .35; }
.name-input { width: 100%; min-width: 0; border: 0; border-radius: 4px; padding: 8px 1px; font-size: 14px; background: transparent; }
.name-input::placeholder { color: #9696a0; }
.directions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.direction { border-radius: 12px; background: #f5f5f6; display: flex; align-items: center; justify-content: center; gap: 11px; min-height: 49px; font-size: 16px; font-weight: 600; }
.direction .badge { width: 25px; height: 25px; font-size: 14px; }
.direction.active { background: #efeff2; }
.add-relatives { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 47px; background: var(--yellow); font-weight: 650; border-radius: 12px; margin-top: 11px; }
.identity-action { margin-top: 17px; padding: 15px 0 0; min-height: 42px; border-top: 1px solid #ededee; display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; font-size: 14px; }
.identity-action .icon { opacity: .55; width: 19px; }
.identity-action:disabled { opacity: .65; }
.relatives-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 9px; }
.relative-option { padding: 9px; display: flex; align-items: center; gap: 5px; border-radius: 9px; font-size: 12px; min-height: 43px; background: #f7f7f8; text-align: left; }
.relative-option .icon { width: 15px; height: 15px; }
.sex-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); margin: 0 0 10px; }
select { border: 1px solid #e5e5e9; background: #fff; color: #34343e; padding: 9px; border-radius: 8px; }
.picker { border: 0; padding: 23px; width: calc(100% - 28px); max-width: 450px; max-height: 80dvh; border-radius: 22px; box-shadow: 0 20px 80px #0002; color: #14151b; }
.picker::backdrop { background: #1b192650; backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dialog-heading h2 { font-size: 23px; margin: 0; line-height: 1.2; }
.dialog-heading .icon-button { margin: -7px -9px 0 0; }
.map-choice { width: 100%; padding: 13px; border-radius: 10px; background: #fff5c6; font-size: 14px; margin: 17px 0 9px; }
.people-list { display: grid; }
.person-choice { min-height: 52px; width: 100%; display: flex; gap: 13px; align-items: center; text-align: left; padding: 10px 6px; border-bottom: 1px solid #f2f2f3; }
.choice-caption { flex: 1; font-size: 15px; overflow-wrap: anywhere; }
.choice-caption small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.choice-dot { width: 17px; height: 17px; border: 3px solid var(--line-color); border-radius: 50%; flex-shrink: 0; }
.choice-star { color: #fdbd20; font-size: 23px; width: 17px; }
.person-choice .icon { width: 17px; }
.dialog-context { color: var(--muted); font-size: 14px; }
.coparent { display: grid; gap: 8px; font-size: 14px; margin: 20px 0; }
.relative-choices { display: grid; gap: 8px; margin-top: 18px; }
.relative-choice { min-height: 48px; display: flex; align-items: center; gap: 11px; background: #f4f4f6; padding: 10px 15px; border-radius: 11px; text-align: left; }
.relative-choice .icon { width: 19px; }
.toast { visibility: hidden; position: fixed; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -130%); max-width: calc(100% - 24px); width: max-content; padding: 12px 16px; background: #282832; color: white; font-size: 13px; border-radius: 13px; z-index: 10; box-shadow: 0 6px 30px #0002; transition: transform .2s ease; display: flex; align-items: center; gap: 15px; }
.toast.visible { visibility: visible; transform: translate(-50%, 0); }
.toast-undo { color: #ffdf55; padding: 6px 0; font-weight: 700; }
.storage-warning { position: fixed; bottom: 0; left: 0; right: 0; background: #fff0c0; padding: 10px 15px; font-size: 12px; z-index: 11; }
@media (hover: hover) { .icon-button:hover, .person-choice:hover, .relative-option:hover { background: #eeeef1; } .breadcrumb-person:hover { color: #16161e; } .station:hover .station-hit { fill: #fff4c466; } }
@media (min-width: 800px) {
  .app { grid-template-columns: 370px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); min-height: 640px; }
  .header { grid-area: 1 / 1; padding: 34px 27px 25px; border-right: 1px solid var(--border); }
  .brand { margin-bottom: 0; gap: 12px; } .brand img { width: 45px; height: 45px; } .brand h1 { font-size: 34px; } .brand p { font-size: 15px; }
  .route-fields { grid-template-columns: minmax(0, 1fr) 30px; grid-template-rows: 51px 51px; gap: 9px 8px; }
  .route-b { grid-area: 2 / 1; } .swap { grid-area: 1 / 2 / 3 / 3; } .swap .icon { transform: none; }
  .route-label { font-size: 16px; } .badge { width: 27px; height: 27px; font-size: 16px; }
  .route-dock { padding: 4px 27px 20px; }
  .map-area { grid-area: 1 / 2 / 3 / 3; background: white; }
  .panel { grid-area: 2 / 1; border-right: 1px solid var(--border); border-radius: 0; box-shadow: none; max-height: none; padding: 0; }
  .panel-content { padding: 15px 27px 24px; }
  .panel-handle { display: none; } .results { gap: 14px; margin-bottom: 23px; } .result-title { font-size: 29px; } .result-title.long { font-size: 22px; }
  .result-caption { font-size: 13px; margin-bottom: 12px; } .breadcrumb { margin: 0 0 12px; padding: 18px 0; }
  .primary { min-height: 50px; } .map-controls { right: 30px; bottom: 30px; gap: 10px; } .zoom-button { width: 48px; height: 48px; border-radius: 15px; }
  .person-title { font-size: 26px; } .name-form { margin: 10px 0 22px; } .identity-action { margin-top: 27px; padding-top: 20px; } .map-hint { top: 26px; }
}
@media (max-width: 379px) { .header { padding-left: 15px; padding-right: 15px; } .panel-content { padding-left: 16px; padding-right: 16px; } .route-dock { padding-left: 12px; padding-right: 12px; } .result-title { font-size: 26px; } .result-title.long { font-size: 19px; } .result-caption { font-size: 12px; } }
@media (max-height: 720px) and (max-width: 799px) { .app { min-height: 620px; } .header { padding-top: 12px; } .brand h1 { font-size: 26px; } .brand p { font-size: 12px; } .brand img { width: 34px; height: 34px; } .panel-handle { margin-bottom: 12px; } .result-title { font-size: 25px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.map-host { position: relative; }
.graph-canvas, .graph-labels { position: absolute; inset: 0; }
.graph-labels { pointer-events: none; overflow: hidden; }
.map-person { position: absolute; width: 40px; height: 40px; transform: translate(-50%, -50%); padding: 0; border-radius: 50%; pointer-events: auto; }
.map-person-label { position: absolute; width: var(--label-width); left: 50%; bottom: calc(20px + var(--label-offset)); transform: translateX(-50%); font-size: var(--label-size); line-height: 1.13; color: #242536; text-align: center; overflow-wrap: anywhere; text-shadow: 1px 0 white, -1px 0 white, 0 1px white, 0 -1px white, 2px 2px white, -2px -2px white; pointer-events: auto; }
.map-person-label.side-below { bottom: auto; top: calc(20px + var(--label-offset)); }
.map-person-label.side-right { bottom: auto; left: calc(20px + var(--label-offset)); top: 50%; transform: translateY(-50%); text-align: left; }
.map-person-label.emphasized { font-weight: 700; }
.map-endpoint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: calc(21px * var(--node-scale)); font-weight: 700; }
.is-anchor .map-endpoint { color: #714800; font-size: calc(14px * var(--node-scale)); }

@media (max-height: 550px) { .app { height: auto; min-height: 100dvh; overflow: visible; } .map-area { min-height: 400px; } .person-panel { max-height: none; } }
.map-host { touch-action: none; }
.panel { position: relative; }
.close-route { position: absolute; top: 0; right: 9px; }
.has-route .panel-content { padding-top: 42px; }
.tap-hint { margin: 10px 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.map-person.is-muted { opacity: .5; }
@media (min-width: 800px) { .panel.has-route .panel-content { padding-top: 45px; } .close-route { right: 17px; } }
.desktop-inspector { margin-top: 27px; padding-top: 24px; border-top: 1px solid var(--border); }
.inspector-caption { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
@media (min-width: 800px) { .desktop-inspector .close-panel { display: none; } .desktop-inspector .identity-action { margin-top: 20px; } }

.map-person-sex { display: block; margin-top: 3px; font-size: .82em; font-weight: 400; }

.route-help { margin: 0; padding: 13px 15px; border-radius: 12px; background: #f6f6f7; color: #73737e; font-size: 14px; line-height: 1.45; }

.result-aliases { margin: 6px 0 0; color: #767680; font-size: 12px; line-height: 1.35; }
@media (max-width: 799px) { .panel { box-shadow: 0 -8px 30px #28233226, 0 -2px 8px #28233212; } }

.glossary-button { display: inline-flex; align-items: center; gap: 6px; padding: 10px 8px; border-radius: 11px; font-size: 13px; background: #f5f5f6; flex-shrink: 0; }
.glossary-button img { width: 19px; height: 19px; }
.glossary { border: 0; border-radius: 24px; padding: 0; width: min(680px, calc(100% - 24px)); height: min(760px, 88dvh); max-height: calc(100dvh - 24px); box-shadow: 0 20px 80px #0003; color: #14151b; }
.glossary[open] { display: flex; flex-direction: column; }
.glossary::backdrop { background: #1b192650; backdrop-filter: blur(3px); }
.glossary-header { padding: 24px 24px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.glossary-intro { font-size: 14px; line-height: 1.4; color: var(--muted); margin: 12px 0 17px; }
.glossary-filters { display: flex; gap: 7px; overflow-x: auto; padding: 4px 3px 9px; }
.glossary-filter { flex-shrink: 0; padding: 9px 12px; background: #f4f4f6; border-radius: 20px; font-size: 13px; }
.glossary-filter[aria-pressed="true"] { background: var(--yellow); }
.glossary-count { font-size: 12px; color: var(--muted); margin: 5px 0 0; }
.glossary-list { overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding: 0 24px 20px; outline-offset: -3px; }
.glossary-entry { padding: 18px 0; border-bottom: 1px solid var(--border); }
.glossary-entry:last-child { border: 0; }
.glossary-entry h3 { margin: 0 0 7px; font-size: 18px; font-weight: 650; line-height: 1.3; }
.glossary-entry p { margin: 0; font-size: 14px; line-height: 1.5; color: #666673; }
.glossary-note { display: inline-block; margin-top: 9px; padding: 5px 8px; border-radius: 6px; background: #fff6d6; color: #826619; font-size: 11px; }
@media (max-width: 799px) { .glossary-header { padding: 20px 18px 12px; } .glossary-list { padding-left: 18px; padding-right: 18px; } }
