.fh-helper,
.fh-helper * {
    box-sizing: border-box;
}

.fh-helper {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: calc(84px + env(safe-area-inset-bottom));
    z-index: 180;
    font-family: inherit;
}

.fh-helper[hidden],
.fh-helper-panel[hidden] {
    display: none;
}

.fh-helper-trigger {
    display: block;
    width: 128px;
    height: 171px;
    margin-left: auto;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: transparent;
    cursor: pointer;
    filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.55));
}

.fh-helper-trigger img {
    display: block;
    width: 154px;
    height: 205px;
    max-width: none;
    margin: -24px 0 0 -13px;
    image-rendering: pixelated;
}

.fh-helper-teaser {
    position: absolute;
    right: calc(100% - 8px);
    bottom: 55px;
    width: min(220px, calc(100vw - 136px));
    margin: 0;
    padding: 9px 11px;
    border: 1px solid rgba(197, 160, 89, 0.65);
    border-radius: 11px;
    background: #111a22;
    color: var(--text-main);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    font-size: 0.78rem;
    line-height: 1.35;
    opacity: 1;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.fh-helper-teaser[hidden] {
    display: none;
}

.fh-helper-teaser.is-fading {
    opacity: 0;
}

.fh-helper-trigger:hover {
    filter: drop-shadow(0 5px 12px rgba(197, 160, 89, 0.5));
}

.fh-helper-trigger:focus-visible,
.fh-helper-panel :is(button, a, input):focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 3px;
}

.fh-helper-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% - 14px);
    width: min(300px, calc(100vw - 24px));
    max-height: min(390px, calc(100dvh - 310px));
    overflow: auto;
    padding: 13px;
    border: 1px solid rgba(197, 160, 89, 0.65);
    border-radius: 12px;
    background: #111a22;
    color: var(--text-main);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.fh-helper-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--accent-gold);
    font-size: 0.88rem;
}

.fh-helper-close {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(197, 160, 89, 0.45);
    border-radius: 7px;
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
}

.fh-helper-message {
    margin: 4px 0 10px;
    font-size: 0.82rem;
}

.fh-helper-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.fh-helper-input-row {
    display: flex;
    gap: 7px;
}

.fh-helper-input-row input {
    min-width: 0;
    flex: 1;
    padding: 8px 9px;
    border: 1px solid rgba(197, 160, 89, 0.5);
    border-radius: 7px;
    background: #0a0e12;
    color: var(--text-main);
    font: inherit;
    font-size: 0.79rem;
}

.fh-helper-input-row button {
    padding: 7px 9px;
    border: 1px solid var(--accent-gold);
    border-radius: 7px;
    background: var(--accent-gold);
    color: #0a0e12;
    cursor: pointer;
    font: inherit;
    font-size: 0.74rem;
    font-weight: 700;
}

.fh-helper-input-row button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.fh-helper-modes {
    display: flex;
    gap: 5px;
    margin-top: 8px;
}

.fh-helper-modes button {
    padding: 4px 8px;
    border: 1px solid rgba(197, 160, 89, 0.38);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.7rem;
}

.fh-helper-modes button[aria-pressed="true"] {
    border-color: var(--accent-gold);
    background: rgba(197, 160, 89, 0.16);
    color: var(--text-main);
}

.fh-helper-results:not(:empty) {
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid rgba(197, 160, 89, 0.25);
}

.fh-helper-results p {
    margin: 0 0 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.fh-helper-results ul {
    display: grid;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.fh-helper-results a,
.fh-helper-links a {
    color: var(--accent-gold);
    text-decoration: none;
}

.fh-helper-results a {
    display: block;
    padding: 6px 8px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.04);
    line-height: 1.35;
}

.fh-helper-results a:hover,
.fh-helper-links a:hover {
    background: rgba(197, 160, 89, 0.12);
    text-decoration: underline;
}

.fh-helper-results small {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.fh-helper-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(197, 160, 89, 0.25);
    font-size: 0.68rem;
}

@media (max-width: 480px) {
    .fh-helper {
        right: max(12px, env(safe-area-inset-right));
        bottom: calc(72px + env(safe-area-inset-bottom));
    }

    .fh-helper-trigger {
        width: 104px;
        height: 139px;
    }

    .fh-helper-trigger img {
        width: 125px;
        height: 167px;
        margin: -20px 0 0 -10px;
    }

    .fh-helper-panel {
        max-height: calc(100dvh - 270px);
        padding: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fh-helper-teaser {
        transition: none;
    }
}

@media (min-width: 380px) and (max-width: 480px) and (max-height: 560px) {
    .fh-helper-panel {
        right: calc(100% + 6px);
        bottom: 0;
        width: min(260px, calc(100vw - 125px));
        max-height: calc(100dvh - 100px);
    }
}
