.modal:has(.poll-dialog) {
    max-width: 550px;
    background: #151b15;
    border-color: #d4fac233;
}

.poll-dialog {
    --poll-accent: #c6f366;
    --poll-wrong: #ffaca7;
    --poll-line: #d9f7c722;
}

.poll-dialog-cover {
    position: relative;
    isolation: isolate;
    height: 150px;
    overflow: hidden;
    background: radial-gradient(ellipse at 70% 50%, #3e591d, #121813 69%);
}

.poll-dialog-cover img {
    position: absolute;
    z-index: -2;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 68% center;
}

.poll-dialog-cover::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    background: linear-gradient(0deg, #151b15 0%, #151b1555 47%, transparent 85%);
}

.poll-cover-label {
    position: absolute;
    bottom: 10px;
    left: 28px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border: 1px solid #c6f36645;
    border-radius: 100px;
    background: #101810e8;
    color: var(--poll-accent);
    font-size: 11px;
    font-weight: 700;
}

.poll-cover-label svg { width: 14px; height: 14px; }
.poll-content { padding: 5px 28px 26px; }

.poll-content h2,
.poll-loading h2 {
    margin-bottom: 20px;
    font-size: clamp(23px, 5vw, 33px);
    line-height: 1.15;
    letter-spacing: -.045em;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

.poll-loading { padding-top: 54px; min-height: 165px; }
.poll-loading p { color: var(--muted); }
.poll-loading .button { margin-top: 16px; }
.poll-choices { display: grid; gap: 8px; min-width: 0; padding: 0; margin: 0; border: 0; }
.poll-choices legend { margin: 0 0 10px; padding: 0; color: #afbda8; font-size: 12px; }

.poll-choice {
    position: relative;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 11px 14px;
    border: 1px solid var(--poll-line);
    border-radius: 13px;
    background: #e5ffd007;
    color: #f1f6ec;
    cursor: pointer;
    font-size: 13px;
    font-weight: 650;
    overflow-wrap: anywhere;
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
    animation: poll-item-in .32s both cubic-bezier(.22, 1, .36, 1);
    animation-delay: min(calc(var(--option-index) * 25ms), 150ms);
}

.poll-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
}

.poll-choice:hover { background: #e5ffd010; }
.poll-choice:active { transform: scale(.99); }
.poll-choice:has(input:focus-visible) { outline: 2px solid var(--poll-accent); outline-offset: 2px; }
.poll-choice:has(input:checked) { border-color: #c6f36680; background: #c6f36616; }

.poll-choice-mark {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 1px solid #91a285;
    border-radius: 50%;
    color: #19240e;
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.poll-choice.is-multiple .poll-choice-mark { border-radius: 6px; }
.poll-choice-mark svg { width: 13px; height: 13px; opacity: 0; stroke-width: 2.6; }
.poll-choice input:checked + .poll-choice-mark { background: var(--poll-accent); border-color: var(--poll-accent); transform: scale(1.06); }
.poll-choice input:checked + .poll-choice-mark svg { opacity: 1; }
.poll-submit { margin-top: 15px; justify-content: space-between; min-height: 46px; }
.poll-submit:disabled { opacity: .45; cursor: default; }
.poll-edit-cancel, .poll-edit-answer { margin-top: 9px; }
.poll-results { animation: poll-item-in .3s both cubic-bezier(.22, 1, .36, 1); }

.poll-verdict {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 0 0 17px;
    border: 1px solid #c6f36640;
    border-radius: 13px;
    background: #c6f36610;
    color: #e0f5cb;
    font-size: 13px;
}

.poll-verdict > span {
    display: grid;
    place-items: center;
    flex: 0 0 29px;
    height: 29px;
    border-radius: 9px;
    background: #c6f36620;
    color: var(--poll-accent);
}

.poll-verdict svg { width: 16px; height: 16px; }
.poll-verdict.is-success { border-color: #c6f36675; color: #e1ffa8; box-shadow: 0 0 24px #aee95713; }
.poll-verdict.is-wrong { border-color: #ff928650; background: #ff817412; color: #ffd1ca; }
.poll-verdict.is-wrong > span { background: #ff928625; color: var(--poll-wrong); }
.poll-results-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.poll-results-heading h3 { font-size: 15px; }
.poll-results-heading > span { font-size: 11px; color: #afbda8; }
.poll-result-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }

.poll-result {
    --result-color: #cfddc7;
    --result-fill: #acbfa029;
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 49px;
    padding: 9px 13px;
    overflow: hidden;
    border: 1px solid var(--poll-line);
    border-radius: 11px;
    background: #e5ffd007;
    font-size: 12px;
}

.poll-result.is-correct, .poll-result.is-selected {
    --result-color: #ddfba3;
    --result-fill: #c6f36636;
    border-color: #c6f36655;
}

.poll-result.is-wrong {
    --result-color: #ffd0ca;
    --result-fill: #ff817439;
    border-color: #ff928654;
}

.poll-result-fill {
    position: absolute;
    z-index: -1;
    inset: 0;
    transform: scaleX(var(--share));
    transform-origin: left;
    background: linear-gradient(90deg, var(--result-fill), color-mix(in srgb, var(--result-fill) 76%, transparent));
    animation: poll-fill .65s cubic-bezier(.22, 1, .36, 1) both;
    animation-delay: min(calc(var(--option-index) * 32ms), 220ms);
}

.poll-result-copy { display: grid; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.poll-result-copy strong { font-weight: 700; }
.poll-result-copy small { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--result-color); }
.poll-result-copy svg { width: 12px; height: 12px; }
.poll-result > b { flex-shrink: 0; color: var(--result-color); font-size: 14px; font-variant-numeric: tabular-nums; }
.poll-confetti-layer { position: absolute; inset: 0; pointer-events: none; }

.poll-confetti {
    position: absolute;
    bottom: 3px;
    width: 5px;
    height: 9px;
    border-radius: 2px;
    background: var(--paper);
    opacity: 0;
}

.poll-confetti:nth-child(3n) { height: 5px; border-radius: 50%; }

@keyframes poll-item-in {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes poll-fill { from { transform: scaleX(0); } }

.admin-poll-list { display: grid; gap: 9px; }
.admin-poll-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.admin-poll-stats { white-space: nowrap; }

.admin-poll-row {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr) auto 17px;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 70px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff04;
    text-align: left;
    transition: background .2s ease, border-color .2s ease, transform .3s cubic-bezier(.2, 1.5, .4, 1);
}

.admin-poll-row:hover { background: #c6f3660a; border-color: #c6f36650; }
.admin-poll-row > img { width: 100%; height: 51px; object-fit: cover; object-position: 68% center; border-radius: 7px; }
.admin-poll-row > svg { width: 15px; height: 15px; color: var(--muted); }
.admin-poll-name { display: grid; gap: 3px; overflow-wrap: anywhere; }
.admin-poll-name strong { font-size: 13px; }
.admin-poll-name span { color: var(--muted); font-size: 10px; }
.poll-admin-form { display: grid; gap: 12px; margin-top: 19px; }
.poll-admin-cover { width: 100%; height: 112px; object-fit: cover; object-position: 68% center; border: 1px solid var(--line); border-radius: 12px; }
.poll-cover-help { margin-top: -6px; }
.poll-config { display: grid; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
.poll-config .check, .poll-publish, .poll-correct-toggle { line-height: 1.4; }
.poll-admin-options-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 5px; }
.poll-admin-options-header h3 { font-size: 17px; }
.poll-admin-options { display: grid; gap: 7px; }

.poll-admin-option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 11px;
}

.poll-admin-option .input { min-width: 0; }
.poll-option-actions { display: flex; gap: 4px; }
.poll-option-actions button { width: 31px; height: 34px; border-radius: 7px; }
.poll-option-actions svg { width: 15px; height: 15px; }
.poll-option-up svg { transform: rotate(-90deg); }
.poll-option-down svg { transform: rotate(90deg); }
.poll-option-actions button:disabled { opacity: .35; cursor: default; }
.poll-correct-toggle { grid-column: 1 / -1; padding: 3px 2px; color: var(--muted); font-size: 11px; }
.poll-correct-toggle[hidden] { display: none; }
.poll-correct-toggle input { accent-color: var(--accent); }
.poll-admin-form .form-actions { margin-top: 5px; }
.poll-publish { margin: 5px 0 0; }

.admin-poll-list .button,
.admin-header:has([data-action="edit-poll"]) > .button,
.poll-admin-form .button,
.poll-dialog .button,
.poll-stats .button {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    transition: background .2s ease, border-color .2s ease, box-shadow .25s ease, transform .3s cubic-bezier(.2, 1.5, .4, 1);
}

.admin-poll-stats::after,
.admin-header > [data-action="edit-poll"]::after,
.poll-admin-form .button.primary::after,
.poll-dialog .button.primary::after,
.poll-stats .button::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(108deg, transparent 25%, #f2ffd845 50%, transparent 75%);
    transform: translateX(-125%);
    transition: transform .48s ease;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .admin-poll-row:hover,
    .admin-poll-stats:hover,
    .admin-header > [data-action="edit-poll"]:hover,
    .poll-admin-form .button.primary:not(:disabled):hover,
    .poll-dialog .button.primary:not(:disabled):hover,
    .poll-stats .button:not(:disabled):hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 18px #9cda3d24;
    }
    .admin-poll-stats:hover::after,
    .admin-header > [data-action="edit-poll"]:hover::after,
    .poll-admin-form .button.primary:not(:disabled):hover::after,
    .poll-dialog .button.primary:not(:disabled):hover::after,
    .poll-stats .button:not(:disabled):hover::after {
        transform: translateX(125%);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .admin-poll-row:active { transform: scale(.985); }
    .admin-poll-stats:active,
    .admin-header > [data-action="edit-poll"]:active,
    .poll-admin-form .button:not(:disabled):active,
    .poll-dialog .button:not(:disabled):active,
    .poll-stats .button:not(:disabled):active { transform: scale(.965); }
    .poll-option-actions button:not(:disabled):active { transform: scale(.9); }
}

@media (max-width: 700px) {
    .poll-dialog-cover { height: 119px; }
    .poll-cover-label { left: 18px; bottom: 8px; }
    .modal-content.poll-content { padding: 5px 17px 17px; }
    .poll-content h2 { margin-bottom: 15px; }
    .admin-poll-row { grid-template-columns: 52px minmax(0, 1fr) auto; gap: 8px; padding: 6px; }
    .admin-poll-row > svg { display: none; }
    .admin-poll-item { grid-template-columns: minmax(0, 1fr); gap: 5px; }
    .admin-poll-stats { justify-self: end; }
}
