:root {
    --sky-top: #0b1021;
    --stone: #f5f0e8;
    --gold: #ffca28;
    --panel-rgb: 11, 16, 33;
    --panel-alpha: 0.58;
    --card-rgb: 20, 28, 45;
    --card-alpha: 0.52;
    --panel-bg: rgba(var(--panel-rgb), var(--panel-alpha));
    --card-bg: rgba(var(--card-rgb), var(--card-alpha));
    --plaque-fade: 1;
    --plaque-border: rgba(255, 202, 40, 0.42);
    --text-muted: #c8d0dc;
    --hud-bg: rgba(11, 16, 33, 0.75);
    /* SVG 1080×7560: плашка ~480px = 480/1080 от ширины картинки (100vw) */
    --svg-w-px: 1080;
    --plaque-w-px: 480;
    --thumb-w: calc(var(--plaque-w-px) / var(--svg-w-px) * 100vw);
    --thumb-gap: calc(14 / var(--svg-w-px) * 100vw);
    --connector-w: calc(28 / var(--svg-w-px) * 100vw);
    --stage-pad-v: 14vh;
    --thumb-h: calc((100vh - var(--stage-pad-v) - 2 * var(--thumb-gap)) / 3.2);
    --detail-h: calc(3 * var(--thumb-h) + 2 * var(--thumb-gap));
    --fade-ms: 0.32s;
    --blur-intro: 14px;
    --blur-card: 10px;
    --blur-panel: 14px;
}

@property --detail-reveal {
    syntax: "<number>";
    inherits: false;
    initial-value: 0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
    background: var(--sky-top);
}

body {
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--stone);
}

.hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 300;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1rem;
    background: linear-gradient(to bottom, var(--hud-bg), transparent);
    pointer-events: none;
}

.hud-title {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hud-depth {
    font-size: 0.72rem;
    color: var(--gold);
}

.scroll-hint {
    position: fixed;
    bottom: 0.85rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    pointer-events: none;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
    text-align: center;
    max-width: 90vw;
    transition: opacity var(--fade-ms) ease;
}

.scroll-hint.is-hidden {
    opacity: 0;
}

.edge-nav__btn {
    position: fixed;
    right: clamp(0.65rem, 2vw, 1.1rem);
    z-index: 280;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid rgba(255, 202, 40, 0.45);
    border-radius: 10px;
    background: rgba(11, 16, 33, 0.72);
    color: var(--gold);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity var(--fade-ms) ease,
        visibility var(--fade-ms) ease,
        border-color var(--fade-ms) ease,
        background var(--fade-ms) ease;
}

.edge-nav__btn.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.edge-nav__btn:hover {
    border-color: var(--gold);
    background: rgba(255, 202, 40, 0.14);
}

.edge-nav__btn--top {
    top: clamp(3.6rem, 10vh, 4.5rem);
}

.edge-nav__btn--bottom {
    bottom: clamp(2.2rem, 6vh, 3rem);
}

.edge-nav__icon {
    display: block;
    width: 0.65rem;
    height: 0.65rem;
    margin: 0 auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
}

.edge-nav__btn--top .edge-nav__icon {
    transform: rotate(-135deg) translate(1px, 1px);
}

.edge-nav__btn--bottom .edge-nav__icon {
    transform: rotate(45deg) translate(-1px, -1px);
}

.intro-plaque.plaque-dormant::before,
.finale-stack.plaque-dormant .finale-plaque::before,
.finale-stack.plaque-dormant .feedback-plaque::before,
.thumb.plaque-dormant::before {
    display: none;
}

.journey {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: var(--sky-top);
}

.journey-inner {
    position: relative;
    width: 100vw;
    will-change: transform;
}

.building-stage {
    position: relative;
    width: 100vw;
    aspect-ratio: 1080 / 7560;
}

.building-art {
    display: block;
    width: 100vw;
    height: 100%;
    object-fit: fill;
    object-position: center top;
    user-select: none;
    pointer-events: none;
}

.overlays {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
}

.intro-plaque {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(88vw, 480px);
    max-width: 90vw;
    text-align: center;
    padding: 1.1rem 1.3rem;
    background: transparent;
    border: 1px solid rgba(255, 202, 40, calc(0.42 * var(--plaque-fade, 1)));
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, calc(0.5 * var(--plaque-fade, 1)));
    isolation: isolate;
    visibility: hidden;
    transition: visibility var(--fade-ms) ease;
    pointer-events: none;
}

.intro-plaque::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: 0;
    pointer-events: none;
    background: rgba(var(--panel-rgb), calc(var(--panel-alpha) * var(--plaque-fade, 1)));
    -webkit-backdrop-filter: blur(calc(var(--blur-intro) * var(--plaque-fade, 1)));
    backdrop-filter: blur(calc(var(--blur-intro) * var(--plaque-fade, 1)));
}

.intro-plaque.is-visible {
    visibility: visible;
}

.intro-plaque h1,
.intro-plaque p {
    position: relative;
    z-index: 1;
    opacity: var(--plaque-fade, 1);
}

.intro-plaque h1 {
    font-size: clamp(1.35rem, 4vw, 2rem);
    font-weight: 300;
    margin-bottom: 0.45rem;
}

.intro-plaque p {
    font-size: clamp(0.78rem, 2.2vw, 0.9rem);
    color: var(--text-muted);
    line-height: 1.55;
}

/* Уровень со списком слева */
.level-panel {
    position: absolute;
    inset: 0;
    --plaque-fade: 1;
    visibility: hidden;
    transition: visibility var(--fade-ms) ease;
    pointer-events: none;
}

.level-panel.is-visible {
    visibility: visible;
    pointer-events: none;
}

.level-ui {
    position: absolute;
    left: clamp(10px, 2vw, 22px);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: var(--connector-w);
    max-width: none;
    pointer-events: auto;
}

.thumb-list {
    display: flex;
    flex-direction: column;
    gap: var(--thumb-gap);
    width: var(--thumb-w);
    flex-shrink: 0;
}

.thumb-row {
    position: relative;
    width: var(--thumb-w);
    height: var(--thumb-h);
    flex-shrink: 0;
}

.thumb {
    display: block;
    position: relative;
    isolation: isolate;
    width: var(--thumb-w);
    height: var(--thumb-h);
    padding: calc(16 / var(--svg-w-px) * 100vw) calc(20 / var(--svg-w-px) * 100vw);
    background: transparent;
    border: 1px solid rgba(255, 202, 40, calc(0.42 * var(--plaque-fade, 1)));
    border-radius: 10px;
    color: var(--stone);
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, calc(0.35 * var(--plaque-fade, 1)));
    transition:
        border-color var(--fade-ms) ease,
        box-shadow var(--fade-ms) ease,
        transform var(--fade-ms) ease;
    visibility: hidden;
}

.thumb::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: 0;
    pointer-events: none;
    background: rgba(var(--card-rgb), calc(var(--card-alpha) * var(--plaque-fade, 1)));
    -webkit-backdrop-filter: blur(calc(var(--blur-card) * var(--plaque-fade, 1)));
    backdrop-filter: blur(calc(var(--blur-card) * var(--plaque-fade, 1)));
}

.level-panel.is-visible .thumb {
    visibility: visible;
}

.thumb:hover {
    border-color: rgba(255, 202, 40, calc(0.65 * var(--plaque-fade, 1)));
}

.thumb.is-active {
    border-color: rgba(255, 202, 40, var(--plaque-fade, 1));
}

.thumb.is-active::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: 0;
    pointer-events: none;
    background: rgba(255, 202, 40, calc(0.12 * var(--plaque-fade, 1)));
}

.thumb__title {
    position: relative;
    z-index: 1;
    opacity: var(--plaque-fade, 1);
    display: block;
    font-size: calc(20 / var(--svg-w-px) * 100vw);
    font-weight: 600;
    line-height: 1.35;
    color: var(--gold);
}

/* Стрелка от плашки до «Подробно» — на всю щель между колонками */
.thumb-arrow {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: var(--connector-w);
    display: flex;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--fade-ms) ease, visibility var(--fade-ms) ease;
    z-index: 2;
}

.thumb-row.is-active .thumb-arrow {
    opacity: var(--plaque-fade, 1);
    visibility: visible;
}

.thumb-arrow__line {
    display: block;
    flex: 1;
    height: 2px;
    min-width: 0;
    width: 0;
    background: var(--gold);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.thumb-row.is-active .thumb-arrow__line {
    width: calc(100% - 10px);
}

.thumb-arrow__head {
    display: block;
    flex-shrink: 0;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 10px solid var(--gold);
    opacity: 0;
    transition: opacity 0.2s ease 0.22s;
}

.thumb-row.is-active .thumb-arrow__head {
    opacity: 1;
}

.detail-zone {
    position: relative;
    width: var(--thumb-w);
    min-height: var(--detail-h);
    flex-shrink: 0;
    align-self: center;
}

.detail-panel {
    --detail-reveal: 0;
    --detail-strength: calc(var(--plaque-fade, 1) * var(--detail-reveal));
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    min-height: var(--detail-h);
    padding: calc(20 / var(--svg-w-px) * 100vw) calc(22 / var(--svg-w-px) * 100vw);
    background: transparent;
    border: 1px solid rgba(255, 202, 40, calc(0.42 * var(--detail-strength, 0)));
    border-radius: 12px;
    box-shadow: 0 10px 36px rgba(0, 0, 0, calc(0.5 * var(--detail-strength, 0)));
    isolation: isolate;
    visibility: hidden;
    transform: translateX(-8px);
    transition:
        --detail-reveal var(--fade-ms) ease,
        visibility 0s linear var(--fade-ms),
        transform var(--fade-ms) ease;
    pointer-events: none;
}

.detail-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: 0;
    pointer-events: none;
    background: rgba(var(--panel-rgb), calc(var(--panel-alpha) * var(--detail-strength, 0)));
    -webkit-backdrop-filter: blur(calc(var(--blur-panel) * var(--detail-strength, 0)));
    backdrop-filter: blur(calc(var(--blur-panel) * var(--detail-strength, 0)));
}

.detail-panel.is-open {
    --detail-reveal: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
    transition:
        --detail-reveal var(--fade-ms) ease,
        visibility 0s linear 0s,
        transform var(--fade-ms) ease;
}

.detail-panel__title,
.detail-panel__text,
.detail-close {
    position: relative;
    z-index: 1;
    opacity: var(--detail-strength, 0);
}

.detail-panel.is-swapping .detail-panel__title,
.detail-panel.is-swapping .detail-panel__text {
    opacity: 0;
}

.detail-panel__title,
.detail-panel__text {
    transition: opacity 0.22s ease;
}

.detail-close {
    position: absolute;
    top: 0.45rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--stone);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--fade-ms) ease, color var(--fade-ms) ease;
}

.detail-close:hover {
    background: rgba(255, 202, 40, 0.2);
    color: var(--gold);
}

.detail-panel__title {
    font-size: calc(22 / var(--svg-w-px) * 100vw);
    font-weight: 600;
    color: var(--gold);
    margin: 0 1.5rem 0.55rem 0;
    line-height: 1.35;
}

.detail-panel__text {
    font-size: calc(18 / var(--svg-w-px) * 100vw);
    line-height: 1.55;
    color: var(--text-muted);
}

/* Финал — год сверху, оценка снизу, один экран */
.level-panel--finale {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(3.5rem, 9vh, 5rem) clamp(10px, 2vw, 18px) clamp(2rem, 5vh, 3rem);
}

.finale-stack {
    --plaque-fade: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(12 / var(--svg-w-px) * 100vw);
    width: calc(520 / var(--svg-w-px) * 100vw);
    max-width: 92vw;
    max-height: calc(100vh - clamp(5.5rem, 14vh, 8rem));
    overflow-y: auto;
    overflow-x: hidden;
    visibility: hidden;
    pointer-events: none;
    transition: visibility var(--fade-ms) ease;
    scrollbar-width: thin;
}

.level-panel--finale.is-visible .finale-stack {
    visibility: visible;
    pointer-events: auto;
}

.finale-plaque,
.feedback-plaque {
    width: 100%;
}

.finale-plaque {
    position: relative;
    isolation: isolate;
    flex-shrink: 0;
    padding: calc(14 / var(--svg-w-px) * 100vw) calc(18 / var(--svg-w-px) * 100vw);
    text-align: center;
    background: transparent;
    border: 1px solid rgba(129, 199, 132, calc(0.55 * var(--plaque-fade, 1)));
    border-radius: 14px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, calc(0.45 * var(--plaque-fade, 1)));
}

.finale-plaque::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: 0;
    pointer-events: none;
    background: rgba(var(--panel-rgb), calc(var(--panel-alpha) * var(--plaque-fade, 1)));
    -webkit-backdrop-filter: blur(calc(var(--blur-panel) * var(--plaque-fade, 1)));
    backdrop-filter: blur(calc(var(--blur-panel) * var(--plaque-fade, 1)));
}

.finale-plaque__date,
.finale-plaque__title,
.finale-plaque__text {
    position: relative;
    z-index: 1;
    opacity: var(--plaque-fade, 1);
}

.finale-plaque__date {
    font-size: clamp(1.75rem, 5.5vw, 2.35rem);
    font-weight: 300;
    color: #81c784;
    margin-bottom: 0.25rem;
    letter-spacing: 0.06em;
}

.finale-plaque__title {
    font-size: clamp(0.82rem, 2vw, 0.95rem);
    font-weight: 600;
    color: var(--stone);
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.finale-plaque__text {
    font-size: clamp(0.72rem, 1.85vw, 0.82rem);
    line-height: 1.45;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feedback-plaque {
    position: relative;
    isolation: isolate;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: calc(16 / var(--svg-w-px) * 100vw) calc(18 / var(--svg-w-px) * 100vw);
    text-align: center;
    background: transparent;
    border: 1px solid rgba(255, 202, 40, calc(0.45 * var(--plaque-fade, 1)));
    border-radius: 14px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, calc(0.45 * var(--plaque-fade, 1)));
    pointer-events: auto;
}

.feedback-plaque::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: 0;
    pointer-events: none;
    background: rgba(var(--panel-rgb), calc(var(--panel-alpha) * var(--plaque-fade, 1)));
    -webkit-backdrop-filter: blur(calc(var(--blur-panel) * var(--plaque-fade, 1)));
    backdrop-filter: blur(calc(var(--blur-panel) * var(--plaque-fade, 1)));
}

.feedback-plaque__lead,
.feedback-plaque__body,
.feedback-plaque__status {
    position: relative;
    z-index: 1;
    opacity: var(--plaque-fade, 1);
}

.feedback-plaque__lead {
    font-size: clamp(0.82rem, 2.1vw, 0.95rem);
    line-height: 1.5;
    color: var(--stone);
    margin: 0 0 calc(12 / var(--svg-w-px) * 100vw);
}

.feedback-plaque__body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(10 / var(--svg-w-px) * 100vw);
    width: 100%;
}

.rating-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: calc(8 / var(--svg-w-px) * 100vw);
    width: 100%;
}

.rating-btn {
    min-width: calc(40 / var(--svg-w-px) * 100vw);
    height: calc(40 / var(--svg-w-px) * 100vw);
    padding: 0 calc(6 / var(--svg-w-px) * 100vw);
    border: 1px solid rgba(255, 202, 40, 0.45);
    border-radius: 8px;
    background: rgba(20, 28, 45, 0.65);
    color: var(--stone);
    font: inherit;
    font-size: calc(16 / var(--svg-w-px) * 100vw);
    font-weight: 600;
    cursor: pointer;
    transition:
        border-color var(--fade-ms) ease,
        background var(--fade-ms) ease,
        color var(--fade-ms) ease,
        transform var(--fade-ms) ease;
}

.rating-btn:hover:not(:disabled) {
    border-color: var(--gold);
    color: var(--gold);
}

.rating-btn.is-selected {
    border-color: var(--gold);
    background: rgba(255, 202, 40, 0.22);
    color: var(--gold);
    transform: scale(1.06);
}

.rating-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.rating-submit {
    display: inline-block;
    min-width: calc(160 / var(--svg-w-px) * 100vw);
    padding: calc(10 / var(--svg-w-px) * 100vw) calc(28 / var(--svg-w-px) * 100vw);
    border: 1px solid rgba(255, 202, 40, 0.55);
    border-radius: 10px;
    background: rgba(255, 202, 40, 0.14);
    color: var(--gold);
    font: inherit;
    font-size: calc(17 / var(--svg-w-px) * 100vw);
    font-weight: 600;
    cursor: pointer;
    transition:
        opacity var(--fade-ms) ease,
        border-color var(--fade-ms) ease,
        background var(--fade-ms) ease,
        color var(--fade-ms) ease;
}

.rating-submit:hover:not(:disabled) {
    background: rgba(255, 202, 40, 0.26);
    border-color: var(--gold);
}

.rating-submit:disabled {
    cursor: default;
    border-color: rgba(255, 202, 40, 0.28);
    background: rgba(255, 202, 40, 0.05);
    color: rgba(255, 202, 40, 0.42);
}

.feedback-plaque__status {
    min-height: 1.25rem;
    margin: calc(10 / var(--svg-w-px) * 100vw) 0 0;
    font-size: clamp(0.72rem, 1.9vw, 0.85rem);
    color: var(--text-muted);
}

.feedback-plaque__status.is-success {
    color: #81c784;
}

.feedback-plaque__status.is-error {
    color: #ef9a9a;
}

@media (max-width: 768px) {
    :root {
        --stage-pad-v: 11vh;
    }

    .level-ui {
        left: calc(12 / var(--svg-w-px) * 100vw);
        flex-direction: column;
        align-items: flex-start;
        gap: calc(12 / var(--svg-w-px) * 100vw);
    }

    .detail-panel {
        position: relative;
    }

    .thumb-arrow {
        display: none;
    }
}
