/* Life — Vamsa's second canvas (life.js): you in the middle, groups of faces around you. */

/* Family | Life: on the "My family" line, right — clear of undo/redo above it */
#lifeSwitch { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 72px); right: 16px; z-index: 241; display: flex; padding: 3px; border-radius: 99px; background: rgba(17,17,17,.07); }
#lifeSwitch button { border: 0; padding: 6px 12px; border-radius: 99px; background: none; color: #8a8a93; font: 700 13px var(--l-font-label, system-ui); cursor: pointer; }
#lifeSwitch button[data-on] { background: #fff; color: #111; box-shadow: 0 1px 6px rgba(0,0,0,.1); }
#screenTree:not([data-view="tree"]) #lifeSwitch { display: none; }
#screenTree[data-life] #histBtns, #screenTree[data-life] #sidePill { display: none; }

/* the layer: between the tree's header and the family dock — over the family canvas, under the
   dock, so the same tray (+ and more) feeds Life */
llife { position: fixed; left: 0; right: 0; z-index: 244; display: block; background: #fff; color: #111; -webkit-user-select: none; user-select: none; }
llife[hidden] { display: none; }
llife .lf-pane { position: absolute; inset: 0; overflow: auto; scrollbar-width: none; touch-action: pan-x pan-y; }
llife .lf-pane::-webkit-scrollbar { display: none; }
llife .lf-map { position: relative; }

/* faces: round photos with a thin white edge, overlapping a little inside a group */
llife .lf-face { position: absolute; display: grid; place-items: center; width: 42px; height: 42px; margin: -21px 0 0 -21px; border-radius: 50%; overflow: hidden; background: #e4e4e7; color: #777; font: 600 15px var(--l-font-label, system-ui); box-shadow: 0 0 0 2.5px #fff; touch-action: none; cursor: grab; }
llife .lf-face img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
llife .lf-face i { font-style: normal; }
llife .lf-face.lead { width: 60px; height: 60px; margin: -30px 0 0 -30px; font-size: 20px; }
llife .lf-me { width: 72px; height: 72px; margin: -36px 0 0 -36px; overflow: visible; cursor: default; touch-action: auto; }
llife .lf-me img, llife .lf-me i { width: 100%; height: 100%; border-radius: 50%; display: block; }
llife .lf-me i { background: #e4e4e7; }
llife .lf-me small { position: absolute; top: 80px; left: 50%; transform: translateX(-50%); font: 700 13px var(--l-font-label, system-ui); color: #111; white-space: nowrap; }

/* a group: its faces, its title underneath; a soft disc shows where a carried face would land */
llife .lf-group { position: absolute; width: 0; height: 0; cursor: pointer; }
llife .lf-group::before { content: ''; position: absolute; left: calc(-1 * var(--r) - 14px); top: calc(-1 * var(--r) - 14px); width: calc(2 * var(--r) + 28px); height: calc(2 * var(--r) + 28px); border-radius: 50%; background: rgba(17,17,17,.06); opacity: 0; }
llife .lf-group[data-hot]::before { opacity: 1; }
llife .lf-title { position: absolute; left: 0; transform: translateX(-50%); font: 600 13px var(--l-font-label, system-ui); color: #111; white-space: nowrap; }
llife .lf-title span { margin-left: 4px; font-weight: 500; color: #8a8a93; }

.lf-ghost { position: fixed; z-index: 500; width: 58px; height: 58px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: #e4e4e7; color: #777; font: 600 18px var(--l-font-label, system-ui); transform: translate(-50%, -50%); box-shadow: 0 0 0 3px #fff, 0 14px 30px -8px rgba(0,0,0,.4); pointer-events: none; }
.lf-ghost[hidden] { display: none; }
.lf-ghost img { width: 100%; height: 100%; object-fit: cover; }
.lf-ghost i { font-style: normal; }

/* sheets (laya's lsheet look, over the whole screen) */
#lifeSheets lsheet { position: fixed; inset: 0; z-index: 400; display: flex; align-items: flex-end; background: rgba(0,0,0,.35); }
#lifeSheets lsheet[hidden] { display: none; }
#lifeSheets lpanel { display: block; width: 100%; max-height: calc(100% - 24px); overflow-y: auto; box-sizing: border-box; padding: 22px 22px calc(env(safe-area-inset-bottom, 0px) + 24px); border-radius: 28px 28px 0 0; background: #fff; }
#lifeSheets header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
#lifeSheets header b { font: 800 1.5rem var(--l-font-display, system-ui); letter-spacing: -.02em; }
#lifeSheets header button { flex: 0 0 auto; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(17,17,17,.07); color: #111; font-size: 1rem; cursor: pointer; }
#lifeSheets [hidden] { display: none !important; }
#lifeSheets label { display: block; margin: 8px 0 6px; font: 700 12px var(--l-font-label, system-ui); color: #6e6e73; text-transform: uppercase; letter-spacing: .08em; }
#lifeSheets .lf-in { width: 100%; box-sizing: border-box; padding: 14px 16px; border: 1px solid #dedcd5; border-radius: 16px; background: #fff; color: #111; font: 500 1rem var(--l-font-label, system-ui); outline: none; -webkit-appearance: none; }
#lifeSheets .lf-row { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; }
#lifeSheets .lf-row > .lf-in { flex: 1 1 auto; min-width: 0; }
#lifeSheets .lf-add { flex: 0 0 auto; padding: 14px 18px; border: 0; border-radius: 16px; background: #111; color: #fff; font: 700 15px var(--l-font-label, system-ui); cursor: pointer; }
#lifeSheets .lf-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
#lifeSheets .lf-chips button { padding: 12px 18px; border: 1.5px solid #111; border-radius: 99px; background: #fff; color: #111; font: 600 15px var(--l-font-label, system-ui); cursor: pointer; }
#lifeSheets .lf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 14px 8px; margin: 16px 0 4px; }
#lifeSheets .lf-cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; font: 500 12px var(--l-font-label, system-ui); color: #333; text-align: center; }
#lifeSheets .lf-cell .lf-face { position: relative; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: #e4e4e7; color: #777; font: 600 18px var(--l-font-label, system-ui); }
#lifeSheets .lf-cell .lf-face img { width: 100%; height: 100%; object-fit: cover; }
#lifeSheets .lf-cell .lf-face i { font-style: normal; }
#lifeSheets .lf-cell span { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lifeSheets .lf-cell button { position: absolute; top: -4px; right: 6px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: #111; color: #fff; font-size: 11px; cursor: pointer; }
#lifeSheets button[big] { display: block; width: 100%; margin-top: 16px; padding: 16px; border: 0; border-radius: 99px; background: #111; color: #fff; font: 800 1rem var(--l-font-display, system-ui); cursor: pointer; }
#lifeSheets .lf-quiet { display: block; width: 100%; margin-top: 8px; padding: 14px; border: 0; background: none; color: #b0524a; font: 600 15px var(--l-font-label, system-ui); cursor: pointer; }

/* the dashed, empty circle: drop a face on it to start a new group */
llife .lf-new { cursor: default; }
llife .lf-drop { position: absolute; left: -30px; top: -30px; width: 60px; height: 60px; box-sizing: border-box; border: 2px dashed #b9b9c0; border-radius: 50%; display: grid; place-items: center; font: 300 28px/1 var(--l-font-label, system-ui); font-style: normal; color: #9a9aa2; }
llife .lf-new[data-hot] .lf-drop { border-color: #111; color: #111; }
llife .lf-new .lf-title { color: #8a8a93; font-weight: 500; }

/* motion — the same as a new connection on the tree: the face springs in, a ring ripples out,
   a new group's title fades in; the carried face lifts; a group's drop disc fades in */
llife .lf-face[data-enter] { animation: lfPop .5s var(--l-spring, cubic-bezier(.34,1.56,.64,1)) .05s backwards; }
llife .lf-group[data-enter] .lf-title { animation: lfFade .4s ease-out .2s backwards; }
llife .lf-ring { position: absolute; border-radius: 50%; border: 2px solid #111; pointer-events: none; animation: lfRing .62s cubic-bezier(.2,.7,.3,1) forwards; }
llife .lf-group::before { transition: opacity .2s, transform .25s var(--l-spring, cubic-bezier(.34,1.56,.64,1)); transform: scale(.85); }
llife .lf-group[data-hot]::before { transform: scale(1); }
llife .lf-drop { transition: border-color .2s, color .2s, transform .25s var(--l-spring, cubic-bezier(.34,1.56,.64,1)); }
llife .lf-new[data-hot] .lf-drop { transform: scale(1.12); }
.lf-ghost:not([hidden]) { animation: lfLift .22s var(--l-spring, cubic-bezier(.34,1.56,.64,1)) forwards; }
@keyframes lfPop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes lfFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lfRing { from { transform: scale(.85); opacity: .75; } to { transform: scale(2.3); opacity: 0; } }
@keyframes lfLift { from { transform: translate(-50%, -50%) scale(1); } to { transform: translate(-50%, -50%) scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  llife .lf-face[data-enter], llife .lf-group[data-enter] .lf-title, .lf-ghost:not([hidden]) { animation: none; }
  llife .lf-ring { display: none; }
  llife .lf-group::before, llife .lf-drop { transition: none; }
}

/* a group, full screen — above the tab bar, under Vamsa's person sheet (z 260) so a tap on
   someone opens their details on top of it */
lifegroup { position: fixed; inset: 0; z-index: 255; display: flex; flex-direction: column; background: #fff; color: #111; animation: lfUp .32s var(--l-spring, cubic-bezier(.34,1.56,.64,1)); }
lifegroup[hidden] { display: none; }
lifegroup header { display: flex; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 12px; border-bottom: 1px solid rgba(17,17,17,.06); }
lifegroup header span { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
lifegroup header b { font: 800 1.6rem/1.1 var(--l-font-display, system-ui); letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
lifegroup header small { margin-top: 2px; color: #8a8a93; font: 500 14px var(--l-font-label, system-ui); }
lifegroup .lf-back { width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(17,17,17,.06); color: #111; font-size: 20px; cursor: pointer; }
lifegroup .lf-edit { padding: 9px 16px; border: 0; border-radius: 99px; background: rgba(17,17,17,.06); color: #111; font: 700 14px var(--l-font-label, system-ui); cursor: pointer; }
lifegroup .lf-people { flex: 1 1 auto; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 22px 12px; align-content: start; padding: 22px 16px calc(env(safe-area-inset-bottom, 0px) + 28px); }
lifegroup .lf-person { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0; border: 0; background: none; color: #111; font: 600 15px var(--l-font-label, system-ui); cursor: pointer; }
lifegroup .lf-person .lf-face { width: 120px; height: 120px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: #e4e4e7; color: #777; font: 600 38px var(--l-font-label, system-ui); }
lifegroup .lf-person .lf-face img { width: 100%; height: 100%; object-fit: cover; }
lifegroup .lf-person .lf-face i { font-style: normal; }
lifegroup .lf-person span { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes lfUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { lifegroup { animation: none; } }
