/* ── CSS custom properties (defaults, overridden per-poll via inline style) ── */
.sfpoll-wrap {
    --sfpoll-color-bg:         #ffffff;
    --sfpoll-color-text:       #1a1a1a;
    --sfpoll-color-bar-bg:     #e0e0e0;
    --sfpoll-color-bar-losing: #a0a0a0;
    --sfpoll-color-winner:     #e63946;
    --sfpoll-color-button:     #1a1a1a;
}

/* ── Card ── */
.sfpoll-wrap {
    box-sizing: border-box;
    max-width: 560px;
    margin: 2em auto;
    padding: 2em 2.25em;
    width: calc(100% - 2rem);
    background: var(--sfpoll-color-bg);
    color: var(--sfpoll-color-text);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
    font-family: inherit;
}

.sfpoll-wrap *,
.sfpoll-wrap *::before,
.sfpoll-wrap *::after {
    box-sizing: inherit;
}

/* ── Title & Question ── */
.sfpoll-title {
    margin: 0 0 0.3em 0;
    font-size: 1.15em;
    font-weight: 700;
    line-height: 1.35;
    color: var(--sfpoll-color-text);
}

.sfpoll-question {
    margin: 0 0 1.25em 0;
    font-size: 0.97em;
    line-height: 1.5;
    color: var(--sfpoll-color-text);
    opacity: 0.75;
}

/* ── Voting form ── */
.sfpoll-form .sfpoll-answers {
    list-style: none;
    margin: 0 0 1.25em 0;
    padding: 0;
}

.sfpoll-form .sfpoll-answers li {
    margin-bottom: 0.6em;
}

.sfpoll-form .sfpoll-answers label {
    display: flex;
    align-items: center;
    gap: 0.6em;
    cursor: pointer;
    font-size: 0.97em;
}

.sfpoll-form .sfpoll-answers input[type="radio"] {
    accent-color: var(--sfpoll-color-button);
    width: 1.1em;
    height: 1.1em;
    flex-shrink: 0;
    cursor: pointer;
}

.sfpoll-submit {
    display: inline-block;
    padding: 0.55em 1.5em;
    background: var(--sfpoll-color-button);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: opacity 0.15s ease;
}

.sfpoll-submit:hover {
    opacity: 0.82;
}

.sfpoll-submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.sfpoll-message {
    margin-top: 0.6em;
    font-size: 0.88em;
    font-style: italic;
    color: #888;
    min-height: 1.2em;
}

/* ── Results ── */
.sfpoll-results {
    margin-top: 0.25em;
}

.sfpoll-result-row {
    margin-bottom: 1em;
}

/* Header row: label left, stats right */
.sfpoll-result-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5em;
    margin-bottom: 0.3em;
}

.sfpoll-bar-label {
    font-size: 0.95em;
    font-weight: 500;
    color: var(--sfpoll-color-text);
}

.sfpoll-bar-stats {
    font-size: 0.82em;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Bar */
.sfpoll-bar-track {
    width: 100%;
    height: 10px;
    background: var(--sfpoll-color-bar-bg);
    border-radius: 5px;
    overflow: hidden;
}

.sfpoll-bar-fill {
    height: 100%;
    background: var(--sfpoll-color-bar-losing);
    border-radius: 5px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Winner highlight */
.sfpoll-result-row.is-winner .sfpoll-bar-fill {
    background: var(--sfpoll-color-winner);
}

.sfpoll-result-row.is-winner .sfpoll-bar-label {
    font-weight: 700;
    color: var(--sfpoll-color-winner);
}

.sfpoll-result-row.is-winner .sfpoll-bar-stats {
    color: var(--sfpoll-color-winner);
    font-weight: 600;
}

/* Total */
.sfpoll-total {
    margin-top: 1em;
    font-size: 0.82em;
    color: #aaa;
    text-align: right;
}

/* ── Table of Contents ── */
.sfpoll-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    max-width: 560px;
    width: calc(100% - 2rem);
    margin: 0 auto 1.5em;
}

.sfpoll-toc-btn {
    display: inline-block;
    padding: 0.45em 1em;
    background: #f0f0f0;
    color: #1a1a1a;
    border-radius: 6px;
    font-size: 0.88em;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.sfpoll-toc-btn:hover {
    background: #1a1a1a;
    color: #fff;
    text-decoration: none;
}

/* Thank-you */
.sfpoll-thankyou {
    font-style: italic;
    color: #888;
    margin: 0.5em 0 0;
}
