/*
 * The Beta tab and its popup, in the app's button colour. --beta-bottom-offset lifts the tab clear of a fixed bar.
 */
.beta-feedback {
    --beta-bg: #1d4e9e;
    --beta-fg: #ffffff;
    position: fixed;
    right: 0;
    bottom: calc(5.5rem + var(--beta-bottom-offset, 0px));
    z-index: 900;
    font: 14px/1.4 system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.beta-feedback [hidden] {
    display: none !important;
}

.beta-tab {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0.55rem 0.8rem 0.55rem 0.75rem;
    border: 0;
    border-radius: 10px 0 0 10px;
    background: var(--beta-bg);
    color: var(--beta-fg);
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.22);
    position: relative;
}

.beta-tab:focus-visible,
.beta-send:focus-visible,
.beta-feedback button:focus-visible {
    outline: 3px solid var(--beta-fg);
    outline-offset: 2px;
}

.beta-tab svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.beta-dot {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d92d20;
    border: 2px solid #fff;
}

.beta-panel,
.beta-done {
    position: absolute;
    right: 0.6rem;
    bottom: 3.2rem;
    width: min(23rem, calc(100vw - 1.2rem));
    max-height: calc(100vh - 7rem);
    overflow: auto;
    box-sizing: border-box;
    padding: 1rem 1.1rem 1rem;
    border-radius: 12px;
    background: var(--beta-bg);
    color: var(--beta-fg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.beta-panel header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.beta-title {
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.25;
    color: inherit;
}

.beta-close {
    flex: none;
    margin: -0.3rem -0.4rem 0 0;
    padding: 0.2rem 0.5rem;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.beta-sub,
.beta-hint,
.beta-foot {
    margin: 0.35rem 0 0.6rem;
    font-size: 0.85rem;
}

.beta-hint {
    margin: 0.4rem 0;
    opacity: 0.9;
}

.beta-kinds {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 0.6rem;
    padding: 0;
    border: 0;
}

.beta-kinds label {
    cursor: pointer;
}

.beta-kinds input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.beta-kinds span {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border: 1.5px solid currentColor;
    border-radius: 999px;
    font-size: 0.82rem;
}

.beta-kinds input:checked + span {
    background: var(--beta-fg);
    color: var(--beta-bg);
}

.beta-kinds input:focus-visible + span {
    outline: 3px solid var(--beta-fg);
    outline-offset: 2px;
}

.beta-panel textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 6.5rem;
    padding: 0.6rem;
    border: 0;
    border-radius: 8px;
    background: #fff;
    color: #15202b;
    font: inherit;
    font-size: 1rem;
    resize: vertical;
}

.beta-count {
    margin: 0.2rem 0 0;
    text-align: right;
    font-size: 0.78rem;
}

.beta-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.beta-thumb {
    position: relative;
    display: inline-block;
}

.beta-thumb img {
    display: block;
    width: 4.5rem;
    height: 3.4rem;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #fff;
}

.beta-thumb button {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 1.3rem;
    height: 1.3rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--beta-fg);
    color: var(--beta-bg);
    font-size: 0.95rem;
    line-height: 1.3rem;
    cursor: pointer;
}

.beta-add {
    margin: 0.4rem 0 0;
    padding: 0.3rem 0.7rem;
    border: 1.5px dashed currentColor;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.beta-what {
    margin: 0.4rem 0 0.6rem;
    font-size: 0.8rem;
}

.beta-what summary {
    color: inherit;
    cursor: pointer;
}

.beta-what ul {
    margin: 0.3rem 0 0;
    padding-left: 1.1rem;
}

.beta-error {
    margin: 0.5rem 0 0;
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    background: #fff;
    color: #b42318;
    font-weight: 600;
    font-size: 0.88rem;
}

.beta-send {
    display: block;
    width: 100%;
    margin: 0.7rem 0 0;
    padding: 0.65rem;
    border: 0;
    border-radius: 8px;
    background: var(--beta-fg);
    color: var(--beta-bg);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

.beta-send:disabled {
    opacity: 0.6;
    cursor: progress;
}

.beta-foot a,
.beta-done a {
    color: inherit;
    font-weight: 600;
}

.beta-done p {
    margin: 0.5rem 0 0;
}

/* a phone: the tab is the icon alone, and the popup uses the width of the screen */
@media (max-width: 640px) {
    .beta-feedback {
        bottom: calc(4.5rem + var(--beta-bottom-offset, 0px));
    }

    /* a narrow strip on the edge, so it covers as little of the page as it can */
    .beta-tab {
        padding: 0.5rem 0.3rem 0.5rem 0.45rem;
        min-width: 32px;
        min-height: 44px;
        justify-content: center;
        opacity: 0.92;
    }

    .beta-tab svg {
        width: 1.1rem;
        height: 1.1rem;
    }

    .beta-tab-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    .beta-panel,
    .beta-done {
        right: 0.3rem;
    }
}

@media print {
    .beta-feedback {
        display: none;
    }
}

/* The person's own reports (/feedback). */
.feedback-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--tint); color: var(--accent); font-size: .8rem; font-weight: 700; }
.feedback-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-shot { max-width: 8rem; max-height: 8rem; margin: 0 8px 8px 0; border: 1px solid var(--line); border-radius: 8px; }
.feedback-answer { border-left: 3px solid var(--accent); padding-left: 12px; }
