/* ==========================================================================
   Общие мелочи для всех страниц: подсказки (data-tip) и уведомление о cookie.
   Поведение — assets/js/ui.js; стили лежат отдельно, чтобы подключаться и на главной, и на страницах результата,
   и на странице «Спасибо» одной строкой.
   ========================================================================== */

/* ---------- Подсказки ---------- */
.tip { cursor: help; }
.tip:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }

/* звёздочка-сноска после текста: заметная лаймовая «пуговка», мягко пульсирует и увеличивается по наведению */
.tip--mark {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    margin-left: 6px;
    padding-top: 5px;
    border-radius: 50%;
    background: var(--color-lime);
    box-shadow: inset 0 0 0 1px rgba(12, 10, 31, 0.14);
    color: var(--color-navy);
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    vertical-align: -5px;
    transition: scale 0.2s ease;
}

.tip--mark:hover,
.tip--mark:focus-visible { scale: 1.2; }

@keyframes tip-pulse {
    0% { box-shadow: inset 0 0 0 1px rgba(12, 10, 31, 0.14), 0 0 0 0 rgba(150, 190, 0, 0.55); }
    70%, 100% { box-shadow: inset 0 0 0 1px rgba(12, 10, 31, 0.14), 0 0 0 8px rgba(150, 190, 0, 0); }
}

@media (prefers-reduced-motion: no-preference) {
    .tip--mark { animation: tip-pulse 2.2s ease-out infinite; }
    .tip--mark:hover,
    .tip--mark:focus-visible { animation: none; }
}

/* Одна общая подсказка на странице: ui.js кладёт её в <html> и ставит рядом с тем, на что навели. Вне <body>, чтобы
   её не обрезали слайдеры с overflow и не сдвигали анимации с transform/zoom. */
.tip-pop {
    position: fixed;
    z-index: 120;
    left: 0;
    top: 0;
    max-width: min(300px, calc(100vw - 16px));
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--color-navy);
    color: var(--color-white);
    font-family: var(--font-text);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    letter-spacing: var(--tracking);
    text-align: left;
    box-shadow: 0 12px 32px rgba(12, 10, 31, 0.28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    translate: 0 4px;
    transition: opacity 0.2s, translate 0.2s, visibility 0s linear 0.2s;
}

.tip-pop.is-below { translate: 0 -4px; }

.tip-pop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    translate: 0 0;
    transition-delay: 0s;
}

.tip-pop a {
    color: var(--color-lime);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Подсказка работы ученика (первый экран): белая, имя и под ним ссылка на работу */
.tip-pop--work {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 14px 11px;
    border-radius: 14px;
    background: var(--color-white);
    color: var(--color-navy);
    white-space: nowrap;
    box-shadow: 0 10px 28px rgba(12, 10, 31, 0.18), 0 0 0 1px rgba(12, 10, 31, 0.06);
}

.tip-pop--work .tip-pop__name { font-size: 13px; font-weight: 500; line-height: 1.2; }

.tip-pop--work a {
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.2;
    text-decoration: none;
    transition: color 0.2s;
}

.tip-pop--work a:hover { color: var(--color-navy); text-decoration: underline; text-underline-offset: 2px; }

.tip-pop.tip-pop--work::after { background: var(--color-white); }

/* «носик» к тому, на что навели (--arrow-x ставит ui.js) */
.tip-pop::after {
    content: "";
    position: absolute;
    left: var(--arrow-x, 50%);
    bottom: -5px;
    width: 10px;
    height: 10px;
    margin-left: -5px;
    border-radius: 2px;
    background: var(--color-navy);
    rotate: 45deg;
}

.tip-pop.is-below::after { bottom: auto; top: -5px; }

/* ---------- Уведомление о cookie ---------- */
.cookie {
    position: fixed;
    z-index: 90;
    left: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: min(380px, calc(100vw - 24px));
    padding: 16px 18px;
    border-radius: 24px;
    background: var(--color-white);
    box-shadow: 0 16px 48px rgba(12, 10, 31, 0.18), 0 0 0 1px rgba(12, 10, 31, 0.06);
    font-size: 12px;
    line-height: 1.4;
    letter-spacing: var(--tracking);
    opacity: 0;
    visibility: hidden;
    translate: 0 16px;
    transition: opacity 0.35s ease, translate 0.35s ease, visibility 0s linear 0.35s;
}

.cookie.is-shown {
    opacity: 1;
    visibility: visible;
    translate: 0 0;
    transition-delay: 0s;
}

.cookie__text { margin: 0; color: var(--color-muted); }

.cookie__text a {
    color: var(--color-navy);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.cookie__text a:hover { text-decoration-thickness: 2px; }

.cookie__btn {
    height: 36px;
    padding: 0 22px;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--color-lime);
    color: var(--color-navy);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: var(--tracking);
    cursor: pointer;
    transition: background-color 0.2s ease, scale 0.2s ease;
}

.cookie__btn:hover { background: #d6ff3d; }
.cookie__btn:active { scale: 0.96; }
.cookie__btn:focus-visible { outline: 2px solid var(--color-navy); outline-offset: 3px; }

@media (max-width: 767.98px) {
    .cookie {
        left: 12px;
        right: 12px;
        bottom: max(12px, env(safe-area-inset-bottom));
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tip-pop, .cookie, .cookie__btn { transition: none; }
}
