/* css/helpChat.css
 *
 * Haily, the help chat (includes/help/helpChat.js), on the main map and the
 * dashboard. Colours come from the --hts-* theme tokens in css/settings.css;
 * every var() has a fallback because the main map only loads settings.css on
 * desktop widths. Everything is namespaced .htc-.
 *
 * Where the floating button sits: --htc-right / --htc-bottom below.
 * Phones and narrow windows (the site's 932px layout) never show the chat.
 * Haily the whale (images/haily/) is animated with the keyframes near the end;
 * Plain mode (.htc-panel--plain) and reduced motion keep the whale still.
 */

:root {
    --htc-right: 20px;
    --htc-bottom: 28px;
    --htc-launcher-size: 52px;
    --htc-width: 380px;
}

/* --- Floating button (main map) ---------------------------------------------- */
.htc-launcher {
    position: fixed;
    right: var(--htc-right);
    bottom: var(--htc-bottom);
    z-index: 1250;
    width: var(--htc-launcher-size);
    height: var(--htc-launcher-size);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: var(--hts-accent, rgb(229, 132, 17));
    color: #ffffff;
    font-size: 22px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    overflow: hidden;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.htc-launcher:hover {
    background: var(--hts-accent-hover, rgb(242, 146, 30));
    transform: translateY(-1px);
}

/* Closed: Haily's face in an orange ring. Open: the minimise arrow. */
.htc-launcher:not(.htc-launcher--open) {
    border: 2px solid var(--hts-accent, rgb(229, 132, 17));
    background: #dce7f1;
}

.htc-launcher-face {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Haily switched off */
.htc-launcher[hidden] {
    display: none;
}

/* The map's ? button (#GetHelp) and Chat with Haily while Haily is on - the
   same orange as the map's other active toggles */
.FunctionBut.htc-toggle--on,
.LayersBut3xDropDown.htc-toggle--on {
    background-color: rgb(229, 132, 17);
    border-color: rgb(229, 132, 17);
}

/* The ? is an outline icon, so at the buttons' usual 13px it looks smaller than
   its solid neighbours. Scaled to about 18px rather than given a bigger font
   size: a bigger font changes the button's text baseline and drops it below the
   rest of the row, while a transform leaves the layout alone */
#GetHelp i {
    transform: scale(1.35);
}

.htc-launcher:focus-visible,
.htc-panel button:focus-visible,
.htc-panel a:focus-visible,
.htc-panel input:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* --- Panel -------------------------------------------------------------------- */
.htc-panel {
    position: fixed;
    right: var(--htc-right);
    bottom: calc(var(--htc-bottom) + var(--htc-launcher-size) + 12px);
    z-index: 1250;
    width: var(--htc-width);
    max-width: calc(100vw - 32px);
    height: min(600px, calc(100vh - var(--htc-bottom) - var(--htc-launcher-size) - 40px));
    min-height: 320px;
    display: flex;
    flex-direction: column;
    background: var(--hts-panel-bg, rgba(44, 66, 94, 0.92));
    backdrop-filter: blur(var(--hts-blur, 6.6px));
    -webkit-backdrop-filter: blur(var(--hts-blur, 6.6px));
    border: 1px solid var(--hts-border, rgba(255, 255, 255, 0.14));
    border-radius: var(--hts-radius, 14px);
    box-shadow: var(--hts-shadow, 0 8px 30px rgba(0, 0, 0, 0.45));
    color: var(--hts-text, #ffffff);
    font: 14px/1.45 var(--hts-font, 'Segoe UI', 'Open Sans', 'Roboto', Arial, sans-serif);
    overflow: hidden;
}

.htc-panel[hidden] {
    display: none;
}

/* Opened from a page button instead of the floating one (dashboard topbar) */
.htc-panel--top {
    top: 56px;
    right: 14px;
    bottom: auto;
    height: min(600px, calc(100vh - 72px));
}

.htc-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 10px 10px 14px;
    background: var(--hts-bar-bg, rgba(29, 52, 76, 0.95));
    border-bottom: 1px solid var(--hts-divider, rgba(255, 255, 255, 0.10));
}

.htc-title {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.htc-title-main {
    font-weight: 600;
    font-size: 15px;
}

.htc-title-sub {
    font-size: 12px;
    opacity: 0.75;
}

.htc-icon-btn {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #ffffff;
    font-size: 15px;
    cursor: pointer;
}

.htc-icon-btn:hover {
    background: var(--hts-btn-idle, rgba(255, 255, 255, 0.07));
    border-color: var(--hts-btn-border, rgba(255, 255, 255, 0.18));
}

/* Haily's face: in the header and beside each answer */
.htc-avatar {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border: 1.5px solid var(--hts-accent, rgb(229, 132, 17));
    border-radius: 50%;
    background: #dce7f1;
    object-fit: cover;
}

.htc-avatar--header {
    width: 34px;
    height: 34px;
    margin-right: 4px;
    border-width: 2px;
}

/* --- Messages ------------------------------------------------------------------ */
.htc-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overscroll-behavior: contain;
}

.htc-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
}

.htc-msg--user {
    align-self: flex-end;
    align-items: flex-end;
}

/* Haily's rows: the face, then the answer, its thumbs and "Ask next" */
.htc-msg--bot {
    align-self: flex-start;
    align-items: flex-start;
    flex-direction: row;
    gap: 7px;
    max-width: 95%;
}

.htc-msg-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.htc-bubble {
    padding: 8px 12px;
    border-radius: 12px;
    overflow-wrap: anywhere;
}

.htc-msg--user .htc-bubble {
    background: rgba(96, 150, 210, 0.32);
    border: 1px solid rgba(96, 150, 210, 0.45);
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}

.htc-msg--bot .htc-bubble {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--hts-inset-border, rgba(255, 255, 255, 0.10));
    border-bottom-left-radius: 4px;
}

.htc-bubble p {
    margin: 0 0 8px;
}

.htc-bubble p:last-child,
.htc-bubble ul:last-child,
.htc-bubble ol:last-child {
    margin-bottom: 0;
}

.htc-bubble ul,
.htc-bubble ol {
    margin: 0 0 8px;
    padding-left: 22px;
}

.htc-bubble li+li {
    margin-top: 3px;
}

.htc-bubble strong {
    font-weight: 600;
}

.htc-bubble code {
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.25);
    font: 12.5px Consolas, 'Courier New', monospace;
}

.htc-bubble a {
    color: var(--hts-accent-hover, rgb(242, 146, 30));
    text-decoration: underline;
}

/* Cards in answers: [[addon:...]] (amber) and [[report]] (blue) */
.htc-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 4px 0 8px;
    padding: 9px 11px;
    border-radius: 8px;
    font-size: 13px;
}

.htc-card:last-child {
    margin-bottom: 0;
}

.htc-card--addon {
    background: rgba(229, 132, 17, 0.14);
    border: 1px solid rgba(229, 132, 17, 0.55);
}

.htc-card--report {
    background: rgba(96, 150, 210, 0.16);
    border: 1px solid rgba(96, 150, 210, 0.5);
}

.htc-card-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.htc-bubble a.htc-card-btn {
    padding: 3px 10px;
    border-radius: 6px;
    background: var(--hts-accent, rgb(229, 132, 17));
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
}

.htc-bubble a.htc-card-btn:hover {
    background: var(--hts-accent-hover, rgb(242, 146, 30));
}

/* Thumbs under each answer */
.htc-rate {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 3px;
}

.htc-rate-btn {
    width: 26px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
    cursor: pointer;
}

.htc-rate-btn:hover {
    color: #ffffff;
    background: var(--hts-btn-idle, rgba(255, 255, 255, 0.07));
}

.htc-rate-btn--on,
.htc-rate-btn--on:hover {
    color: var(--hts-accent, rgb(229, 132, 17));
}

.htc-rate-note {
    margin-left: 4px;
    font-size: 11.5px;
    opacity: 0.8;
}

/* "..." while waiting for an answer */
.htc-typing .htc-bubble {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
}

.htc-typing .htc-bubble span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ffffff;
    opacity: 0.35;
    animation: htc-dot 1.2s infinite ease-in-out;
}

.htc-typing .htc-bubble span:nth-child(2) {
    animation-delay: 0.2s;
}

.htc-typing .htc-bubble span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes htc-dot {

    0%,
    80%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.htc-divider {
    align-self: center;
    padding: 2px 10px;
    font-size: 11.5px;
    opacity: 0.7;
    border-top: 1px solid var(--hts-divider, rgba(255, 255, 255, 0.10));
}

/* Welcome and suggested questions (empty chat) */
.htc-welcome p {
    margin: 0 0 10px;
}

.htc-suggestions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.htc-suggestion {
    padding: 6px 10px;
    background: var(--hts-btn-idle, rgba(255, 255, 255, 0.07));
    border: 1px solid var(--hts-btn-border, rgba(255, 255, 255, 0.18));
    border-radius: 8px;
    color: #ffffff;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.htc-suggestion:hover {
    border-color: var(--hts-accent, rgb(229, 132, 17));
}

/* The welcome: the waving whale beside the greeting */
.htc-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.htc-hero p {
    margin: 0;
}

/* "Ask next": follow-up questions under the newest answer */
.htc-next {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.htc-next-label {
    width: 100%;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.65;
}

.htc-next[hidden] {
    display: none;
}

/* "Still need help, contact support": always the last "Ask next" button */
.htc-support-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-color: rgba(229, 132, 17, 0.6);
}

.htc-support-btn i {
    color: var(--hts-accent, rgb(229, 132, 17));
}

/* The support form, in place of the "Ask next" buttons */
.htc-support {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--hts-btn-idle, rgba(255, 255, 255, 0.07));
    border: 1px solid var(--hts-btn-border, rgba(255, 255, 255, 0.18));
    border-radius: 10px;
    font-size: 13px;
}

.htc-support-label {
    font-weight: 600;
}

.htc-support-text {
    width: 100%;
    min-height: 84px;
    box-sizing: border-box;
    padding: 8px 10px;
    resize: vertical;
    background: var(--hts-field-bg, rgba(29, 52, 76, 0.55));
    border: 1px solid var(--hts-border, rgba(255, 255, 255, 0.14));
    border-radius: 8px;
    color: #ffffff;
    font: inherit;
}

.htc-support-text::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.htc-support-text:focus {
    outline: none;
    border-color: var(--hts-accent, rgb(229, 132, 17));
}

.htc-support-note,
.htc-support-error {
    margin: 0;
    font-size: 12px;
}

.htc-support-note {
    opacity: 0.75;
}

.htc-support-error {
    color: #ffb4a8;
}

.htc-support-error[hidden] {
    display: none;
}

.htc-support-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.htc-support-cancel,
.htc-support-submit {
    padding: 6px 14px;
    border-radius: 6px;
    color: #ffffff;
    font: inherit;
    cursor: pointer;
}

.htc-support-cancel {
    background: transparent;
    border: 1px solid var(--hts-btn-border, rgba(255, 255, 255, 0.18));
}

.htc-support-submit {
    background: var(--hts-accent, rgb(229, 132, 17));
    border: 1px solid transparent;
    font-weight: 600;
}

.htc-support-submit:hover {
    background: var(--hts-accent-hover, rgb(242, 146, 30));
}

.htc-support-cancel:disabled,
.htc-support-submit:disabled {
    opacity: 0.55;
    cursor: default;
}

/* The chat's own messages, such as the support confirmation */
.htc-msg--note .htc-bubble {
    background: rgba(76, 175, 80, 0.16);
    border-color: rgba(76, 175, 80, 0.45);
}

/* --- Notices, input, footer ------------------------------------------------- */
.htc-status {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 12px 8px;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--hts-shelf, rgba(0, 0, 0, 0.16));
    border: 1px solid var(--hts-inset-border, rgba(255, 255, 255, 0.10));
    font-size: 12.5px;
}

.htc-status[hidden] {
    display: none;
}

.htc-status span {
    flex: 1 1 auto;
}

.htc-status-btn {
    flex: 0 0 auto;
    padding: 4px 10px;
    background: var(--hts-accent, rgb(229, 132, 17));
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    font: inherit;
    cursor: pointer;
}

.htc-form {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 0 12px;
}

.htc-input {
    flex: 1 1 auto;
    min-height: 38px;
    max-height: 120px;
    box-sizing: border-box;
    padding: 8px 10px;
    resize: none;
    overflow-y: auto;
    background: var(--hts-field-bg, rgba(29, 52, 76, 0.55));
    border: 1px solid var(--hts-border, rgba(255, 255, 255, 0.14));
    border-radius: 10px;
    color: #ffffff;
    font: inherit;
}

.htc-input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.htc-input:focus {
    outline: none;
    border-color: var(--hts-accent, rgb(229, 132, 17));
}

.htc-input:disabled {
    opacity: 0.6;
}

.htc-send {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 0;
    background: var(--hts-accent, rgb(229, 132, 17));
    border: 0;
    border-radius: 10px;
    color: #ffffff;
    font-size: 15px;
    cursor: pointer;
}

.htc-send:hover {
    background: var(--hts-accent-hover, rgb(242, 146, 30));
}

.htc-send:disabled {
    opacity: 0.45;
    cursor: default;
}

.htc-counter {
    flex: 0 0 auto;
    padding: 3px 14px 0;
    font-size: 11px;
    text-align: right;
    opacity: 0.7;
}

.htc-counter[hidden] {
    display: none;
}

.htc-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 10px;
    font-size: 11.5px;
    opacity: 0.8;
}

.htc-footer-note {
    flex: 1 1 auto;
}

/* Plain mode switch: the whale keeps still and answers appear at once */
.htc-plain {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.htc-plain input {
    margin: 0;
    accent-color: var(--hts-accent, rgb(229, 132, 17));
    cursor: pointer;
}

/* --- Haily the whale (images/haily/: base, flip = the fin, spout) ---------------
   Three stacked layers, moved by CSS keyframes only. helpChat.js decides when
   each scene shows; DIVE_MS there must match the 6s dive below. */
.htc-whale,
.htc-whale img {
    position: absolute;
    inset: 0;
}

.htc-whale img {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
}

.htc-whale-spout {
    transform-origin: 54.9% 18.05%;
}

/* Welcome: bobs over its shadow, the spout pulses and the fin waves three times */
.htc-whale-stage {
    position: relative;
    display: block;
    flex: 0 0 auto;
    width: 92px;
    aspect-ratio: 820 / 870;
}

.htc-whale-shade {
    position: absolute;
    left: 18%;
    right: 22%;
    bottom: -2%;
    height: 7%;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(0, 0, 0, 0.45), transparent);
    animation: htc-w-shadow 3.2s ease-in-out infinite;
}

.htc-whale-bob {
    position: absolute;
    inset: 0;
    transform-origin: 50% 70%;
    animation: htc-w-bob 3.2s ease-in-out infinite;
}

.htc-whale-stage .htc-whale-fin {
    transform-origin: 86.1% 58.85%;
    animation: htc-w-wave 3.2s cubic-bezier(0.45, 0, 0.55, 1) 3;
}

.htc-whale-stage .htc-whale-spout {
    animation: htc-w-spout 1.6s ease-in-out infinite;
}

@keyframes htc-w-bob {

    0%,
    100% {
        transform: translateY(0) rotate(0);
    }

    50% {
        transform: translateY(-2.2%) rotate(-1.2deg);
    }
}

@keyframes htc-w-shadow {

    0%,
    100% {
        transform: scaleX(1);
        opacity: 1;
    }

    50% {
        transform: scaleX(0.9);
        opacity: 0.75;
    }
}

@keyframes htc-w-wave {

    0% {
        transform: rotate(0);
    }

    9% {
        transform: rotate(-18deg);
    }

    20% {
        transform: rotate(6deg);
    }

    31% {
        transform: rotate(-18deg);
    }

    42% {
        transform: rotate(6deg);
    }

    53% {
        transform: rotate(-16deg);
    }

    66%,
    100% {
        transform: rotate(0);
    }
}

@keyframes htc-w-spout {

    0%,
    100% {
        transform: scaleY(1);
    }

    30% {
        transform: scaleY(1.07);
    }

    70% {
        transform: scaleY(0.94);
    }
}

/* Waiting: leaps, spins, dives under the sea and comes back up, every 6s. When
   the answer arrives, helpChat.js speeds up the rest of the dive (surface()). */
.htc-typing--dive {
    align-items: center;
    gap: 12px;
}

.htc-dive {
    position: relative;
    display: block;
    flex: 0 0 auto;
    width: 66px;
    height: 94px;
    overflow: hidden;
    border-radius: 0 0 10px 10px;
}

.htc-dive-sprite {
    position: absolute;
    left: 18%;
    bottom: 30%;
    width: 64%;
    aspect-ratio: 820 / 870;
}

.htc-dive-jump,
.htc-dive-spin {
    position: absolute;
    inset: 0;
}

.htc-dive-jump {
    animation: htc-d-jump 6s linear infinite;
}

.htc-dive-spin {
    transform-origin: 50% 57%;
    animation: htc-d-spin 6s linear infinite;
}

.htc-dive-sea {
    position: absolute;
    left: 0;
    right: 0;
    top: 66%;
    bottom: 0;
    z-index: 2;
    background: linear-gradient(rgba(62, 143, 196, 0.7), #0a2038);
    border-top: 2px solid #8fcff0;
}

.htc-dive-ring {
    position: absolute;
    left: 50%;
    top: 66%;
    z-index: 3;
    width: 38px;
    height: 7px;
    margin: -3.5px 0 0 -19px;
    border: 2px solid #8fcff0;
    border-radius: 50%;
    opacity: 0;
    animation: htc-d-ring 6s linear infinite;
}

.htc-dive-text {
    font-size: 12.5px;
    opacity: 0.8;
}

@keyframes htc-d-jump {

    0% {
        transform: translateY(0);
        opacity: 1;
    }

    12% {
        transform: translateY(0);
    }

    17% {
        transform: translateY(5%);
        animation-timing-function: cubic-bezier(0.2, 0.75, 0.4, 1);
    }

    31% {
        transform: translateY(-40%);
        animation-timing-function: cubic-bezier(0.55, 0, 0.85, 0.45);
    }

    44% {
        transform: translateY(40%);
        opacity: 1;
        animation-timing-function: cubic-bezier(0.2, 0.6, 0.4, 1);
    }

    54% {
        transform: translateY(125%);
        opacity: 0;
    }

    66% {
        transform: translateY(125%);
        opacity: 0;
        animation-timing-function: cubic-bezier(0.3, 0.3, 0.4, 1);
    }

    70% {
        opacity: 0.6;
    }

    76% {
        transform: translateY(-10%);
        opacity: 1;
        animation-timing-function: ease-in-out;
    }

    82% {
        transform: translateY(3%);
    }

    88% {
        transform: translateY(-1%);
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes htc-d-spin {

    0%,
    18% {
        transform: rotate(0);
        animation-timing-function: cubic-bezier(0.4, 0.1, 0.5, 1);
    }

    34% {
        transform: rotate(360deg);
        animation-timing-function: ease-in-out;
    }

    46% {
        transform: rotate(525deg);
        animation-timing-function: ease-out;
    }

    55% {
        transform: rotate(540deg);
    }

    55.2%,
    100% {
        transform: rotate(0);
    }
}

@keyframes htc-d-ring {

    0%,
    44% {
        opacity: 0;
        transform: scale(0.3);
    }

    45% {
        opacity: 0.9;
    }

    62% {
        opacity: 0;
        transform: scale(1.8);
    }

    76% {
        opacity: 0;
        transform: scale(0.3);
    }

    77% {
        opacity: 0.8;
    }

    92% {
        opacity: 0;
        transform: scale(1.5);
    }

    100% {
        opacity: 0;
    }
}

/* Thumbs up: one backflip beside the buttons. The negative margin lets it rise
   out of the row instead of making the row taller. */
.htc-cheer {
    position: relative;
    z-index: 2;
    display: block;
    flex: 0 0 auto;
    width: 36px;
    aspect-ratio: 820 / 870;
    margin: -16px 2px 0 6px;
    pointer-events: none;
}

.htc-cheer-jump,
.htc-cheer-spin,
.htc-cheer-squash {
    position: absolute;
    inset: 0;
}

.htc-cheer-jump {
    animation: htc-c-jump 2.4s linear 1 forwards;
}

.htc-cheer-spin {
    transform-origin: 50% 57%;
    animation: htc-c-spin 2.4s linear 1 forwards;
}

.htc-cheer-squash {
    transform-origin: 50% 96%;
    animation: htc-c-squash 2.4s linear 1 forwards;
}

@keyframes htc-c-jump {

    0%,
    18% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1);
    }

    40% {
        transform: translateY(-55%);
        animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.4);
    }

    62% {
        transform: translateY(0);
        animation-timing-function: ease-out;
    }

    70% {
        transform: translateY(-4%);
    }

    78%,
    100% {
        transform: translateY(0);
    }
}

@keyframes htc-c-spin {

    0%,
    20% {
        transform: rotate(0);
        animation-timing-function: cubic-bezier(0.45, 0.05, 0.4, 1);
    }

    58%,
    100% {
        transform: rotate(-360deg);
    }
}

@keyframes htc-c-squash {

    0%,
    10% {
        transform: scale(1, 1);
    }

    18% {
        transform: scale(1.08, 0.86);
    }

    26% {
        transform: scale(0.94, 1.08);
    }

    34%,
    58% {
        transform: scale(1, 1);
    }

    64% {
        transform: scale(1.1, 0.84);
    }

    72% {
        transform: scale(0.96, 1.05);
    }

    80%,
    100% {
        transform: scale(1, 1);
    }
}

/* Plain mode: no whale scenes (the face stays) */
.htc-panel--plain .htc-whale-stage,
.htc-panel--plain .htc-cheer {
    display: none;
}

/* Devices set to reduce motion: everything keeps still (helpChat.js also skips
   the dive, the write-in and the backflip) */
@media (prefers-reduced-motion: reduce) {

    .htc-whale-stage *,
    .htc-dive *,
    .htc-cheer *,
    .htc-typing .htc-bubble span {
        animation: none !important;
    }

    .htc-dive-ring {
        display: none;
    }

    .htc-launcher,
    .htc-launcher:hover {
        transition: none;
        transform: none;
    }
}

/* --- Dashboard topbar ? menu (dashboard/index.php) ------------------------------
   Opens on hover like the map's dropdowns. #htdbTopbar is lifted above the
   widgets in css/dashboard/dashboard.css so the list can drop over them. */
.htc-help-menu {
    position: relative;
    display: inline-flex;
}

.htc-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 30;
    /* invisible strip so the pointer can move from the button to the list */
    padding-top: 6px;
}

.htc-help-menu:hover .htc-menu {
    display: block;
}

.htc-menu-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 170px;
    padding: 5px;
    background: var(--hts-bar-bg, rgba(29, 52, 76, 0.95));
    border: 1px solid var(--hts-btn-border, rgba(255, 255, 255, 0.18));
    border-radius: 10px;
    box-shadow: var(--hts-shadow, 0 8px 30px rgba(0, 0, 0, 0.45));
}

.htc-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    font: 12.5px var(--hts-font, 'Segoe UI', 'Open Sans', 'Roboto', Arial, sans-serif);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.htc-menu-item i {
    width: 14px;
    text-align: center;
}

.htc-menu-item:hover {
    background: var(--hts-accent, rgb(229, 132, 17));
}

/* --- Phones and narrow windows: no chat --------------------------------------------
   The site's mobile layout starts at 932px (index.php loads indexMobile.css). The
   on/off choice is kept, so the bubble comes back if the window is widened. The
   dashboard's ? only opens the chat, so it goes too. */
@media (max-width: 932px) {

    .htc-launcher,
    .htc-panel,
    .htc-help-menu {
        display: none !important;
    }
}