@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
    --primary-bg: #f4f7f6;
    --container-bg: #ffffff;
    --text-color: #333;
    --primary-color: #7B1FA2;
    --primary-hover: #6A1B9A;
    --correct-color: #28a745;
    --incorrect-color: #dc3545;
    --border-color: #dee2e6;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.gss-scramble-container {
    font-family: 'Roboto', sans-serif;
    color: var(--text-color);
    box-sizing: border-box;
    width: 100%;
}

.gss-scramble.test-container {
    background-color: var(--container-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem 2.5rem;
    text-align: center;
    width: 100%;
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.question-content-wrapper {
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.question-content-wrapper.fade-out {
    opacity: 0;
    transform: translateY(-15px);
}

.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.topic-heading {
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 500;
    text-align: left;
}

.progress-text {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

.gss-chunks-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 1rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    min-height: 50px;
}

.gss-chunks-container.correct {
    border-color: var(--correct-color);
}

.gss-chunks-container.incorrect {
    border-color: var(--incorrect-color);
}

.gss-chunk {
    background-color: #F3E5F5;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    cursor: grab;
    transition: all 0.2s ease;
    color: var(--text-color);
    font-weight: 500;
    margin: 5px;
    transition: transform 0.2s ease-in-out;
}

.gss-chunk.placeholder {
    background-color: #e0e0e0;
    border-color: #bdbdbd;
}

.gss-chunk.correct, .gss-chunk.incorrect {
    position: relative;
    overflow: hidden;
}

.gss-chunk.correct {
    background-color: #d1e7dd;
    border-color: var(--correct-color);
    color: #0a3622;
}

.gss-chunk.incorrect {
    background-color: #f8d7da;
    border-color: var(--incorrect-color);
    color: #58151c;
}

.gss-chunk.correct::after, .gss-chunk.incorrect::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
    animation: splash-explosion 0.5s ease-out;
}

.gss-chunk.correct::after {
    background: rgba(40, 167, 69, 0.5);
}

.gss-chunk.incorrect::after {
    background: rgba(220, 53, 69, 0.5);
}

@keyframes splash-explosion {
    from {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    to {
        transform: translate(-50%, -50%) scale(20);
        opacity: 0;
    }
}

.gss-chunk:active {
    cursor: grabbing;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mute-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
}

.check-button-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.action-buttons-container {
    margin-top: 1rem;
    padding-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-btn,
.next-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 2.5rem;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

.back-btn:disabled,
.next-btn:disabled,
.back-btn:disabled:hover,
.next-btn:disabled:hover {
    background-color: #adb5bd;
    cursor: not-allowed;
}

.back-btn:hover,
.next-btn:hover {
    background-color: var(--primary-hover);
}

.explanation-box {
    background-color: #e0f2f7;
    padding: 15px;
    border: 1px solid #b0dff2;
    border-radius: 5px;
    font-size: 0.9em;
    line-height: 1.5;
    margin-top: 1rem;
    text-align: left;
}

.results-container {
    background-color: var(--container-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem 2.5rem;
    text-align: center;
    width: 100%;
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.results-container .results-title {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.results-summary .score-text {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    max-width: 300px;
    margin: 0 auto 2rem;
}

.view-answers-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 2.5rem;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

.view-answers-btn:hover {
    background-color: var(--primary-hover);
}

.back-btn.shake,
.next-btn.shake {
    animation: shake-flash 0.5s;
}

@keyframes shake-flash {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-8px);
    }
    50% {
        transform: translateX(8px);
    }
    75% {
        transform: translateX(-8px);
    }
}
