/* Страница «Ven4verse» — вселенная Венчика. Шапка и переменные — из общего файла облика
   (look.css или scene.css); сама страница — ночной космос и в светлом виде сайта, это небо,
   а не карточка. Первый экран под шапкой — космос целиком: звёзды на всю ширину, солнце и
   планеты квадратом по центру, текст слева поверх неба. На узком экране — столбиком. */
body.v4v-page {
    --v4v-void: #05080f;
    --v4v-ink: #e6ebf3;
    --v4v-mute: #8b9cb3;
    --v4v-line: rgba(139, 156, 179, .18);
    --v4v-soft: #4ade80;
    --v4v-game: #f5b04a;
    --v4v-media: #7cc7ff;
    --v4v-card: rgba(10, 18, 32, .94);
    --v4v-display: 'Unbounded', 'Segoe UI', system-ui, sans-serif;
    --v4v-body: 'Onest', 'Segoe UI', system-ui, sans-serif;
    --v4v-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
    background: var(--v4v-void);
    color: var(--v4v-ink);
}
html:has(body.v4v-page), body.v4v-page { overflow: auto; overflow-x: hidden; height: auto; min-height: 100%; }
.v4v-main { padding-top: var(--v4v-top, 72px); }

/* ---------- первый экран: космос ---------- */
.v4v-space {
    position: relative;
    scroll-margin-top: var(--v4v-top, 72px); /* при прокрутке к зуму шапка не закрывает планету */
    height: calc(100vh - var(--v4v-top, 72px));
    height: calc(100dvh - var(--v4v-top, 72px));
    min-height: 560px;
    overflow: hidden;
    background:
        radial-gradient(55% 60% at 50% 50%, rgba(74, 222, 128, .07), transparent 70%),
        radial-gradient(60% 50% at 100% 0%, rgba(124, 199, 255, .06), transparent 60%),
        radial-gradient(50% 50% at 0% 100%, rgba(245, 176, 74, .04), transparent 60%),
        var(--v4v-void);
    user-select: none;
    -webkit-user-select: none;
}
.v4v-stars { position: absolute; inset: 0; width: 100%; height: 100%; }

.v4v-sky {
    position: absolute; left: 50%; top: 50%;
    width: min(calc(100vh - var(--v4v-top, 72px) - 24px), calc(100% - 24px));
    width: min(calc(100dvh - var(--v4v-top, 72px) - 24px), calc(100% - 24px));
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
}
.v4v-sky > svg, .v4v-sky > canvas { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.v4v-sky > canvas { pointer-events: none; }

.v4v-intro {
    position: absolute; z-index: 3; left: max(32px, env(safe-area-inset-left, 0px)); top: 32px;
    width: min(330px, calc(50% - 300px));
    display: grid; gap: 10px;
    user-select: text; -webkit-user-select: text;
}
.v4v-badge {
    justify-self: start; font-family: var(--v4v-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
    color: var(--v4v-soft); border: 1px solid rgba(74, 222, 128, .35); border-radius: 999px; padding: 5px 10px;
}
.v4v-intro h1 {
    font-family: var(--v4v-display); font-weight: 700; font-size: clamp(36px, 4.2vw, 58px); line-height: 1;
    margin: 0; color: var(--v4v-ink); letter-spacing: -.01em;
}
.v4v-intro h1 span { color: var(--v4v-soft); }
.v4v-intro p { margin: 0; font-family: var(--v4v-body); font-size: 15px; line-height: 1.55; color: #c9d2df; }
.v4v-cats { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; font-family: var(--v4v-body); font-size: 14px; color: var(--v4v-mute); }
.v4v-cats i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: -1px; }

.v4v-orbit { fill: none; stroke: var(--v4v-line); stroke-width: 1.2; stroke-dasharray: 2 7; }
.v4v-orbit-label { font-family: var(--v4v-mono); font-size: 13px; letter-spacing: .14em; fill: var(--v4v-mute); text-transform: uppercase; }
.v4v-ray { stroke-width: 1.4; opacity: .28; transition: opacity .25s, stroke-width .25s; }
.v4v-ray.on { opacity: .9; stroke-width: 2.4; }
.v4v-planet { cursor: pointer; outline: none; }
.v4v-planet .body { transition: transform .25s ease; transform-box: fill-box; transform-origin: center; }
.v4v-planet:hover .body, .v4v-planet.on .body, .v4v-planet:focus-visible .body { transform: scale(1.12); }
.v4v-planet .focus { fill: none; stroke: none; }
.v4v-planet:focus-visible .focus { stroke: var(--v4v-ink); stroke-width: 2; stroke-dasharray: 4 4; }
.v4v-planet .name {
    font-family: var(--v4v-body); font-weight: 600; font-size: 15px;
    fill: var(--v4v-ink); paint-order: stroke; stroke: var(--v4v-void); stroke-width: 4px; stroke-linejoin: round;
}
.v4v-sun-glow { animation: v4v-pulse 6s ease-in-out infinite; transform-origin: 500px 500px; }
@keyframes v4v-pulse { 50% { transform: scale(1.05); opacity: .85; } }

/* ---------- «На весь экран» ---------- */
.v4v-fs {
    position: absolute; z-index: 6; top: 20px; right: max(20px, env(safe-area-inset-right, 0px));
    display: inline-flex; align-items: center; gap: 7px;
    font: 600 13px/1 var(--v4v-body);
    color: var(--v4v-ink); background: rgba(10, 18, 32, .72);
    border: 1px solid var(--v4v-line); border-radius: 999px; padding: 9px 13px; cursor: pointer;
}
.v4v-fs:hover { border-color: var(--v4v-soft); }
.v4v-fs:focus-visible { outline: 2px solid var(--v4v-ink); outline-offset: 2px; }
.v4v-fs[hidden] { display: none; }
.v4v-space:fullscreen { height: 100vh; min-height: 0; }
/* на весь экран — только галактика: текст убирается */
.v4v-space:fullscreen .v4v-intro { display: none; }
.v4v-space:fullscreen .v4v-sky { width: min(calc(100vh - 24px), calc(100% - 24px)); }
.v4v-space:fullscreen .v4v-fs { top: calc(20px + env(safe-area-inset-top, 0px)); }

/* ---------- зум на планету ---------- */
.v4v-sky { transition: opacity .7s ease, filter .7s ease; }
.v4v-space.zoom .v4v-sky { opacity: 0; filter: blur(6px); pointer-events: none; }
.v4v-space.zoom .v4v-intro { opacity: 0; pointer-events: none; }
.v4v-intro { transition: opacity .5s ease; }
.v4v-focus { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; }
.v4v-detail {
    position: absolute; z-index: 7; top: 50%; right: max(40px, env(safe-area-inset-right, 0px));
    width: min(520px, 44%); max-height: calc(100% - 64px); overflow-y: auto; overscroll-behavior: contain;
    transform: translate(40px, -50%); opacity: 0; transition: opacity .45s ease, transform .55s cubic-bezier(.2, .8, .2, 1);
    display: grid; gap: 12px; text-align: left; padding: 4px 6px 4px 0;
    user-select: text; -webkit-user-select: text;
}
.v4v-detail[hidden] { display: none; }
.v4v-space.zoom-in .v4v-detail { opacity: 1; transform: translate(0, -50%); }
.v4v-detail .tag { font-family: var(--v4v-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.v4v-detail h2 { font-family: var(--v4v-display); font-weight: 700; font-size: clamp(26px, 2.6vw, 38px); line-height: 1.1; margin: 0; color: var(--v4v-ink); text-wrap: balance; }
.v4v-detail p { margin: 0; font-family: var(--v4v-body); font-size: 15.5px; line-height: 1.6; color: #c9d2df; max-width: 60ch; }
.v4v-back {
    justify-self: start; font: 600 13px/1 var(--v4v-body); color: var(--v4v-ink); cursor: pointer;
    background: rgba(10, 18, 32, .72); border: 1px solid var(--v4v-line); border-radius: 999px; padding: 9px 14px;
}
.v4v-back:hover { border-color: var(--v4v-soft); }
.v4v-back:focus-visible, .v4v-shots button:focus-visible { outline: 2px solid var(--v4v-ink); outline-offset: 2px; }
.v4v-shots { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; scrollbar-color: var(--v4v-line) transparent; }
.v4v-shots button {
    flex: 0 0 auto; padding: 0; border: 1px solid var(--v4v-line); border-radius: 10px; overflow: hidden;
    background: #0a1220; cursor: zoom-in; height: 150px;
}
.v4v-shots img { display: block; height: 100%; width: auto; }
.v4v-shots button:hover { border-color: var(--c, var(--v4v-soft)); }
.v4v-lightbox {
    position: fixed; inset: 0; z-index: 80; background: rgba(3, 5, 10, .88);
    display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top, 0px)) 24px;
    cursor: zoom-out;
}
.v4v-lightbox[hidden] { display: none; }
.v4v-lightbox img { max-width: min(1100px, 100%); max-height: 100%; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.v4v-lightbox .close {
    position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); right: 16px; width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid var(--v4v-line); background: rgba(10, 18, 32, .8); color: var(--v4v-ink); font-size: 22px; cursor: pointer;
}

/* ---------- карточка планеты ---------- */
.v4v-card {
    position: absolute; z-index: 5; width: min(300px, 78%);
    background: var(--v4v-card); color: var(--v4v-ink);
    border: 1px solid var(--v4v-line); border-radius: 14px;
    padding: 16px 16px 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
    display: grid; gap: 8px; text-align: left;
    user-select: text; -webkit-user-select: text;
}
.v4v-card[hidden] { display: none; }
.v4v-card .tag { font-family: var(--v4v-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.v4v-card h2 { font-family: var(--v4v-display); font-weight: 500; font-size: 17px; line-height: 1.25; margin: 0; color: var(--v4v-ink); text-wrap: balance; }
.v4v-card p { margin: 0; font-family: var(--v4v-body); font-size: 14px; line-height: 1.5; color: #c9d2df; }
.v4v-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.v4v-links a {
    color: var(--v4v-void); background: var(--c, var(--v4v-soft)); text-decoration: none;
    font-family: var(--v4v-body); font-weight: 600; font-size: 13px; padding: 6px 11px; border-radius: 999px;
}
.v4v-links a.ghost { background: transparent; color: var(--v4v-ink); box-shadow: inset 0 0 0 1px var(--v4v-line); }
.v4v-links a:hover { filter: brightness(1.1); }
.v4v-links a:focus-visible, .v4v-card .close:focus-visible { outline: 2px solid var(--v4v-ink); outline-offset: 2px; }
.v4v-card .close {
    position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%;
    border: 0; background: transparent; color: var(--v4v-mute); font-size: 18px; cursor: pointer;
}

/* ---------- все планеты списком ---------- */
.v4v-atlas-wrap {
    max-width: 1120px; margin: 0 auto;
    padding: 40px max(24px, env(safe-area-inset-right, 0px)) 64px max(24px, env(safe-area-inset-left, 0px));
    display: grid; gap: 18px;
}
.v4v-atlas-wrap > h2 { font-family: var(--v4v-display); font-weight: 500; font-size: 22px; margin: 0; color: var(--v4v-ink); }
.v4v-atlas { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.v4v-atlas section { display: grid; gap: 8px; min-width: 0; align-content: start; }
.v4v-atlas h3 { margin: 0; font-family: var(--v4v-display); font-weight: 500; font-size: 15px; color: var(--v4v-ink); display: flex; align-items: center; gap: 8px; }
.v4v-atlas h3 i { width: 10px; height: 10px; border-radius: 50%; }
.v4v-atlas ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.v4v-atlas button {
    width: 100%; text-align: left; display: grid; gap: 2px; font-family: var(--v4v-body); font-size: 14px; cursor: pointer;
    background: rgba(255, 255, 255, .03); color: var(--v4v-ink);
    border: 1px solid var(--v4v-line); border-radius: 10px; padding: 10px 12px;
}
.v4v-atlas button:hover, .v4v-atlas button:focus-visible { border-color: var(--c); outline: none; }
.v4v-atlas .t { font-weight: 600; }
.v4v-atlas .d { font-size: 13px; color: var(--v4v-mute); }

/* ---------- узкий экран: текст, небо во всю ширину, список ---------- */
@media (max-width: 1099px), (orientation: portrait) {
    .v4v-space { height: auto; min-height: 0; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 16px; }
    .v4v-space:fullscreen { height: 100vh; display: block; padding: 0; }
    .v4v-intro { position: relative; left: auto; top: auto; width: auto; max-width: 62ch; padding-right: 56px; }
    .v4v-sky { position: relative; left: auto; top: auto; transform: none; width: 100%; max-width: 720px; justify-self: center; aspect-ratio: auto; }
    .v4v-sky > #v4v-sky { position: relative; display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; }
    .v4v-sky > #v4v-bodies, .v4v-sky > #v4v-front { inset: 0 0 auto 0; height: auto; aspect-ratio: 1 / 1; }
    .v4v-space:fullscreen .v4v-sky { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); aspect-ratio: 1 / 1; }
    .v4v-space:fullscreen .v4v-sky > svg, .v4v-space:fullscreen .v4v-sky > canvas { position: absolute; inset: 0; height: 100%; }
    .v4v-orbit-label { display: none; }
    .v4v-card { position: relative; left: auto !important; top: auto !important; width: 100%; margin-top: 12px; }
    .v4v-space:fullscreen .v4v-card {
        position: absolute; left: auto !important; top: auto !important; margin: 0;
        right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: min(340px, calc(100% - 24px));
    }
    /* зум на телефоне: шар сверху, описание под ним во всю ширину */
    .v4v-space.zoom { min-height: 100vh; min-height: 100svh; }
    .v4v-space.zoom .v4v-intro { display: none; }
    .v4v-space.zoom .v4v-sky { position: absolute; left: 50%; top: 24px; transform: translateX(-50%); width: calc(100% - 32px); }
    .v4v-detail {
        position: relative; top: auto; right: auto; left: auto; width: auto; max-height: none; overflow: visible;
        margin-top: var(--v4v-detail-top, 60vw); transform: translateY(24px);
    }
    .v4v-space.zoom-in .v4v-detail { transform: none; }
    .v4v-space:fullscreen .v4v-detail { position: absolute; left: 16px; right: 16px; top: var(--v4v-detail-top, 55%); margin: 0; max-height: calc(100% - var(--v4v-detail-top, 55%) - 16px); overflow-y: auto; }
    .v4v-shots button { height: 120px; }
    .v4v-fs { top: 24px; right: max(16px, env(safe-area-inset-right, 0px)); padding: 9px; }
    .v4v-fs span { display: none; }
    .v4v-atlas-wrap { padding-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    .v4v-sun-glow { animation: none; }
    .v4v-planet .body { transition: none; }
}
