.fxt-quiz {
    --fxtq-bg: #f6f7fb;
    --fxtq-panel: #ffffff;
    --fxtq-border: #d7dce7;
    --fxtq-text: #172033;
    --fxtq-muted: #5f6b7f;
    --fxtq-accent: #1f7a5c;
    --fxtq-accent-dark: #165b45;
    --fxtq-warn: #9a5b00;
    --fxtq-danger: #b42318;
    color: var(--fxtq-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 18px 0;
}

.fxt-quiz *,
.fxt-quiz *::before,
.fxt-quiz *::after {
    box-sizing: border-box;
}

body.fxt-quiz-modal-open {
    overflow: hidden;
}

.fxt-quiz-backdrop {
    align-items: center;
    background: rgba(15, 23, 42, 0.62);
    bottom: 0;
    display: flex;
    justify-content: center;
    left: 0;
    padding: 20px;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 99998;
}

.fxt-quiz-backdrop[hidden] {
    display: none;
}

.fxt-quiz-modal {
    background: var(--fxtq-bg);
    border: 1px solid var(--fxtq-border);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
    max-height: min(92vh, 900px);
    overflow: auto;
    padding: 14px;
    width: min(1120px, 100%);
}

.fxt-quiz-modal__header {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.fxt-quiz-modal__header h2,
.fxt-quiz-modal__header p {
    margin: 0;
}

.fxt-quiz-modal__header p {
    color: var(--fxtq-muted);
}

.fxt-quiz-modal__close {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--fxtq-border);
    border-radius: 6px;
    color: var(--fxtq-text);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font: inherit;
    font-weight: 800;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.fxt-quiz-modal__close:hover,
.fxt-quiz-modal__close:focus {
    border-color: var(--fxtq-accent);
    outline: none;
}

.fxt-quiz__shell {
    background: var(--fxtq-bg);
    border: 1px solid var(--fxtq-border);
    border-radius: 8px;
    padding: 14px;
}

.fxt-quiz__header,
.fxt-quiz-topbar,
.fxt-quiz-chat,
.fxt-quiz-suggest__actions {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.fxt-quiz__header h2,
.fxt-quiz__header p,
.fxt-quiz-panel h3,
.fxt-quiz-stats p,
.fxt-quiz-leaders p {
    margin: 0;
}

.fxt-quiz__header p,
.fxt-quiz-muted {
    color: var(--fxtq-muted);
}

.fxt-quiz__app {
    margin-top: 14px;
}

.fxt-quiz-layout {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1fr) 280px;
}

.fxt-quiz-panel {
    background: var(--fxtq-panel);
    border: 1px solid var(--fxtq-border);
    border-radius: 8px;
    padding: 14px;
}

.fxt-quiz-main {
    min-width: 0;
}

.fxt-quiz-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.fxt-quiz__primary,
.fxt-quiz__secondary,
.fxt-quiz-choice,
.fxt-quiz-link,
.fxt-quiz-report {
    border: 1px solid var(--fxtq-border);
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    min-height: 38px;
    padding: 8px 12px;
}

.fxt-quiz__primary {
    background: var(--fxtq-accent);
    border-color: var(--fxtq-accent);
    color: #fff;
    font-weight: 700;
}

.fxt-game-button {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
}

.fxt-quiz__primary:hover {
    background: var(--fxtq-accent-dark);
}

.fxt-quiz__secondary,
.fxt-quiz-link {
    background: #fff;
    color: var(--fxtq-text);
}

.fxt-quiz-link,
.fxt-quiz-report {
    min-height: 0;
    padding: 4px 8px;
}

.fxt-quiz-report {
    background: #fff7ed;
    color: var(--fxtq-warn);
    font-size: 12px;
    margin-top: 6px;
}

.fxt-quiz-input,
.fxt-quiz textarea,
.fxt-quiz select {
    border: 1px solid var(--fxtq-border);
    border-radius: 6px;
    font: inherit;
    min-height: 38px;
    padding: 8px 10px;
    width: 100%;
}

.fxt-quiz textarea {
    min-height: 86px;
    resize: vertical;
}

.fxt-quiz-auth__form {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.fxt-quiz-terms {
    background: #fff;
    border: 1px solid var(--fxtq-border);
    border-radius: 6px;
    color: #283548;
    line-height: 1.45;
    max-height: 220px;
    overflow: auto;
    padding: 12px;
    white-space: pre-wrap;
}

.fxt-quiz-check {
    align-items: flex-start;
    display: flex;
    gap: 8px;
    line-height: 1.4;
}

.fxt-quiz-warning,
.fxt-quiz-status {
    color: var(--fxtq-warn);
    font-size: 13px;
}

.fxt-quiz-question {
    background: #eef7f3;
    border: 1px solid #bee3d4;
    border-radius: 8px;
    color: #000;
    margin: 12px 0;
    padding: 12px;
}

.fxt-quiz-question__title {
    color: #000;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 8px;
}

.fxt-quiz-countdown {
    color: #000;
    font-weight: 700;
    margin-bottom: 10px;
}

.fxt-quiz-choices {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fxt-quiz-choice {
    background: #ffffff;
    color: #000;
    text-align: left;
}

.fxt-quiz-choice:hover:not(:disabled),
.fxt-quiz-choice.is-selected {
    background: #dff3ea;
    border-color: var(--fxtq-accent);
    color: #000;
}

.fxt-quiz-choice.is-correct {
    background: #d1fae5;
    border-color: #15803d;
    color: #052e16;
    font-weight: 800;
    opacity: 1;
}

.fxt-quiz-choice.is-wrong {
    background: #fee2e2;
    border-color: #b91c1c;
    color: #450a0a;
    font-weight: 800;
    opacity: 1;
}

.fxt-quiz-choice.is-disabled {
    cursor: default;
}

.fxt-quiz-choice:disabled {
    color: #000;
    cursor: default;
    opacity: 0.72;
}

.fxt-quiz-choice.is-correct:disabled,
.fxt-quiz-choice.is-wrong:disabled {
    opacity: 1;
}

.fxt-quiz-choice.is-correct:disabled {
    color: #052e16;
}

.fxt-quiz-choice.is-wrong:disabled {
    color: #450a0a;
}

.fxt-game-card {
    align-items: center;
    background: #fff;
    border: 1px solid var(--fxtq-border);
    border-radius: 8px;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin: 14px 0;
    padding: 14px;
}

.fxt-game-card h3,
.fxt-game-card p {
    margin: 0;
}

.fxt-game-card p {
    color: var(--fxtq-muted);
    margin-top: 4px;
}

.fxt-quiz-messages {
    background: #fbfcff;
    border: 1px solid var(--fxtq-border);
    border-radius: 8px;
    height: 360px;
    overflow: auto;
    padding: 10px;
}

.fxt-quiz-load-older {
    justify-self: flex-start;
    margin-bottom: 8px;
}

.fxt-quiz-message {
    border-bottom: 1px solid #eef1f6;
    padding: 8px 0;
}

.fxt-quiz-message:last-child {
    border-bottom: 0;
}

.fxt-quiz-message__meta {
    color: var(--fxtq-muted);
    font-size: 12px;
    margin-bottom: 3px;
}

.fxt-quiz-message__text {
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.fxt-quiz-message--system .fxt-quiz-message__text,
.fxt-quiz-message--leaderboard .fxt-quiz-message__text {
    color: var(--fxtq-accent-dark);
    font-weight: 700;
}

.fxt-quiz-message--question .fxt-quiz-message__text {
    color: #1d4ed8;
    font-weight: 700;
}

.fxt-quiz-message--error .fxt-quiz-message__text {
    color: var(--fxtq-danger);
}

.fxt-quiz-message--warning .fxt-quiz-message__text {
    color: var(--fxtq-warn);
}

.fxt-quiz-chat {
    margin-top: 10px;
}

.fxt-quiz-chat .fxt-quiz-input {
    flex: 1;
}

.fxt-quiz-stats,
.fxt-quiz-leaders {
    border-top: 1px solid var(--fxtq-border);
    display: grid;
    gap: 6px;
    padding-top: 12px;
}

.fxt-quiz-suggest {
    align-items: center;
    background: rgba(10, 18, 30, 0.45);
    bottom: 0;
    display: flex;
    justify-content: center;
    left: 0;
    padding: 16px;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 9999;
}

.fxt-quiz-suggest[hidden] {
    display: none;
}

.fxt-quiz-suggest__box {
    background: #fff;
    border-radius: 8px;
    display: grid;
    gap: 10px;
    max-width: 560px;
    padding: 16px;
    width: min(100%, 560px);
}

@media (max-width: 760px) {
    .fxt-quiz-backdrop {
        align-items: stretch;
        padding: 8px;
    }

    .fxt-quiz-modal {
        max-height: 96vh;
        padding: 10px;
        width: 100%;
    }

    .fxt-quiz-modal__header {
        align-items: flex-start;
    }

    .fxt-quiz-layout {
        grid-template-columns: 1fr;
    }

    .fxt-quiz__header,
    .fxt-quiz-topbar,
    .fxt-quiz-chat {
        align-items: stretch;
        flex-direction: column;
    }

    .fxt-quiz-choices {
        grid-template-columns: 1fr;
    }

    .fxt-quiz-messages {
        height: 300px;
    }
}
