/* Телескоп QSTiUM. Лицензия: GNU AGPL-3.0, см. telescope.html.
   Страница всегда тёмная: глаза привыкают к ночному небу. */
:root {
	--bg: #05070f;
	--panel: rgba(16, 21, 38, 0.86);
	--panel-solid: #101526;
	--line: rgba(255, 255, 255, 0.14);
	--text: #eef1f8;
	--muted: #a4adc2;
	--accent: #8ab4ff;
	--accent-ink: #07101f;
	--error: #ffb4a8;
	--gutter: max(0.75em, env(safe-area-inset-left));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; background: var(--bg); }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }

#sky { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#nightFilter { position: fixed; inset: 0; z-index: 40; pointer-events: none; background: #ff2200; mix-blend-mode: multiply; visibility: hidden; }
body.night #nightFilter { visibility: visible; }

.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.round { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 2.75em; height: 2.75em; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.round--small { width: 2.5em; height: 2.5em; }
.round--flat { border: none; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }

#loader { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1em; padding: 1.5em; text-align: center; background: var(--bg); }
#loader p { margin: 0; max-width: 22em; color: var(--muted); }
.loader__star { width: 1em; height: 1em; border-radius: 50%; background: var(--text); box-shadow: 0 0 1.5em 0.4em var(--accent); animation: звезда 1.6s ease-in-out infinite; }
@keyframes звезда { 50% { transform: scale(0.45); opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .loader__star { animation: none; } }

/* Слева оставлено место под кнопку «назад» приложения, которая лежит поверх окна */
#topBar { position: fixed; z-index: 20; top: max(0.75em, env(safe-area-inset-top)); left: var(--gutter); right: max(0.75em, env(safe-area-inset-right)); display: flex; flex-wrap: wrap; gap: 0.5em; }
#topBar { left: calc(var(--gutter) + 3.25em); }
#homeLink { position: fixed; z-index: 21; top: max(0.75em, env(safe-area-inset-top)); left: var(--gutter); color: inherit; }
#searchForm { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 0.4em; height: 2.75em; padding: 0 0.25em 0 0.8em; border: 1px solid var(--line); border-radius: 1.4em; background: var(--panel); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#searchInput { flex: 1; min-width: 0; height: 100%; border: none; outline: none; background: transparent; appearance: none; -webkit-appearance: none; }
#searchInput::-webkit-search-cancel-button { display: none; }
#searchInput::placeholder { color: var(--muted); }
#searchClear { width: 2.25em; height: 2.25em; }
#searchResults { flex: 1 0 100%; max-height: 55dvh; margin: 0; padding: 0.3em; overflow-y: auto; overscroll-behavior: contain; list-style: none; border: 1px solid var(--line); border-radius: 1em; background: var(--panel-solid); }
#searchResults { margin-left: -3.25em; flex-basis: calc(100% + 3.25em); }
#searchResults button { display: flex; flex-direction: column; width: 100%; min-height: 3em; padding: 0.45em 0.7em; text-align: left; border: none; border-radius: 0.7em; background: transparent; }
#searchResults button:hover, #searchResults button:focus-visible { background: rgba(255, 255, 255, 0.08); }
#searchResults small { color: var(--muted); }
#searchResults .empty { padding: 0.8em; color: var(--muted); }

#zoomBox { position: fixed; z-index: 15; right: max(0.75em, env(safe-area-inset-right)); top: 42%; display: flex; flex-direction: column; gap: 0.5em; }

#bottomBar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 0.5em; padding: 0.5em 0 max(0.6em, env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(5, 7, 15, 0.9) 45%, transparent); pointer-events: none; }
#bottomBar > * { pointer-events: auto; }
#timeRow { display: flex; align-items: center; justify-content: center; gap: 0.5em; padding: 0 var(--gutter); }
#timeLabel { display: flex; flex-direction: column; align-items: center; flex: 0 1 15em; min-width: 0; min-height: 2.75em; padding: 0.2em 1em; border: 1px solid var(--line); border-radius: 1.4em; background: var(--panel); }
#timeValue { font-weight: 600; white-space: nowrap; }
#placeValue { max-width: 100%; overflow: hidden; font-size: 0.78em; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
#layers { display: flex; gap: 0.35em; padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; justify-content: safe center; }
#layers::-webkit-scrollbar { display: none; }
.layer { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15em; flex: none; min-width: 4.8em; min-height: 3.5em; padding: 0.35em 0.6em; font-size: 0.82em; white-space: nowrap; line-height: 1.15; color: var(--muted); border: 1px solid transparent; border-radius: 0.9em; background: var(--panel); }
.layer[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); }

.sheet { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; max-height: 72dvh; margin: 0 auto; max-width: 40em; padding: 1em max(1em, env(safe-area-inset-right)) max(1em, env(safe-area-inset-bottom)) max(1em, env(safe-area-inset-left)); overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-bottom: none; border-radius: 1.2em 1.2em 0 0; background: var(--panel-solid); }
#objectCard { max-height: 46dvh; padding-bottom: 0; }
.sheet__action { position: sticky; bottom: 0; margin: 0 -0.2em; padding: 0.6em 0.2em max(0.8em, env(safe-area-inset-bottom)); background: var(--panel-solid); }
.sheet h2 { margin: 0 2.5em 0.15em 0; font-size: 1.25em; line-height: 1.25; overflow-wrap: anywhere; }
.sheet__second { margin-top: 1.4em !important; }
.sheet__muted { margin: 0 0 0.7em; color: var(--muted); }
.sheet__error { margin: 0.5em 0 0; color: var(--error); }
.sheet__ok { margin: 0.5em 0 0; color: var(--accent); }
/* Тела, на которые движок неба навести не может: сразу в 3D */
.surface-bodies { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4em; margin: 0.8em 0 0.2em; }
.surface-bodies span { flex-basis: 100%; font-size: 0.85em; color: var(--muted); }
.surface-bodies button { min-height: 2.75em; padding: 0.2em 1em; color: var(--text); border: 1px solid var(--glass-border); border-radius: 1.4em; background: var(--glass-small); }
.sheet__close { position: absolute; top: 0.45em; right: 0.45em; }
.sheet p { overflow-wrap: anywhere; }
#objectFacts { display: grid; grid-template-columns: auto 1fr; gap: 0.25em 1em; margin: 0 0 0.8em; }
#objectFacts dt { color: var(--muted); }
#objectFacts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
#objectAbout { margin: 0 0 0.4em; }
#objectAbout:empty { display: none; }
#objectLink { display: inline-block; margin-bottom: 0.8em; }

.btn { display: flex; align-items: center; justify-content: center; flex: 1 1 0; min-width: 0; min-height: 2.9em; margin: 0; padding: 0.4em 0.6em; border: 1px solid var(--line); border-radius: 0.8em; background: transparent; }
.btn--main { border-color: transparent; color: var(--accent-ink); background: var(--accent); font-weight: 600; }
#placeDetect, #placeApply, #viewShare { width: 100%; }
#viewShare { margin-top: 0.6em; }
.sheet__action { display: flex; gap: 0.5em; align-items: center; }
#viewOptions { display: flex; flex-direction: column; }
.option { display: flex; align-items: center; justify-content: space-between; gap: 1em; min-height: 2.9em; cursor: pointer; }
.option input { width: 1.3em; height: 1.3em; flex: none; margin: 0; accent-color: var(--accent); }
.btn-row { display: flex; gap: 0.5em; margin-top: 0.6em; }
.field-col { flex: 1 1 0; min-width: 0; }
.field-label { display: block; margin: 0.8em 0 0.25em; color: var(--muted); font-size: 0.9em; }
.field { display: block; width: 100%; min-height: 2.9em; padding: 0.4em 0.7em; border: 1px solid var(--line); border-radius: 0.8em; background: rgba(255, 255, 255, 0.06); color-scheme: dark; }
#placeApply { margin-top: 0.6em; }
.credits { font-size: 0.82em; color: var(--muted); }
#aboutCredits summary { min-height: 2.75em; padding: 0.6em 0; cursor: pointer; }

#note { position: fixed; z-index: 35; left: 50%; bottom: 11em; transform: translateX(-50%); max-width: calc(100% - 2em); padding: 0.5em 1em; text-align: center; border-radius: 1em; background: var(--panel-solid); border: 1px solid var(--line); }

/* === Правки после критики дизайнера === */
:root { color-scheme: dark; }
.layer[aria-pressed="true"] { color: #d6e4ff; background: rgba(138, 180, 255, 0.22); border-color: rgba(138, 180, 255, 0.55); }
.sheet__close { position: sticky; top: 0.25em; float: right; z-index: 2; margin: -0.55em -0.55em 0 0.5em; background: var(--panel-solid); }
.sheet__action::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 1.5em; background: linear-gradient(to top, var(--panel-solid), transparent); pointer-events: none; }
#searchResults { max-height: 42dvh; }
.round--small { width: 2.75em; height: 2.75em; }
#searchClear { width: 2.75em; height: 2.75em; margin-right: -0.25em; }
#objectLink, #settingsSheet p a { display: inline-flex; align-items: center; min-height: 2.75em; }
.step { font-size: 0.72em; line-height: 1.05; text-align: center; }
#placeCustom summary { min-height: 2.75em; padding: 0.6em 0; cursor: pointer; }
@media (max-width: 22.5em) { #timeLabel { padding-inline: 0.5em; } }
@media (orientation: portrait) { #zoomBox { top: auto; bottom: calc(max(0.6em, env(safe-area-inset-bottom)) + 8.2em); } }

/* Красный фильтр умножает цвета: чтобы текст читался, под ним всё светлое */
body.night { --muted: #fff; --text: #fff; --accent: #fff; --accent-ink: #000; --line: rgba(255, 255, 255, 0.35); }
body.night .layer[aria-pressed="true"] { color: #fff; background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.7); }

/* Телефон боком: один ряд снизу и лист слева, объект в центре остаётся виден */
@media (orientation: landscape) and (max-height: 30em) {
	#bottomBar { flex-direction: row; align-items: center; padding-left: var(--gutter); padding-right: max(0.75em, env(safe-area-inset-right)); }
	#timeRow { flex: none; padding: 0; }
	#timeLabel { flex: 0 0 12.5em; }
	#layers { flex: 1 1 0; min-width: 0; padding: 0; justify-content: flex-start; }
	#searchForm { flex: 0 1 22em; }
	#openSettings { margin-left: auto; }
	#searchResults { max-width: 25.25em; max-height: calc(100dvh - 5em); }
	#zoomBox { top: auto; bottom: 5em; }
	.sheet, #objectCard { left: var(--gutter); right: auto; top: 4em; bottom: 0.75em; width: 22em; max-height: none; margin: 0; border: 1px solid var(--line); border-radius: 1.2em; }
}

/* === Матовое стекло, как в атласе: небо просвечивает сквозь весь интерфейс === */
:root {
	--glass-small: rgba(10, 13, 24, 0.5);
	--glass-sheet: rgba(10, 13, 24, 0.66);
	--glass-border: rgba(255, 255, 255, 0.16);
	--glass-blur: blur(14px) saturate(130%);
	--muted: #c8cfe0;
}
.round, #searchForm, #timeLabel, .layer, #note, #searchResults, .sheet, .sheet__action {
	-webkit-backdrop-filter: var(--glass-blur);
	backdrop-filter: var(--glass-blur);
}
.round, #searchForm, #timeLabel, .layer, #note {
	background: var(--glass-small);
	border: 1px solid var(--glass-border);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.sheet, #searchResults {
	background: var(--glass-sheet);
	border-color: var(--glass-border);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
}
.round--flat, #searchClear, .sheet__close { background: transparent; border: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.layer[aria-pressed="true"] { color: #e6eeff; background: rgba(138, 180, 255, 0.3); border-color: rgba(138, 180, 255, 0.65); }
#bottomBar { background: none; }
/* Текст карточки уезжает под кнопку: здесь стекло плотное, иначе буквы мешают читать */
.sheet__action { background: rgba(10, 13, 24, 0.92); border-radius: 0.8em 0.8em 0 0; }
body.night .sheet__action { background: #000; }
.sheet__action::before { content: none; }
.field { background: rgba(255, 255, 255, 0.08); border-color: var(--glass-border); }
.btn { border-color: var(--glass-border); }
.btn--main { color: #e6eeff; background: rgba(138, 180, 255, 0.34); border: 1px solid rgba(138, 180, 255, 0.65); }
#loader { background: var(--bg); }

/* Кому прозрачность мешает или браузер не умеет размывать, тому плотные панели */
@media (prefers-reduced-transparency: reduce) {
	:root { --glass-small: rgba(10, 13, 24, 0.92); --glass-sheet: rgba(10, 13, 24, 0.96); }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	:root { --glass-small: rgba(10, 13, 24, 0.88); --glass-sheet: rgba(10, 13, 24, 0.94); }
}

body.night { --glass-border: rgba(255, 255, 255, 0.35); }
body.night .layer[aria-pressed="true"], body.night .btn--main { color: #fff; background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.7); }

/* === Колесо зума, как в микроскопе === */
.zoom-wheel { position: fixed; z-index: 15; right: max(0.75em, env(safe-area-inset-right)); bottom: calc(max(0.6em, env(safe-area-inset-bottom)) + 8.6em); width: 1.75em; height: min(26dvh, 12em); border: 1px solid var(--glass-border); border-radius: 0.9em; background: var(--glass-small); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); touch-action: none; cursor: ns-resize; }
.zoom-wheel::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.3) 0 1.5px, transparent 1.5px 11px); background-size: 11px 11px; background-repeat: repeat-y; background-position-x: center; background-position-y: var(--tick-y, 0px); -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%); pointer-events: none; }
/* Долгое нажатие: колесо можно перетащить куда угодно */
.zoom-wheel.moving { border-color: var(--accent); box-shadow: 0 0 0 0.25em rgba(138, 180, 255, 0.25); cursor: grabbing; transform: scale(1.08); transition: transform 0.12s ease; }
.zoom-wheel.dragging::before { background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.6) 0 1.5px, transparent 1.5px 11px); }
#objectSurface { width: 100%; margin-bottom: 0.6em; }
@media (orientation: landscape) and (max-height: 30em) { .zoom-wheel { bottom: 5em; height: 32dvh; } }

/* === Снимки Хаббла и Уэбба === */
#objectPhotos { margin: 0 0 0.9em; }
#objectPhotos h3 { margin: 0 0 0.4em; font-size: 0.9em; font-weight: 600; color: var(--muted); }
#objectPhotosRow { display: flex; gap: 0.5em; overflow-x: auto; scrollbar-width: none; margin: 0 -1em; padding: 0 1em; overscroll-behavior-x: contain; }
#objectPhotosRow::-webkit-scrollbar { display: none; }
.photo-thumb { position: relative; flex: none; width: 6.5em; height: 6.5em; margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--glass-border); border-radius: 0.8em; background: rgba(0, 0, 0, 0.4); }
.photo-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-thumb span { position: absolute; left: 0.3em; bottom: 0.3em; padding: 0.05em 0.45em; font-size: 0.72em; border-radius: 0.6em; background: var(--glass-small); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
#photoViewer { position: fixed; inset: 0; z-index: 45; background: #000; }
#photoCanvas { position: absolute; inset: 0; }
#photoHead { position: absolute; z-index: 2; top: max(0.75em, env(safe-area-inset-top)); left: var(--gutter); right: max(0.75em, env(safe-area-inset-right)); display: flex; gap: 0.5em; align-items: stretch; }
body.embedded #photoHead { left: calc(var(--gutter) + 3.25em); }
#photoTitleBox { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; min-height: 2.75em; padding: 0.25em 0.9em; border: 1px solid var(--glass-border); border-radius: 1.4em; background: var(--glass-small); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
#photoTitle { overflow: hidden; font-weight: 600; line-height: 1.2; white-space: nowrap; text-overflow: ellipsis; }
#photoInfo { color: var(--muted); }
#photoCredit { position: absolute; z-index: 2; left: var(--gutter); right: 3.4em; bottom: max(0.5em, env(safe-area-inset-bottom)); margin: 0; padding: 0.35em 0.7em; font-size: 0.78em; border-radius: 0.8em; background: var(--glass-small); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
#photoLink { color: var(--text); }
#photoWheel { position: absolute; z-index: 2; bottom: max(1em, env(safe-area-inset-bottom)); }

/* === Снимки Хаббла и Уэбба прямо на небе === */
#skyPhotos { position: fixed; top: 0; left: 0; z-index: 1; opacity: 0; pointer-events: none; }
#skyPhotoCredit { position: fixed; z-index: 16; left: var(--gutter); right: 3.4em; bottom: calc(max(0.6em, env(safe-area-inset-bottom)) + 11.6em); margin: 0; padding: 0.3em 0.7em; overflow: hidden; font-size: 0.72em; border: 1px solid var(--glass-border); border-radius: 0.8em; white-space: nowrap; text-overflow: ellipsis; background: var(--glass-small); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
#skyPhotoLink { color: var(--text); }
@media (orientation: landscape) and (max-height: 30em) { #skyPhotoCredit { bottom: 7.4em; } }

/* Подпись снимка на небе с переключением: шрифт обычный, мелкий только у самого текста */
#skyPhotoCredit { display: flex; align-items: center; gap: 0.2em; bottom: calc(max(0.6em, env(safe-area-inset-bottom)) + 8.3em); min-height: 2.75em; padding: 0 0.15em 0 0.4em; font-size: 1em; }
#skyPhotoLink { flex: 1; min-width: 0; overflow: hidden; font-size: 0.72em; line-height: 1.2; white-space: nowrap; text-overflow: ellipsis; }
#skyPhotoCount { flex: none; font-size: 0.78em; color: var(--muted); font-variant-numeric: tabular-nums; }
#skyPhotoCredit .round { width: 2.75em; height: 2.75em; }
@media (orientation: landscape) and (max-height: 30em) { #skyPhotoCredit { bottom: 5.2em; } }

/* === Выбор снимка на небе === */
#skyPhotos { mix-blend-mode: lighten; }
#skyPhotoPanel { position: fixed; z-index: 16; left: var(--gutter); right: 3.4em; bottom: calc(max(0.6em, env(safe-area-inset-bottom)) + 8.3em); display: flex; flex-direction: column; gap: 0.4em; }
#skyPhotoBar { display: flex; align-items: center; gap: 0.5em; min-width: 0; }
#skyPhotoOpen { flex: none; min-height: 2.75em; padding: 0.2em 0.9em; font-size: 0.85em; color: var(--text); border: 1px solid var(--glass-border); border-radius: 1.4em; background: var(--glass-small); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
#skyPhotoLink { flex: 1; min-width: 0; overflow: hidden; font-size: 0.72em; line-height: 1.25; color: var(--text); white-space: nowrap; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
#skyPhotoStrip { display: flex; gap: 0.4em; padding: 0.4em; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; border: 1px solid var(--glass-border); border-radius: 1em; background: var(--glass-sheet); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
#skyPhotoStrip::-webkit-scrollbar { display: none; }
.sky-thumb { flex: none; width: 4.2em; height: 4.2em; margin: 0; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 0.7em; background: rgba(0, 0, 0, 0.4); }
.sky-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sky-thumb--none { font-size: 0.72em; line-height: 1.15; color: var(--text); width: 5.8em; height: 5.8em; }
.sky-thumb[aria-pressed="true"] { border-color: var(--accent); }
.sheet__action { background: #0a0d18; }
body.night .sheet__action { background: #000; }
@media (orientation: landscape) and (max-height: 30em) { #skyPhotoPanel { bottom: 5em; right: 3.4em; } }

/* Выбранный снимок: панель свёрнута в одну кнопку и одну строку подписи. Автор идёт первым, полная подпись — по ссылке на страницу снимка */
#skyPhotoBar { flex-wrap: wrap; gap: 0.25em 0.5em; }
#skyPhotoLink { flex-basis: 100%; }
#skyPhotoOpen { display: inline-flex; align-items: center; gap: 0.5em; }
#skyPhotoOpen::after { content: ""; width: 0.45em; height: 0.45em; margin-left: 0.1em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(0.1em) rotate(-135deg); }
#skyPhotoOpen[aria-expanded="true"]::after { transform: translateY(-0.1em) rotate(45deg); }
#skyPhotoOpen:disabled::after { display: none; }
#skyPhotoOpen img { width: 1.9em; height: 1.9em; margin-left: -0.45em; border-radius: 50%; object-fit: cover; }
/* Поверхность заранее готовится в этом окне; показывается поверх неба */
#surfaceFrame { position: fixed; inset: 0; z-index: 60; width: 100%; height: 100%; border: 0; visibility: hidden; opacity: 0; pointer-events: none; background: transparent; color-scheme: dark; }
#surfaceFrame.shown { visibility: visible; }
#surfaceFrame.on { pointer-events: auto; }
/* Пока шар проступает, оформление неба растворяется вместе с ним; звёзды и само тело остаются */
body.to-3d > :not(#sky):not(#skyPhotos):not(#nightFilter):not(#surfaceFrame) { opacity: var(--ui, 1); }
#note { z-index: 46; }
#nightFilter { z-index: 47; }

/* Город: свой тёмный список вместо белого системного select */
.city-picker { position: relative; }
#placeCitySearch { text-overflow: ellipsis; }
#placeCityList { position: absolute; z-index: 5; top: calc(100% + 0.35em); left: 0; right: 0; max-height: 15em; margin: 0; padding: 0.3em; overflow-y: auto; overscroll-behavior: contain; list-style: none; border: 1px solid var(--glass-border); border-radius: 0.9em; background: var(--panel-solid); box-shadow: 0 0.8em 2em rgba(0, 0, 0, 0.45); }
#placeCityList [role="option"] { display: flex; align-items: center; min-height: 2.75em; padding: 0.5em 0.7em; border-radius: 0.65em; cursor: pointer; }
#placeCityList [role="option"]:hover, #placeCityList [role="option"].active { background: rgba(138, 180, 255, 0.16); }
#placeCityList [role="option"][aria-selected="true"] { color: var(--accent); background: rgba(138, 180, 255, 0.22); }
#placeCityList [role="option"][aria-selected="true"]::after { content: '✓'; margin-left: auto; padding-left: 0.7em; }
#placeCityList .city-list__empty { padding: 0.8em; color: var(--muted); }

/* На ПК есть и колесо (обработчик в JS), и обычная полоса прокрутки */
@media (hover: hover) and (pointer: fine) {
	#objectPhotosRow, #skyPhotoStrip { padding-bottom: 0.5em; scrollbar-width: thin; scrollbar-color: rgba(200, 207, 224, 0.55) transparent; }
	#objectPhotosRow::-webkit-scrollbar, #skyPhotoStrip::-webkit-scrollbar { display: block; height: 0.35em; }
	#objectPhotosRow::-webkit-scrollbar-thumb, #skyPhotoStrip::-webkit-scrollbar-thumb { border-radius: 0.3em; background: rgba(200, 207, 224, 0.55); }
	#objectPhotosRow::-webkit-scrollbar-track, #skyPhotoStrip::-webkit-scrollbar-track { background: transparent; }
}

/* Захват для слежения: плашка под поиском и кольцо вокруг тела, которое небо держит в центре */
#lockChip { position: fixed; z-index: 19; top: calc(max(0.75em, env(safe-area-inset-top)) + 3.7em); left: 50%; transform: translateX(-50%); max-width: calc(100% - 2 * var(--gutter)); display: flex; align-items: center; gap: 0.45em; padding: 0.2em 0.25em 0.2em 0.8em; border-radius: 2em; font-size: 0.9em; background: var(--glass-small); border: 1px solid var(--accent); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); color: var(--text); }
#lockChip[hidden] { display: none; }
#lockName { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lockOff { width: 2.2em; height: 2.2em; flex: none; }
.lock-chip__dot { width: 0.6em; height: 0.6em; flex: none; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0.2em rgba(138, 180, 255, 0.25); }
#lockRing { position: fixed; z-index: 2; pointer-events: none; border: 1.5px solid var(--accent); border-radius: 50%; box-shadow: 0 0 0.6em rgba(138, 180, 255, 0.45); animation: lock-ring 2.4s ease-in-out infinite; }
#lockRing[hidden] { display: none; }
@keyframes lock-ring { 0%, 100% { opacity: 0.95; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { #lockRing { animation: none; } }
body.to-3d #lockChip, body.to-3d #lockRing { display: none; }

/* === Нижняя панель: время на виду, слои ровной сеткой, подсказки (владелец 20.11.2026: «неудобно, некрасиво;
   непонятно, почему объект движется и как остановить; онбординг слабый») === */
#bottomBar { gap: 0.45em; }
#timeRow { gap: 0.45em; }
.time-play { width: 3em; height: 3em; }
.time-play .icon { width: 1.35em; height: 1.35em; }
.time-play .icon--play { display: none; fill: currentColor; }
.time-play[aria-pressed="true"] .icon--pause { display: none; }
.time-play[aria-pressed="true"] .icon--play { display: block; }
/* Время стоит — кнопка «пуск» заметнее: к ней и вернутся */
.time-play[aria-pressed="true"] { color: #ffe08a; border-color: rgba(255, 224, 138, 0.55); }
#timeLabel { flex: 0 1 17.5em; min-height: 3em; padding: 0.25em 1em; }
#timeState { display: flex; align-items: center; justify-content: center; gap: 0.35em; max-width: 100%; min-width: 0; font-size: 0.76em; color: var(--muted); white-space: nowrap; }
#timeStateText { flex: none; }
#timeState #placeValue { flex: 0 1 auto; min-width: 0; font-size: 1em; overflow: hidden; text-overflow: ellipsis; }
#timeState #placeValue::before { content: '· '; }
.time-dot { flex: none; width: 0.5em; height: 0.5em; border-radius: 50%; background: #5ee38a; box-shadow: 0 0 0.45em rgba(94, 227, 138, 0.8); animation: время-идёт 2s ease-in-out infinite; }
#bottomBar[data-time="stopped"] .time-dot { background: #ffe08a; box-shadow: none; animation: none; border-radius: 0.1em; }
#bottomBar[data-time="shifted"] .time-dot { background: var(--accent); box-shadow: none; animation: none; }
@keyframes время-идёт { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .time-dot { animation: none; } }
#timeNowBtn { width: 3em; height: 3em; color: var(--accent); }

/* Пять кнопок ровной сеткой: четыре главных слоя и «Ещё» — без ленты вбок */
#layers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.35em; width: 100%; max-width: 30em; margin: 0 auto; overflow: visible; }
#layers .layer { min-width: 0; min-height: 3.4em; padding: 0.4em 0.15em; font-size: 0.74em; white-space: normal; text-align: center; overflow-wrap: anywhere; }
.layer--more { color: var(--text); }
.layers-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5em; margin-top: 0.8em; }
.layers-grid .layer { min-width: 0; min-height: 4.4em; font-size: 0.86em; white-space: normal; text-align: center; }

/* Почему уплывает — плашка над временем (или под поиском, когда снизу карточка объекта); место ставит скрипт */
#driftHint { position: fixed; z-index: 35; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; gap: 0.5em; width: calc(100% - 2 * var(--gutter)); max-width: 30em; margin: 0; padding: 0.7em 2.6em 0.7em 0.9em; border: 1px solid var(--glass-border); border-radius: 1.1em; background: var(--glass-sheet); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
#driftHint p { flex: 1 1 100%; margin: 0; font-size: 0.88em; line-height: 1.35; }
.drift-actions { display: flex; gap: 0.5em; width: 100%; }
.drift-actions .btn { min-height: 2.6em; font-size: 0.9em; }
#driftClose { position: absolute; top: 0.2em; right: 0.2em; width: 2.4em; height: 2.4em; }

/* Подсказки при первом входе: затемнение с окном вокруг нужного места и карточка рядом */
#coach { position: fixed; inset: 0; z-index: 60; }
.coach__hole { position: fixed; border-radius: 1.3em; box-shadow: 0 0 0 200vmax rgba(3, 5, 12, 0.74); transition: left 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease; pointer-events: none; }
#coach.coach--center .coach__hole { box-shadow: 0 0 0 200vmax rgba(3, 5, 12, 0.6); }
.coach__card { position: fixed; left: var(--gutter); right: max(0.75em, env(safe-area-inset-right)); max-width: 24em; margin: 0 auto; padding: 1em 1.1em 0.9em; border: 1px solid var(--glass-border); border-radius: 1.2em; background: rgba(12, 16, 30, 0.97); box-shadow: 0 1em 2.5em rgba(0, 0, 0, 0.5); }
#coach.coach--center .coach__card { top: 50%; transform: translateY(-50%); }
.coach__step { font-size: 0.75em; letter-spacing: 0.06em; color: var(--accent); }
.coach__title { margin: 0.15em 0 0.35em; font-size: 1.15em; }
.coach__text { margin: 0 0 0.9em; color: var(--muted); line-height: 1.45; }
.coach__actions { display: flex; gap: 0.5em; }
@media (prefers-reduced-motion: reduce) { .coach__hole { transition: none; } }

/* Телефон боком: время и слои в одну строку */
@media (orientation: landscape) and (max-height: 30em) {
	#layers { display: flex; max-width: none; margin: 0; }
	#layers .layer { flex: 1 1 0; }
}
