/* «Телевизор» at the top (Andrew 19.10): a thin wooden cabinet, the screen takes nearly all of it (bulging, rounded), a narrow
   panel with the knob and five keys on the right (at the bottom on a narrow screen); colour photos with light grain and a vignette;
   no flicker, no sound. */
.family-tv{--wood-1:#7a4a26;--wood-2:#5b3519;--wood-3:#94603a;width:100%;max-width:640px;justify-self:end;user-select:none}
.family-tv[hidden]{display:none}
.tv-cabinet{display:grid;grid-template-columns:minmax(0,1fr) clamp(54px,12%,72px);gap:8px;padding:9px;border-radius:16px;
 background:repeating-linear-gradient(97deg,#ffffff0d 0 2px,transparent 2px 9px),repeating-linear-gradient(83deg,#00000014 0 1px,transparent 1px 13px),linear-gradient(160deg,var(--wood-3),var(--wood-1) 45%,var(--wood-2));
 box-shadow:0 14px 34px #2a1a0e33,inset 0 1px 0 #ffffff33,inset 0 -2px 4px #00000040}
.tv-bezel{border-radius:13px;padding:5px;background:linear-gradient(160deg,#2b2520,#141210);box-shadow:inset 0 2px 5px #000a}
.tv-screen{position:relative;display:block;width:100%;aspect-ratio:4/3;max-height:420px;padding:0;border:0;overflow:hidden;touch-action:manipulation;user-select:none;background:#0d0f0d;
 border-radius:18% / 22%;box-shadow:inset 0 0 26px 8px #000c,0 0 0 1px #000}
.tv-screen:focus-visible{outline:3px solid #e6c98f;outline-offset:3px}
.tv-photo{position:absolute;inset:-6%;width:112%;height:112%;object-fit:cover;object-position:50% var(--face-y,25%);opacity:0;transition:opacity 1.4s ease;transform-origin:50% var(--face-y,25%);
 animation:tv-drift 8.4s ease-in-out forwards}
.tv-photo.on{opacity:1}.tv-photo.off{opacity:0}
@keyframes tv-drift{from{transform:scale(calc(1 + var(--kin)*.08)) translate(calc(var(--kx)*1.5%),calc(var(--ky)*1.5%))}to{transform:scale(calc(1.08 - var(--kin)*.08)) translate(calc(var(--kx)*-1.5%),calc(var(--ky)*-1.5%))}}
/* The glass: a highlight, the vignette and a light, still grain. */
.tv-glass{position:absolute;inset:0;z-index:3;pointer-events:none;border-radius:inherit;
 background:radial-gradient(120% 90% at 30% 18%,#ffffff26,transparent 42%),radial-gradient(110% 100% at 50% 50%,transparent 58%,#000000a6 100%),
 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
 background-blend-mode:normal,normal,overlay;opacity:.9}
.tv-lines,.tv-static{position:absolute;inset:0;z-index:2;pointer-events:none;opacity:0}
/* The name: the only way to the card from the television (underlined on hover, a hand). */
.tv-caption{position:absolute;z-index:4;left:50%;transform:translateX(-50%);bottom:4%;max-width:84%;min-height:36px;padding:8px 14px;border:0;border-radius:6px;background:transparent;color:#fffdf6;font:600 clamp(12px,1.5vw,15px)/1.3 system-ui,sans-serif;text-align:center;text-shadow:0 1px 3px #000,0 0 10px #000a;cursor:pointer;text-underline-offset:3px}
.tv-caption:hover,.tv-caption:focus-visible{text-decoration:underline}.tv-caption:focus-visible{outline:2px solid #fff3d6}
.tv-caption:empty{display:none}
/* ⤢ in the screen's top corner, small, as on the photo sites. */
.tv-full-btn{position:absolute;z-index:4;top:5%;inset-inline-end:5%;width:32px;height:32px;padding:0;border:0;border-radius:8px;background:#0006;color:#fff;font:600 18px/32px system-ui,sans-serif;cursor:pointer;opacity:.75}
.tv-full-btn:hover,.tv-full-btn:focus-visible{opacity:1;outline:2px solid #fff3d6}

/* The panel: the knob («next channel»), keys 1–4 (the picture), 5 (next relative) and a speaker grille. */
.tv-panel{display:flex;flex-direction:column;align-items:center;gap:10px;padding:10px 0;border-radius:10px;background:linear-gradient(180deg,#00000022,#0000003d);box-shadow:inset 0 1px 3px #0006}
.tv-knob{width:min(44px,90%);aspect-ratio:1;border-radius:50%;border:0;padding:0;cursor:pointer;background:radial-gradient(circle at 35% 30%,#f3e6c8,#c7b48c 55%,#8e7a55);box-shadow:0 2px 4px #0007,inset 0 -2px 3px #0004}
.tv-knob span{display:block;width:100%;height:100%;border-radius:50%;transition:transform .35s ease;background:linear-gradient(#5a4630,#5a4630) 50% 8%/3px 34% no-repeat}
.tv-keys{display:flex;flex-direction:column;gap:7px;align-items:center;width:100%}
.tv-key{width:min(46px,86%);height:36px;flex:none;display:grid;place-items:center;border:0;border-radius:5px;padding:0;cursor:pointer;color:#3a2a18;font:700 11px/1 system-ui,sans-serif;background:linear-gradient(#f4ead2,#d6c49c);box-shadow:0 2px 0 #6b5434,0 3px 4px #0005}
/* The keys show what they do: a colour dot, half black and white, sepia, lines, «»» for the next relative (titles too). */
.tv-swatch{display:block;width:18px;height:18px;border-radius:50%;box-shadow:inset 0 0 0 1px #0004;font:700 15px/16px system-ui,sans-serif;font-style:normal;text-align:center;color:#3a2a18}
.tv-swatch-color{background:conic-gradient(#e0533d,#f2b63c,#5fae5a,#3f7fd0,#9a5ac8,#e0533d)}
.tv-swatch-bw{background:linear-gradient(90deg,#111 50%,#f4f4f4 50%)}
.tv-swatch-sepia{background:radial-gradient(circle at 35% 35%,#e9d3a8,#9b7444)}
.tv-swatch-tube{border-radius:3px;background:repeating-linear-gradient(0deg,#2b2b2b 0 2px,#bdbdbd 2px 4px)}
.tv-swatch-next{box-shadow:none}
.tv-key[aria-pressed=true]{transform:translateY(2px);box-shadow:0 0 0 #6b5434,inset 0 2px 3px #0004;background:linear-gradient(#e6d3a6,#cdb684)}
.tv-key:focus-visible,.tv-knob:focus-visible{outline:2px solid #fff3d6;outline-offset:2px}
.tv-grille{flex:1;width:70%;min-height:24px;border-radius:5px;background:repeating-linear-gradient(0deg,#00000045 0 2px,transparent 2px 5px)}
/* Picture styles, CSS filters only. */
.family-tv[data-effect=bw] .tv-photo{filter:grayscale(1) contrast(1.08)}
.family-tv[data-effect=sepia] .tv-photo{filter:sepia(.78) contrast(.94) brightness(1.03) saturate(.9)}
.family-tv[data-effect=tube] .tv-photo{filter:grayscale(.55) contrast(1.12) brightness(.96) blur(.25px)}
.family-tv[data-effect=tube] .tv-lines{opacity:.55;background:repeating-linear-gradient(0deg,#0000004d 0 1px,transparent 1px 3px),linear-gradient(0deg,transparent 0 46%,#ffffff14 50%,transparent 54%) 0 0/100% 300%;animation:tv-roll 9s linear infinite}
@keyframes tv-roll{from{background-position:0 0,0 0}to{background-position:0 0,0 300%}}
/* «Next channel»: a short, soft snow, no flashing. */
.tv-static{background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='turbulence' baseFrequency='1.3' numOctaves='1'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23s)'/%3E%3C/svg%3E")}
.family-tv.tv-switch .tv-static{animation:tv-snow .55s ease-out}
@keyframes tv-snow{0%{opacity:.75}100%{opacity:0}}
@media(prefers-reduced-motion:reduce){.tv-photo{animation:none;transition:opacity .6s}.family-tv[data-effect=tube] .tv-lines{animation:none}.family-tv.tv-switch .tv-static{animation:none}}
/* Narrow: an even thinner frame, the panel as a strip at the bottom. */
@media(max-width:560px){
 .tv-cabinet{grid-template-columns:1fr;padding:6px;gap:6px;border-radius:12px}
 .tv-bezel{padding:3px;border-radius:10px}
 .tv-panel{flex-direction:row;justify-content:center;padding:5px 8px;gap:10px}
 .tv-knob{width:36px;height:36px;flex:none}.tv-keys{flex-direction:row}.tv-key{width:40px;height:32px}.tv-grille{flex:0 0 40px;min-height:16px;height:16px}
}
/* The top of the page with the television: the heading and the birthdays on the left, the television on the right. */
.intro-overview.intro-compact.intro-tv{grid-template-columns:minmax(300px,420px) minmax(0,1fr)!important;grid-template-areas:"copy tv" "stats tv" "stats controls"!important;grid-template-rows:auto auto 1fr;align-items:start;row-gap:10px;padding-top:18px}
.intro-overview.intro-tv .family-tv{grid-area:tv}
.intro-overview.intro-tv .surname-controls{justify-self:end;margin-top:-2px}
/* Upright iPad too (Andrew 19.10): the heading and the birthdays on the left, the television on the right from the very top. */
@media(max-width:1100px){.intro-overview.intro-compact.intro-tv{grid-template-columns:minmax(0,300px) minmax(0,1fr)!important;grid-template-areas:"copy tv" "stats tv" "stats controls"!important;grid-template-rows:auto auto 1fr}}
@media(max-width:700px){.intro-overview.intro-compact.intro-tv{grid-template-columns:minmax(0,1fr)!important;grid-template-areas:"copy" "tv" "controls" "stats"!important;grid-template-rows:none}.intro-overview.intro-tv .family-tv{justify-self:stretch;max-width:none}}
/* The view of the top: small and quiet, a native select (a tap on iPad always lands). */
.hero-pick{display:inline-flex;align-items:center;gap:4px;margin:0;font-size:12px;color:var(--muted)}
.hero-pick select{display:inline-block;width:auto;margin:0;padding:3px 4px;min-height:28px;font-size:12px;color:var(--muted);background:transparent;border:1px solid transparent;border-radius:6px;cursor:pointer}
.hero-pick select:hover,.hero-pick select:focus-visible{border-color:#cfd6c8;color:var(--ink)}
.surname-display-dropdown{display:none!important}
/* The screen fills the cabinet's height when the panel is the taller one (iPad upright). */
.tv-bezel{display:flex;flex-direction:column}
.tv-screen{flex:1 1 auto}
/* «↓ К древу» under the top and «↑ Наверх» floating while the top is out of view (Andrew 19.10). */
.intro-to-tree-button{position:static!important;transform:none!important;display:inline-flex;align-items:center;gap:8px;margin:6px auto 0;padding:9px 18px;border:1px solid #cfd6c8;border-radius:999px;background:#fffefa;color:#365c48;font:600 14px/1.2 system-ui,sans-serif;cursor:pointer;min-height:40px}
.intro-to-tree-button:hover{background:#365c480d}
.intro-family-actions:has(.intro-to-tree-button){display:flex;justify-content:center}
.back-to-top{position:fixed;inset-inline-end:18px;bottom:calc(18px + env(safe-area-inset-bottom));z-index:60;display:inline-flex;align-items:center;gap:6px;padding:9px 14px;border:1px solid #cfd6c8;border-radius:999px;background:#fffefaee;color:#365c48;font:600 13px/1.2 system-ui,sans-serif;box-shadow:0 6px 18px #24342b26;cursor:pointer;min-height:40px}
.back-to-top[hidden]{display:none}
.intro-to-tree-button:focus-visible,.back-to-top:focus-visible{outline:2px solid #365c48;outline-offset:2px}
/* /m/: «📺 ТВ» beside the search (the full words where they fit). */
.m-search-row{display:flex;gap:8px;margin:14px 16px 0}
.m-search-row .m-search-entry{margin:0;width:auto;flex:1;min-width:0}
.m-tv-open{flex:none;display:inline-flex;align-items:center;gap:6px;min-height:52px;padding:0 14px;border-radius:14px;border:1px solid var(--tint-line);background:var(--tint);color:var(--ink);font:inherit;font-weight:700;font-size:1rem;cursor:pointer}
.m-tv-long{display:none}
@media(min-width:520px){.m-tv-short{display:none}.m-tv-long{display:inline}}
/* The television over the page: the phone upright at the top over a darkened page, an iPad upright large in the centre,
   any device lying down full screen; «✕ Скрыть ТВ» large beside it. */
.tv-layer-open,.tv-layer-open body{overflow:hidden}
.tv-layer{position:fixed;inset:0;z-index:2147482000;display:flex;justify-content:center;align-items:flex-start;overflow:auto;background:#0b0d0bd9;
 padding:max(10px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left))}
.tv-layer-box{width:100%;max-width:760px;display:flex;flex-direction:column;align-items:center;gap:14px}
.tv-layer-host{width:100%}
.tv-layer .family-tv{max-width:none;width:100%}
.tv-layer .tv-screen{max-height:none}
.tv-hide{min-height:48px;padding:10px 22px;border:0;border-radius:999px;background:#fffefa;color:#1f2a22;font:700 17px/1.2 system-ui,sans-serif;box-shadow:0 4px 14px #0006;cursor:pointer}
.tv-hide:focus-visible{outline:3px solid #e6c98f;outline-offset:3px}
@media(orientation:portrait) and (min-width:700px){.tv-layer{align-items:center}.tv-layer-box{max-width:min(86vw,820px)}}
@media(orientation:landscape){
 .tv-layer{align-items:center;padding:6px max(6px,env(safe-area-inset-right)) 6px max(6px,env(safe-area-inset-left))}
 .tv-layer-box{width:auto;max-width:none;flex-direction:row;align-items:flex-start;gap:10px}
 .tv-layer-host{width:auto}
 .tv-layer .family-tv{width:min(calc((100dvh - 40px) * 1.3333 + 100px),calc(100vw - 250px))}
 .tv-hide{flex:none;white-space:nowrap;max-width:200px}
}
/* The full screen: the cabinet with its keys over the whole screen, the photo large (turning the device follows). */
.tv-full-open,.tv-full-open body{overflow:hidden}
.family-tv.tv-full{position:fixed;inset:0;justify-self:stretch;align-self:stretch;z-index:2147482500;max-width:none!important;width:auto!important;margin:0;display:flex;align-items:center;justify-content:center;background:#050605;
 padding:max(6px,env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left))}
.family-tv.tv-full .tv-cabinet{width:min(100%,calc((100dvh - 40px) * 1.3333 + 100px));flex:none}
.family-tv.tv-full .tv-screen{max-height:none}
@media(orientation:portrait){.family-tv.tv-full .tv-cabinet{width:100%}}
.family-tv.tv-full .tv-full-btn{width:44px;height:44px;font-size:22px;line-height:44px;opacity:.9}
/* In the full screen a tap or click shows or hides the keys, ✕ and the name (as the photo sites' viewer). */
.family-tv.tv-full .tv-panel,.family-tv.tv-full .tv-full-btn,.family-tv.tv-full .tv-caption{transition:opacity .25s ease}
.family-tv.tv-full.tv-bare .tv-panel,.family-tv.tv-full.tv-bare .tv-full-btn,.family-tv.tv-full.tv-bare .tv-caption{opacity:0;pointer-events:none}
/* Tuning a channel: a soft, slowly breathing snow and a line of text; never an empty tube, no flashing. */
.family-tv.tv-tuning .tv-static{opacity:.5;animation:tv-tune 2.4s ease-in-out infinite alternate}
@keyframes tv-tune{from{opacity:.35}to{opacity:.6}}
.family-tv.tv-tuning .tv-caption{cursor:default}.family-tv.tv-tuning .tv-caption:hover{text-decoration:none}
@media(prefers-reduced-motion:reduce){.family-tv.tv-tuning .tv-static{animation:none}}
/* The name is a button (Andrew 19.10): a dark, rounded pill with a person icon and an arrow, at least 36 px high. */
.tv-caption{display:inline-flex;align-items:center;gap:8px;background:#000000a6;border-radius:999px;padding:8px 16px;min-height:38px;max-width:86%;box-shadow:0 2px 10px #0006;text-shadow:none}
.tv-caption .tv-cap-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tv-caption .tv-cap-arrow{font-size:1.25em;line-height:1;opacity:.85}
.tv-caption:hover,.tv-caption:focus-visible{background:#000000cc;text-decoration:none}.tv-caption:hover .tv-cap-name{text-decoration:underline}
.family-tv.tv-tuning .tv-caption{background:transparent;box-shadow:none}
/* The full screen: the whole photo (no cut faces), a gentler drift. */
.family-tv.tv-full .tv-photo{inset:0;width:100%;height:100%;object-fit:contain;background:#050605;animation-name:tv-drift-soft}
@keyframes tv-drift-soft{from{transform:scale(1)}to{transform:scale(1.03)}}
/* Upright full screen: the cabinet fills the height and the screen grows with it (the whole photo stays inside). */
@media(orientation:portrait){.family-tv.tv-full .tv-cabinet{height:calc(100dvh - 24px);grid-template-rows:minmax(0,1fr)}.family-tv.tv-full .tv-bezel{min-height:0}.family-tv.tv-full .tv-screen{aspect-ratio:auto;height:100%;max-height:none}}
/* «Вверху: Телевизор / Овалы / Ничего» in one place in all three (Andrew 23.10): the top right corner of the block, a line of its
   own above the television and the birthdays; «Стоп» keeps its place even where it is not needed, so the switch never moves. */
@media (min-width:701px){
 .intro-overview{position:relative}
 .intro-overview .surname-controls{position:absolute!important;grid-area:auto!important;inset-block-start:6px!important;inset-inline-end:0!important;z-index:6}
 .intro-overview.intro-compact{padding-top:46px!important}
 .intro-overview.intro-compact .surname-controls .surname-motion{display:inline-flex!important;visibility:hidden}
}
/* «Наверх» (the audit 24.10): not under an open window, where it cannot be pressed (T4), and not over the guest's hint (T3). */
body:has(dialog[open]) .back-to-top,body:has(> .guest-hint) .back-to-top{display:none}
/* «Мобильная версия» on a tablet (the audit 24.10, T7): away while the television fills the screen. */
html.tv-layer-open .ui-mobile-link,html.tv-full-open .ui-mobile-link{display:none!important}
/* Andrew 24.10: on a wide screen «↓ К древу» at the end of the tabs' row; the row under the television goes (about 24px left). */
.tabs .intro-to-tree-button{flex:none;margin:0;margin-inline-start:auto;align-self:center;min-height:36px;padding:6px 16px;white-space:nowrap}
/* Andrew 25.10: in the tabs' row it must not look like a tab — an accent pill, a bolder arrow (.tabs button took its border and ground). */
.tabs button.intro-to-tree-button{display:inline-flex;align-items:center;gap:8px;border:1px solid #b7cdb2;border-radius:999px;background:#e8f0e2;color:var(--green);font-weight:700;font-size:14px}
.tabs button.intro-to-tree-button:hover{background:#dbe8d3}
.tabs button.intro-to-tree-button>span[aria-hidden]{font-size:19px;font-weight:800;line-height:1}
.intro.intro-carry .intro-family-actions:empty{display:none}
.intro.intro-carry .intro-overview.intro-tv{padding-bottom:14px}
