body {
    --poll-background-color: #18181B;
    --poll-bubble-color: #262623;
    --poll-bubble-winner-color: #297c45;
    --poll-border-color: #484849;
    --poll-text-color: #EFEFF1;
    --poll-option-accent-color: #FFCC03;
    --poll-vote-enabled-color: #BE9800;
    --poll-vote-enabled-hover-color: #947600;
    --poll-vote-disabled-color: #808080;
    --poll-stop-btn-bgcolor: #f85d5db8;
    --poll-stop-btn-bgcolor-hover: #dd3737b8;
    --twitch-btn-bgcolor: #6541A5;
    --twitch-btn-hover-bgcolor: #9466C5;
}

html, body {
    min-height: 100%;
    width: 100%;
    font-family: Arial, sans-serif;
    color: #000;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    background-image: url('../resources/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 100dvh;
}

.content {
    display: flex;
    flex-direction: var(--panel-direction, column);
    align-items: center;
    justify-content: space-between;
    min-height: 100dvh;
    width: 100%;
    padding: clamp(1rem, 2.5vw, 2rem);
    gap: clamp(1rem, 2vw, 1.5rem);
}

@keyframes joy {
    0% {
        transform: rotate(0) scale(1);
    }
    15% {
        transform: rotate(20deg) scale(1.2) translate(0.125rem, -0.25rem);
    }
    30% {
        transform: rotate(0) scale(1) translate(0, 0);
    }
    45% {
        transform: rotate(-20deg) scale(1.2) translate(-0.125rem, -0.25rem);
    }
    60% {
        transform: rotate(0) scale(1) translate(0, 0);
    }
    75% {
        transform: scale(1.21) translateY(-0.25rem);
    }
    90% {
        transform: rotate(0) scale(1);
    }
}

.fa-trophy {
    animation-name: joy;
    animation-duration: 2s;
    animation-iteration-count: 30;
}

/*  ------------------------------------------------------------------------------------
   -----------------------------------------Poll-----------------------------------------
    ------------------------------------------------------------------------------------
*/
.pollContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: min(100%, clamp(28rem, 70vw, 56rem));
}

.currentPoll {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(1.25rem, 2.5vw, 2rem) clamp(1.5rem, 3.5vw, 3rem);
    border-radius: 1rem;
    color: var(--poll-text-color);
    background-color: var(--poll-background-color);
    border: 0.0625rem solid var(--poll-border-color);
    width: 100%;
    max-width: 100%;
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.2);
}

.bubble {
    padding: clamp(0.9rem, 1.5vw, 1.25rem) clamp(1rem, 2vw, 1.5rem);
    border-radius: 1.25rem;
    background-color: var(--poll-bubble-color);
    width: 100%;
    text-align: center;
    font-size: clamp(1rem, 1.6vw, 1.2rem);
}

.bubble .option {
    padding: 0.75rem;
    text-align: start;
}

.pollOptions {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: clamp(0.75rem, 1.2vw, 1rem);
    margin-top: clamp(1rem, 2vw, 1.5rem);
}

.pollOption {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    padding: 0;
    text-align: start;
    width: 100%;
    border-radius: 0.875rem;
    background-color: var(--poll-bubble-color);
    min-height: clamp(3rem, 5vw, 3.75rem);
    transition: background-color 0.3s ease;
}

.pollOption.winner {
    background-color: var(--poll-bubble-winner-color);
}

.pollOptionBar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.5);
    opacity: 0.5;
    z-index: 0;
    transition: width 0.5s cubic-bezier(0.3, 0, 0.2, 1), background-color 0.5s ease;
}

.pollOptionBar.chosen {
    background-color: var(--poll-option-accent-color);
    transition: width 0.5s cubic-bezier(0.3, 0, 0.2, 1), background-color 0s ease;
}

.pollOptionContent {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.3125rem 0.9375rem;
    gap: 0.9375rem;
}

.pollOptionInput {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex: 1;
}

.pollOptionInput input[type="radio"],
.pollOptionInput input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: var(--poll-option-accent-color);
    margin: 0;
}

.optionLabel {
    min-width: 0;
    max-width: 100%;
    font-weight: 500;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    flex: 1;
    cursor: pointer;
    line-height: 1.45;
}

.optionVotes {
    width: clamp(3.5rem, 8vw, 4.75rem);
    text-align: right;
    font-weight: 500;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    white-space: nowrap;
}

.pollCountdown {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.35rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pollCountdownBar {
    flex: 1;
    height: 0.35rem;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.pollCountdownBar::after {
    content: '';
    display: block;
    width: var(--progress, 100%);
    height: 100%;
    background: linear-gradient(90deg, var(--poll-option-accent-color), #ffd84d);
    transition: width 0.25s linear;
}

.pollCountdownText {
    color: rgba(239, 239, 241, 0.85);
    font-size: 0.9rem;
    white-space: nowrap;
}

.voteButton {
    margin-top: 1.25rem;
    padding: 0.75rem clamp(1.5rem, 4vw, 2.5rem);
    font-size: clamp(0.95rem, 1.8vw, 1rem);
    font-weight: 600;
    color: var(--poll-text-color);
    border: none;
    border-radius: 0.3125rem;
    cursor: pointer;
    transition: background-color 0.3s ease, opacity 0.3s ease;
}

.voteButton:enabled {
    background-color: var(--poll-vote-enabled-color);
}

.voteButton:enabled:hover {
    background-color: var(--poll-vote-enabled-hover-color);
}

.voteButton:disabled {
    background-color: var(--poll-vote-disabled-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.pollTitleRow {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.bubble.pollTitle {
    flex: 1;
    width: auto;
}

#stopPollBtn {
    height: 4rem;
    flex-shrink: 0;
    margin-left: auto;
    padding: 0.25rem 0.65rem;
    border: none;
    border-radius: 1rem;
    background: var(--poll-stop-btn-bgcolor);
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

#stopPollBtn:hover {
    background-color: var(--poll-stop-btn-bgcolor-hover);
}

.adminStartModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.adminStartModalCard {
    width: min(100%, 24rem);
    background: rgba(24, 24, 27, 0.98);
    color: var(--poll-text-color);
    border: 0.0625rem solid var(--poll-border-color);
    border-radius: 1rem;
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.25);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.adminStartModalCard h4 {
    margin: 0;
    font-size: 1.1rem;
}

.adminStartModalField {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.adminStartModalField input {
    width: 100%;
    border: 0;
    border-radius: 0.625rem;
    padding: 0.7rem 0.8rem;
    font-size: 0.95rem;
}

.adminStartModalActions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.25rem;
}

.adminStartModalActions .adminSecondaryButton,
.adminStartModalActions .adminPrimaryButton {
    flex: 1;
}

.adminPollItem .adminPollStatus {
    margin-left: 0;
}

.adminPollItem strong {
    display: block;
    word-break: break-word;
}

.adminPollItem .adminPollItemActions {
    margin-bottom: 0.25rem;
}

/*  ------------------------------------------------------------------------------------
   -----------------------------------------Logo-----------------------------------------
    ------------------------------------------------------------------------------------
*/
img.logo {
    flex: 1;
    max-width: 100%;
    height: auto;
}

.floatingIcon {
    position: fixed;
    width: clamp(3.5rem, 5vw, 4.5rem);
    height: auto;
    cursor: pointer;
    z-index: 900;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.floatingIcon:hover {
    transform: scale(1.05);
    opacity: 0.95;
}

.floatingChat {
    top: 1rem;
    left: 1rem;
}

.floatingKeyboard {
    height: clamp(3.5rem, 5vw, 4.5rem);
    width: auto;
    bottom: 1rem;
    right: 1rem;
}

/*  ------------------------------------------------------------------------------------
   ------------------------------------Control Panel-------------------------------------
    ------------------------------------------------------------------------------------
*/
.panelContainer {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#connection {
    display: flex;
    gap: 0.625rem;
    font-size: clamp(1.25rem, 2.5vw, 1.875rem);
    padding: 0.875rem 1.5rem;
    border-radius: 0.9375rem;
    border: 0;
    background-color: var(--twitch-btn-bgcolor);
    color: white;
    transition: background-color 0.3s ease;
}

#connection:hover {
    background-color: var(--twitch-btn-hover-bgcolor);
}

.adminPollLayout {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    width: 100%;
    max-width: min(100%, 90rem);
    margin: 0;
}

.adminPollPanel {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 62rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: clamp(1rem, 2vw, 1.5rem);
    border-radius: 1rem;
    background-color: rgba(24, 24, 27, 0.95);
    border: 0.0625rem solid var(--poll-border-color);
    color: var(--poll-text-color);
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.2);
}

.adminPollPanelHeader h3,
.adminPollListHeader h4 {
    margin: 0 0 0.25rem;
}

.adminPollPanelHeader p {
    margin: 0;
    color: rgba(239, 239, 241, 0.8);
    font-size: 0.95rem;
}

.adminPollPanelCreate {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100%;
    flex: 1 1 auto;
    min-width: 0;
}

.adminPollPanelCreateInner {
    width: min(100%, 30rem);
}

.adminPollForm {
    width: min(100%, 30rem);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.adminPollList {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 0 0 22rem;
    max-width: 22rem;
    width: 22rem;
    padding: clamp(1rem, 2vw, 1.25rem);
    border-radius: 1rem;
    background-color: rgba(24, 24, 27, 0.95);
    border: 0.0625rem solid var(--poll-border-color);
    color: var(--poll-text-color);
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.2);
}

.adminPollForm label,
.optionCreatorLabel {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.95rem;
}

.adminPollForm input,
.optionCreatorInput {
    width: 100%;
    border: 0;
    border-radius: 0.625rem;
    padding: 0.7rem 0.8rem;
    font-size: 0.95rem;
}

.adminPollFormFooter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.adminCheckboxLabel {
    flex-direction: row !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    flex: 1;
}

.adminCheckboxLabel input {
    width: auto;
    accent-color: var(--poll-option-accent-color);
}

.pollOptionsInputs {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.optionCreatorRow {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.optionCreatorLabel {
    flex: 1;
}

.optionRemoveButton,
.addOptionButton {
    border: none;
    border-radius: 0.625rem;
    padding: 0.7rem 0.8rem;
    cursor: pointer;
}

.optionRemoveButton {
    background-color: rgba(248, 93, 93, 0.2);
    color: #ffb3b3;
}

.addOptionButton {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--poll-text-color);
    font-size: 0.95rem;
}

.addOptionButton:hover {
    background-color: rgba(255, 255, 255, 0.16);
}

.adminPrimaryButton,
.adminSecondaryButton {
    border: none;
    border-radius: 0.625rem;
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.adminPrimaryButton {
    background-color: var(--poll-vote-enabled-color);
    color: white;
}

.adminPrimaryButton:hover {
    background-color: var(--poll-vote-enabled-hover-color);
}

.adminSecondaryButton {
    background-color: rgba(255, 255, 255, 0.12);
    color: var(--poll-text-color);
}

.adminSecondaryButton:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.adminPollListHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.pollsList {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.adminPollItem {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.85rem;
    border-radius: 0.75rem;
    background-color: rgba(255, 255, 255, 0.06);
    position: relative;
}

.adminPollItemHeader {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding-top: 1.35rem;
}

.adminPollItemHeader > div:last-child {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
}

.adminPollStatus {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    display: inline-flex;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    background-color: rgba(255, 204, 3, 0.2);
    color: #ffe68d;
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
    max-width: 100%;
    z-index: 1;
}

.adminPollItemActions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
}

.adminPollOptions {
    margin: 0;
    padding-left: 1.1rem;
    color: rgba(239, 239, 241, 0.85);
}

.emptyState {
    margin: 0;
    color: rgba(239, 239, 241, 0.7);
    font-style: italic;
}

@media (max-width: 48rem) {
    .content {
        padding: 0.75rem;
    }

    .pollOptions {
        gap: 0.5rem;
    }

    .pollOptionContent {
        flex-direction: column;
        align-items: flex-start;
    }

    .optionVotes {
        width: auto;
        align-self: flex-end;
    }

    .voteButton {
        width: 100%;
    }
}

@media (max-width: 30rem) {
    .currentPoll {
        padding: 1rem;
    }

    .bubble {
        padding: 0.625rem 1rem;
    }

    .pollOption {
        min-height: 3rem;
    }

    .pollOptionContent {
        padding: 0.5rem 0.75rem;
    }

    #connection {
        width: 100%;
        justify-content: center;
    }

    .adminPollLayout {
        flex-direction: column;
        align-items: stretch;
    }

    .adminPollPanelCreate {
        width: 100%;
    }

    .adminPollList {
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
        border-left: none;
        padding-top: 0.25rem;
    }

    .adminPollFormFooter {
        flex-direction: column;
        align-items: stretch;
    }

    .adminPollItemHeader {
        flex-direction: column;
        align-items: stretch;
    }

    .adminPollItemActions {
        width: 100%;
        flex-wrap: wrap;
    }

    .adminPollItemActions button {
        flex: 1;
    }
}