.rally-helper {
    bottom: 22px;
    position: fixed;
    right: 22px;
    z-index: 99980;
}

.rally-helper * {
    box-sizing: border-box;
}

.rally-helper__button {
    align-items: center;
    background: #087ea4;
    border: 0;
    border-radius: 999px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    gap: 8px;
    min-height: 48px;
    padding: 8px 14px 8px 8px;
}

.rally-helper__mascot {
    align-items: center;
    background: #fff;
    border-radius: 50%;
    color: #087ea4;
    display: inline-flex;
    font-weight: 800;
    height: 32px;
    justify-content: center;
    overflow: hidden;
    width: 32px;
}

.rally-helper__mascot img,
.rally-helper__header-mascot img,
.rally-helper__toolbar-trigger img {
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.rally-helper__button-text {
    font-size: 14px;
    font-weight: 700;
}

.rally-helper--toolbar {
    bottom: auto;
    position: static;
    right: auto;
    z-index: 5;
}

.rally-helper--toolbar.rally-helper--has-proxy > .rally-helper__button {
    display: none;
}

.rally-helper--toolbar .rally-helper__button {
    box-shadow: none;
    height: 38px;
    min-height: 38px;
    padding: 3px;
    width: 38px;
}

.rally-helper--toolbar .rally-helper__button-text {
    display: none;
}

.rally-helper--toolbar .rally-helper__mascot {
    height: 32px;
    width: 32px;
}

.rally-helper__toolbar-trigger {
    align-items: center !important;
    background: #087ea4 !important;
    border: 0 !important;
    border-radius: 8px !important;
    color: #fff !important;
    display: inline-flex !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    height: 44px !important;
    justify-content: center !important;
    line-height: 1 !important;
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 0 !important;
    width: 44px !important;
}

.rally-helper__toolbar-trigger img {
    border-radius: 6px;
}

.rl-btn.rally-helper__toolbar-trigger.rally-helper__toolbar-trigger--mascot,
.rally-helper__toolbar-trigger.rally-helper__toolbar-trigger--mascot {
    background: #fff !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: none !important;
    color: #087ea4 !important;
    padding: 2px !important;
}

.rally-helper__toolbar-trigger:hover,
.rally-helper__toolbar-trigger:focus {
    background: #066b8c !important;
    color: #fff !important;
}

.rally-helper [data-rh-tooltip],
.rally-helper__toolbar-trigger[data-rh-tooltip] {
    position: relative;
}

.rally-helper [data-rh-tooltip]::after,
.rally-helper__toolbar-trigger[data-rh-tooltip]::after {
    background: #0f172a;
    border-radius: 6px;
    bottom: calc(100% + 8px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
    color: #fff;
    content: attr(data-rh-tooltip);
    font-size: 12px;
    font-weight: 700;
    left: 50%;
    line-height: 1.2;
    opacity: 0;
    padding: 6px 8px;
    pointer-events: none;
    position: absolute;
    text-align: center;
    transform: translate(-50%, 4px);
    transition: opacity 0.14s ease, transform 0.14s ease;
    white-space: nowrap;
    z-index: 100000;
}

.rally-helper [data-rh-tooltip]:hover::after,
.rally-helper [data-rh-tooltip]:focus-visible::after,
.rally-helper__toolbar-trigger[data-rh-tooltip]:hover::after,
.rally-helper__toolbar-trigger[data-rh-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.rl-btn.rally-helper__toolbar-trigger.rally-helper__toolbar-trigger--mascot:hover,
.rl-btn.rally-helper__toolbar-trigger.rally-helper__toolbar-trigger--mascot:focus,
.rally-helper__toolbar-trigger.rally-helper__toolbar-trigger--mascot:hover,
.rally-helper__toolbar-trigger.rally-helper__toolbar-trigger--mascot:focus {
    background: #fff !important;
    border-color: rgba(15, 23, 42, 0.18) !important;
    color: #087ea4 !important;
}

.rally-helper__panel {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 10px;
    bottom: 62px;
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.24);
    color: #111827;
    max-height: min(620px, calc(100vh - 110px));
    overflow: hidden;
    padding: 10px;
    position: absolute;
    right: 0;
    width: min(360px, calc(100vw - 28px));
}

body.rally-helper-is-open .rl-img-zoom-icon,
body.rally-helper-is-open .rl-int-zoom-icon {
    opacity: 0;
    pointer-events: none;
}

.rally-helper--toolbar .rally-helper__panel {
    bottom: 92px;
    position: fixed;
    right: 22px;
}

.rally-helper__header {
    align-items: flex-start;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    border-radius: 8px 8px 0 0;
    padding: 14px;
}

.rally-helper__header-mascot {
    align-items: center;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    border-radius: 50%;
    color: #087ea4;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 18px;
    font-weight: 800;
    height: 42px;
    justify-content: center;
    overflow: hidden;
    width: 42px;
}

.rally-helper__header-copy {
    flex: 1 1 auto;
    min-width: 0;
}

.rally-helper__header-copy strong {
    color: #0f172a;
    display: block;
    font-weight: 800;
    line-height: 1.25;
}

.rally-helper__header p {
    color: #64748b;
    font-size: 13px;
    line-height: 1.4;
    margin: 4px 0 0;
}

.rally-helper__close {
    background: transparent;
    border: 0;
    color: #64748b;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 0 2px;
}

.rally-helper__messages {
    display: grid;
    gap: 8px;
    max-height: 260px;
    overflow: auto;
    padding: 14px;
}

.rally-helper__message {
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
    padding: 10px 12px;
}

.rally-helper__message--helper {
    background: #f1f5f9;
}

.rally-helper__message--student {
    background: #e0f2fe;
    margin-left: 28px;
}

.rally-helper__source {
    color: #475569;
    display: block;
    font-size: 12px;
    margin-top: 8px;
}

.rally-helper__message-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
}

.rally-helper__report {
    align-items: center;
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    font-size: 10px;
    font-weight: 800;
    height: 18px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    min-width: 18px;
}

.rally-helper__report:hover,
.rally-helper__report:focus-visible {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
    outline: none;
}

.rally-helper__report:disabled {
    cursor: default;
    opacity: 0.75;
}

.rally-helper__report[data-rh-tooltip]::after {
    bottom: calc(100% + 6px);
    left: auto;
    max-width: 170px;
    right: 0;
    text-align: left;
    transform: translateY(4px);
    white-space: normal;
    width: max-content;
}

.rally-helper__report[data-rh-tooltip]:hover::after,
.rally-helper__report[data-rh-tooltip]:focus-visible::after {
    transform: translateY(0);
}

.rally-helper__message--loading {
    align-items: center;
    display: flex;
    gap: 8px;
}

.rally-helper__spinner {
    animation: rally-helper-spin 0.8s linear infinite;
    border: 2px solid #cbd5e1;
    border-top-color: #087ea4;
    border-radius: 50%;
    display: inline-block;
    height: 16px;
    width: 16px;
}

.rally-helper__disclaimer {
    background: #fef2f2;
    border-top: 1px solid #fecaca;
    color: #991b1b;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
    padding: 8px 14px;
}

@keyframes rally-helper-spin {
    to {
        transform: rotate(360deg);
    }
}

.rally-helper__quick {
    border-top: 1px solid #eef2f7;
}

.rally-helper__quick-toggle,
button.rally-helper__quick-toggle {
    align-items: center;
    appearance: none;
    background: #fff !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #475569 !important;
    cursor: pointer;
    display: flex;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    justify-content: space-between;
    padding: 9px 14px;
    text-align: left;
    width: 100%;
}

.rally-helper__quick-toggle:hover,
.rally-helper__quick-toggle:focus,
.rally-helper__quick-toggle:focus-visible,
button.rally-helper__quick-toggle:hover,
button.rally-helper__quick-toggle:focus,
button.rally-helper__quick-toggle:focus-visible {
    background: #f8fafc !important;
    color: #0f172a !important;
    outline: none !important;
}

.rally-helper__quick-icon {
    border-bottom: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    color: #64748b;
    height: 7px;
    margin-right: 2px;
    transform: rotate(45deg);
    transition: transform 0.16s ease;
    width: 7px;
}

.rally-helper__quick-toggle[aria-expanded="true"] .rally-helper__quick-icon {
    transform: rotate(225deg);
}

.rally-helper__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 12px;
}

.rally-helper__chips[hidden] {
    display: none !important;
}

.rally-helper__chip {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    color: #0f172a;
    cursor: pointer;
    font-size: 12px;
    padding: 6px 9px;
}

.rally-helper__chip:hover,
.rally-helper__chip:focus-visible {
    background: #f8fafc;
    border-color: #94a3b8;
    outline: none;
}

.rally-helper__form {
    border-top: 1px solid #e5e7eb;
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr auto;
    border-radius: 0 0 8px 8px;
    padding: 12px 14px 14px;
}

.rally-helper__input {
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    font: inherit;
    min-height: 38px;
    padding: 8px 10px;
    width: 100%;
}

.rally-helper__website {
    display: none !important;
}

.rally-helper__submit {
    background: #087ea4;
    border: 0;
    border-radius: 7px;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 8px 12px;
}

.rally-helper__submit:disabled {
    cursor: wait;
    opacity: 0.65;
}

html.rl-dark-mode body .rally-helper__panel {
    background: #0f172a !important;
    border-color: rgba(148, 163, 184, 0.34) !important;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.48);
    color: #f8fafc !important;
}

html.rl-dark-mode body .rally-helper__panel,
html.rl-dark-mode body .rally-helper__button,
html.rl-dark-mode body .rally-helper__toolbar-trigger {
    filter: invert(1) hue-rotate(180deg);
}

html.rl-dark-mode body .rally-helper__header,
html.rl-dark-mode body .rally-helper__quick-toggle,
html.rl-dark-mode body button.rally-helper__quick-toggle {
    background: #111c31 !important;
    border-color: rgba(148, 163, 184, 0.24) !important;
    color: #f8fafc !important;
}

html.rl-dark-mode body .rally-helper__header-mascot {
    background: #e0f2fe !important;
    border-color: rgba(125, 211, 252, 0.6) !important;
    color: #087ea4 !important;
}

html.rl-dark-mode body .rally-helper__header p,
html.rl-dark-mode body .rally-helper__source {
    color: #cbd5e1 !important;
}

html.rl-dark-mode body .rally-helper__header-copy,
html.rl-dark-mode body .rally-helper__header-copy strong {
    color: #f8fafc !important;
}

html.rl-dark-mode body .rally-helper__close {
    background: #1e293b !important;
    border: 1px solid rgba(148, 163, 184, 0.28) !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    color: #e2e8f0 !important;
    height: 24px;
    min-width: 24px;
    padding: 0 !important;
}

html.rl-dark-mode body .rally-helper__close:hover,
html.rl-dark-mode body .rally-helper__close:focus-visible {
    color: #fff;
}

html.rl-dark-mode body .rally-helper__message--helper {
    background: #162033 !important;
    border: 1px solid rgba(148, 163, 184, 0.14);
    color: #f8fafc !important;
}

html.rl-dark-mode body .rally-helper__message--student {
    background: #073b53 !important;
    border: 1px solid rgba(56, 189, 248, 0.18);
    color: #f8fafc !important;
}

html.rl-dark-mode body .rally-helper__messages {
    background: #0f172a !important;
}

html.rl-dark-mode body .rally-helper__disclaimer {
    background: #3b1118 !important;
    border-color: rgba(248, 113, 113, 0.34) !important;
    color: #fecdd3 !important;
}

html.rl-dark-mode body .rally-helper__quick,
html.rl-dark-mode body .rally-helper__form {
    background: #0f172a !important;
    border-color: rgba(148, 163, 184, 0.24) !important;
    color: #f8fafc !important;
}

html.rl-dark-mode body .rally-helper__quick-toggle:hover,
html.rl-dark-mode body .rally-helper__quick-toggle:focus,
html.rl-dark-mode body .rally-helper__quick-toggle:focus-visible,
html.rl-dark-mode body button.rally-helper__quick-toggle:hover,
html.rl-dark-mode body button.rally-helper__quick-toggle:focus,
html.rl-dark-mode body button.rally-helper__quick-toggle:focus-visible {
    background: #1e293b !important;
    color: #fff !important;
}

html.rl-dark-mode body .rally-helper__chip {
    background: #111c31 !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

html.rl-dark-mode body .rally-helper__chip:hover,
html.rl-dark-mode body .rally-helper__chip:focus-visible {
    background: #1e293b !important;
    border-color: #38bdf8 !important;
    color: #fff !important;
}

html.rl-dark-mode body .rally-helper__input,
html.rl-dark-mode body input.rally-helper__input {
    background: #020617 !important;
    border-color: #475569 !important;
    box-shadow: none !important;
    color: #f8fafc !important;
}

html.rl-dark-mode body .rally-helper__input::placeholder {
    color: #94a3b8 !important;
}

html.rl-dark-mode body .rally-helper__submit,
html.rl-dark-mode body button.rally-helper__submit {
    background: #0ea5e9 !important;
    border: 0 !important;
    color: #fff !important;
}

html.rl-dark-mode body .rally-helper__report {
    background: #111827 !important;
    border-color: #475569 !important;
    color: #cbd5e1 !important;
}

html.rl-dark-mode body .rally-helper__report:hover,
html.rl-dark-mode body .rally-helper__report:focus-visible {
    background: #3b1118 !important;
    border-color: #f87171 !important;
    color: #fecdd3 !important;
}

@media (max-width: 640px) {
    .rally-helper {
        bottom: 82px;
        right: 12px;
    }

    .rally-helper__panel {
        bottom: 58px;
        right: 12px;
        width: calc(100vw - 48px);
    }

    .rally-helper__header {
        padding: 16px;
    }

    .rally-helper__messages {
        padding: 16px;
    }

    .rally-helper__chips {
        padding: 0 16px 14px;
    }

    .rally-helper__quick-toggle {
        padding: 12px 16px;
    }

    .rally-helper__form {
        padding: 14px 16px 16px;
    }

    .rally-helper--toolbar .rally-helper__toolbar-trigger {
        height: 44px !important;
        min-height: 44px !important;
        min-width: 44px !important;
        width: 44px !important;
    }

    .rally-helper--toolbar .rally-helper__panel {
        bottom: calc(236px + env(safe-area-inset-bottom));
        max-height: min(390px, calc(100vh - 286px));
        right: 16px;
        width: calc(100vw - 32px);
    }
}
