.pls-container {
    --poll-accent: var(--room-switch-accent, #4678f9);
    --poll-toolbar-surface: rgba(18, 18, 21, 0.88);
    --poll-control-surface: rgba(255, 255, 255, 0.06);
    z-index: 5;
    position: absolute;
    display: flex;
    flex-direction: column;
    container-type: inline-size;
    container-name: polls;
    padding: 10px;
    width: 100%;
    height: 100%;
    max-width: 600px;
    max-height: 700px;
    border-radius: 10px;
    background: var(--body-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: max-width 0.5s ease-in-out;
}

.pls-container.show {
    display: flex !important;
}

.pls-container.is-maximized {
    padding: 12px;
    border-radius: 0;
}

.pls-container.is-maximized .poll-creation {
    width: min(100%, 760px);
    margin-right: auto;
    margin-left: auto;
}

.pls-container.is-maximized .polls-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 10px;
    width: min(100%, 1200px);
    margin: 0 auto;
}

.pls-container.is-maximized .poll {
    min-width: 0;
    margin-bottom: 0;
}

.poll-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 48px;
    padding: 5px 6px;
    margin-bottom: 14px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: var(--poll-toolbar-surface);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(14px);
    box-sizing: border-box;
    color: #fff;
    text-align: left;
    cursor: move;
    flex: 0 0 auto;
}

.poll-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 0 4px;
}

.poll-title-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 7px;
    background: color-mix(in srgb, var(--poll-accent) 14%, transparent);
    color: var(--poll-accent);
}

.poll-title-text {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0;
    white-space: nowrap;
}

.poll-header-btns {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    margin-left: auto;
}

.poll-tool-group {
    display: flex;
    align-items: center;
    gap: 2px;
    min-height: 36px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    background: var(--poll-control-surface);
}

.poll-header-btns button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    border: none !important;
    border-radius: 6px;
    background: transparent;
    color: #fff;
    font-size: 0.88rem;
    cursor: pointer;
    transition:
        background 0.18s ease,
        color 0.18s ease,
        box-shadow 0.18s ease;
}

.poll-header-btns button.hidden {
    display: none;
}

.poll-header-btns button:hover {
    background: rgba(255, 255, 255, 0.11);
}

.poll-header-btns button:focus-visible {
    outline: 2px solid var(--poll-accent);
    outline-offset: 2px;
}

.poll-header-btns button.is-active,
.poll-header-btns button[aria-pressed='true'] {
    background: color-mix(in srgb, var(--poll-accent) 18%, transparent);
    color: var(--poll-accent) !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--poll-accent) 40%, transparent);
}

.poll-creation {
    flex: 0 0 auto;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: var(--poll-toolbar-surface);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(14px);
}

.form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group {
    margin: 0;
}

.form label {
    display: block;
    margin-bottom: 7px;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
}

.form input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    background: var(--poll-control-surface);
    box-sizing: border-box;
    color: #fff;
    outline: none;
    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease;
}

.form input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.form input:focus {
    border-color: var(--poll-accent);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--poll-accent) 22%, transparent);
}

.poll-options-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
}

.poll-field-label {
    margin: 0;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
}

.poll-option-actions,
.poll-card-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    background: var(--poll-control-surface);
}

.poll-option-actions button,
.poll-card-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    transition:
        background 0.18s ease,
        color 0.18s ease,
        transform 0.15s ease;
}

.poll-option-actions button {
    width: 28px;
    height: 28px;
    font-size: 0.72rem;
}

.poll-option-actions button:hover,
.poll-card-action:hover {
    background: rgba(255, 255, 255, 0.11);
}

#pollDelOptionBtn:hover,
.poll-card-action-danger:hover {
    background: color-mix(in srgb, var(--color-danger, #ff4b4b) 18%, transparent);
    color: #fca5a5;
}

.poll-option-actions button:active,
.poll-card-action:active {
    transform: scale(0.92);
}

.poll-option-actions button:focus-visible,
.poll-card-action:focus-visible,
.poll-primary-btn:focus-visible {
    outline: 2px solid var(--poll-accent);
    outline-offset: 2px;
}

#optionsContainer {
    display: grid;
    gap: 7px;
}

.option-input {
    margin: 0;
}

.poll-btns {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 12px;
}

.poll-primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: none;
    border-radius: 8px;
    background: var(--poll-accent);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--poll-accent) 30%, transparent);
    color: var(--room-switch-ink, #fff);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.15s ease;
}

.poll-primary-btn:hover {
    background: color-mix(in srgb, var(--poll-accent) 84%, white);
    color: var(--room-switch-ink, #fff);
}

.poll-primary-btn:active {
    transform: scale(0.97);
}

.polls {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.polls-container {
    padding: 0 2px 10px;
}

.poll {
    display: flex;
    flex-direction: column;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: var(--poll-toolbar-surface);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(14px);
}

.poll-question {
    margin: 0;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.4;
}

.poll .options {
    display: grid;
    gap: 7px;
    margin-top: 12px;
}

.poll-option-row {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 7px;
    background: var(--poll-control-surface);
    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease;
}

.poll-option-row:hover {
    background: rgba(255, 255, 255, 0.1);
}

.poll-option-row:has(input:checked) {
    border-color: color-mix(in srgb, var(--poll-accent) 52%, transparent);
    background: color-mix(in srgb, var(--poll-accent) 14%, transparent);
    box-shadow: inset 3px 0 0 var(--poll-accent);
}

.poll-option-row:focus-within {
    border-color: var(--poll-accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--poll-accent) 20%, transparent);
}

.poll-option-row input[type='radio'] {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--poll-accent);
}

.options label {
    width: 100%;
    margin: 0;
    padding: 10px 12px 10px 38px;
    color: #fff;
    font-size: 0.78rem;
    line-height: 1.35;
    cursor: pointer;
}

.poll-card-footer {
    margin-top: auto;
}

.poll hr {
    margin: 12px 0 8px;
    border-color: rgba(255, 255, 255, 0.08);
    opacity: 1;
}

.poll-card-actions {
    justify-content: flex-end;
    width: fit-content;
    margin-left: auto;
}

.poll ul {
    padding: 0;
    margin: 10px 0 0;
    list-style-type: none;
}

.poll ul li {
    padding: 7px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.72rem;
}

.poll ul li:last-child {
    border-bottom: none;
}

@media (max-width: 400px) {
    .pls-container {
        padding: 5px;
        border-radius: 8px;
    }
}

@container polls (max-width: 400px) {
    .poll-header {
        gap: 4px;
        min-height: 38px;
        padding: 2px;
    }

    .poll-title-text {
        display: none;
    }

    .poll-title-mark {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
    }

    .poll-header-title {
        gap: 2px;
        padding: 0;
    }

    .poll-header-btns {
        gap: 3px;
    }

    .poll-tool-group {
        min-height: 30px;
        padding: 0;
        border: none;
        background: transparent;
    }

    .poll-layout-tools {
        order: 1;
    }

    .poll-document-tools {
        order: 2;
    }

    #pollCloseBtn {
        order: 3;
    }

    .poll-header-btns button {
        width: 28px;
        min-width: 28px;
        height: 28px;
        padding: 5px;
        font-size: 0.75rem;
    }

    .poll-creation {
        padding: 10px;
    }

    #addPollButton {
        width: 100%;
    }
}
